@xsolla/payment-client-core 0.2.43 → 0.2.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/esm2022/lib/core/environment.interface.mjs +2 -0
  2. package/esm2022/lib/core/payment/actions/action.interface.mjs +1 -1
  3. package/esm2022/lib/core/payment/actions/next-action.service.mjs +1 -1
  4. package/esm2022/lib/core/payment/field-names.enum.mjs +4 -1
  5. package/esm2022/lib/core/payment/field.interface.mjs +1 -1
  6. package/esm2022/lib/core/payment/finance-details/finance-details.service.mjs +4 -1
  7. package/esm2022/lib/core/payment/initialize-actions/action.interface.mjs +2 -0
  8. package/esm2022/lib/core/payment/initialize-actions/initialize-next-action.service.mjs +40 -0
  9. package/esm2022/lib/core/payment/initialize-actions/initialize-next-actions.mjs +7 -0
  10. package/esm2022/lib/core/payment/initialize-actions/next-action.interface.mjs +2 -0
  11. package/esm2022/lib/core/payment/initialize-actions/special-button/special-button.action.class.mjs +46 -0
  12. package/esm2022/lib/core/payment/initialize-actions/special-button/special-button.action.type.mjs +2 -0
  13. package/esm2022/lib/core/payment/initialized-form.inteface.mjs +1 -1
  14. package/esm2022/lib/core/payment/payment.service.mjs +72 -24
  15. package/esm2022/lib/core/payment/sync/request/sync-request.class.mjs +3 -1
  16. package/esm2022/lib/core/payment/sync/sync.service.mjs +4 -4
  17. package/esm2022/lib/core/payment/xps-error.interface.mjs +1 -1
  18. package/esm2022/lib/core/script-tracker/script-tracker.service.mjs +88 -0
  19. package/esm2022/lib/core/sdk-payment-systems/google-pay/check-payment-device-data.interface.mjs +2 -0
  20. package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.mjs +1 -1
  21. package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.mjs +1 -1
  22. package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +70 -59
  23. package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-checkout-payment.service.mjs +75 -0
  24. package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-instant-payment.service.mjs +121 -0
  25. package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-payment-service.interface.mjs +2 -0
  26. package/esm2022/lib/core/sdk-payment-systems/google-pay/updated-price.interface.mjs +2 -0
  27. package/esm2022/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.mjs +1 -1
  28. package/esm2022/lib/core/sdk-payment-systems/sdk-payment-systems.interface.mjs +1 -1
  29. package/esm2022/lib/core/settings/configuration.interface.mjs +1 -1
  30. package/esm2022/lib/core/user-behaviour-analytics/event-builder/event-builder.service.mjs +2 -1
  31. package/esm2022/lib/core/user-behaviour-analytics/event-builder/event-parameter-types.mjs +2 -1
  32. package/esm2022/lib/core/user-behaviour-analytics/user-behaviour-analytics.interface.mjs +1 -1
  33. package/esm2022/lib/core/user-behaviour-analytics/user-behaviour-event-name.enum.mjs +2 -1
  34. package/esm2022/lib/core-library.module.mjs +12 -1
  35. package/esm2022/lib/core-library.service.mjs +19 -5
  36. package/fesm2022/xsolla-payment-client-core.mjs +649 -213
  37. package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
  38. package/lib/core/environment.interface.d.ts +1 -0
  39. package/lib/core/payment/actions/action.interface.d.ts +2 -2
  40. package/lib/core/payment/actions/next-action.service.d.ts +1 -1
  41. package/lib/core/payment/actions/next-actions.d.ts +1 -1
  42. package/lib/core/payment/field-names.enum.d.ts +4 -1
  43. package/lib/core/payment/field.interface.d.ts +1 -1
  44. package/lib/core/payment/finance-details/finance-details.service.d.ts +1 -0
  45. package/lib/core/payment/initialize-actions/action.interface.d.ts +11 -0
  46. package/lib/core/payment/initialize-actions/initialize-next-action.service.d.ts +16 -0
  47. package/lib/core/payment/initialize-actions/initialize-next-actions.d.ts +5 -0
  48. package/lib/core/payment/initialize-actions/next-action.interface.d.ts +2 -0
  49. package/lib/core/payment/initialize-actions/special-button/special-button.action.class.d.ts +17 -0
  50. package/lib/core/payment/initialize-actions/special-button/special-button.action.type.d.ts +6 -0
  51. package/lib/core/payment/initialized-form.inteface.d.ts +2 -0
  52. package/lib/core/payment/payment.service.d.ts +11 -2
  53. package/lib/core/payment/sync/sync.service.d.ts +1 -1
  54. package/lib/core/payment/xps-error.interface.d.ts +1 -0
  55. package/lib/core/script-tracker/script-tracker.service.d.ts +19 -0
  56. package/lib/core/sdk-payment-systems/google-pay/check-payment-device-data.interface.d.ts +9 -0
  57. package/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.d.ts +6 -0
  58. package/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.d.ts +170 -52
  59. package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +18 -10
  60. package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-checkout-payment.service.d.ts +18 -0
  61. package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-instant-payment.service.d.ts +18 -0
  62. package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-payment-service.interface.d.ts +14 -0
  63. package/lib/core/sdk-payment-systems/google-pay/updated-price.interface.d.ts +7 -0
  64. package/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.d.ts +7 -1
  65. package/lib/core/sdk-payment-systems/sdk-payment-systems.interface.d.ts +1 -1
  66. package/lib/core/settings/configuration.interface.d.ts +2 -0
  67. package/lib/core/user-behaviour-analytics/event-builder/event-parameter-types.d.ts +2 -1
  68. package/lib/core/user-behaviour-analytics/user-behaviour-analytics.interface.d.ts +2 -2
  69. package/lib/core/user-behaviour-analytics/user-behaviour-event-name.enum.d.ts +2 -1
  70. package/lib/core-library.service.d.ts +12 -1
  71. package/package.json +1 -1
  72. package/xsolla-payment-client-core-0.2.45.tgz +0 -0
  73. package/xsolla-payment-client-core-0.2.43.tgz +0 -0
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Inject, Pipe, isDevMode, NgModule } from '@angular/core';
2
+ import { InjectionToken, Injectable, Inject, isDevMode, Pipe, NgModule } from '@angular/core';
3
3
  import { firstValueFrom, lastValueFrom, map, Subject, BehaviorSubject, filter as filter$1, takeUntil, skip, take, of, interval, throwError } from 'rxjs';
4
4
  import * as i1 from '@angular/common/http';
5
5
  import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
6
+ import { UntypedFormGroup, Validators, UntypedFormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
6
7
  import JSEncrypt from 'jsencrypt';
7
- import { UntypedFormGroup, Validators, UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
8
- import { filter, map as map$1, tap, debounce, catchError } from 'rxjs/operators';
8
+ import { filter, map as map$1, tap, debounce, debounceTime, catchError } from 'rxjs/operators';
9
9
  import * as i1$1 from '@angular/router';
10
10
  import { CommonModule } from '@angular/common';
11
11
 
@@ -540,6 +540,7 @@ var FieldNames;
540
540
  FieldNames["description"] = "description";
541
541
  FieldNames["email"] = "email";
542
542
  FieldNames["psEmail"] = "psEmail";
543
+ FieldNames["psAccountCountry"] = "psAccountCountry";
543
544
  FieldNames["bazitemail"] = "bazitemail";
544
545
  FieldNames["euCheck"] = "eu_check";
545
546
  FieldNames["extraCvv"] = "extra_cvv";
@@ -595,6 +596,8 @@ var FieldNames;
595
596
  FieldNames["payInstanceAccountId"] = "payInstanceAccountId";
596
597
  FieldNames["getApplePaySessionUrl"] = "getApplePaySessionUrl";
597
598
  FieldNames["payViaCheckoutUrl"] = "payViaCheckoutUrl";
599
+ FieldNames["googlePayInitData"] = "googlePayInitData";
600
+ FieldNames["googlePayPaymentData"] = "googlePayPaymentData";
598
601
  })(FieldNames || (FieldNames = {}));
599
602
 
600
603
  class SubmitResponse {
@@ -685,6 +688,145 @@ var InputEventName;
685
688
 
686
689
  const googlePayPid = 3431;
687
690
 
691
+ var ErrorTags;
692
+ (function (ErrorTags) {
693
+ ErrorTags["APP"] = "appError";
694
+ ErrorTags["HTTP"] = "httpError";
695
+ ErrorTags["JS"] = "jsError";
696
+ ErrorTags["WS"] = "webSocket";
697
+ ErrorTags["ENCRYPT"] = "encrypt";
698
+ ErrorTags["APPLEPAY"] = "applepay";
699
+ ErrorTags["HEADLESS_UI"] = "headlessUi";
700
+ ErrorTags["GOOGLEPAY"] = "googlepay";
701
+ ErrorTags["PAYTM"] = "paytm";
702
+ })(ErrorTags || (ErrorTags = {}));
703
+
704
+ class TaggedError extends Error {
705
+ constructor(message, tags) {
706
+ super(message);
707
+ this.tags = [];
708
+ this.parentTag = ErrorTags.HEADLESS_UI;
709
+ this.tags = this.childTag
710
+ ? [this.parentTag, this.childTag]
711
+ : [this.parentTag];
712
+ if (tags) {
713
+ const newTags = tags.filter((t, i, arr) => !this.tags.includes(t) && arr.indexOf(t) == i);
714
+ this.tags = [...this.tags, ...newTags];
715
+ }
716
+ }
717
+ }
718
+
719
+ class ElkLoggerService {
720
+ constructor(window, settingsService, http, ngZone) {
721
+ this.window = window;
722
+ this.settingsService = settingsService;
723
+ this.http = http;
724
+ this.ngZone = ngZone;
725
+ this.vendors = new RegExp('node_modules\\/(@angular|zone).*.js$');
726
+ this.stackTrace = this.loadStackTrace();
727
+ }
728
+ handleError(error) {
729
+ this.ngZone.runOutsideAngular(() => {
730
+ if (isDevMode()) {
731
+ console.error(error);
732
+ return;
733
+ }
734
+ this.parseError(error).catch(console.log);
735
+ });
736
+ }
737
+ log(message, tags, extra) {
738
+ const logTags = [ErrorTags.HEADLESS_UI, ...tags];
739
+ if (isDevMode()) {
740
+ console.log(message, tags);
741
+ return;
742
+ }
743
+ const logMessage = {
744
+ additionalInfo: this.getAdditionalInfo(),
745
+ extra,
746
+ message,
747
+ };
748
+ this.sendLog(logMessage, logTags);
749
+ }
750
+ async parseError(error) {
751
+ const errorObj = error instanceof TaggedError
752
+ ? error
753
+ : new TaggedError(error.message || error.toString());
754
+ errorObj.trace = await this.getErrorTrace(errorObj);
755
+ errorObj.additionalInfo = this.getAdditionalInfo();
756
+ const { tags } = errorObj;
757
+ const cleanError = this.removeErrorMetaFields(errorObj);
758
+ this.sendLog(cleanError, tags);
759
+ return errorObj;
760
+ }
761
+ async loadStackTrace() {
762
+ const library = await import('stacktrace-js');
763
+ return library.default;
764
+ }
765
+ async getErrorTrace(error) {
766
+ const stackTrace = await this.stackTrace;
767
+ const stackFramesArr = await stackTrace.fromError(error);
768
+ const filteredFramesArr = stackFramesArr.filter(({ fileName }) => fileName && !this.vendors.test(fileName));
769
+ return filteredFramesArr
770
+ .map((stackFrame) => stackFrame.toString())
771
+ .join('\n');
772
+ }
773
+ getAdditionalInfo() {
774
+ const extractUrlHost = (url) => url.replace(/^https?:\/\/([^/?#]+).*$/i, '$1');
775
+ return {
776
+ location: {
777
+ url: this.window.location.href,
778
+ },
779
+ project: {
780
+ id: this.settingsService.project.id,
781
+ },
782
+ referrer: {
783
+ url: this.window.document.referrer,
784
+ },
785
+ viewport: {
786
+ width: this.window.document.documentElement.clientWidth,
787
+ height: this.window.document.documentElement.clientHeight,
788
+ },
789
+ cdn_address: this.settingsService.settings.cdnUrl
790
+ ? extractUrlHost(this.settingsService.settings.cdnUrl)
791
+ : 'none',
792
+ country: this.settingsService.user.country.value,
793
+ local: this.settingsService.user.country.localized_name,
794
+ };
795
+ }
796
+ removeErrorMetaFields(error) {
797
+ const metaPropList = [
798
+ 'parentTag',
799
+ 'childTag',
800
+ 'RESTRICTED_KEYS_REGEXP',
801
+ 'tags',
802
+ ];
803
+ Object.keys(error).forEach((key) => {
804
+ if (metaPropList.includes(key))
805
+ delete error[key];
806
+ });
807
+ // implementing own 'message' property from prototype
808
+ return { ...error, message: error.message };
809
+ }
810
+ sendLog(message, tags) {
811
+ const url = `https://logs-01.xsolla.com/tag/${tags.join(',')}`;
812
+ firstValueFrom(this.http.post(url, message, {
813
+ headers: new HttpHeaders().set('Content-Type', 'text/plain'),
814
+ responseType: 'text',
815
+ })).catch((err) => console.error('Elk Logger: request error', err));
816
+ }
817
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, deps: [{ token: windowToken }, { token: SettingsService }, { token: i1.HttpClient }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
818
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, providedIn: 'root' }); }
819
+ }
820
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, decorators: [{
821
+ type: Injectable,
822
+ args: [{
823
+ providedIn: 'root',
824
+ }]
825
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
826
+ type: Inject,
827
+ args: [windowToken]
828
+ }] }, { type: SettingsService }, { type: i1.HttpClient }, { type: i0.NgZone }] });
829
+
688
830
  const initializeResponseFactoryToken = new InjectionToken('InitializeResponse');
689
831
  const initializeResponseFactoryProvider = {
690
832
  provide: initializeResponseFactoryToken,
@@ -697,6 +839,7 @@ var UserBehaviourEventName;
697
839
  UserBehaviourEventName["showMethodHeader"] = "show-method-header";
698
840
  UserBehaviourEventName["showErrorMessage"] = "show-error-message";
699
841
  UserBehaviourEventName["openStatusError"] = "open-status-error";
842
+ UserBehaviourEventName["sysTrackedScripts"] = "sys-tracked_scripts";
700
843
  })(UserBehaviourEventName || (UserBehaviourEventName = {}));
701
844
 
702
845
  const userBehaviourEventTypes = {
@@ -1922,34 +2065,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
1922
2065
  args: [{ providedIn: 'root' }]
1923
2066
  }], ctorParameters: () => [{ type: UnescapeHtmlPipe }] });
1924
2067
 
1925
- var ErrorTags;
1926
- (function (ErrorTags) {
1927
- ErrorTags["APP"] = "appError";
1928
- ErrorTags["HTTP"] = "httpError";
1929
- ErrorTags["JS"] = "jsError";
1930
- ErrorTags["WS"] = "webSocket";
1931
- ErrorTags["ENCRYPT"] = "encrypt";
1932
- ErrorTags["APPLEPAY"] = "applepay";
1933
- ErrorTags["HEADLESS_UI"] = "headlessUi";
1934
- ErrorTags["GOOGLEPAY"] = "googlepay";
1935
- ErrorTags["PAYTM"] = "paytm";
1936
- })(ErrorTags || (ErrorTags = {}));
1937
-
1938
- class TaggedError extends Error {
1939
- constructor(message, tags) {
1940
- super(message);
1941
- this.tags = [];
1942
- this.parentTag = ErrorTags.HEADLESS_UI;
1943
- this.tags = this.childTag
1944
- ? [this.parentTag, this.childTag]
1945
- : [this.parentTag];
1946
- if (tags) {
1947
- const newTags = tags.filter((t, i, arr) => !this.tags.includes(t) && arr.indexOf(t) == i);
1948
- this.tags = [...this.tags, ...newTags];
1949
- }
1950
- }
1951
- }
1952
-
1953
2068
  class EncryptCreditCardError extends TaggedError {
1954
2069
  constructor(message, tags) {
1955
2070
  tags = tags ? [...tags, ErrorTags.ENCRYPT] : [ErrorTags.ENCRYPT];
@@ -2340,6 +2455,7 @@ var EventParameterType;
2340
2455
  EventParameterType["float"] = "2";
2341
2456
  EventParameterType["bool"] = "3";
2342
2457
  EventParameterType["intArray"] = "4";
2458
+ EventParameterType["stringArray"] = "5";
2343
2459
  })(EventParameterType || (EventParameterType = {}));
2344
2460
 
2345
2461
  class EventBuilderService {
@@ -2443,6 +2559,7 @@ class EventBuilderService {
2443
2559
  case EventParameterType.int:
2444
2560
  value = parseInt(String(value), 10);
2445
2561
  return isNaN(value) ? 0 : value;
2562
+ case EventParameterType.stringArray:
2446
2563
  case EventParameterType.intArray:
2447
2564
  return Array.isArray(value) ? value : [];
2448
2565
  case EventParameterType.float:
@@ -2936,6 +3053,8 @@ class SyncRequest extends XpsApiPartRequest {
2936
3053
  this.addXpsParameters({
2937
3054
  ...fieldsValues,
2938
3055
  change_element: changedField.name,
3056
+ fix_command: changedField.javascript?.change?.staticParams?.fix_command ??
3057
+ this.xps_fix_command,
2939
3058
  });
2940
3059
  }
2941
3060
  getFieldsValues(changedField, fields, form) {
@@ -3067,13 +3186,13 @@ class SyncService extends EmitDataService {
3067
3186
  const control = this.form.get(field.name);
3068
3187
  return control?.errors ?? null;
3069
3188
  }
3070
- async request(field) {
3189
+ async request(field, fields, form) {
3071
3190
  const paymentSettingsParams = this.paymentSettingsService.getPaymentSettingsParams(this.paymentConfiguration);
3072
3191
  const requestParams = this.requestFactory({
3073
3192
  token: this.settingsService.token,
3074
3193
  changedField: field,
3075
- fields: this.fields,
3076
- form: this.form,
3194
+ fields: fields ?? this.fields,
3195
+ form: form ?? this.form,
3077
3196
  ...paymentSettingsParams,
3078
3197
  });
3079
3198
  const encryptedRequest = this.encryptCreditCardService.encryptCreditCard(requestParams);
@@ -5146,6 +5265,9 @@ class FinanceDetailsService extends EmitDataService {
5146
5265
  super.emit(financeDetails);
5147
5266
  }
5148
5267
  }
5268
+ getDetailsFromSummary(summary) {
5269
+ return this.summaryFinanceDetailsAdapterService.getFinanceDetails(summary);
5270
+ }
5149
5271
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: FinanceDetailsService, deps: [{ token: SessionService }, { token: SummaryFinanceDetailsAdapterService }, { token: StatusFinanceDetailsAdapterService }], target: i0.ɵɵFactoryTarget.Injectable }); }
5150
5272
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: FinanceDetailsService, providedIn: 'root' }); }
5151
5273
  }
@@ -5365,117 +5487,6 @@ class WsError extends TaggedError {
5365
5487
  }
5366
5488
  }
5367
5489
 
5368
- class ElkLoggerService {
5369
- constructor(window, settingsService, http, ngZone) {
5370
- this.window = window;
5371
- this.settingsService = settingsService;
5372
- this.http = http;
5373
- this.ngZone = ngZone;
5374
- this.vendors = new RegExp('node_modules\\/(@angular|zone).*.js$');
5375
- this.stackTrace = this.loadStackTrace();
5376
- }
5377
- handleError(error) {
5378
- this.ngZone.runOutsideAngular(() => {
5379
- if (isDevMode()) {
5380
- console.error(error);
5381
- return;
5382
- }
5383
- this.parseError(error).catch(console.log);
5384
- });
5385
- }
5386
- log(message, tags, extra) {
5387
- const logTags = [ErrorTags.HEADLESS_UI, ...tags];
5388
- if (isDevMode()) {
5389
- console.log(message, tags);
5390
- return;
5391
- }
5392
- const logMessage = {
5393
- additionalInfo: this.getAdditionalInfo(),
5394
- extra,
5395
- message,
5396
- };
5397
- this.sendLog(logMessage, logTags);
5398
- }
5399
- async parseError(error) {
5400
- const errorObj = error instanceof TaggedError
5401
- ? error
5402
- : new TaggedError(error.message || error.toString());
5403
- errorObj.trace = await this.getErrorTrace(errorObj);
5404
- errorObj.additionalInfo = this.getAdditionalInfo();
5405
- const { tags } = errorObj;
5406
- const cleanError = this.removeErrorMetaFields(errorObj);
5407
- this.sendLog(cleanError, tags);
5408
- return errorObj;
5409
- }
5410
- async loadStackTrace() {
5411
- const library = await import('stacktrace-js');
5412
- return library.default;
5413
- }
5414
- async getErrorTrace(error) {
5415
- const stackTrace = await this.stackTrace;
5416
- const stackFramesArr = await stackTrace.fromError(error);
5417
- const filteredFramesArr = stackFramesArr.filter(({ fileName }) => fileName && !this.vendors.test(fileName));
5418
- return filteredFramesArr
5419
- .map((stackFrame) => stackFrame.toString())
5420
- .join('\n');
5421
- }
5422
- getAdditionalInfo() {
5423
- const extractUrlHost = (url) => url.replace(/^https?:\/\/([^/?#]+).*$/i, '$1');
5424
- return {
5425
- location: {
5426
- url: this.window.location.href,
5427
- },
5428
- project: {
5429
- id: this.settingsService.project.id,
5430
- },
5431
- referrer: {
5432
- url: this.window.document.referrer,
5433
- },
5434
- viewport: {
5435
- width: this.window.document.documentElement.clientWidth,
5436
- height: this.window.document.documentElement.clientHeight,
5437
- },
5438
- cdn_address: this.settingsService.settings.cdnUrl
5439
- ? extractUrlHost(this.settingsService.settings.cdnUrl)
5440
- : 'none',
5441
- country: this.settingsService.user.country.value,
5442
- local: this.settingsService.user.country.localized_name,
5443
- };
5444
- }
5445
- removeErrorMetaFields(error) {
5446
- const metaPropList = [
5447
- 'parentTag',
5448
- 'childTag',
5449
- 'RESTRICTED_KEYS_REGEXP',
5450
- 'tags',
5451
- ];
5452
- Object.keys(error).forEach((key) => {
5453
- if (metaPropList.includes(key))
5454
- delete error[key];
5455
- });
5456
- // implementing own 'message' property from prototype
5457
- return { ...error, message: error.message };
5458
- }
5459
- sendLog(message, tags) {
5460
- const url = `https://logs-01.xsolla.com/tag/${tags.join(',')}`;
5461
- firstValueFrom(this.http.post(url, message, {
5462
- headers: new HttpHeaders().set('Content-Type', 'text/plain'),
5463
- responseType: 'text',
5464
- })).catch((err) => console.error('Elk Logger: request error', err));
5465
- }
5466
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, deps: [{ token: windowToken }, { token: SettingsService }, { token: i1.HttpClient }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
5467
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, providedIn: 'root' }); }
5468
- }
5469
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, decorators: [{
5470
- type: Injectable,
5471
- args: [{
5472
- providedIn: 'root',
5473
- }]
5474
- }], ctorParameters: () => [{ type: undefined, decorators: [{
5475
- type: Inject,
5476
- args: [windowToken]
5477
- }] }, { type: SettingsService }, { type: i1.HttpClient }, { type: i0.NgZone }] });
5478
-
5479
5490
  class CentrifugoWebSocketService {
5480
5491
  static { this.reconnectionTimeoutIncrementFactor = 2; }
5481
5492
  static { this.timeoutsMs = {
@@ -6114,6 +6125,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
6114
6125
  }]
6115
6126
  }] });
6116
6127
 
6128
+ class InitializeSpecialButtonActionCreator {
6129
+ constructor(elkLoggerService) {
6130
+ this.elkLoggerService = elkLoggerService;
6131
+ this.type = 'special_button';
6132
+ this.pids = [googlePayPid];
6133
+ this.sdkPaymentMethodsName = new Map([
6134
+ [googlePayPid, 'google-pay'],
6135
+ ]);
6136
+ }
6137
+ getActionData(response) {
6138
+ return {
6139
+ type: this.type,
6140
+ data: {
6141
+ buttonName: this.getPaymentMethodName(response.paymentForm?.pid),
6142
+ },
6143
+ };
6144
+ }
6145
+ isSuitable(response) {
6146
+ if (!response.paymentForm)
6147
+ return false;
6148
+ const hasGooglePayInitDataField = response.paymentForm.fields.some((field) => field.name === FieldNames.googlePayInitData);
6149
+ return (this.pids.includes(response.paymentForm.pid) && hasGooglePayInitDataField);
6150
+ }
6151
+ getPaymentMethodName(pid = 0) {
6152
+ const buttonName = this.sdkPaymentMethodsName.get(pid);
6153
+ if (!buttonName) {
6154
+ this.elkLoggerService.log('No special button for provided pid', [ErrorTags.GOOGLEPAY], {
6155
+ pid,
6156
+ });
6157
+ throw new Error('Special button not found');
6158
+ }
6159
+ return buttonName;
6160
+ }
6161
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator, deps: [{ token: ElkLoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
6162
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator }); }
6163
+ }
6164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator, decorators: [{
6165
+ type: Injectable
6166
+ }], ctorParameters: () => [{ type: ElkLoggerService }] });
6167
+
6168
+ const initializeNextActionsToken = new InjectionToken('InitializeNextActions');
6169
+ const initializeNextActions = [
6170
+ InitializeSpecialButtonActionCreator,
6171
+ ];
6172
+
6173
+ class InitializeNextActionService {
6174
+ constructor(initializeNextActionTokens, injector) {
6175
+ this.initializeNextActionTokens = initializeNextActionTokens;
6176
+ this.injector = injector;
6177
+ this.initializeNextActionsList = [];
6178
+ this.fillNextActionsList();
6179
+ }
6180
+ getNextAction(response) {
6181
+ const nextAction = this.findNextAction(response);
6182
+ if (!nextAction)
6183
+ return null;
6184
+ return nextAction.getActionData(response);
6185
+ }
6186
+ fillNextActionsList() {
6187
+ this.initializeNextActionTokens.forEach((nextAction) => {
6188
+ const item = this.injector.get(nextAction);
6189
+ this.initializeNextActionsList.push(item);
6190
+ });
6191
+ }
6192
+ findNextAction(response) {
6193
+ return this.initializeNextActionsList.find((nextAction) => {
6194
+ return nextAction.isSuitable(response);
6195
+ });
6196
+ }
6197
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeNextActionService, deps: [{ token: initializeNextActionsToken }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
6198
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeNextActionService, providedIn: 'root' }); }
6199
+ }
6200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeNextActionService, decorators: [{
6201
+ type: Injectable,
6202
+ args: [{
6203
+ providedIn: 'root',
6204
+ }]
6205
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
6206
+ type: Inject,
6207
+ args: [initializeNextActionsToken]
6208
+ }] }, { type: i0.Injector }] });
6209
+
6117
6210
  var ThreeDsStatusWebSocketTypes;
6118
6211
  (function (ThreeDsStatusWebSocketTypes) {
6119
6212
  ThreeDsStatusWebSocketTypes["status3DS_changed"] = "status3DS_changed";
@@ -6605,7 +6698,8 @@ class PaymentService {
6605
6698
  get formResponseValue() {
6606
6699
  return this._formResponse$.getValue();
6607
6700
  }
6608
- constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, printInstructionService) {
6701
+ constructor(elkLoggerService, initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, initializeNextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, printInstructionService) {
6702
+ this.elkLoggerService = elkLoggerService;
6609
6703
  this.initializeService = initializeService;
6610
6704
  this.submitService = submitService;
6611
6705
  this.syncService = syncService;
@@ -6614,6 +6708,7 @@ class PaymentService {
6614
6708
  this.financeDetailsService = financeDetailsService;
6615
6709
  this.creditCardStateService = creditCardStateService;
6616
6710
  this.nextActionService = nextActionService;
6711
+ this.initializeNextActionService = initializeNextActionService;
6617
6712
  this.controlConfigService = controlConfigService;
6618
6713
  this.threeDsService = threeDsService;
6619
6714
  this.formMessagesService = formMessagesService;
@@ -6658,6 +6753,7 @@ class PaymentService {
6658
6753
  return {
6659
6754
  fields: this.fields.filter((field) => field?.isVisible === "1" /* XpsBoolean.true */),
6660
6755
  isFormAutoSubmitted: isNeedAutoSubmit,
6756
+ nextAction: this.initializeNextActionService.getNextAction(this.data),
6661
6757
  };
6662
6758
  }
6663
6759
  async submit() {
@@ -6689,6 +6785,26 @@ class PaymentService {
6689
6785
  this.syncService.setup(this.form, this.fields, this.config);
6690
6786
  return this.nextActionService.getNextAction(submitResponse);
6691
6787
  }
6788
+ async submitWithFields(fields) {
6789
+ if (!this.form) {
6790
+ this.elkLoggerService.log('submit error: trying to submit with no form', [
6791
+ ErrorTags.GOOGLEPAY,
6792
+ ]);
6793
+ throw new Error('form is empty!');
6794
+ }
6795
+ this.isSavingMethodMode = this.fields.some(({ name, value }) => name === 'savePsAccountOnly' && value === "1" /* XpsBoolean.true */);
6796
+ const submitResponse = await this.submitService.request(fields ?? this.fields, this.form, this.config);
6797
+ this.data = submitResponse;
6798
+ this.emitFormResponse(this.data);
6799
+ if (!this.isSavingMethodMode) {
6800
+ this.emitFinanceDetails(submitResponse.summary);
6801
+ }
6802
+ this.emitFormMessages(submitResponse.messages);
6803
+ this.fields = this.getFields();
6804
+ this.form = this.formService.createForm(this.fields);
6805
+ this.syncService.setup(this.form, this.fields, this.config);
6806
+ return submitResponse;
6807
+ }
6692
6808
  getFields() {
6693
6809
  if (this.data instanceof SubmitResponse) {
6694
6810
  return this.data.fields ?? [];
@@ -6706,17 +6822,21 @@ class PaymentService {
6706
6822
  status: control.status,
6707
6823
  };
6708
6824
  }
6709
- getInitialDataForSdkPaymentSystems() {
6710
- if (!isSubmitResponse(this.data)) {
6825
+ async getInitialDataForSdkPaymentSystems() {
6826
+ if (!this.data) {
6711
6827
  throw new Error('Should submit form first');
6712
6828
  }
6713
- return {
6714
- data: this.data.parameters.checkout.data.data,
6829
+ const sdkPaymentData = this.getSdkPaymentDataFromResponse(this.data);
6830
+ return Promise.resolve({
6831
+ data: sdkPaymentData.checkoutData,
6715
6832
  sandbox: this.settingsService.isSandboxMode()
6716
6833
  ? "1" /* XpsBoolean.true */
6717
6834
  : "0" /* XpsBoolean.false */,
6718
6835
  country: this.countryService.getCountry(),
6719
- };
6836
+ fields: sdkPaymentData.fields,
6837
+ submitResponse: isSubmitResponse(this.data) ? this.data : null,
6838
+ summary: sdkPaymentData.summary,
6839
+ });
6720
6840
  }
6721
6841
  getQrCode() {
6722
6842
  if (!isSubmitResponse(this.data)) {
@@ -6768,6 +6888,9 @@ class PaymentService {
6768
6888
  }
6769
6889
  return this.syncService.validate(field);
6770
6890
  }
6891
+ async calculateField(changedField, fields) {
6892
+ return this.syncService.request(changedField, fields, new FormGroup({}));
6893
+ }
6771
6894
  runThreeDs() {
6772
6895
  if (!isSubmitResponse(this.data)) {
6773
6896
  throw new Error('Should submit form first');
@@ -6972,7 +7095,21 @@ class PaymentService {
6972
7095
  (visibleFields.length === 0 &&
6973
7096
  suitablePids.includes(response.paymentForm.pid)));
6974
7097
  }
6975
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, deps: [{ token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }, { token: SettingsService }, { token: CountryService }, { token: CheckStatusActionCreator }, { token: PrintInstructionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
7098
+ getSdkPaymentDataFromResponse(data) {
7099
+ if (isSubmitResponse(data)) {
7100
+ return {
7101
+ checkoutData: data.parameters.checkout.data.data,
7102
+ fields: data.fields,
7103
+ summary: data.summary,
7104
+ };
7105
+ }
7106
+ return {
7107
+ checkoutData: null,
7108
+ fields: data.paymentForm?.fields ?? [],
7109
+ summary: data.paymentForm?.summary ?? null,
7110
+ };
7111
+ }
7112
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, deps: [{ token: ElkLoggerService }, { token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: InitializeNextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }, { token: SettingsService }, { token: CountryService }, { token: CheckStatusActionCreator }, { token: PrintInstructionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
6976
7113
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, providedIn: 'root' }); }
6977
7114
  }
6978
7115
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, decorators: [{
@@ -6980,7 +7117,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
6980
7117
  args: [{
6981
7118
  providedIn: 'root',
6982
7119
  }]
6983
- }], ctorParameters: () => [{ type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }, { type: SettingsService }, { type: CountryService }, { type: CheckStatusActionCreator }, { type: PrintInstructionService }] });
7120
+ }], ctorParameters: () => [{ type: ElkLoggerService }, { type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: InitializeNextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }, { type: SettingsService }, { type: CountryService }, { type: CheckStatusActionCreator }, { type: PrintInstructionService }] });
6984
7121
 
6985
7122
  const euCountries = new Set([
6986
7123
  'AT',
@@ -7537,8 +7674,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
7537
7674
  args: [sendInstructionStatusResponseFactoryToken]
7538
7675
  }] }] });
7539
7676
 
7677
+ class ScriptTrackerService {
7678
+ constructor(userBehaviourAnalyticsService) {
7679
+ this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
7680
+ this.currentScripts = new Set();
7681
+ this.scriptHostBlacklist = [
7682
+ 'https://cdn.xsolla.net/headless-checkout-prod',
7683
+ ];
7684
+ this.SCRIPT_DEBOUNCE_TIME_MS = 1000;
7685
+ this.scriptTracked$ = new Subject();
7686
+ }
7687
+ initScriptTracking(environment) {
7688
+ if (environment !== 'production') {
7689
+ return;
7690
+ }
7691
+ this.scriptTracked$
7692
+ .pipe(debounceTime(this.SCRIPT_DEBOUNCE_TIME_MS))
7693
+ .subscribe(() => this.handleScriptData());
7694
+ this.checkCurrentScripts();
7695
+ this.setupScriptObserver();
7696
+ }
7697
+ handleScriptData() {
7698
+ const scriptsData = this.getTrackedScripts();
7699
+ this.userBehaviourAnalyticsService.send(UserBehaviourEventName.sysTrackedScripts, userBehaviourEventTypes.manual, {
7700
+ value: scriptsData,
7701
+ valueType: EventParameterType.stringArray,
7702
+ });
7703
+ }
7704
+ getTrackedScripts() {
7705
+ return Array.from(this.currentScripts.values());
7706
+ }
7707
+ checkCurrentScripts() {
7708
+ const scripts = Array.from(document.getElementsByTagName('script'));
7709
+ scripts.forEach((script) => {
7710
+ this.trackScript(script);
7711
+ });
7712
+ }
7713
+ setupScriptObserver() {
7714
+ if (typeof MutationObserver === 'undefined') {
7715
+ return;
7716
+ }
7717
+ const observer = new MutationObserver((mutations) => {
7718
+ mutations.forEach((mutation) => {
7719
+ if (mutation.type !== 'childList') {
7720
+ return;
7721
+ }
7722
+ mutation.addedNodes.forEach((node) => {
7723
+ if (node.nodeName === 'SCRIPT') {
7724
+ this.trackScript(node);
7725
+ }
7726
+ });
7727
+ });
7728
+ });
7729
+ observer.observe(document.documentElement, {
7730
+ childList: true,
7731
+ subtree: true,
7732
+ });
7733
+ }
7734
+ trackScript(script) {
7735
+ if (!script.src || this.currentScripts.has(script.src)) {
7736
+ return;
7737
+ }
7738
+ const isScriptInBlacklist = this.scriptHostBlacklist.some((host) => {
7739
+ return script.src.includes(host);
7740
+ });
7741
+ if (isScriptInBlacklist) {
7742
+ return;
7743
+ }
7744
+ this.currentScripts.add(script.src);
7745
+ this.scriptTracked$.next();
7746
+ }
7747
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ScriptTrackerService, deps: [{ token: UserBehaviourAnalyticsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
7748
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ScriptTrackerService, providedIn: 'root' }); }
7749
+ }
7750
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ScriptTrackerService, decorators: [{
7751
+ type: Injectable,
7752
+ args: [{
7753
+ providedIn: 'root',
7754
+ }]
7755
+ }], ctorParameters: () => [{ type: UserBehaviourAnalyticsService }] });
7756
+
7540
7757
  class CoreLibraryService {
7541
- constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService) {
7758
+ constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService, scriptTrackerService) {
7542
7759
  this.settingsService = settingsService;
7543
7760
  this.countryService = countryService;
7544
7761
  this.paymentMethodsService = paymentMethodsService;
@@ -7560,6 +7777,7 @@ class CoreLibraryService {
7560
7777
  this.combinedPaymentMethodsService = combinedPaymentMethodsService;
7561
7778
  this.countriesApiService = countriesApiService;
7562
7779
  this.sendInstructionService = sendInstructionService;
7780
+ this.scriptTrackerService = scriptTrackerService;
7563
7781
  this.paymentMethods = {
7564
7782
  getList: async (isSaveMethodMode) => this.paymentMethodsService.getList(isSaveMethodMode),
7565
7783
  getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
@@ -7569,7 +7787,12 @@ class CoreLibraryService {
7569
7787
  deleteSavedMethod: async (id, type) => this.editSavedMethodsService.deleteSavedMethodRequest(id, type),
7570
7788
  };
7571
7789
  this.sdkPaymentSystems = {
7572
- getInitialData: () => this.paymentService.getInitialDataForSdkPaymentSystems(),
7790
+ getInitialData: async () => this.paymentService.getInitialDataForSdkPaymentSystems(),
7791
+ };
7792
+ this.finance = {
7793
+ getDetailsFromSummary: (summary) => {
7794
+ return this.financeDetailsService.getDetailsFromSummary(summary);
7795
+ },
7573
7796
  };
7574
7797
  }
7575
7798
  async init(configuration) {
@@ -7577,10 +7800,17 @@ class CoreLibraryService {
7577
7800
  this.performanceService.init();
7578
7801
  this.userBehaviourAnalyticsService.init();
7579
7802
  this.deviceFingerPrintService.init();
7803
+ this.scriptTrackerService.initScriptTracking(configuration.environment);
7580
7804
  }
7581
7805
  async getStatus(url) {
7582
7806
  return this.statusService.getStatusWithUrlSearchParams(url);
7583
7807
  }
7808
+ async calculateField(changedField, fields) {
7809
+ return this.paymentService.calculateField(changedField, fields);
7810
+ }
7811
+ async submit(fields) {
7812
+ return this.paymentService.submitWithFields(fields);
7813
+ }
7584
7814
  sendAnalytics(action, type, options) {
7585
7815
  this.userBehaviourAnalyticsService.send(action, type, options);
7586
7816
  }
@@ -7667,7 +7897,7 @@ class CoreLibraryService {
7667
7897
  get formResponseValue() {
7668
7898
  return this.paymentService.formResponseValue;
7669
7899
  }
7670
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }, { token: SendInstructionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
7900
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }, { token: SendInstructionService }, { token: ScriptTrackerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
7671
7901
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
7672
7902
  }
7673
7903
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, decorators: [{
@@ -7675,7 +7905,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
7675
7905
  args: [{
7676
7906
  providedIn: 'root',
7677
7907
  }]
7678
- }], ctorParameters: () => [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }, { type: SendInstructionService }] });
7908
+ }], ctorParameters: () => [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }, { type: SendInstructionService }, { type: ScriptTrackerService }] });
7679
7909
 
7680
7910
  class HttpError extends AppError {
7681
7911
  constructor(error, req) {
@@ -7860,7 +8090,12 @@ class CoreLibraryModule {
7860
8090
  provide: nextActionsToken,
7861
8091
  useValue: nextActions,
7862
8092
  },
8093
+ {
8094
+ provide: initializeNextActionsToken,
8095
+ useValue: initializeNextActions,
8096
+ },
7863
8097
  ...nextActions,
8098
+ ...initializeNextActions,
7864
8099
  ...flowUpdateNextActions,
7865
8100
  printInstructionRequestFactoryProvider,
7866
8101
  sendInstructionRequestFactoryProvider,
@@ -7897,7 +8132,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
7897
8132
  provide: nextActionsToken,
7898
8133
  useValue: nextActions,
7899
8134
  },
8135
+ {
8136
+ provide: initializeNextActionsToken,
8137
+ useValue: initializeNextActions,
8138
+ },
7900
8139
  ...nextActions,
8140
+ ...initializeNextActions,
7901
8141
  ...flowUpdateNextActions,
7902
8142
  printInstructionRequestFactoryProvider,
7903
8143
  sendInstructionRequestFactoryProvider,
@@ -7984,6 +8224,195 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
7984
8224
  args: [windowToken]
7985
8225
  }] }] });
7986
8226
 
8227
+ class GooglePayCheckoutPaymentService {
8228
+ constructor(paymentSystemProcessingService) {
8229
+ this.paymentSystemProcessingService = paymentSystemProcessingService;
8230
+ this.checkout = null;
8231
+ }
8232
+ preparePayment({ initParams, checkDeviceData, }) {
8233
+ if (!initParams || !checkDeviceData.base64checkoutData)
8234
+ return null;
8235
+ this.initParams = initParams;
8236
+ this.checkout =
8237
+ this.paymentSystemProcessingService.getDecodedCheckout(checkDeviceData.base64checkoutData);
8238
+ if (!this.checkout)
8239
+ return null;
8240
+ const checkoutData = this.checkout.request.form.fields;
8241
+ const paymentDataRequest = JSON.parse(checkoutData.paymentDataRequest);
8242
+ const isReadyToPayRequest = JSON.parse(checkoutData.isReadyToPayRequest);
8243
+ const result = { paymentDataRequest, isReadyToPayRequest };
8244
+ if (checkoutData.amexCardNotification) {
8245
+ result.amexCardNotification = JSON.parse(checkoutData.amexCardNotification);
8246
+ }
8247
+ return result;
8248
+ }
8249
+ getPaymentRequest() {
8250
+ if (!this.checkout)
8251
+ return null;
8252
+ const checkoutData = this.checkout.request.form.fields;
8253
+ const paymentDataRequest = JSON.parse(checkoutData.paymentDataRequest);
8254
+ paymentDataRequest.transactionInfo = {
8255
+ currencyCode: checkoutData.currency,
8256
+ totalPriceStatus: 'FINAL',
8257
+ totalPrice: checkoutData.sum?.toString(),
8258
+ countryCode: this.initParams.country.toUpperCase(),
8259
+ };
8260
+ return paymentDataRequest;
8261
+ }
8262
+ getAllowedPaymentMethods() {
8263
+ if (!this.checkout)
8264
+ return [];
8265
+ const paymentDataRequest = JSON.parse(this.checkout.request.form.fields.paymentDataRequest);
8266
+ return paymentDataRequest.allowedPaymentMethods;
8267
+ }
8268
+ handleSuccessfulPayment(response) {
8269
+ if (!this.checkout)
8270
+ return;
8271
+ let returnUrl = this.checkout.request.form.fields.returnSuccessUrl;
8272
+ const data = this.checkout.request.form.fields;
8273
+ returnUrl += `&cpf_number=${data.cpf_number}&descriptor=${data.descriptor}&paymentData=${JSON.stringify(response)}`;
8274
+ this.paymentSystemProcessingService.emitStatusUrl(returnUrl);
8275
+ }
8276
+ handleFailedPayment(error) {
8277
+ if (!this.checkout)
8278
+ return;
8279
+ const statusCode = error?.statusCode;
8280
+ const isStatusCanceled = statusCode && this.isCancelledStatus(statusCode);
8281
+ if (isStatusCanceled)
8282
+ return;
8283
+ const returnUrl = this.checkout.request.form.fields.returnFailUrl;
8284
+ this.paymentSystemProcessingService.emitStatusUrl(returnUrl);
8285
+ }
8286
+ isCancelledStatus(statusCode) {
8287
+ return statusCode.toLowerCase() === 'canceled';
8288
+ }
8289
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayCheckoutPaymentService, deps: [{ token: PaymentSystemProcessingService }], target: i0.ɵɵFactoryTarget.Injectable }); }
8290
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayCheckoutPaymentService, providedIn: 'root' }); }
8291
+ }
8292
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayCheckoutPaymentService, decorators: [{
8293
+ type: Injectable,
8294
+ args: [{
8295
+ providedIn: 'root',
8296
+ }]
8297
+ }], ctorParameters: () => [{ type: PaymentSystemProcessingService }] });
8298
+
8299
+ class GooglePayInstantPaymentService {
8300
+ constructor(summaryFinanceDetailsAdapterService) {
8301
+ this.summaryFinanceDetailsAdapterService = summaryFinanceDetailsAdapterService;
8302
+ this.googleInitData = null;
8303
+ }
8304
+ preparePayment({ initParams, checkDeviceData, }) {
8305
+ if (!initParams)
8306
+ return null;
8307
+ this.initParams = initParams;
8308
+ this.googleInitData = this.extractGoogleInitData(initParams.fields);
8309
+ if (!this.googleInitData)
8310
+ return null;
8311
+ const displayItems = checkDeviceData.summary
8312
+ ? this.getItemsTaxes(checkDeviceData.summary)
8313
+ : [];
8314
+ this.googleInitData.paymentDataRequest = {
8315
+ ...this.googleInitData.paymentDataRequest,
8316
+ transactionInfo: {
8317
+ ...this.googleInitData.paymentDataRequest.transactionInfo,
8318
+ totalPriceStatus: 'ESTIMATED',
8319
+ totalPrice: this.googleInitData.paymentDataRequest.transactionInfo.totalPrice?.toString(),
8320
+ countryCode: initParams.country.toUpperCase() ??
8321
+ this.googleInitData.paymentDataRequest.transactionInfo.countryCode?.toUpperCase(),
8322
+ totalPriceLabel: this.googleInitData.paymentDataRequest.transactionInfo
8323
+ .totalPriceLabel ?? 'Total',
8324
+ displayItems,
8325
+ },
8326
+ shippingAddressRequired: true,
8327
+ callbackIntents: ['SHIPPING_ADDRESS', 'PAYMENT_AUTHORIZATION'],
8328
+ };
8329
+ return this.googleInitData;
8330
+ }
8331
+ getPaymentRequest() {
8332
+ if (!this.googleInitData)
8333
+ return null;
8334
+ return {
8335
+ ...this.googleInitData.paymentDataRequest,
8336
+ transactionInfo: {
8337
+ ...this.googleInitData.paymentDataRequest.transactionInfo,
8338
+ totalPriceStatus: 'ESTIMATED',
8339
+ totalPrice: this.googleInitData.paymentDataRequest.transactionInfo.totalPrice?.toString(),
8340
+ countryCode: this.initParams.country.toUpperCase() ??
8341
+ this.googleInitData.paymentDataRequest.transactionInfo.countryCode?.toUpperCase(),
8342
+ },
8343
+ shippingAddressRequired: true,
8344
+ callbackIntents: ['SHIPPING_ADDRESS', 'PAYMENT_AUTHORIZATION'],
8345
+ };
8346
+ }
8347
+ getAllowedPaymentMethods() {
8348
+ if (!this.googleInitData)
8349
+ return [];
8350
+ return this.googleInitData.paymentDataRequest.allowedPaymentMethods;
8351
+ }
8352
+ extractGoogleInitData(fields) {
8353
+ try {
8354
+ const googlePayInitData = fields.filter((field) => field.name === FieldNames.googlePayInitData)[0]?.value;
8355
+ const data = JSON.parse(googlePayInitData ?? null);
8356
+ return data;
8357
+ }
8358
+ catch (error) {
8359
+ return null;
8360
+ }
8361
+ }
8362
+ getItemsTaxes(summary) {
8363
+ const financeResponse = this.summaryFinanceDetailsAdapterService.getFinanceDetails(summary);
8364
+ const newCartPricing = financeResponse.cartSummary;
8365
+ if (!newCartPricing.total?.money?.amount || !financeResponse.finance) {
8366
+ return [];
8367
+ }
8368
+ const newPrice = {
8369
+ total: this.getTotalAmount(financeResponse.finance),
8370
+ subtotalDetails: newCartPricing.subtotalDetails,
8371
+ subtotalPayment: newCartPricing.subtotalPayment,
8372
+ totalDetails: newCartPricing.totalDetails,
8373
+ };
8374
+ const displayItems = [];
8375
+ if (newPrice.subtotalPayment?.money?.amount) {
8376
+ displayItems.push({
8377
+ label: newPrice.subtotalPayment.title || 'Subtotal',
8378
+ amount: newPrice.subtotalPayment.money?.amount.toString(),
8379
+ });
8380
+ }
8381
+ let paymentsDetails = [];
8382
+ if (newPrice.subtotalDetails?.length) {
8383
+ paymentsDetails = newPrice.subtotalDetails;
8384
+ }
8385
+ if (newPrice.totalDetails?.length) {
8386
+ paymentsDetails = paymentsDetails.concat(newPrice.totalDetails);
8387
+ }
8388
+ paymentsDetails.forEach((cartItem) => {
8389
+ if (!cartItem.title || !cartItem.money?.amount) {
8390
+ return;
8391
+ }
8392
+ displayItems.push({
8393
+ label: cartItem.title,
8394
+ amount: cartItem.money.amount.toString(),
8395
+ });
8396
+ });
8397
+ return displayItems.map((item) => ({
8398
+ label: item.label ?? '',
8399
+ type: 'TAX',
8400
+ price: item.amount,
8401
+ }));
8402
+ }
8403
+ getTotalAmount(finance) {
8404
+ return finance?.grand_total?.amount ?? finance?.total?.amount;
8405
+ }
8406
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayInstantPaymentService, deps: [{ token: SummaryFinanceDetailsAdapterService }], target: i0.ɵɵFactoryTarget.Injectable }); }
8407
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayInstantPaymentService, providedIn: 'root' }); }
8408
+ }
8409
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayInstantPaymentService, decorators: [{
8410
+ type: Injectable,
8411
+ args: [{
8412
+ providedIn: 'root',
8413
+ }]
8414
+ }], ctorParameters: () => [{ type: SummaryFinanceDetailsAdapterService }] });
8415
+
7987
8416
  class GooglePayService {
7988
8417
  get libraryWasInitialized() {
7989
8418
  return !!this.window.google;
@@ -7991,14 +8420,17 @@ class GooglePayService {
7991
8420
  get googlePaymentClientWasInitialized() {
7992
8421
  return !!this.googlePaymentClient;
7993
8422
  }
7994
- constructor(window, paymentSystemProcessingService, injector) {
8423
+ constructor(window, elkLoggerService, paymentSystemProcessingService, googlePayCheckoutPaymentService, googlePayInstantPaymentService, injector) {
7995
8424
  this.window = window;
8425
+ this.elkLoggerService = elkLoggerService;
7996
8426
  this.paymentSystemProcessingService = paymentSystemProcessingService;
8427
+ this.googlePayCheckoutPaymentService = googlePayCheckoutPaymentService;
8428
+ this.googlePayInstantPaymentService = googlePayInstantPaymentService;
7997
8429
  this.injector = injector;
7998
8430
  this.googlePayScriptUrl = 'https://pay.google.com/gp/p/js/pay.js';
7999
8431
  this.readyToPay = new BehaviorSubject(null);
8000
- this.checkout = null;
8001
8432
  this.googlePaymentClient = null;
8433
+ this.paymentService = null;
8002
8434
  }
8003
8435
  get readyToPay$() {
8004
8436
  return this.readyToPay.asObservable();
@@ -8007,8 +8439,9 @@ class GooglePayService {
8007
8439
  return this.readyToPay.getValue();
8008
8440
  }
8009
8441
  initGooglePayLibrary(data) {
8010
- this.isSandbox = data.isSandbox;
8011
- this.country = data.country;
8442
+ this.initParams = data;
8443
+ this.onPaymentDataChanged = data.onPaymentDataChanged;
8444
+ this.onPaymentAuthorized = data.onPaymentAuthorized;
8012
8445
  if (this.libraryWasInitialized && this.googlePaymentClientWasInitialized) {
8013
8446
  return;
8014
8447
  }
@@ -8018,28 +8451,36 @@ class GooglePayService {
8018
8451
  }
8019
8452
  this.paymentSystemProcessingService.loadScript(this.googlePayScriptUrl, this.onLoadScript.bind(this));
8020
8453
  }
8021
- checkPaymentDevice(base64checkoutData) {
8454
+ checkPaymentDevice(data) {
8022
8455
  this.paymentSystemProcessingService.initialize$
8023
8456
  .pipe(filter$1(Boolean), take(1))
8024
8457
  .subscribe(() => {
8025
- this.checkout =
8026
- this.paymentSystemProcessingService.getDecodedCheckout(base64checkoutData);
8027
- if (!this.checkout || !this.googlePaymentClient) {
8028
- throw new AppError(`Google Pay: no checkout or google payment client, checkout - ${Boolean(this.checkout).toString()}, client - ${Boolean(this.googlePaymentClient).toString()}`);
8458
+ if (!this.googlePaymentClient) {
8459
+ this.elkLoggerService.log('Google payment client is not initialized', [ErrorTags.GOOGLEPAY]);
8460
+ throw new AppError(`Google Pay: Google payment client is not initialized`);
8461
+ }
8462
+ this.paymentService = this.getPaymentService();
8463
+ const initData = this.paymentService.preparePayment({
8464
+ initParams: this.initParams,
8465
+ checkDeviceData: data,
8466
+ });
8467
+ if (!initData) {
8468
+ this.elkLoggerService.log('No initialization data', [
8469
+ ErrorTags.GOOGLEPAY,
8470
+ ]);
8471
+ throw new AppError('Google Pay: no initialization data');
8029
8472
  }
8030
- const checkoutData = this.checkout.request.form.fields;
8031
- const isReadyToPayRequest = JSON.parse(checkoutData.isReadyToPayRequest);
8032
8473
  this.googlePaymentClient
8033
- .isReadyToPay(isReadyToPayRequest)
8474
+ .isReadyToPay(initData.isReadyToPayRequest)
8034
8475
  .then((response) => {
8035
8476
  if (response.result && this.googlePaymentClient) {
8036
- this.googlePaymentClient.prefetchPaymentData(JSON.parse(checkoutData.paymentDataRequest));
8477
+ this.googlePaymentClient.prefetchPaymentData(initData.paymentDataRequest);
8037
8478
  return this.readyToPay.next(true);
8038
8479
  }
8039
8480
  this.readyToPay.next(false);
8040
8481
  const result = response.result?.toString() ?? '';
8041
8482
  const isHavePaymentClient = Boolean(this.googlePaymentClient).toString();
8042
- throw new Error(`Google Pay: possibly no response.result or googlePaymentClient is missing, result - ${result}, isHavePaymentClient - ${isHavePaymentClient}`);
8483
+ throw new AppError(`Google Pay: possibly no response.result or googlePaymentClient is missing, result - ${result}, isHavePaymentClient - ${isHavePaymentClient}`);
8043
8484
  })
8044
8485
  .catch((error) => {
8045
8486
  this.readyToPay.next(false);
@@ -8052,60 +8493,46 @@ class GooglePayService {
8052
8493
  });
8053
8494
  }
8054
8495
  async proceedCheckout() {
8055
- if (!this.checkout || !this.googlePaymentClient) {
8056
- const isHaveCheckout = !!this.checkout;
8057
- const isHaveClient = !!this.googlePaymentClient;
8058
- throw new AppError(`Google Pay: no checkout or google payment client, checkout - ${isHaveCheckout.toString()}, client - ${isHaveClient.toString()}`);
8496
+ if (!this.googlePaymentClient) {
8497
+ this.elkLoggerService.log('Google payment client is not initialized to proceed checkout', [ErrorTags.GOOGLEPAY]);
8498
+ throw new AppError(`Google Pay. proceedCheckout: no google payment client`);
8499
+ }
8500
+ if (!this.paymentService) {
8501
+ this.elkLoggerService.log('Google payment service is not initialized to proceed checkout', [ErrorTags.GOOGLEPAY]);
8502
+ throw new AppError(`Google Pay. proceedCheckout: no google payment service`);
8503
+ }
8504
+ const paymentDataRequest = this.paymentService.getPaymentRequest();
8505
+ if (!paymentDataRequest) {
8506
+ this.elkLoggerService.log('No data for payment data request', [
8507
+ ErrorTags.GOOGLEPAY,
8508
+ ]);
8509
+ throw new AppError(`Google Pay: No data for payment data request`);
8059
8510
  }
8060
- const checkoutData = this.checkout.request.form.fields;
8061
- const paymentDataRequest = JSON.parse(checkoutData.paymentDataRequest);
8062
- paymentDataRequest.transactionInfo = {
8063
- currencyCode: checkoutData.currency,
8064
- totalPriceStatus: 'FINAL',
8065
- totalPrice: checkoutData.sum,
8066
- countryCode: this.country,
8067
- };
8068
8511
  const checkStatusAction = this.injector
8069
8512
  .get(CheckStatusActionCreator)
8070
8513
  .getActionData();
8071
8514
  try {
8072
8515
  const paymentData = await this.googlePaymentClient.loadPaymentData(paymentDataRequest);
8073
8516
  if (!paymentData?.paymentMethodData?.tokenizationData?.token) {
8517
+ this.elkLoggerService.log('Token is missing', [ErrorTags.GOOGLEPAY]);
8074
8518
  throw new AppError('Google Pay: token is missing');
8075
8519
  }
8076
- if (!this.checkout) {
8077
- throw new AppError('Google Pay: no checkout data in then');
8078
- }
8079
- let returnUrl = this.checkout.request.form.fields.returnSuccessUrl;
8080
- const data = this.checkout.request.form.fields;
8081
- returnUrl += `&cpf_number=${data.cpf_number}&descriptor=${data.descriptor}&paymentData=${JSON.stringify(paymentData)}`;
8082
- this.paymentSystemProcessingService.emitStatusUrl(returnUrl);
8520
+ this.paymentService.handleSuccessfulPayment?.(paymentData);
8083
8521
  return checkStatusAction;
8084
8522
  }
8085
8523
  catch (error) {
8086
- if (!this.checkout) {
8087
- throw new AppError(`Google Pay: no checkout data`);
8088
- }
8089
- const statusCode = error
8090
- ?.statusCode;
8091
- const isStatusCanceled = statusCode && this.isCancelledStatus(statusCode);
8092
- if (isStatusCanceled) {
8093
- return null;
8094
- }
8095
- const returnUrl = this.checkout.request.form.fields.returnFailUrl;
8096
- this.paymentSystemProcessingService.emitStatusUrl(returnUrl);
8524
+ this.paymentService.handleFailedPayment?.(error);
8097
8525
  return checkStatusAction;
8098
8526
  }
8099
8527
  }
8100
8528
  createButton(onClickHandler, buttonColor = 'default') {
8101
- if (!this.checkout || !this.googlePaymentClient) {
8529
+ if (!this.googlePaymentClient) {
8102
8530
  return null;
8103
8531
  }
8104
- const checkoutData = this.checkout.request.form.fields;
8105
- const paymentDataRequest = JSON.parse(checkoutData.paymentDataRequest);
8532
+ const allowedPaymentMethods = this.paymentService?.getAllowedPaymentMethods() || [];
8106
8533
  return this.googlePaymentClient.createButton({
8107
8534
  onClick: onClickHandler,
8108
- allowedPaymentMethods: paymentDataRequest.allowedPaymentMethods,
8535
+ allowedPaymentMethods: allowedPaymentMethods,
8109
8536
  buttonSizeMode: 'fill',
8110
8537
  buttonType: 'buy',
8111
8538
  buttonColor,
@@ -8115,11 +8542,18 @@ class GooglePayService {
8115
8542
  if (!this.window.google) {
8116
8543
  return;
8117
8544
  }
8118
- const environment = this.isSandbox ? 'TEST' : 'PRODUCTION';
8545
+ const environment = this.initParams.isSandbox ? 'TEST' : 'PRODUCTION';
8546
+ const googlePaymentClientData = {
8547
+ environment,
8548
+ };
8549
+ if (this.initParams.isInstantPayFlow) {
8550
+ googlePaymentClientData.paymentDataCallbacks = {
8551
+ onPaymentDataChanged: this.onPaymentDataChanged,
8552
+ onPaymentAuthorized: this.onPaymentAuthorized,
8553
+ };
8554
+ }
8119
8555
  this.googlePaymentClient =
8120
- new this.window.google.payments.api.PaymentsClient({
8121
- environment,
8122
- });
8556
+ new this.window.google.payments.api.PaymentsClient(googlePaymentClientData);
8123
8557
  }
8124
8558
  onLoadScript() {
8125
8559
  if (!this.window.google) {
@@ -8138,10 +8572,12 @@ class GooglePayService {
8138
8572
  this.paymentSystemProcessingService.emitInitialize(true);
8139
8573
  }
8140
8574
  }
8141
- isCancelledStatus(statusCode) {
8142
- return statusCode.toLowerCase() === 'canceled';
8575
+ getPaymentService() {
8576
+ if (this.initParams.isInstantPayFlow)
8577
+ return this.googlePayInstantPaymentService;
8578
+ return this.googlePayCheckoutPaymentService;
8143
8579
  }
8144
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token: PaymentSystemProcessingService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
8580
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token: ElkLoggerService }, { token: PaymentSystemProcessingService }, { token: GooglePayCheckoutPaymentService }, { token: GooglePayInstantPaymentService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
8145
8581
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, providedIn: 'root' }); }
8146
8582
  }
8147
8583
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, decorators: [{
@@ -8152,7 +8588,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
8152
8588
  }], ctorParameters: () => [{ type: undefined, decorators: [{
8153
8589
  type: Inject,
8154
8590
  args: [windowToken]
8155
- }] }, { type: PaymentSystemProcessingService }, { type: i0.Injector }] });
8591
+ }] }, { type: ElkLoggerService }, { type: PaymentSystemProcessingService }, { type: GooglePayCheckoutPaymentService }, { type: GooglePayInstantPaymentService }, { type: i0.Injector }] });
8156
8592
 
8157
8593
  const applePayVersion = 3;
8158
8594