'));\r\n newDescription = newDescription.substr(stringChop[0]);\r\n\r\n this.eventDescription = newDescription;\r\n\r\n }\r\n\r\n getMemberDesignerItem(member: MemberDesignersLicensesBasicsResponse, license: MemberDesignersLicenseItem) {\r\n\r\n // merge the right data\r\n const data = new MemberDesignersLicensesBasicsResponse();\r\n\r\n data.Email = member.Email;\r\n data.Name = member.Name;\r\n data.Phone = member.Phone;\r\n\r\n data.Keys = new MemberDesignersLicenseItemArray();\r\n data.Keys.push(new MemberDesignersLicenseItem());\r\n\r\n data.Keys[0].CompatibilityToken = license.CompatibilityToken;\r\n data.Keys[0].Key = license.Key;\r\n data.Keys[0].Product = license.Product;\r\n data.Keys[0].ID = license.ID;\r\n data.Keys[0].SoftwareVersion = license.SoftwareVersion;\r\n data.Keys[0].PastDue = license.PastDue;\r\n data.Keys[0].TOS = license.TOS;\r\n data.Keys[0].Registered = license.Registered;\r\n\r\n\r\n return data;\r\n }\r\n\r\n getRequest(): RegisterForTrainingEventRequest {\r\n\r\n const request = new RegisterForTrainingEventRequest();\r\n let member;\r\n\r\n // because there is a bug on selected items we have to make sure\r\n // that the value is a valid object\r\n if (this.SelectedLicense == undefined)\r\n // we didnt select an object, take the 1st\r\n member = this.LicensesSelectItems[0].value;\r\n else\r\n // we selected an object. check if the data is in value or not\r\n member = this.SelectedLicense;\r\n\r\n request.AlternateEmail = \"\";\r\n request.AlternatePhone = \"\";\r\n request.LicenseID = member.Keys[0].ID;\r\n request.TrainingEventID = this.event.ID;\r\n return request;\r\n }\r\n\r\n confirm() {\r\n\r\n const request = this.getRequest();\r\n\r\n confirm;\r\n Swal.fire({\r\n title: this.confirmTitle,\r\n text: this.confirmMessage,\r\n icon: 'warning',\r\n showCancelButton: true,\r\n showCloseButton: true,\r\n confirmButtonText: 'Yes',\r\n cancelButtonText: 'No',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n preConfirm: () => {\r\n // try to process\r\n return this.api.RegisterForTrainingEvent(request).toPromise();\r\n }\r\n })\r\n .then(\r\n (response: any) => {\r\n\r\n // init dialog vars\r\n let cType = 'success';\r\n let cTitle = this.successTitle;\r\n let cMessage = this.successMessage;\r\n\r\n if (response.isDismissed) {\r\n cType = 'error';\r\n cTitle = this.cancelledTitle;\r\n cMessage = this.cancelledMessage;\r\n } else if (!response.value || !response.value.Result) {\r\n // not ok\r\n cType = 'error';\r\n cTitle = this.errorTitle;\r\n cMessage = response.value.Message;\r\n }\r\n\r\n if (cMessage == \"New License\") {\r\n // show custom result\r\n Swal.fire(\r\n {\r\n title: \"New License\",\r\n html: \"Before registering for this advanced class, please attend a Fundamentals Workshop. If you have any questions, give us a call at 702-433-0274.
\",\r\n icon: cType as SweetAlertIcon,\r\n showCancelButton: false,\r\n showConfirmButton: true\r\n })\r\n .then(() => { this.result = true; this.close(); }, () => { this.close(); }); // keep this line to prevent promise error;\r\n } else {\r\n // show result\r\n Swal.fire(\r\n {\r\n title: cTitle,\r\n text: cMessage,\r\n icon: cType as SweetAlertIcon,\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1500\r\n })\r\n .then(() => { this.result = true; this.close(); }, () => { this.close(); }); // keep this line to prevent promise error;\r\n }\r\n\r\n },\r\n (dismiss) => {\r\n if (dismiss === 'cancel') {\r\n\r\n if (!confirm)\r\n return;\r\n\r\n // show cancelled\r\n Swal.fire({\r\n title: this.cancelledTitle,\r\n text: this.cancelledMessage,\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1000\r\n })\r\n .then(() => { this.close(); }, () => { this.close(); }); // keep this line to prevent promise error;\r\n }\r\n });\r\n\r\n this.result = true;\r\n }\r\n\r\n cancel() {\r\n // we set dialog result as true on click on confirm button,\r\n // then we can get dialog result from caller code\r\n this.result = false;\r\n this.close();\r\n }\r\n\r\n toggleIsBusy() {\r\n this.isBusy = !this.isBusy;\r\n }\r\n\r\n RegistrationAvailable(): boolean {\r\n if (this.eventData.IsExpired)\r\n return false;\r\n\r\n //out of date\r\n if (!this.isValidVersion() && this.SelectedLicense)\r\n return false;\r\n\r\n //past due license\r\n if (this.isPastDue())\r\n return false;\r\n\r\n //tos\r\n if (this.isTOS())\r\n return false;\r\n\r\n if (!this.isRegistered())\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n}\r\n","import * as moment from 'moment';\r\nimport { Component, OnInit } from '@angular/core';\r\nimport { DialogService } from 'primeng/dynamicdialog';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport Swal from 'sweetalert2';\r\nimport { GlobalServices } from '../../services/global.service';\r\nimport { TrainingEvent } from '../../models/domain/training.event';\r\nimport { TrainingCalendarRequest } from 'app/models/ss-api/requests/training.calendar.request';\r\nimport { TrainingClass } from 'app/models/domain/training.class';\r\nimport { TrainingHistoryResponse } from 'app/models/ss-api/responses/training.history.response';\r\nimport { EventRegistrationDialogComponent } from '../event-registration/event-registration-dialog.component';\r\nimport { UpdateTrainingEventSubscriptionStatusRequest } from 'app/models/ss-api/requests/update.training.event.subscription.status.request';\r\nimport { AttendanceStatusTypes } from 'app/models/domain/training.event.subscription';\r\nimport {DynamicDialogRef} from 'primeng/dynamicdialog';\r\nimport {DynamicDialogConfig} from 'primeng/dynamicdialog';\r\n\r\nexport interface IEventRescheduleDialogModel {\r\n Event: TrainingHistoryResponse;\r\n LicenseID: number;\r\n}\r\n\r\nclass CalendarEvent {\r\n title: String;\r\n start: Date;\r\n end: Date;\r\n event: TrainingEvent;\r\n}\r\n\r\n@Component({\r\n selector: 'event-reschedule-dialog',\r\n styleUrls: ['./event-reschedule-dialog.component.css'],\r\n templateUrl: './event-reschedule-dialog.component.html'\r\n})\r\n\r\nexport class EventRescheduleDialogComponent implements OnInit {\r\n Events: Array;\r\n Event: TrainingHistoryResponse;\r\n MinimumTrainingVersionv2: string;\r\n MinimumTrainingVersionv3: string;\r\n CurrentTrainingVersion: string;\r\n\r\n isBusy: boolean = true;\r\n\r\n constructor(\r\n private dialogService: DialogService,\r\n public ref: DynamicDialogRef,\r\n public config: DynamicDialogConfig,\r\n private api: ssApiService, private gb: GlobalServices) {\r\n }\r\n\r\n ngOnInit() {\r\n this.Event = this.config.data.Event;\r\n\r\n this.LoadEvents();\r\n }\r\n\r\n close() {\r\n this.ref.close();\r\n }\r\n\r\n LoadEvents() {\r\n let request: TrainingCalendarRequest = new TrainingCalendarRequest();\r\n let tempEvents = [];\r\n request.StartDate = moment().toDate();\r\n request.EndDate = moment().add(30, 'days').toDate();\r\n\r\n let disposable = this.api.GetMemberTrainingCalendar(request).subscribe(response => {\r\n this.MinimumTrainingVersionv2 = response.Data.TrainingMinimumSoftwareVersionv2;\r\n this.MinimumTrainingVersionv3 = response.Data.TrainingMinimumSoftwareVersionv3;\r\n this.CurrentTrainingVersion = response.Data.CurrentSoftwareVersion;\r\n\r\n response.Data['TrainingEvents'].forEach(function(e: TrainingEvent) {\r\n let trainingClass: TrainingClass = response.Data['TrainingClasses'].filter(c => c.ID == e.TrainingClassID)[0];\r\n if (e.ID != this.Event.EventID && trainingClass.ProductIDs.indexOf(this.Event.Product_ID) >= 0) {\r\n let duration = moment(trainingClass.ClassDuration, 'hh:mm:ss');\r\n let eventTemplate: CalendarEvent = new CalendarEvent();\r\n\r\n eventTemplate.title = trainingClass.ClassTitle;\r\n eventTemplate.start = new Date(e.EventDateTime);\r\n eventTemplate.end = moment(e.EventDateTime).add({hours: duration.hours(), minutes: duration.minutes()}).toDate();\r\n eventTemplate.event = e;\r\n eventTemplate.event.TrainingClass = trainingClass;\r\n\r\n tempEvents.push(eventTemplate);\r\n }\r\n }, this);\r\n\r\n this.Events = tempEvents;\r\n this.isBusy = false;\r\n\r\n disposable.unsubscribe();\r\n });\r\n }\r\n\r\n RegisterForClass(event: TrainingEvent) {\r\n if (moment().isAfter(moment(this.Event.EventDateTime).subtract(15, 'minutes'))) {\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'Class Closed',\r\n text: 'Open registration for this class is now closed. Please select a different class.'\r\n });\r\n } else {\r\n this.dialogService.open(EventRegistrationDialogComponent, {data: {\r\n title: 'Test Title',\r\n subTitle: 'Another Test',\r\n event: event,\r\n minimumVersionv2: this.MinimumTrainingVersionv2,\r\n minimumVersionv3: this.MinimumTrainingVersionv3,\r\n currentVersion: this.CurrentTrainingVersion,\r\n licenseID: this.Event.License_ID\r\n }});\r\n this.isBusy = true;\r\n let request = new UpdateTrainingEventSubscriptionStatusRequest();\r\n request.AttendanceStatusType = AttendanceStatusTypes.Rescheduled;\r\n request.TrainingEventSubscriptionID = Number(this.Event.TrainingEventSubscriptionID);\r\n let disposable = this.api.UpdateTrainingEventSubscriptionStatus(request).subscribe(r => {\r\n Swal.fire({\r\n icon: 'success',\r\n title: 'Successfully Rescheduled',\r\n text: 'You have rescheduled to a new class. Please check your email for your registration confirmation.'\r\n }).then(() => {\r\n this.close();\r\n });\r\n disposable.unsubscribe();\r\n });\r\n }\r\n }\r\n\r\n TrainingEventForEvent(event: TrainingEvent): TrainingEvent {\r\n let trainingEvent: TrainingEvent;\r\n\r\n this.Events.forEach(function(training) {\r\n if (training.event.ID == event.ID) {\r\n trainingEvent = training.event;\r\n }\r\n });\r\n\r\n return trainingEvent;\r\n }\r\n\r\n ProductsForEvent(event: TrainingEvent) {\r\n let productHTML = '';\r\n let productBorder = '';\r\n\r\n event.TrainingClass.ProductIDs.forEach(function(product) {\r\n let icon = '';\r\n let color = '#000';\r\n switch (product) {\r\n case 5:\r\n icon = '../../assets/images/icons/logo-icons-vip3d-xs.png';\r\n color = '#0064DF';\r\n break;\r\n case 8:\r\n icon = '../../assets/images/icons/logo-icons-pool-studio-xs.png';\r\n color = '#FF0000';\r\n break;\r\n case 9:\r\n icon = '../../assets/images/icons/logo-icons-vizterra-xs.png';\r\n color = '#64A000';\r\n break;\r\n default:\r\n return false;\r\n }\r\n productHTML += '
';\r\n productBorder += '';\r\n }, this);\r\n\r\n return {\r\n ProductIcons : productHTML,\r\n ProductBorder: productBorder\r\n };\r\n }\r\n\r\n}\r\n","import { ResumeLicenseSimulationResponse } from './../../models/ss-api/responses/resume.license..simulation.response';\r\nimport { ResumeLicenseSimulationRequest } from 'app/models/ss-api/requests/resume.license.simulation.request';\r\nimport { ResumeLicenseRequest } from './../../models/ss-api/requests/resume.license.request';\r\nimport { CheckHoldEligibilityResponse } from './../../models/ss-api/responses/check.hold.eligibility.response';\r\nimport { HoldRequest } from 'app/models/ss-api/requests/hold.request';\r\nimport { HoldPricingArray, HoldPricing } from './../../models/ss-api/responses/hold.pricing';\r\nimport { ssApiService } from '../../services/ss-api.service';\r\nimport { Component, OnInit } from '@angular/core';\r\n\r\nimport Swal from 'sweetalert2';\r\nimport { GlobalServices } from '../../services/global.service';\r\nimport * as moment from 'moment';\r\nimport { CancellationRequestDialogComponent } from '../cancellation-request/cancellation-request-dialog.component';\r\nimport { DashboardLicenseResponse } from 'app/models/ss-api/responses/dashboard.license.response';\r\nimport { SelectItem } from 'primeng/api';\r\nimport { CreditCardResponseArray } from 'app/models/ss-api/responses/credit.card.response';\r\nimport {DynamicDialogRef} from 'primeng/dynamicdialog';\r\nimport {DynamicDialogConfig} from 'primeng/dynamicdialog';\r\n\r\nexport interface IHoldDialogModel {\r\n License: DashboardLicenseResponse;\r\n CreditCards: SelectItem[];\r\n HoldResponse : CheckHoldEligibilityResponse;\r\n}\r\n\r\nexport enum HoldRequestDialogResultTypes {\r\n\tcancelled = 0,\r\n\tsuccess = 1,\r\n\tshowCancel = 10,\r\n\terror = 99\r\n}\r\n\r\n@Component({\r\n selector: 'hold-request-dialog',\r\n styleUrls: ['./hold-request-dialog.component.scss'],\r\n templateUrl: './hold-request-dialog.component.html'\r\n})\r\nexport class HoldRequestDialogcomponent implements IHoldDialogModel, OnInit {\r\n IsBusy: boolean = true;\r\n\r\n\tresult = HoldRequestDialogResultTypes.cancelled;\r\n\r\n License: DashboardLicenseResponse;\r\n CreditCards: SelectItem[];\r\n HoldResponse : CheckHoldEligibilityResponse;\r\n Credit;\r\n State: string;\r\n TaxRateDisplay: string;\r\n isMobile: boolean;\r\n\r\n\r\n showHoldDuration : boolean = false;\r\n\r\n clickedOK : boolean = false;\r\n\r\n Options: HoldPricingArray;\r\n SelectedOption: HoldPricing;\r\n\r\n\tSelectedOptionResumeDate : Date;\r\n\r\n step = 1;\r\n\r\n showAddCreditCard: boolean;\r\n SelectedCreditCard;\r\n Initials : string = \"hold\";\r\n ShowTimeline: boolean = false;\r\n\r\n\tOriginalTitle : string = '';\r\n\tOriginalSubTitle : string = '';\r\n\r\n Title = 'Hold Your Membership';\r\n Subtitle = 'Sometimes you just need a break. Keep your GIS credits, avoid the set up fee.';\r\n\r\n OptionTitle = 'Select An Option';\r\n\r\n\r\n\tlabel_HoldOK : string = \"Confirm Hold Membership\";\r\n\tlabel_Next : string = \"Hold Membership\";\r\n\r\n\ttoday : Date = new Date();\r\n\r\n ResumeSimulationResponse: ResumeLicenseSimulationResponse;\r\n\r\n constructor(\r\n public ref: DynamicDialogRef,\r\n public config: DynamicDialogConfig,\r\n private api: ssApiService,\r\n private gb: GlobalServices\r\n ) {\r\n }\r\n\r\n ngOnInit() {\r\n this.License = this.config.data.License;\r\n this.CreditCards = this.config.data.CreditCards;\r\n this.HoldResponse = this.config.data.HoldResponse;\r\n this.isMobile = this.config.data.isMobile;\r\n console.log(this.License);\r\n\t\t\r\n\t\tconsole.log(\"CreditCards :\", this.CreditCards);\r\n\r\n this.GetCredit();\r\n\r\n\t\tconsole.log(\"HoldStartDate : \", this.License.HoldStartDate);\r\n\r\n\t\tconsole.log(\"Holdresponse : \", this.HoldResponse);\r\n\r\n this.State = this.HoldResponse.State;\r\n this.TaxRateDisplay = this.HoldResponse.TaxRateDisplay;\r\n\r\n if(this.HoldResponse.HoldPrices) {\r\n this.Options = this.HoldResponse.HoldPrices;\r\n\r\n\t\t\tthis.SelectedOption = this.Options[0];\r\n\r\n\t\t\tthis.Options.forEach( o => {\r\n\t\t\t\tif( o.IsSelected )\r\n\t\t\t\t\tthis.SelectedOption = o;\r\n\t\t\t});\r\n\t\t\r\n\t\t}\r\n\r\n\t\tconsole.log(\"Options : \", this.Options);\r\n\r\n\t\t// UPDATE TILES\r\n\t\tif( this.License.IsOnHold ) {\r\n\t\t\t// LICENSE IS ON HOLD\r\n\t\t\tthis.Title = 'Membership on Hold';\r\n\t\t\tthis.Subtitle = 'Membership resumes on ' + moment(this.License.HoldEndDate).format('MMMM Do, YYYY');\r\n\t\t} else if ( this.License.IsScheduledHold ) {\r\n\t\t\t// LICENSE IS SCHEDULED FOR HOLD\r\n\t\t\tthis.Title = 'Hold Starting Soon';\r\n\t\t\tthis.Subtitle = 'Your hold will begin on ' + moment(this.License.HoldStartDate).format('MMMM Do, YYYY') + \r\n\t\t\t\t\t'
and resume automatically on ' + moment(this.License.HoldEndDate).format('MMMM Do, YYYY');\r\n\t\t}\r\n\r\n\t\tthis.OriginalTitle = this.Title;\r\n\t\tthis.OriginalSubTitle = this.Subtitle;\r\n\r\n if (this.License.IsOnHold || this.License.IsScheduledHold ) {\r\n\t\t\t//UPDATE LABELS FOR EXTEND HOLD OPTIONS\r\n\t\t\tthis.label_Next = \"Extend Hold\";\r\n\t\t\tthis.label_HoldOK = \"Confirm Hold Extension\"; \r\n\t\t}\r\n\t\t\r\n\r\n if (this.CreditCards != undefined) {\r\n this.SelectedCreditCard = this.CreditCards[0].value;\r\n\t\t}\r\n\t\t\r\n\t\tthis.InitializeHoldResumeDate();\r\n\t\t\r\n\r\n }\r\n\r\n close() {\r\n this.ref.close(this.result);\r\n }\r\n\r\n ToggleSelectedOption(option) {\r\n\t\t\r\n\t\tif (option.IsAvailable) {\r\n\t\t\t\r\n\t\t\tthis.SelectedOption = option;\t\r\n\t\t\tthis.UpdateHoldResumeDate();\r\n\r\n\t\t\tthis.showHoldDuration = true;\r\n\r\n\t\t}\r\n\t\t\r\n\t}\r\n\t\r\n\tInitializeHoldResumeDate() {\r\n\t\tif( this.License.IsOnHold ) {\r\n\t\t\tthis.SelectedOptionResumeDate = this.License.HoldEndDate;\r\n\t\t} else {\r\n\t\t\tthis.SelectedOptionResumeDate = new Date( moment(this.License.NextBillingDate).add( 1, 'months' ).toString() );\r\n\t\t}\r\n\t}\r\n\r\n\tUpdateHoldResumeDate() {\r\n\t\t\r\n\t\tlet resumeDate : Date = this.License.IsOnHold ? this.License.HoldEndDate : this.License.NextBillingDate;\r\n\r\n\t\tlet addMonths : number = this.SelectedOption.Months;\r\n\r\n\t\tif( this.License.IsOnHold ) {\r\n\t\t\tthis.Options.forEach( o => {\r\n\t\t\t\tif( o.IsSelected )\r\n\t\t\t\t\taddMonths -= o.Months;\r\n\t\t\t});\r\n\t\t}\r\n\t\t\r\n\r\n\t\tthis.SelectedOptionResumeDate = new Date( moment( resumeDate ).add( addMonths, 'months' ).toString() );\r\n\r\n\t}\r\n\r\n\tGetHoldDays( days : number ) : number {\r\n\r\n\r\n\t\tthis.Options.forEach( o => {\r\n\t\t\tif( o.IsSelected )\r\n\t\t\t\tdays -= o.Days;\r\n\t\t});\r\n\r\n\t\treturn days;\r\n\r\n\t}\r\n\r\n\r\n\tHoldStartedDate( nextBillingDate : Date ) : Date {\r\n\t\treturn new Date( moment( nextBillingDate ).add( -1, 'months' ).toString() );\r\n\t}\r\n\r\n\r\n ShowCancelDialog() {\r\n\t\t\r\n\t\tthis.result = HoldRequestDialogResultTypes.showCancel;\r\n\t\tthis.close();\r\n\r\n\t}\r\n\t\r\n\r\n\r\n GetOptions() {\r\n this.IsBusy = true;\r\n let disposable = this.api.CheckHoldEligibility(this.License.Key).subscribe(response => {\r\n this.IsBusy = false;\r\n if (response.Data.HoldEligible) {\r\n this.Options = response.Data.HoldPrices;\r\n }\r\n disposable.unsubscribe();\r\n });\r\n }\r\n\r\n GetCredit() {\r\n this.IsBusy = true;\r\n\r\n let subscription = this.api.MemberCredit().subscribe(response => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n this.Credit = response.Data;\r\n }, error => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n });\r\n }\r\n\r\n\r\n cardAdded({cards, newCardId}: {cards: CreditCardResponseArray, newCardId: number}) {\r\n this.showAddCreditCard = false;\r\n this.updateCreditCardOptions(cards);\r\n this.SelectedCreditCard = newCardId;\r\n }\r\n\r\n updateCreditCardOptions( newCards: CreditCardResponseArray ) {\r\n this.CreditCards = [];\r\n newCards.forEach(card => {\r\n this.CreditCards.push(\r\n {\r\n label: 'Name: ' + card.FirstName + ' ' + card.LastName +\r\n ' - Last four: ' + card.LastFour +\r\n ' - exp. Date: ' + card.ExpMonth + '/' + card.ExpYear,\r\n value: card.ID\r\n });\r\n });\r\n }\r\n\r\n addCardCanceled() {\r\n this.showAddCreditCard = false;\r\n }\r\n\r\n\r\n\tnextStep() {\r\n\t\tthis.step += 1;\r\n\t\tthis.UpdateStepTitles();\r\n\t}\r\n\r\n previousStep() {\r\n\t\tthis.step -= 1;\r\n\t\tthis.UpdateStepTitles();\r\n }\r\n\r\n goToStep(step) {\r\n\t\tthis.step = step;\r\n\t\tthis.UpdateStepTitles();\r\n\t}\r\n\t\r\n\tUpdateStepTitles() {\r\n\t\tswitch (this.step) {\r\n\t\t\tcase 1:\r\n\t\t\t\tthis.Title = this.OriginalTitle;\r\n\t\t\t\tthis.Subtitle = this.OriginalSubTitle;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 2:\r\n\t\t\t\tthis.Title = this.License.IsOnHold || this.License.IsScheduledHold ? 'Extend Your Hold' : 'Hold Your Membership';\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 5:\r\n\t\t\t\tthis.Title = 'Resume Membership';\r\n\t\t\t\tthis.Subtitle = 'Membership will be available immediately';\r\n\t\t\t\tbreak;\r\n\r\n\t\t}\r\n\t}\r\n\r\n CreditUsed(): number {\r\n let price = this.SelectedOption.PriceWithTax;\r\n\r\n if (this.HoldResponse.IsExtension) {\r\n price = this.SelectedOption.ExtensionPriceWithTax;\r\n }\r\n\r\n if (this.Credit > price) {\r\n return price;\r\n } else {\r\n return this.Credit;\r\n }\r\n }\r\n\r\n PriceDue(): number {\r\n let credit = this.CreditUsed();\r\n\r\n let price = this.SelectedOption.PriceWithTax;\r\n\r\n if (this.HoldResponse.IsExtension) {\r\n price = this.SelectedOption.ExtensionPriceWithTax;\r\n }\r\n\r\n return price - credit;\r\n }\r\n\r\n CreditCardChanged(event) {\r\n console.log(event);\r\n console.log(this.SelectedCreditCard);\r\n }\r\n\r\n IsWithinCreditPeriod() {\r\n return moment().isBefore(moment(this.License.HoldEndDate));\r\n }\r\n\r\n ResumeProductPrice() {\r\n if (this.ResumeSimulationResponse.TotalPrice === 0) {\r\n return 0;\r\n } else {\r\n return this.ResumeSimulationResponse.ProductPrice;\r\n }\r\n }\r\n\r\n OtherCreditUsed() : number {\r\n let otherCreditUsed : number = 0;\r\n let data = this.ResumeSimulationResponse;\r\n\r\n let otherCreditNeeded = data.Total - data.HoldCredit;\r\n\r\n if ( otherCreditNeeded > 0 && data.OtherCredit > 0 ) {\r\n if ( otherCreditNeeded > data.OtherCredit ) {\r\n otherCreditUsed = data.OtherCredit;\r\n } else {\r\n otherCreditUsed = otherCreditNeeded;\r\n }\r\n }\r\n\r\n return otherCreditUsed;\r\n }\r\n\r\n ResumeLicense() {\r\n this.IsBusy = true;\r\n\r\n if (this.step === 1) {\r\n let request: ResumeLicenseSimulationRequest = {\r\n LicenseKey: this.License.Key,\r\n Initials: 'aa'\r\n };\r\n\r\n let disposable = this.api.ResumeLicenseSimulation(request).subscribe(response => {\r\n if (response.Result && response.Data.ResumePossible) {\r\n this.ResumeSimulationResponse = response.Data;\r\n\t\t\t\t\tthis.step = 5;\r\n\t\t\t\t\tthis.UpdateStepTitles();\r\n } else {\r\n let message;\r\n if (response.Result) {\r\n message = response.Data.ResumeNotPossibleReason;\r\n } else {\r\n message = response.Message;\r\n }\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'Cannot Resume Membership',\r\n text: message\r\n }).then( () => {}, () => {} );\r\n }\r\n this.IsBusy = false;\r\n disposable.unsubscribe();\r\n });\r\n } else if (this.step === 5) {\r\n let request: ResumeLicenseRequest = new ResumeLicenseRequest();\r\n\r\n if (this.ResumeSimulationResponse.HoldStarted == false ) {\r\n request.CreditCardID = this.CreditCards[0].value;\r\n request.LicenseKey = this.License.Key;\r\n request.Initials = 'resumedPendingHold';\r\n } else {\r\n request.CreditCardID = this.SelectedCreditCard;\r\n request.LicenseKey = this.License.Key;\r\n request.Initials = this.Initials;\r\n }\r\n\r\n let disposable = this.api.ResumeLicense(request).subscribe(response => {\r\n console.log(response);\r\n this.IsBusy = false;\r\n if (response.Result) {\r\n\r\n\t\t\t\t\tthis.result = HoldRequestDialogResultTypes.success;\r\n\r\n Swal.fire({\r\n icon: 'success',\r\n title: 'Membership Resumed',\r\n text: 'Your membership is now active and available for use'\r\n\t\t\t\t\t}).then( () => { this.close() }, () => { this.close() } );\r\n\t\t\t\t\t\r\n } else {\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'Cannot Resume Membership',\r\n text: response.Message\r\n }).then( () => {}, () => {} );\r\n }\r\n disposable.unsubscribe();\r\n });\r\n }\r\n\r\n \r\n\r\n }\r\n\r\n HoldDate() {\r\n return moment(this.License.NextBillingDate).format('MMMM DD, YYYY');\r\n }\r\n\r\n ResumeDate() {\r\n if (this.HoldResponse.IsExtension) {\r\n return moment(this.License.HoldStartDate).add(this.SelectedOption.Months, 'months').format('MMMM DD, YYYY');\r\n } else {\r\n return moment(this.License.NextBillingDate).add(this.SelectedOption.Months, 'months').format('MMMM DD, YYYY');\r\n }\r\n }\r\n\r\n confirm() {\r\n this.clickedOK = true;\r\n this.IsBusy = true;\r\n \r\n // waiting on endpoint\r\n let request: HoldRequest = {\r\n CreditCardID: this.SelectedCreditCard,\r\n HoldItemID: this.SelectedOption.ID,\r\n LicenseKey: this.License.Key,\r\n Initials: this.Initials\r\n };\r\n\r\n if (this.HoldResponse.IsExtension) {\r\n let disposable = this.api.ExtendHoldLicense(request).subscribe(response => {\r\n\t\t\t\tdisposable.unsubscribe();\r\n\t\t\t\tif(response.Result) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tthis.result = HoldRequestDialogResultTypes.success;\r\n\r\n\t\t\t\t\tSwal.fire({\r\n icon: 'success',\r\n title: 'Hold Extended',\r\n text: 'Your Membership will resume on ' + moment(response.Data.HoldEndDate).format('MMMM Do, YYYY')\r\n }).then( () => {\r\n this.close();\r\n }, () => {\r\n this.close();\r\n\t\t\t\t\t} );\r\n\t\t\t\t\t\r\n } else {\r\n\r\n\t\t\t\t\tthis.result = HoldRequestDialogResultTypes.error;\r\n\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'Could Not Extend Hold',\r\n text: response.Message\r\n }).then( () => {\r\n this.close();\r\n }, () => {\r\n this.close();\r\n } );\r\n }\r\n \r\n // this.IsBusy = false;\r\n })\r\n } else {\r\n let disposable = this.api.HoldLicense(request).subscribe(response => {\r\n\t\t\t\tdisposable.unsubscribe();\r\n\t\t\t\tif (response.Result) {\r\n\r\n\t\t\t\t\tthis.result = HoldRequestDialogResultTypes.success;\r\n\t\t\t\t\t\r\n\t\t\t\t\tSwal.fire({\r\n icon: 'success',\r\n title: 'Hold Successful',\r\n text: 'Your Membership will resume on ' + moment(response.Data.HoldEndDate).format('MMMM Do, YYYY')\r\n }).then( () => {\r\n this.close();\r\n }, () => {\r\n this.close();\r\n } );\r\n\t\t\t\t\r\n\t\t\t\t} else {\r\n\t\t\t\t\t\r\n\t\t\t\t\tthis.result = HoldRequestDialogResultTypes.error;\r\n\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'Error',\r\n text: response.Message\r\n }).then( () => {\r\n this.close();\r\n }, () => {\r\n this.close();\r\n\t\t\t\t\t} );\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n //this.IsBusy = false;\r\n \r\n });\r\n }\r\n }\r\n\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\n\r\nimport { SelectItem } from 'primeng/api';\r\nimport Swal from 'sweetalert2';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { IBaseResponse } from 'app/models/comm-http/responses/BaseResponse';\r\nimport { CreditCardResponseArray } from 'app/models/ss-api/responses/credit.card.response';\r\nimport { InvoiceItem } from '../../models/ss-api/responses/invoice.item';\r\nimport { PayInvoiceRequest } from '../../models/ss-api/requests/pay.invoice.request';\r\nimport { DecimalPipe } from '@angular/common';\r\nimport {DynamicDialogRef} from 'primeng/dynamicdialog';\r\nimport {DynamicDialogConfig} from 'primeng/dynamicdialog';\r\n\r\nexport interface IPayInvoiceDialogModel {\r\n title: string;\r\n subTitle: string;\r\n CreditCards: SelectItem[];\r\n Invoice: InvoiceItem;\r\n}\r\n\r\n@Component({\r\n selector: 'pay-invoice-dialog',\r\n styleUrls: ['./pay-invoice-dialog.component.scss'],\r\n templateUrl: './pay-invoice-dialog.component.html',\r\n providers: [DecimalPipe],\r\n})\r\nexport class PayInvoiceDialogComponent implements IPayInvoiceDialogModel, OnInit {\r\n\r\n IsBusy: boolean = false;\r\n\r\n confirmTitle: string = 'Purchase GIS Bundle?';\r\n confirmMessage: string = 'You are about to purchase a GIS bundle. Your credit card will be billed.';\r\n\r\n successTitle: string = 'GIS Bundle Purchased';\r\n successMessage: string = 'Your purchase was successfull. The GIS credits are added to your account.';\r\n\r\n errorTitle: string = 'Error';\r\n errorMessage: string = 'We were not able to process this request. Try again later or use a different credit card.';\r\n\r\n cancelledTitle: string = 'Cancelled';\r\n cancelledMessage: string = 'You cancelled this order.';\r\n\r\n\r\n title: string;\r\n subTitle: string;\r\n\r\n CreditCards: SelectItem[];\r\n SelectedCreditCard: number;\r\n\r\n Invoice: InvoiceItem;\r\n\r\n PurchaseDisabled: boolean = true;\r\n\r\n Credit: number = 0;\r\n\r\n showAddCreditCard: boolean = false;\r\n\r\n result: any;\r\n\r\n constructor(\r\n public ref: DynamicDialogRef,\r\n public config: DynamicDialogConfig,\r\n private api: ssApiService,\r\n private numberPipe: DecimalPipe\r\n ) {\r\n }\r\n\r\n ngOnInit() {\r\n this.title = this.config.data.title;\r\n this.subTitle = this.config.data.subTitle;\r\n this.CreditCards = this.config.data.CreditCards;\r\n this.Invoice = this.config.data.Invoice;\r\n\r\n this.GetCredit();\r\n this.SelectedCreditCard = this.CreditCards[0].value;\r\n }\r\n\r\n close() {\r\n this.ref.close();\r\n }\r\n\r\n CreditCardChanged(item: SelectItem) {\r\n\r\n }\r\n\r\n\r\n confirm() {\r\n let request = new PayInvoiceRequest;\r\n request.CreditCardID = this.SelectedCreditCard;\r\n request.InvoiceID = this.Invoice.ID;\r\n\r\n this.IsBusy = true;\r\n\r\n Swal.fire({\r\n title: 'Pay Invoice?',\r\n text: 'You are about to pay this invoice for $' + this.numberPipe.transform(this.GetPriceDue()) + '. Your selected credit card wil be billed.',\r\n icon: 'warning',\r\n showCancelButton: true,\r\n showCloseButton: true,\r\n confirmButtonText: 'Yes!',\r\n cancelButtonText: 'Cancel',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n preConfirm: () => {\r\n // try to order\r\n return this.api.BillingPayInvoice(request).toPromise();\r\n }\r\n }).then((response: any) => {\r\n this.IsBusy = false;\r\n\r\n if (response.isDismissed) {\r\n Swal.fire({\r\n title: 'Invoice Payment Cancelled!',\r\n text: '',\r\n icon: 'error',\r\n showCancelButton: false,\r\n showCloseButton: false,\r\n confirmButtonText: 'OK',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n timer: 2000,\r\n }).then(() => {\r\n \r\n }, () => { }); // keep this line to prevent promise error;\r\n this.IsBusy = false;\r\n this.close();\r\n } else if (!response.value || !response.value.Result) { \r\n Swal.fire({\r\n title: 'Invoice Not Paid!',\r\n text: 'There was a problem processing your payment! Please try a different card, or contact our support team at 702-433-0274 or support@structurestudios.com.',\r\n icon: 'error',\r\n showCancelButton: false,\r\n showCloseButton: true,\r\n confirmButtonText: 'OK',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n }).then(() => {\r\n\r\n }, () => { }); // keep this line to prevent promise error;\r\n } else {\r\n Swal.fire({\r\n title: 'Invoice Paid!',\r\n text: 'Thank you for your membership!',\r\n icon: 'success',\r\n showCancelButton: false,\r\n showCloseButton: false,\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n timer: 2000,\r\n }).then(() => {\r\n this.result = true;\r\n this.close();\r\n }, () => {\r\n this.result = true;\r\n this.close();\r\n }); // keep this line to prevent promise error;\r\n }\r\n\r\n }, error => {\r\n Swal.fire({\r\n title: 'Invoice Payment Cancelled!',\r\n text: '',\r\n icon: 'error',\r\n showCancelButton: false,\r\n showCloseButton: false,\r\n confirmButtonText: 'OK',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n timer: 2000,\r\n }).then(() => {\r\n\r\n }, () => { }); // keep this line to prevent promise error;\r\n this.IsBusy = false;\r\n this.close();\r\n });\r\n\r\n\r\n }\r\n\r\n cancel() {\r\n this.result = false;\r\n this.close();\r\n }\r\n\r\n cardAdded({cards, newCardId}: {cards: CreditCardResponseArray, newCardId: number}) {\r\n this.showAddCreditCard = false;\r\n this.updateCreditCardOptions(cards);\r\n this.SelectedCreditCard = newCardId;\r\n }\r\n\r\n addCardCanceled() {\r\n this.showAddCreditCard = false;\r\n }\r\n\r\n updateCreditCardOptions(newCards: CreditCardResponseArray) {\r\n this.CreditCards = [];\r\n newCards.forEach(card => {\r\n this.CreditCards.push(\r\n {\r\n label: 'Name: ' + card.FirstName + ' ' + card.LastName +\r\n ' - Last four: ' + card.LastFour +\r\n ' - exp. Date: ' + card.ExpMonth + '/' + card.ExpYear,\r\n value: card.ID\r\n });\r\n });\r\n }\r\n\r\n\r\n GetCredit() {\r\n this.IsBusy = true;\r\n\r\n let subscription = this.api.MemberCredit().subscribe(response => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n this.Credit = response.Data;\r\n }, error => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n });\r\n\r\n }\r\n\r\n GetPriceDue(): number {\r\n let totalPriceDue: number = 0;\r\n totalPriceDue += this.Invoice.Total;\r\n totalPriceDue -= this.Credit;\r\n if (totalPriceDue < 0 || Number.isNaN(totalPriceDue))\r\n totalPriceDue = 0;\r\n\r\n return totalPriceDue;\r\n\r\n }\r\n\r\n CreditUsed(): number {\r\n if (this.Credit > this.Invoice.Total)\r\n return this.Invoice.Total;\r\n else\r\n return this.Credit;\r\n }\r\n\r\n\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\n\r\nimport { BillingRecurringTypes } from 'app/models/ss-api/responses/upgradable.products.response';\r\nimport { DashboardLicenseResponse } from 'app/models/ss-api/responses/dashboard.license.response';\r\nimport { SelectItem } from 'primeng/api';\r\nimport Swal from 'sweetalert2';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { ReactivateRequest } from '../../models/ss-api/requests/reactivate.request';\r\nimport { ReactivateSimulationResponse } from '../../models/ss-api/responses/reactivate.simulation.response';\r\nimport { CreditCardResponseArray } from '../../models/ss-api/responses/credit.card.response';\r\nimport { GlobalServices } from '../../services/global.service';\r\n\r\nexport interface IReactivateCDKeyDialogModel {\r\n title: string;\r\n License: DashboardLicenseResponse;\r\n CreditCards: SelectItem[];\r\n\r\n}\r\n\r\n@Component({\r\n selector: 'reactivate-cdkey-dialog',\r\n templateUrl: './reactivate-cdkey-dialog.component.html',\r\n styleUrls: ['./reactivate-cdkey-dialog.component.css'],\r\n\r\n})\r\nexport class ReactivateCDKeyDialogComponent implements IReactivateCDKeyDialogModel, OnInit {\r\n\r\n IsBusy: boolean = false;\r\n\r\n License: DashboardLicenseResponse;\r\n\r\n // VARIABLES\r\n isBusy: boolean = false;\r\n\r\n setUpFee: boolean = false;\r\n\r\n // VARIABLES FROM INTERFACE\r\n title: string;\r\n LicenseKey: string;\r\n FirstName: string;\r\n LastName: string;\r\n Email: string;\r\n\r\n BillingDate: Date = new Date();\r\n\r\n Initals: string = '';\r\n\r\n PurchaseDisabled: boolean = true;\r\n\r\n includeSetupFee: boolean = false;\r\n\r\n simulationResponse: ReactivateSimulationResponse = new ReactivateSimulationResponse;\r\n\r\n // CREDIT CARDS\r\n showAddCreditCard: boolean = false;\r\n CreditCards: SelectItem[];\r\n SelectedCreditCard: number;\r\n\r\n Credit: number = 0;\r\n\r\n Item: any = {\r\n Name: 'VIP3D',\r\n BillingCycle: BillingRecurringTypes.Monthly,\r\n Price: '500.00'\r\n };\r\n result: any;\r\n\r\n constructor(private api: ssApiService, private gb: GlobalServices) {\r\n }\r\n\r\n ngOnInit() {\r\n\r\n this.setRequireSetupDate();\r\n this.simulateReactivation();\r\n this.GetCredit();\r\n\r\n if (this.CreditCards) {\r\n this.SelectedCreditCard = this.CreditCards[0].value;\r\n }\r\n\r\n }\r\n\r\n close() {\r\n \r\n }\r\n\r\n setRequireSetupDate() {\r\n let requireSetupDate = new Date(this.License.NextBillingDate);\r\n requireSetupDate.setDate(requireSetupDate.getDate() + 30);\r\n if (new Date() > requireSetupDate) {\r\n this.includeSetupFee = true;\r\n }\r\n }\r\n\r\n simulateReactivation() {\r\n this.isBusy = true;\r\n let disposable = this.api.ProductsReactivateSimulation(this.License.Key).subscribe(response => {\r\n disposable.unsubscribe();\r\n this.isBusy = false;\r\n this.simulationResponse = response.Data;\r\n }, error => {\r\n disposable.unsubscribe();\r\n this.isBusy = false;\r\n });\r\n\r\n }\r\n\r\n getNextBillDate(): Date {\r\n let newNextBillDate: Date = new Date();\r\n newNextBillDate.setMonth(newNextBillDate.getMonth() + 1);\r\n return newNextBillDate;\r\n }\r\n\r\n confirm() {\r\n // Confirm Action\r\n let request = new ReactivateRequest;\r\n request.LicenseKey = this.License.Key;\r\n request.Initials = 'reactivate';\r\n request.CreditCardID = Number(this.SelectedCreditCard);\r\n request.AdminID = this.gb.AdminID;\r\n\r\n Swal.fire({\r\n title: 'Reactivate This License Key?',\r\n text: '',\r\n icon: 'warning',\r\n showCancelButton: true,\r\n showCloseButton: true,\r\n confirmButtonText: 'Yes!',\r\n cancelButtonText: 'Cancel',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n preConfirm: () => {\r\n // try to order\r\n return this.api.ProductsReactivate(request).toPromise();\r\n }\r\n }).then(\r\n async (response: any) => {\r\n\r\n if (response.isDismissed) {\r\n // show cancelled\r\n Swal.fire({\r\n title: 'Cancelled',\r\n text: 'No changes are saved.',\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1000\r\n }).then(() => {\r\n this.close();\r\n }, () => { }); // keep this line to prevent promise error;\r\n } else if (!response.value || !response.value.Result) {\r\n Swal.fire(\r\n {\r\n title: 'Error',\r\n text: 'Error reactivating License Key',\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1500\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n } else {\r\n // show confirmation\r\n Swal.fire(\r\n {\r\n title: 'Success',\r\n text: 'Product Reactivated',\r\n icon: 'success',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1500\r\n })\r\n .then(() => {\r\n \r\n }, () => { }); // keep this line to prevent promise error;\r\n }\r\n this.result = true;\r\n this.close();\r\n },\r\n (dismiss) => {\r\n if (dismiss === 'cancel') {\r\n\r\n if (!confirm)\r\n return;\r\n\r\n // show cancelled\r\n Swal.fire({\r\n title: 'Cancelled',\r\n text: 'No changes are saved.',\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1000\r\n }).then(() => {\r\n this.close();\r\n }, () => { }); // keep this line to prevent promise error;\r\n }\r\n }).catch(error => {\r\n Swal.fire(\r\n {\r\n title: 'Error',\r\n text: error.message,\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: true,\r\n confirmButtonText: 'OK',\r\n })\r\n .then((response: any) => {\r\n this.result = false;\r\n // this.IsBusy = false;\r\n this.close();\r\n }, (dismiss) => {\r\n // this.IsBusy = false;\r\n return;\r\n }); // keep this line to prevent promise error;\r\n });\r\n\r\n\r\n }\r\n\r\n cancel() {\r\n // we set dialog result as true on click on confirm button,\r\n // then we can get dialog result from caller code\r\n this.result = false;\r\n this.close();\r\n }\r\n\r\n BillingTypeToString(type: BillingRecurringTypes) {\r\n return BillingRecurringTypes[type];\r\n }\r\n\r\n BillingTypeToPerString(type: BillingRecurringTypes) {\r\n if (type == BillingRecurringTypes.Monthly)\r\n return 'per Month';\r\n else\r\n return 'per Year';\r\n }\r\n\r\n InitialsChanged(data: string) {\r\n this.CheckPurchaseDisabled();\r\n }\r\n\r\n CheckPurchaseDisabled() {\r\n if (this.Initals != '')\r\n this.PurchaseDisabled = false;\r\n else\r\n this.PurchaseDisabled = true;\r\n }\r\n\r\n CreditCardChanged(e: any) {\r\n\r\n }\r\n\r\n recurringToString(myBillingCycle: BillingRecurringTypes): string {\r\n if (myBillingCycle == BillingRecurringTypes.Monthly)\r\n return 'Monthly';\r\n else\r\n return 'Yearly';\r\n }\r\n\r\n\r\n cardAdded({cards, newCardId}: {cards: CreditCardResponseArray, newCardId: number}) {\r\n this.showAddCreditCard = false;\r\n this.updateCreditCardOptions(cards);\r\n this.SelectedCreditCard = newCardId;\r\n this.CheckPurchaseDisabled();\r\n }\r\n\r\n addCardCanceled() {\r\n this.showAddCreditCard = false;\r\n }\r\n\r\n updateCreditCardOptions(newCards: CreditCardResponseArray) {\r\n this.CreditCards = [];\r\n newCards.forEach(card => {\r\n this.CreditCards.push(\r\n {\r\n label: 'Name: ' + card.FirstName + ' ' + card.LastName +\r\n ' - Last four: ' + card.LastFour +\r\n ' - exp. Date: ' + card.ExpMonth + '/' + card.ExpYear,\r\n value: card.ID\r\n });\r\n });\r\n }\r\n\r\n\r\n GetCredit() {\r\n this.IsBusy = true;\r\n\r\n let subscription = this.api.MemberCredit().subscribe(response => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n this.Credit = response.Data;\r\n }, error => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n });\r\n\r\n }\r\n\r\n GetPriceDue(): number {\r\n let totalPriceDue: number = 0;\r\n totalPriceDue += this.simulationResponse.ProductPrice;\r\n totalPriceDue += this.simulationResponse.SetupPrice;\r\n totalPriceDue -= this.Credit;\r\n if (totalPriceDue < 0 || Number.isNaN(totalPriceDue))\r\n totalPriceDue = 0;\r\n\r\n return totalPriceDue;\r\n\r\n }\r\n\r\n CreditUsed(): number {\r\n if (this.Credit > (this.simulationResponse.ProductPrice + this.simulationResponse.SetupPrice))\r\n return (this.simulationResponse.ProductPrice + this.simulationResponse.SetupPrice);\r\n else\r\n return this.Credit;\r\n }\r\n\r\n}\r\n","import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';\r\n\r\nimport { BillingRecurringTypes } from 'app/models/ss-api/responses/upgradable.products.response';\r\nimport { DashboardLicenseResponse } from 'app/models/ss-api/responses/dashboard.license.response';\r\nimport { SelectItem } from 'primeng/api';\r\nimport Swal from 'sweetalert2';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { ReactivateRequest } from '../../models/ss-api/requests/reactivate.request';\r\nimport { ReactivateSimulationResponse } from '../../models/ss-api/responses/reactivate.simulation.response';\r\nimport { CreditCardResponseArray } from '../../models/ss-api/responses/credit.card.response';\r\nimport { GlobalServices } from '../../services/global.service';\r\nimport { PublicOrderProductsResponseArray, PublicOrderProductsResponse } from '../../../app/models/ss-api/responses/public.order.products.response';\r\nimport { ReactivateSimulationRequestv2 } from 'app/models/ss-api/requests/reactivate.simulation.request.v2';\r\nimport { ReactivateSimulationResponsev2 } from 'app/models/ss-api/responses/reactivate.simulation.response.v2';\r\nimport { ReactivateRequestv2 } from 'app/models/ss-api/requests/reactivate.request.v2';\r\nimport * as moment from 'moment';\r\nimport { DynamicDialogRef } from 'primeng/dynamicdialog';\r\nimport { DynamicDialogConfig } from 'primeng/dynamicdialog';\r\nimport { MemberProfile } from 'app/models/domain/member.profile';\r\n\r\nexport interface IReactivateLicenseDialogModel {\r\n title: string;\r\n License: DashboardLicenseResponse;\r\n CreditCards: SelectItem[];\r\n CameFromAdd: boolean;\r\n Products: PublicOrderProductsResponseArray;\r\n}\r\n\r\n@Component({\r\n selector: 'reactivate-license-dialog',\r\n templateUrl: './reactivate-license-dialog.component.html',\r\n styleUrls: ['./reactivate-license-dialog.component.scss'],\r\n\r\n})\r\nexport class ReactivateLicenseDialogComponent implements OnInit {\r\n // @ViewChild('container', {static: false}) container: ElementRef;\r\n\r\n IsBusy: boolean = false;\r\n\r\n License: DashboardLicenseResponse;\r\n\r\n // VARIABLES\r\n isBusy: boolean = false;\r\n\r\n setUpFee: boolean = false;\r\n\r\n CameFromAdd: boolean = false;\r\n Products: PublicOrderProductsResponseArray;\r\n SelectedProduct: PublicOrderProductsResponse = new PublicOrderProductsResponse();\r\n SelectedBillingCycle: BillingRecurringTypes;\r\n isYearly: boolean;\r\n SelectedPrice: number;\r\n SelectedSetupFee: number;\r\n PriceDue: number;\r\n ProductSelected: boolean;\r\n IsYardSelected: boolean;\r\n DisableYard: boolean;\r\n IsInCycle: boolean;\r\n memberProfile: MemberProfile;\r\n designerName: string;\r\n\r\n // VARIABLES FROM INTERFACE\r\n title: string;\r\n LicenseKey: string;\r\n FirstName: string;\r\n LastName: string;\r\n Email: string;\r\n\r\n BillingDate: Date = new Date();\r\n\r\n Initals: string = '';\r\n\r\n PurchaseDisabled: boolean = true;\r\n\r\n includeSetupFee: boolean = false;\r\n\r\n simulationResponse: ReactivateSimulationResponsev2 = new ReactivateSimulationResponsev2;\r\n\r\n // CREDIT CARDS\r\n showAddCreditCard: boolean = false;\r\n CreditCards: SelectItem[];\r\n SelectedCreditCard: number;\r\n DesignerFieldsHidden: boolean = true;\r\n DesignerName: string;\r\n DesignerEmail: string;\r\n\r\n Credit: number = 0;\r\n\r\n Item: any = {\r\n Name: 'VIP3D',\r\n BillingCycle: BillingRecurringTypes.Monthly,\r\n Price: '500.00'\r\n };\r\n\r\n AssignmentOptions: SelectItem[];\r\n KeyAssignment: SelectItem;\r\n\r\n result: any;\r\n\r\n currentModalStep: number = 1;\r\n\r\n constructor(\r\n public ref: DynamicDialogRef,\r\n public config: DynamicDialogConfig,\r\n private api: ssApiService, private gb: GlobalServices\r\n ) {\r\n }\r\n\r\n ngOnInit() {\r\n this.title = this.config.data.title;\r\n this.License = this.config.data.License;\r\n this.CreditCards = this.config.data.CreditCards;\r\n this.CameFromAdd = this.config.data.CameFromAdd;\r\n this.Products = this.config.data.Products;\r\n this.memberProfile = this.config.data.memberProfile;\r\n this.designerName = this.config.data.designerName;\r\n this.setRequireSetupDate();\r\n this.GetCredit();\r\n\r\n this.AssignmentOptions = [\r\n { label: this.designerName || 'Prior User', value: 0 },\r\n { label: `Me: Only ${this.memberProfile.Firstname} ${this.memberProfile.Lastname} will have access`, value: 1 },\r\n { label: 'New Designer', value: 2 }\r\n ];\r\n\r\n this.KeyAssignment = this.AssignmentOptions[0];\r\n\r\n setTimeout(() => {\r\n let productID = Number(localStorage.getItem('cartProductID'));\r\n let billingCycle = Number(localStorage.getItem('cartBillingCycle'));\r\n let yard = Boolean(localStorage.getItem('cartHasYard'));\r\n\r\n if (productID && billingCycle) {\r\n let product = this.Products.filter(product => product.ProductID == productID)[0];\r\n this.SetSelectedProduct(product, billingCycle);\r\n this.SelectedBillingCycle = billingCycle;\r\n this.isYearly = this.SelectedBillingCycle == BillingRecurringTypes.Yearly;\r\n } else {\r\n this.SelectedBillingCycle = this.License.Recurring;\r\n this.isYearly = this.SelectedBillingCycle == BillingRecurringTypes.Yearly;\r\n this.SetSelectedProduct(this.Products.filter(product => product.Name == this.License.ProductName)[0], this.License.Recurring);\r\n }\r\n\r\n if (this.CreditCards) {\r\n this.SelectedCreditCard = this.CreditCards[0].value;\r\n }\r\n\r\n\r\n }, 250);\r\n }\r\n\r\n close() {\r\n this.ref.close();\r\n }\r\n\r\n\r\n\r\n YardAvailable(product: PublicOrderProductsResponse) {\r\n\r\n if (product.YardAddon == null || product.YardAddon == undefined)\r\n return false;\r\n\r\n var isDevPublic = this.gb.IsDevPublic();\r\n var isLocal = this.gb.IsLocal();\r\n\r\n //console.log(\"Item: \", product.Name);\r\n //console.log(\"YardVisiblePublic: \", product.YardVisiblePublic);\r\n //console.log(\"isDevPublic: \", isDevPublic);\r\n //console.log(\"isLocal: \", isLocal);\r\n\r\n if (!product.YardVisiblePublic && (!isDevPublic && !isLocal))\r\n return false;\r\n\r\n // ok\r\n return true;\r\n }\r\n\r\n\r\n setRequireSetupDate() {\r\n let requireSetupDate = new Date(this.License.NextBillingDate);\r\n requireSetupDate.setDate(requireSetupDate.getDate() + 30);\r\n if (new Date() > requireSetupDate) {\r\n this.includeSetupFee = true;\r\n }\r\n }\r\n\r\n simulateReactivation() {\r\n this.isBusy = true;\r\n\r\n let request: ReactivateSimulationRequestv2 = {\r\n LicenseKey: this.License.Key,\r\n IncludeYARD: this.IsYardSelected,\r\n NewProductID: this.SelectedProduct.ProductID,\r\n BillingCycle: this.SelectedBillingCycle\r\n };\r\n\r\n let disposable = this.api.ProductsReactivateSimulationv2(request).subscribe(response => {\r\n console.log(\"reactresponse\", response);\r\n this.simulationResponse = response.Data;\r\n this.isBusy = false;\r\n\r\n if (response.Data && response.Data.ProductPrice <= 0) {\r\n this.IsInCycle = true;\r\n }\r\n this.CheckPurchaseDisabled();\r\n disposable.unsubscribe();\r\n }, error => {\r\n this.isBusy = false;\r\n });\r\n\r\n }\r\n\r\n MonthlySelected(product: PublicOrderProductsResponse) {\r\n this.SetSelectedProduct(product, BillingRecurringTypes.Monthly);\r\n }\r\n\r\n YearlySelected(product: PublicOrderProductsResponse) {\r\n this.SetSelectedProduct(product, BillingRecurringTypes.Yearly);\r\n }\r\n\r\n billingCycleChange(e) {\r\n this.SelectedBillingCycle = e.checked ? BillingRecurringTypes.Yearly : BillingRecurringTypes.Monthly;\r\n // this.simulateReactivation();\r\n }\r\n\r\n billingCylceIsYearly()\r\n {\r\n return this.SelectedBillingCycle == BillingRecurringTypes.Yearly;\r\n }\r\n\r\n AssignmentChanged(e) {\r\n this.KeyAssignment = this.AssignmentOptions.find(option => option.value === e.value);\r\n this.DesignerFieldsHidden = this.KeyAssignment.value != 2;\r\n if (this.DesignerFieldsHidden) {\r\n this.DesignerName = '';\r\n this.DesignerEmail = '';\r\n this.CheckPurchaseDisabled()\r\n }\r\n }\r\n\r\n YardSelected(event: any, product: PublicOrderProductsResponse) {\r\n\r\n this.IsYardSelected = event.checked;\r\n\r\n }\r\n\r\n SetSelectedProduct(product: PublicOrderProductsResponse, billingCycle?: BillingRecurringTypes) {\r\n this.SelectedProduct = product;\r\n\r\n if (this.IsYardSelected == true && !this.YardAvailable(product))\r\n this.IsYardSelected = false;\r\n\r\n if (billingCycle) {\r\n this.SelectedBillingCycle = billingCycle;\r\n }\r\n this.SelectedPrice = product.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Price;\r\n this.SelectedSetupFee = product.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n\r\n this.PriceDue = this.SelectedPrice + this.SelectedSetupFee - this.Credit;\r\n\r\n if (this.PriceDue < 0)\r\n this.PriceDue = 0;\r\n\r\n this.ProductSelected = true;\r\n this.CheckPurchaseDisabled();\r\n // this.CheckYardStatus();\r\n // this.simulateReactivation();\r\n }\r\n\r\n getNextBillDate(): Date {\r\n let newNextBillDate: Date = new Date();\r\n newNextBillDate.setMonth(newNextBillDate.getMonth() + 1);\r\n return newNextBillDate;\r\n }\r\n\r\n confirm() {\r\n // Confirm Action\r\n let request = new ReactivateRequestv2;\r\n request.LicenseKey = this.License.Key;\r\n request.Initials = 'reactivate';\r\n request.CreditCardID = Number(this.SelectedCreditCard);\r\n request.AdminID = this.gb.AdminID;\r\n request.BillingCycle = this.SelectedBillingCycle;\r\n request.IncludeYARD = this.IsYardSelected;\r\n request.NewProductID = this.SelectedProduct.ProductID;\r\n request.designerEmail = this.DesignerEmail;\r\n request.designerName = this.DesignerName;\r\n\r\n switch (this.KeyAssignment.value) {\r\n case 0:\r\n request.keepAssigned = true;\r\n break;\r\n case 1:\r\n request.assignToMember = true;\r\n break;\r\n case 2:\r\n request.assignToMember = false;\r\n break;\r\n }\r\n\r\n Swal.fire({\r\n title: 'Reactivate This License Key?',\r\n text: '',\r\n icon: 'warning',\r\n showCancelButton: true,\r\n showCloseButton: true,\r\n confirmButtonText: 'Yes!',\r\n cancelButtonText: 'Cancel',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n preConfirm: () => {\r\n // try to order\r\n return this.api.ProductsReactivatev2(request).toPromise();\r\n }\r\n }).then(\r\n async (response: any) => {\r\n this.gb.ClearOrderFormLocalStorage();\r\n\r\n if (response.isDismissed) {\r\n this.gb.ClearOrderFormLocalStorage();\r\n\r\n // show cancelled\r\n Swal.fire({\r\n title: 'Cancelled',\r\n text: 'No changes are saved.',\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1000\r\n }).then(() => {\r\n this.close();\r\n }, () => { }); // keep this line to prevent promise error;\r\n } else if (!response.value || !response.value.Result) {\r\n Swal.fire(\r\n {\r\n title: 'Error',\r\n text: 'Error reactivating License Key',\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1500\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n } else {\r\n // show confirmation\r\n Swal.fire(\r\n {\r\n title: 'Success',\r\n text: 'Product Reactivated',\r\n icon: 'success',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1500\r\n })\r\n .then(() => {\r\n\r\n }, () => { }); // keep this line to prevent promise error;\r\n }\r\n this.result = true;\r\n this.close();\r\n },\r\n (dismiss) => {\r\n if (dismiss === 'cancel') {\r\n this.gb.ClearOrderFormLocalStorage();\r\n\r\n if (!confirm)\r\n return;\r\n\r\n // show cancelled\r\n Swal.fire({\r\n title: 'Cancelled',\r\n text: 'No changes are saved.',\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1000\r\n }).then(() => {\r\n this.close();\r\n }, () => { }); // keep this line to prevent promise error;\r\n }\r\n }).catch(error => {\r\n Swal.fire(\r\n {\r\n title: 'Error',\r\n text: error.message,\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: true,\r\n confirmButtonText: 'OK',\r\n })\r\n .then((response: any) => {\r\n this.result = false;\r\n // this.IsBusy = false;\r\n this.close();\r\n }, (dismiss) => {\r\n // this.IsBusy = false;\r\n return;\r\n }); // keep this line to prevent promise error;\r\n });\r\n\r\n\r\n }\r\n\r\n cancel() {\r\n // we set dialog result as true on click on confirm button,\r\n // then we can get dialog result from caller code\r\n this.gb.ClearOrderFormLocalStorage();\r\n this.result = false;\r\n this.close();\r\n }\r\n\r\n next() {\r\n this.currentModalStep = 2;\r\n this.simulateReactivation();\r\n // this.container.nativeElement.scrollTo(0, 0);\r\n }\r\n\r\n back() {\r\n this.currentModalStep = 1;\r\n }\r\n\r\n BillingTypeToString(type: BillingRecurringTypes) {\r\n return BillingRecurringTypes[type];\r\n }\r\n\r\n BillingTypeToPerString(type: BillingRecurringTypes) {\r\n if (type == BillingRecurringTypes.Monthly)\r\n return 'per Month';\r\n else\r\n return 'per Year';\r\n }\r\n\r\n InitialsChanged(data: string) {\r\n this.CheckPurchaseDisabled();\r\n }\r\n\r\n CheckDesignerFields() {\r\n if (this.DesignerFieldsHidden || (!this.DesignerFieldsHidden && (this.DesignerEmail != undefined && this.DesignerEmail.length > 1) && (this.DesignerName != undefined && this.DesignerName.length > 1))) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n CheckPurchaseDisabled() {\r\n if (this.ProductSelected && this.CreditCards.length > 0 && this.CheckDesignerFields())\r\n this.PurchaseDisabled = false;\r\n else\r\n this.PurchaseDisabled = true;\r\n }\r\n\r\n\r\n\r\n CreditCardChanged(e: any) {\r\n\r\n }\r\n\r\n recurringToString(myBillingCycle: BillingRecurringTypes): string {\r\n if (myBillingCycle == BillingRecurringTypes.Monthly)\r\n return 'Monthly';\r\n else\r\n return 'Yearly';\r\n }\r\n\r\n\r\n cardAdded({ cards, newCardId }: { cards: CreditCardResponseArray, newCardId: number }) {\r\n this.showAddCreditCard = false;\r\n this.updateCreditCardOptions(cards);\r\n this.SelectedCreditCard = newCardId;\r\n this.CheckPurchaseDisabled();\r\n }\r\n\r\n addCardCanceled() {\r\n this.showAddCreditCard = false;\r\n }\r\n\r\n updateCreditCardOptions(newCards: CreditCardResponseArray) {\r\n this.CreditCards = [];\r\n newCards.forEach(card => {\r\n this.CreditCards.push(\r\n {\r\n label: 'Name: ' + card.FirstName + ' ' + card.LastName +\r\n ' - Last four: ' + card.LastFour +\r\n ' - exp. Date: ' + card.ExpMonth + '/' + card.ExpYear,\r\n value: card.ID\r\n });\r\n });\r\n }\r\n\r\n\r\n GetCredit() {\r\n this.IsBusy = true;\r\n\r\n let subscription = this.api.MemberCredit().subscribe(response => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n this.Credit = response.Data;\r\n }, error => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n });\r\n\r\n }\r\n\r\n GetPriceDue(): number {\r\n let totalPriceDue: number = 0;\r\n\r\n if (this.simulationResponse) {\r\n totalPriceDue += this.simulationResponse.TotalWithTax;\r\n totalPriceDue -= this.Credit;\r\n if (totalPriceDue < 0 || Number.isNaN(totalPriceDue))\r\n totalPriceDue = 0;\r\n }\r\n\r\n return totalPriceDue;\r\n }\r\n\r\n CreditUsed(): number {\r\n if (this.simulationResponse && this.Credit > this.simulationResponse.TotalWithTax)\r\n return this.simulationResponse.TotalWithTax;\r\n else\r\n return this.Credit;\r\n }\r\n\r\n InCycleMessage() {\r\n if (this.IsInCycle) {\r\n Swal.fire({\r\n icon: 'warning',\r\n title: 'Active License',\r\n text: 'This license is still active until ' + moment(this.License.NextBillingDate).format('MMM DD, YYYY') + ' and cannot be modified. For more assistance, please contact support at 702-433-0274.',\r\n backdrop: false\r\n });\r\n }\r\n }\r\n\r\n getProductPrice(product: PublicOrderProductsResponse) {\r\n try {\r\n var productPrice = product.Prices.find(price => price.BillingCycle === this.SelectedBillingCycle).Price;\r\n\r\n var yardPrice = 0;\r\n\r\n if (this.YardAvailable(product) && this.IsYardSelected)\r\n yardPrice = product.YardAddon.Prices.find(price => price.BillingCycle === this.SelectedBillingCycle).Price;\r\n\r\n return productPrice + yardPrice;\r\n } catch (e) {\r\n\r\n }\r\n return 0;\r\n }\r\n\r\n}\r\n","import { BaseResponse, IBaseResponse } from '../../models/comm-http/responses/BaseResponse';\r\n\r\nimport { Component, OnInit } from '@angular/core';\r\n\r\nimport { BillingRecurringTypes, UpgradableProductsResponseArray, UpgradableProductsResponse } from 'app/models/ss-api/responses/upgradable.products.response';\r\nimport { SelectItem } from 'primeng/api';\r\nimport Swal, { SweetAlertIcon } from 'sweetalert2';\r\nimport { UpgradeProductRequest } from 'app/models/ss-api/requests/upgrade.product.request';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { DashboardLicenseResponse } from '../../models/ss-api/responses/dashboard.license.response';\r\nimport { GlobalServices } from 'app/services/global.service';\r\n\r\nimport { UpgradeSimulationResponse } from '../../models/ss-api/responses/upgrade.simulation.response';\r\nimport { CreditCardResponseArray } from 'app/models/ss-api/responses/credit.card.response';\r\nimport { DynamicDialogRef } from 'primeng/dynamicdialog';\r\nimport { DynamicDialogConfig } from 'primeng/dynamicdialog';\r\n\r\nexport interface IUpgradeProductDialogModel {\r\n title: string;\r\n subTitle: string;\r\n message: string;\r\n upgradeProducts: UpgradableProductsResponseArray;\r\n CreditCards: SelectItem[];\r\n SelectedCreditCard: number;\r\n LicenseKey: string;\r\n\r\n LicenseObject: DashboardLicenseResponse;\r\n\r\n CurrentProductBillingCycle: BillingRecurringTypes;\r\n\r\n}\r\n\r\ninterface productOptionItem {\r\n name: string;\r\n productID: number;\r\n billingCycle: BillingRecurringTypes;\r\n}\r\n\r\n@Component({\r\n selector: 'upgrade-product-dialog',\r\n styleUrls: ['./upgrade-product-dialog.component.scss'],\r\n templateUrl: './upgrade-product-dialog.component.html'\r\n})\r\nexport class UpgradeProductDialogComponent implements IUpgradeProductDialogModel, OnInit {\r\n\r\n IsBusy: boolean = true;\r\n\r\n confirmTitle: string = 'Upgrade Membership';\r\n\r\n successTitle: string = 'Membership Upgraded!';\r\n successMessage: string = 'Your purchase was successfull. Please restart your software so that it can update to Vip3D';\r\n\r\n errorTitle: string = 'Error';\r\n errorMessage: string = 'We were not able to process this request. Try again later or use a different credit card.';\r\n\r\n cancelledTitle: string = 'Cancelled';\r\n cancelledMessage: string = 'You cancelled this upgrade.';\r\n\r\n\r\n\r\n title: string;\r\n subTitle: string;\r\n message: string;\r\n upgradeProducts: UpgradableProductsResponseArray;\r\n CreditCards: SelectItem[];\r\n SelectedCreditCard: number;\r\n\r\n SelectedProduct: UpgradableProductsResponse = new UpgradableProductsResponse();\r\n SelectedProductLock: boolean = false;\r\n\r\n ProductOptions: productOptionItem[] = [];\r\n SelectedProductOption: number;\r\n\r\n PurchaseDisabled: boolean = false;\r\n Initals: string = 'AP'; // Account Panel\r\n LicenseKey: string = '';\r\n LicenseObject: DashboardLicenseResponse;\r\n\r\n\r\n // CURRENT PRODUCT VARIABLES\r\n CurrentProductBillingCycle: BillingRecurringTypes;\r\n\r\n CurrentProductName: string = 'Vip3D';\r\n\r\n TodaysDate: Date = new Date();\r\n RenewDate: Date = new Date();\r\n\r\n PriceSimulationResponse: UpgradeSimulationResponse = new UpgradeSimulationResponse;\r\n CreditAmount: number = 0;\r\n DebitAmount: number = 0;\r\n PriceDue: any = 0;\r\n PriceDueWithTax: any = 0;\r\n State: string = \"\";\r\n TaxRateDisplay: string = \"\";\r\n\r\n TaxEnabled: boolean = false;\r\n\r\n Credit: number = 0;\r\n TotalDueUpgradeTaxAmount: number = 0;\r\n\r\n result: any;\r\n\r\n constructor(\r\n public ref: DynamicDialogRef,\r\n public config: DynamicDialogConfig,\r\n private api: ssApiService,\r\n private gb: GlobalServices\r\n ) {\r\n }\r\n\r\n async ngOnInit() {\r\n this.title = this.config.data.title;\r\n this.subTitle = this.config.data.subTitle;\r\n this.message = this.config.data.message;\r\n this.upgradeProducts = this.config.data.upgradeProducts;\r\n this.CreditCards = this.config.data.CreditCards;\r\n this.SelectedCreditCard = this.config.data.SelectedCreditCard;\r\n this.LicenseKey = this.config.data.LicenseKey;\r\n this.CurrentProductBillingCycle = this.config.data.CurrentProductBillingCycle;\r\n this.LicenseObject = this.config.data.LicenseObject;\r\n\r\n this.setUpProductOptions();\r\n\r\n console.log(\"Upgrade Products Options\", this.upgradeProducts);\r\n\r\n if (this.SelectedProduct == undefined) {\r\n\r\n }\r\n\r\n this.GetCredit();\r\n\r\n let request = new UpgradeProductRequest();\r\n request.CreditCardID = 0;\r\n request.Initials = 'PS'; // Price Simulation\r\n request.LicenseKey = this.LicenseKey;\r\n request.NewBillingCycle = this.SelectedProduct.BillingCycle;\r\n request.NewProductID = this.SelectedProduct.ProductID;\r\n request.SimulateOnly = true;\r\n request.AdminID = this.gb.AdminID;\r\n\r\n await this.simulateUpgradePrice(request).then(\r\n (response) => {\r\n console.log(\"SimUpdResp\", response.Data);\r\n this.PriceDue = response.Data.TotalDueUpgrade;\r\n this.PriceDueWithTax = response.Data.TotalDueUpgradeWithTax;\r\n this.PriceSimulationResponse = response.Data;\r\n this.TaxEnabled = response.Data.TaxEnabled;\r\n this.TotalDueUpgradeTaxAmount = response.Data.TotalDueUpgradeTaxAmount;\r\n this.TaxRateDisplay = response.Data.TaxRateDisplay;\r\n this.State = response.Data.State;\r\n }\r\n );\r\n\r\n if (this.CreditCards) {\r\n this.SelectedCreditCard = this.CreditCards[0].value;\r\n }\r\n this.IsBusy = false;\r\n\r\n }\r\n\r\n close() {\r\n this.ref.close();\r\n }\r\n\r\n\r\n setUpProductOptions() {\r\n this.upgradeProducts.forEach(x => {\r\n let newName: string = x.Name + ' ' + this.getBillingCycleName(x.BillingCycle);\r\n\r\n if (x.HasYard)\r\n newName += ' + YARD';\r\n\r\n this.ProductOptions.push({ name: newName, productID: x.ProductID, billingCycle: x.BillingCycle });\r\n });\r\n\r\n this.SelectedProductOption = this.ProductOptions[0].productID;\r\n\r\n this.setSelectedProduct(this.ProductOptions[0]);\r\n }\r\n\r\n getBillingCycleName(billingCycle: BillingRecurringTypes): string {\r\n if (billingCycle == BillingRecurringTypes.Monthly)\r\n return 'Monthly';\r\n else\r\n return 'Yearly';\r\n }\r\n\r\n setSelectedProduct(e: productOptionItem) {\r\n this.upgradeProducts.forEach(x => {\r\n if (x.ProductID == e.productID && x.BillingCycle == e.billingCycle) {\r\n this.SelectedProduct = x;\r\n }\r\n\r\n });\r\n\r\n\r\n this.RenewDate = new Date(this.LicenseObject.NextBillingDate);\r\n if (this.SelectedProduct.BillingCycle == BillingRecurringTypes.Yearly) {\r\n this.RenewDate.setFullYear(this.RenewDate.getFullYear() + 1);\r\n }\r\n\r\n }\r\n\r\n async ProductChanged(e) {\r\n\r\n this.IsBusy = true;\r\n\r\n let newProductOption: productOptionItem = {\r\n name: e.value.name,\r\n productID: e.value.productID,\r\n billingCycle: e.value.billingCycle\r\n };\r\n\r\n this.setSelectedProduct(newProductOption);\r\n\r\n let request = new UpgradeProductRequest();\r\n request.CreditCardID = 0;\r\n request.Initials = 'PS'; // Price Simulation\r\n request.LicenseKey = this.LicenseKey;\r\n request.NewBillingCycle = this.SelectedProduct.BillingCycle;\r\n request.NewProductID = this.SelectedProduct.ProductID;\r\n request.SimulateOnly = true;\r\n request.AdminID = this.gb.AdminID;\r\n\r\n await this.simulateUpgradePrice(request).then(\r\n (response) => {\r\n this.PriceDue = response.Data.TotalDueUpgrade;\r\n this.PriceSimulationResponse = response.Data;\r\n this.PriceDueWithTax = response.Data.TotalDueUpgradeWithTax;\r\n this.TaxEnabled = response.Data.TaxEnabled;\r\n this.TotalDueUpgradeTaxAmount = response.Data.TotalDueUpgradeTaxAmount;\r\n this.TaxRateDisplay = response.Data.TaxRateDisplay;\r\n this.State = response.Data.State;\r\n }\r\n );\r\n\r\n this.IsBusy = false;\r\n\r\n }\r\n\r\n\r\n simulateUpgradePrice(request: UpgradeProductRequest): Promise> {\r\n /*\r\n let request = new UpgradeProductRequest();\r\n request.CreditCardID = 0;\r\n request.Initials = \"PS\"; //Price Simulation\r\n request.LicenseKey = this.LicenseKey;\r\n request.NewBillingCycle = this.SelectedProduct.BillingCycle;\r\n request.NewProductID = this.SelectedProduct.ProductID;\r\n request.SimulateOnly = true;\r\n */\r\n\r\n return this.api.ProductsUpgradeSimulation(request).toPromise();\r\n\r\n }\r\n\r\n ProductSelectionChanged(product: UpgradableProductsResponse) {\r\n this.SelectedProduct = product;\r\n this.SelectedProductLock = false;\r\n this.CheckPurchaseDisabled();\r\n\r\n\r\n }\r\n\r\n\r\n BillingTypeToString(type: BillingRecurringTypes) {\r\n return BillingRecurringTypes[type];\r\n }\r\n\r\n BillingTypeToPerString(type: BillingRecurringTypes) {\r\n if (type == BillingRecurringTypes.Monthly)\r\n return 'per Month';\r\n else\r\n return 'per Year';\r\n }\r\n\r\n CreditCardChanged() {\r\n\r\n }\r\n\r\n InitialsChanged(data: string) {\r\n this.CheckPurchaseDisabled();\r\n }\r\n\r\n CheckPurchaseDisabled() {\r\n // if (this.Initals != \"\" && !this.SelectedProductLock)\r\n if (!this.SelectedProductLock)\r\n this.PurchaseDisabled = false;\r\n else\r\n this.PurchaseDisabled = true;\r\n }\r\n\r\n SelectedBillingCycleToString(): string {\r\n\r\n switch (this.SelectedProduct.BillingCycle) {\r\n\r\n case BillingRecurringTypes.Monthly:\r\n return 'month';\r\n\r\n case BillingRecurringTypes.Yearly:\r\n return 'year';\r\n\r\n default:\r\n return 'unimplemented';\r\n }\r\n\r\n }\r\n\r\n private UpgradeProduct(): Promise {\r\n\r\n if (this.SelectedCreditCard == undefined)\r\n // we didn't change the credit card selection\r\n this.SelectedCreditCard = this.CreditCards[0].value;\r\n\r\n let request = new UpgradeProductRequest();\r\n request.CreditCardID = this.SelectedCreditCard;\r\n request.Initials = this.Initals;\r\n request.LicenseKey = this.LicenseKey;\r\n request.NewBillingCycle = this.SelectedProduct.BillingCycle;\r\n request.NewProductID = this.SelectedProduct.ProductID;\r\n request.SimulateOnly = false; // for debug\r\n request.AdminID = this.gb.AdminID;\r\n\r\n return this.api.ProductsUpgrade(request)\r\n .toPromise()\r\n .then(response => {\r\n this.result = response.Result;\r\n return response;\r\n });\r\n }\r\n\r\n ProcessOrder(): Promise {\r\n // confirm\r\n return Swal.fire({\r\n title: this.confirmTitle,\r\n text: 'You are about to upgrade a membership to ' + this.SelectedProduct.Name + '. Your credit card will be billed.',\r\n icon: 'warning',\r\n showCancelButton: true,\r\n showCloseButton: true,\r\n confirmButtonText: 'Yes!',\r\n cancelButtonText: 'Cancel',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n preConfirm: () => {\r\n // try to order\r\n return this.UpgradeProduct();\r\n }\r\n });\r\n\r\n }\r\n\r\n async confirm() {\r\n this.result = true;\r\n\r\n await this.ProcessOrder().then(\r\n (response: any) => {\r\n\r\n // init dialog vars\r\n let cType = 'success';\r\n let cTitle = this.successTitle;\r\n let cMessage = 'Your purchase was successfull. Please restart your software so that it can update to ' + this.SelectedProduct.Name + '.';\r\n\r\n if (response.isDismissed) {\r\n // show cancelled\r\n Swal.fire({\r\n title: this.cancelledTitle,\r\n text: this.cancelledMessage,\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1000\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n } else if (response.value && response.value.Result) {\r\n // show result\r\n Swal.fire(\r\n {\r\n\r\n title: cTitle,\r\n text: cMessage,\r\n icon: cType as SweetAlertIcon,\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 2000\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n }\r\n else {\r\n // not ok\r\n\r\n Swal.fire(\r\n {\r\n\r\n title: this.errorTitle,\r\n text: this.errorMessage,\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: true,\r\n confirmButtonText: 'OK',\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n }\r\n },\r\n (dismiss) => {\r\n if (dismiss === 'cancel') {\r\n this.result = false;\r\n\r\n if (!confirm)\r\n return;\r\n\r\n // show cancelled\r\n Swal.fire({\r\n title: this.cancelledTitle,\r\n text: this.cancelledMessage,\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1000\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n }\r\n });\r\n\r\n this.close();\r\n }\r\n\r\n\r\n\r\n\r\n cancel() {\r\n // we set dialog result as true on click on confirm button,\r\n // then we can get dialog result from caller code\r\n this.result = false;\r\n this.close();\r\n }\r\n\r\n\r\n showAddCreditCard: boolean = false;\r\n\r\n cardAdded({ cards, newCardId }: { cards: CreditCardResponseArray, newCardId: number }) {\r\n this.showAddCreditCard = false;\r\n this.updateCreditCardOptions(cards);\r\n this.SelectedCreditCard = newCardId;\r\n this.CheckPurchaseDisabled();\r\n }\r\n\r\n addCardCanceled() {\r\n this.showAddCreditCard = false;\r\n }\r\n\r\n updateCreditCardOptions(newCards: CreditCardResponseArray) {\r\n this.CreditCards = [];\r\n newCards.forEach(card => {\r\n this.CreditCards.push(\r\n {\r\n label: 'Name: ' + card.FirstName + ' ' + card.LastName +\r\n ' - Last four: ' + card.LastFour +\r\n ' - exp. Date: ' + card.ExpMonth + '/' + card.ExpYear,\r\n value: card.ID\r\n });\r\n });\r\n }\r\n\r\n GetCredit() {\r\n this.IsBusy = true;\r\n\r\n let subscription = this.api.MemberCredit().subscribe(response => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n this.Credit = response.Data;\r\n }, error => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n });\r\n\r\n }\r\n\r\n GetPriceDue(): number {\r\n let totalPriceDue: number = 0;\r\n totalPriceDue += this.PriceDueWithTax;\r\n totalPriceDue -= this.Credit;\r\n if (totalPriceDue < 0 || Number.isNaN(totalPriceDue))\r\n totalPriceDue = 0;\r\n\r\n return totalPriceDue;\r\n }\r\n\r\n CreditUsed(): number {\r\n if (this.Credit > this.PriceDue)\r\n return this.PriceDueWithTax;\r\n else\r\n return this.Credit;\r\n }\r\n\r\n\r\n\r\n ProductNameAdditions(): string {\r\n let additions: string = '';\r\n\r\n if (this.SelectedProduct.HasYard)\r\n additions += ' + YARD';\r\n\r\n return additions;\r\n }\r\n\r\n}\r\n","import { BaseResponse } from '../../models/comm-http/responses/BaseResponse';\r\nimport { BillingRecurringTypes } from '../../models/ss-api/price.billing.cycle';\r\nimport { Component, OnInit } from '@angular/core';\r\n\r\nimport Swal, { SweetAlertIcon } from 'sweetalert2';\r\nimport { SelectItem } from 'primeng/api';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { DashboardLicenseResponse } from 'app/models/ss-api/responses/dashboard.license.response';\r\nimport { YardAddonPriceResponse } from 'app/models/ss-api/responses/yard.addon.price.response';\r\nimport { YardAddonOrderRequest } from '../../models/ss-api/requests/yard.addon.order.request';\r\nimport { CreditCardResponseArray } from 'app/models/ss-api/responses/credit.card.response';\r\nimport {DynamicDialogRef} from 'primeng/dynamicdialog';\r\nimport {DynamicDialogConfig} from 'primeng/dynamicdialog';\r\n\r\nexport interface IAddYardAddModel {\r\n title: string;\r\n subTitle: string;\r\n\r\n CreditCards: SelectItem[];\r\n SelectedCreditCard: number;\r\n\r\n License: DashboardLicenseResponse;\r\n YardPricing: YardAddonPriceResponse;\r\n\r\n}\r\n\r\n@Component({\r\n selector: 'yard-add-dialog',\r\n styleUrls: ['./yard-add-dialog.component.scss'],\r\n templateUrl: './yard-add-dialog.component.html'\r\n})\r\nexport class YARDAddDialogComponent implements IAddYardAddModel, OnInit {\r\n\r\n IsBusy: boolean = false;\r\n\r\n confirmTitle: string = 'Add Product';\r\n confirmMessage: string = 'You are about to purchase a new product subscription. Your credit card will be billed.';\r\n\r\n successTitle: string = 'Product added';\r\n successMessage: string = 'Your purchase was successfull. You will recieve an email confirming your purchase.';\r\n\r\n errorTitle: string = 'Error';\r\n errorMessage: string = 'We were not able to process this request. Try again later or use a different credit card.';\r\n\r\n cancelledTitle: string = 'Cancelled';\r\n cancelledMessage: string = 'You cancelled this order.';\r\n\r\n\r\n AssignToOwner: boolean = true;\r\n Initials: string;\r\n title: string;\r\n subTitle: string;\r\n\r\n CreditCards: SelectItem[];\r\n SelectedCreditCard: number;\r\n\r\n License: DashboardLicenseResponse;\r\n YardPricing: YardAddonPriceResponse;\r\n\r\n SelectedBillingCycle: BillingRecurringTypes;\r\n\r\n\r\n PurchaseDisabled: boolean = false;\r\n ProductSelected: boolean = false;\r\n\r\n Initals: string = '';\r\n\r\n TodaysDate: Date = new Date();\r\n\r\n\r\n Credit: number = 0;\r\n\r\n result: any;\r\n\r\n\r\n constructor(\r\n public ref: DynamicDialogRef,\r\n public config: DynamicDialogConfig,\r\n private api: ssApiService\r\n ) {\r\n }\r\n\r\n ngOnInit(): void {\r\n this.title = this.config.data.title;\r\n this.subTitle = this.config.data.subTitle;\r\n this.CreditCards = this.config.data.CreditCards;\r\n this.SelectedCreditCard = this.config.data.SelectedCreditCard;\r\n this.License = this.config.data.License;\r\n this.YardPricing = this.config.data.YardPricing;\r\n this.SelectedCreditCard = this.CreditCards[0].value;\r\n this.GetCredit();\r\n }\r\n\r\n close() {\r\n this.ref.close();\r\n }\r\n\r\n CreditCardChanged(item: SelectItem) {\r\n\r\n }\r\n\r\n\r\n SelectedBillingCycleToString(): string {\r\n\r\n switch (this.SelectedBillingCycle) {\r\n\r\n case BillingRecurringTypes.Monthly:\r\n return 'month';\r\n\r\n case BillingRecurringTypes.Yearly:\r\n return 'year';\r\n\r\n default:\r\n return 'unimplemented';\r\n }\r\n\r\n }\r\n\r\n private PurchaseProduct(): Promise {\r\n\r\n if (this.SelectedCreditCard == undefined)\r\n // we didn't change the credit card selection\r\n this.SelectedCreditCard = this.CreditCards[0].value;\r\n\r\n let request = new YardAddonOrderRequest();\r\n request.CCardID = this.SelectedCreditCard;\r\n request.LicenseID = this.License.LicenseID;\r\n request.YardProductID = this.YardPricing.YardProductID;\r\n\r\n\r\n return this.api.YardAdd(request)\r\n .toPromise()\r\n .then(response => {\r\n\r\n if (!response.Result)\r\n return; // error\r\n\r\n\t\t\t\tthis.result = response.Result;\r\n\t\t\t\treturn response;\r\n });\r\n }\r\n\r\n\r\n ProcessOrder(): Promise {\r\n // confirm\r\n return Swal.fire({\r\n title: this.confirmTitle,\r\n text: this.confirmMessage,\r\n icon: 'warning',\r\n showCancelButton: true,\r\n showCloseButton: true,\r\n confirmButtonText: 'Yes, order!',\r\n cancelButtonText: 'No, cancel',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n preConfirm: () => {\r\n // try to order\r\n return this.PurchaseProduct();\r\n }\r\n });\r\n\r\n }\r\n\r\n async confirm() {\r\n await this.ProcessOrder().then(\r\n (response: any) => {\r\n\r\n // init dialog vars\r\n let cType = 'success';\r\n let cTitle = this.successTitle;\r\n let cMessage = this.successMessage;\r\n\r\n if (response.isDismissed) {\r\n cType = 'error';\r\n cTitle = this.cancelledTitle;\r\n cMessage = this.cancelledMessage;\r\n } else if (!response.value || !response.value.Result) {\r\n // not ok\r\n cType = 'error';\r\n cTitle = this.errorTitle;\r\n cMessage = this.errorMessage;\r\n }\r\n\r\n // show result\r\n Swal.fire(\r\n {\r\n title: cTitle,\r\n text: cMessage,\r\n icon: cType as SweetAlertIcon,\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 2500\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n\r\n },\r\n (dismiss) => {\r\n if (dismiss === 'cancel') {\r\n\r\n if (!confirm)\r\n return;\r\n\r\n // show cancelled\r\n Swal.fire({\r\n title: this.cancelledTitle,\r\n text: this.cancelledMessage,\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1000\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n }\r\n });\r\n\r\n this.result = true;\r\n this.close();\r\n }\r\n\r\n cancel() {\r\n this.result = false;\r\n this.close();\r\n }\r\n\r\n\r\n BillingTypeToString(type: BillingRecurringTypes) {\r\n return BillingRecurringTypes[type];\r\n }\r\n\r\n BillingTypeToPerString(type: BillingRecurringTypes) {\r\n if (type == BillingRecurringTypes.Monthly)\r\n return 'per Month';\r\n else\r\n return 'per Year';\r\n }\r\n\r\n productNameWebSafe(productName: string): string {\r\n\r\n let webSafeName = 'vip3d';\r\n\r\n if (productName == 'Pool Studio')\r\n webSafeName = 'poolstudio';\r\n else if (productName == 'VizTerra')\r\n webSafeName = 'vizterra';\r\n\r\n return webSafeName;\r\n\r\n }\r\n\r\n showAddCreditCard: boolean = false;\r\n\r\n\r\n cardAdded({cards, newCardId}: {cards: CreditCardResponseArray, newCardId: number}) {\r\n this.showAddCreditCard = false;\r\n this.updateCreditCardOptions(cards);\r\n this.SelectedCreditCard = newCardId;\r\n }\r\n\r\n addCardCanceled() {\r\n this.showAddCreditCard = false;\r\n }\r\n\r\n updateCreditCardOptions(newCards: CreditCardResponseArray) {\r\n this.CreditCards = [];\r\n newCards.forEach(card => {\r\n this.CreditCards.push(\r\n {\r\n label: 'Name: ' + card.FirstName + ' ' + card.LastName +\r\n ' - Last four: ' + card.LastFour +\r\n ' - exp. Date: ' + card.ExpMonth + '/' + card.ExpYear,\r\n value: card.ID\r\n });\r\n });\r\n }\r\n\r\n GetCredit() {\r\n this.IsBusy = true;\r\n\r\n let subscription = this.api.MemberCredit().subscribe(response => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n this.Credit = response.Data;\r\n }, error => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n });\r\n\r\n }\r\n\r\n GetPriceDue(): number {\r\n let totalPriceDue: number = 0;\r\n totalPriceDue += this.YardPricing.Pay;\r\n totalPriceDue -= this.Credit;\r\n if (totalPriceDue < 0 || Number.isNaN(totalPriceDue))\r\n totalPriceDue = 0;\r\n\r\n return totalPriceDue;\r\n\r\n }\r\n\r\n CreditUsed(): number {\r\n if (this.Credit > this.YardPricing.Pay)\r\n return this.YardPricing.Pay;\r\n else\r\n return this.Credit;\r\n }\r\n\r\n\r\n\r\n}\r\n","import { BaseResponse } from '../../models/comm-http/responses/BaseResponse';\r\nimport { ssApiService } from '../../services/ss-api.service';\r\nimport { Component, OnInit } from '@angular/core';\r\n\r\nimport Swal, { SweetAlertIcon } from 'sweetalert2';\r\nimport { xToastr, ToastrTypes } from 'app/shared/Toastr';\r\nimport { DashboardLicenseResponse } from 'app/models/ss-api/responses/dashboard.license.response';\r\nimport { CancelYardRequest } from 'app/models/ss-api/requests/cancel.yard.request';\r\nimport {DynamicDialogRef} from 'primeng/dynamicdialog';\r\nimport {DynamicDialogConfig} from 'primeng/dynamicdialog';\r\n\r\nexport interface IConfirmDialogModel {\r\n title: string;\r\n subTitle: string;\r\n message: string;\r\n License: DashboardLicenseResponse;\r\n}\r\n\r\n@Component({\r\n selector: 'yard-cancellation-request-dialog',\r\n styleUrls: ['./yard-cancellation-request-dialog.component.scss'],\r\n templateUrl: './yard-cancellation-request-dialog.component.html'\r\n})\r\nexport class YARDCancellationRequestDialogComponent implements IConfirmDialogModel, OnInit {\r\n\r\n\r\n confirmTitle: string = 'Cancel YARD';\r\n confirmMessage: string = 'You are about to cancel this YARD membership.';\r\n\r\n successTitle: string = 'Cancellation successfull';\r\n successMessage: string = 'Your YARD membership is cancelled.';\r\n\r\n errorTitle: string = 'Error';\r\n errorMessage: string = 'We were not able to cancel YARD. Please contact support.';\r\n\r\n cancelledTitle: string = 'Cancelled Request';\r\n cancelledMessage: string = 'You cancelled the request.';\r\n\r\n\r\n title: string;\r\n subTitle: string;\r\n message: string;\r\n License: DashboardLicenseResponse;\r\n CancellationReason: string;\r\n\r\n step: number = 1;\r\n\r\n result: any;\r\n\r\n constructor(\r\n public ref: DynamicDialogRef,\r\n public config: DynamicDialogConfig,\r\n private api: ssApiService\r\n ) {\r\n }\r\n\r\n ngOnInit() {\r\n this.title = this.config.data.title;\r\n this.subTitle = this.config.data.subTitle;\r\n this.message = this.config.data.message;\r\n this.License = this.config.data.License;\r\n }\r\n\r\n close() {\r\n this.ref.close();\r\n }\r\n\r\n private CancelProduct(): Promise {\r\n\r\n // if (this.SelectedCreditCard == undefined)\r\n // we didn't change the credit card selection\r\n // this.SelectedCreditCard = this.CreditCards[0];\r\n\r\n let request = new CancelYardRequest();\r\n request.LicenseKey = this.License.Key;\r\n request.CancelReason = this.CancellationReason;\r\n\r\n\r\n return this.api.YardCancel( request )\r\n .toPromise()\r\n .then(response => {\r\n\r\n if (!response.Result)\r\n return; // error\r\n\r\n this.result = response.Result;\r\n return response;\r\n });\r\n }\r\n\r\n ProcessCancellation(): Promise {\r\n // confirm\r\n return Swal.fire({\r\n title: this.confirmTitle,\r\n text: this.confirmMessage,\r\n icon: 'warning',\r\n showCancelButton: true,\r\n showCloseButton: true,\r\n confirmButtonText: 'Yes, cancel!',\r\n cancelButtonText: 'No, keep',\r\n allowOutsideClick: false,\r\n showLoaderOnConfirm: true,\r\n preConfirm: () => {\r\n // try to order\r\n return this.CancelProduct();\r\n }\r\n });\r\n\r\n }\r\n\r\n async confirm() {\r\n\r\n if ( this.CancellationReason == '' || this.CancellationReason == undefined) {\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'Please enter \\'Reason For Canceling\\'');\r\n return;\r\n }\r\n\r\n await this.ProcessCancellation().then(\r\n (response: any) => {\r\n\r\n // init dialog vars\r\n let cType = 'success';\r\n let cTitle = this.successTitle;\r\n let cMessage = this.successMessage;\r\n\r\n if (response.isDismissed) {\r\n cType = 'error';\r\n cTitle = this.cancelledTitle;\r\n cMessage = this.cancelledMessage;\r\n } else if (!response.value || !response.value.Result) {\r\n // not ok\r\n cType = 'error';\r\n cTitle = this.errorTitle;\r\n cMessage = this.errorMessage;\r\n }\r\n\r\n // show result\r\n Swal.fire(\r\n {\r\n title: cTitle,\r\n text: cMessage,\r\n icon: cType as SweetAlertIcon,\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1500\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n\r\n },\r\n (dismiss) => {\r\n if (dismiss === 'cancel') {\r\n\r\n if (!confirm)\r\n return;\r\n\r\n // show cancelled\r\n Swal.fire({\r\n title: this.cancelledTitle,\r\n text: this.cancelledMessage,\r\n icon: 'error',\r\n showCancelButton: false,\r\n showConfirmButton: false,\r\n timer: 1000\r\n })\r\n .then(() => { }, () => { }); // keep this line to prevent promise error;\r\n }\r\n });\r\n\r\n this.result = true;\r\n this.close();\r\n }\r\n\r\n\r\n cancel() {\r\n this.result = false;\r\n this.close();\r\n }\r\n\r\n nextStep() {\r\n this.step++;\r\n }\r\n\r\n onContactUs() {\r\n window.open('https://www.structurestudios.com/help/kb-tickets/new', '_blank');\r\n }\r\n}\r\n","import {Directive,HostListener} from '@angular/core'\r\n\r\n@Directive({\r\n\tselector: '[cdKeyMask]'\r\n})\r\nexport class CDKeyDirective {\r\n\r\n\t@HostListener('input', ['$event'])\r\n\tonKeyDown(event: KeyboardEvent) {\r\n\t\tconst input = event.target as HTMLInputElement;\r\n\r\n\t\t// remove spaces\r\n\t\tlet trimmed = input.value.replace(/\\s+/g, '');\r\n\r\n\t\t// trim string to 17 characters (15 characters and 2 dashes)\r\n\t\tif (trimmed.length > 17) {\r\n\t\t\ttrimmed = trimmed.substr(0, 17);\r\n\t\t}\r\n\r\n\t\t// trim '-' dashes\r\n\t\ttrimmed = trimmed.replace(/-/g,'');\r\n\r\n\t\t\r\n\t\ttrimmed = trimmed.toUpperCase();\r\n\r\n // new array to hold sections of the License Key\r\n\t\tlet numbers = [];\r\n\r\n\t\t// create set of characters from first 5 characters\r\n\t\tnumbers.push(trimmed.substr(0,5));\r\n\t\t\r\n\t\t// try for next 5\r\n\t\tif(trimmed.substr(5,5)!==\"\")\r\n\t\t\tnumbers.push(trimmed.substr(5,5));\r\n\t\t\r\n\t\t// and last set of 5\r\n\t\tif(trimmed.substr(10,10)!=\"\")\r\n\t\t\tnumbers.push(trimmed.substr(10,10));\r\n\r\n\t\t// add '-' dashes back to formated string\r\n\t\tinput.value = numbers.join('-');\r\n\r\n\r\n\t}\r\n}\r\n","import { Directive, Input, OnChanges, SimpleChanges } from '@angular/core';\r\nimport {\r\n AbstractControl, NG_VALIDATORS, NgModel, ValidationErrors, Validator, ValidatorFn,\r\n Validators\r\n} from '@angular/forms';\r\n\r\n@Directive({\r\n selector: '[fieldMatches]',\r\n providers: [{\r\n provide: NG_VALIDATORS,\r\n useExisting: FieldMatchesValidatorDirective,\r\n multi: true\r\n }]\r\n})\r\nexport class FieldMatchesValidatorDirective implements Validator, OnChanges {\r\n @Input() fieldMatches: NgModel;\r\n\r\n private validationFunction = Validators.nullValidator;\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n let change = changes['fieldMatches'];\r\n if (change) {\r\n const otherFieldModel = change.currentValue;\r\n this.validationFunction = fieldMatchesValidator(otherFieldModel);\r\n } else {\r\n this.validationFunction = Validators.nullValidator;\r\n }\r\n }\r\n\r\n validate(control: AbstractControl): ValidationErrors | any {\r\n return this.validationFunction(control);\r\n }\r\n}\r\n\r\nexport function fieldMatchesValidator(otherFieldModel: NgModel): ValidatorFn {\r\n return (control: AbstractControl): ValidationErrors => {\r\n return control.value === otherFieldModel.value ? null : { 'fieldMatches': { match: false } };\r\n };\r\n}\r\n","import { Directive, HostListener } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[formControlName][appMonthYearMask]',\r\n})\r\nexport class MonthYearMaskDirective {\r\n\r\n @HostListener('input', ['$event'])\r\n onKeyDown(event: KeyboardEvent) {\r\n const input = event.target as HTMLInputElement;\r\n\r\n const trimmed = input.value.replace(/\\s+/g, '').slice(0, input.value.indexOf('/')==-1?4:5);\r\n if (trimmed.length > 3) {\r\n return (input.value = `${trimmed.slice(0, 2)}/${trimmed.slice(trimmed.indexOf('/')==-1?2:3)}`);\r\n }\r\n }\r\n \r\n}\r\n","import {Directive,HostListener} from '@angular/core'\r\n\r\n@Directive({\r\n\tselector: '[numberSlashMask]'\r\n})\r\nexport class MyNumberSlashDirective {\r\n\r\n\t@HostListener('input', ['$event'])\r\n\tonKeyDown(event: KeyboardEvent) {\r\n\t\tconst input = event.target as HTMLInputElement;\r\n\r\n\t\t// remove spaces\r\n\t\tlet trimmed = input.value.replace(/\\s+/g, '');\r\n\r\n\t\ttrimmed = trimmed.replace(/[^\\d\\/]/g, \"\");\r\n\r\n\t\tinput.value = trimmed;\r\n\r\n\t}\r\n}","import {Directive,HostListener} from '@angular/core'\r\n\r\n@Directive({\r\n\tselector: '[numberMask]'\r\n})\r\nexport class MyNumberDirective {\r\n\r\n\t@HostListener('input', ['$event'])\r\n\tonKeyDown(event: KeyboardEvent) {\r\n\t\tconst input = event.target as HTMLInputElement;\r\n\r\n\t\t// remove spaces\r\n\t\tlet trimmed = input.value.replace(/\\s+/g, '');\r\n\r\n\t\ttrimmed = trimmed.replace(/[^\\d]/g, \"\");\r\n\r\n\t\tinput.value = trimmed;\r\n\r\n\t}\r\n}","import {Directive,HostListener} from '@angular/core'\r\n\r\n@Directive({\r\n\tselector: '[phoneMask]'\r\n})\r\nexport class PhoneDirective {\r\n\r\n\t@HostListener('input', ['$event'])\r\n\tonKeyDown(event: KeyboardEvent) {\r\n\t\tconst input = event.target as HTMLInputElement;\r\n\t\t\r\n\t\t// remove spaces\r\n\t\tlet trimmed = input.value.replace(/\\s+/g, '');\r\n\r\n\t\tinput.value = this.GetInputValue( trimmed );\r\n\t\t\r\n\t}\r\n\r\n\tpublic GetInputValue( v : string ) : string {\r\n\t\t\r\n\r\n\t\t// trim '-' dashes\r\n\t\tv = v.replace(/-/g,'');\r\n\r\n\t\tv = v.replace(/[^\\d]/g, \"\");\r\n\t\t\r\n\t\t// trim string to 15 characters\r\n\t\tif( v.length > 10) {\r\n\t\t\tif (v.length > 15) {\r\n\t\t\t\tv = v.substr(0, 15);\r\n\t\t\t}\r\n\t\t\treturn ' +' + v;\r\n\t\t}\r\n\t\t\r\n\r\n // new array to hold sections of the License Key\r\n\t\tlet numbers = [];\r\n\r\n\t\t// create set of characters from first 5 characters\r\n\t\tnumbers.push(v.substr(0,3));\r\n\t\t\r\n\t\t// try for next 5\r\n\t\tif(v.substr(3,3)!==\"\")\r\n\t\t\tnumbers.push(v.substr(3,3));\r\n\t\t\r\n\t\t// and last set of 5\r\n\t\tif(v.substr(6,10)!=\"\")\r\n\t\t\tnumbers.push(v.substr(6,4));\r\n\t\t\r\n\t\tif(v.substr(10,15)!=\"\")\r\n\t\t\tnumbers.push(v.substr(10,5));\r\n\r\n\t\t// add '-' dashes back to formated string\r\n\t\tlet newValue = numbers[0];\r\n\t\t\r\n\t\t//if( newValue.length == 3 ) {\r\n\t\t\t\r\n\t\t//}\r\n\r\n\t\tif( numbers.length > 1 ) {\r\n\t\t\tnewValue = '(' + newValue + ') ';\r\n\t\t\tnewValue += numbers[1];\r\n\t\t}\r\n\t\t\t\r\n\r\n\t\tif (numbers.length > 2 )\r\n\t\t\tnewValue += '-' + numbers[2];\r\n\r\n\t\t// if (numbers.length > 3 )\r\n\t\t// \tnewValue += '-' + numbers[3];\r\n\r\n\t\treturn newValue;\r\n\t}\r\n\r\n}\r\n","import {Directive,HostListener} from '@angular/core'\r\n\r\n@Directive({\r\n\tselector: '[zipCodeMask]'\r\n})\r\nexport class ZipCodeDirective {\r\n\r\n\t@HostListener('input', ['$event'])\r\n\tonKeyDown(event: KeyboardEvent) {\r\n\t\tconst input = event.target as HTMLInputElement;\r\n\r\n\t\t// remove spaces\r\n\t\tlet trimmed = input.value.replace(/\\s+/g, '');\r\n\r\n\t\ttrimmed = trimmed.replace(/[^\\d]/g, \"\");\r\n\r\n\t\tif (trimmed.length > 5) {\r\n\t\t\ttrimmed = trimmed.substr(0, 5);\r\n\t\t}\r\n\r\n\t\tinput.value = trimmed;\r\n\r\n\t}\r\n}","\r\nexport class CountryListItem {\r\n\r\n\tlabel : string;\r\n\tvalue : string;\r\n\r\n}\r\n\r\nexport class CountryList {\r\n\r\n\r\n\tprivate static countries : CountryListItem[] = [\r\n\t\t{ label : \"United States\", value : \"US\"}, \r\n\t\t\r\n\t\t{ label : \"Afghanistan\", value : \"AF\"}, \r\n\t\t{ label : \"Aland Islands\", value : \"AX\"}, \r\n\t\t{ label : \"Albania\", value : \"AL\"}, \r\n\t\t{ label : \"Algeria\", value : \"DZ\"}, \r\n\t\t{ label : \"American Samoa\", value : \"AS\"}, \r\n\t\t{ label : \"AndorrA\", value : \"AD\"}, \r\n\t\t{ label : \"Angola\", value : \"AO\"}, \r\n\t\t{ label : \"Anguilla\", value : \"AI\"}, \r\n\t\t{ label : \"Antarctica\", value : \"AQ\"}, \r\n\t\t{ label : \"Antigua and Barbuda\", value : \"AG\"}, \r\n\t\t{ label : \"Argentina\", value : \"AR\"}, \r\n\t\t{ label : \"Armenia\", value : \"AM\"}, \r\n\t\t{ label : \"Aruba\", value : \"AW\"}, \r\n\t\t{ label : \"Australia\", value : \"AU\"}, \r\n\t\t{ label : \"Austria\", value : \"AT\"}, \r\n\t\t{ label : \"Azerbaijan\", value : \"AZ\"}, \r\n\t\t{ label : \"Bahamas\", value : \"BS\"}, \r\n\t\t{ label : \"Bahrain\", value : \"BH\"}, \r\n\t\t{ label : \"Bangladesh\", value : \"BD\"}, \r\n\t\t{ label : \"Barbados\", value : \"BB\"}, \r\n\t\t{ label : \"Belarus\", value : \"BY\"}, \r\n\t\t{ label : \"Belgium\", value : \"BE\"}, \r\n\t\t{ label : \"Belize\", value : \"BZ\"}, \r\n\t\t{ label : \"Benin\", value : \"BJ\"}, \r\n\t\t{ label : \"Bermuda\", value : \"BM\"}, \r\n\t\t{ label : \"Bhutan\", value : \"BT\"}, \r\n\t\t{ label : \"Bolivia\", value : \"BO\"}, \r\n\t\t{ label : \"Bosnia and Herzegovina\", value : \"BA\"}, \r\n\t\t{ label : \"Botswana\", value : \"BW\"}, \r\n\t\t{ label : \"Bouvet Island\", value : \"BV\"}, \r\n\t\t{ label : \"Brazil\", value : \"BR\"}, \r\n\t\t{ label : \"British Indian Ocean Territory\", value : \"IO\"}, \r\n\t\t{ label : \"Brunei Darussalam\", value : \"BN\"}, \r\n\t\t{ label : \"Bulgaria\", value : \"BG\"}, \r\n\t\t{ label : \"Burkina Faso\", value : \"BF\"}, \r\n\t\t{ label : \"Burundi\", value : \"BI\"}, \r\n\t\t{ label : \"Cambodia\", value : \"KH\"}, \r\n\t\t{ label : \"Cameroon\", value : \"CM\"}, \r\n\t\t{ label : \"Canada\", value : \"CA\"}, \r\n\t\t{ label : \"Cape Verde\", value : \"CV\"}, \r\n\t\t{ label : \"Cayman Islands\", value : \"KY\"}, \r\n\t\t{ label : \"Central African Republic\", value : \"CF\"}, \r\n\t\t{ label : \"Chad\", value : \"TD\"}, \r\n\t\t{ label : \"Chile\", value : \"CL\"}, \r\n\t\t{ label : \"China\", value : \"CN\"}, \r\n\t\t{ label : \"Christmas Island\", value : \"CX\"}, \r\n\t\t{ label : \"Cocos (Keeling) Islands\", value : \"CC\"}, \r\n\t\t{ label : \"Colombia\", value : \"CO\"}, \r\n\t\t{ label : \"Comoros\", value : \"KM\"}, \r\n\t\t{ label : \"Congo\", value : \"CG\"}, \r\n\t\t{ label : \"Congo, The Democratic Republic of the\", value : \"CD\"}, \r\n\t\t{ label : \"Cook Islands\", value : \"CK\"}, \r\n\t\t{ label : \"Costa Rica\", value : \"CR\"}, \r\n\t\t{ label : \"Cote D'Ivoire\", value : \"CI\"}, \r\n\t\t{ label : \"Croatia\", value : \"HR\"}, \r\n\t\t{ label : \"Cuba\", value : \"CU\"}, \r\n\t\t{ label : \"Cyprus\", value : \"CY\"}, \r\n\t\t{ label : \"Czech Republic\", value : \"CZ\"}, \r\n\t\t{ label : \"Denmark\", value : \"DK\"}, \r\n\t\t{ label : \"Djibouti\", value : \"DJ\"}, \r\n\t\t{ label : \"Dominica\", value : \"DM\"}, \r\n\t\t{ label : \"Dominican Republic\", value : \"DO\"}, \r\n\t\t{ label : \"Ecuador\", value : \"EC\"}, \r\n\t\t{ label : \"Egypt\", value : \"EG\"}, \r\n\t\t{ label : \"El Salvador\", value : \"SV\"}, \r\n\t\t{ label : \"Equatorial Guinea\", value : \"GQ\"}, \r\n\t\t{ label : \"Eritrea\", value : \"ER\"}, \r\n\t\t{ label : \"Estonia\", value : \"EE\"}, \r\n\t\t{ label : \"Ethiopia\", value : \"ET\"}, \r\n\t\t{ label : \"Falkland Islands (Malvinas)\", value : \"FK\"}, \r\n\t\t{ label : \"Faroe Islands\", value : \"FO\"}, \r\n\t\t{ label : \"Fiji\", value : \"FJ\"}, \r\n\t\t{ label : \"Finland\", value : \"FI\"}, \r\n\t\t{ label : \"France\", value : \"FR\"}, \r\n\t\t{ label : \"French Guiana\", value : \"GF\"}, \r\n\t\t{ label : \"French Polynesia\", value : \"PF\"}, \r\n\t\t{ label : \"French Southern Territories\", value : \"TF\"}, \r\n\t\t{ label : \"Gabon\", value : \"GA\"}, \r\n\t\t{ label : \"Gambia\", value : \"GM\"}, \r\n\t\t{ label : \"Georgia\", value : \"GE\"}, \r\n\t\t{ label : \"Germany\", value : \"DE\"}, \r\n\t\t{ label : \"Ghana\", value : \"GH\"}, \r\n\t\t{ label : \"Gibraltar\", value : \"GI\"}, \r\n\t\t{ label : \"Greece\", value : \"GR\"}, \r\n\t\t{ label : \"Greenland\", value : \"GL\"}, \r\n\t\t{ label : \"Grenada\", value : \"GD\"}, \r\n\t\t{ label : \"Guadeloupe\", value : \"GP\"}, \r\n\t\t{ label : \"Guam\", value : \"GU\"}, \r\n\t\t{ label : \"Guatemala\", value : \"GT\"}, \r\n\t\t{ label : \"Guernsey\", value : \"GG\"}, \r\n\t\t{ label : \"Guinea\", value : \"GN\"}, \r\n\t\t{ label : \"Guinea-Bissau\", value : \"GW\"}, \r\n\t\t{ label : \"Guyana\", value : \"GY\"}, \r\n\t\t{ label : \"Haiti\", value : \"HT\"}, \r\n\t\t{ label : \"Heard Island and Mcdonald Islands\", value : \"HM\"}, \r\n\t\t{ label : \"Holy See (Vatican City State)\", value : \"VA\"}, \r\n\t\t{ label : \"Honduras\", value : \"HN\"}, \r\n\t\t{ label : \"Hong Kong\", value : \"HK\"}, \r\n\t\t{ label : \"Hungary\", value : \"HU\"}, \r\n\t\t{ label : \"Iceland\", value : \"IS\"}, \r\n\t\t{ label : \"India\", value : \"IN\"}, \r\n\t\t{ label : \"Indonesia\", value : \"ID\"}, \r\n\t\t{ label : \"Iran, Islamic Republic Of\", value : \"IR\"}, \r\n\t\t{ label : \"Iraq\", value : \"IQ\"}, \r\n\t\t{ label : \"Ireland\", value : \"IE\"}, \r\n\t\t{ label : \"Isle of Man\", value : \"IM\"}, \r\n\t\t{ label : \"Israel\", value : \"IL\"}, \r\n\t\t{ label : \"Italy\", value : \"IT\"}, \r\n\t\t{ label : \"Jamaica\", value : \"JM\"}, \r\n\t\t{ label : \"Japan\", value : \"JP\"}, \r\n\t\t{ label : \"Jersey\", value : \"JE\"}, \r\n\t\t{ label : \"Jordan\", value : \"JO\"}, \r\n\t\t{ label : \"Kazakhstan\", value : \"KZ\"}, \r\n\t\t{ label : \"Kenya\", value : \"KE\"}, \r\n\t\t{ label : \"Kiribati\", value : \"KI\"}, \r\n\t\t{ label : \"Korea, Democratic People's Republic of\", value : \"KP\"}, \r\n\t\t{ label : \"Korea, Republic of\", value : \"KR\"}, \r\n\t\t{ label : \"Kuwait\", value : \"KW\"}, \r\n\t\t{ label : \"Kyrgyzstan\", value : \"KG\"}, \r\n\t\t{ label : \"Lao People's Democratic Republic\", value : \"LA\"}, \r\n\t\t{ label : \"Latvia\", value : \"LV\"}, \r\n\t\t{ label : \"Lebanon\", value : \"LB\"}, \r\n\t\t{ label : \"Lesotho\", value : \"LS\"}, \r\n\t\t{ label : \"Liberia\", value : \"LR\"}, \r\n\t\t{ label : \"Libyan Arab Jamahiriya\", value : \"LY\"}, \r\n\t\t{ label : \"Liechtenstein\", value : \"LI\"}, \r\n\t\t{ label : \"Lithuania\", value : \"LT\"}, \r\n\t\t{ label : \"Luxembourg\", value : \"LU\"}, \r\n\t\t{ label : \"Macao\", value : \"MO\"}, \r\n\t\t{ label : \"Macedonia, The Former Yugoslav Republic of\", value : \"MK\"}, \r\n\t\t{ label : \"Madagascar\", value : \"MG\"}, \r\n\t\t{ label : \"Malawi\", value : \"MW\"}, \r\n\t\t{ label : \"Malaysia\", value : \"MY\"}, \r\n\t\t{ label : \"Maldives\", value : \"MV\"}, \r\n\t\t{ label : \"Mali\", value : \"ML\"}, \r\n\t\t{ label : \"Malta\", value : \"MT\"}, \r\n\t\t{ label : \"Marshall Islands\", value : \"MH\"}, \r\n\t\t{ label : \"Martinique\", value : \"MQ\"}, \r\n\t\t{ label : \"Mauritania\", value : \"MR\"}, \r\n\t\t{ label : \"Mauritius\", value : \"MU\"}, \r\n\t\t{ label : \"Mayotte\", value : \"YT\"}, \r\n\t\t{ label : \"Mexico\", value : \"MX\"}, \r\n\t\t{ label : \"Micronesia, Federated States of\", value : \"FM\"}, \r\n\t\t{ label : \"Moldova, Republic of\", value : \"MD\"}, \r\n\t\t{ label : \"Monaco\", value : \"MC\"}, \r\n\t\t{ label : \"Mongolia\", value : \"MN\"}, \r\n\t\t{ label : \"Montenegro\", value : \"ME\"},\r\n\t\t{ label : \"Montserrat\", value : \"MS\"},\r\n\t\t{ label : \"Morocco\", value : \"MA\"}, \r\n\t\t{ label : \"Mozambique\", value : \"MZ\"}, \r\n\t\t{ label : \"Myanmar\", value : \"MM\"}, \r\n\t\t{ label : \"Namibia\", value : \"NA\"}, \r\n\t\t{ label : \"Nauru\", value : \"NR\"}, \r\n\t\t{ label : \"Nepal\", value : \"NP\"}, \r\n\t\t{ label : \"Netherlands\", value : \"NL\"}, \r\n\t\t{ label : \"Netherlands Antilles\", value : \"AN\"}, \r\n\t\t{ label : \"New Caledonia\", value : \"NC\"}, \r\n\t\t{ label : \"New Zealand\", value : \"NZ\"}, \r\n\t\t{ label : \"Nicaragua\", value : \"NI\"}, \r\n\t\t{ label : \"Niger\", value : \"NE\"}, \r\n\t\t{ label : \"Nigeria\", value : \"NG\"}, \r\n\t\t{ label : \"Niue\", value : \"NU\"}, \r\n\t\t{ label : \"Norfolk Island\", value : \"NF\"}, \r\n\t\t{ label : \"Northern Mariana Islands\", value : \"MP\"}, \r\n\t\t{ label : \"Norway\", value : \"NO\"}, \r\n\t\t{ label : \"Oman\", value : \"OM\"}, \r\n\t\t{ label : \"Pakistan\", value : \"PK\"}, \r\n\t\t{ label : \"Palau\", value : \"PW\"}, \r\n\t\t{ label : \"Palestinian Territory, Occupied\", value : \"PS\"}, \r\n\t\t{ label : \"Panama\", value : \"PA\"}, \r\n\t\t{ label : \"Papua New Guinea\", value : \"PG\"}, \r\n\t\t{ label : \"Paraguay\", value : \"PY\"}, \r\n\t\t{ label : \"Peru\", value : \"PE\"}, \r\n\t\t{ label : \"Philippines\", value : \"PH\"}, \r\n\t\t{ label : \"Pitcairn\", value : \"PN\"}, \r\n\t\t{ label : \"Poland\", value : \"PL\"}, \r\n\t\t{ label : \"Portugal\", value : \"PT\"}, \r\n\t\t{ label : \"Puerto Rico\", value : \"PR\"}, \r\n\t\t{ label : \"Qatar\", value : \"QA\"}, \r\n\t\t{ label : \"Reunion\", value : \"RE\"}, \r\n\t\t{ label : \"Romania\", value : \"RO\"}, \r\n\t\t{ label : \"Russian Federation\", value : \"RU\"}, \r\n\t\t{ label : \"RWANDA\", value : \"RW\"}, \r\n\t\t{ label : \"Saint Helena\", value : \"SH\"}, \r\n\t\t{ label : \"Saint Kitts and Nevis\", value : \"KN\"}, \r\n\t\t{ label : \"Saint Lucia\", value : \"LC\"}, \r\n\t\t{ label : \"Saint Pierre and Miquelon\", value : \"PM\"}, \r\n\t\t{ label : \"Saint Vincent and the Grenadines\", value : \"VC\"}, \r\n\t\t{ label : \"Samoa\", value : \"WS\"}, \r\n\t\t{ label : \"San Marino\", value : \"SM\"}, \r\n\t\t{ label : \"Sao Tome and Principe\", value : \"ST\"}, \r\n\t\t{ label : \"Saudi Arabia\", value : \"SA\"}, \r\n\t\t{ label : \"Senegal\", value : \"SN\"}, \r\n\t\t{ label : \"Serbia\", value : \"RS\"}, \r\n\t\t{ label : \"Seychelles\", value : \"SC\"}, \r\n\t\t{ label : \"Sierra Leone\", value : \"SL\"}, \r\n\t\t{ label : \"Singapore\", value : \"SG\"}, \r\n\t\t{ label : \"Slovakia\", value : \"SK\"}, \r\n\t\t{ label : \"Slovenia\", value : \"SI\"}, \r\n\t\t{ label : \"Solomon Islands\", value : \"SB\"}, \r\n\t\t{ label : \"Somalia\", value : \"SO\"}, \r\n\t\t{ label : \"South Africa\", value : \"ZA\"}, \r\n\t\t{ label : \"South Georgia and the South Sandwich Islands\", value : \"GS\"}, \r\n\t\t{ label : \"Spain\", value : \"ES\"}, \r\n\t\t{ label : \"Sri Lanka\", value : \"LK\"}, \r\n\t\t{ label : \"Sudan\", value : \"SD\"}, \r\n\t\t{ label : \"Suriname\", value : \"SR\"}, \r\n\t\t{ label : \"Svalbard and Jan Mayen\", value : \"SJ\"}, \r\n\t\t{ label : \"Swaziland\", value : \"SZ\"}, \r\n\t\t{ label : \"Sweden\", value : \"SE\"}, \r\n\t\t{ label : \"Switzerland\", value : \"CH\"}, \r\n\t\t{ label : \"Syrian Arab Republic\", value : \"SY\"}, \r\n\t\t{ label : \"Taiwan, Province of China\", value : \"TW\"}, \r\n\t\t{ label : \"Tajikistan\", value : \"TJ\"}, \r\n\t\t{ label : \"Tanzania, United Republic of\", value : \"TZ\"}, \r\n\t\t{ label : \"Thailand\", value : \"TH\"}, \r\n\t\t{ label : \"Timor-Leste\", value : \"TL\"}, \r\n\t\t{ label : \"Togo\", value : \"TG\"}, \r\n\t\t{ label : \"Tokelau\", value : \"TK\"}, \r\n\t\t{ label : \"Tonga\", value : \"TO\"}, \r\n\t\t{ label : \"Trinidad and Tobago\", value : \"TT\"}, \r\n\t\t{ label : \"Tunisia\", value : \"TN\"}, \r\n\t\t{ label : \"Turkey\", value : \"TR\"}, \r\n\t\t{ label : \"Turkmenistan\", value : \"TM\"}, \r\n\t\t{ label : \"Turks and Caicos Islands\", value : \"TC\"}, \r\n\t\t{ label : \"Tuvalu\", value : \"TV\"}, \r\n\t\t{ label : \"Uganda\", value : \"UG\"}, \r\n\t\t{ label : \"Ukraine\", value : \"UA\"}, \r\n\t\t{ label : \"United Arab Emirates\", value : \"AE\"}, \r\n\t\t{ label : \"United Kingdom\", value : \"GB\"}, \r\n\t\t{ label : \"United States Minor Outlying Islands\", value : \"UM\"},\r\n\t\t{ label : \"Uruguay\", value : \"UY\"}, \r\n\t\t{ label : \"Uzbekistan\", value : \"UZ\"}, \r\n\t\t{ label : \"Vanuatu\", value : \"VU\"}, \r\n\t\t{ label : \"Venezuela\", value : \"VE\"}, \r\n\t\t{ label : \"Viet Nam\", value : \"VN\"}, \r\n\t\t{ label : \"Virgin Islands, British\", value : \"VG\"}, \r\n\t\t{ label : \"Virgin Islands, U.S.\", value : \"VI\"}, \r\n\t\t{ label : \"Wallis and Futuna\", value : \"WF\"}, \r\n\t\t{ label : \"Western Sahara\", value : \"EH\"}, \r\n\t\t{ label : \"Yemen\", value : \"YE\"}, \r\n\t\t{ label : \"Zambia\", value : \"ZM\"}, \r\n\t\t{ label : \"Zimbabwe\", value : \"ZW\"}\r\n\r\n\t];\r\n\r\n\r\n\tpublic static Countries() : CountryListItem[] {\r\n\t\treturn this.countries;\r\n\t} \r\n\r\n\r\n\tpublic static ValidCountry( country : string ) : string {\r\n\r\n\t\t\r\n\r\n\t\tlet theList = CountryList.Countries();\r\n\r\n\t\t//console.log(\"The List:\", theList);\r\n\r\n\t\tfor( let c = 0; c < theList.length; c++ ) {\r\n\t\t\tif( theList[c].value.toLowerCase() == country.toLowerCase() || theList[c].label.toLowerCase() == country.toLowerCase() ) {\r\n\t\t\t\t\r\n\t\t\t\treturn theList[c].value;\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconsole.log(\"No Country Match for '\" + country + \"'\");\r\n\t\treturn \"\";\r\n\r\n\t}\r\n\r\n\r\n\r\n}","import { CreditCardTypes } from \"app/models/ss-api/responses/credit.card.response\";\r\nimport { FormControl } from '@angular/forms';\r\n\r\nexport class CardTypeInfo {\r\n\r\n public RegEx : RegExp;\r\n public Length : number;\r\n public Type : CreditCardTypes;\r\n \r\n constructor( regEx : RegExp, length : number, type : CreditCardTypes)\r\n {\r\n this.RegEx = regEx;\r\n this.Length = length;\r\n this.Type = type;\r\n }\r\n\r\n\r\n \r\n\r\n}\r\n\r\nexport class CreditCardHelper {\r\n\r\n\r\n public static GetCardType( number : string ) : string {\r\n // visa\r\n var re = new RegExp(\"^4\");\r\n if (number.match(re) != null)\r\n return \"Visa\";\r\n\r\n // Mastercard \r\n // Updated for Mastercard 2017 BINs expansion\r\n if (/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/.test(number)) \r\n return \"Mastercard\";\r\n\r\n // AMEX\r\n re = new RegExp(\"^3[47]\");\r\n if (number.match(re) != null)\r\n return \"AMEX\";\r\n\r\n // Discover\r\n re = new RegExp(\"^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)\");\r\n if (number.match(re) != null)\r\n return \"Discover\";\r\n\r\n // Diners\r\n re = new RegExp(\"^36\");\r\n if (number.match(re) != null)\r\n return \"Diners\";\r\n\r\n // Diners - Carte Blanche\r\n re = new RegExp(\"^30[0-5]\");\r\n if (number.match(re) != null)\r\n return \"Diners - Carte Blanche\";\r\n\r\n // JCB\r\n re = new RegExp(\"^35(2[89]|[3-8][0-9])\");\r\n if (number.match(re) != null)\r\n return \"JCB\";\r\n\r\n // Visa Electron\r\n re = new RegExp(\"^(4026|417500|4508|4844|491(3|7))\");\r\n if (number.match(re) != null)\r\n return \"Visa Electron\";\r\n\r\n return \"\";\r\n }\r\n\r\n \r\n\r\n\r\n private static _cardTypeInfo : CardTypeInfo[] = [\r\n \r\n // FROM NICK - These are from the backend code, don't seem to work in Angular\r\n new CardTypeInfo( new RegExp(\"^(51|52|53|54|55)\"), 16, CreditCardTypes.MasterCard),\r\n new CardTypeInfo( new RegExp(\"^(4)\"), 16, CreditCardTypes.VISA),\r\n new CardTypeInfo( new RegExp(\"^(4)\"), 13, CreditCardTypes.VISA),\r\n new CardTypeInfo( new RegExp(\"^(34|37)\"), 15, CreditCardTypes.AmericanExpress),\r\n new CardTypeInfo( new RegExp(\"^(6011)\"), 16, CreditCardTypes.Discover),\r\n new CardTypeInfo( new RegExp(\"^(300|301|302|303|304|305|36|38)\"), 14, CreditCardTypes.DinersClub),\r\n new CardTypeInfo( new RegExp(\"^(3)\"), 16, CreditCardTypes.JCB),\r\n new CardTypeInfo( new RegExp(\"^(2131|1800)\"), 15, CreditCardTypes.JCB),\r\n new CardTypeInfo( new RegExp(\"^(2014|2149)\"), 15, CreditCardTypes.EnRoute),\r\n\r\n // new CardTypeInfo( new RegExp(\"^(51|52|53|54|55)\"), 16, CreditCardTypes.MasterCard),\r\n // new CardTypeInfo( new RegExp(\"^4\"), 16, CreditCardTypes.VISA),\r\n // new CardTypeInfo( new RegExp(\"^4\"), 13, CreditCardTypes.VISA),\r\n // new CardTypeInfo( new RegExp(\"^(34|37)\"), 15, CreditCardTypes.AmericanExpress),\r\n // new CardTypeInfo( new RegExp(\"^(6011)\"), 16, CreditCardTypes.Discover),\r\n // new CardTypeInfo( new RegExp(\"^(300|301|302|303|304|305|36|38)\"), 14, CreditCardTypes.DinersClub),\r\n // new CardTypeInfo( new RegExp(\"^(3)\"), 16, CreditCardTypes.JCB),\r\n // new CardTypeInfo( new RegExp(\"^(2131|1800)\"), 15, CreditCardTypes.JCB),\r\n // new CardTypeInfo( new RegExp(\"^(2014|2149)\"), 15, CreditCardTypes.EnRoute),\r\n \r\n ];\r\n\r\n\r\n\r\n public static GetCardTypes( cardNumber : string ) : CreditCardTypes {\r\n //Replace any spaces, periods, etc.\r\n cardNumber = cardNumber.replace(\"[^0-9]\", \"\");\r\n\r\n for ( var i = 0; i < this._cardTypeInfo.length; i++ ) {\r\n \r\n let item = this._cardTypeInfo[i];\r\n \r\n if( cardNumber.length == item.Length && cardNumber.match( item.RegEx ) != null ) {\r\n return item.Type;\r\n }\r\n \r\n }\r\n\r\n return CreditCardTypes.Unknown;\r\n\r\n }\r\n\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","\r\nexport class StateListItem {\r\n\r\n\tlabel : string;\r\n\tvalue : string;\r\n\r\n}\r\n\r\nexport class StateList {\r\n\r\n\r\n\tprivate static states : StateListItem[] = [\r\n\t\t{ label : \"\", value : \"\"}, \r\n\t\t\r\n\t\t{ label : \"Alabama\", value : \"AL\"}, \r\n\t\t{ label : \"Alaska\", value : \"AK\"}, \r\n\t\t{ label : \"American Samoa\", value : \"AS\"}, \r\n\t\t{ label : \"Arizona\", value : \"AZ\"}, \r\n\t\t{ label : \"Arkansas\", value : \"AR\"}, \r\n\t\t{ label : \"California\", value : \"CA\"}, \r\n\t\t{ label : \"Colorado\", value : \"CO\"}, \r\n\t\t{ label : \"Connecticut\", value : \"CT\"}, \r\n\t\t{ label : \"Delaware\", value : \"DE\"}, \r\n\t\t{ label : \"District Of Columbia\", value : \"DC\"}, \r\n\t\t{ label : \"Federated States Of Micronesia\", value : \"FM\"}, \r\n\t\t{ label : \"Florida\", value : \"FL\"}, \r\n\t\t{ label : \"Georgia\", value : \"GA\"}, \r\n\t\t{ label : \"Guam\", value : \"GU\"}, \r\n\t\t{ label : \"Hawaii\", value : \"HI\"}, \r\n\t\t{ label : \"Idaho\", value : \"ID\"}, \r\n\t\t{ label : \"Illinois\", value : \"IL\"}, \r\n\t\t{ label : \"Indiana\", value : \"IN\"}, \r\n\t\t{ label : \"Iowa\", value : \"IA\"}, \r\n\t\t{ label : \"Kansas\", value : \"KS\"}, \r\n\t\t{ label : \"Kentucky\", value : \"KY\"}, \r\n\t\t{ label : \"Louisiana\", value : \"LA\"}, \r\n\t\t{ label : \"Maine\", value : \"ME\"}, \r\n\t\t{ label : \"Marshall Islands\", value : \"MH\"}, \r\n\t\t{ label : \"Maryland\", value : \"MD\"}, \r\n\t\t{ label : \"Massachusetts\", value : \"MA\"}, \r\n\t\t{ label : \"Michigan\", value : \"MI\"}, \r\n\t\t{ label : \"Minnesota\", value : \"MN\"}, \r\n\t\t{ label : \"Mississippi\", value : \"MS\"}, \r\n\t\t{ label : \"Missouri\", value : \"MO\"}, \r\n\t\t{ label : \"Montana\", value : \"MT\"}, \r\n\t\t{ label : \"Nebraska\", value : \"NE\"}, \r\n\t\t{ label : \"Nevada\", value : \"NV\"}, \r\n\t\t{ label : \"New Hampshire\", value : \"NH\"}, \r\n\t\t{ label : \"New Jersey\", value : \"NJ\"}, \r\n\t\t{ label : \"New Mexico\", value : \"NM\"}, \r\n\t\t{ label : \"New York\", value : \"NY\"}, \r\n\t\t{ label : \"North Carolina\", value : \"NC\"}, \r\n\t\t{ label : \"North Dakota\", value : \"ND\"}, \r\n\t\t{ label : \"Northern Mariana Islands\", value : \"MP\"}, \r\n\t\t{ label : \"Ohio\", value : \"OH\"}, \r\n\t\t{ label : \"Oklahoma\", value : \"OK\"}, \r\n\t\t{ label : \"Oregon\", value : \"OR\"}, \r\n\t\t{ label : \"Palau\", value : \"PW\"}, \r\n\t\t{ label : \"Pennsylvania\", value : \"PA\"}, \r\n\t\t{ label : \"Puerto Rico\", value : \"PR\"}, \r\n\t\t{ label : \"Rhode Island\", value : \"RI\"}, \r\n\t\t{ label : \"South Carolina\", value : \"SC\"}, \r\n\t\t{ label : \"South Dakota\", value : \"SD\"}, \r\n\t\t{ label : \"Tennessee\", value : \"TN\"}, \r\n\t\t{ label : \"Texas\", value : \"TX\"}, \r\n\t\t{ label : \"Utah\", value : \"UT\"}, \r\n\t\t{ label : \"Vermont\", value : \"VT\"}, \r\n\t\t{ label : \"Virgin Islands\", value : \"VI\"}, \r\n\t\t{ label : \"Virginia\", value : \"VA\"}, \r\n\t\t{ label : \"Washington\", value : \"WA\"}, \r\n\t\t{ label : \"West Virginia\", value : \"WV\"}, \r\n\t\t{ label : \"Wisconsin\", value : \"WI\"}, \r\n\t\t{ label : \"Wyoming\", value : \"WY\"}\r\n\t];\r\n\r\n\r\n\tpublic static States() : StateListItem[] {\r\n\t\treturn this.states;\r\n\t} \r\n\r\n\r\n\tpublic static ValidCountry( country : string ) : string {\r\n\r\n\t\t\r\n\r\n\t\tlet theList = StateList.States();\r\n\r\n\t\t//console.log(\"The List:\", theList);\r\n\r\n\t\tfor( let c = 0; c < theList.length; c++ ) {\r\n\t\t\tif( theList[c].value.toLowerCase() == country.toLowerCase() || theList[c].label.toLowerCase() == country.toLowerCase() ) {\r\n\t\t\t\t\r\n\t\t\t\treturn theList[c].value;\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconsole.log(\"No State Match for '\" + country + \"'\");\r\n\t\treturn \"\";\r\n\r\n\t}\r\n\r\n\r\n\r\n}\r\n\r\nexport const DualStateZipcodeList = {\r\n\t'02861': ['MA', 'RI'],\r\n\t'42223': ['KY', 'TN'],\r\n\t'59221': ['MT', 'ND'],\r\n\t'63673': ['IL', 'MO'],\r\n\t'71749': ['AR', 'LA'],\r\n\t'73949': ['OK', 'TX'],\r\n\t'81137': ['CO', 'NM'],\r\n\t'84536': ['AZ', 'UT'],\r\n\t'86044': ['AZ', 'UT'],\r\n\t'86515': ['AZ', 'NM'],\r\n\t'88063': ['NM', 'TX'],\r\n\t'89439': ['CA', 'NV'],\r\n\t'97635': ['CA', 'OR'],\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { SharedAppModule } from '../app.module.shared';\r\nimport { LoginAsMemberRoutingModule } from './login.as.member.routing.module';\r\n\r\nimport { LoginAsMemberComponent } from './login.as.member/login.as.member.component';\r\n\r\n@NgModule({\r\n declarations: [\r\n LoginAsMemberComponent,\r\n ],\r\n imports: [\r\n CommonModule,\r\n SharedAppModule,\r\n LoginAsMemberRoutingModule,\r\n FormsModule,\r\n ]\r\n})\r\nexport class LoginAsMemberModule { }\r\n\r\n","import { NgModule } from '@angular/core';\r\nimport { Routes, RouterModule } from '@angular/router';\r\n\r\nimport { LoginAsMemberComponent } from './login.as.member/login.as.member.component';\r\n\r\nimport { BlankView } from '../views/blank/blank.view';\r\n\r\nconst LoginAsMemberRoutes: Routes = [\r\n // login view\r\n\r\n {\r\n path: 'login-as-member', component: BlankView,\r\n // canActivate: [AuthGuardService],\r\n children: [\r\n { path: ':loginToken', component: LoginAsMemberComponent },\r\n { path: ':loginToken/:adminID', component: LoginAsMemberComponent },\r\n { path: '**', component: LoginAsMemberComponent }\r\n ]\r\n },\r\n];\r\n\r\n@NgModule({\r\n imports: [RouterModule.forChild(LoginAsMemberRoutes)],\r\n exports: [RouterModule]\r\n})\r\nexport class LoginAsMemberRoutingModule { }\r\n","import { Component, OnDestroy, OnInit } from '@angular/core';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { GlobalServices } from '../../services/global.service';\r\nimport { ssApiService } from '../../services/ss-api.service';\r\n\r\n@Component({\r\n selector: 'login-as-member',\r\n templateUrl: './login.as.member.component.html',\r\n styleUrls: ['./login.as.member.component.scss']\r\n})\r\nexport class LoginAsMemberComponent implements OnInit, OnDestroy {\r\n\r\n routeParams: object;\r\n paramsSubscribe: any;\r\n\r\n constructor(private route: ActivatedRoute, private router: Router, private gb: GlobalServices, private api: ssApiService) {\r\n\r\n }\r\n\r\n ngOnInit() {\r\n this.paramsSubscribe = this.route.params.subscribe(params => {\r\n\r\n\r\n // get the token from url and re-convert from friendlyurl\r\n let token: string = params['loginToken'].toString();\r\n\r\n console.log(\"token\", token);\r\n\r\n token = GlobalServices.ConverFromUrlFriendly(token);\r\n console.log(\"token 1\", token);\r\n\r\n // set the token tot he globals so that our server request has a bearer header\r\n this.gb.SetToken(token);\r\n\r\n\r\n let newMemberID: number = Number(params['adminID']);\r\n this.gb.AdminID = newMemberID;\r\n\r\n // get session info\r\n let subscription = this.api.GetSessionInfo().subscribe(response => {\r\n subscription.unsubscribe();\r\n\r\n // check on error\r\n if (!response.Result) {\r\n this.router.navigate(['/authentication']);\r\n return;\r\n }\r\n\r\n // set the globals and skip token\r\n this.gb.SetGlobalsFromLoginResponse(response.Data, false);\r\n\r\n // redirect to global redirect after successfull login\r\n if (response.Data.Redirect != null)\r\n this.router.navigate([response.Data.Redirect]);\r\n else\r\n this.router.navigate(['Dashboard']);\r\n });\r\n\r\n\r\n }, error => {\r\n this.router.navigate(['/authentication']);\r\n });\r\n\r\n }\r\n\r\n ngOnDestroy() {\r\n this.paramsSubscribe.unsubscribe();\r\n }\r\n\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { SharedAppModule } from '../app.module.shared';\r\nimport { LoginFromSoftwareRoutingModule } from './login.from.software.routing.module';\r\nimport { LoginFromSoftwareComponent } from './login.from.software/login.from.software.component';\r\n\r\n@NgModule({\r\n declarations: [\r\n LoginFromSoftwareComponent,\r\n ],\r\n imports: [\r\n CommonModule,\r\n SharedAppModule,\r\n LoginFromSoftwareRoutingModule,\r\n FormsModule,\r\n ]\r\n})\r\nexport class LoginFromSoftwareModule { }\r\n\r\n","import { NgModule } from '@angular/core';\r\nimport { Routes, RouterModule } from '@angular/router';\r\n\r\nimport { LoginFromSoftwareComponent } from './login.from.software/login.from.software.component';\r\n\r\nimport { BlankView } from '../views/blank/blank.view';\r\n\r\nconst LoginFromSoftwareRoutes: Routes = [\r\n // login view\r\n\r\n {\r\n path: 'login-from-software', component: BlankView,\r\n // canActivate: [AuthGuardService],\r\n children: [\r\n { path: ':loginToken', component: LoginFromSoftwareComponent },\r\n { path: '**', component: LoginFromSoftwareComponent }\r\n ]\r\n },\r\n];\r\n\r\n@NgModule({\r\n imports: [RouterModule.forChild(LoginFromSoftwareRoutes)],\r\n exports: [RouterModule]\r\n})\r\nexport class LoginFromSoftwareRoutingModule { }\r\n","import { Component, OnDestroy, OnInit } from '@angular/core';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { GlobalServices } from '../../services/global.service';\r\nimport { ssApiService } from '../../services/ss-api.service';\r\n\r\n@Component({\r\n selector: 'login-from-software',\r\n templateUrl: './login.from.software.component.html',\r\n styleUrls: ['./login.from.software.component.scss']\r\n})\r\nexport class LoginFromSoftwareComponent implements OnInit, OnDestroy {\r\n\r\n routeParams: object;\r\n paramsSubscribe: any;\r\n\r\n constructor(private route: ActivatedRoute, private router: Router, private gb: GlobalServices, private api: ssApiService) {\r\n\r\n }\r\n\r\n ngOnInit() {\r\n this.paramsSubscribe = this.route.params.subscribe(params => {\r\n\r\n\r\n // get the token from url and re-convert from friendlyurl\r\n let token: string = params['loginToken'].toString();\r\n token = GlobalServices.ConverFromUrlFriendly(token);\r\n\r\n // set the token tot he globals so that our server request has a bearer header\r\n this.gb.SetToken(token);\r\n\r\n // get session info\r\n let subscription = this.api.GetSessionInfo().subscribe(response => {\r\n subscription.unsubscribe();\r\n\r\n // check on error\r\n if (!response.Result) {\r\n this.router.navigate(['/authentication']);\r\n return;\r\n }\r\n\r\n // set the globals and skip token\r\n this.gb.SetGlobalsFromLoginResponse(response.Data, true);\r\n\r\n // redirect to global redirect after successfull login\r\n \r\n if (response.Data.Redirect != null)\r\n this.router.navigate([response.Data.Redirect]);\r\n else\r\n this.router.navigate(['/account/add-credit-card']);\r\n });\r\n\r\n\r\n }, error => {\r\n this.router.navigate(['/authentication']);\r\n });\r\n\r\n }\r\n\r\n ngOnDestroy() {\r\n this.paramsSubscribe.unsubscribe();\r\n }\r\n\r\n}\r\n","export interface IBreadCrumb {\r\n\r\n Index: number;\r\n Title: string;\r\n Link: string;\r\n Tooltip: string;\r\n\r\n}\r\n\r\nexport class BreadCrumb implements IBreadCrumb {\r\n\r\n Index: number;\r\n Title: string;\r\n Link: string;\r\n Tooltip: string;\r\n\r\n}\r\n","import { TrainingEventSubscriptionCertificateResponseArray } from '../ss-api/responses/training.event.subscription.certificate.response';\r\nimport { EmailLogResponseArray } from '../ss-api/responses/email.log.response';\r\n\r\nexport enum AttendanceStatusTypes {\r\n Registered = 1,\r\n AttendedClass = 2,\r\n Cancelled = 3,\r\n Rescheduled = 4,\r\n NoShow = 5\r\n}\r\n\r\nexport enum SubscriptionMethodTypes {\r\n Admin = 1,\r\n Member = 2,\r\n Phone = 3,\r\n Email = 4,\r\n Other = 99\r\n}\r\n\r\nexport class TrainingEventSubscription {\r\n ID: number;\r\n Created: Date;\r\n Modified: Date;\r\n SubscriptionMethodType: SubscriptionMethodTypes;\r\n AttendancestatusType: AttendanceStatusTypes;\r\n SubscriptionNotes: string;\r\n CertificateToken: string;\r\n CertificatesAwarded: TrainingEventSubscriptionCertificateResponseArray;\r\n CreditsEarned: number;\r\n LevelScoreEarned: number;\r\n AlternatePhone: string;\r\n AlternateEmail: string;\r\n License_ID: number;\r\n LicenseKey: string;\r\n SignupDate: Date;\r\n Member_ID: number;\r\n MemberName: string;\r\n MemberPhone: string;\r\n MemberEmail: string;\r\n Product_ID: number;\r\n ProductName: string;\r\n SoftwareVersion: string;\r\n\r\n EmailLogs: EmailLogResponseArray;\r\n\r\n // public static FixDates(item: TrainingEventSubscription) {\r\n // item.Created = new Date(item.Created);\r\n // item.Modified = new Date(item.Modified);\r\n // item.SignupDate = new Date(item.SignupDate);\r\n // }\r\n\r\n}\r\n\r\nexport class TrainingEventSubscriptionArray extends Array {\r\n\r\n constructor(...items: TrainingEventSubscription[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, TrainingEventSubscriptionArray.prototype);\r\n }\r\n\r\n // public static FixDates(item: TrainingEventSubscriptionArray) {\r\n // item.forEach(x => TrainingEventSubscription.FixDates(x));\r\n // }\r\n\r\n\r\n}\r\n","import { TrainingClass } from './training.class';\r\n\r\nexport class TrainingEvent {\r\n ID: number;\r\n Created: Date;\r\n Modified: Date;\r\n EventDateTime: Date;\r\n TrainingClassID: number;\r\n TrainingClass: TrainingClass;\r\n\r\n // public static FixDates(item: TrainingEvent) {\r\n // item.Created = new Date(item.Created);\r\n // item.Modified = new Date(item.Modified);\r\n // item.EventDateTime = new Date(item.EventDateTime);\r\n // }\r\n\r\n}\r\n\r\nexport class TrainingEventArray extends Array {\r\n\r\n constructor(...items: TrainingEvent[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, TrainingEventArray.prototype);\r\n }\r\n\r\n public static FixDates(item: TrainingEventArray) {\r\n //item.forEach(x => TrainingEvent.FixDates(x));\r\n }\r\n\r\n\r\n}\r\n","export class HttpError {\r\n\r\n constructor(public OriginalError?: any, public FriendlyTitle?: string, public FriendlyMessage?: string) {\r\n\r\n }\r\n\r\n}\r\n","export interface IErrorEventArgs {\r\n ErrorCode: string;\r\n ErrorMessage: string;\r\n FriendlyErrorTitle: string;\r\n FriendlyErrorMessage: string;\r\n}\r\n\r\nexport class ErrorEventArgs implements IErrorEventArgs {\r\n public ErrorCode: string;\r\n public ErrorMessage: string;\r\n public FriendlyErrorTitle: string;\r\n public FriendlyErrorMessage: string;\r\n\r\n constructor(errorCode: string = '', errorMessage: string = '', friendlyErrorMessage: string = '', friendlyErrorTitle: string = 'Error') {\r\n this.Set(errorCode, errorMessage, friendlyErrorTitle, friendlyErrorMessage);\r\n }\r\n\r\n public Set(errorCode: string, errorMessage: string, friendlyErrorTitle: string, friendlyErrorMessage: string) {\r\n this.ErrorCode = errorCode;\r\n this.ErrorMessage = errorMessage;\r\n this.FriendlyErrorTitle = friendlyErrorTitle;\r\n this.FriendlyErrorMessage = friendlyErrorMessage;\r\n }\r\n\r\n}\r\n","export enum BillingRecurringTypes {\r\n\r\n Monthly = 1,\r\n Yearly = 2\r\n\r\n}\r\n\r\nexport interface IPriceBillingCycle {\r\n\r\n Price: number;\r\n Setup: number;\r\n BillingCycle: BillingRecurringTypes;\r\n\r\n TaxEnabled: boolean;\r\n TaxRate: number;\r\n State: string;\r\n TaxRateDisplay: string;\r\n TotalWithTax: string;\r\n TaxAmount: number;\r\n\r\n}\r\n\r\nexport class PriceBillingCycle implements IPriceBillingCycle {\r\n\r\n Price: number;\r\n Setup: number;\r\n BillingCycle: BillingRecurringTypes;\r\n\r\n TaxEnabled: boolean;\r\n TaxRate: number;\r\n State: string;\r\n TaxRateDisplay: string;\r\n TotalWithTax: string;\r\n TaxAmount: number;\r\n\r\n}\r\n\r\nexport class PriceBillingCycleArray extends Array {\r\n\r\n constructor(...items: PriceBillingCycle[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, PriceBillingCycleArray.prototype);\r\n }\r\n}","import { CreditCardTypes } from '../responses/credit.card.response';\r\n\r\nexport interface IAddCreditCardRequest {\r\n\r\n CVV: number;\r\n CreditCardNumber: string;\r\n SetAsDefault: boolean;\r\n\r\n ID: number;\r\n LastFour: string;\r\n ExpMonth: number;\r\n ExpYear: number;\r\n CardType: CreditCardTypes;\r\n DateTimeLastUpdate: Date;\r\n DateTimeCreated: Date;\r\n DateTimeLastUsed: Date;\r\n Status: string;\r\n FirstName: string;\r\n LastName: string;\r\n Address01: string;\r\n City: string;\r\n State: string;\r\n ZipCode: string;\r\n Country: string;\r\n\r\n UpdateMemberAddress: boolean;\r\n\r\n IsValid(): string[];\r\n \r\n}\r\n\r\nexport class AddCreditCardRequest implements IAddCreditCardRequest {\r\n\r\n ID: number;\r\n LastFour: string;\r\n ExpMonth: number;\r\n ExpYear: number;\r\n CardType: CreditCardTypes;\r\n DateTimeLastUpdate: Date;\r\n DateTimeCreated: Date;\r\n DateTimeLastUsed: Date;\r\n Status: string;\r\n FirstName: string;\r\n LastName: string;\r\n Address01: string;\r\n City: string;\r\n State: string;\r\n ZipCode: string;\r\n Country: string;\r\n CreditCardNumber: string;\r\n CVV: number;\r\n SetAsDefault: boolean;\r\n\r\n UpdateMemberAddress: boolean;\r\n\r\n IsValid(): string[] {\r\n\r\n let validationErrors = new Array();\r\n\r\n\r\n if (this.Address01 == undefined || this.Address01 == \"\") {\r\n validationErrors.push(\"Address 1\");\r\n }\r\n\r\n if (this.City == undefined || this.City == \"\") {\r\n validationErrors.push(\"City\");\r\n }\r\n\r\n if (this.Country == undefined || this.Country == \"\") {\r\n validationErrors.push(\"Country\");\r\n }\r\n\r\n if (this.CVV == undefined || this.CVV < 99) {\r\n validationErrors.push(\"CVV\");\r\n }\r\n\r\n if (this.ExpMonth == undefined) {\r\n validationErrors.push(\"ExpMonth\");\r\n }\r\n\r\n if (this.ExpYear == undefined) {\r\n validationErrors.push(\"ExpYear\");\r\n }\r\n\r\n if (this.FirstName == undefined || this.FirstName == \"\") {\r\n validationErrors.push(\"FirstName\");\r\n }\r\n\r\n if (this.LastName == undefined || this.LastName == \"\") {\r\n validationErrors.push(\"LastName\");\r\n }\r\n\r\n if (this.ZipCode == undefined || this.ZipCode == \"\") {\r\n validationErrors.push(\"PostalCode\");\r\n }\r\n\r\n if (this.State == undefined || this.State == \"\") {\r\n validationErrors.push(\"State\");\r\n }\r\n\r\n if (this.CreditCardNumber == undefined || this.CreditCardNumber == \"\") {\r\n validationErrors.push(\"Number\");\r\n }\r\n\r\n return validationErrors;\r\n\r\n }\r\n\r\n}","import { BillingRecurringTypes } from \"app/models/ss-api/price.billing.cycle\";\r\n\r\nexport interface IAddProductRequest {\r\n\r\n AdminID: number;\r\n ProductID: number;\r\n CreditCardID: number;\r\n BillingCycle: BillingRecurringTypes;\r\n AssignToOwner: boolean;\r\n Initials: string;\r\n DesignerEmail: string;\r\n DesignerName: string;\r\n YardAddon: boolean;\r\n}\r\n\r\nexport class AddProductRequest implements IAddProductRequest {\r\n\r\n AdminID: number;\r\n ProductID: number;\r\n CreditCardID: number;\r\n BillingCycle: BillingRecurringTypes;\r\n AssignToOwner: boolean;\r\n Initials: string;\r\n DesignerEmail: string;\r\n DesignerName: string;\r\n YardAddon: boolean;\r\n}\r\n","export interface ICancelProductRequest {\r\n\r\n LicenseKey: string;\r\n CancellationReason: string;\r\n CancellationComments: string;\r\n AdminID: number;\r\n\r\n}\r\n\r\nexport class CancelProductRequest implements ICancelProductRequest {\r\n\r\n LicenseKey: string;\r\n CancellationReason: string;\r\n CancellationComments: string;\r\n AdminID: number;\r\n\r\n}\r\n","export class CancelYardRequest {\r\n\r\n LicenseKey: string;\r\n CancelReason: string;\r\n\r\n}","export class CdKeyReassignRequest {\r\n\r\n Key: string;\r\n Name: string;\r\n NotifyEmail: string;\r\n\r\n}","export interface IChangePasswordRequest {\r\n\r\n NewPassword: string;\r\n CurrentPassword : string;\r\n\r\n ValidationMessage : string;\r\n\r\n IsValid();\r\n\r\n}\r\n\r\nexport class ChangePasswordRequest implements IChangePasswordRequest {\r\n\r\n public NewPassword: string;\r\n public CurrentPassword: string;\r\n\r\n public ValidationMessage: string;\r\n \r\n public IsValid(): boolean {\r\n\r\n if (this.NewPassword == undefined || this.NewPassword.length < 6) {\r\n this.ValidationMessage = \"The new password must be at least 6 characters.\";\r\n return false;\r\n }\r\n else if (this.CurrentPassword == undefined || this.CurrentPassword == \"\") {\r\n this.ValidationMessage = \"The current password is empty.\";\r\n return false;\r\n }\r\n else {\r\n this.ValidationMessage = \"\";\r\n return true;\r\n }\r\n }\r\n\r\n}\r\n","export class CheckForExistingMemberRequest {\r\n Email: string;\r\n Checksum: string;\r\n}","export interface IDesignerInstructionsRequest {\r\n\r\n Name: string;\r\n Email: string;\r\n LicenseKey: string;\r\n\r\n}\r\n\r\nexport class DesignerInstructionsRequest implements IDesignerInstructionsRequest {\r\n\r\n Name: string;\r\n Email: string;\r\n LicenseKey: string;\r\n\r\n}","export interface IFinishOrderRequest {\r\n\r\n UFOID: string;\r\n CC_FirstName: string;\r\n CC_LastName: string;\r\n CC_Number: string;\r\n CC_ExpMonth: number;\r\n CC_ExpYear: number;\r\n CC_CVC: number;\r\n OrderFormVersion: string;\r\n\r\n}\r\n\r\nexport class FinishOrderRequest implements IFinishOrderRequest {\r\n\r\n UFOID: string;\r\n CC_FirstName: string;\r\n CC_LastName: string;\r\n CC_Number: string;\r\n CC_ExpMonth: number;\r\n CC_ExpYear: number;\r\n CC_CVC: number;\r\n OrderFormVersion: string;\r\n\r\n}","export class GetTrainingClassesRequest {\r\n Checksum: string;\r\n}","\r\nexport interface IHoldRequest {\r\n \r\n HoldItemID: number;\r\n CreditCardID: number;\r\n LicenseKey: string;\r\n Initials: string;\r\n}\r\n\r\nexport class HoldRequest implements IHoldRequest {\r\n\r\n HoldItemID: number;\r\n CreditCardID: number;\r\n LicenseKey: string;\r\n Initials: string;\r\n}\r\n\r\n","export interface ILoginRequest {\r\n\r\n Username: string;\r\n Password: string;\r\n Checksum: string;\r\n CheckEmpty(): boolean;\r\n\r\n}\r\n\r\nexport class LoginRequest implements ILoginRequest {\r\n\r\n public Username: string;\r\n public Password: string;\r\n public Checksum: string;\r\n\r\n public CheckEmpty(): boolean {\r\n\r\n if (this.Username === \"\" || this.Password === \"\")\r\n return false;\r\n else\r\n return true;\r\n\r\n }\r\n\r\n}\r\n","export class MemberTrainingCertificatesRequest {\r\n\r\n StartDate: Date;\r\n EndDate: Date; //Make sure your end date is time aware - if you want all requests on 10/28/2018, pass 10/28/2018 11:59:59 PM. Or 10/29/2018 would also work, assuming events always have both a date and time.\r\n\r\n}","export enum BillingRecurringTypes {\r\n\r\n Yearly = 2,\r\n Monthly = 1\r\n\r\n}\r\n\r\nexport interface INewMemberRequest {\r\n Checksum: string;\r\n OrderFormVersion: string;\r\n FirstName: string;\r\n LastName: string;\r\n Email: string;\r\n Company: string;\r\n Phone: string;\r\n Password: string;\r\n Address1: string;\r\n City: string;\r\n State: string;\r\n ZipCode: string;\r\n Country: string;\r\n CC_FirstName: string;\r\n CC_LastName: string;\r\n CC_Address1: string;\r\n CC_City: string;\r\n CC_State: string;\r\n CC_ZipCode: string;\r\n CC_Country: string;\r\n CC_Number: string;\r\n CC_ExpMonth: number;\r\n CC_ExpYear: number;\r\n CC_CVC: number;\r\n ProductID: number;\r\n BillingCycle: BillingRecurringTypes;\r\n PromoCode: string;\r\n AssignToOwner: boolean;\r\n Initials: string;\r\n RedirectID: number;\r\n DateTimeRedirectClick: Date;\r\n\r\n AuthorizedContactFirstName : string;\r\n AuthorizedContactLastName : string;\r\n AuthorizedContactEmail : string;\r\n AuthorizedContactNote : string;\r\n}\r\n\r\nexport class NewMemberRequest implements INewMemberRequest {\r\n Checksum: string;\r\n OrderFormVersion: string;\r\n FirstName: string;\r\n LastName: string;\r\n Email: string;\r\n Company: string;\r\n Phone: string;\r\n Password: string;\r\n Address1: string;\r\n City: string;\r\n State: string;\r\n ZipCode: string;\r\n Country: string;\r\n CC_FirstName: string;\r\n CC_LastName: string;\r\n CC_Address1: string;\r\n CC_City: string;\r\n CC_State: string;\r\n CC_ZipCode: string;\r\n CC_Country: string;\r\n CC_Number: string;\r\n CC_ExpMonth: any;\r\n CC_ExpYear: number;\r\n CC_CVC: number;\r\n ProductID: number;\r\n BillingCycle: BillingRecurringTypes;\r\n PromoCode: string;\r\n AssignToOwner: boolean = true;\r\n Initials: string;\r\n RedirectID: number;\r\n DateTimeRedirectClick: Date;\r\n AddYard: boolean;\r\n\r\n AuthorizedContactFirstName : string;\r\n AuthorizedContactLastName : string;\r\n AuthorizedContactEmail : string;\r\n AuthorizedContactNote : string;\r\n\r\n}","export interface IOrderGISRequest {\r\n\r\n CDKey: string;\r\n ProductID: number;\r\n CCID: number;\r\n\r\n}\r\n\r\nexport class OrderGISRequest implements IOrderGISRequest {\r\n\r\n CDKey: string;\r\n ProductID: number;\r\n CCID: number;\r\n\r\n}","export class PayInvoiceRequest {\r\n\r\n InvoiceID: number;\r\n CreditCardID: number;\r\n\r\n}","export class ReactivateRequest {\r\n\r\n LicenseKey: string;\r\n Initials: string;\r\n CreditCardID: number;\r\n AdminID: number;\r\n\r\n}","import { BillingRecurringTypes } from \"../responses/dashboard.license.response\";\r\n\r\nexport class ReactivateRequestv2 {\r\n\r\n LicenseKey: string;\r\n Initials: string;\r\n CreditCardID: number;\r\n AdminID: number;\r\n NewProductID: number;\r\n IncludeYARD: boolean;\r\n BillingCycle: BillingRecurringTypes;\r\n assignToMember: boolean = true;\r\n keepAssigned: boolean = false;\r\n\tdesignerName: string = \"\";\r\n\tdesignerEmail: string = \"\"; \r\n}","export class RegisterForTrainingEventRequest {\r\n\r\n LicenseID: number;\r\n TrainingEventID: number;\r\n AlternateEmail: string;\r\n AlternatePhone: string;\r\n\r\n}","export interface IResetPasswordRequest {\r\n\r\n Checksum: string;\r\n Email: string;\r\n\r\n}\r\n\r\nexport class ResetPasswordRequest implements IResetPasswordRequest {\r\n\r\n Checksum: string;\r\n Email: string;\r\n\r\n}\r\n","\r\nexport interface IResumeLicenseRequest {\r\n \r\n CreditCardID: number;\r\n LicenseKey: string;\r\n Initials: string;\r\n}\r\n\r\nexport class ResumeLicenseRequest implements IResumeLicenseRequest {\r\n\r\n CreditCardID: number;\r\n LicenseKey: string;\r\n Initials: string;\r\n}\r\n\r\n","\r\nexport interface IResumeLicenseSimulationRequest {\r\n \r\n LicenseKey: string;\r\n Initials: string;\r\n}\r\n\r\nexport class ResumeLicenseSimulationRequest implements IResumeLicenseSimulationRequest {\r\n LicenseKey: string;\r\n Initials: string;\r\n}\r\n\r\n","export enum CommTypes {\r\n\r\n SMS = 0,\r\n Email = 1\r\n\r\n};\r\n\r\nexport interface ISendTwoFactorCodeOptionRequest {\r\n\r\n Token: string;\r\n CommType: CommTypes;\r\n CommValue: string;\r\n\r\n}\r\n\r\nexport class SendTwoFactorCodeOptionRequest implements ISendTwoFactorCodeOptionRequest {\r\n\r\n public Token: string;\r\n public CommType: CommTypes;\r\n public CommValue: string;\r\n\r\n}\r\n","export interface ISetNewPasswordRequest {\r\n\r\n ResetPasswordID: string;\r\n NewPassword: string;\r\n\r\n}\r\n\r\nexport class SetNewPasswordRequest implements ISetNewPasswordRequest {\r\n\r\n public ResetPasswordID: string;\r\n public NewPassword: string;\r\n\r\n}","export class TrainingCalendarRequest {\r\n\r\n StartDate: Date;\r\n EndDate: Date; //Make sure your end date is time aware - if you want all requests on 10/28/2018, pass 10/28/2018 11:59:59 PM. Or 10/29/2018 would also work, assuming events always have both a date and time.\r\n\r\n}","export interface ITwoFactorAuthenticationRequest {\r\n\r\n Token: string;\r\n Code: string;\r\n\r\n}\r\n\r\nexport class TwoFactorAuthenticationRequest implements ITwoFactorAuthenticationRequest {\r\n\r\n Token: string;\r\n Code: string;\r\n\r\n}","export interface IUnlockLoginRequest {\r\n\r\n Code: string;\r\n\r\n}\r\n\r\nexport class UnlockLoginRequest implements IUnlockLoginRequest {\r\n\r\n Code: string;\r\n\r\n}\r\n","import { BillingRecurringTypes } from \"app/models/ss-api/price.billing.cycle\";\r\n\r\nexport interface IUpdateCartRequest {\r\n\r\n ProductID: Number;\r\n CartID: string;\r\n RedirectID: Number;\r\n DateTimeRedirectClicked: Date\r\n FirstName: string;\r\n LastName: string;\r\n Email1: string;\r\n Email2: string;\r\n Company: string;\r\n Phone: string;\r\n CCName: string;\r\n CCNumber: string;\r\n CCLastFour: string;\r\n CCExpMonth: number;\r\n CCExpYear: number;\r\n Address: string;\r\n City: string;\r\n State: string;\r\n ZipCode: string;\r\n Country: string;\r\n Initials: string;\r\n BillingCycle: BillingRecurringTypes;\r\n SubTotal: number;\r\n TaxChecksum: string;\r\n}\r\n\r\nexport class UpdateCartRequest implements IUpdateCartRequest {\r\n\r\n public Company: string;\r\n public ProductID: Number;\r\n public RedirectID: Number;\r\n public DateTimeRedirectClicked: Date;\r\n public FirstName: string;\r\n public LastName: string;\r\n public Email1: string;\r\n public Email2: string;\r\n public CartID: string;\r\n public Phone: string;\r\n public CCName: string;\r\n CCNumber: string;\r\n CCLastFour: string;\r\n CCExpMonth: number;\r\n CCExpYear: number;\r\n public Address: string;\r\n public City: string;\r\n public State: string;\r\n public ZipCode: string;\r\n public Country: string;\r\n public Initials: string;\r\n BillingCycle: BillingRecurringTypes;\r\n SubTotal: number;\r\n TaxChecksum: string;\r\n}","export class UpdateCreditCardExpirationRequest {\r\n CreditCardID: number;\r\n ExpMonth: number;\r\n ExpYear: number;\r\n Zipcode: string;\r\n IsDefault?: boolean;\r\n}\r\n","export class UpdateMemberProfileRequest {\r\n\r\n Companyname: string;\r\n Email: string;\r\n Address1: string;\r\n City: string;\r\n State: string;\r\n Postcode: string;\r\n Country: string;\r\n Phonenumber: string;\r\n Phonenumber2: string;\r\n FaxNumber: string;\r\n\r\n public NewPassword: string;\r\n public CurrentPassword: string;\r\n\r\n public ValidationMessage: string;\r\n \r\n public IsPasswordValid(): boolean {\r\n\r\n if (this.NewPassword == undefined || this.NewPassword.length < 5) {\r\n this.ValidationMessage = \"The new password must be at least 5 characters.\";\r\n return false;\r\n }\r\n else if (this.CurrentPassword == undefined || this.CurrentPassword == \"\") {\r\n this.ValidationMessage = \"The current password is empty.\";\r\n return false;\r\n }\r\n else {\r\n this.ValidationMessage = \"\";\r\n return true;\r\n }\r\n } \r\n\r\n}","import { AttendanceStatusTypes } from \"../../domain/training.event.subscription\";\r\n\r\nexport class UpdateTrainingEventSubscriptionStatusRequest {\r\n\r\n TrainingEventSubscriptionID: number;\r\n AttendanceStatusType: AttendanceStatusTypes;\r\n\r\n}","import { BillingRecurringTypes } from \"app/models/ss-api/price.billing.cycle\";\r\n\r\nexport interface IUpgradeProductRequest {\r\n\r\n LicenseKey: string;\r\n NewProductID: number;\r\n CreditCardID: number;\r\n NewBillingCycle: BillingRecurringTypes;\r\n Initials: string;\r\n SimulateOnly: boolean;\r\n PromoCode: string;\r\n AdminID: number;\r\n\r\n}\r\n\r\nexport class UpgradeProductRequest implements IUpgradeProductRequest {\r\n\r\n LicenseKey: string;\r\n NewProductID: number;\r\n CreditCardID: number;\r\n NewBillingCycle: BillingRecurringTypes;\r\n Initials: string;\r\n SimulateOnly: boolean;\r\n PromoCode: string;\r\n AdminID: number;\r\n\r\n}\r\n","export interface IYardAddonOrderRequest {\r\n\r\n YardProductID: number;\r\n LicenseID: number;\r\n CCardID: number;\r\n Initials: string;\r\n\r\n}\r\n\r\nexport class YardAddonOrderRequest implements IYardAddonOrderRequest {\r\n\r\n YardProductID: number;\r\n LicenseID: number;\r\n CCardID: number;\r\n Initials: string;\r\n\r\n}","import { BillingHistoryItemArray } from './billing.history.item';\r\n\r\nexport interface IBillingHistoryResponse {\r\n\r\n DateTimeCreated: Date;\r\n DateTimePaid: Date;\r\n Total: number;\r\n TotalPaid: number;\r\n InvoiceNumber: string;\r\n Items: BillingHistoryItemArray;\r\n Refunded: boolean;\r\n IsOnHoldInvoice: boolean;\r\n // FixDates();\r\n\r\n}\r\n\r\nexport class BillingHistoryResponse implements IBillingHistoryResponse {\r\n\r\n DateTimeCreated: Date;\r\n DateTimePaid: Date;\r\n Total: number;\r\n TotalPaid: number;\r\n InvoiceNumber: string;\r\n Items: BillingHistoryItemArray;\r\n Refunded: boolean;\r\n IsOnHoldInvoice: boolean;\r\n\r\n\r\n // FixDates() {\r\n // this.DateTimeCreated = new Date(this.DateTimeCreated);\r\n // this.DateTimePaid = new Date(this.DateTimePaid);\r\n // }\r\n}\r\n\r\nexport class BillingHistoryResponseArray extends Array {\r\n\r\n constructor(...items: BillingHistoryResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, BillingHistoryResponseArray.prototype);\r\n }\r\n\r\n public InitFromJSON() {\r\n\r\n if (this.length == 0)\r\n return;\r\n\r\n this.forEach((item) => {\r\n Object.setPrototypeOf(item, BillingHistoryResponse.prototype);\r\n // item.FixDates();\r\n })\r\n }\r\n\r\n}","export enum CreditCardTypes {\r\n\r\n Unknown = 0,\r\n VISA = 1,\r\n MasterCard = 2,\r\n Discover = 3,\r\n AmericanExpress = 4,\r\n JCB = 5,\r\n EnRoute = 6,\r\n DinersClub = 7\r\n\r\n}\r\n\r\nexport interface ICreditCardResponse {\r\n\r\n ID: number;\r\n LastFour: string;\r\n ExpMonth: number;\r\n ExpYear: number;\r\n CardType: CreditCardTypes;\r\n IsDefault: boolean;\r\n DateTimeLastUpdate: Date;\r\n DateTimeCreated: Date;\r\n DateTimeLastUsed: Date;\r\n Status: string;\r\n FirstName: string;\r\n LastName: string;\r\n Address01: string;\r\n City: string;\r\n State: string;\r\n PostalCode: string;\r\n Country: string;\r\n // FixDates();\r\n\r\n}\r\n\r\nexport class CreditCardResponse implements ICreditCardResponse {\r\n\r\n ID: number;\r\n LastFour: string;\r\n ExpMonth: number;\r\n ExpYear: number;\r\n CardType: CreditCardTypes;\r\n IsDefault: boolean;\r\n DateTimeLastUpdate: Date;\r\n DateTimeCreated: Date;\r\n DateTimeLastUsed: Date;\r\n Status: string;\r\n FirstName: string;\r\n LastName: string;\r\n Address01: string;\r\n City: string;\r\n State: string;\r\n PostalCode: string;\r\n Country: string;\r\n\r\n // public FixDates() {\r\n // this.DateTimeCreated = new Date(this.DateTimeCreated);\r\n // this.DateTimeLastUpdate = new Date(this.DateTimeLastUpdate);\r\n // this.DateTimeLastUsed = new Date(this.DateTimeLastUsed);\r\n // }\r\n\r\n\r\n public static GetCreditCardTypeFromString(type: string): CreditCardTypes {\r\n\r\n switch (type) {\r\n\r\n case \"visa\":\r\n return CreditCardTypes.VISA;\r\n\r\n case \"mastercard\":\r\n return CreditCardTypes.MasterCard;\r\n\r\n case \"discover\":\r\n return CreditCardTypes.Discover;\r\n\r\n case \"amex\":\r\n return CreditCardTypes.AmericanExpress;\r\n\r\n case \"jcb\":\r\n return CreditCardTypes.JCB;\r\n\r\n case \"\":\r\n return CreditCardTypes.EnRoute;\r\n\r\n case \"dinersclub\":\r\n return CreditCardTypes.DinersClub;\r\n\r\n default:\r\n return CreditCardTypes.Unknown;\r\n }\r\n\r\n }\r\n\r\n}\r\n\r\n\r\nexport class CreditCardResponseArray extends Array {\r\n\r\n constructor(...items: CreditCardResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, CreditCardResponseArray.prototype);\r\n }\r\n\r\n public InitFromJSON() {\r\n\r\n if (this.length == 0)\r\n return;\r\n\r\n this.forEach((item) => {\r\n Object.setPrototypeOf(item, CreditCardResponse.prototype);\r\n // item.FixDates();\r\n })\r\n }\r\n\r\n}","import { InvoiceItem } from \"./invoice.item\";\r\n\r\nexport enum LicenseStatus {\r\n\r\n Open = 0,\r\n Registered = 1,\r\n Cancelled = 2,\r\n CancelledOpen = 3,\r\n Disabled = 4,\r\n Terminated = 99,\r\n DoesNotExist = 100\r\n\r\n}\r\n\r\nexport enum BillingRecurringTypes {\r\n\r\n Yearly = 2,\r\n Monthly = 1\r\n\r\n}\r\n\r\nexport enum HoldStatusTypes {\r\n None = 0,\r\n Active = 1,\r\n LicenseResumed = 2,\r\n HoldFinished = 3\r\n}\r\n\r\nexport interface IDashboardLicenseResponse {\r\n\r\n LicenseID: number;\r\n \r\n DateTimeCreated: Date;\r\n Key: string;\r\n SoftwareVersion: string;\r\n Status: LicenseStatus; \r\n ProductName: string;\r\n ProductPrice : number;\r\n\r\n IsRegistered: boolean; \r\n TerminationDate: Date;\r\n\r\n // Billing\r\n Recurring: BillingRecurringTypes;\r\n Price: number;\r\n IsGrace: boolean;\r\n GraceInvoice: InvoiceItem;\r\n\r\n NextBillingDate: Date;\r\n LastActiveDate : Date;\r\n\r\n //Hold\r\n IsOnHold: boolean;\r\n HoldStatus : HoldStatusTypes;\r\n HoldStartDate: Date;\r\n HoldEndDate: Date;\r\n IsScheduledHold: boolean;\r\n\r\n // YARD\r\n YardAvailable: boolean;\r\n HasYard: boolean;\r\n YardCancelled: boolean;\r\n \r\n \r\n\r\n // FixDates();\r\n\r\n}\r\n\r\n\r\nexport class DashboardLicenseResponse implements IDashboardLicenseResponse {\r\n ProductPrice: number;\r\n LastActiveDate: Date;\r\n HoldStatus: HoldStatusTypes;\r\n\r\n LicenseID: number;\r\n Key: string;\r\n SoftwareVersion: string;\r\n Status: LicenseStatus;\r\n DateTimeCreated: Date;\r\n NextBillingDate: Date;\r\n Recurring: BillingRecurringTypes;\r\n Price: number;\r\n ProductName: string;\r\n YardAvailable: boolean;\r\n YardVisiblePublic: boolean;\r\n IsRegistered: boolean;\r\n HasYard: boolean;\r\n YardCancelled: boolean;\r\n TerminationDate: Date;\r\n IsGrace: boolean;\r\n GraceInvoice: InvoiceItem;\r\n\r\n IsOnHold: boolean;\r\n HoldStartDate: Date;\r\n HoldEndDate: Date;\r\n IsScheduledHold: boolean;\r\n\r\n\r\n // FixDates() {\r\n\r\n // this.DateTimeCreated = new Date(this.DateTimeCreated.toString() + \"-08:00\");\r\n // this.NextBillingDate = new Date(this.NextBillingDate.toString() + \"-08:00\");\r\n // this.TerminationDate = new Date(this.TerminationDate.toString() + \"-08:00\");\r\n // this.HoldStartDate = new Date(this.HoldStartDate.toString() + \"-08:00\");\r\n // this.HoldEndDate = new Date(this.HoldEndDate.toString() + \"-08:00\");\r\n // this.LastActiveDate = new Date(this.LastActiveDate.toString() + \"-08:00\");\r\n\r\n // this.DateTimeCreated = new Date(this.DateTimeCreated);\r\n // this.NextBillingDate = new Date(this.NextBillingDate);\r\n // this.TerminationDate = new Date(this.TerminationDate);\r\n // this.HoldStartDate = new Date(this.HoldStartDate);\r\n // this.HoldEndDate = new Date(this.HoldEndDate);\r\n // this.LastActiveDate = new Date(this.LastActiveDate);\r\n \r\n // }\r\n\r\n}\r\n\r\n\r\nexport class DashboardLicenseResponseArray extends Array {\r\n\r\n constructor(...items: DashboardLicenseResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, DashboardLicenseResponseArray.prototype);\r\n }\r\n\r\n public InitFromJSON() {\r\n\r\n if (this.length == 0)\r\n return;\r\n\r\n this.forEach((item) => {\r\n Object.setPrototypeOf(item, DashboardLicenseResponse.prototype);\r\n // item.FixDates();\r\n })\r\n }\r\n\r\n}\r\n","import { DashboardLicenseResponseArray } from './dashboard.license.response';\r\nimport { InvoiceItem } from './invoice.item';\r\n\r\nexport interface IDashboardProductsResponse {\r\n\r\n MemberID: number;\r\n FirstName: string;\r\n LastName: string;\r\n Email: string;\r\n IsMember: boolean;\r\n Desginers: DashboardProductsResponseArray;\r\n Licenses: DashboardLicenseResponseArray;\r\n SharedGISCredits: number;\r\n PersonalGISCredits: number;\r\n IsTOS: boolean;\r\n IsDispute: boolean;\r\n IsFormerTOS: boolean;\r\n IsGrace: boolean;\r\n GraceInvoice: InvoiceItem;\r\n InitFromJSON();\r\n\r\n}\r\n\r\nexport class DashboardProductsResponse implements IDashboardProductsResponse {\r\n\r\n MemberID: number;\r\n FirstName: string;\r\n LastName: string;\r\n Email: string;\r\n IsMember: boolean;\r\n Desginers: DashboardProductsResponseArray;\r\n Licenses: DashboardLicenseResponseArray;\r\n SharedGISCredits: number;\r\n PersonalGISCredits: number;\r\n IsTOS: boolean;\r\n IsDispute: boolean;\r\n IsFormerTOS: boolean;\r\n IsGrace: boolean;\r\n GraceInvoice: InvoiceItem;\r\n\r\n InitFromJSON() {\r\n\r\n if (this.Licenses != undefined) {\r\n Object.setPrototypeOf(this.Licenses, DashboardLicenseResponseArray.prototype);\r\n this.Licenses.InitFromJSON();\r\n }\r\n\r\n if (this.Desginers != undefined) {\r\n Object.setPrototypeOf(this.Desginers, DashboardProductsResponseArray.prototype);\r\n this.Desginers.InitFromJSON();\r\n }\r\n\r\n }\r\n\r\n}\r\n\r\n\r\nexport class DashboardProductsResponseArray extends Array {\r\n\r\n constructor(...items: DashboardProductsResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, DashboardProductsResponseArray.prototype);\r\n }\r\n\r\n public InitFromJSON() {\r\n\r\n if (this.length == 0)\r\n return;\r\n\r\n this.forEach((item) => {\r\n\r\n if (item.Licenses != undefined && item.Licenses.length > 0) {\r\n Object.setPrototypeOf(item.Licenses, DashboardLicenseResponseArray.prototype);\r\n item.Licenses.InitFromJSON();\r\n }\r\n\r\n })\r\n }\r\n\r\n}","export enum GISTypes {\r\n\r\n Shared = 0,\r\n Individual = 1\r\n\r\n}\r\n\r\nexport interface IGISBundleResponse {\r\n\r\n ProductID: number;\r\n PricingID: number;\r\n Credits: number;\r\n Price: number;\r\n Name: string;\r\n GisType: GISTypes;\r\n\r\n TaxEnabled: boolean;\r\n TaxRate: number;\r\n State: string;\r\n TaxRateDisplay: string;\r\n TotalWithTax: number;\r\n TaxAmount: number; \r\n\r\n}\r\n\r\n\r\nexport class GISBundleResponse implements IGISBundleResponse {\r\n\r\n ProductID: number;\r\n PricingID: number;\r\n Credits: number;\r\n Price: number;\r\n Name: string;\r\n GisType: GISTypes;\r\n \r\n TaxEnabled: boolean;\r\n TaxRate: number;\r\n State: string;\r\n TaxRateDisplay: string;\r\n TotalWithTax: number;\r\n TaxAmount: number; \r\n}\r\n\r\nexport class GISBundleResponseArray extends Array {\r\n\r\n constructor(...items: GISBundleResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, GISBundleResponseArray.prototype);\r\n }\r\n\r\n}","export enum GISCreditTypes {\r\n\r\n Shared = 0,\r\n Individual = 1\r\n\r\n}\r\n\r\nexport interface IGISUsageHistoryItemResponse {\r\n\r\n ID: number;\r\n CreditType: GISCreditTypes;\r\n Credited: boolean;\r\n DateTimeCreated: Date;\r\n Key: string;\r\n Address: string;\r\n Refunded: boolean;\r\n // FixDates();\r\n\r\n}\r\n\r\nexport class GISUsageHistoryItemResponse implements IGISUsageHistoryItemResponse {\r\n\r\n ID: number;\r\n CreditType: GISCreditTypes;\r\n Credited: boolean;\r\n DateTimeCreated: Date;\r\n Key: string;\r\n Address: string;\r\n Refunded: boolean;\r\n\r\n // FixDates() {\r\n // this.DateTimeCreated = new Date(this.DateTimeCreated);\r\n // }\r\n\r\n}\r\n\r\nexport class GISUsageHistoryItemResponseArray extends Array {\r\n\r\n constructor(...items: GISUsageHistoryItemResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, GISUsageHistoryItemResponseArray.prototype);\r\n }\r\n\r\n public InitFromJSON() {\r\n\r\n if (this.length == 0)\r\n return;\r\n\r\n this.forEach((item) => {\r\n Object.setPrototypeOf(item, GISUsageHistoryItemResponse.prototype);\r\n // item.FixDates();\r\n })\r\n }\r\n\r\n}","export enum GISCreditTypes {\r\n\r\n Shared = 0,\r\n Individual = 1\r\n\r\n}\r\n\r\nexport interface IGISPurchaseItemResponse {\r\n\r\n ID: number;\r\n ServiceID: number;\r\n Refunded: boolean;\r\n DateTimeRefunded: Date;\r\n ExpirationDate: Date;\r\n PurchaseDate: Date;\r\n CreditType: GISCreditTypes;\r\n OldCreditsTotal: number;\r\n Expired: boolean;\r\n Used: number;\r\n BundleCredits: number;\r\n Remaining: number;\r\n Name: string;\r\n Terminated: boolean;\r\n Suspended: boolean;\r\n // FixDates();\r\n\r\n}\r\n\r\nexport class GISPurchaseItemResponse implements IGISPurchaseItemResponse {\r\n\r\n ID: number;\r\n ServiceID: number;\r\n Refunded: boolean;\r\n DateTimeRefunded: Date;\r\n PurchaseDate: Date;\r\n ExpirationDate: Date;\r\n CreditType: GISCreditTypes;\r\n OldCreditsTotal: number;\r\n Expired: boolean;\r\n Used: number;\r\n BundleCredits: number;\r\n Remaining: number;\r\n Name: string;\r\n Terminated: boolean;\r\n Suspended: boolean;\r\n\r\n // FixDates() {\r\n // this.DateTimeRefunded = new Date(this.DateTimeRefunded);\r\n // this.PurchaseDate = new Date(this.PurchaseDate);\r\n // this.ExpirationDate = new Date(this.ExpirationDate);\r\n // }\r\n\r\n}\r\n\r\nexport class GISPurchaseItemResponseArray extends Array {\r\n\r\n constructor(...items: GISPurchaseItemResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, GISPurchaseItemResponseArray.prototype);\r\n }\r\n\r\n public InitFromJSON() {\r\n\r\n if (this.length == 0)\r\n return;\r\n\r\n this.forEach((item) => {\r\n Object.setPrototypeOf(item, GISPurchaseItemResponse.prototype);\r\n //item.FixDates();\r\n })\r\n }\r\n\r\n}","import { KeyValuePairArray } from \"app/models/KeyValuePair\";\r\n\r\nexport enum MemberTypes {\r\n\r\n Member = 0,\r\n Designer = 1\r\n\r\n}\r\n\r\nexport interface ILoginResponse {\r\n\r\n Token: string;\r\n Authenticated: boolean;\r\n TokenExpiration: Date;\r\n TwoFactorRequired: boolean;\r\n TwoFactorOptions: KeyValuePairArray;\r\n TwoFactorExpiration: Date;\r\n Redirect: string;\r\n FirstName: string;\r\n LastName: string;\r\n MemberID: number;\r\n Username: string;\r\n Email: string;\r\n MemberType: MemberTypes;\r\n UnfinishedOrderID: string;\r\n IsFormerTOS: boolean;\r\n IsTOS: boolean;\r\n IsDispute: boolean;\r\n // FixDates();\r\n\r\n}\r\n\r\nexport class LoginResponse implements ILoginResponse {\r\n\r\n Token: string = \"\";\r\n Authenticated: boolean = false;\r\n TokenExpiration: Date;\r\n TwoFactorRequired: boolean = false;\r\n TwoFactorOptions: KeyValuePairArray;\r\n TwoFactorExpiration: Date;\r\n Redirect: string;\r\n FirstName: string;\r\n LastName: string;\r\n MemberID: number;\r\n Username: string;\r\n Email: string;\r\n MemberType: MemberTypes;\r\n UnfinishedOrderID: string;\r\n IsFormerTOS: boolean;\r\n IsTOS: boolean;\r\n IsDispute: boolean;\r\n\r\n\r\n // FixDates() {\r\n\r\n // this.TokenExpiration = new Date(this.TokenExpiration);\r\n\r\n // if (this.TwoFactorRequired)\r\n // this.TwoFactorExpiration = new Date(this.TwoFactorExpiration);\r\n // }\r\n\r\n}","export interface IMemberBasicInfoResponse {\r\n\r\n ID: number;\r\n Firstname: string;\r\n Lastname: string;\r\n Address1: string;\r\n City: string;\r\n State: string;\r\n ZipCode: string;\r\n Country: string;\r\n Credit: number;\r\n\r\n AuthorizedContactFirstName : string;\r\n AuthorizedContactLastName : string;\r\n AuthorizedContactEmail : string;\r\n AuthorizedContactNote : string;\r\n\r\n}\r\n\r\nexport class MemberBasicInfoResponse implements IMemberBasicInfoResponse {\r\n\r\n ID: number;\r\n Firstname: string;\r\n Lastname: string;\r\n Address1: string;\r\n City: string;\r\n State: string;\r\n ZipCode: string;\r\n Country: string;\r\n Credit: number;\r\n\r\n AuthorizedContactFirstName : string;\r\n AuthorizedContactLastName : string;\r\n AuthorizedContactEmail : string;\r\n AuthorizedContactNote : string;\r\n\r\n}","export interface IMemberDesignersLicenseItem {\r\n\r\n ID: number;\r\n Key: string;\r\n LicenseStatus: string;\r\n Product_ID: number;\r\n Product: string;\r\n SoftwareVersion: string;\r\n CompatibilityToken: string;\r\n SoftwareVersionInt: number;\r\n PastDue: boolean;\r\n TOS: boolean;\r\n Registered: boolean;\r\n\r\n}\r\n\r\nexport class MemberDesignersLicenseItem implements IMemberDesignersLicenseItem {\r\n\r\n ID: number;\r\n Key: string;\r\n LicenseStatus: string;\r\n Product_ID: number;\r\n Product: string;\r\n SoftwareVersion: string;\r\n CompatibilityToken: string;\r\n SoftwareVersionInt: number;\r\n PastDue: boolean;\r\n TOS: boolean;\r\n Registered: boolean;\r\n\r\n}\r\n\r\n\r\nexport class MemberDesignersLicenseItemArray extends Array {\r\n\r\n constructor(...items: MemberDesignersLicenseItem[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, MemberDesignersLicenseItemArray.prototype);\r\n }\r\n\r\n}","import { MemberDesignersLicenseItemArray } from \"app/models/ss-api/responses/member.designers.license.item\";\r\n\r\nexport interface IMemberDesignersLicensesBasicsResponse {\r\n\r\n Keys: MemberDesignersLicenseItemArray;\r\n Name: string;\r\n Email: string;\r\n Phone: string;\r\n Credit: number;\r\n\r\n}\r\n\r\nexport class MemberDesignersLicensesBasicsResponse implements IMemberDesignersLicensesBasicsResponse {\r\n\r\n Keys: MemberDesignersLicenseItemArray;\r\n Name: string;\r\n Email: string;\r\n Phone: string;\r\n Credit: number;\r\n\r\n}\r\n\r\nexport class MemberDesignerLicenseBasicsResponseArray extends Array {\r\n\r\n constructor(...items: MemberDesignersLicensesBasicsResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, MemberDesignerLicenseBasicsResponseArray.prototype);\r\n }\r\n\r\n}","import { PriceBillingCycleArray } from \"app/models/ss-api/price.billing.cycle\";\r\n\r\nexport interface IPublicOrderProductsResponse {\r\n\r\n ProductID: number;\r\n Name: string;\r\n Prices: PriceBillingCycleArray;\r\n YardAddon: IPublicOrderProductsResponse;\r\n VisiblePublic: boolean;\r\n TaxEnabled: boolean;\r\n YardVisiblePublic: boolean;\r\n}\r\n\r\nexport class PublicOrderProductsResponse implements IPublicOrderProductsResponse {\r\n\r\n ProductID: number;\r\n Name: string;\r\n Prices: PriceBillingCycleArray;\r\n YardAddon: PublicOrderProductsResponse;\r\n VisiblePublic: boolean;\r\n TaxEnabled: boolean;\r\n YardVisiblePublic: boolean;\r\n}\r\n\r\nexport class PublicOrderProductsResponseArray extends Array {\r\n\r\n constructor(...items: PublicOrderProductsResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, PublicOrderProductsResponseArray.prototype);\r\n }\r\n\r\n}\r\n","export class ReactivateSimulationResponse {\r\n\r\n ReactivatePossible: string;\r\n ReactivateNotPossibleReason: string;\r\n InGraceReactivation: boolean;\r\n ProductPrice: number;\r\n SetupPrice: number;\r\n\r\n //total without tax\r\n TotalPrice: number;\r\n Credit: number;\r\n NextBillingDate: Date;\r\n\r\n TaxFromCache: boolean;\r\n TaxEnabled: boolean;\r\n TaxRate: number;\r\n TaxAmount: number;\r\n State: string;\r\n TotalWithTax: number;\r\n TaxRateDisplay: string;\r\n\r\n // public static FixDates(item: ReactivateSimulationResponse) {\r\n // item.NextBillingDate = new Date(item.NextBillingDate);\r\n // }\r\n\r\n}","export class ReactivateSimulationResponsev2 {\r\n\r\n ReactivatePossible: string;\r\n ReactivateNotPossibleReason: string;\r\n InGraceReactivation: boolean;\r\n ProductPrice: number;\r\n SetupPrice: number;\r\n YARDPrice: number;\r\n TotalPrice: number;\r\n NextBillingDate: Date;\r\n\r\n Credit: number;\r\n\r\n TaxFromCache: boolean;\r\n TaxEnabled: boolean;\r\n TaxRate: number;\r\n TaxAmount: number;\r\n State: string;\r\n TotalWithTax: number;\r\n TaxRateDisplay: string;\r\n \r\n\r\n // public static FixDates(item: ReactivateSimulationResponsev2) {\r\n // item.NextBillingDate = new Date(item.NextBillingDate);\r\n // }\r\n\r\n}","export class ssApiResponse {\r\n\r\n constructor(public Url: string, public Method: string, public Payload: any) {\r\n\r\n }\r\n\r\n}","export interface ITrainingEventDetailsResponse {\r\n\r\n ScheduleID: any;\r\n title: string;\r\n date: string;\r\n displaySoftware: any;\r\n end: string;\r\n hour: number;\r\n htmlContent: string;\r\n start: string;\r\n time: string;\r\n credits: string;\r\n IsExpired: boolean;\r\n url: string;\r\n\r\n}\r\n\r\n\r\nexport class TrainingEventDetailsResponse implements ITrainingEventDetailsResponse {\r\n\r\n ScheduleID: any;\r\n title: string;\r\n date: string;\r\n displaySoftware: any;\r\n end: string;\r\n hour: number;\r\n htmlContent: string;\r\n start: string;\r\n time: string;\r\n credits: string;\r\n IsExpired: boolean;\r\n url: string;\r\n\r\n}\r\n\r\n","import { BillingRecurringTypes } from \"app/models/ss-api/requests/new.member.request\";\r\n\r\nexport interface IUnfunishedOrderData {\r\n\r\n Product: string;\r\n Package: string;\r\n BillingCycleType: BillingRecurringTypes;\r\n RecurringAmount: number;\r\n SetupAmount: number;\r\n CCLast4: string;\r\n TaxEnabled: boolean;\r\n TaxRate: number;\r\n State: string;\r\n TaxRateDisplay: string;\r\n TotalWithTax: number;\r\n TaxAmount: number;\r\n\r\n}\r\n\r\nexport class UnfunishedOrderData implements IUnfunishedOrderData {\r\n\r\n Product: string;\r\n Package: string;\r\n BillingCycleType: BillingRecurringTypes;\r\n RecurringAmount: number = 0;\r\n SetupAmount: number = 0;\r\n CCLast4: string;\r\n TaxEnabled: boolean;\r\n TaxRate: number;\r\n State: string;\r\n TaxRateDisplay: string;\r\n TotalWithTax: number;\r\n TaxAmount: number;\r\n\r\n}\r\n\r\n\r\n","export enum BillingRecurringTypes {\r\n Yearly = 2,\r\n Monthly = 1,\r\n\r\n}\r\n\r\nexport interface IUpgradableProductsResponse {\r\n FromProductID: number;\r\n FromProductName: string;\r\n FromBillingCycle: BillingRecurringTypes;\r\n HasYard: boolean;\r\n ProductID: number;\r\n Name: string;\r\n Price: number;\r\n BillingCycle: BillingRecurringTypes;\r\n}\r\n\r\nexport class UpgradableProductsResponse implements IUpgradableProductsResponse {\r\n FromProductID: number;\r\n FromProductName: string;\r\n FromBillingCycle: BillingRecurringTypes;\r\n HasYard: boolean;\r\n ProductID: number;\r\n Name: string;\r\n Price: number;\r\n BillingCycle: BillingRecurringTypes;\r\n}\r\n\r\nexport class UpgradableProductsResponseArray extends Array {\r\n\r\n constructor(...items: UpgradableProductsResponse[]) {\r\n super(...items);\r\n Object.setPrototypeOf(this, UpgradableProductsResponseArray.prototype);\r\n }\r\n\r\n}","import { BillingRecurringTypes } from \"./upgradable.products.response\";\r\n\r\nexport enum UpgradeTypes {\r\n\r\n MonthToMonth = 0,\r\n MonthToYear = 1,\r\n YearToYear = 2,\r\n NotSupported = 99\r\n\r\n}\r\n\r\nexport class UpgradeSimulationResponse {\r\n\r\n UpgradeType: UpgradeTypes;\r\n OldBillingCycle: BillingRecurringTypes;\r\n NewBillingCycle: BillingRecurringTypes;\r\n OldProductID: number;\r\n OldProductName: string;\r\n NewProductID: number;\r\n NewProductName: string;\r\n OldPrice: number;\r\n DateTimeCycleStart: Date;\r\n DateTimeCycleEnd: Date;\r\n DaysCurrentCycle: number;\r\n DaysUntilRenewal: number;\r\n DaysUsed: number;\r\n OldDayPrice: number;\r\n AmountUsedThisCycle: number;\r\n CreditThisCycle: number;\r\n NewPrice: number;\r\n NewDayPrice: Number;\r\n AmountDueThisCycleNewProduct: number;\r\n TotalDueUpgrade: number;\r\n DateTimeNewCycleEnd: Date;\r\n\r\n TotalDueUpgradeTaxAmount: number;\r\n TotalDueUpgradeWithTax: number;\r\n TaxRateDisplay: string;\r\n TaxFromCache: boolean;\r\n TaxEnabled: boolean;\r\n TaxRate: number;\r\n State: string;\r\n\r\n // public static FixDates(item: UpgradeSimulationResponse) {\r\n // item.DateTimeCycleEnd = new Date(item.DateTimeCycleEnd);\r\n // item.DateTimeCycleStart = new Date(item.DateTimeCycleStart);\r\n // item.DateTimeNewCycleEnd = new Date(item.DateTimeNewCycleEnd);\r\n // }\r\n\r\n}","import { LoginDialogComponent } from './../../../dialogs/auth-login/auth-login-dialog.component';\r\nimport { CheckForExistingMemberRequest } from './../../../models/ss-api/requests/check.for.existing.member.request';\r\nimport { BillingRecurringTypes } from '../../../models/ss-api/price.billing.cycle';\r\nimport { HttpError } from '../../../models/errors/HttpError';\r\nimport { Component, OnInit, ViewChild, OnDestroy } from '@angular/core';\r\nimport { AbstractControl, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\n\r\nimport * as moment from 'moment';\r\nimport Swal from 'sweetalert2';\r\nimport { xToastr, ToastrTypes } from 'app/shared/Toastr';\r\n\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { NewMemberRequest } from 'app/models/ss-api/requests/new.member.request';\r\nimport { PublicOrderProductsResponseArray, PublicOrderProductsResponse } from 'app/models/ss-api/responses/public.order.products.response';\r\nimport { UpdateCartRequest } from 'app/models/ss-api/requests/update.cart.request';\r\n\r\nimport { DialogService } from 'primeng/dynamicdialog';\r\nimport { CompleteOrderDialogComponent } from 'app/dialogs/complete-order/complete-order-dialog.component';\r\nimport { GlobalServices } from 'app/services/global.service';\r\nimport { NewMemberResponse } from '../../../models/ss-api/responses/new.member.response';\r\nimport { Title } from '@angular/platform-browser';\r\nimport { CreditCardValidators } from 'angular-cc-library';\r\nimport { CheckForExistingMemberResponse } from 'app/models/ss-api/responses/check.for.existing.member.response';\r\n\r\nimport { CountryList, CountryListItem } from '../../../helpers/country.list';\r\nimport { StateList, StateListItem, DualStateZipcodeList } from '../../../helpers/state.list';\r\n\r\nimport { CreditCardHelper } from '../../../helpers/creditcard';\r\nimport { CreditCardTypes } from 'app/models/ss-api/responses/credit.card.response';\r\n\r\n\r\nfunction CustomCreditCardValidator(c: UntypedFormControl) {\r\n \r\n let cardType = CreditCardHelper.GetCardTypes( c.value );\r\n\r\n if( cardType == CreditCardTypes.Unknown || cardType == null ) {\r\n return {\r\n CustomCreditCardValidator: {\r\n valid: false\r\n }\r\n }\r\n } else {\r\n return null;\r\n }\r\n\r\n}\r\n\r\n@Component({\r\n selector: 'app-order-form',\r\n templateUrl: './order-form-v2.component.html',\r\n styleUrls: ['./order-form-v2.component.scss'],\r\n providers: [DialogService]\r\n})\r\nexport class OrderFormComponentV2 implements OnInit, OnDestroy {\r\n\r\n // *********************************************************************************************************** //\r\n // orderFormVersion - Update this whenever a major change is made to form\r\n //\r\n // if updated, a corresponding order form component needs to be created and routed on the reports panel\r\n //\r\n //orderFormVersion ------- WE GET THIS FROM THE GLOBALS, IT IS IMPERATIVE THAT IT BE UPDATED!!! YOOOOUUUU HAAAAAVE BEEEEEN WAARRRRNEEDD!!!!\r\n // *********************************************************************************************************** //\r\n\r\n\r\n /* *******************************************\r\n order form link URLs:\r\n Vip3D Monthly -- https://members.structurestudios.com/order-form/product/0/1/1\r\n Vip3D Special -- https://members.structurestudios.com/order-form/product/VIP3D_-_Special1/1/1\r\n\r\n ******************************************** */\r\n IsBusy: boolean = true;\r\n\r\n isSpecial: boolean = false;\r\n isPromo: boolean = false;\r\n\r\n isCheckingMember : boolean = false;\r\n\r\n // products\r\n Products: PublicOrderProductsResponseArray;\r\n SelectedProduct: PublicOrderProductsResponse = new PublicOrderProductsResponse();\r\n SelectedBillingCycle: BillingRecurringTypes = BillingRecurringTypes.Monthly;\r\n SelectedPrice: number = 0;\r\n SelectedSetupFee: number = 0;\r\n ReferallInfo: any;\r\n\r\n yardAddOnOption: boolean = false;\r\n yardAddOn: boolean = false;\r\n yardPrice: number = 0;\r\n yardSetup: number = 0;\r\n // ID's FROM ROUTE PARAMTERS\r\n routeParams: object;\r\n marketTag: string;\r\n\r\n\r\n\ttrainingValue : string = \"2,375\";\r\n\r\n // Cart ID\r\n CartID: string;\r\n SkipUpdteCart: boolean = true; // for initial change detects like dropdowns\r\n LastUpdateCartRequest: UpdateCartRequest;\r\n\r\n // form\r\n OrderForm: UntypedFormGroup;\r\n\r\n orderFormSubmited: boolean = false;\r\n\r\n selectedCycle: number = 1;\r\n formProductClass: string;\r\n\r\n //Tax - Hard Code to TX\r\n /*\r\n TaxEnabled: boolean = true;\r\n TaxCalculated: boolean = true;\r\n State: string = \"TX\";\r\n TaxRateDisplay: string = \"8.25%\";\r\n TaxAmount: number = 14.25;\r\n TaxRate: number = 8.25;\r\n YardTax: number = 0;\r\n */\r\n \r\n //Tax - Emulate First Load\r\n /*\r\n TaxEnabled: boolean = true;\r\n TaxCalculated: boolean = false;\r\n State: string = \"\";\r\n TaxRateDisplay: string = \"\";\r\n TaxAmount: number = 0;\r\n YardTax: number = 0;\r\n */\r\n\r\n //Tax - Live\r\n TaxEnabled: boolean = false;\r\n TaxCalculated: boolean = false;\r\n State: string = \"\";\r\n TaxRateDisplay: string = \"\";\r\n TaxAmount: number = 0;\r\n YardTax: number = 0;\r\n TaxRate: number = 0;\r\n\r\n @ViewChild('orderForm') form;\r\n\r\n @ViewChild('billingCycleSelect') billingCycleSelect;\r\n @ViewChild('EmailField') EmailField;\r\n @ViewChild('ccNumber') ccNumber;\r\n\r\n @ViewChild('phoneNumber') phoneNumber;\r\n\r\n Year: number = new Date().getFullYear();\r\n YearRange: any[] = [];\r\n \r\n // CC Name Variables\r\n ccFirstName = '';\r\n ccLastName = '';\r\n ccardType: number;\r\n \r\n cardType : CreditCardTypes = CreditCardTypes.Unknown;\r\n\r\n ccardTypeClass : string;\r\n\r\n ExpirationChanged: boolean = false;\r\n\r\n // DATA SUBSCRIPTION VARIABLES\r\n paramsSubscribe: any;\r\n\r\n EdgeInterval;\r\n\r\n thisIsDev: boolean = false;\r\n\r\n\r\n countryList : CountryListItem[] = CountryList.Countries();\r\n stateList : StateListItem[] = StateList.States();\r\n\r\n\r\n constructor(public api: ssApiService,\r\n private route: ActivatedRoute,\r\n private router: Router,\r\n // private sweetAlertService: SweetAlertService,\r\n private dialogService: DialogService,\r\n private gb: GlobalServices,\r\n private titleService: Title) {\r\n\r\n this.paramsSubscribe = this.route.params.subscribe(params => this.routeParams = params);\r\n\r\n }\r\n\r\n ngOnDestroy() {\r\n this.paramsSubscribe.unsubscribe();\r\n }\r\n\r\n ngOnInit() {\r\n\r\n\r\n if (window.navigator.platform.includes('Mac')) {\r\n Swal.fire({\r\n // type: 'warning',\r\n // title: 'Mac Not Supported',\r\n text: 'Please note the software is not compatible with Mac',\r\n confirmButtonText: 'I understand',\r\n allowOutsideClick: false\r\n }).then( (confirm) => {\r\n\r\n }, (dismiss) => {\r\n window.history.back();\r\n });\r\n }\r\n\r\n // Set page title\r\n this.titleService.setTitle('Order Form');\r\n\r\n const usZipValidators = [\r\n Validators.required,\r\n Validators.minLength(5),\r\n ];\r\n\r\n // this.showCompleteOrderDialog();\r\n // initialize order form\r\n this.OrderForm = new UntypedFormGroup({\r\n firstName: new UntypedFormControl('', [Validators.required, Validators.minLength(2), Validators.pattern('[a-zA-Z ]*')] ),\r\n lastName: new UntypedFormControl('', [Validators.required, Validators.minLength(2), Validators.pattern('[a-zA-Z ]*')]),\r\n company: new UntypedFormControl('', [Validators.required, Validators.minLength(2), Validators.pattern('.*[a-zA-Z].*') ] ),\r\n\t\t\t//'phone': new FormControl('', [Validators.required, Validators.minLength(10), Validators.pattern('^[0-9 \\+\\-\\]+$')]),\r\n\t\t\tphone: new UntypedFormControl('', [Validators.required, Validators.minLength(14) ]),\r\n email: new UntypedFormControl('', [Validators.required, Validators.email]),\r\n // 'email1': new FormControl(\"\", [Validators.required, Validators.email]),\r\n password: new UntypedFormControl('', [Validators.required, Validators.minLength(5)]),\r\n password1: new UntypedFormControl('', [Validators.required, Validators.minLength(5)]),\r\n\r\n address1: new UntypedFormControl('', [Validators.required, Validators.minLength(5)]),\r\n city: new UntypedFormControl('', [Validators.required, Validators.minLength(3)]),\r\n state: new UntypedFormControl('NA', [Validators.required, Validators.minLength(2)]),\r\n statepicker: new UntypedFormControl('', [Validators.required]),\r\n\t\t\tzipCode: new UntypedFormControl('', usZipValidators),\r\n\t\t\tcountry: new UntypedFormControl('US', [Validators.required]),\r\n ccNameOnCard: new UntypedFormControl('', [Validators.required]),\r\n \r\n //ccNr: new FormControl('', [CreditCardValidator.validateCCNumber]), //creditCard: new FormControl('', [CreditCardValidator.validateCCNumber]),\r\n ccNr: new UntypedFormControl('', [CreditCardValidators.validateCCNumber, Validators.required, CustomCreditCardValidator]),\r\n\r\n ccExpMonth: new UntypedFormControl(this.ThisMonth(), [Validators.required]),\r\n ccExpYear: new UntypedFormControl(this.Year, [Validators.required]),\r\n ccCVC: new UntypedFormControl('', [Validators.required, Validators.minLength(3), Validators.maxLength(4), Validators.pattern('^[0-9]+$')]),\r\n yardAddOn: new UntypedFormControl(''),\r\n confirmInitials: new UntypedFormControl('', [Validators.required]),\r\n });\r\n\r\n\t\tthis.OrderForm.controls.country.valueChanges.subscribe( newCountry => {\r\n\t\t\tif ( newCountry == \"US\" ) {\r\n\t\t\t\tconsole.log(\"GO USA\");\r\n // this.OrderForm.get('state').setValue(\"NA\");\r\n // this.OrderForm.get('statepicker').setValue(\"\");\r\n\t\t\t\tthis.OrderForm.controls.zipCode.setValidators(usZipValidators);\r\n\t\t\t} else {\r\n\t\t\t\tconsole.log(\"GO \" + newCountry +\"?\");\r\n // this.OrderForm.get('state').setValue(\"\");\r\n // this.OrderForm.get('statepicker').setValue(\"NV\"); \r\n\t\t\t\tthis.OrderForm.controls.zipCode.setValidators([Validators.required, Validators.minLength(2), Validators.maxLength(10)]);\r\n\t\t\t}\r\n\t\t\tthis.OrderForm.updateValueAndValidity();\r\n\t\t});\r\n\r\n this.OrderForm.controls.zipCode.valueChanges.subscribe((value) => {\r\n if (!this.IsUS()) {\r\n return;\r\n }\r\n // remove spaces\r\n let trimmed = value.replace(/\\s+/g, '');\r\n\r\n trimmed = trimmed.replace(/[^\\d]/g, \"\");\r\n\r\n if (trimmed.length > 5) {\r\n trimmed = trimmed.substr(0, 5);\r\n }\r\n\r\n if (value !== trimmed) {\r\n this.OrderForm.controls.zipCode.setValue(trimmed);\r\n }\r\n });\r\n\r\n this.OrderForm.controls.phone.valueChanges.subscribe((value) => {\r\n if (value !== this.getPhoneInputValue(value)) {\r\n this.OrderForm.controls.phone.setValue(\r\n this.getPhoneInputValue(value)\r\n );\r\n }\r\n });\r\n\r\n // SET UP YEAR RANGE FOR CREDIT CARD EXPIRATION DATE FIELD\r\n for (let i: number = 0; i < 15; i++) {\r\n this.YearRange.push(this.Year + i);\r\n }\r\n\r\n // assign product from routed parameters and refresh the public product list\r\n this.refreshProducts();\r\n\r\n // create CardID if not exist\r\n this.GetCartID();\r\n\r\n // SHOW COMPLETE ORDER DIALOG TEST -- mike\r\n // this.showCompleteOrderDialog(\"UFOID\");\r\n this.thisIsDev = this.api.isDev;\r\n\r\n let disposable = this.OrderForm.controls.ccNr.valueChanges.subscribe( val => {\r\n \r\n console.log(val);\r\n //this.CheckCredtiCardType(val); \r\n\r\n });\r\n\r\n\r\n }\r\n\r\n \r\n\r\n CheckCredtiCardType( value : string ) {\r\n \r\n console.log(\"Credit Card Value : \" + value);\r\n let cardType : CreditCardTypes = CreditCardHelper.GetCardTypes( value );\r\n this.cardType = cardType;\r\n console.log(this.cardType);\r\n let newCardType : string = cardType.toString().toLowerCase();\r\n\r\n this.ccardTypeClass = newCardType;\r\n\r\n }\r\n\r\n\r\n ThisMonth() {\r\n const month = new Date().getMonth() + 1;\r\n\r\n if (month < 10) {\r\n return '0' + month;\r\n } else {\r\n return month;\r\n }\r\n }\r\n\r\n matchedFieldChanged() {\r\n this.OrderForm.controls['password'].updateValueAndValidity();\r\n this.OrderForm.controls['password1'].updateValueAndValidity();\r\n\r\n // this.OrderForm.controls[\"email\"].updateValueAndValidity();\r\n // this.OrderForm.controls[\"email1\"].updateValueAndValidity();\r\n }\r\n\r\n GetCartID() {\r\n\r\n this.CartID = localStorage.getItem('cartID');\r\n\r\n if (this.CartID != undefined) {\r\n // console.log(\"CartID exist:\", this.CartID);\r\n return;\r\n }\r\n\r\n // console.log(\"New CartID:\", this.CartID);\r\n this.CartID = this.generateUUID();\r\n localStorage.setItem('cartID', this.CartID);\r\n }\r\n\r\n generateUUID() {\r\n let d = new Date().getTime();\r\n if (typeof performance !== 'undefined' && typeof performance.now === 'function') {\r\n d += performance.now();\r\n }\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n let r = (d + Math.random() * 16) % 16 | 0;\r\n d = Math.floor(d / 16);\r\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\r\n });\r\n }\r\n\r\n assignRouteParams(newParams: object) {\r\n // MAKE SURE NEWPARAMS IS DEFINED, IF NOT ASSIGN DEFAULT PRODUCT ID\r\n // console.log(newParams);\r\n if (this.isEmpty(newParams)) {\r\n this.SelectedProduct.ProductID = 0;\r\n // this.SelectedBillingCycle = 1;\r\n // console.log(\"newParams object was empty\");\r\n return;\r\n }\r\n\r\n // ASSIGN ACTIVATED ROUTE PARAMETERS\r\n let newProductID = Number(newParams['productID']);\r\n let newCycleID = Number(newParams['cycleID']);\r\n let newYardAddOn = Number(newParams['yardAddOn']);\r\n this.marketTag = String(newParams['marketTag']);\r\n // console.log(\"marketTag = \" + this.marketTag);\r\n // MAKE SURE NEW ID's FALLS INTO ACCEPTABLE RANGE\r\n if (newCycleID < 1)\r\n newCycleID = 1;\r\n\r\n\r\n\r\n // ASSIGN PRODUCT ID AND BILLING CYCLE ID\r\n this.SelectedProduct.ProductID = newProductID;\r\n this.SelectedBillingCycle = newCycleID;\r\n\r\n // console.log(\"newYardAddOn = \" + newYardAddOn + \" ProductID = \" + this.SelectedProduct.ProductID);\r\n\r\n if (newYardAddOn == 0 || this.SelectedProduct.ProductID != 0)\r\n this.yardAddOn = false;\r\n else\r\n this.yardAddOn = true;\r\n\r\n if (this.SelectedProduct.ProductID == 0)\r\n this.yardAddOnOption = true;\r\n\r\n // console.log(\"newCycleID\", newCycleID, \" Selected Billing Cycle = \", this.SelectedBillingCycle);\r\n\r\n // ASSIGN MONTHYL/YEARLY SELECTION\r\n if (this.SelectedBillingCycle == 2) {\r\n // this.billingCycleSelect.value = '2';\r\n let mySelect: any = document.getElementById('billingCycleSelect');\r\n mySelect.value = 2;\r\n }\r\n\r\n\r\n }\r\n\r\n refreshProducts() {\r\n\r\n this.IsBusy = true;\r\n let subScription = this.api.ProductsPublicAndSpecialOrderProducts()\r\n .subscribe((response) => {\r\n console.log(\"prodresponse\", response);\r\n subScription.unsubscribe();\r\n\r\n if (response.Result)\r\n this.Products = response.Data;\r\n else\r\n this.Products = new PublicOrderProductsResponseArray();\r\n\r\n let newProductName = 'VIP3D';\r\n\r\n if (this.routeParams['productID'] != undefined) {\r\n if (this.routeParams['productID'] == '0') {\r\n newProductName = 'VIP3D';\r\n } else if (this.routeParams['productID'] == '1') {\r\n newProductName = 'Pool Studio';\r\n } else if (this.routeParams['productID'] == '2') {\r\n newProductName = 'VizTerra';\r\n } else {\r\n newProductName = this.routeParams['productID'].replace(/_/g, ' ');\r\n if (newProductName.toLowerCase().includes('special'))\r\n this.isSpecial = true;\r\n else if (newProductName.toLowerCase().includes(\"promo\"))\r\n this.isPromo = true; \r\n }\r\n }\r\n\r\n this.assignRouteParams(this.routeParams);\r\n\t\t\t\t// this.personService.getPersons().find(x => x.id == this.personId);\r\n\t\t\t\t\r\n\t\t\t\tlet newProductID : number = -1;\r\n\r\n\t\t\t\tfor( var i = 0; i < response.Data.length; i++ ) {\r\n\t\t\t\t\tif( response.Data[i].Name == newProductName ) {\r\n\t\t\t\t\t\tnewProductID = response.Data[i].ProductID;\r\n this.TaxEnabled = response.Data[i].TaxEnabled;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\t//let newProductID : number = response.Data.find(x => x.Name == newProductName).ProductID;\r\n\r\n\t\t\t\tif( newProductID == -1 ) {\r\n\t\t\t\t\t// No product Found\r\n console.log(\"NO PRODUCT!!!!\");\r\n console.log(\"t1\", newProductName);\r\n console.log(\"t2\", response.Data);\r\n\r\n\t\t\t\t\tthis.ShowProductNotFoundDialog();\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Found a valid Product\r\n\t\t\t\t\tthis.ProductChanged( newProductID );\r\n\t\t\t\t}\r\n\r\n\t\t\t\t\r\n\t\t\t\tif( newProductName == 'VIP3D' ) {\r\n\t\t\t\t\tthis.trainingValue = '2,425';\r\n\t\t\t\t} else if ( newProductName == \"VizTerra\" ) {\r\n\t\t\t\t\tthis.trainingValue = '2,090';\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t// this.IsBusy = false;\r\n\t\t\t},\r\n\t\t\t(error: any) => {\r\n\t\t\t\tthis.IsBusy = false;\r\n\t\t});\r\n\r\n }\r\n\r\n makePriceLookNice(thePrice: any): string {\r\n return thePrice.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\r\n }\r\n\r\n totalPrice(): number {\r\n let newTotal = this.SelectedPrice + this.SelectedSetupFee;\r\n if (this.yardAddOn)\r\n newTotal += this.yardPrice;\r\n return newTotal;\r\n }\r\n\r\n totalTaxDisplay(): string {\r\n let newTax = this.TaxAmount;\r\n if (this.yardAddOn)\r\n newTax += this.YardTax;\r\n\r\n if (newTax == 0 || (newTax * 100).toString().endsWith(\"00\")){\r\n return newTax.toString();\r\n }\r\n else{\r\n return(Math.round( newTax * 100) / 100).toFixed(2);\r\n } \r\n }\r\n\r\n totalTax(): number {\r\n let newTax = this.TaxAmount;\r\n if (this.yardAddOn)\r\n newTax += this.YardTax;\r\n return newTax; \r\n } \r\n\r\n totalPriceWithTax(): string {\r\n let newTotalWithTax = this.SelectedPrice + this.SelectedSetupFee + this.totalTax();\r\n if (this.yardAddOn)\r\n newTotalWithTax += this.yardPrice;\r\n\r\n if ((newTotalWithTax * 100).toString().endsWith(\"00\")){\r\n return newTotalWithTax.toString();\r\n }\r\n else{\r\n return(Math.round( newTotalWithTax * 100) / 100).toFixed(2);\r\n }\r\n }\r\n\r\n\r\n isEmpty(obj): boolean {\r\n for (let key in obj) {\r\n if (obj.hasOwnProperty(key))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n isValidExpiration() {\r\n let ccExpMonth = this.OrderForm.get('ccExpMonth').value;\r\n let ccExpYear = this.OrderForm.get('ccExpYear').value;\r\n\r\n if (moment(ccExpMonth + '/' + ccExpYear, 'MM/YYYY').isSameOrAfter(moment(moment().format('MM/YYYY'), 'MM/YYYY'))) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n onExpirationChange() {\r\n this.ExpirationChanged = true;\r\n this.UpdateCart();\r\n }\r\n\r\n isFormValid(): boolean {\r\n // isCompareValid( passwordRepeat.value, password.value ) == true && isCompareValid( email.value, email1.value ) == true && email.value != '' && password.value != ''\r\n let ccNameOnCard = this.OrderForm.get('ccNameOnCard').value;\r\n this.getNameOnCard(ccNameOnCard);\r\n let ccExpMonth = this.OrderForm.get('ccExpMonth').value;\r\n let ccExpYear = this.OrderForm.get('ccExpYear').value;\r\n\r\n if (this.ccLastName == '')\r\n return false;\r\n\r\n if (!this.OrderForm.valid)\r\n return false;\r\n\r\n if (!this.isValidExpiration())\r\n return false;\r\n\r\n if (this.orderFormSubmited)\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n hasLastName(): boolean {\r\n\r\n let ccNameOnCard = this.OrderForm.get('ccNameOnCard').value;\r\n this.getNameOnCard(ccNameOnCard);\r\n if (this.ccLastName == '')\r\n return false;\r\n\r\n return true;\r\n\r\n }\r\n\r\n \r\n\r\n CheckMember() {\r\n\r\n if( this.isCheckingMember ) return;\r\n\r\n if ( !this.OrderForm.controls['email'].valid ) return;\r\n \r\n this.isCheckingMember = true;\r\n \r\n let email = this.OrderForm.controls['email'].value;\r\n \r\n let request: CheckForExistingMemberRequest = {\r\n Checksum: 'ADSFEWFF~!OMG1ITS5SNOWING3INVEGAS42!!!AND6ALL4FROZEN7DRINKS3ARE22HALF00OFF43IN65THE998CASINO',\r\n Email: email\r\n };\r\n\r\n\r\n let disposable = this.api.CheckForExistingMember(request).subscribe(response => {\r\n \r\n disposable.unsubscribe();\r\n\r\n this.isCheckingMember = false;\r\n\r\n let existingMemberResponse : CheckForExistingMemberResponse = response.Data;\r\n\r\n console.log('existingmemberresponse = ', existingMemberResponse );\r\n\r\n if (existingMemberResponse.PromptToLoginOnOrderForm) {\r\n \r\n localStorage.setItem('email', email);\r\n\r\n \r\n switch (existingMemberResponse.MemberType) {\r\n case 100:\r\n case 110: {\r\n // Active Member && Cancelled Member\r\n this.ShowLoginDialog();\r\n break;\r\n }\r\n case 200:\r\n case 210: {\r\n // Cancelled Designer && Active Designer\r\n Swal.fire({\r\n icon: 'warning',\r\n title: 'Warning',\r\n text: 'It looks like you already have a designer profile registered to this email address. Please use a different email address.'\r\n }).then(() => {\r\n // this.router.navigate(['/'])\r\n this.OrderForm.controls['email'].setValue('');\r\n this.EmailField.nativeElement.focus();\r\n }, () => {\r\n // this.router.navigate(['/'])\r\n this.OrderForm.controls['email'].setValue('');\r\n this.EmailField.nativeElement.focus();\r\n });\r\n break;\r\n }\r\n }\r\n } else if ( existingMemberResponse.PromptToFinishOrder && existingMemberResponse.UFOID) {\r\n this.dialogService.open(CompleteOrderDialogComponent, {data: {\r\n UFOID: existingMemberResponse.UFOID,\r\n fromLogin : false,\r\n }});\r\n this.OrderForm.controls['email'].setValue('');\r\n this.EmailField.nativeElement.focus();\r\n }\r\n \r\n });\r\n }\r\n\r\n ShowLoginDialog() {\r\n this.dialogService.open(LoginDialogComponent, {data: {\r\n IsWelcomeBack: true,\r\n ProductID: this.SelectedProduct.ProductID,\r\n BillingCycle: this.SelectedBillingCycle,\r\n HasYard: this.yardAddOn\r\n }});\r\n this.OrderForm.controls['email'].setValue('');\r\n this.EmailField.nativeElement.focus();\r\n }\r\n\r\n BillingCycleChanged(billingCycleType: BillingRecurringTypes) {\r\n\r\n // set billing\r\n this.SelectedBillingCycle = billingCycleType;\r\n\r\n // set type based on new billing\r\n this.SelectedPrice = this.SelectedProduct\r\n .Prices\r\n .find(x => x.BillingCycle == billingCycleType)\r\n .Price;\r\n\r\n this.SelectedSetupFee = this.SelectedProduct\r\n .Prices\r\n .find(x => x.BillingCycle == billingCycleType)\r\n .Setup;\r\n\r\n if (this.yardAddOn && this.SelectedProduct.YardAddon != null) {\r\n this.yardPrice = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Price;\r\n this.yardSetup = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n this.YardTax = this.yardPrice * (this.TaxRate / 100);\r\n this.YardTax = this.YardTax * 100;\r\n this.YardTax = Math.round(this.YardTax);\r\n this.YardTax = this.YardTax / 100;\r\n } else {\r\n this.yardPrice = 0;\r\n this.yardSetup = 0;\r\n this.YardTax = 0;\r\n }\r\n this.UpdatePageTitle();\r\n if (!this.SkipUpdteCart)\r\n this.UpdateCart();\r\n }\r\n\r\n ProductChanged(productID: number) {\r\n\r\n // set product\r\n this.SelectedProduct = this.Products.find(x => x.ProductID == productID);\r\n this.SelectedSetupFee = this.SelectedProduct.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n\r\n if (this.yardAddOn && this.SelectedProduct.YardAddon != null) {\r\n this.yardPrice = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Price;\r\n this.yardSetup = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n } else {\r\n this.yardPrice = 0;\r\n this.yardSetup = 0;\r\n }\r\n\r\n\r\n // set price based on new product\r\n this.BillingCycleChanged(this.SelectedBillingCycle);\r\n\r\n // console.log(\"Prodcut Name:\", this.SelectedProduct.Name);\r\n // console.log(\"Setup Fee:\", this.SelectedSetupFee);\r\n\r\n this.formProductClass = this.SelectedProduct.Name.replace(/\\s+/g, '');\r\n\r\n this.titleService.setTitle('Order Form | ' + this.SelectedProduct.Name);\r\n this.UpdatePageTitle();\r\n\r\n if (!this.SkipUpdteCart)\r\n this.UpdateCart();\r\n\r\n }\r\n\r\n UpdatePageTitle() {\r\n let cycleName = 'Monthly';\r\n if (this.SelectedBillingCycle == 2) {\r\n cycleName = 'Yearly';\r\n }\r\n //console.log(this.SelectedBillingCycle);\r\n this.titleService.setTitle(this.SelectedProduct.Name + ' Order Form - Review Your ' + cycleName + ' Membership Plan');\r\n }\r\n\r\n checkEmailValid(): boolean {\r\n\r\n let Email = this.OrderForm.get('email');\r\n // let Email1 = this.OrderForm.get('email1');\r\n\r\n // if (!Email.touched || !Email.touched)\r\n // return false;\r\n\r\n // if (!Email.valid || !Email1.valid)\r\n // return false;\r\n\r\n // if (Email.value != Email1.value)\r\n // return false;\r\n\r\n return true;\r\n }\r\n\r\n isCompareValid(myField: string, compareField: string): boolean {\r\n return myField == compareField;\r\n }\r\n\r\n checkPasswordValid(): boolean {\r\n\r\n let Email = this.OrderForm.get('password');\r\n let Email1 = this.OrderForm.get('password1');\r\n\r\n if (!Email.touched || !Email.touched)\r\n return false;\r\n\r\n if (!Email.valid || !Email1.valid)\r\n return false;\r\n\r\n if (Email.value != Email1.value)\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n isFieldValid(fieldName: string): boolean {\r\n\r\n if (this.OrderForm.get(fieldName).value != '')\r\n return true;\r\n else\r\n return false;\r\n\r\n }\r\n\r\n StripNonNumeric(strValue: string): number {\r\n\r\n let value = strValue.replace(/[^\\d]/g, ''); // 1238\r\n\r\n if (value == '')\r\n return 0;\r\n else\r\n return value;\r\n\r\n }\r\n\r\n\r\n GetNewMemberRequest(): NewMemberRequest {\r\n\r\n\r\n\r\n // credit card names\r\n let ccNameOnCard = this.OrderForm.get('ccNameOnCard').value;\r\n this.getNameOnCard(ccNameOnCard);\r\n\r\n // credit card expiration month\r\n let ccExpMonth = this.OrderForm.get('ccExpMonth');\r\n if (ccExpMonth == undefined)\r\n throw RangeError('Credit Card Expiration Month Value Error');\r\n\r\n // credit card expiration year\r\n let ccExpYear = this.OrderForm.get('ccExpYear');\r\n if (ccExpYear == undefined)\r\n throw RangeError('Credit Card Expiration Year Value Error');\r\n\r\n // check email\r\n if (!this.checkEmailValid())\r\n throw Error('Invalid Email.');\r\n\r\n // check password\r\n if (!this.checkPasswordValid())\r\n throw Error('Invalid Password.');\r\n\r\n\r\n // prepare object to return\r\n let data = new NewMemberRequest();\r\n data.Checksum = \"33022hTllpOOO99#$%^ABlpse634!!dss66kfpEFes46^^sdd2\";\r\n data.OrderFormVersion = this.gb.OrderFormVersion;\r\n\r\n // - personal\r\n data.FirstName = this.OrderForm.get('firstName').value;\r\n data.LastName = this.OrderForm.get('lastName').value;\r\n data.Email = this.OrderForm.get('email').value;\r\n data.Company = this.OrderForm.get('company').value;\r\n data.Phone = this.OrderForm.get('phone').value.replace(/[^\\d]/g, \"\");\r\n data.Password = this.OrderForm.get('password').value;\r\n\r\n // - address\r\n data.Address1 = this.OrderForm.get('address1').value;\r\n data.City = this.OrderForm.get('city').value;\r\n data.Country = this.OrderForm.get('country').value;\r\n\r\n if (data.Country == \"US\"){\r\n data.State = this.OrderForm.get('statepicker').value;\r\n }\r\n else{\r\n data.State = this.OrderForm.get('state').value;\r\n }\r\n\r\n data.ZipCode = this.OrderForm.get('zipCode').value;\r\n\r\n // - credit card\r\n data.CC_FirstName = this.ccFirstName;\r\n data.CC_LastName = this.ccLastName;\r\n\r\n\r\n data.CC_Number = this.OrderForm.get('ccNr').value;\r\n\r\n this.CheckCredtiCardType(data.CC_Number);\r\n\r\n if(this.cardType == CreditCardTypes.Unknown) {\r\n throw Error('Unknown Credit Card Type');\r\n }\r\n \r\n data.CC_Number = this.StripNonNumeric(data.CC_Number).toString();\r\n\r\n if (data.CC_Number == '' ||\r\n data.CC_Number.length < 13)\r\n throw Error('Invalid Credit Card Number.');\r\n\r\n\r\n\r\n data.CC_ExpMonth = ccExpMonth.value;\r\n data.CC_ExpYear = ccExpYear.value - 2000;\r\n data.CC_CVC = this.OrderForm.get('ccCVC').value;\r\n data.CC_Address1 = data.Address1;\r\n data.CC_City = data.City;\r\n data.CC_Country = data.Country;\r\n data.CC_State = data.State;\r\n data.CC_ZipCode = data.ZipCode;\r\n\r\n // - product\r\n data.ProductID = this.SelectedProduct.ProductID;\r\n data.BillingCycle = this.SelectedBillingCycle;\r\n data.AddYard = this.yardAddOn;\r\n\r\n\r\n\r\n // - initals\r\n data.Initials = this.OrderForm.get('confirmInitials').value;\r\n\r\n // - redirect/referral\r\n let strRedirectID = localStorage.getItem('s_redirect_id');\r\n let RedirectCreated = localStorage.getItem('s_redirect_created');\r\n let RedirectID = 0;\r\n\r\n if (strRedirectID != undefined)\r\n RedirectID = parseInt(strRedirectID);\r\n\r\n if (RedirectID > 0) {\r\n data.RedirectID = RedirectID;\r\n data.DateTimeRedirectClick = new Date(RedirectCreated);\r\n }\r\n\r\n data.AssignToOwner = false;\r\n\r\n // console.log(\"Request Data: \", data);\r\n return data;\r\n }\r\n\r\n GetUpdateCartRequest(): UpdateCartRequest {\r\n\r\n // prepare object to return\r\n let data = new UpdateCartRequest();\r\n\r\n // cart\r\n data.CartID = this.CartID;\r\n\r\n // - personal\r\n data.FirstName = this.OrderForm.get('firstName').value;\r\n data.LastName = this.OrderForm.get('lastName').value;\r\n data.Email1 = this.OrderForm.get('email').value;\r\n // data.Email2 = this.OrderForm.get('email1').value;\r\n data.Company = this.OrderForm.get('company').value;\r\n data.Phone = this.gb.FormattedPhone(this.OrderForm.get('phone').value);\r\n\r\n // - address\r\n data.Address = this.OrderForm.get('address1').value;\r\n data.City = this.OrderForm.get('city').value;\r\n\t\tdata.Country = this.OrderForm.get('country').value;\r\n\r\n if (data.Country == \"US\"){\r\n data.State = this.OrderForm.get('statepicker').value;\r\n }\r\n else{\r\n data.State = this.OrderForm.get('state').value;\r\n }\r\n\t\t\r\n\t\tdata.ZipCode = this.OrderForm.get('zipCode').value;\r\n\t\t\r\n\r\n // - credit card\r\n data.CCName = this.OrderForm.get('ccNameOnCard').value;\r\n data.CCNumber = this.OrderForm.get('ccNr').value;\r\n data.CCLastFour = data.CCNumber.slice(data.CCNumber.length - 4);\r\n data.CCExpMonth = Number(this.OrderForm.get('ccExpMonth').value);\r\n data.CCExpYear = Number(this.OrderForm.get('ccExpYear').value) - 2000;\r\n\r\n // - product\r\n data.ProductID = this.SelectedProduct.ProductID;\r\n data.BillingCycle = this.SelectedBillingCycle;\r\n\r\n // - Initals\r\n data.Initials = this.OrderForm.get('confirmInitials').value;\r\n\r\n //taxes\r\n data.TaxChecksum = \"s53f4s56dfa4fs6ljsdhfasdlfAFDASKHflash5646asdf\";\r\n data.SubTotal = this.totalPrice(); \r\n\r\n // - redirect/referral\r\n let strRedirectID = localStorage.getItem('s_redirect_id');\r\n let RedirectCreated = localStorage.getItem('s_redirect_created');\r\n let RedirectID = 0;\r\n\r\n if (strRedirectID != undefined)\r\n RedirectID = parseInt(strRedirectID);\r\n\r\n if (RedirectID > 0) {\r\n data.RedirectID = RedirectID;\r\n data.DateTimeRedirectClicked = new Date(RedirectCreated);\r\n }\r\n\r\n console.log(\"Request Cart Update Data: \", data);\r\n return data;\r\n }\r\n\r\n getNameOnCard(nameString: string) {\r\n\r\n this.ccFirstName = '';\r\n this.ccLastName = '';\r\n\r\n let namesSplit = nameString.split(' ');\r\n\r\n if (namesSplit.length == 0)\r\n return;\r\n\r\n let firstName = namesSplit[0];\r\n\r\n let lastName = '';\r\n\r\n if (namesSplit.length > 1) {\r\n for (let i = 1; i < namesSplit.length; i++) {\r\n if (i != 1)\r\n lastName += ' ';\r\n\r\n lastName += namesSplit[i];\r\n }\r\n }\r\n\r\n this.ccFirstName = firstName;\r\n this.ccLastName = lastName;\r\n\r\n }\r\n\r\n\r\n\r\n async onOrderFormSubmit() {\r\n\r\n // Check to see if our order form has been submitted and cancel the submit action\r\n if (this.orderFormSubmited) return;\r\n\r\n this.orderFormSubmited = true;\r\n\r\n this.IsBusy = true;\r\n // get data\r\n let data: NewMemberRequest;\r\n\r\n try {\r\n data = this.GetNewMemberRequest();\r\n } catch (e) {\r\n // console.log(\"error:\", e);\r\n xToastr.ShowToast(ToastrTypes.Error, 'Validation Errors', e);\r\n this.IsBusy = false;\r\n return;\r\n }\r\n\r\n console.log(\"request data\", data);\r\n \r\n //if( 0 == 0 ) return;\r\n \r\n let request = this.api.MemberNew(data)\r\n .subscribe(response => {\r\n // console.log(\"response received\");\r\n // console.log(response)\r\n\r\n\r\n if (!response.Result)\r\n switch (response.ErrCode) {\r\n case '0':\r\n // user exists\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'This user already exists.');\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '1':\r\n // Error Creating Member\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Unkown Error', 'New user could not be created.');\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '2':\r\n // payment\r\n // unfinished order\r\n this.showCompleteOrderDialog(response.Message);\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '3':\r\n // member exists but we couldn't authenticate or something else went wrong\r\n localStorage.setItem('WelcomeBack', '1');\r\n this.router.navigate(['/authentication/signin/welcome-back']);\r\n return;\r\n\r\n case '17':\r\n let options = {\r\n closeButton: true,\r\n progressBar: true,\r\n debug: true,\r\n preventDuplicates: true,\r\n positionClass: 'toast-top-center',\r\n onclick: null,\r\n showDuration: 400,\r\n hideDuration: 1000,\r\n timeOut: 30000,\r\n extendedTimeOut: 1000,\r\n showEasing: 'swing',\r\n hideEasing: 'linear',\r\n showMethod: 'fadeIn',\r\n hideMethod: 'fadeOut'\r\n };\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'This email is linked to a cancelled membership. Please provide a new email address to create a new membership. If you would like to reactivate, contact your account owner or call us at 702-433-0274.', options);\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '19':\r\n case '20':\r\n // user exists\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'A member already exists with this email. Please log in or use a different email address.');\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n default:\r\n // user exists\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'Error processing request. Your Card has been declined.');\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n }\r\n\r\n\r\n\r\n // ok\r\n\r\n // window.location.href = \"https://www.structurestudios.com/thank-you\";\r\n // console.log(response);\r\n // console.log(response.Data);\r\n\r\n // we are authenticated\r\n let Response: NewMemberResponse = response.Data;\r\n\r\n if (Response.Reactivated && Response.ReturningMember) {\r\n // we were able to reactivate this member\r\n // redirect to welcome back page or dashboard\r\n // we are authenticated\r\n this.gb.SetGlobalsFromLoginResponse(Response.LoginResponse);\r\n // HERE MIKE\r\n localStorage.setItem('WelcomeBack', '1');\r\n this.router.navigate(['account/product-memberships']);\r\n return;\r\n } else if (!Response.Reactivated && Response.ReturningMember) {\r\n // we are a returning member and we couldn't reactivate.\r\n // redirect to welcome back or tell the member that the email already exists\r\n // HERE MIKE\r\n localStorage.setItem('WelcomeBack', '1');\r\n this.router.navigate(['/authentication/signin/welcome-back']);\r\n return;\r\n } else {\r\n // we are a new member\r\n this.gb.SetGlobalsFromLoginResponse(Response.LoginResponse);\r\n window.location.href = this.getRedirectURL();\r\n\r\n }\r\n\r\n\r\n\r\n\r\n },\r\n\r\n (error: HttpError) => {\r\n\r\n // this.ResetSigninFormSubmitRequest(request);\r\n this.orderFormSubmited = false;\r\n this.IsBusy = false;\r\n xToastr.ShowToast(ToastrTypes.Error, error.FriendlyTitle, error.FriendlyMessage);\r\n\r\n }\r\n );\r\n\r\n }\r\n\r\n logoLoaded() {\r\n // console.log(\"IsBusy on the logoLoaded method = \" + this.IsBusy);\r\n this.IsBusy = false;\r\n }\r\n\r\n UpdateCart() {\r\n if( this.isCheckingMember ) return;\r\n\r\n this.SkipUpdteCart = false;\r\n\r\n let data = this.GetUpdateCartRequest();\r\n\r\n if (!this.CheckUpdateCart(data))\r\n return;\r\n\r\n this.LastUpdateCartRequest = data;\r\n\r\n let subscription = this.api.SalesUpdateCart(data)\r\n .subscribe( \r\n (result) => { \r\n console.log(\"datarec\");\r\n console.log(result.Data);\r\n console.log(\"dataend\");\r\n this.TaxAmount = result.Data.TaxAmount;\r\n this.TaxEnabled = result.Data.TaxEnabled;\r\n this.TaxRateDisplay = result.Data.TaxRateDisplay;\r\n this.TaxAmount = result.Data.TaxAmount;\r\n this.TaxCalculated = result.Data.TaxCalculated;\r\n if (this.IsUS()) {\r\n if (this.TaxCalculated) {\r\n this.OrderForm.controls.zipCode.setErrors(null);\r\n } else {\r\n this.OrderForm.controls.zipCode.setErrors({\r\n invalid: true\r\n });\r\n } \r\n }\r\n this.OrderForm.updateValueAndValidity();\r\n this.TaxRate = result.Data.TaxRate;\r\n subscription.unsubscribe();\r\n this.updateState(result.Data.State);\r\n },\r\n (error) => { \r\n subscription.unsubscribe();\r\n }\r\n );\r\n\r\n }\r\n\r\n updateState(state) {\r\n const curState = this.orderFormControls.statepicker.value || this.orderFormControls.state.value;\r\n const curZipCode = this.orderFormControls.zipCode.value;\r\n const dualStates = DualStateZipcodeList[curZipCode] || [];\r\n if (!dualStates.includes(curState)) {\r\n this.State = state;\r\n this.OrderForm.get('statepicker').setValue(this.State);\r\n this.OrderForm.get('state').setValue(this.State);\r\n this.OrderForm.updateValueAndValidity();\r\n }\r\n }\r\n\r\n CheckUpdateCart(newCartData: UpdateCartRequest): boolean {\r\n\r\n if (this.LastUpdateCartRequest == undefined)\r\n return true;\r\n\r\n if (newCartData.ProductID != this.LastUpdateCartRequest.ProductID)\r\n return true;\r\n\r\n if (newCartData.BillingCycle != this.LastUpdateCartRequest.BillingCycle)\r\n return true;\r\n\r\n if (newCartData.FirstName != this.LastUpdateCartRequest.FirstName)\r\n return true;\r\n\r\n if (newCartData.LastName != this.LastUpdateCartRequest.LastName)\r\n return true;\r\n\r\n if (newCartData.Initials != this.LastUpdateCartRequest.Initials)\r\n return true;\r\n\r\n if (newCartData.Address != this.LastUpdateCartRequest.Address)\r\n return true;\r\n\r\n if (newCartData.City != this.LastUpdateCartRequest.City)\r\n return true;\r\n\r\n if (newCartData.ZipCode != this.LastUpdateCartRequest.ZipCode)\r\n return true;\r\n\r\n if (newCartData.State != this.LastUpdateCartRequest.State)\r\n return true;\r\n\r\n if (newCartData.Country != this.LastUpdateCartRequest.Country)\r\n return true;\r\n\r\n if (newCartData.CCName != this.LastUpdateCartRequest.CCName)\r\n return true;\r\n\r\n if (newCartData.Company != this.LastUpdateCartRequest.Company)\r\n return true;\r\n\r\n // if (newCartData.Email1 != this.LastUpdateCartRequest.Email1)\r\n // return true;\r\n\r\n if (newCartData.Email2 != this.LastUpdateCartRequest.Email2)\r\n return true;\r\n\r\n if (newCartData.Phone != this.LastUpdateCartRequest.Phone)\r\n return true;\r\n\r\n if (newCartData.CCExpMonth != this.LastUpdateCartRequest.CCExpMonth)\r\n return true;\r\n\r\n if (newCartData.CCExpYear != this.LastUpdateCartRequest.CCExpYear)\r\n return true;\r\n\r\n if (newCartData.CCNumber != this.LastUpdateCartRequest.CCNumber)\r\n return true;\r\n\r\n if (newCartData.CCLastFour != this.LastUpdateCartRequest.CCLastFour)\r\n return true;\r\n\r\n }\r\n\r\n // ///////////////////////////////////////\r\n // SHOW COMPLETE ORDER FORM DIALOG\r\n // ///////////////////////////////////////\r\n showCompleteOrderDialog(ufoid: string) {\r\n\r\n // this.IsBusy = true;\r\n\r\n this.dialogService.open(CompleteOrderDialogComponent, {data: {\r\n UFOID : ufoid,\r\n fromLogin : false,\r\n }});\r\n\r\n\r\n }\r\n\r\n\r\n getRedirectURL(): string {\r\n let membershipName = this.SelectedProduct.Name.toString().toLowerCase();\r\n membershipName = membershipName.replace(/\\s+/g, '');\r\n let billingCycle = 'monthly';\r\n\r\n // console.log(\"this.selectedCycle: \" + this.SelectedBillingCycle)\r\n\r\n if (this.SelectedBillingCycle == 2)\r\n billingCycle = 'yearly';\r\n\r\n return 'order-form/thank-you/' + membershipName + '-' + billingCycle;\r\n }\r\n\r\n GotoThankYouPage() {\r\n window.location.href = this.getRedirectURL();\r\n // console.log(\"Thank You URL: \", this.getRedirectURL() );\r\n }\r\n\r\n yardAddOnCheckChanged(e: any) {\r\n // console.log(\"yardAddOn now = \" + this.yardAddOn);\r\n // console.log(e.target.checked);\r\n\r\n this.yardAddOn = e.target.checked;\r\n this.BillingCycleChanged(this.SelectedBillingCycle);\r\n\r\n }\r\n\r\n isVipName(Name: string): boolean {\r\n if (Name != undefined)\r\n return Name.toLowerCase().includes('vip3d');\r\n else\r\n return false;\r\n }\r\n\r\n isVizterraName(Name: string): boolean {\r\n if (Name != undefined)\r\n return Name.toLowerCase().includes('vizterra');\r\n else\r\n return false;\r\n }\r\n\r\n isPoolStudioName(Name: string): boolean {\r\n if (Name != undefined)\r\n return Name.toLowerCase().includes('pool studio');\r\n else\r\n return false;\r\n\t} \r\n\t\r\n\r\n\r\n\tShowProductNotFoundDialog() {\r\n\r\n\t\tvar pricingURL : string = \"https://www.structurestudios.com/landscape-design-software-and-pool-design-software-pricing\";\r\n\r\n\t\tSwal.fire({\r\n\t\t\ticon: 'error',\r\n\t\t\ttitle: 'We\\'re Sorry',\r\n\t\t\ttext: 'The promotion is no longer available',\r\n\t\t\tshowCloseButton: true,\r\n confirmButtonText: 'View our products',\r\n allowOutsideClick: false,\r\n\t\t}).then(() => {\r\n\t\t\t// this.router.navigate(['/'])\r\n\t\t\twindow.open( pricingURL, '_self');\r\n\t\t}, () => {\r\n\t\t\t// this.router.navigate(['/'])\r\n\t\t\twindow.open( pricingURL, '_self');\r\n\t\t});\r\n\r\n\t}\r\n\r\n IsUS() : boolean {\r\n\t\treturn this.OrderForm.controls.country.value == 'US' ? true : false;\r\n\t}\r\n\r\n public getPhoneInputValue( v : string ) : string {\r\n\t\t\r\n\r\n\t\t// trim '-' dashes\r\n\t\tv = v.replace(/-/g,'');\r\n\r\n\t\tv = v.replace(/[^\\d]/g, \"\");\r\n\t\t\r\n\t\t// trim string to 15 characters\r\n\t\tif( v.length > 10) {\r\n\t\t\tif (v.length > 15) {\r\n\t\t\t\tv = v.substr(0, 15);\r\n\t\t\t}\r\n\t\t\treturn ' +' + v;\r\n\t\t}\r\n\t\t\r\n\r\n // new array to hold sections of the License Key\r\n\t\tlet numbers = [];\r\n\r\n\t\t// create set of characters from first 5 characters\r\n\t\tnumbers.push(v.substr(0,3));\r\n\t\t\r\n\t\t// try for next 5\r\n\t\tif(v.substr(3,3)!==\"\")\r\n\t\t\tnumbers.push(v.substr(3,3));\r\n\t\t\r\n\t\t// and last set of 5\r\n\t\tif(v.substr(6,10)!=\"\")\r\n\t\t\tnumbers.push(v.substr(6,4));\r\n\t\t\r\n\t\tif(v.substr(10,15)!=\"\")\r\n\t\t\tnumbers.push(v.substr(10,5));\r\n\r\n\t\t// add '-' dashes back to formated string\r\n\t\tlet newValue = numbers[0];\r\n\t\t\r\n\t\t//if( newValue.length == 3 ) {\r\n\t\t\t\r\n\t\t//}\r\n\r\n\t\tif( numbers.length > 1 ) {\r\n\t\t\tnewValue = '(' + newValue + ') ';\r\n\t\t\tnewValue += numbers[1];\r\n\t\t}\r\n\t\t\t\r\n\r\n\t\tif (numbers.length > 2 )\r\n\t\t\tnewValue += '-' + numbers[2];\r\n\r\n\t\t// if (numbers.length > 3 )\r\n\t\t// \tnewValue += '-' + numbers[3];\r\n\r\n\t\treturn newValue;\r\n\t}\r\n\r\n get orderFormControls() { return this.OrderForm.controls; }\r\n\r\n // Start Google Place API\r\n getAddress(place: object) {\r\n // this.address = place['formatted_address'];\r\n // this.phone = this.getPhone(place);\r\n // this.formattedAddress = place['formatted_address'];\r\n // this.zone.run(() => this.formattedAddress = place['formatted_address']);\r\n const street = this.getStreet(place);\r\n const district = this.getDistrict(place);\r\n const city = this.getCity(place);\r\n const state = this.getStateShort(place);\r\n const postCode = this.getPostCode(place);\r\n const country = this.getCountryShort(place);\r\n // this.orderFormControls.street.patchValue(street);\r\n this.orderFormControls.address1.patchValue(street);\r\n this.orderFormControls.city.patchValue(city);\r\n this.orderFormControls.state.patchValue(state);\r\n this.orderFormControls.statepicker.patchValue(state);\r\n this.orderFormControls.zipCode.patchValue(postCode);\r\n this.orderFormControls.country.patchValue(country);\r\n setTimeout(() => {\r\n this.UpdateCart(); \r\n });\r\n }\r\n\r\n getAddrComponent(place, componentTemplate) {\r\n let result;\r\n\r\n for (let i = 0; i < place.address_components.length; i++) {\r\n const addressType = place.address_components[i].types[0];\r\n if (componentTemplate[addressType]) {\r\n result = place.address_components[i][componentTemplate[addressType]];\r\n return result;\r\n }\r\n }\r\n return;\r\n }\r\n\r\n getStreetNumber(place) {\r\n const COMPONENT_TEMPLATE = { street_number: 'short_name' },\r\n streetNumber = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return streetNumber;\r\n }\r\n\r\n getStreet(place) {\r\n const COMPONENT_TEMPLATE = { street_number: 'long_name' },\r\n streetNumber = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n const COMPONENT_TEMPLATE1 = { route: 'long_name' },\r\n route = this.getAddrComponent(place, COMPONENT_TEMPLATE1);\r\n const street = streetNumber ? (streetNumber + ' ' + route) : route;\r\n return street || place['formatted_address'];\r\n }\r\n\r\n getCity(place) {\r\n const COMPONENT_TEMPLATE = { locality: 'long_name' },\r\n city = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return city || '';\r\n }\r\n\r\n getState(place) {\r\n const COMPONENT_TEMPLATE = { administrative_area_level_1: 'long_name' },\r\n state = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return state || '';\r\n }\r\n\r\n getStateShort(place) {\r\n const COMPONENT_TEMPLATE = { administrative_area_level_1: 'short_name' },\r\n stateShort = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return stateShort || '';\r\n }\r\n\r\n getDistrict(place) {\r\n const COMPONENT_TEMPLATE = { administrative_area_level_2: 'short_name' },\r\n state = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return state || '';\r\n }\r\n\r\n getCountryShort(place) {\r\n const COMPONENT_TEMPLATE = { country: 'short_name' },\r\n countryShort = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return countryShort || '';\r\n }\r\n\r\n getCountry(place) {\r\n const COMPONENT_TEMPLATE = { country: 'long_name' },\r\n country = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return country || '';\r\n }\r\n\r\n getPostCode(place) {\r\n const COMPONENT_TEMPLATE = { postal_code: 'long_name' },\r\n postCode = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return postCode || '';\r\n }\r\n\r\n getPhone(place) {\r\n const COMPONENT_TEMPLATE = { formatted_phone_number: 'formatted_phone_number' },\r\n phone = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return phone || '';\r\n }\r\n // End Google Place API\r\n}\r\n","import { LoginDialogComponent } from './../../../dialogs/auth-login/auth-login-dialog.component';\r\nimport { CheckForExistingMemberRequest } from './../../../models/ss-api/requests/check.for.existing.member.request';\r\nimport { BillingRecurringTypes } from '../../../models/ss-api/price.billing.cycle';\r\nimport { HttpError } from '../../../models/errors/HttpError';\r\nimport { ChangeDetectorRef, Component, HostListener, OnInit, ViewChild, OnDestroy } from '@angular/core';\r\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\n\r\nimport * as moment from 'moment';\r\nimport Swal from 'sweetalert2';\r\nimport { xToastr, ToastrTypes } from 'app/shared/Toastr';\r\n\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { NewMemberRequest } from 'app/models/ss-api/requests/new.member.request';\r\nimport { PublicOrderProductsResponseArray, PublicOrderProductsResponse } from 'app/models/ss-api/responses/public.order.products.response';\r\nimport { UpdateCartRequest } from 'app/models/ss-api/requests/update.cart.request';\r\n\r\nimport { DialogService } from 'primeng/dynamicdialog';\r\nimport { CompleteOrderDialogComponent } from 'app/dialogs/complete-order/complete-order-dialog.component';\r\nimport { GlobalServices } from 'app/services/global.service';\r\nimport { NewMemberResponse } from '../../../models/ss-api/responses/new.member.response';\r\nimport { Title } from '@angular/platform-browser';\r\nimport { CreditCardValidators } from 'angular-cc-library';\r\nimport { CheckForExistingMemberResponse } from 'app/models/ss-api/responses/check.for.existing.member.response';\r\n\r\nimport { CountryList, CountryListItem } from '../../../helpers/country.list';\r\nimport { StateList, StateListItem, DualStateZipcodeList } from '../../../helpers/state.list';\r\n\r\nimport { CreditCardHelper } from '../../../helpers/creditcard';\r\nimport { CreditCardTypes } from 'app/models/ss-api/responses/credit.card.response';\r\n\r\n\r\nfunction CustomCreditCardValidator(c: UntypedFormControl) {\r\n\r\n let cardType = CreditCardHelper.GetCardTypes(c.value);\r\n\r\n if (cardType == CreditCardTypes.Unknown || cardType == null) {\r\n return {\r\n CustomCreditCardValidator: {\r\n valid: false\r\n }\r\n }\r\n } else {\r\n return null;\r\n }\r\n\r\n}\r\n\r\n@Component({\r\n selector: 'app-order-form',\r\n templateUrl: './order-form-v3.component.html',\r\n styleUrls: ['./order-form-v3.component.scss'],\r\n providers: [DialogService]\r\n})\r\nexport class OrderFormComponentV3 implements OnInit, OnDestroy {\r\n\r\n // *********************************************************************************************************** //\r\n // orderFormVersion - Update this whenever a major change is made to form\r\n //\r\n // if updated, a corresponding order form component needs to be created and routed on the reports panel\r\n //\r\n //orderFormVersion ------- WE GET THIS FROM THE GLOBALS, IT IS IMPERATIVE THAT IT BE UPDATED!!! YOOOOUUUU HAAAAAVE BEEEEEN WAARRRRNEEDD!!!!\r\n // *********************************************************************************************************** //\r\n\r\n\r\n /* *******************************************\r\n order form link URLs:\r\n Vip3D Monthly -- https://members.structurestudios.com/order-form/product/0/1/1\r\n Vip3D Special -- https://members.structurestudios.com/order-form/product/VIP3D_-_Special1/1/1\r\n\r\n ******************************************** */\r\n IsBusy: boolean = true;\r\n\r\n isSpecial: boolean = false;\r\n isPromo: boolean = false;\r\n\r\n isCheckingMember: boolean = false;\r\n\r\n // products\r\n Products: PublicOrderProductsResponseArray;\r\n SelectedProduct: PublicOrderProductsResponse = new PublicOrderProductsResponse();\r\n SelectedBillingCycle: BillingRecurringTypes = BillingRecurringTypes.Monthly;\r\n SelectedPrice: number = 0;\r\n SelectedSetupFee: number = 0;\r\n ReferallInfo: any;\r\n ProductName: string = 'VIP3D';\r\n\r\n yardAddOnOption: boolean = false;\r\n yardAddOn: boolean = false;\r\n yardPrice: number = 0;\r\n yardSetup: number = 0;\r\n // ID's FROM ROUTE PARAMTERS\r\n routeParams: object;\r\n marketTag: string;\r\n\r\n\r\n trainingValue: string = \"2,375\";\r\n\r\n // Cart ID\r\n CartID: string;\r\n SkipUpdteCart: boolean = true; // for initial change detects like dropdowns\r\n LastUpdateCartRequest: UpdateCartRequest;\r\n\r\n // form\r\n OrderForm: UntypedFormGroup;\r\n\r\n orderFormSubmited: boolean = false;\r\n\r\n selectedCycle: number = 1;\r\n formProductClass: string;\r\n\r\n //Tax - Hard Code to TX\r\n /*\r\n TaxEnabled: boolean = true;\r\n TaxCalculated: boolean = true;\r\n State: string = \"TX\";\r\n TaxRateDisplay: string = \"8.25%\";\r\n TaxAmount: number = 14.25;\r\n TaxRate: number = 8.25;\r\n YardTax: number = 0;\r\n */\r\n\r\n //Tax - Emulate First Load\r\n /*\r\n TaxEnabled: boolean = true;\r\n TaxCalculated: boolean = false;\r\n State: string = \"\";\r\n TaxRateDisplay: string = \"\";\r\n TaxAmount: number = 0;\r\n YardTax: number = 0;\r\n */\r\n\r\n //Tax - Live\r\n TaxEnabled: boolean = false;\r\n TaxCalculated: boolean = false;\r\n State: string = \"\";\r\n TaxRateDisplay: string = \"\";\r\n TaxAmount: number = 0;\r\n YardTax: number = 0;\r\n TaxRate: number = 0;\r\n\r\n @ViewChild('orderForm') form;\r\n\r\n @ViewChild('EmailField') EmailField;\r\n @ViewChild('ccNumber') ccNumber;\r\n\r\n @ViewChild('phoneNumber') phoneNumber;\r\n\r\n today: Date = new Date();\r\n Year: number = new Date().getFullYear();\r\n YearRange: any[] = [];\r\n\r\n // CC Name Variables\r\n ccFirstName = '';\r\n ccLastName = '';\r\n ccardType: number;\r\n\r\n cardType: CreditCardTypes = CreditCardTypes.Unknown;\r\n\r\n ccardTypeClass: string;\r\n\r\n ExpirationChanged: boolean = false;\r\n\r\n // DATA SUBSCRIPTION VARIABLES\r\n paramsSubscribe: any;\r\n\r\n EdgeInterval;\r\n\r\n thisIsDev: boolean = false;\r\n\r\n showPassword: boolean;\r\n\r\n countryList: CountryListItem[] = CountryList.Countries();\r\n stateList: StateListItem[] = StateList.States();\r\n\r\n isShowLoginAlert: boolean;\r\n isStickySummary: boolean;\r\n\r\n recurringOptions = [\r\n { name: 'Monthly recurring', value: 1 },\r\n { name: 'Yearly recurring', value: 2 },\r\n ];\r\n selectedRecurring = this.recurringOptions[0].value;\r\n\r\n @HostListener('window:scroll', ['$event'])\r\n track(event: any) {\r\n let threshold = 520;\r\n if (window.innerWidth >= 1276) {\r\n threshold = 480;\r\n } else if (window.innerWidth >= 1092) {\r\n threshold = 550;\r\n } else if (window.innerWidth >= 984) {\r\n threshold = 420;\r\n } else if (window.innerWidth >= 855) {\r\n threshold = 470;\r\n }\r\n if (window.pageYOffset > threshold) {\r\n this.isStickySummary = true;\r\n } else {\r\n this.isStickySummary = false;\r\n }\r\n }\r\n\r\n constructor(public api: ssApiService,\r\n private route: ActivatedRoute,\r\n private router: Router,\r\n private dialogService: DialogService,\r\n private gb: GlobalServices,\r\n private titleService: Title,\r\n private dr: ChangeDetectorRef) {\r\n\r\n this.paramsSubscribe = this.route.params.subscribe(params => this.routeParams = params);\r\n\r\n }\r\n\r\n ngOnDestroy() {\r\n this.paramsSubscribe.unsubscribe();\r\n }\r\n\r\n ngOnInit() {\r\n\r\n if (window.navigator.platform.includes('Mac')) {\r\n Swal.fire({\r\n // type: 'warning',\r\n // title: 'Mac Not Supported',\r\n text: 'Please note the software is not compatible with Mac',\r\n confirmButtonText: 'I understand',\r\n allowOutsideClick: false\r\n }).then((confirm) => {\r\n\r\n }, (dismiss) => {\r\n window.history.back();\r\n });\r\n }\r\n\r\n // Set page title\r\n this.titleService.setTitle('Order Form');\r\n\r\n const usZipValidators = [\r\n Validators.required,\r\n Validators.minLength(5),\r\n ];\r\n\r\n // this.showCompleteOrderDialog();\r\n // initialize order form\r\n this.OrderForm = new UntypedFormGroup({\r\n firstName: new UntypedFormControl('', [Validators.required, Validators.minLength(2), Validators.pattern('[a-zA-Z ]*')]),\r\n lastName: new UntypedFormControl('', [Validators.required, Validators.minLength(2), Validators.pattern('[a-zA-Z ]*')]),\r\n company: new UntypedFormControl('', [Validators.required, Validators.minLength(2), Validators.pattern('.*[a-zA-Z].*')]),\r\n //'phone': new FormControl('', [Validators.required, Validators.minLength(10), Validators.pattern('^[0-9 \\+\\-\\]+$')]),\r\n phone: new UntypedFormControl('', [Validators.required, Validators.minLength(14)]),\r\n email: new UntypedFormControl('', [Validators.required, Validators.email]),\r\n // 'email1': new FormControl(\"\", [Validators.required, Validators.email]),\r\n password: new UntypedFormControl('', [Validators.required, Validators.minLength(5)]),\r\n password1: new UntypedFormControl('', [Validators.required, Validators.minLength(5)]),\r\n\r\n address1: new UntypedFormControl('', [Validators.required, Validators.minLength(5)]),\r\n city: new UntypedFormControl('', [Validators.required, Validators.minLength(3)]),\r\n state: new UntypedFormControl('NA', [Validators.required, Validators.minLength(2)]),\r\n statepicker: new UntypedFormControl('', [Validators.required]),\r\n zipCode: new UntypedFormControl('', usZipValidators),\r\n country: new UntypedFormControl('US', [Validators.required]),\r\n ccNameOnCard: new UntypedFormControl('', [Validators.required]),\r\n\r\n //ccNr: new FormControl('', [CreditCardValidator.validateCCNumber]), //creditCard: new FormControl('', [CreditCardValidator.validateCCNumber]),\r\n ccNr: new UntypedFormControl('', [CreditCardValidators.validateCCNumber, Validators.required, CustomCreditCardValidator]),\r\n\r\n ccExpMonth: new UntypedFormControl(this.ThisMonth(), [Validators.required]),\r\n ccExpYear: new UntypedFormControl(this.Year, [Validators.required]),\r\n ccCVC: new UntypedFormControl('', [Validators.required, Validators.minLength(3), Validators.maxLength(4), Validators.pattern('^[0-9]+$')]),\r\n yardAddOn: new UntypedFormControl(''),\r\n confirmInitials: new UntypedFormControl('', [Validators.required, Validators.minLength(2)]),\r\n });\r\n\r\n this.OrderForm.controls.country.valueChanges.subscribe(newCountry => {\r\n if (newCountry == \"US\") {\r\n console.log(\"GO USA\");\r\n // this.OrderForm.get('state').setValue(\"NA\");\r\n // this.OrderForm.get('statepicker').setValue(\"\"); \r\n this.OrderForm.controls.zipCode.setValidators(usZipValidators);\r\n } else {\r\n console.log(\"GO \" + newCountry + \"?\");\r\n // this.OrderForm.get('state').setValue(\"\");\r\n // this.OrderForm.get('statepicker').setValue(\"NV\"); \r\n this.OrderForm.controls.zipCode.setValidators([Validators.required, Validators.minLength(2), Validators.maxLength(10)]);\r\n }\r\n this.OrderForm.updateValueAndValidity();\r\n });\r\n\r\n this.OrderForm.controls.zipCode.valueChanges.subscribe((value) => {\r\n if (!this.IsUS()) {\r\n return;\r\n }\r\n // remove spaces\r\n let trimmed = value.replace(/\\s+/g, '');\r\n\r\n trimmed = trimmed.replace(/[^\\d]/g, \"\");\r\n\r\n if (trimmed.length > 5) {\r\n trimmed = trimmed.substr(0, 5);\r\n }\r\n\r\n if (value !== trimmed) {\r\n this.OrderForm.controls.zipCode.setValue(trimmed);\r\n }\r\n });\r\n\r\n this.OrderForm.controls.phone.valueChanges.subscribe((value) => {\r\n if (value !== this.getPhoneInputValue(value)) {\r\n this.OrderForm.controls.phone.setValue(\r\n this.getPhoneInputValue(value)\r\n );\r\n }\r\n });\r\n\r\n\r\n\r\n // SET UP YEAR RANGE FOR CREDIT CARD EXPIRATION DATE FIELD\r\n for (let i: number = 0; i < 20; i++) {\r\n this.YearRange.push(this.Year + i);\r\n }\r\n\r\n // assign product from routed parameters and refresh the public product list\r\n this.refreshProducts();\r\n\r\n // create CardID if not exist\r\n this.GetCartID();\r\n\r\n // SHOW COMPLETE ORDER DIALOG TEST -- mike\r\n // this.showCompleteOrderDialog(\"UFOID\");\r\n this.thisIsDev = this.api.isDev;\r\n\r\n let disposable = this.OrderForm.controls.ccNr.valueChanges.subscribe(val => {\r\n\r\n console.log(val);\r\n this.CheckCredtiCardType(val);\r\n\r\n });\r\n\r\n\r\n }\r\n\r\n\r\n\r\n CheckCredtiCardType(value: string) {\r\n\r\n console.log(\"Credit Card Value : \" + value);\r\n let cardType: CreditCardTypes = CreditCardHelper.GetCardTypes(value);\r\n this.cardType = cardType;\r\n console.log(this.cardType);\r\n let newCardType: string = cardType.toString().toLowerCase();\r\n\r\n this.ccardTypeClass = newCardType;\r\n\r\n }\r\n\r\n\r\n ThisMonth() {\r\n const month = new Date().getMonth() + 1;\r\n\r\n if (month < 10) {\r\n return '0' + month;\r\n } else {\r\n return month;\r\n }\r\n }\r\n\r\n matchedFieldChanged() {\r\n this.OrderForm.controls['password'].updateValueAndValidity();\r\n this.OrderForm.controls['password1'].updateValueAndValidity();\r\n\r\n // this.OrderForm.controls[\"email\"].updateValueAndValidity();\r\n // this.OrderForm.controls[\"email1\"].updateValueAndValidity();\r\n }\r\n\r\n GetCartID() {\r\n\r\n this.CartID = localStorage.getItem('cartID');\r\n\r\n if (this.CartID != undefined) {\r\n // console.log(\"CartID exist:\", this.CartID);\r\n return;\r\n }\r\n\r\n // console.log(\"New CartID:\", this.CartID);\r\n this.CartID = this.generateUUID();\r\n localStorage.setItem('cartID', this.CartID);\r\n }\r\n\r\n generateUUID() {\r\n let d = new Date().getTime();\r\n if (typeof performance !== 'undefined' && typeof performance.now === 'function') {\r\n d += performance.now();\r\n }\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n let r = (d + Math.random() * 16) % 16 | 0;\r\n d = Math.floor(d / 16);\r\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\r\n });\r\n }\r\n\r\n assignRouteParams(newParams: object) {\r\n // MAKE SURE NEWPARAMS IS DEFINED, IF NOT ASSIGN DEFAULT PRODUCT ID\r\n // console.log(newParams);\r\n if (this.isEmpty(newParams)) {\r\n this.SelectedProduct.ProductID = 0;\r\n // this.SelectedBillingCycle = 1;\r\n // console.log(\"newParams object was empty\");\r\n return;\r\n }\r\n\r\n // ASSIGN ACTIVATED ROUTE PARAMETERS\r\n let newProductID = Number(newParams['productID']);\r\n let newCycleID = Number(newParams['cycleID']);\r\n let newYardAddOn = Number(newParams['yardAddOn']);\r\n this.marketTag = String(newParams['marketTag']);\r\n // console.log(\"marketTag = \" + this.marketTag);\r\n // MAKE SURE NEW ID's FALLS INTO ACCEPTABLE RANGE\r\n if (newCycleID < 1)\r\n newCycleID = 1;\r\n\r\n\r\n // ASSIGN PRODUCT ID AND BILLING CYCLE ID \r\n this.SelectedProduct = this.Products.find(x => x.Name == this.ProductName);\r\n this.SelectedBillingCycle = newCycleID;\r\n\r\n // console.log(\"newYardAddOn = \" + newYardAddOn + \" ProductID = \" + this.SelectedProduct.ProductID);\r\n\r\n if (newYardAddOn == 0)\r\n this.yardAddOn = false;\r\n else\r\n this.yardAddOn = true;\r\n\r\n this.yardAddOnOption = this.YardAvailable(this.SelectedProduct);\r\n\r\n\r\n // console.log(\"newCycleID\", newCycleID, \" Selected Billing Cycle = \", this.SelectedBillingCycle);\r\n\r\n // ASSIGN MONTHYL/YEARLY SELECTION\r\n if (this.SelectedBillingCycle == 2) {\r\n this.selectedRecurring = this.recurringOptions[1].value;\r\n }\r\n\r\n\r\n }\r\n\r\n YardAvailable(product: PublicOrderProductsResponse) {\r\n\r\n if (product.YardAddon == null || product.YardAddon == undefined)\r\n return false;\r\n\r\n if (!product.YardVisiblePublic && (!this.gb.IsDevPublic() && !this.gb.IsLocal()))\r\n return false;\r\n\r\n // ok\r\n return true;\r\n }\r\n\r\n refreshProducts() {\r\n\r\n this.IsBusy = true;\r\n let subScription = this.api.ProductsPublicAndSpecialOrderProducts()\r\n .subscribe((response) => {\r\n console.log(\"prodresponse\", response);\r\n subScription.unsubscribe();\r\n\r\n if (response.Result)\r\n this.Products = response.Data;\r\n else\r\n this.Products = new PublicOrderProductsResponseArray();\r\n\r\n if (this.routeParams['productID'] != undefined) {\r\n if (this.routeParams['productID'] == '0') {\r\n this.ProductName = 'VIP3D';\r\n } else if (this.routeParams['productID'] == '1') {\r\n this.ProductName = 'Pool Studio';\r\n } else if (this.routeParams['productID'] == '2') {\r\n this.ProductName = 'VizTerra';\r\n } else {\r\n this.ProductName = this.routeParams['productID'].replace(/_/g, ' ');\r\n if (this.ProductName.toLowerCase().includes('special'))\r\n this.isSpecial = true;\r\n else if (this.ProductName.toLowerCase().includes(\"promo\"))\r\n this.isPromo = true;\r\n }\r\n }\r\n\r\n this.assignRouteParams(this.routeParams);\r\n\r\n this.TaxEnabled = this.SelectedProduct.TaxEnabled;\r\n if (this.SelectedProduct.ProductID == -1) {\r\n // No product Found\r\n console.log(\"NO PRODUCT!!!!\");\r\n console.log(\"t1\", this.SelectedProduct.Name);\r\n console.log(\"t2\", response.Data);\r\n\r\n this.ShowProductNotFoundDialog();\r\n } else {\r\n // Found a valid Product\r\n this.ProductChanged(this.SelectedProduct.ProductID);\r\n }\r\n\r\n\r\n if (this.SelectedProduct.Name.toLowerCase().includes('vip3d')) {\r\n this.trainingValue = '2,425';\r\n } else if (this.SelectedProduct.Name.toLowerCase().includes(\"vizterra\")) {\r\n this.trainingValue = '2,090';\r\n }\r\n\r\n\r\n // this.IsBusy = false;\r\n },\r\n (error: any) => {\r\n this.IsBusy = false;\r\n });\r\n\r\n }\r\n\r\n makePriceLookNice(thePrice: any): string {\r\n return thePrice.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\r\n }\r\n\r\n totalPrice(): number {\r\n let newTotal = this.SelectedPrice + this.SelectedSetupFee;\r\n if (this.yardAddOn)\r\n newTotal += this.yardPrice;\r\n return newTotal;\r\n }\r\n\r\n totalTaxDisplay(): string {\r\n let newTax = this.TaxAmount;\r\n\r\n if (newTax == 0 || (newTax * 100).toString().endsWith(\"00\")) {\r\n return newTax.toString();\r\n }\r\n else {\r\n return (Math.round(newTax * 100) / 100).toFixed(2);\r\n }\r\n }\r\n\r\n totalTax(): number {\r\n let newTax = this.TaxAmount;\r\n // if (this.yardAddOn)\r\n // newTax += this.YardTax;\r\n return newTax;\r\n }\r\n\r\n totalPriceWithTax(): string {\r\n let newTotalWithTax = this.SelectedPrice + this.SelectedSetupFee + this.totalTax();\r\n if (this.yardAddOn)\r\n newTotalWithTax += this.yardPrice;\r\n\r\n if ((newTotalWithTax * 100).toString().endsWith(\"00\")) {\r\n return newTotalWithTax.toString();\r\n }\r\n else {\r\n return (Math.round(newTotalWithTax * 100) / 100).toFixed(2);\r\n }\r\n }\r\n\r\n\r\n isEmpty(obj): boolean {\r\n for (let key in obj) {\r\n if (obj.hasOwnProperty(key))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n isValidExpiration() {\r\n let ccExpMonth = this.OrderForm.get('ccExpMonth').value;\r\n let ccExpYear = this.OrderForm.get('ccExpYear').value;\r\n\r\n if (moment(ccExpMonth + '/' + ccExpYear, 'MM/YYYY').isSameOrAfter(moment(moment().format('MM/YYYY'), 'MM/YYYY'))) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n onExpirationChange() {\r\n this.ExpirationChanged = true;\r\n this.UpdateCart();\r\n }\r\n\r\n isFormValid(): boolean {\r\n // isCompareValid( passwordRepeat.value, password.value ) == true && isCompareValid( email.value, email1.value ) == true && email.value != '' && password.value != ''\r\n let ccNameOnCard = this.OrderForm.get('ccNameOnCard').value;\r\n this.getNameOnCard(ccNameOnCard);\r\n let ccExpMonth = this.OrderForm.get('ccExpMonth').value;\r\n let ccExpYear = this.OrderForm.get('ccExpYear').value;\r\n\r\n if (this.ccLastName == '')\r\n return false;\r\n\r\n if (!this.OrderForm.valid)\r\n return false;\r\n\r\n if (!this.isValidExpiration())\r\n return false;\r\n\r\n if (this.orderFormSubmited)\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n hasLastName(): boolean {\r\n\r\n let ccNameOnCard = this.OrderForm.get('ccNameOnCard').value;\r\n this.getNameOnCard(ccNameOnCard);\r\n if (this.ccLastName == '')\r\n return false;\r\n\r\n return true;\r\n\r\n }\r\n\r\n\r\n\r\n CheckMember() {\r\n\r\n if (this.isCheckingMember) return;\r\n\r\n if (!this.OrderForm.controls['email'].valid) return;\r\n\r\n this.isCheckingMember = true;\r\n\r\n let email = this.OrderForm.controls['email'].value;\r\n\r\n let request: CheckForExistingMemberRequest = {\r\n Checksum: 'ADSFEWFF~!OMG1ITS5SNOWING3INVEGAS42!!!AND6ALL4FROZEN7DRINKS3ARE22HALF00OFF43IN65THE998CASINO',\r\n Email: email\r\n };\r\n\r\n\r\n let disposable = this.api.CheckForExistingMember(request).subscribe(response => {\r\n\r\n disposable.unsubscribe();\r\n\r\n this.isCheckingMember = false;\r\n\r\n let existingMemberResponse: CheckForExistingMemberResponse = response.Data;\r\n\r\n console.log('existingmemberresponse = ', existingMemberResponse);\r\n\r\n if (existingMemberResponse.PromptToLoginOnOrderForm) {\r\n\r\n localStorage.setItem('email', email);\r\n\r\n\r\n switch (existingMemberResponse.MemberType) {\r\n case 100:\r\n case 110: {\r\n // Active Member && Cancelled Member\r\n this.ShowLoginDialog();\r\n break;\r\n }\r\n case 200:\r\n case 210: {\r\n this.showLoginAlert();\r\n break;\r\n }\r\n }\r\n } else if (existingMemberResponse.PromptToFinishOrder && existingMemberResponse.UFOID) {\r\n this.dialogService.open(CompleteOrderDialogComponent, {\r\n data: {\r\n UFOID: existingMemberResponse.UFOID,\r\n fromLogin: false,\r\n }\r\n });\r\n this.OrderForm.controls['email'].setValue('');\r\n this.EmailField.nativeElement.focus();\r\n }\r\n\r\n });\r\n }\r\n\r\n showLoginAlert() {\r\n // window.scrollTo({ top: 0, behavior: 'smooth' });\r\n this.isShowLoginAlert = true;\r\n setTimeout(() => {\r\n const emptyEmailExistAlert: any = document.getElementsByClassName('empty-email-exist-alert')[0];\r\n const emailExistAlertText: any = document.getElementsByClassName('email-exist-alert--text')[0];\r\n emailExistAlertText.style.top = emptyEmailExistAlert.offsetTop - 16;\r\n emailExistAlertText.style.left = emptyEmailExistAlert.offsetLeft + 16;\r\n window.scrollTo(0, 0);\r\n });\r\n }\r\n\r\n ShowLoginDialog() {\r\n this.dialogService.open(LoginDialogComponent, {\r\n data: {\r\n IsWelcomeBack: true,\r\n ProductID: this.SelectedProduct.ProductID,\r\n BillingCycle: this.SelectedBillingCycle,\r\n HasYard: this.yardAddOn\r\n },\r\n position: 'top'\r\n });\r\n this.OrderForm.controls['email'].setValue('');\r\n this.EmailField.nativeElement.focus();\r\n }\r\n\r\n BillingCycleChanged(billingCycleType: BillingRecurringTypes) {\r\n\r\n // set billing\r\n this.SelectedBillingCycle = billingCycleType;\r\n\r\n console.log(888888, this.selectedRecurring, this.SelectedProduct, billingCycleType)\r\n // set type based on new billing\r\n this.SelectedPrice = this.SelectedProduct\r\n .Prices\r\n .find(x => x.BillingCycle == billingCycleType)\r\n .Price;\r\n\r\n this.SelectedSetupFee = this.SelectedProduct\r\n .Prices\r\n .find(x => x.BillingCycle == billingCycleType)\r\n .Setup;\r\n\r\n if (this.yardAddOn && this.SelectedProduct.YardAddon != null) {\r\n this.yardPrice = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Price;\r\n this.yardSetup = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n this.YardTax = this.yardPrice * (this.TaxRate / 100);\r\n this.YardTax = this.YardTax * 100;\r\n this.YardTax = Math.round(this.YardTax);\r\n this.YardTax = this.YardTax / 100;\r\n } else {\r\n this.yardPrice = 0;\r\n this.yardSetup = 0;\r\n this.YardTax = 0;\r\n }\r\n this.UpdatePageTitle();\r\n if (!this.SkipUpdteCart)\r\n this.UpdateCart();\r\n }\r\n\r\n ProductChanged(productID: number) {\r\n\r\n // set product\r\n this.SelectedProduct = this.Products.find(x => x.ProductID == productID);\r\n console.log(9999000, this.SelectedProduct)\r\n this.SelectedSetupFee = this.SelectedProduct.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n\r\n if (this.YardAvailable(this.SelectedProduct)) {\r\n this.yardPrice = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Price;\r\n this.yardSetup = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n } else {\r\n this.yardPrice = 0;\r\n this.yardSetup = 0;\r\n }\r\n\r\n\r\n // set price based on new product\r\n this.BillingCycleChanged(this.SelectedBillingCycle);\r\n\r\n // console.log(\"Prodcut Name:\", this.SelectedProduct.Name);\r\n // console.log(\"Setup Fee:\", this.SelectedSetupFee);\r\n\r\n this.formProductClass = this.SelectedProduct.Name.replace(/\\s+/g, '');\r\n\r\n this.titleService.setTitle('Order Form | ' + this.SelectedProduct.Name);\r\n this.UpdatePageTitle();\r\n\r\n if (!this.SkipUpdteCart)\r\n this.UpdateCart();\r\n\r\n }\r\n\r\n UpdatePageTitle() {\r\n let cycleName = 'Monthly';\r\n if (this.SelectedBillingCycle == 2) {\r\n cycleName = 'Yearly';\r\n }\r\n //console.log(this.SelectedBillingCycle);\r\n this.titleService.setTitle(this.SelectedProduct.Name + ' Order Form - Review Your ' + cycleName + ' Membership Plan');\r\n }\r\n\r\n checkEmailValid(): boolean {\r\n\r\n let Email = this.OrderForm.get('email');\r\n // let Email1 = this.OrderForm.get('email1');\r\n\r\n // if (!Email.touched || !Email.touched)\r\n // return false;\r\n\r\n // if (!Email.valid || !Email1.valid)\r\n // return false;\r\n\r\n // if (Email.value != Email1.value)\r\n // return false;\r\n\r\n return true;\r\n }\r\n\r\n isCompareValid(myField: string, compareField: string): boolean {\r\n return myField == compareField;\r\n }\r\n\r\n checkPasswordValid(): boolean {\r\n\r\n let Email = this.OrderForm.get('password');\r\n let Email1 = this.OrderForm.get('password1');\r\n\r\n if (!Email.touched || !Email.touched)\r\n return false;\r\n\r\n if (!Email.valid || !Email1.valid)\r\n return false;\r\n\r\n if (Email.value != Email1.value)\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n isFieldValid(fieldName: string): boolean {\r\n\r\n if (this.OrderForm.get(fieldName).value != '')\r\n return true;\r\n else\r\n return false;\r\n\r\n }\r\n\r\n StripNonNumeric(strValue: string): number {\r\n\r\n let value = strValue.replace(/[^\\d]/g, ''); // 1238\r\n\r\n if (value == '')\r\n return 0;\r\n else\r\n return value;\r\n\r\n }\r\n\r\n\r\n GetNewMemberRequest(): NewMemberRequest {\r\n\r\n\r\n\r\n // credit card names\r\n let ccNameOnCard = this.OrderForm.get('ccNameOnCard').value;\r\n this.getNameOnCard(ccNameOnCard);\r\n\r\n // credit card expiration month\r\n let ccExpMonth = this.OrderForm.get('ccExpMonth');\r\n if (ccExpMonth == undefined)\r\n throw RangeError('Credit Card Expiration Month Value Error');\r\n\r\n // credit card expiration year\r\n let ccExpYear = this.OrderForm.get('ccExpYear');\r\n if (ccExpYear == undefined)\r\n throw RangeError('Credit Card Expiration Year Value Error');\r\n\r\n // check email\r\n if (!this.checkEmailValid())\r\n throw Error('Invalid Email.');\r\n\r\n // check password\r\n if (!this.checkPasswordValid())\r\n throw Error('Invalid Password.');\r\n\r\n\r\n // prepare object to return\r\n let data = new NewMemberRequest();\r\n data.Checksum = \"33022hTllpOOO99#$%^ABlpse634!!dss66kfpEFes46^^sdd2\";\r\n data.OrderFormVersion = this.gb.OrderFormVersion;\r\n\r\n // - personal\r\n data.FirstName = this.OrderForm.get('firstName').value;\r\n data.LastName = this.OrderForm.get('lastName').value;\r\n data.Email = this.OrderForm.get('email').value;\r\n data.Company = this.OrderForm.get('company').value;\r\n data.Phone = this.OrderForm.get('phone').value.replace(/[^\\d]/g, \"\");\r\n data.Password = this.OrderForm.get('password').value;\r\n\r\n // - address\r\n data.Address1 = this.OrderForm.get('address1').value;\r\n data.City = this.OrderForm.get('city').value;\r\n data.Country = this.OrderForm.get('country').value;\r\n\r\n if (data.Country == \"US\") {\r\n data.State = this.OrderForm.get('statepicker').value;\r\n }\r\n else {\r\n data.State = this.OrderForm.get('state').value;\r\n }\r\n\r\n data.ZipCode = this.OrderForm.get('zipCode').value;\r\n\r\n // - credit card\r\n data.CC_FirstName = this.ccFirstName;\r\n data.CC_LastName = this.ccLastName;\r\n\r\n\r\n data.CC_Number = this.OrderForm.get('ccNr').value;\r\n\r\n this.CheckCredtiCardType(data.CC_Number);\r\n\r\n if (this.cardType == CreditCardTypes.Unknown) {\r\n throw Error('Unknown Credit Card Type');\r\n }\r\n\r\n data.CC_Number = this.StripNonNumeric(data.CC_Number).toString();\r\n\r\n if (data.CC_Number == '' ||\r\n data.CC_Number.length < 13)\r\n throw Error('Invalid Credit Card Number.');\r\n\r\n\r\n\r\n data.CC_ExpMonth = ccExpMonth.value;\r\n data.CC_ExpYear = ccExpYear.value - 2000;\r\n data.CC_CVC = this.OrderForm.get('ccCVC').value;\r\n data.CC_Address1 = data.Address1;\r\n data.CC_City = data.City;\r\n data.CC_Country = data.Country;\r\n data.CC_State = data.State;\r\n data.CC_ZipCode = data.ZipCode;\r\n\r\n // - product\r\n data.ProductID = this.SelectedProduct.ProductID;\r\n data.BillingCycle = this.SelectedBillingCycle;\r\n data.AddYard = this.yardAddOn;\r\n\r\n\r\n\r\n // - initals\r\n data.Initials = this.OrderForm.get('confirmInitials').value;\r\n\r\n // - redirect/referral\r\n let strRedirectID = localStorage.getItem('s_redirect_id');\r\n let RedirectCreated = localStorage.getItem('s_redirect_created');\r\n let RedirectID = 0;\r\n\r\n if (strRedirectID != undefined)\r\n RedirectID = parseInt(strRedirectID);\r\n\r\n if (RedirectID > 0) {\r\n data.RedirectID = RedirectID;\r\n data.DateTimeRedirectClick = new Date(RedirectCreated);\r\n }\r\n\r\n data.AssignToOwner = false;\r\n\r\n // console.log(\"Request Data: \", data);\r\n return data;\r\n }\r\n\r\n GetUpdateCartRequest(): UpdateCartRequest {\r\n\r\n // prepare object to return\r\n let data = new UpdateCartRequest();\r\n\r\n // cart\r\n data.CartID = this.CartID;\r\n\r\n // - personal\r\n data.FirstName = this.OrderForm.get('firstName').value;\r\n data.LastName = this.OrderForm.get('lastName').value;\r\n data.Email1 = this.OrderForm.get('email').value;\r\n // data.Email2 = this.OrderForm.get('email1').value;\r\n data.Company = this.OrderForm.get('company').value;\r\n data.Phone = this.gb.FormattedPhone(this.OrderForm.get('phone').value);\r\n\r\n // - address\r\n data.Address = this.OrderForm.get('address1').value;\r\n data.City = this.OrderForm.get('city').value;\r\n data.Country = this.OrderForm.get('country').value;\r\n\r\n if (data.Country == \"US\") {\r\n data.State = this.OrderForm.get('statepicker').value;\r\n }\r\n else {\r\n data.State = this.OrderForm.get('state').value;\r\n }\r\n\r\n data.ZipCode = this.OrderForm.get('zipCode').value;\r\n\r\n\r\n // - credit card\r\n data.CCName = this.OrderForm.get('ccNameOnCard').value;\r\n data.CCNumber = this.OrderForm.get('ccNr').value;\r\n data.CCLastFour = data.CCNumber.slice(data.CCNumber.length - 4);\r\n data.CCExpMonth = Number(this.OrderForm.get('ccExpMonth').value);\r\n data.CCExpYear = Number(this.OrderForm.get('ccExpYear').value) - 2000;\r\n\r\n // - product\r\n data.ProductID = this.SelectedProduct.ProductID;\r\n data.BillingCycle = this.SelectedBillingCycle;\r\n\r\n // - Initals\r\n data.Initials = this.OrderForm.get('confirmInitials').value;\r\n\r\n //taxes\r\n data.TaxChecksum = \"s53f4s56dfa4fs6ljsdhfasdlfAFDASKHflash5646asdf\";\r\n data.SubTotal = this.totalPrice();\r\n\r\n // - redirect/referral\r\n let strRedirectID = localStorage.getItem('s_redirect_id');\r\n let RedirectCreated = localStorage.getItem('s_redirect_created');\r\n let RedirectID = 0;\r\n\r\n if (strRedirectID != undefined)\r\n RedirectID = parseInt(strRedirectID);\r\n\r\n if (RedirectID > 0) {\r\n data.RedirectID = RedirectID;\r\n data.DateTimeRedirectClicked = new Date(RedirectCreated);\r\n }\r\n\r\n console.log(\"Request Cart Update Data: \", data);\r\n return data;\r\n }\r\n\r\n getNameOnCard(nameString: string) {\r\n\r\n this.ccFirstName = '';\r\n this.ccLastName = '';\r\n\r\n let namesSplit = nameString.split(' ');\r\n\r\n if (namesSplit.length == 0)\r\n return;\r\n\r\n let firstName = namesSplit[0];\r\n\r\n let lastName = '';\r\n\r\n if (namesSplit.length > 1) {\r\n for (let i = 1; i < namesSplit.length; i++) {\r\n if (i != 1)\r\n lastName += ' ';\r\n\r\n lastName += namesSplit[i];\r\n }\r\n }\r\n\r\n this.ccFirstName = firstName;\r\n this.ccLastName = lastName;\r\n\r\n }\r\n\r\n\r\n\r\n async onOrderFormSubmit() {\r\n\r\n // Check to see if our order form has been submitted and cancel the submit action\r\n if (this.orderFormSubmited) return;\r\n\r\n this.orderFormSubmited = true;\r\n\r\n this.IsBusy = true;\r\n // get data\r\n let data: NewMemberRequest;\r\n\r\n try {\r\n data = this.GetNewMemberRequest();\r\n } catch (e) {\r\n // console.log(\"error:\", e);\r\n xToastr.ShowToast(ToastrTypes.Error, 'Validation Errors', e);\r\n this.IsBusy = false;\r\n return;\r\n }\r\n\r\n console.log(\"request data\", data);\r\n\r\n //if( 0 == 0 ) return;\r\n\r\n let request = this.api.MemberNew(data)\r\n .subscribe(response => {\r\n // console.log(\"response received\");\r\n // console.log(response)\r\n\r\n\r\n if (!response.Result)\r\n switch (response.ErrCode) {\r\n case '0':\r\n // user exists\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'An error has occurred. Please verify the information and try again.');\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '1':\r\n // Error Creating Member\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Unkown Error', 'New user could not be created.');\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '2':\r\n // payment\r\n // unfinished order\r\n this.showCompleteOrderDialog(response.Message);\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '3':\r\n // member exists but we couldn't authenticate or something else went wrong\r\n localStorage.setItem('WelcomeBack', '1');\r\n this.router.navigate(['/authentication/signin/welcome-back']);\r\n return;\r\n\r\n case '17':\r\n let options = {\r\n closeButton: true,\r\n progressBar: true,\r\n debug: true,\r\n preventDuplicates: true,\r\n positionClass: 'toast-top-center',\r\n onclick: null,\r\n showDuration: 400,\r\n hideDuration: 1000,\r\n timeOut: 30000,\r\n extendedTimeOut: 1000,\r\n showEasing: 'swing',\r\n hideEasing: 'linear',\r\n showMethod: 'fadeIn',\r\n hideMethod: 'fadeOut'\r\n };\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'This email is linked to a cancelled membership. Please provide a new email address to create a new membership. If you would like to reactivate, contact your account owner or call us at 702-433-0274.', options);\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '19':\r\n case '20':\r\n // user exists\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'A member already exists with this email. Please log in or use a different email address.');\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '6000':\r\n // credit card zip code error\r\n xToastr.ShowToast(ToastrTypes.Error, 'Zip Code Invalid', response.Message);\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '6001':\r\n // credit card cvv error\r\n xToastr.ShowToast(ToastrTypes.Error, 'Address Invalid', response.Message);\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '6002':\r\n // credit card cvv error\r\n xToastr.ShowToast(ToastrTypes.Error, 'Security Code Invalid', response.Message);\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n case '6003':\r\n // credit card cvv error\r\n xToastr.ShowToast(ToastrTypes.Error, 'Credit Card Error', response.Message);\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n\r\n default:\r\n // user exists\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'Error processing request. Your Card has been declined.');\r\n this.IsBusy = false;\r\n this.orderFormSubmited = false;\r\n return;\r\n }\r\n\r\n\r\n\r\n // ok\r\n\r\n // window.location.href = \"https://www.structurestudios.com/thank-you\";\r\n // console.log(response);\r\n // console.log(response.Data);\r\n\r\n // we are authenticated\r\n let Response: NewMemberResponse = response.Data;\r\n\r\n if (Response.Reactivated && Response.ReturningMember) {\r\n // we were able to reactivate this member\r\n // redirect to welcome back page or dashboard\r\n // we are authenticated\r\n this.gb.SetGlobalsFromLoginResponse(Response.LoginResponse);\r\n // HERE MIKE\r\n localStorage.setItem('WelcomeBack', '1');\r\n this.router.navigate(['account/product-memberships']);\r\n return;\r\n } else if (!Response.Reactivated && Response.ReturningMember) {\r\n // we are a returning member and we couldn't reactivate.\r\n // redirect to welcome back or tell the member that the email already exists\r\n // HERE MIKE\r\n localStorage.setItem('WelcomeBack', '1');\r\n this.router.navigate(['/authentication/signin/welcome-back']);\r\n return;\r\n } else {\r\n // we are a new member\r\n this.gb.SetGlobalsFromLoginResponse(Response.LoginResponse);\r\n this.openThankyouModal();\r\n\r\n }\r\n\r\n\r\n\r\n\r\n },\r\n\r\n (error: HttpError) => {\r\n\r\n // this.ResetSigninFormSubmitRequest(request);\r\n this.orderFormSubmited = false;\r\n this.IsBusy = false;\r\n xToastr.ShowToast(ToastrTypes.Error, error.FriendlyTitle, error.FriendlyMessage);\r\n\r\n }\r\n );\r\n\r\n }\r\n\r\n logoLoaded() {\r\n // console.log(\"IsBusy on the logoLoaded method = \" + this.IsBusy);\r\n this.IsBusy = false;\r\n }\r\n\r\n UpdateCart() {\r\n if (this.isCheckingMember) return;\r\n\r\n this.SkipUpdteCart = false;\r\n\r\n let data = this.GetUpdateCartRequest();\r\n\r\n if (!this.CheckUpdateCart(data))\r\n return;\r\n\r\n this.LastUpdateCartRequest = data;\r\n\r\n let subscription = this.api.SalesUpdateCart(data)\r\n .subscribe(\r\n (result) => {\r\n console.log(\"datarec\");\r\n console.log(result.Data);\r\n console.log(\"dataend\");\r\n this.TaxAmount = result.Data.TaxAmount;\r\n this.TaxEnabled = result.Data.TaxEnabled;\r\n this.TaxRateDisplay = result.Data.TaxRateDisplay;\r\n this.TaxCalculated = result.Data.TaxCalculated;\r\n if (this.IsUS()) {\r\n if (this.TaxCalculated) {\r\n this.OrderForm.controls.zipCode.setErrors(null);\r\n } else {\r\n this.OrderForm.controls.zipCode.setErrors({\r\n invalid: true\r\n });\r\n }\r\n }\r\n this.OrderForm.updateValueAndValidity();\r\n this.TaxRate = result.Data.TaxRate;\r\n subscription.unsubscribe();\r\n this.updateState(result.Data.State);\r\n },\r\n (error) => {\r\n subscription.unsubscribe();\r\n }\r\n );\r\n\r\n }\r\n\r\n updateState(state) {\r\n const curState = this.orderFormControls.statepicker.value || this.orderFormControls.state.value;\r\n const curZipCode = this.orderFormControls.zipCode.value;\r\n const dualStates = DualStateZipcodeList[curZipCode] || [];\r\n if (!dualStates.includes(curState)) {\r\n this.State = state;\r\n this.OrderForm.get('statepicker').setValue(this.State);\r\n this.OrderForm.get('state').setValue(this.State);\r\n this.OrderForm.updateValueAndValidity();\r\n }\r\n }\r\n\r\n CheckUpdateCart(newCartData: UpdateCartRequest): boolean {\r\n\r\n if (this.LastUpdateCartRequest == undefined)\r\n return true;\r\n\r\n if (newCartData.ProductID != this.LastUpdateCartRequest.ProductID)\r\n return true;\r\n\r\n if (newCartData.BillingCycle != this.LastUpdateCartRequest.BillingCycle)\r\n return true;\r\n\r\n if (newCartData.FirstName != this.LastUpdateCartRequest.FirstName)\r\n return true;\r\n\r\n if (newCartData.LastName != this.LastUpdateCartRequest.LastName)\r\n return true;\r\n\r\n if (newCartData.Initials != this.LastUpdateCartRequest.Initials)\r\n return true;\r\n\r\n if (newCartData.Address != this.LastUpdateCartRequest.Address)\r\n return true;\r\n\r\n if (newCartData.City != this.LastUpdateCartRequest.City)\r\n return true;\r\n\r\n if (newCartData.ZipCode != this.LastUpdateCartRequest.ZipCode)\r\n return true;\r\n\r\n if (newCartData.State != this.LastUpdateCartRequest.State)\r\n return true;\r\n\r\n if (newCartData.Country != this.LastUpdateCartRequest.Country)\r\n return true;\r\n\r\n if (newCartData.CCName != this.LastUpdateCartRequest.CCName)\r\n return true;\r\n\r\n if (newCartData.Company != this.LastUpdateCartRequest.Company)\r\n return true;\r\n\r\n // if (newCartData.Email1 != this.LastUpdateCartRequest.Email1)\r\n // return true;\r\n\r\n if (newCartData.Email2 != this.LastUpdateCartRequest.Email2)\r\n return true;\r\n\r\n if (newCartData.Phone != this.LastUpdateCartRequest.Phone)\r\n return true;\r\n\r\n if (newCartData.CCExpMonth != this.LastUpdateCartRequest.CCExpMonth)\r\n return true;\r\n\r\n if (newCartData.CCExpYear != this.LastUpdateCartRequest.CCExpYear)\r\n return true;\r\n\r\n if (newCartData.CCNumber != this.LastUpdateCartRequest.CCNumber)\r\n return true;\r\n\r\n if (newCartData.CCLastFour != this.LastUpdateCartRequest.CCLastFour)\r\n return true;\r\n\r\n }\r\n\r\n // ///////////////////////////////////////\r\n // SHOW COMPLETE ORDER FORM DIALOG\r\n // ///////////////////////////////////////\r\n showCompleteOrderDialog(ufoid: string) {\r\n\r\n // this.IsBusy = true;\r\n\r\n this.dialogService.open(CompleteOrderDialogComponent, {\r\n data: {\r\n UFOID: ufoid,\r\n fromLogin: false,\r\n }\r\n });\r\n\r\n }\r\n\r\n openThankyouModal() {\r\n this.router.navigate(['account'], {\r\n state: {\r\n showThankyouModal: true\r\n }\r\n });\r\n }\r\n\r\n getRedirectURL(): string {\r\n let membershipName = this.SelectedProduct.Name.toString().toLowerCase();\r\n membershipName = membershipName.replace(/\\s+/g, '');\r\n let billingCycle = 'monthly';\r\n\r\n // console.log(\"this.selectedCycle: \" + this.SelectedBillingCycle)\r\n\r\n if (this.SelectedBillingCycle == 2)\r\n billingCycle = 'yearly';\r\n\r\n return 'order-form/thank-you/' + membershipName + '-' + billingCycle;\r\n }\r\n\r\n GotoThankYouPage() {\r\n this.openThankyouModal();\r\n }\r\n\r\n yardAddOnCheckChanged(yardAddOn: boolean) {\r\n // console.log(\"yardAddOn now = \" + this.yardAddOn);\r\n // console.log(e.target.checked);\r\n\r\n this.yardAddOn = yardAddOn;\r\n this.BillingCycleChanged(this.SelectedBillingCycle);\r\n\r\n }\r\n\r\n isVipName(Name: string): boolean {\r\n if (Name != undefined)\r\n return Name.toLowerCase().includes('vip3d');\r\n else\r\n return false;\r\n }\r\n\r\n isVizterraName(Name: string): boolean {\r\n if (Name != undefined)\r\n return Name.toLowerCase().includes('vizterra');\r\n else\r\n return false;\r\n }\r\n\r\n isPoolStudioName(Name: string): boolean {\r\n if (Name != undefined)\r\n return Name.toLowerCase().includes('pool studio');\r\n else\r\n return false;\r\n }\r\n\r\n\r\n\r\n ShowProductNotFoundDialog() {\r\n\r\n var pricingURL: string = \"https://www.structurestudios.com/landscape-design-software-and-pool-design-software-pricing\";\r\n\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'We\\'re Sorry',\r\n text: 'The promotion is no longer available',\r\n showCloseButton: true,\r\n confirmButtonText: 'View our products',\r\n allowOutsideClick: false,\r\n }).then(() => {\r\n // this.router.navigate(['/'])\r\n window.open(pricingURL, '_self');\r\n }, () => {\r\n // this.router.navigate(['/'])\r\n window.open(pricingURL, '_self');\r\n });\r\n\r\n }\r\n\r\n IsUS(): boolean {\r\n return this.OrderForm.controls.country.value == 'US' ? true : false;\r\n }\r\n\r\n public getPhoneInputValue(v: string): string {\r\n\r\n\r\n // trim '-' dashes\r\n v = v.replace(/-/g, '');\r\n\r\n v = v.replace(/[^\\d]/g, \"\");\r\n\r\n // trim string to 15 characters\r\n if (v.length > 10) {\r\n if (v.length > 15) {\r\n v = v.substr(0, 15);\r\n }\r\n return ' +' + v;\r\n }\r\n\r\n\r\n // new array to hold sections of the License Key\r\n let numbers = [];\r\n\r\n // create set of characters from first 5 characters\r\n numbers.push(v.substr(0, 3));\r\n\r\n // try for next 5\r\n if (v.substr(3, 3) !== \"\")\r\n numbers.push(v.substr(3, 3));\r\n\r\n // and last set of 5\r\n if (v.substr(6, 10) != \"\")\r\n numbers.push(v.substr(6, 4));\r\n\r\n if (v.substr(10, 15) != \"\")\r\n numbers.push(v.substr(10, 5));\r\n\r\n // add '-' dashes back to formated string\r\n let newValue = numbers[0];\r\n\r\n //if( newValue.length == 3 ) {\r\n\r\n //}\r\n\r\n if (numbers.length > 1) {\r\n newValue = '(' + newValue + ') ';\r\n newValue += numbers[1];\r\n }\r\n\r\n\r\n if (numbers.length > 2)\r\n newValue += '-' + numbers[2];\r\n\r\n // if (numbers.length > 3 )\r\n // \tnewValue += '-' + numbers[3];\r\n\r\n return newValue;\r\n }\r\n\r\n get orderFormControls() { return this.OrderForm.controls; }\r\n\r\n getMonth(date: Date) {\r\n const month = date.getMonth() + 1;\r\n\r\n if (month < 10) {\r\n return '0' + month.toString();\r\n } else {\r\n return month.toString();\r\n }\r\n }\r\n\r\n // Start Google Place API\r\n getAddress(place: object) {\r\n // this.address = place['formatted_address'];\r\n // this.phone = this.getPhone(place);\r\n // this.formattedAddress = place['formatted_address'];\r\n // this.zone.run(() => this.formattedAddress = place['formatted_address']);\r\n const street = this.getStreet(place);\r\n const district = this.getDistrict(place);\r\n const city = this.getCity(place);\r\n const state = this.getStateShort(place);\r\n const postCode = this.getPostCode(place);\r\n const country = this.getCountryShort(place);\r\n // this.orderFormControls.street.patchValue(street);\r\n this.orderFormControls.address1.patchValue(street);\r\n this.orderFormControls.city.patchValue(city);\r\n this.orderFormControls.state.patchValue(state);\r\n this.orderFormControls.statepicker.patchValue(state);\r\n this.orderFormControls.zipCode.patchValue(postCode);\r\n this.orderFormControls.country.patchValue(country);\r\n setTimeout(() => {\r\n this.UpdateCart();\r\n });\r\n this.orderFormControls.city.markAsTouched();\r\n this.orderFormControls.state.markAsTouched();\r\n this.orderFormControls.statepicker.markAsTouched();\r\n this.orderFormControls.zipCode.markAsTouched();\r\n this.orderFormControls.country.markAsTouched();\r\n this.dr.detectChanges();\r\n }\r\n\r\n getAddrComponent(place, componentTemplate) {\r\n let result;\r\n\r\n for (let i = 0; i < place.address_components.length; i++) {\r\n const addressType = place.address_components[i].types[0];\r\n if (componentTemplate[addressType]) {\r\n result = place.address_components[i][componentTemplate[addressType]];\r\n return result;\r\n }\r\n }\r\n return;\r\n }\r\n\r\n getStreetNumber(place) {\r\n const COMPONENT_TEMPLATE = { street_number: 'short_name' },\r\n streetNumber = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return streetNumber;\r\n }\r\n\r\n getStreet(place) {\r\n const COMPONENT_TEMPLATE = { street_number: 'long_name' },\r\n streetNumber = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n const COMPONENT_TEMPLATE1 = { route: 'long_name' },\r\n route = this.getAddrComponent(place, COMPONENT_TEMPLATE1);\r\n const street = streetNumber ? (streetNumber + ' ' + route) : route;\r\n return street || place['formatted_address'];\r\n }\r\n\r\n getCity(place) {\r\n const COMPONENT_TEMPLATE = { locality: 'long_name' },\r\n city = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return city || '';\r\n }\r\n\r\n getState(place) {\r\n const COMPONENT_TEMPLATE = { administrative_area_level_1: 'long_name' },\r\n state = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return state || '';\r\n }\r\n\r\n getStateShort(place) {\r\n const COMPONENT_TEMPLATE = { administrative_area_level_1: 'short_name' },\r\n stateShort = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return stateShort || '';\r\n }\r\n\r\n getDistrict(place) {\r\n const COMPONENT_TEMPLATE = { administrative_area_level_2: 'short_name' },\r\n state = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return state || '';\r\n }\r\n\r\n getCountryShort(place) {\r\n const COMPONENT_TEMPLATE = { country: 'short_name' },\r\n countryShort = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return countryShort || '';\r\n }\r\n\r\n getCountry(place) {\r\n const COMPONENT_TEMPLATE = { country: 'long_name' },\r\n country = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return country || '';\r\n }\r\n\r\n getPostCode(place) {\r\n const COMPONENT_TEMPLATE = { postal_code: 'long_name' },\r\n postCode = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return postCode || '';\r\n }\r\n\r\n getPhone(place) {\r\n const COMPONENT_TEMPLATE = { formatted_phone_number: 'formatted_phone_number' },\r\n phone = this.getAddrComponent(place, COMPONENT_TEMPLATE);\r\n return phone || '';\r\n }\r\n // End Google Place API\r\n}\r\n\r\nexport function expDateValidators(c: UntypedFormControl) {\r\n const monthAndYear = /^(0[1-9]|1[0-2])\\/?([0-9]{4}|[0-9]{2})$/;\r\n\r\n return monthAndYear.test(c.value)\r\n ? null\r\n : {\r\n validateInput: {\r\n valid: false,\r\n },\r\n };\r\n}\r\n","import { CheckForExistingMemberRequest } from './../../../models/ss-api/requests/check.for.existing.member.request';\r\nimport { BillingRecurringTypes } from '../../../models/ss-api/price.billing.cycle';\r\nimport { HttpError } from '../../../models/errors/HttpError';\r\nimport { Component, OnInit, ViewChild, OnDestroy } from '@angular/core';\r\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\n\r\nimport * as moment from 'moment';\r\nimport Swal from 'sweetalert2';\r\nimport { xToastr, ToastrTypes } from 'app/shared/Toastr';\r\n\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { NewMemberRequest } from 'app/models/ss-api/requests/new.member.request';\r\nimport { PublicOrderProductsResponseArray, PublicOrderProductsResponse } from 'app/models/ss-api/responses/public.order.products.response';\r\nimport { UpdateCartRequest } from 'app/models/ss-api/requests/update.cart.request';\r\n\r\nimport { DialogService } from 'primeng/dynamicdialog';\r\nimport { CompleteOrderDialogComponent } from 'app/dialogs/complete-order/complete-order-dialog.component';\r\nimport { GlobalServices } from 'app/services/global.service';\r\nimport { NewMemberResponse } from '../../../models/ss-api/responses/new.member.response';\r\nimport { Title } from '@angular/platform-browser';\r\n\r\n\r\n@Component({\r\n selector: 'app-order-form',\r\n templateUrl: './order-form.component.html',\r\n styleUrls: ['./order-form.component.scss'],\r\n providers: [DialogService]\r\n})\r\nexport class OrderFormComponent implements OnInit, OnDestroy {\r\n\r\n /* *******************************************\r\n order form link URLs:\r\n Vip3D Monthly -- https://members.structurestudios.com/order-form/product/0/1/1\r\n Vip3D Special -- https://members.structurestudios.com/order-form/product/VIP3D_-_Special1/1/1\r\n\r\n ******************************************** */\r\n IsBusy: boolean = true;\r\n\r\n isSpecial: boolean = false;\r\n isPromo: boolean = false;\r\n\r\n // products\r\n Products: PublicOrderProductsResponseArray;\r\n SelectedProduct: PublicOrderProductsResponse = new PublicOrderProductsResponse();\r\n SelectedBillingCycle: BillingRecurringTypes = BillingRecurringTypes.Monthly;\r\n SelectedPrice: number = 0;\r\n SelectedSetupFee: number = 0;\r\n ReferallInfo: any;\r\n\r\n yardAddOnOption: boolean = false;\r\n yardAddOn: boolean = false;\r\n yardPrice: number = 0;\r\n yardSetup: number = 0;\r\n // ID's FROM ROUTE PARAMTERS\r\n routeParams: object;\r\n marketTag: string;\r\n\r\n // Cart ID\r\n CartID: string;\r\n SkipUpdteCart: boolean = true; // for initial change detects like dropdowns\r\n LastUpdateCartRequest: UpdateCartRequest;\r\n\r\n // form\r\n OrderForm: UntypedFormGroup;\r\n selectedCycle: number = 1;\r\n formProductClass: string;\r\n @ViewChild('billingCycleSelect') billingCycleSelect;\r\n\r\n Year: number = new Date().getFullYear();\r\n YearRange: any[] = [];\r\n // CC Name Variables\r\n ccFirstName = '';\r\n ccLastName = '';\r\n ExpirationChanged: boolean = false;\r\n\r\n // DATA SUBSCRIPTION VARIABLES\r\n paramsSubscribe: any;\r\n\r\n thisIsDev: boolean = false;\r\n\r\n constructor(public api: ssApiService,\r\n private route: ActivatedRoute,\r\n private router: Router,\r\n // private sweetAlertService: SweetAlertService,\r\n private dialogService: DialogService,\r\n private gb: GlobalServices,\r\n private titleService: Title) {\r\n\r\n this.paramsSubscribe = this.route.params.subscribe(params => this.routeParams = params);\r\n\r\n }\r\n\r\n ngOnDestroy() {\r\n this.paramsSubscribe.unsubscribe();\r\n }\r\n\r\n ngOnInit() {\r\n\r\n // Set page title\r\n this.titleService.setTitle('Order Form');\r\n\r\n // this.showCompleteOrderDialog();\r\n // initialize order form\r\n this.OrderForm = new UntypedFormGroup({\r\n 'firstName': new UntypedFormControl('', [Validators.required, Validators.minLength(3)]),\r\n 'lastName': new UntypedFormControl('', [Validators.required, Validators.minLength(3)]),\r\n 'company': new UntypedFormControl('', [Validators.required, Validators.minLength(3)]),\r\n 'phone': new UntypedFormControl('', [Validators.required, Validators.minLength(5), Validators.pattern('^[0-9 \\+\\-\\]+$')]),\r\n 'email': new UntypedFormControl('', [Validators.required, Validators.email]),\r\n 'email1': new UntypedFormControl('', [Validators.required, Validators.email]),\r\n 'password': new UntypedFormControl('', [Validators.required, Validators.minLength(5)]),\r\n 'password1': new UntypedFormControl('', [Validators.required, Validators.minLength(5)]),\r\n\r\n 'address1': new UntypedFormControl('', [Validators.required, Validators.minLength(5)]),\r\n 'city': new UntypedFormControl('', [Validators.required, Validators.minLength(3)]),\r\n 'state': new UntypedFormControl('', [Validators.required, Validators.minLength(2)]),\r\n 'zipCode': new UntypedFormControl('', [Validators.required, Validators.minLength(3)]),\r\n 'country': new UntypedFormControl('US', [Validators.required]),\r\n\r\n 'ccNameOnCard': new UntypedFormControl('', [Validators.required]),\r\n 'ccNr': new UntypedFormControl('', [Validators.required, Validators.maxLength(22), Validators.minLength(13), Validators.pattern('^[0-9 \\+\\-\\]+$')]),\r\n 'ccExpMonth': new UntypedFormControl('01', [Validators.required]),\r\n 'ccExpYear': new UntypedFormControl(this.Year, [Validators.required]),\r\n 'ccCVC': new UntypedFormControl('', [Validators.required, Validators.maxLength(5), Validators.pattern('^[0-9]+$')]),\r\n\r\n 'yardAddOn': new UntypedFormControl(''),\r\n\r\n 'confirmInitials': new UntypedFormControl('', [Validators.required]),\r\n });\r\n\r\n // SET UP YEAR RANGE FOR CREDIT CARD EXPIRATION DATE FIELD\r\n for (let i: number = 0; i < 15; i++) {\r\n this.YearRange.push(this.Year + i);\r\n }\r\n\r\n // assign product from routed parameters and refresh the public product list\r\n this.refreshProducts();\r\n\r\n // create CardID if not exist\r\n this.GetCartID();\r\n\r\n // SHOW COMPLETE ORDER DIALOG TEST -- mike\r\n // this.showCompleteOrderDialog(\"UFOID\");\r\n this.thisIsDev = this.api.isDev;\r\n }\r\n\r\n\r\n\r\n formatEmailAddress() {\r\n\r\n\r\n\r\n\r\n }\r\n\r\n\r\n matchedFieldChanged() {\r\n this.OrderForm.controls['password'].updateValueAndValidity();\r\n this.OrderForm.controls['password1'].updateValueAndValidity();\r\n\r\n this.OrderForm.controls['email'].updateValueAndValidity();\r\n this.OrderForm.controls['email1'].updateValueAndValidity();\r\n }\r\n\r\n GetCartID() {\r\n\r\n this.CartID = localStorage.getItem('cartID');\r\n\r\n if (this.CartID != undefined) {\r\n // console.log(\"CartID exist:\", this.CartID);\r\n return;\r\n }\r\n\r\n // console.log(\"New CartID:\", this.CartID);\r\n this.CartID = this.generateUUID();\r\n localStorage.setItem('cartID', this.CartID);\r\n }\r\n\r\n generateUUID() {\r\n let d = new Date().getTime();\r\n if (typeof performance !== 'undefined' && typeof performance.now === 'function') {\r\n d += performance.now();\r\n }\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n let r = (d + Math.random() * 16) % 16 | 0;\r\n d = Math.floor(d / 16);\r\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\r\n });\r\n }\r\n\r\n assignRouteParams(newParams: object) {\r\n // MAKE SURE NEWPARAMS IS DEFINED, IF NOT ASSIGN DEFAULT PRODUCT ID\r\n // console.log(newParams);\r\n if (this.isEmpty(newParams)) {\r\n this.SelectedProduct.ProductID = 0;\r\n // this.SelectedBillingCycle = 1;\r\n // console.log(\"newParams object was empty\");\r\n return;\r\n }\r\n\r\n // ASSIGN ACTIVATED ROUTE PARAMETERS\r\n let newProductID = Number(newParams['productID']);\r\n let newCycleID = Number(newParams['cycleID']);\r\n let newYardAddOn = Number(newParams['yardAddOn']);\r\n this.marketTag = String(newParams['marketTag']);\r\n // console.log(\"marketTag = \" + this.marketTag);\r\n // MAKE SURE NEW ID's FALLS INTO ACCEPTABLE RANGE\r\n if (newCycleID < 1)\r\n newCycleID = 1;\r\n\r\n\r\n\r\n // ASSIGN PRODUCT ID AND BILLING CYCLE ID\r\n this.SelectedProduct.ProductID = newProductID;\r\n this.SelectedBillingCycle = newCycleID;\r\n\r\n // console.log(\"newYardAddOn = \" + newYardAddOn + \" ProductID = \" + this.SelectedProduct.ProductID);\r\n\r\n if (newYardAddOn == 0 || this.SelectedProduct.ProductID != 0)\r\n this.yardAddOn = false;\r\n else\r\n this.yardAddOn = true;\r\n\r\n if (this.SelectedProduct.ProductID == 0)\r\n this.yardAddOnOption = true;\r\n\r\n // console.log(\"newCycleID\", newCycleID, \" Selected Billing Cycle = \", this.SelectedBillingCycle);\r\n\r\n // ASSIGN MONTHYL/YEARLY SELECTION\r\n if (this.SelectedBillingCycle == 2) {\r\n // this.billingCycleSelect.value = '2';\r\n let mySelect: any = document.getElementById('billingCycleSelect');\r\n mySelect.value = 2;\r\n }\r\n\r\n\r\n }\r\n\r\n refreshProducts() {\r\n\r\n this.IsBusy = true;\r\n let subScription = this.api.ProductsPublicAndSpecialOrderProducts()\r\n .subscribe((response) => {\r\n subScription.unsubscribe();\r\n // console.log(\"refreshProducts response: \", response);\r\n\r\n if (response.Result)\r\n this.Products = response.Data;\r\n else\r\n this.Products = new PublicOrderProductsResponseArray();\r\n\r\n let newProductName = 'VIP3D';\r\n\r\n if (this.routeParams['productID'] != undefined) {\r\n if (this.routeParams['productID'] == '0') {\r\n newProductName = 'VIP3D';\r\n } else if (this.routeParams['productID'] == '1') {\r\n newProductName = 'Pool Studio';\r\n } else if (this.routeParams['productID'] == '2') {\r\n newProductName = 'VizTerra';\r\n } else {\r\n newProductName = this.routeParams['productID'].replace(/_/g, ' ');\r\n if (newProductName.toLowerCase().includes('special'))\r\n this.isSpecial = true;\r\n else if (newProductName.toLowerCase().includes(\"promo\"))\r\n this.isPromo = true;\r\n // console.log( \"OOOOH! A special Product! Why Hello \" + newProductName );\r\n }\r\n }\r\n\r\n this.assignRouteParams(this.routeParams);\r\n // this.personService.getPersons().find(x => x.id == this.personId);\r\n this.ProductChanged(response.Data.find(x => x.Name == newProductName).ProductID); // debug\r\n\r\n // this.IsBusy = false;\r\n },\r\n (error: any) => {\r\n this.IsBusy = false;\r\n });\r\n\r\n // console.log(\"PRODUCT NAME = \" + this.SelectedProduct.Name);\r\n\r\n }\r\n\r\n makePriceLookNice(thePrice: any): string {\r\n return thePrice.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\r\n }\r\n\r\n totalPrice(): number {\r\n let newTotal = this.SelectedPrice + this.SelectedSetupFee;\r\n if (this.yardAddOn)\r\n newTotal += this.yardPrice;\r\n return newTotal;\r\n }\r\n\r\n isEmpty(obj): boolean {\r\n for (let key in obj) {\r\n if (obj.hasOwnProperty(key))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n isValidExpiration() {\r\n let ccExpMonth = this.OrderForm.get('ccExpMonth').value;\r\n let ccExpYear = this.OrderForm.get('ccExpYear').value;\r\n\r\n if (moment(ccExpMonth + '/' + ccExpYear, 'MM/YYYY').isSameOrAfter(moment(moment().format('MM/YYYY'), 'MM/YYYY'))) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n onExpirationChange() {\r\n this.ExpirationChanged = true;\r\n this.UpdateCart();\r\n }\r\n\r\n isFormValid(): boolean {\r\n // isCompareValid( passwordRepeat.value, password.value ) == true && isCompareValid( email.value, email1.value ) == true && email.value != '' && password.value != ''\r\n let ccNameOnCard = this.OrderForm.get('ccNameOnCard').value;\r\n this.getNameOnCard(ccNameOnCard);\r\n let ccExpMonth = this.OrderForm.get('ccExpMonth').value;\r\n let ccExpYear = this.OrderForm.get('ccExpYear').value;\r\n\r\n if (this.ccLastName == '')\r\n return false;\r\n\r\n if (!this.OrderForm.valid)\r\n return false;\r\n\r\n if (!this.isValidExpiration())\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n hasLastName(): boolean {\r\n\r\n let ccNameOnCard = this.OrderForm.get('ccNameOnCard').value;\r\n this.getNameOnCard(ccNameOnCard);\r\n if (this.ccLastName == '')\r\n return false;\r\n\r\n return true;\r\n\r\n }\r\n\r\n CheckMember() {\r\n let email = this.OrderForm.controls['email'].value;\r\n let request: CheckForExistingMemberRequest = {\r\n Checksum: 'ADSFEWFF~!OMG1ITS5SNOWING3INVEGAS42!!!AND6ALL4FROZEN7DRINKS3ARE22HALF00OFF43IN65THE998CASINO',\r\n Email: email\r\n };\r\n\r\n let disposable = this.api.CheckForExistingMember(request).subscribe(response => {\r\n if (response.Data.PromptToLoginOnOrderForm) {\r\n switch (response.Data.MemberType) {\r\n case 100:\r\n case 110: {\r\n // Active Member && Cancelled Member\r\n Swal.fire({\r\n icon: 'warning',\r\n title: 'Warning',\r\n text: 'It looks like you already have an account registered to this email address. You will be redirected to the login page where you can purchase a license.'\r\n }).then(() => {\r\n this.router.navigate(['/']);\r\n }, () => {\r\n this.router.navigate(['/']);\r\n });\r\n break;\r\n }\r\n case 200:\r\n case 210: {\r\n // Cancelled Designer && Active Designer\r\n Swal.fire({\r\n icon: 'warning',\r\n title: 'Warning',\r\n text: 'It looks like you already have a designer profile registered to this email address. Please use a different email address.'\r\n }).then(() => {\r\n this.router.navigate(['/']);\r\n }, () => {\r\n this.router.navigate(['/']);\r\n });\r\n break;\r\n }\r\n }\r\n }\r\n disposable.unsubscribe();\r\n });\r\n }\r\n\r\n\r\n BillingCycleChanged(billingCycleType: BillingRecurringTypes) {\r\n\r\n // set billing\r\n this.SelectedBillingCycle = billingCycleType;\r\n\r\n // set type based on new billing\r\n this.SelectedPrice = this.SelectedProduct\r\n .Prices\r\n .find(x => x.BillingCycle == billingCycleType)\r\n .Price;\r\n\r\n this.SelectedSetupFee = this.SelectedProduct\r\n .Prices\r\n .find(x => x.BillingCycle == billingCycleType)\r\n .Setup;\r\n\r\n if (this.yardAddOn && this.SelectedProduct.YardAddon != null) {\r\n this.yardPrice = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Price;\r\n this.yardSetup = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n } else {\r\n this.yardPrice = 0;\r\n this.yardSetup = 0;\r\n }\r\n\r\n if (!this.SkipUpdteCart)\r\n this.UpdateCart();\r\n }\r\n\r\n ProductChanged(productID: number) {\r\n\r\n // set product\r\n this.SelectedProduct = this.Products.find(x => x.ProductID == productID);\r\n this.SelectedSetupFee = this.SelectedProduct.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n\r\n if (this.yardAddOn && this.SelectedProduct.YardAddon != null) {\r\n this.yardPrice = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Price;\r\n this.yardSetup = this.SelectedProduct.YardAddon.Prices.find(x => x.BillingCycle == this.SelectedBillingCycle).Setup;\r\n } else {\r\n this.yardPrice = 0;\r\n this.yardSetup = 0;\r\n }\r\n\r\n\r\n // set price based on new product\r\n this.BillingCycleChanged(this.SelectedBillingCycle);\r\n\r\n // console.log(\"Prodcut Name:\", this.SelectedProduct.Name);\r\n // console.log(\"Setup Fee:\", this.SelectedSetupFee);\r\n\r\n this.formProductClass = this.SelectedProduct.Name.replace(/\\s+/g, '');\r\n\r\n this.titleService.setTitle('Order Form | ' + this.SelectedProduct.Name);\r\n\r\n if (!this.SkipUpdteCart)\r\n this.UpdateCart();\r\n\r\n }\r\n\r\n checkEmailValid(): boolean {\r\n\r\n let Email = this.OrderForm.get('email');\r\n let Email1 = this.OrderForm.get('email1');\r\n\r\n if (!Email.touched || !Email.touched)\r\n return false;\r\n\r\n if (!Email.valid || !Email1.valid)\r\n return false;\r\n\r\n if (Email.value != Email1.value)\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n isCompareValid(myField: string, compareField: string): boolean {\r\n return myField == compareField;\r\n }\r\n\r\n checkPasswordValid(): boolean {\r\n\r\n let Email = this.OrderForm.get('password');\r\n let Email1 = this.OrderForm.get('password1');\r\n\r\n if (!Email.touched || !Email.touched)\r\n return false;\r\n\r\n if (!Email.valid || !Email1.valid)\r\n return false;\r\n\r\n if (Email.value != Email1.value)\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n isFieldValid(fieldName: string): boolean {\r\n\r\n if (this.OrderForm.get(fieldName).value != '')\r\n return true;\r\n else\r\n return false;\r\n\r\n }\r\n\r\n StripNonNumeric(strValue: string): number {\r\n\r\n let value = strValue.replace(/[^\\d]/g, ''); // 1238\r\n\r\n if (value == '')\r\n return 0;\r\n else\r\n return value;\r\n\r\n }\r\n\r\n\r\n GetNewMemberRequest(): NewMemberRequest {\r\n\r\n // credit card names\r\n let ccNameOnCard = this.OrderForm.get('ccNameOnCard').value;\r\n this.getNameOnCard(ccNameOnCard);\r\n\r\n // credit card expiration month\r\n let ccExpMonth = this.OrderForm.get('ccExpMonth');\r\n if (ccExpMonth == undefined)\r\n throw RangeError('Credit Card Expiration Month Value Error');\r\n\r\n // credit card expiration year\r\n let ccExpYear = this.OrderForm.get('ccExpYear');\r\n if (ccExpYear == undefined)\r\n throw RangeError('Credit Card Expiration Year Value Error');\r\n\r\n // check email\r\n if (!this.checkEmailValid())\r\n throw Error('Invalid Email.');\r\n\r\n // check password\r\n if (!this.checkPasswordValid())\r\n throw Error('Invalid Password.');\r\n\r\n\r\n // prepare object to return\r\n let data = new NewMemberRequest();\r\n data.Checksum = \"33022hTllpOOO99#$%^ABlpse634!!dss66kfpEFes46^^sdd2\";\r\n \r\n // - personal\r\n data.FirstName = this.OrderForm.get('firstName').value;\r\n data.LastName = this.OrderForm.get('lastName').value;\r\n data.Email = this.OrderForm.get('email').value;\r\n data.Company = this.OrderForm.get('company').value;\r\n data.Phone = this.OrderForm.get('phone').value;\r\n data.Password = this.OrderForm.get('password').value;\r\n\r\n // - address\r\n data.Address1 = this.OrderForm.get('address1').value;\r\n data.City = this.OrderForm.get('city').value;\r\n data.State = this.OrderForm.get('state').value;\r\n data.ZipCode = this.OrderForm.get('zipCode').value;\r\n data.Country = this.OrderForm.get('country').value;\r\n\r\n // - credit card\r\n data.CC_FirstName = this.ccFirstName;\r\n data.CC_LastName = this.ccLastName;\r\n\r\n data.CC_Number = this.OrderForm.get('ccNr').value;\r\n data.CC_Number = this.StripNonNumeric(data.CC_Number).toString();\r\n\r\n if (data.CC_Number == '' ||\r\n data.CC_Number.length < 13)\r\n throw Error('Invalid Credit Card Number.');\r\n\r\n\r\n\r\n data.CC_ExpMonth = ccExpMonth.value;\r\n data.CC_ExpYear = ccExpYear.value - 2000;\r\n data.CC_CVC = this.OrderForm.get('ccCVC').value;\r\n data.CC_Address1 = data.Address1;\r\n data.CC_City = data.City;\r\n data.CC_Country = data.Country;\r\n data.CC_State = data.State;\r\n data.CC_ZipCode = data.ZipCode;\r\n\r\n // - product\r\n data.ProductID = this.SelectedProduct.ProductID;\r\n data.BillingCycle = this.SelectedBillingCycle;\r\n data.AddYard = this.yardAddOn;\r\n\r\n\r\n\r\n // - initals\r\n data.Initials = this.OrderForm.get('confirmInitials').value;\r\n\r\n // - redirect/referral\r\n let strRedirectID = localStorage.getItem('s_redirect_id');\r\n let RedirectCreated = localStorage.getItem('s_redirect_created');\r\n let RedirectID = 0;\r\n\r\n if (strRedirectID != undefined)\r\n RedirectID = parseInt(strRedirectID);\r\n\r\n if (RedirectID > 0) {\r\n data.RedirectID = RedirectID;\r\n data.DateTimeRedirectClick = new Date(RedirectCreated);\r\n }\r\n\r\n data.AssignToOwner = false;\r\n\r\n // console.log(\"Request Data: \", data);\r\n return data;\r\n }\r\n\r\n GetUpdateCartRequest(): UpdateCartRequest {\r\n\r\n // prepare object to return\r\n let data = new UpdateCartRequest();\r\n\r\n // cart\r\n data.CartID = this.CartID;\r\n\r\n // - personal\r\n data.FirstName = this.OrderForm.get('firstName').value;\r\n data.LastName = this.OrderForm.get('lastName').value;\r\n data.Email1 = this.OrderForm.get('email').value;\r\n data.Email2 = this.OrderForm.get('email1').value;\r\n data.Company = this.OrderForm.get('company').value;\r\n data.Phone = this.OrderForm.get('phone').value;\r\n\r\n // - address\r\n data.Address = this.OrderForm.get('address1').value;\r\n data.City = this.OrderForm.get('city').value;\r\n data.State = this.OrderForm.get('state').value;\r\n data.ZipCode = this.OrderForm.get('zipCode').value;\r\n data.Country = this.OrderForm.get('country').value;\r\n\r\n // - credit card\r\n data.CCName = this.OrderForm.get('ccNameOnCard').value;\r\n data.CCNumber = this.OrderForm.get('ccNr').value;\r\n data.CCLastFour = data.CCNumber.slice(data.CCNumber.length - 4);\r\n data.CCExpMonth = this.OrderForm.get('ccExpMonth').value\r\n data.CCExpYear = this.OrderForm.get('ccExpYear').value\r\n\r\n // - product\r\n data.ProductID = this.SelectedProduct.ProductID;\r\n data.BillingCycle = this.SelectedBillingCycle;\r\n\r\n // - Initals\r\n data.Initials = this.OrderForm.get('confirmInitials').value;\r\n\r\n // - redirect/referral\r\n let strRedirectID = localStorage.getItem('s_redirect_id');\r\n let RedirectCreated = localStorage.getItem('s_redirect_created');\r\n let RedirectID = 0;\r\n\r\n //taxes\r\n data.TaxChecksum = \"s53f4s56dfa4fs6ljsdhfasdlfAFDASKHflash5646asdf\";\r\n data.SubTotal = this.totalPrice();\r\n\r\n if (strRedirectID != undefined)\r\n RedirectID = parseInt(strRedirectID);\r\n\r\n if (RedirectID > 0) {\r\n data.RedirectID = RedirectID;\r\n data.DateTimeRedirectClicked = new Date(RedirectCreated);\r\n }\r\n\r\n console.log(\"Request Cart Update Data: \", data);\r\n return data;\r\n }\r\n\r\n getNameOnCard(nameString: string) {\r\n\r\n this.ccFirstName = '';\r\n this.ccLastName = '';\r\n\r\n let namesSplit = nameString.split(' ');\r\n\r\n if (namesSplit.length == 0)\r\n return;\r\n\r\n let firstName = namesSplit[0];\r\n\r\n let lastName = '';\r\n\r\n if (namesSplit.length > 1) {\r\n for (let i = 1; i < namesSplit.length; i++) {\r\n if (i != 1)\r\n lastName += ' ';\r\n\r\n lastName += namesSplit[i];\r\n }\r\n }\r\n\r\n this.ccFirstName = firstName;\r\n this.ccLastName = lastName;\r\n\r\n }\r\n\r\n async onOrderFormSubmit() {\r\n\r\n this.IsBusy = true;\r\n // get data\r\n let data: NewMemberRequest;\r\n\r\n try {\r\n data = this.GetNewMemberRequest();\r\n } catch (e) {\r\n // console.log(\"error:\", e);\r\n xToastr.ShowToast(ToastrTypes.Error, 'Validation Errors', e);\r\n this.IsBusy = false;\r\n return;\r\n }\r\n\r\n // console.log(\"request data\", data);\r\n\r\n let request = this.api.MemberNew(data)\r\n .subscribe(response => {\r\n // console.log(\"response received\");\r\n // console.log(response)\r\n\r\n\r\n if (!response.Result)\r\n\r\n switch (response.ErrCode) {\r\n case '0':\r\n // user exists\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'This user already exists.');\r\n this.IsBusy = false;\r\n return;\r\n\r\n case '2':\r\n // payment\r\n // unfinished order\r\n this.showCompleteOrderDialog(response.Message);\r\n this.IsBusy = false;\r\n return;\r\n\r\n case '3':\r\n // member exists but we couldn't authenticate or something else went wrong\r\n localStorage.setItem('WelcomeBack', '1');\r\n this.router.navigate(['/authentication/signin/welcome-back']);\r\n return;\r\n\r\n case '17':\r\n let options = {\r\n closeButton: true,\r\n progressBar: true,\r\n debug: true,\r\n preventDuplicates: true,\r\n positionClass: 'toast-top-center',\r\n onclick: null,\r\n showDuration: 400,\r\n hideDuration: 1000,\r\n timeOut: 30000,\r\n extendedTimeOut: 1000,\r\n showEasing: 'swing',\r\n hideEasing: 'linear',\r\n showMethod: 'fadeIn',\r\n hideMethod: 'fadeOut'\r\n };\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'This email is linked to a cancelled membership. Please provide a new email address to create a new membership. If you would like to reactivate, contact your account owner or call us at 702-433-0274.', options);\r\n this.IsBusy = false;\r\n return;\r\n\r\n default:\r\n // user exists\r\n // console.log(\"Error response\");\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', 'Error processing request. Your Card has been declined.');\r\n this.IsBusy = false;\r\n return;\r\n }\r\n\r\n\r\n\r\n // ok\r\n\r\n // window.location.href = \"https://www.structurestudios.com/thank-you\";\r\n\r\n // we are authenticated\r\n let Response: NewMemberResponse = response.Data;\r\n\r\n if (Response.Reactivated && Response.ReturningMember) {\r\n // we were able to reactivate this member\r\n // redirect to welcome back page or dashboard\r\n // we are authenticated\r\n this.gb.SetGlobalsFromLoginResponse(Response.LoginResponse);\r\n // HERE MIKE\r\n localStorage.setItem('WelcomeBack', '1');\r\n this.router.navigate(['account/product-memberships']);\r\n return;\r\n } else if (!Response.Reactivated && Response.ReturningMember) {\r\n // we are a returning member and we couldn't reactivate.\r\n // redirect to welcome back or tell the member that the email already exists\r\n // HERE MIKE\r\n localStorage.setItem('WelcomeBack', '1');\r\n this.router.navigate(['/authentication/signin/welcome-back']);\r\n return;\r\n } else {\r\n // we are a new member\r\n this.gb.SetGlobalsFromLoginResponse(Response.LoginResponse);\r\n window.location.href = this.getRedirectURL();\r\n\r\n }\r\n\r\n\r\n\r\n\r\n },\r\n\r\n (error: HttpError) => {\r\n\r\n // this.ResetSigninFormSubmitRequest(request);\r\n\r\n // console.log(\"error login form\");\r\n // console.log(data);\r\n this.IsBusy = false;\r\n xToastr.ShowToast(ToastrTypes.Error, error.FriendlyTitle, error.FriendlyMessage);\r\n\r\n }\r\n );\r\n\r\n }\r\n\r\n logoLoaded() {\r\n // console.log(\"IsBusy on the logoLoaded method = \" + this.IsBusy);\r\n this.IsBusy = false;\r\n }\r\n\r\n UpdateCart() {\r\n\r\n this.SkipUpdteCart = false;\r\n\r\n let data = this.GetUpdateCartRequest();\r\n\r\n if (!this.CheckUpdateCart(data))\r\n return;\r\n\r\n this.LastUpdateCartRequest = data;\r\n\r\n let subscription = this.api.SalesUpdateCart(data).subscribe(\r\n (data) => { subscription.unsubscribe(); },\r\n (error) => { });\r\n\r\n }\r\n\r\n CheckUpdateCart(newCartData: UpdateCartRequest): boolean {\r\n\r\n if (this.LastUpdateCartRequest == undefined)\r\n return true;\r\n\r\n if (newCartData.ProductID != this.LastUpdateCartRequest.ProductID)\r\n return true;\r\n\r\n if (newCartData.BillingCycle != this.LastUpdateCartRequest.BillingCycle)\r\n return true;\r\n\r\n if (newCartData.FirstName != this.LastUpdateCartRequest.FirstName)\r\n return true;\r\n\r\n if (newCartData.LastName != this.LastUpdateCartRequest.LastName)\r\n return true;\r\n\r\n if (newCartData.Initials != this.LastUpdateCartRequest.Initials)\r\n return true;\r\n\r\n if (newCartData.Address != this.LastUpdateCartRequest.Address)\r\n return true;\r\n\r\n if (newCartData.City != this.LastUpdateCartRequest.City)\r\n return true;\r\n\r\n if (newCartData.ZipCode != this.LastUpdateCartRequest.ZipCode)\r\n return true;\r\n\r\n if (newCartData.State != this.LastUpdateCartRequest.State)\r\n return true;\r\n\r\n if (newCartData.Country != this.LastUpdateCartRequest.Country)\r\n return true;\r\n\r\n if (newCartData.CCName != this.LastUpdateCartRequest.CCName)\r\n return true;\r\n\r\n if (newCartData.Company != this.LastUpdateCartRequest.Company)\r\n return true;\r\n\r\n if (newCartData.Email1 != this.LastUpdateCartRequest.Email1)\r\n return true;\r\n\r\n if (newCartData.Email2 != this.LastUpdateCartRequest.Email2)\r\n return true;\r\n\r\n if (newCartData.Phone != this.LastUpdateCartRequest.Phone)\r\n return true;\r\n\r\n if (newCartData.CCExpMonth != this.LastUpdateCartRequest.CCExpMonth)\r\n return true;\r\n\r\n if (newCartData.CCExpYear != this.LastUpdateCartRequest.CCExpYear)\r\n return true;\r\n\r\n if (newCartData.CCNumber != this.LastUpdateCartRequest.CCNumber)\r\n return true;\r\n\r\n if (newCartData.CCLastFour != this.LastUpdateCartRequest.CCLastFour)\r\n return true;\r\n }\r\n\r\n // ///////////////////////////////////////\r\n // SHOW COMPLETE ORDER FORM DIALOG\r\n // ///////////////////////////////////////\r\n showCompleteOrderDialog(ufoid: string) {\r\n\r\n // this.IsBusy = true;\r\n\r\n this.dialogService.open(CompleteOrderDialogComponent, {data: {\r\n UFOID: ufoid,\r\n fromLogin: false\r\n }});\r\n\r\n\r\n }\r\n\r\n\r\n getRedirectURL(): string {\r\n let membershipName = this.SelectedProduct.Name.toString().toLowerCase();\r\n membershipName = membershipName.replace(/\\s+/g, '');\r\n let billingCycle = 'monthly';\r\n\r\n // console.log(\"this.selectedCycle: \" + this.SelectedBillingCycle)\r\n\r\n if (this.SelectedBillingCycle == 2)\r\n billingCycle = 'yearly';\r\n\r\n return 'order-form/thank-you/' + membershipName + '-' + billingCycle;\r\n }\r\n\r\n GotoThankYouPage() {\r\n window.location.href = this.getRedirectURL();\r\n // console.log(\"Thank You URL: \", this.getRedirectURL() );\r\n }\r\n\r\n yardAddOnCheckChanged(e: any) {\r\n // console.log(\"yardAddOn now = \" + this.yardAddOn);\r\n // console.log(e.target.checked);\r\n\r\n this.yardAddOn = e.target.checked;\r\n this.BillingCycleChanged(this.SelectedBillingCycle);\r\n\r\n }\r\n\r\n isVipName(Name: string): boolean {\r\n if (Name != undefined)\r\n return Name.toLowerCase().includes('vip3d');\r\n else\r\n return false;\r\n }\r\n\r\n}\r\n","import { Component, OnDestroy } from '@angular/core';\r\nimport { ActivatedRoute } from '@angular/router';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\n\r\n\r\n@Component({\r\n selector: 'redirect',\r\n templateUrl: './redirect.html'\r\n})\r\nexport class Redirect implements OnDestroy {\r\n // DATA SUBSCRIPTION VARIABLES\r\n paramsSubscribe: any;\r\n\r\n constructor(private api: ssApiService, private route: ActivatedRoute) {\r\n\r\n this.paramsSubscribe = this.route.params.subscribe(params => {\r\n\r\n if (params != undefined)\r\n this.ProcessParameters(params);\r\n });\r\n\r\n }\r\n\r\n ngOnDestroy() {\r\n this.paramsSubscribe.unsubscribe();\r\n }\r\n\r\n ProcessParameters(params: object) {\r\n\r\n // get parameter\r\n let RedirectID = params['redirectID'];\r\n\r\n // check and save to local storage\r\n if (RedirectID != undefined)\r\n localStorage.setItem('s_redirect_id', RedirectID);\r\n else\r\n window.location.href = 'http://www.structurestudios.com';\r\n\r\n\r\n localStorage.setItem('s_redirect_created', new Date().toString());\r\n\r\n\r\n // get the data from server\r\n let subscribe = this.api.ReferralRedirect(RedirectID).subscribe(\r\n (redirect) => {\r\n subscribe.unsubscribe();\r\n\r\n if (redirect.Result)\r\n window.location.href = redirect.Data.ForwardUrl;\r\n else\r\n window.location.href = 'http://www.structurestudios.com';\r\n\r\n },\r\n (error) => {\r\n window.location.href = 'http://www.structurestudios.com';\r\n });\r\n\r\n }\r\n\r\n\r\n}\r\n","import { Component, OnInit, ViewEncapsulation, ViewChild, ElementRef, OnDestroy } from '@angular/core';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { DesignerInstructionsRequest } from '../../../models/ss-api/requests/designer.instructions.request';\r\nimport { GlobalServices } from 'app/services/global.service';\r\nimport { xToastr, ToastrTypes } from 'app/shared/Toastr';\r\nimport Swal from 'sweetalert2';\r\nimport { Title } from '@angular/platform-browser';\r\n\r\n@Component({\r\n selector: 'thank-you',\r\n templateUrl: './thank-you.component.html',\r\n styleUrls: ['./thank-you.component.scss'],\r\n})\r\nexport class ThankYouComponent implements OnInit, OnDestroy {\r\n\r\n IsBusy: boolean = true;\r\n\r\n chooseUser: boolean = true;\r\n designerKey: boolean = false;\r\n\r\n // DATA SUBSCRIPTION VARIABLES\r\n paramsSubscribe: any;\r\n marketTag: string = '';\r\n\r\n // key\r\n licenseKey: string = 'loading';\r\n firstName: string = '';\r\n\r\n // designer\r\n DesignerName: string;\r\n DesignerEmail: string;\r\n\r\n @ViewChild('emailField') emailField: ElementRef;\r\n\r\n constructor(private router: Router, private api: ssApiService, private route: ActivatedRoute, private gb: GlobalServices,\r\n private titleService: Title) {\r\n\r\n }\r\n\r\n ngOnInit(): void {\r\n this.GetFirstLicenseKey();\r\n this.firstName = this.gb.FirstName;\r\n this.titleService.setTitle('Structure Studios Account');\r\n }\r\n\r\n isVizterraName(): boolean {\r\n if(window.location.href.indexOf(\"vizterra\") > -1) {\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n } \r\n\r\n ngOnDestroy() {\r\n\r\n }\r\n\r\n\r\n private GetFirstLicenseKey() {\r\n\r\n this.IsBusy = true;\r\n\r\n let subscription = this.api.GetFirstLicenseKey().subscribe(\r\n (response) => {\r\n subscription.unsubscribe();\r\n //if (!response.Result) {\r\n // window.location.href = 'http://www.structurestudios.com';\r\n //}\r\n\r\n if (response.Result) {\r\n this.licenseKey = response.Data;\r\n }\r\n\r\n this.IsBusy = false;\r\n\r\n },\r\n (error) => {\r\n subscription.unsubscribe();\r\n this.IsBusy = false;\r\n });\r\n\r\n }\r\n\r\n SendEmail() {\r\n\r\n if (this.DesignerName == '' || this.DesignerName == undefined) {\r\n xToastr.ShowToast(ToastrTypes.Error, 'Form Incomplete', 'Please provide the Name of your designer in the form.');\r\n return;\r\n }\r\n\r\n if (!this.emailField.nativeElement.classList.contains('ng-valid')) {\r\n xToastr.ShowToast(ToastrTypes.Error, 'Invalid Email', 'Please provide a valid email address.');\r\n return;\r\n }\r\n\r\n this.IsBusy = true;\r\n\r\n let request = new DesignerInstructionsRequest();\r\n request.Email = this.DesignerEmail;\r\n request.Name = this.DesignerName;\r\n request.LicenseKey = this.licenseKey;\r\n\r\n let subscription = this.api.SendLicenseKeyInstructionsToDesignerEmail(request).subscribe(\r\n (response) => {\r\n\r\n subscription.unsubscribe();\r\n\r\n if (!response.Result) {\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error Sending Email', response.Message);\r\n this.IsBusy = false;\r\n return;\r\n }\r\n\r\n // show result\r\n Swal.fire(\r\n {\r\n title: 'Success',\r\n text: 'An email has been sent to ' + request.Name + ' at ' + request.Email,\r\n icon: 'success',\r\n showCancelButton: false,\r\n showConfirmButton: true,\r\n\r\n })\r\n .then(() => {\r\n return new Promise((resolve, reject) => {\r\n // this.router.navigate([\"Dashboard\"]);\r\n window.location.href = 'account';\r\n resolve('');\r\n });\r\n }, () => { }); // keep this line to prevent promise error;\r\n\r\n this.IsBusy = false;\r\n\r\n },\r\n (error) => {\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error Sending Email', error);\r\n this.IsBusy = false;\r\n });\r\n }\r\n\r\n isEmpty(obj): boolean {\r\n for (let key in obj) {\r\n if (obj.hasOwnProperty(key))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n chooseMe() {\r\n\r\n this.IsBusy = true;\r\n\r\n let subscription = this.api.LicenseAssigToLoggedinUser(this.licenseKey).subscribe(\r\n async (response) => {\r\n\r\n this.IsBusy = false;\r\n subscription.unsubscribe();\r\n\r\n if (!response.Result) {\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', response.Message);\r\n return;\r\n } else {\r\n this.setUserChosen();\r\n }\r\n\r\n },\r\n\r\n (error) => {\r\n this.IsBusy = false;\r\n xToastr.ShowToast(ToastrTypes.Error, 'Error', error);\r\n });\r\n\r\n }\r\n\r\n chooseDesigner() {\r\n this.designerKey = true;\r\n this.setUserChosen();\r\n }\r\n\r\n setUserChosen() {\r\n this.chooseUser = false;\r\n }\r\n\r\n switchDesignerKey() {\r\n this.designerKey = !this.designerKey;\r\n\t}\r\n\r\n}\r\n","import { BlankView } from '../views/blank/blank.view';\r\nimport { OrderFormView } from '../views/order-form/order-form.view';\r\nimport { NgModule } from '@angular/core';\r\nimport { Routes, RouterModule } from '@angular/router';\r\n\r\nimport { OrderFormComponent } from './components/order-form/order-form.component';\r\nimport { ThankYouComponent } from './components/thank-you/thank-you.component';\r\nimport { Redirect } from 'app/order/components/redirect/redirect';\r\nimport { OrderFormComponentV2 } from './components/order-form-v2/order-form-v2.component';\r\nimport { OrderFormComponentV3 } from './components/order-form-v3/order-form-v3.component';\r\n\r\nconst OrderRouting: Routes = [\r\n // login view\r\n {\r\n\r\n path: 'order-form', component: OrderFormView,\r\n children: [\r\n { path: 'product-old/:productID/:cycleID/:yardAddOn', component: OrderFormComponent },\r\n { path: 'product-old/:productID/:cycleID/:yardAddOn/:marketTag', component: OrderFormComponent },\r\n { path: 'product/:productID/:cycleID/:yardAddOn', component: OrderFormComponentV3 },\r\n { path: 'product/:productID/:cycleID/:yardAddOn/:marketTag', component: OrderFormComponentV3 },\r\n\r\n { path: 'thank-you', component: ThankYouComponent },\r\n { path: 'thank-you/:marketTag', component: ThankYouComponent },\r\n\r\n // { path: 'dashboard1', component: SupportDashboard1Component },\r\n\r\n // handle all other routes\r\n { path: '**', component: OrderFormComponentV3 }\r\n ]\r\n },\r\n\r\n // dashboard views\r\n {\r\n path: 'redirect', component: BlankView,\r\n children: [\r\n { path: ':redirectID', component: Redirect }\r\n ]\r\n },\r\n];\r\n\r\n\r\n@NgModule({\r\n imports: [RouterModule.forChild(OrderRouting)],\r\n exports: [RouterModule]\r\n})\r\nexport class OrderRoutingModule {\r\n\r\n}\r\n","import { AuthenticationModule } from './../authentication/authentication.module';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SharedAppModule } from '../app.module.shared';\r\nimport { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\n\r\nimport { OrderRoutingModule } from './order-routing.module';\r\nimport { OrderFormComponent } from './components/order-form/order-form.component';\r\nimport { Redirect } from 'app/order/components/redirect/redirect';\r\nimport { OrderFormComponentV2 } from './components/order-form-v2/order-form-v2.component';\r\nimport { OrderFormComponentV3 } from './components/order-form-v3/order-form-v3.component';\r\nimport { CreditCardDirectivesModule } from 'angular-cc-library';\r\n\r\n@NgModule({\r\n declarations: [\r\n OrderFormComponentV2,\r\n OrderFormComponentV3,\r\n OrderFormComponent,\r\n Redirect\r\n ],\r\n imports: [\r\n // AuthenticationModule,\r\n CommonModule,\r\n OrderRoutingModule,\r\n SharedAppModule,\r\n ReactiveFormsModule,\r\n FormsModule,\r\n CreditCardDirectivesModule\r\n ]\r\n\r\n})\r\nexport class OrderModule { }\r\n","import { DatePipe } from '@angular/common';\r\nimport { Pipe, PipeTransform } from '@angular/core';\r\n\r\n\r\n@Pipe({ name: 'addYearsToDate' })\r\nexport class AddYearsToDatePipe implements PipeTransform {\r\n\r\n transform(value: any, args: any[]): string {\r\n\r\n let datePipe = new DatePipe('en-US');\r\n\r\n let date: Date = new Date(value);\r\n let year: number = date.getFullYear();\r\n\r\n date.setFullYear(year + args[1]);\r\n\r\n return datePipe.transform(date, args[0]);\r\n\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n\r\n@Pipe({ name: 'capitalizeFirstLetter' })\r\nexport class CapitalizeFirstLetterPipe implements PipeTransform {\r\n\r\n transform(value: string): string {\r\n\r\n if (!value) {\r\n return '';\r\n }\r\n\r\n if (value.length == 1) {\r\n return value.charAt(0).toUpperCase();\r\n } else {\r\n return value.charAt(0).toUpperCase() + value.substr(1).toLowerCase();\r\n }\r\n\r\n }\r\n\r\n}\r\n","import { DatePipe } from '@angular/common';\r\nimport { Pipe, PipeTransform } from '@angular/core';\r\nimport { CreditCardTypes } from 'app/models/ss-api/responses/credit.card.response';\r\n\r\n\r\n@Pipe({ name: 'creditCardType' })\r\nexport class CreditCardTypePipe implements PipeTransform {\r\n\r\n transform(value: CreditCardTypes, args: any[]): string {\r\n\r\n switch ( value ) {\r\n case CreditCardTypes.AmericanExpress :\r\n return \"amex\";\r\n \r\n case CreditCardTypes.DinersClub :\r\n return \"diners\";\r\n \r\n case CreditCardTypes.Discover :\r\n return \"discover\";\r\n\r\n case CreditCardTypes.EnRoute :\r\n return \"enroute\";\r\n\r\n case CreditCardTypes.JCB :\r\n return \"jcb\";\r\n\r\n case CreditCardTypes.MasterCard :\r\n return \"mastercard\";\r\n\r\n case CreditCardTypes.VISA :\r\n return \"visa\";\r\n\r\n default :\r\n return \"unknown\";\r\n\r\n }\r\n\r\n\r\n\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n\r\n@Pipe({ name: 'daysRemaining' })\r\nexport class DaysRemainingPipe implements PipeTransform {\r\n\r\n transform(terminationDate: string): number {\r\n\r\n let daysRemaining: number = 0;\r\n let date1 = new Date();\r\n const tDate = new Date(terminationDate);\r\n\r\n let diffc = date1.getTime() - tDate.getTime();\r\n\r\n daysRemaining = Math.round(Math.abs(diffc / (1000 * 60 * 60 * 24)));\r\n\r\n return daysRemaining;\r\n\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\nimport { BillingRecurringTypes } from '../models/ss-api/responses/dashboard.license.response';\r\n\r\n\r\n@Pipe({ name: 'productNameWebSafe' })\r\nexport class ProductNameWebSafePipe implements PipeTransform {\r\n\r\n constructor(private _sanitizer: DomSanitizer) {\r\n }\r\n\r\n transform(productName: string): string {\r\n let returnName = '';\r\n\r\n switch (productName) {\r\n case 'VIP3D':\r\n case 'Vip3D':\r\n returnName = 'vip3d';\r\n break;\r\n\r\n case 'Pool Studio':\r\n returnName = 'poolstudio';\r\n break;\r\n\r\n case 'VizTerra':\r\n returnName = 'vizterra';\r\n break;\r\n\r\n default:\r\n returnName = 'vip3d';\r\n break;\r\n }\r\n\r\n return returnName;\r\n }\r\n\r\n}\r\n\r\n\r\n@Pipe({ name: 'productName' })\r\nexport class ProductNamePipe implements PipeTransform {\r\n\r\n constructor(private _sanitizer: DomSanitizer) {\r\n }\r\n\r\n transform(productName: string): string {\r\n let returnName = '';\r\n\r\n switch (productName) {\r\n case 'VIP3D':\r\n case 'Vip3D':\r\n returnName = 'Vip3D';\r\n break;\r\n\r\n case 'Pool Studio':\r\n returnName = 'Pool Studio';\r\n break;\r\n\r\n case 'VizTerra':\r\n returnName = 'VizTerra';\r\n break;\r\n\r\n default:\r\n returnName = 'Vip3D';\r\n break;\r\n }\r\n\r\n return returnName;\r\n }\r\n\r\n}\r\n\r\n\r\n@Pipe({ name: 'billingCycle' })\r\nexport class BillingCyclePipe implements PipeTransform {\r\n\r\n constructor(private _sanitizer: DomSanitizer) {\r\n }\r\n\r\n transform(Recurring: BillingRecurringTypes): string {\r\n let returnName = '';\r\n\r\n switch (Recurring) {\r\n case BillingRecurringTypes.Yearly:\r\n returnName = 'Yearly';\r\n break;\r\n\r\n case BillingRecurringTypes.Monthly:\r\n returnName = 'Monthly';\r\n break;\r\n\r\n default:\r\n returnName = 'Monthly';\r\n break;\r\n }\r\n\r\n return returnName;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'sanitizeHtml'\r\n})\r\nexport class SanitizeHtmlPipe implements PipeTransform {\r\n\r\n constructor(private _sanitizer: DomSanitizer) {\r\n }\r\n\r\n transform(html: string): SafeHtml {\r\n return this._sanitizer.bypassSecurityTrustHtml(html);\r\n }\r\n}\r\n","import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, Router } from '@angular/router';\r\nimport { Injectable } from '@angular/core';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { GlobalServices } from './global.service';\r\n\r\n\r\n@Injectable()\r\nexport class AuthGuardService implements CanActivate {\r\n\r\n\r\n constructor( private router: Router, private api: ssApiService, private gb: GlobalServices ) { }\r\n\r\n\r\n async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise {\r\n this.gb.ReadFromStorage();\r\n if ( this.gb.Token != undefined && this.gb.Token != '' && this.gb.TokenExpiration != undefined && this.gb.TokenExpiration > new Date() ) {\r\n return true;\r\n } else {\r\n localStorage.setItem('loginRedirect', state.url);\r\n this.router.navigate(['/authentication/signin']);\r\n }\r\n\r\n }\r\n\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { HttpError } from '../models/errors/HttpError';\r\nimport { IBaseResponse } from '../models/comm-http/responses/BaseResponse';\r\nimport { HttpResponse, HttpClient, HttpHeaders } from '@angular/common/http';\r\nimport { catchError, map, Observable, throwError } from 'rxjs';\r\nimport { KeyValuePair } from 'app/models/KeyValuePair';\r\nimport { Router } from '@angular/router';\r\n\r\n@Injectable()\r\nexport class CommHttpService {\r\n\r\n // router public because it is used in other classes\r\n constructor(private httpMain: HttpClient, private router: Router) {\r\n }\r\n\r\n private StatusCodeToFriendlyMessage(code: number, defaultValue: string = ''): string {\r\n\r\n switch (code) {\r\n\r\n case 401:\r\n return 'Wrong username or password!';\r\n\r\n default:\r\n return defaultValue;\r\n }\r\n\r\n }\r\n\r\n private ErrorToFriendlyMessage(response: HttpResponse): string {\r\n\r\n // check first error in header\r\n let headerKeys = response.headers.keys();\r\n\r\n // headers?\r\n if (!headerKeys) {\r\n // return from status\r\n return this.StatusCodeToFriendlyMessage(response.status, response.statusText);\r\n }\r\n\r\n // check from headers\r\n if (headerKeys.some(x => x === 'autherrorcode')) {\r\n let code = response.headers.get('autherrorcode');\r\n\r\n switch (code) {\r\n\r\n case '0':\r\n return response.headers.get('autherror');\r\n\r\n case '1':\r\n return 'Wrong Username or Password';\r\n\r\n default:\r\n // return from status\r\n return this.StatusCodeToFriendlyMessage(response.status, response.statusText);\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n\r\n private HandleError(error: HttpResponse): Observable {\r\n\r\n // let errorResponse: any;\r\n\r\n // if (error.status === 0)\r\n // errorResponse = new HttpNoConnectionError(error);\r\n\r\n // else if (error.status === 401)\r\n // errorResponse = new HttpUnauthorized(error);\r\n\r\n // else if (error.status === 403)\r\n // errorResponse = new HttpForbidden(error);\r\n\r\n // else if (error.status === 404)\r\n // errorResponse = new HttpNotFoundError(error);\r\n\r\n // else if (error.status === 400)\r\n // errorResponse = new BadRequest(error.json());\r\n\r\n // else\r\n let errorResponse = new HttpError(error);\r\n errorResponse.FriendlyTitle = 'Error';\r\n\r\n if (error.status == 0) {\r\n errorResponse.FriendlyTitle = 'Connection Error';\r\n errorResponse.FriendlyMessage = 'Unable to connect to server.';\r\n } else if (error.status == 401) {\r\n localStorage.clear();\r\n this.router.navigate(['/authentication/signin']);\r\n } else {\r\n errorResponse.FriendlyMessage = error.statusText;\r\n }\r\n\r\n\r\n return throwError(errorResponse);\r\n\r\n }\r\n\r\n protected Post(url: string, data: any, headers: HttpHeaders = null, withCredentials: boolean = true): Observable> {\r\n\r\n let reqHeaders: HttpHeaders = headers ? headers : new HttpHeaders();\r\n\r\n return this.httpMain.post(url, data, { headers: reqHeaders, withCredentials: withCredentials })\r\n .pipe(\r\n catchError(\r\n (error) => {\r\n\r\n // if ((error as Response).status == 401)\r\n // this.onAuthError.next(error.statusText);\r\n\r\n return this.HandleError(error);\r\n })\r\n );\r\n }\r\n\r\n protected PostRaw(url: string, data: any, headers: HttpHeaders = null, withCredentials: boolean = true): Observable {\r\n\r\n let reqHeaders: HttpHeaders = headers ? headers : new HttpHeaders();\r\n\r\n return this.httpMain.post(url, data, { headers: reqHeaders, withCredentials: withCredentials })\r\n .pipe(\r\n catchError(\r\n (error) => {\r\n\r\n // if ((error as Response).status == 401)\r\n // this.onAuthError.next(error.statusText);\r\n \r\n return this.HandleError(error);\r\n })\r\n );\r\n }\r\n\r\n\r\n protected Patch(url: string, data: any, headers: HttpHeaders = null): Observable> {\r\n\r\n let reqHeaders: HttpHeaders = headers ? headers : new HttpHeaders();\r\n\r\n return this.httpMain.patch(url, data, { headers: reqHeaders, withCredentials: true })\r\n .pipe(\r\n catchError(\r\n (error) => {\r\n\r\n // if ((error as Response).status == 401)\r\n // this.onAuthError.next(error.statusText);\r\n \r\n return this.HandleError(error);\r\n })\r\n );\r\n }\r\n\r\n\r\n protected Delete(url: string, headers: HttpHeaders = null): Observable> {\r\n\r\n let reqHeaders: HttpHeaders = headers ? headers : new HttpHeaders();\r\n let qData = '';\r\n\r\n\r\n return this.httpMain.delete(url, { headers: reqHeaders, withCredentials: true })\r\n .pipe(\r\n catchError(\r\n (error) => {\r\n\r\n // if ((error as Response).status == 401)\r\n // this.onAuthError.next(error.statusText);\r\n\r\n return this.HandleError(error);\r\n })\r\n );\r\n\r\n }\r\n\r\n protected GetCore(converter: any, url: string, queryData: KeyValuePair[] = null, headers: HttpHeaders = null): Observable> {\r\n\r\n let reqHeaders: HttpHeaders = headers ? headers : new HttpHeaders();\r\n let qData = '';\r\n\r\n if (queryData != null) {\r\n qData = '?';\r\n for (let item of queryData) {\r\n qData += item.Key + '=' + item.Value;\r\n }\r\n }\r\n\r\n return this.httpMain.get(url, { headers: reqHeaders, withCredentials: true })\r\n .pipe(\r\n map((response: HttpResponse) => {\r\n\r\n return converter(response);\r\n\r\n }),\r\n catchError((error) => {\r\n\r\n // if ((error as Response).status == 401)\r\n // this.onAuthError.next(error.statusText);\r\n\r\n return this.HandleError(error);\r\n })\r\n );\r\n\r\n }\r\n\r\n protected Get(url: string, queryData: KeyValuePair[] = null, headers: HttpHeaders = null): Observable> {\r\n\r\n // only properties\r\n\r\n let converter =\r\n function (response: HttpResponse) {\r\n return response;\r\n };\r\n\r\n return this.GetCore(converter, url, queryData, headers);\r\n }\r\n\r\n}\r\n","import { LoginResponse, MemberTypes } from '../models/ss-api/responses/login.response';\r\nimport { Injectable } from '@angular/core';\r\nimport { ssApiService } from 'app/services/ss-api.service';\r\nimport { DashboardProductsResponse } from 'app/models/ss-api/responses/dashboard.products.response';\r\nimport { environment } from 'environments/environment';\r\nimport { Title, Meta } from '@angular/platform-browser';\r\nimport { MemberBasicInfoResponse } from 'app/models/ss-api/responses/member.basic.info.response';\r\nimport { TrainingHistoryComponent } from 'app/account/components/training-history/training-history.component';\r\nimport { Subject } from 'rxjs';\r\nimport { IBaseResponse } from 'app/models/comm-http/responses/BaseResponse';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\n\r\n@Injectable()\r\nexport class GlobalServices {\r\n\r\n HttpTimeout: number = 20000;\r\n\r\n AdminID: number = 0;\r\n MemberID: number;\r\n Username: string;\r\n FirstName: string;\r\n LastName: string;\r\n Email: string;\r\n MemberType: MemberTypes;\r\n\r\n Token: string;\r\n TokenExpiration: Date;\r\n DateTimeLogin: Date;\r\n\r\n ServerDateTime: Date;\r\n\r\n MyProducts: DashboardProductsResponse;\r\n\r\n\tpublic MemberBasicInfo: MemberBasicInfoResponse = new MemberBasicInfoResponse();\r\n\r\n\tpublic hasValidAddress : boolean = false;\r\n\r\n // OrderFormVersion\r\n OrderFormVersion : string = 'v1-3'\r\n // When Updated you MUST update the report panel with a new order form tempalte for JPEG screenshots as well!!!\r\n\r\n \r\n // Dev variables from environment settings\r\n envName: string = environment.envName;\r\n isDevMode: boolean = false;\r\n ReportURL: string = environment.reportUrl;\r\n\r\n\tpublic onMemberProfileUpdated = new Subject>();\r\n\r\n constructor(private api: ssApiService, private titleService: Title, private meta : Meta, private router: Router ) {\r\n this.ReadFromStorage();\r\n this.SubscribeEvents();\r\n\r\n this.ReportURL = this.api.GetReportBotURL();\r\n this.isDevMode = this.api.isDev;\r\n\r\n this.meta.addTag({ name: 'description', content : 'Structure Studios Member site for managing accounts.' });\r\n\r\n console.log(router.url);\r\n if (!router.url.toLowerCase().startsWith(\"/order-form\"))\r\n {\r\n this.GetMemberInfo();\r\n }\t\t\r\n\r\n }\r\n\r\n public SetGlobalsFromLoginResponse(data: LoginResponse, skipToken: boolean = false) {\r\n\r\n this.MemberID = data.MemberID;\r\n this.DateTimeLogin = new Date();\r\n\r\n this.ServerDateTime = new Date();\r\n\r\n this.Email = data.Email;\r\n this.Username = data.Username;\r\n this.FirstName = data.FirstName;\r\n this.LastName = data.LastName;\r\n this.Token = data.Token;\r\n this.TokenExpiration = data.TokenExpiration;\r\n this.MemberType = data.MemberType;\r\n\r\n localStorage.setItem('MemberID', data.MemberID.toString());\r\n localStorage.setItem('DateTimeLogin', new Date().toString());\r\n localStorage.setItem('Email', data.Email);\r\n localStorage.setItem('Username', data.Username);\r\n localStorage.setItem('FirstName', data.FirstName);\r\n localStorage.setItem('LastName', data.LastName);\r\n localStorage.setItem('MemberType', data.MemberType.toString());\r\n\r\n localStorage.setItem('email', data.Username);\r\n localStorage.setItem('token_expiration', data.TokenExpiration.toString());\r\n\r\n // skip token?\r\n // we skip token when we come from login as member from admin\r\n if (!skipToken)\r\n localStorage.setItem('token', data.Token);\r\n \r\n if (!this.router.url.toLowerCase().startsWith(\"/order-form\")) {\r\n this.GetMemberInfo();\r\n }\r\n }\r\n\r\n public Logout() {\r\n localStorage.clear();\r\n }\r\n\r\n public IsDevPublic(): boolean {\r\n\r\n var url = window.location.hostname;\r\n return url.toLowerCase().includes(\"members-dev.structurestudios.com\")\r\n\r\n }\r\n\r\n public IsLocal(): boolean {\r\n\r\n var url = window.location.hostname;\r\n return url.toLowerCase().includes(\"localhost\");\r\n\r\n }\r\n\r\n\t\r\n\tpublic gettingAddress : boolean = false;\r\n\r\n\tpublic GetMemberInfo() {\r\n\t\tthis.gettingAddress = true;\r\n\r\n\t\tlet disposable = this.api.MemberBasicInfo().subscribe(response => {\r\n\t\t\tdisposable.unsubscribe();\r\n\r\n\t\t\tif (!response.Result)\r\n\t\t\t\treturn; // error\r\n\r\n\t\t\tthis.MemberBasicInfo = response.Data;\r\n\t\t\t\r\n\t\t\tlet hasAddress = true;\r\n\r\n\t\t\tif( this.MemberBasicInfo.Address1 == \"\" || this.MemberBasicInfo.Address1 == undefined )\r\n\t\t\t\thasAddress = false;\r\n\t\t\telse if( this.MemberBasicInfo.City == \"\" || this.MemberBasicInfo.City == undefined )\r\n\t\t\t\thasAddress = false;\r\n\t\t\telse if( this.MemberBasicInfo.State == \"\" || this.MemberBasicInfo.State == undefined )\r\n\t\t\t\thasAddress = false;\r\n\t\t\telse if( this.MemberBasicInfo.ZipCode == \"\" || this.MemberBasicInfo.ZipCode == undefined )\r\n\t\t\t\thasAddress = false;\r\n\r\n\t\t\tthis.hasValidAddress = hasAddress;\r\n\t\t\tthis.gettingAddress = false;\r\n\r\n\t\t\tconsole.log(\"GetMemberInfo() complete\");\r\n\t\t\tconsole.log(response);\r\n\r\n\t\t\tthis.onMemberProfileUpdated.next( response );\r\n\r\n\t\t}, error => {\r\n\t\t\tdisposable.unsubscribe();\r\n\t\t\tthis.hasValidAddress = false;\r\n\t\t\tthis.gettingAddress = false;\r\n\t\t\tconsole.log(\"GetMemberInfo() ERROR\");\r\n\r\n\t\t});\r\n\t}\r\n\r\n\t\r\n\tpublic CheckMemberInfo() {\r\n\t\tconsole.log(\"checking member info\", this.MemberBasicInfo);\r\n\t\tthis.GetMemberInfo();\r\n\t\t\r\n\t}\r\n\t\r\n\r\n public SetPageTitle( title : string, description : string = \"\" ) {\r\n \r\n this.titleService.setTitle(title + \" | Member Panel | StructureStudios.com\");\r\n\r\n if( description == \"\" )\r\n description = \"Structure Studios Member site for managing accounts.\";\r\n\r\n this.meta.updateTag({ name: 'description', content: description });\r\n\r\n }\r\n\r\n public SetToken(token: string) {\r\n this.Token = token;\r\n localStorage.setItem('token', token);\r\n }\r\n\r\n SubscribeEvents() {\r\n this.api.onProductsMyProducts.subscribe((response) => { this.MyProducts = response.Data; });\r\n }\r\n\r\n public static replaceAll(str, find, replace) {\r\n return str.replace(new RegExp(this.escapeRegExp(find), 'g'), replace);\r\n }\r\n\r\n public static escapeRegExp(str) {\r\n return str.replace(/([.*+?^=!:${}()|\\[\\]\\/\\\\])/g, '\\\\$1');\r\n }\r\n\r\n TokenToUrlFriendly(): string {\r\n return GlobalServices.ConverToUrlFriendly(this.Token);\r\n }\r\n\r\n public static ConverToUrlFriendly(input: string): string {\r\n // this.Token = this.Token.Replace(\"\\\\\", \"_\");\r\n input = this.replaceAll(input, '/', '~');\r\n input = this.replaceAll(input, '+', '|');\r\n input = this.replaceAll(input, '=', '<');\r\n\r\n return input;\r\n }\r\n\r\n public static ConverFromUrlFriendly(input: string): string {\r\n // this.Token = this.Token.Replace(\"\\\\\", \"_\");\r\n input = this.replaceAll(input, '~', '/');\r\n input = this.replaceAll(input, '|', '+');\r\n input = this.replaceAll(input, '<', '=');\r\n\r\n return input;\r\n }\r\n\r\n public ClearOrderFormLocalStorage() {\r\n localStorage.removeItem('cartProductID');\r\n localStorage.removeItem('cartBillingCycle');\r\n localStorage.removeItem('cartHasYard');\r\n localStorage.removeItem('email');\r\n }\r\n\r\n ReadFromStorage() {\r\n\r\n let MemberID = localStorage.getItem('MemberID');\r\n if (MemberID != undefined)\r\n this.MemberID = MemberID;\r\n\r\n let Username = localStorage.getItem('Username');\r\n if (Username != undefined)\r\n this.Username = Username;\r\n\r\n let FirstName = localStorage.getItem('FirstName');\r\n if (FirstName != undefined)\r\n this.FirstName = FirstName;\r\n\r\n let LastName = localStorage.getItem('LastName');\r\n if (LastName != undefined)\r\n this.LastName = LastName;\r\n\r\n let Email = localStorage.getItem('email');\r\n if (Email != undefined)\r\n this.Email = Email;\r\n\r\n let MemberType: number = localStorage.getItem('MemberType');\r\n if (MemberType != undefined)\r\n this.MemberType = MemberType;\r\n\r\n let Token = localStorage.getItem('token');\r\n if (Token != undefined)\r\n this.Token = Token;\r\n\r\n let TokenExpiration = localStorage.getItem('token_expiration');\r\n if (TokenExpiration != undefined)\r\n this.TokenExpiration = new Date(TokenExpiration);\r\n\r\n let DateTimeLogin = localStorage.getItem('DateTimeLogin');\r\n if (DateTimeLogin != undefined)\r\n this.DateTimeLogin = new Date(DateTimeLogin);\r\n\r\n\t}\r\n\t\r\n\r\n\r\n\tpublic FormattedPhone( v : string ) : string {\r\n\t\t\r\n\t\tif( v == null || v == undefined ) {\r\n\t\t\treturn '';\r\n\t\t}\r\n\r\n\t\t// trim '-' dashes\r\n\t\tv = v.replace(/-/g,'');\r\n\r\n\t\tv = v.replace(/[^\\d]/g, \"\");\r\n\t\t\r\n\t\t// trim string to 15 characters\r\n\t\tif( v.length > 10) {\r\n\t\t\tif (v.length > 15) {\r\n\t\t\t\tv = v.substr(0, 15);\r\n\t\t\t}\r\n\t\t\treturn ' +' + v;\r\n\t\t}\r\n\t\t\r\n\r\n // new array to hold sections of the License Key\r\n\t\tlet numbers = [];\r\n\r\n\t\t// create set of characters from first 5 characters\r\n\t\tnumbers.push(v.substr(0,3));\r\n\t\t\r\n\t\t// try for next 5\r\n\t\tif(v.substr(3,3)!==\"\")\r\n\t\t\tnumbers.push(v.substr(3,3));\r\n\t\t\r\n\t\t// and last set of 5\r\n\t\tif(v.substr(6,10)!=\"\")\r\n\t\t\tnumbers.push(v.substr(6,4));\r\n\t\t\r\n\t\tif(v.substr(10,15)!=\"\")\r\n\t\t\tnumbers.push(v.substr(10,5));\r\n\r\n\t\t// add '-' dashes back to formated string\r\n\t\tlet newValue = numbers[0];\r\n\t\t\r\n\t\t//if( newValue.length == 3 ) {\r\n\t\t\t\r\n\t\t//}\r\n\r\n\t\tif( numbers.length > 1 ) {\r\n\t\t\tnewValue = '(' + newValue + ') ';\r\n\t\t\tnewValue += numbers[1];\r\n\t\t}\r\n\t\t\t\r\n\r\n\t\tif (numbers.length > 2 )\r\n\t\t\tnewValue += '-' + numbers[2];\r\n\r\n\t\t// if (numbers.length > 3 )\r\n\t\t// \tnewValue += '-' + numbers[3];\r\n\r\n\t\treturn newValue;\r\n\t}\r\n\r\n ThisMonth() {\r\n const month = new Date().getMonth() + 1;\r\n\r\n if (month < 10) {\r\n return '0' + month;\r\n } else {\r\n return month;\r\n }\r\n }\r\n\t\r\n\r\n}\r\n","import { PublicOrderProductsResponse } from '../models/ss-api/responses/public.order.products.response';\r\nimport { TrainingJoinEventRequest } from '../models/ss-api/requests/training.join.event.request';\r\nimport { CancelProductRequest } from '../models/ss-api/requests/cancel.product.request';\r\nimport { UpgradeProductResponse } from '../models/ss-api/responses/upgrade.product.response';\r\nimport { AddCreditCardRequest } from '../models/ss-api/requests/add.credit.card.request';\r\nimport { CreditCardResponseArray } from '../models/ss-api/responses/credit.card.response';\r\nimport { ChangePasswordRequest } from '../models/ss-api/requests/change.password.request';\r\nimport { GISUsageHistoryItemResponseArray } from '../models/ss-api/responses/gis.history.item.response';\r\nimport { GISPurchaseItemResponseArray } from '../models/ss-api/responses/gis.purchase.item.response';\r\nimport { BillingHistoryResponseArray } from '../models/ss-api/responses/billing.history.response';\r\nimport { TwoFactorAuthenticationRequest } from '../models/ss-api/requests/twoFactorAuthentication.request';\r\nimport { SendTwoFactorCodeOptionRequest } from '../models/ss-api/requests/sendTwoFactorCodeOption.request';\r\nimport { catchError, map, Observable, Subject, throwError } from 'rxjs';\r\nimport { Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { HttpHeaders, HttpClient } from '@angular/common/http';\r\nimport { CommHttpService } from './comm-http.service';\r\nimport { IBaseResponse } from 'app/models/comm-http/responses/BaseResponse';\r\nimport { HttpError } from 'app/models/errors/HttpError';\r\nimport { ssApiResponse } from '../models/ss-api/responses/ss-api.response';\r\nimport { LoginResponse } from 'app/models/ss-api/responses/login.response';\r\nimport { LoginRequest } from 'app/models/ss-api/requests/login.request';\r\nimport { DashboardProductsResponse } from 'app/models/ss-api/responses/dashboard.products.response';\r\nimport { CreditCardResponse } from 'app/models/ss-api/responses/credit.card.response';\r\nimport { MemberBasicInfoResponse } from 'app/models/ss-api/responses/member.basic.info.response';\r\nimport { GISBundleResponseArray } from 'app/models/ss-api/responses/gis.bundle.response';\r\nimport { CalendarEventResponseArray } from 'app/models/ss-api/responses/calendar.event.response';\r\nimport { OrderGISRequest } from 'app/models/ss-api/requests/order.gis.request';\r\nimport { TrainingEventDetailsResponse } from 'app/models/ss-api/responses/training.event.details.response';\r\nimport { NewMemberRequest } from 'app/models/ss-api/requests/new.member.request';\r\nimport { PublicOrderProductsResponseArray } from 'app/models/ss-api/responses/public.order.products.response';\r\nimport { AddProductRequest } from 'app/models/ss-api/requests/add.product.request';\r\nimport { UpgradableProductsResponseArray } from 'app/models/ss-api/responses/upgradable.products.response';\r\nimport { UpgradeProductRequest } from 'app/models/ss-api/requests/upgrade.product.request';\r\nimport { RedirectResponse } from 'app/models/ss-api/responses/redirect.response';\r\nimport { UpdateCartRequest } from 'app/models/ss-api/requests/update.cart.request';\r\nimport { ResetPasswordRequest } from 'app/models/ss-api/requests/reset.password.request';\r\nimport { SetNewPasswordRequest } from 'app/models/ss-api/requests/set.new.password.request';\r\nimport { TrainingJoinEventResponse } from 'app/models/ss-api/responses/training.join.event.response';\r\nimport { MemberDesignerLicenseBasicsResponseArray } from 'app/models/ss-api/responses/member.designers.licenses.basics.response';\r\nimport { IUnlockLoginRequest } from 'app/models/ss-api/requests/unlock.code.request';\r\nimport { UnfunishedOrderData } from 'app/models/ss-api/responses/unfinished.order.data';\r\nimport { FinishOrderRequest } from 'app/models/ss-api/requests/finish.order.request';\r\nimport { DesignerInstructionsRequest } from '../models/ss-api/requests/designer.instructions.request';\r\nimport { YardAddonOrderRequest } from '../models/ss-api/requests/yard.addon.order.request';\r\nimport { YardAddonPriceResponse } from 'app/models/ss-api/responses/yard.addon.price.response';\r\nimport { UpgradeSimulationResponse } from '../models/ss-api/responses/upgrade.simulation.response';\r\nimport { ReactivateSimulationResponse } from '../models/ss-api/responses/reactivate.simulation.response';\r\nimport { ReactivateRequest } from '../models/ss-api/requests/reactivate.request';\r\nimport { CancelYardRequest } from '../models/ss-api/requests/cancel.yard.request';\r\nimport { NewMemberResponse } from '../models/ss-api/responses/new.member.response';\r\nimport { PayInvoiceRequest } from '../models/ss-api/requests/pay.invoice.request';\r\nimport { environment } from 'environments/environment';\r\nimport { CdKeyReassignRequest } from '../models/ss-api/requests/cdkey.reassign.request';\r\nimport { TrainingEvent } from '../models/domain/training.event';\r\nimport { RegisterForTrainingEventRequest } from '../models/ss-api/requests/register.for.training.event.request';\r\nimport { MemberTrainingCalendarResponse } from '../models/ss-api/responses/member.training.calendar.response';\r\nimport { TrainingCalendarRequest } from '../models/ss-api/requests/training.calendar.request';\r\nimport { MemberTrainingCertificateResponseArray } from '../models/ss-api/responses/member.training.certificate.response';\r\nimport { MemberTrainingCertificatesRequest } from '../models/ss-api/requests/member.training.certificates.request';\r\nimport { TrainingHistoryResponseArray } from '../models/ss-api/responses/training.history.response';\r\nimport { RegisterForTrainingEventResponse } from '../models/ss-api/responses/register.for.training.event.response';\r\nimport { UpdateTrainingEventSubscriptionStatusResponse } from '../models/ss-api/responses/update.training.subscription.status.response';\r\nimport { UpdateTrainingEventSubscriptionStatusRequest } from '../models/ss-api/requests/update.training.event.subscription.status.request';\r\nimport { ReactivateSimulationRequest } from '../models/ss-api/requests/reactivate.simulation.request';\r\nimport { UpdateCreditCardExpirationRequest } from '../models/ss-api/requests/update.credit.card.expiration.request';\r\nimport { ReactivateSimulationRequestv2 } from '../models/ss-api/requests/reactivate.simulation.request.v2';\r\nimport { ReactivateSimulationResponsev2 } from '../models/ss-api/responses/reactivate.simulation.response.V2';\r\nimport { ReactivateRequestv2 } from '../models/ss-api/requests/reactivate.request.v2';\r\nimport { CheckForExistingMemberResponse } from '../models/ss-api/responses/check.for.existing.member.response';\r\nimport { CheckForExistingMemberRequest } from '../models/ss-api/requests/check.for.existing.member.request';\r\nimport { GetTrainingClassesRequest } from 'app/models/ss-api/requests/get.training.classes.request';\r\nimport { TrainingClassArray } from 'app/models/domain/training.class';\r\nimport { CheckHoldEligibilityResponse } from 'app/models/ss-api/responses/check.hold.eligibility.response';\r\nimport { HoldRequest } from 'app/models/ss-api/requests/hold.request';\r\nimport { ResumeLicenseRequest } from 'app/models/ss-api/requests/resume.license.request';\r\nimport { ResumeLicenseSimulationResponse } from 'app/models/ss-api/responses/resume.license..simulation.response';\r\nimport { ResumeLicenseSimulationRequest } from 'app/models/ss-api/requests/resume.license.simulation.request';\r\nimport { UpdateMemberProfileRequest } from 'app/models/ss-api/requests/update.member.profile.request';\r\nimport { MemberProfile } from 'app/models/domain/member.profile';\r\nimport { MemberAnnouncementArray } from 'app/models/ss-api/responses/member.announcement';\r\nimport { UpdateCartResponse } from 'app/models/ss-api/responses/update.cart.response';\r\n\r\n\r\n\r\nclass ssApiUrls {\r\n\r\n // authentication\r\n static readonly Authentication_Login: string = 'Authentication/Login';\r\n static readonly Authentication_Logout: string = 'Authentication/Logout';\r\n static readonly Authentication_SendTwoFactorCode: string = 'Authentication/SendTwoFactorCode';\r\n static readonly Authentication_TwoFactorAuthentication: string = 'Authentication/TwoFactorAuthentication';\r\n static readonly Authentication_ChangePassword: string = 'Authentication/ChangePassword';\r\n static readonly Authentication_ResetPassword: string = 'Authentication/ResetPassword';\r\n static readonly Authentication_SetNewPassword: string = 'Authentication/SetNewPassword';\r\n static readonly Authentication_UnlockLogin: string = 'Authentication/UnlockLogin';\r\n static readonly Authentication_SessionInfo: string = 'Authentication/SessionInfo';\r\n\r\n // member\r\n static readonly Member_New: string = 'Member/New';\r\n static readonly Member_BasicInfo: string = 'Member/BasicInfo';\r\n static readonly Member_Credit: string = 'Member/Credit';\r\n static readonly Member_MemberDesignersLicensesBasics: string = 'Member/MemberDesignersLicensesBasics';\r\n static readonly Member_FinishOrder: string = 'Member/FinishOrder';\r\n static readonly Member_CheckForExistingMember: string = 'Member/CheckForExistingMember';\r\n static readonly Member_Profile: string = 'Member/MemberProfile';\r\n static readonly Member_UpdateProfile: string = 'Member/UpdateMemberProfile'; \r\n static readonly Member_MemberAnnouncements: string = 'Member/MemberAnnouncements';\r\n\r\n // referral\r\n static readonly Referral_Redirect: string = 'Referral/GetRedirect';\r\n\r\n // sales\r\n static readonly Sales_UpdateCart: string = 'Sales/UpdateCart';\r\n static readonly Sales_GetUnfinishedOrderData: string = 'Sales/GetUnfinishedOrderData';\r\n\r\n // products\r\n static readonly Products_PublicOrderProducts: string = 'Products/PublicOrderProducts';\r\n static readonly Products_OrderProducts: string = 'Products/OrderProducts';\r\n static readonly Products_PublicAndSpecialOrderProducts: string = 'Products/PublicAndSpecialOrderProducts';\r\n static readonly Products_Add: string = 'Products/Add';\r\n static readonly Products_Cancel: string = 'Products/Cancel';\r\n static readonly Products_MyProducts: string = 'Products/MyProducts';\r\n static readonly Products_UpgradableProducts: string = 'Products/UpgradableProducts';\r\n static readonly Products_Upgrade: string = 'Products/Upgrade';\r\n static readonly Products_UpgradeSimulation: string = 'Products/UpgradeSimulation';\r\n static readonly Products_ReactivateSimulation: string = 'Products/ReactivateSimulation/';\r\n static readonly Products_Reactivate: string = 'Products/Reactivate';\r\n static readonly Products_ReactivateSimulationv2: string = 'Products/ReactivateSimulationv2/';\r\n static readonly Products_Reactivatev2: string = 'Products/Reactivatev2';\r\n static readonly Products_CheckHoldEligibility: string = 'Products/CheckHoldEligibility/';\r\n static readonly Products_Hold: string = 'Products/Hold/';\r\n static readonly Products_ExtendHold: string = 'Products/ExtendHold/';\r\n static readonly Products_ResumeLicense: string = 'Products/ResumeLicense/';\r\n static readonly Products_ResumeLicenseSimulation: string = 'Products/ResumeLicenseSimulation/';\r\n\r\n // license\r\n static readonly License_Reassign: string = 'License/Reassign';\r\n static readonly License_AssigToLoggedinUser: string = 'License/AssigToLoggedinUser';\r\n static readonly License_GetFirstLicenseKey: string = 'License/GetFirstLicenseKey';\r\n static readonly License_SendLicenseKeyInstructionsToDesignerEmail: string = 'License/SendLicenseKeyInstructionsToDesignerEmail';\r\n\r\n // billing\r\n static readonly Billing_History: string = 'Billing/History';\r\n static readonly Billing_PayInvoice: string = 'Billing/PayInvoice';\r\n\r\n // GIS\r\n static readonly GIS_PurchaseHistory: string = 'GIS/PurchaseHistory';\r\n static readonly GIS_UsageHistory: string = 'GIS/UsageHistory';\r\n static readonly GIS_SharedBundle: string = 'GIS/SharedBundle';\r\n static readonly GIS_IndividualBundle: string = 'GIS/IndividualBundle';\r\n static readonly GIS_Order: string = 'GIS/Order';\r\n\r\n // Yard\r\n static readonly Yard_GetPricing: string = 'Yard/GetPricingForLicense/';\r\n static readonly Yard_Add: string = 'Yard/Add/';\r\n static readonly Yard_Cancel: string = 'Yard/Cancel/';\r\n\r\n // credit card\r\n static readonly CreditCard_GetDefault: string = 'CreditCard/GetDefault';\r\n static readonly CreditCard_GetAll: string = 'CreditCard/GetAll';\r\n static readonly CreditCard_Add: string = 'CreditCard/Add';\r\n static readonly CreditCard_UpdateExpiration: string = 'CreditCard/UpdateExpiration';\r\n static readonly CreditCard_SetAsDefault: string = 'CreditCard/SetDefault';\r\n static readonly CreditCard_Delete: string = 'CreditCard/Delete';\r\n\r\n // training\r\n static readonly Training_GetTrainingEventByID: string = 'Training/GetTrainingEventByID/';\r\n static readonly Training_RegisterForTrainingEvent: string = 'Training/RegisterForTrainingEvent/';\r\n static readonly Training_GetMemberTrainingCalendar: string = 'Training/GetMemberTrainingCalendarv2/';\r\n static readonly Training_GetMemberTrainingCertificates: string = 'Training/GetMemberTrainingCertificates/';\r\n static readonly Training_GetTrainingHistory: string = 'Training/GetTrainingHistory/';\r\n static readonly Training_UpdateTrainingEventSubscriptionStatus: string = 'Training/UpdateTrainingEventSubscriptionStatus/';\r\n static readonly Training_GetTrainingClasses: string = 'Training/GetTrainingClasses/';\r\n}\r\n\r\n@Injectable()\r\nexport class ssApiService extends CommHttpService {\r\n\r\n // private baseUrl: string = \"https://members-pci-api.structurestudios.com/api/\";\r\n // private baseUrl: string = \"http://localhost:55189/api/\"\r\n private baseUrl: string = environment.baseUrl;\r\n private envName: string = environment.envName;\r\n public isDev: boolean = false;\r\n\r\n // busy\r\n public IsBusy: boolean = false;\r\n\r\n // events\r\n public onIsBusyChanged = new Subject();\r\n public onResponse = new Subject();\r\n\r\n public onLoginResponse = new Subject>();\r\n public onSessionInfoResponse = new Subject>();\r\n public onLogoutResponse = new Subject>();\r\n public onSendTwoFactorCode = new Subject>();\r\n public onTwoFactorAuthentication = new Subject>();\r\n public onChangePassword = new Subject>();\r\n public onResetPasswordRequest = new Subject>();\r\n public onSetNewPassword = new Subject>();\r\n public onUnlockLogin = new Subject>();\r\n\r\n public onMemberNew = new Subject>();\r\n public onFinishOrder = new Subject>();\r\n public onMemberBasicInfo = new Subject>();\r\n public onMemberDesignersLicensesBasics = new Subject>();\r\n public onMemberCheckForExistingMember = new Subject>();\r\n public onMemberProfile = new Subject>();\r\n public onMemberUpdateProfile = new Subject>();\r\n public onMemberMemberAnnouncements = new Subject>();\r\n\r\n public onReferralRedirect = new Subject>();\r\n\r\n public onProductsPublicOrderProducts = new Subject>();\r\n public onProductsOrderProducts = new Subject>();\r\n public onProductsPublicAndSpecialOrderProducts = new Subject>();\r\n public onProductsMyProducts = new Subject>();\r\n public onProductsUpgradableProducts = new Subject>();\r\n public onProductsAdd = new Subject>();\r\n public onProductsCancel = new Subject>();\r\n public onProductUpgrade = new Subject>();\r\n public onProductUpgradeSimulation = new Subject>();\r\n public onProductReactivateSimulationn = new Subject>();\r\n public onCheckHoldEligibility = new Subject>();\r\n public onHoldLicense = new Subject>();\r\n public onExtendHoldLicense = new Subject>();\r\n public onResumeLicense = new Subject>();\r\n public onResumeLicenseSimulation = new Subject>();\r\n\r\n public onProductReactivate = new Subject>();\r\n public onProductReactivateSimulationnv2 = new Subject>();\r\n public onProductReactivatev2 = new Subject>();\r\n\r\n\r\n public onLicenseReassign = new Subject>();\r\n public onAssigToLoggedinUser = new Subject>();\r\n public onGetFirstLicenseKey = new Subject>();\r\n public onSendLicenseKeyInstructionsToDesignerEmail = new Subject>();\r\n\r\n public onBillingHistory = new Subject>();\r\n public onBillingPayInvoice = new Subject>();\r\n\r\n public onSalesUpdateCart = new Subject>();\r\n public onSalesGetUnfinishedOrderData = new Subject>();\r\n\r\n public onGISPurchaseHistory = new Subject>();\r\n public onGISUsageHistory = new Subject>();\r\n public onGISSharedBundle = new Subject>();\r\n public onGISIndividualBundle = new Subject>();\r\n public onGISOrder = new Subject>();\r\n\r\n public onCreditCardGetDefault = new Subject>();\r\n public onCreditCardGetAll = new Subject>();\r\n public onCreditCardAdd = new Subject>();\r\n public onCreditCardUpdateExpiration = new Subject>();\r\n public onCreditCardSetDefault = new Subject>();\r\n public onCreditCardDelete = new Subject>();\r\n\r\n public onCalendarData = new Subject();\r\n\r\n public onYardAddonOrder = new Subject();\r\n public onYardGetPricing = new Subject>();\r\n public onYardCancel = new Subject>();\r\n\r\n public onMemberCredit = new Subject>();\r\n\r\n public onTrainingEventByID = new Subject>();\r\n public onRegisterForTrainingEvent = new Subject>();\r\n public onGetMemberTrainingCalendar = new Subject>();\r\n public onGetMemberTrainingCertificates = new Subject>();\r\n public onGetTrainingHistory = new Subject>();\r\n public onUpdateTrainingEventSubscriptionStatus = new Subject>();\r\n public onGetTrainingClasses = new Subject>();\r\n\r\n // leave router to protected because of inheritance\r\n constructor(private http: HttpClient, router: Router) {\r\n super(http, router);\r\n\r\n // Set baseUrl\r\n this.baseUrl = this.GetBaseURL();\r\n\r\n }\r\n\r\n // Method that returns the BaseURL of the API based on the current domain\r\n public GetBaseURL(): string {\r\n\r\n if (this.envName == 'local') {\r\n\r\n return 'https://localhost:4402/api/';\r\n\r\n } else {\r\n\r\n switch (window.location.hostname) {\r\n\r\n case 'members.structurestudios.com':\r\n // return 'https://members-pci-api.structurestudios.com/api/'; // NEW PCI Compliant server/api\r\n return 'https://members-api.structurestudios.com/api/'; // Original API\r\n\r\n case 'members-panel-dev.structurestudios.com':\r\n this.isDev = true;\r\n return 'https://members-api-dev.structurestudios.com/api/';\r\n\r\n case 'member-panel-dev-primo.structurestudios.com':\r\n this.isDev = true;\r\n return 'https://members-api-dev-primo.structurestudios.com/api/';\r\n\r\n case 'localhost':\r\n this.isDev = true;\r\n\t\t\t\t\t// return 'http://localhost:55189/api/';// https://members-api-dev.structurestudios.com/api/''; // DEV API\r\n return 'https://members-api.structurestudios.com/api/'; // LIVE API -- BEE CAREFUL!\r\n // return 'https://members-pci-api.structurestudios.com/api/'; // NEW PCI Compliant server/api\r\n \r\n case 'members-pci.structurestudios.com':\r\n this.isDev = true;\r\n return 'https://members-pci-api.structurestudios.com/api/';\r\n\r\n default:\r\n this.isDev = true;\r\n return 'https://dev-test-api.structurestudios.com/api/';\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n\r\n // Method that returns the ReportBotURL of the API based on the current domain\r\n public GetReportBotURL(): string {\r\n\r\n if (this.envName == 'local') {\r\n\r\n return 'https://reports-api.structurestudios.com';\r\n\r\n } else {\r\n\r\n switch (window.location.hostname) {\r\n\r\n case 'members.structurestudios.com':\r\n return 'https://reports-api.structurestudios.com';\r\n\r\n case 'members-panel-dev.structurestudios.com':\r\n return 'https://reports-api-dev.structurestudios.com';\r\n\r\n case 'localhost':\r\n return 'https://reports-api.structurestudios.com';\r\n\r\n default:\r\n return 'https://reports-api.structurestudios.com';\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n private SetBusy(): void {\r\n this.IsBusy = true;\r\n this.onIsBusyChanged.next(true);\r\n }\r\n\r\n private UnsetBusy(): void {\r\n this.IsBusy = false;\r\n this.onIsBusyChanged.next(false);\r\n }\r\n\r\n private FullURL(url: string): string {\r\n return this.baseUrl + url;\r\n }\r\n\r\n\r\n\r\n\r\n // prep\r\n\r\n private getTokenHeader(): HttpHeaders {\r\n\r\n let token = localStorage.getItem('token');\r\n let headers = new HttpHeaders();\r\n\r\n if (token != undefined) {\r\n headers = headers.set('Authorization', 'Bearer ' + token);\r\n }\r\n\r\n return headers;\r\n }\r\n\r\n private prepGet(referalMethod: string, url: string, key: string = ''): Observable> {\r\n this.SetBusy();\r\n\r\n url = this.FullURL(url) + key;\r\n let headers = this.getTokenHeader();\r\n\r\n // request\r\n return this.Get(url, null, headers)\r\n .pipe(\r\n map(response => {\r\n this.UnsetBusy();\r\n \r\n let apiResponse = new ssApiResponse(url, referalMethod, response);\r\n this.onResponse.next(apiResponse);\r\n return response;\r\n }),\r\n catchError((error: HttpError) => {\r\n this.UnsetBusy();\r\n return throwError(error);\r\n })\r\n )\r\n\r\n }\r\n\r\n public prepPOST(referalMethod: string, request: any, url: string): Observable> {\r\n this.SetBusy();\r\n\r\n url = this.FullURL(url);\r\n let headers = this.getTokenHeader();\r\n\r\n // request\r\n return this.Post(url, request, headers)\r\n .pipe(\r\n map(response => {\r\n this.UnsetBusy();\r\n \r\n let apiResponse = new ssApiResponse(url, referalMethod, response);\r\n this.onResponse.next(apiResponse);\r\n return response;\r\n \r\n }),\r\n catchError((error: HttpError) => {\r\n this.UnsetBusy();\r\n return throwError(error);\r\n })\r\n )\r\n }\r\n\r\n\r\n public prepPATCH(referalMethod: string, request: any, url: string): Observable> {\r\n this.SetBusy();\r\n\r\n url = this.FullURL(url);\r\n let headers = this.getTokenHeader();\r\n\r\n // request\r\n return this.Patch(url, request, headers)\r\n .pipe(\r\n map(response => {\r\n this.UnsetBusy();\r\n \r\n let apiResponse = new ssApiResponse(url, referalMethod, response);\r\n this.onResponse.next(apiResponse);\r\n return response;\r\n \r\n }),\r\n catchError((error: HttpError) => {\r\n this.UnsetBusy();\r\n return throwError(error);\r\n })\r\n )\r\n\r\n }\r\n\r\n public prepDelete(referalMethod: string, url: string): Observable> {\r\n this.SetBusy();\r\n\r\n url = this.FullURL(url);\r\n let headers = this.getTokenHeader();\r\n\r\n // request\r\n return this.Delete(url, headers)\r\n .pipe(\r\n map(response => {\r\n this.UnsetBusy();\r\n \r\n let apiResponse = new ssApiResponse(url, referalMethod, response);\r\n this.onResponse.next(apiResponse);\r\n return response;\r\n \r\n }),\r\n catchError((error: HttpError) => {\r\n this.UnsetBusy();\r\n return throwError(error);\r\n })\r\n )\r\n\r\n }\r\n\r\n\r\n // Authentication\r\n public Login(request: LoginRequest): Observable> {\r\n\r\n let referalMethod = 'Login';\r\n\r\n return this.prepPOST(referalMethod, request, ssApiUrls.Authentication_Login)\r\n .pipe(\r\n map(response => {\r\n\r\n if (response.Result) {\r\n // only when a true result\r\n Object.setPrototypeOf(response.Data, LoginResponse.prototype);\r\n //response.Data.FixDates();\r\n }\r\n \r\n this.onLoginResponse.next(response);\r\n return response;\r\n })\r\n );\r\n\r\n }\r\n\r\n public ChangePassword(request: ChangePasswordRequest): Observable> {\r\n\r\n let referalMethod = 'ChangePassword';\r\n\r\n return this.prepPATCH(referalMethod, request, ssApiUrls.Authentication_ChangePassword)\r\n .pipe(\r\n map(response => {\r\n\r\n this.onChangePassword.next(response);\r\n return response;\r\n })\r\n );\r\n\r\n }\r\n\r\n public SendTwoFactorCode(request: SendTwoFactorCodeOptionRequest): Observable> {\r\n\r\n let referalMethod = 'SendTwoFactorCode';\r\n\r\n return this.prepPOST(referalMethod, request, ssApiUrls.Authentication_SendTwoFactorCode)\r\n .pipe(\r\n map(response => {\r\n\r\n this.onSendTwoFactorCode.next(response);\r\n return response;\r\n })\r\n );\r\n\r\n }\r\n\r\n public SetNewPassword(request: SetNewPasswordRequest): Observable> {\r\n\r\n let referalMethod = 'SetNewPassword';\r\n\r\n return this.prepPOST(referalMethod, request, ssApiUrls.Authentication_SetNewPassword)\r\n .pipe(\r\n map(response => {\r\n\r\n this.onSetNewPassword.next(response);\r\n return response;\r\n })\r\n )\r\n }\r\n\r\n public ResetPasswordRequest(request: ResetPasswordRequest): Observable> {\r\n\r\n let referalMethod = 'ResetPasswordRequest';\r\n\r\n return this.prepPOST(referalMethod, request, ssApiUrls.Authentication_ResetPassword)\r\n .pipe(\r\n map(response => {\r\n\r\n this.onResetPasswordRequest.next(response);\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n public TwoFactorAuthentication(request: TwoFactorAuthenticationRequest): Observable> {\r\n\r\n let referalMethod = 'TwoFactorAuthentication';\r\n\r\n return this.prepPOST(referalMethod, request, ssApiUrls.Authentication_TwoFactorAuthentication)\r\n .pipe(\r\n map(response => {\r\n\r\n this.onTwoFactorAuthentication.next(response);\r\n return response;\r\n })\r\n );\r\n\r\n }\r\n\r\n public Logout(logoutEverywhere: boolean): Observable> {\r\n\r\n let referalMethod = 'Logout';\r\n\r\n return this.prepDelete(referalMethod, ssApiUrls.Authentication_Logout + '/' + logoutEverywhere)\r\n .pipe(\r\n map(response => {\r\n this.onLogoutResponse.next(response);\r\n return response;\r\n })\r\n );\r\n\r\n }\r\n\r\n public UnlockLogin(request: IUnlockLoginRequest): Observable