@xsolla/payment-client-core 0.2.74 → 0.2.76
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.
- package/esm2022/lib/core/exceptions-handling/common-log-attributes/common-log-attributes.interface.mjs +2 -0
- package/esm2022/lib/core/exceptions-handling/common-log-attributes/common-log-attributes.service.mjs +50 -0
- package/esm2022/lib/core/exceptions-handling/elk/additional-info.interface.mjs +1 -1
- package/esm2022/lib/core/exceptions-handling/elk/elk-logger.service.mjs +17 -23
- package/esm2022/lib/core/exceptions-handling/elk/log-message.interface.mjs +1 -1
- package/esm2022/lib/core/exceptions-handling/errors/index.mjs +3 -0
- package/esm2022/lib/core/exceptions-handling/errors/tagged-error.class.mjs +3 -2
- package/esm2022/lib/core/exceptions-handling/logger/index.mjs +2 -0
- package/esm2022/lib/core/exceptions-handling/logger/log-handler.interface.mjs +2 -0
- package/esm2022/lib/core/exceptions-handling/logger/logger.service.mjs +25 -0
- package/esm2022/lib/core/payment/form/converters/cpf-number/cpf-number.converter.mjs +5 -1
- package/esm2022/lib/core/payment/form/validators/cpf-formula-validator/cpf-formula.validator.mjs +55 -0
- package/esm2022/lib/core/payment/initialize-actions/special-button/special-button.action.class.mjs +9 -8
- package/esm2022/lib/core/payment/payment-behaviour/behaviour-strategies.mjs +5 -1
- package/esm2022/lib/core/payment/payment-behaviour/strategies/behaviour-strategy.abstract.mjs +5 -1
- package/esm2022/lib/core/payment/payment-behaviour/strategies/google-pay-instant-flow/google-pay-instant-flow.strategy.mjs +41 -0
- package/esm2022/lib/core/payment/payment-behaviour/strategies/google-pay-regular-flow/google-pay-regular-flow.strategy.mjs +36 -0
- package/esm2022/lib/core/payment/payment.service.mjs +18 -15
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay-sdk.service.mjs +7 -6
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.mjs +9 -8
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.mjs +9 -8
- package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +16 -15
- package/esm2022/lib/core/settings/settings.service.mjs +10 -1
- package/esm2022/lib/core/web-socket/centrifugo-web-socket.service.mjs +19 -18
- package/esm2022/lib/core-library.service.mjs +36 -26
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/xsolla-payment-client-core.mjs +1221 -1012
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/exceptions-handling/common-log-attributes/common-log-attributes.interface.d.ts +16 -0
- package/lib/core/exceptions-handling/common-log-attributes/common-log-attributes.service.d.ts +15 -0
- package/lib/core/exceptions-handling/elk/additional-info.interface.d.ts +2 -1
- package/lib/core/exceptions-handling/elk/elk-logger.service.d.ts +4 -8
- package/lib/core/exceptions-handling/elk/log-message.interface.d.ts +1 -3
- package/lib/core/exceptions-handling/errors/index.d.ts +2 -0
- package/lib/core/exceptions-handling/errors/tagged-error.class.d.ts +2 -1
- package/lib/core/exceptions-handling/logger/index.d.ts +1 -0
- package/lib/core/exceptions-handling/logger/log-handler.interface.d.ts +4 -0
- package/lib/core/exceptions-handling/logger/logger.service.d.ts +13 -0
- package/lib/core/payment/form/converters/cpf-number/cpf-number.converter.d.ts +2 -0
- package/lib/core/payment/form/validators/cpf-formula-validator/cpf-formula.validator.d.ts +6 -0
- package/lib/core/payment/initialize-actions/special-button/special-button.action.class.d.ts +3 -3
- package/lib/core/payment/payment-behaviour/strategies/behaviour-strategy.abstract.d.ts +2 -1
- package/lib/core/payment/payment-behaviour/strategies/google-pay-instant-flow/google-pay-instant-flow.strategy.d.ts +10 -0
- package/lib/core/payment/payment-behaviour/strategies/google-pay-regular-flow/google-pay-regular-flow.strategy.d.ts +10 -0
- package/lib/core/payment/payment.service.d.ts +4 -3
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay-sdk.service.d.ts +2 -2
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.d.ts +3 -3
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.d.ts +3 -3
- package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +3 -3
- package/lib/core/settings/settings.service.d.ts +3 -0
- package/lib/core/web-socket/centrifugo-web-socket.service.d.ts +3 -3
- package/lib/core-library.service.d.ts +9 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/xsolla-payment-client-core-0.2.76.tgz +0 -0
- package/xsolla-payment-client-core-0.2.74.tgz +0 -0
|
@@ -6,7 +6,7 @@ import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS, provideHt
|
|
|
6
6
|
import { UntypedFormGroup, Validators, UntypedFormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import JSEncrypt from 'jsencrypt';
|
|
8
8
|
import { filter, map as map$1, tap, debounce, debounceTime, catchError } from 'rxjs/operators';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i24 from '@ngx-translate/core';
|
|
10
10
|
import { provideTranslateService, MissingTranslationHandler } from '@ngx-translate/core';
|
|
11
11
|
import * as i1$1 from '@angular/router';
|
|
12
12
|
import { CommonModule } from '@angular/common';
|
|
@@ -141,6 +141,15 @@ class SettingsService {
|
|
|
141
141
|
get unsafeUtilsResponse() {
|
|
142
142
|
return this.response ?? null;
|
|
143
143
|
}
|
|
144
|
+
get unsafeUser() {
|
|
145
|
+
return this.response?.user ?? null;
|
|
146
|
+
}
|
|
147
|
+
get unsafeProject() {
|
|
148
|
+
return this.response?.project ?? null;
|
|
149
|
+
}
|
|
150
|
+
get unsafeSettings() {
|
|
151
|
+
return this.response?.settings ?? null;
|
|
152
|
+
}
|
|
144
153
|
get isEmpty() {
|
|
145
154
|
return !this.response;
|
|
146
155
|
}
|
|
@@ -197,782 +206,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
197
206
|
}]
|
|
198
207
|
}], ctorParameters: () => [{ type: SecureApiClient }] });
|
|
199
208
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
getCountry() {
|
|
213
|
-
return this.userDefinedCountry ?? this.getTokenCountry();
|
|
214
|
-
}
|
|
215
|
-
getTokenCountry() {
|
|
216
|
-
return this.settingsService.user.country.value;
|
|
217
|
-
}
|
|
218
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
219
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, providedIn: 'root' }); }
|
|
220
|
-
}
|
|
221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, decorators: [{
|
|
222
|
-
type: Injectable,
|
|
223
|
-
args: [{
|
|
224
|
-
providedIn: 'root',
|
|
225
|
-
}]
|
|
226
|
-
}], ctorParameters: () => [{ type: SettingsService }] });
|
|
227
|
-
|
|
228
|
-
class ResponseError extends AppError {
|
|
229
|
-
constructor(message) {
|
|
230
|
-
super('Response failed' + (message ? `: "${message}".` : '.'));
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
var BooleanNumber;
|
|
235
|
-
(function (BooleanNumber) {
|
|
236
|
-
BooleanNumber[BooleanNumber["false"] = 0] = "false";
|
|
237
|
-
BooleanNumber[BooleanNumber["true"] = 1] = "true";
|
|
238
|
-
})(BooleanNumber || (BooleanNumber = {}));
|
|
239
|
-
|
|
240
|
-
class PaymentMethodsResponse {
|
|
241
|
-
constructor(paymentMethods) {
|
|
242
|
-
this.especial = paymentMethods.especial.map((method) => this.mapPaymentMethod(method));
|
|
243
|
-
this.top = paymentMethods.top.map((method) => this.mapPaymentMethod(method));
|
|
244
|
-
this.remained = paymentMethods.remained.map((method) => this.mapPaymentMethod(method));
|
|
245
|
-
this.remainedCount = {
|
|
246
|
-
total: paymentMethods.remained_count.total,
|
|
247
|
-
visible: paymentMethods.remained_count.visible,
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
mapPaymentMethod(method) {
|
|
251
|
-
return {
|
|
252
|
-
id: method.id,
|
|
253
|
-
rank: method.rank,
|
|
254
|
-
name: method.name,
|
|
255
|
-
aliases: method.aliases,
|
|
256
|
-
categories: method.cat,
|
|
257
|
-
recommended: method.recommended === BooleanNumber.true,
|
|
258
|
-
enabledSaveAccount: method.enabled_save_account,
|
|
259
|
-
iconName: method.switch_icon_name,
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const paymentMethodsResponseFactoryToken = new InjectionToken('PaymentMethodsResponse');
|
|
265
|
-
const paymentMethodsResponseFactoryProvider = {
|
|
266
|
-
provide: paymentMethodsResponseFactoryToken,
|
|
267
|
-
useValue: (...args) => new PaymentMethodsResponse(...args),
|
|
268
|
-
};
|
|
209
|
+
var ErrorTags;
|
|
210
|
+
(function (ErrorTags) {
|
|
211
|
+
ErrorTags["APP"] = "appError";
|
|
212
|
+
ErrorTags["HTTP"] = "httpError";
|
|
213
|
+
ErrorTags["JS"] = "jsError";
|
|
214
|
+
ErrorTags["WS"] = "webSocket";
|
|
215
|
+
ErrorTags["ENCRYPT"] = "encrypt";
|
|
216
|
+
ErrorTags["APPLEPAY"] = "applepay";
|
|
217
|
+
ErrorTags["HEADLESS_UI"] = "headlessUi";
|
|
218
|
+
ErrorTags["GOOGLEPAY"] = "googlepay";
|
|
219
|
+
ErrorTags["PAYTM"] = "paytm";
|
|
220
|
+
})(ErrorTags || (ErrorTags = {}));
|
|
269
221
|
|
|
270
|
-
class
|
|
271
|
-
constructor(
|
|
272
|
-
|
|
273
|
-
this.
|
|
274
|
-
this.
|
|
275
|
-
this.
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
async getList(isSaveMethodMode) {
|
|
283
|
-
const response = await this.request(isSaveMethodMode);
|
|
284
|
-
if (this.isFixedPaymentMethod) {
|
|
285
|
-
return this.filterMethodsByFixedPaymentMethod(response.remained);
|
|
286
|
-
}
|
|
287
|
-
return response.remained;
|
|
288
|
-
}
|
|
289
|
-
async getQuickMethods() {
|
|
290
|
-
const response = await this.request();
|
|
291
|
-
return response.especial;
|
|
292
|
-
}
|
|
293
|
-
async request(isSaveMethodMode) {
|
|
294
|
-
const requestParams = {
|
|
295
|
-
access_token: this.settingsService.token,
|
|
296
|
-
country: this.countryService.getCountry(),
|
|
297
|
-
save_payment_account_only: isSaveMethodMode
|
|
298
|
-
? "1" /* XpsBoolean.true */
|
|
299
|
-
: "0" /* XpsBoolean.false */,
|
|
300
|
-
refer: this.settingsService.refer,
|
|
301
|
-
};
|
|
302
|
-
const cacheKey = JSON.stringify(requestParams);
|
|
303
|
-
if (!this.cache.has(cacheKey)) {
|
|
304
|
-
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
305
|
-
.post(this.apiRoute, new URLSearchParams({
|
|
306
|
-
...requestParams,
|
|
307
|
-
refer: String(requestParams.refer),
|
|
308
|
-
}), {
|
|
309
|
-
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
310
|
-
responseType: 'json',
|
|
311
|
-
})
|
|
312
|
-
.pipe(map((response) => this.responseFactory(response.payment_methods)))).catch((error) => {
|
|
313
|
-
throw new ResponseError(error.message);
|
|
314
|
-
}));
|
|
222
|
+
class TaggedError extends Error {
|
|
223
|
+
constructor(message, tags, extra) {
|
|
224
|
+
super(message);
|
|
225
|
+
this.tags = [];
|
|
226
|
+
this.parentTag = ErrorTags.HEADLESS_UI;
|
|
227
|
+
this.tags = this.childTag
|
|
228
|
+
? [this.parentTag, this.childTag]
|
|
229
|
+
: [this.parentTag];
|
|
230
|
+
if (tags) {
|
|
231
|
+
const newTags = tags.filter((t, i, arr) => !this.tags.includes(t) && arr.indexOf(t) == i);
|
|
232
|
+
this.tags = [...this.tags, ...newTags];
|
|
315
233
|
}
|
|
316
|
-
|
|
317
|
-
return this.cache.get(cacheKey);
|
|
318
|
-
}
|
|
319
|
-
filterMethodsByFixedPaymentMethod(methods) {
|
|
320
|
-
const fixedPid = this.settingsService.purchase?.payment_system?.id;
|
|
321
|
-
const paymentMethod = methods.find((method) => method.id === fixedPid);
|
|
322
|
-
return paymentMethod ? [paymentMethod] : [];
|
|
323
|
-
}
|
|
324
|
-
get isFixedPaymentMethod() {
|
|
325
|
-
return !!this.settingsService.purchase?.payment_system?.id;
|
|
234
|
+
this.extra = extra || {};
|
|
326
235
|
}
|
|
327
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, deps: [{ token: paymentMethodsResponseFactoryToken }, { token: SettingsService }, { token: CountryService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
328
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, providedIn: 'root' }); }
|
|
329
236
|
}
|
|
330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, decorators: [{
|
|
331
|
-
type: Injectable,
|
|
332
|
-
args: [{
|
|
333
|
-
providedIn: 'root',
|
|
334
|
-
}]
|
|
335
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
336
|
-
type: Inject,
|
|
337
|
-
args: [paymentMethodsResponseFactoryToken]
|
|
338
|
-
}] }, { type: SettingsService }, { type: CountryService }, { type: SecureApiClient }] });
|
|
339
237
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
238
|
+
const unknownValue = 'unknown';
|
|
239
|
+
const browsers = [
|
|
240
|
+
{
|
|
241
|
+
sentName: 'Mozilla Firefox',
|
|
242
|
+
shortName: 'Firefox',
|
|
243
|
+
regexpBrowserNameWithVersion: '(Firefox)\\/(.+)',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
sentName: 'Samsung Internet',
|
|
247
|
+
shortName: 'SamsungBrowser',
|
|
248
|
+
regexpBrowserNameWithVersion: '(SamsungBrowser)\\/(.+)\\s',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
sentName: 'Opera',
|
|
252
|
+
shortName: 'Opera',
|
|
253
|
+
regexpBrowserNameWithVersion: '(Opera)\\/(.+)',
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
sentName: 'Opera',
|
|
257
|
+
shortName: 'Opera',
|
|
258
|
+
regexpBrowserNameWithVersion: '(OPR)\\/(.+)',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
sentName: 'Microsoft Edge (Legacy)',
|
|
262
|
+
shortName: 'MSEdge-legacy',
|
|
263
|
+
regexpBrowserNameWithVersion: '(Edge)\\/(.+)',
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
sentName: 'Microsoft Edge (Chromium)',
|
|
267
|
+
shortName: 'MSEdge',
|
|
268
|
+
regexpBrowserNameWithVersion: '(Edg)\\/(.+)',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
sentName: 'Google Chrome or Chromium',
|
|
272
|
+
shortName: 'Chrome',
|
|
273
|
+
regexpBrowserNameWithVersion: '(Chrome)\\/(.+)\\s',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
sentName: 'Apple Safari',
|
|
277
|
+
shortName: 'Safari',
|
|
278
|
+
regexpBrowserNameWithVersion: '(Safari)\\/(.+)',
|
|
279
|
+
},
|
|
280
|
+
];
|
|
366
281
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
class SavedMethodsService {
|
|
374
|
-
constructor(responseFactory, settingsService, secureApi) {
|
|
375
|
-
this.responseFactory = responseFactory;
|
|
376
|
-
this.settingsService = settingsService;
|
|
377
|
-
this.secureApi = secureApi;
|
|
378
|
-
this.apiRoute = 'savedmethods';
|
|
379
|
-
this.cache = new Map();
|
|
380
|
-
}
|
|
381
|
-
async getList(needResetCache = false) {
|
|
382
|
-
if (needResetCache) {
|
|
383
|
-
this.cache.clear();
|
|
384
|
-
}
|
|
385
|
-
const response = await this.request();
|
|
386
|
-
return response.list;
|
|
387
|
-
}
|
|
388
|
-
async request() {
|
|
389
|
-
const requestParams = {
|
|
390
|
-
access_token: this.settingsService.token,
|
|
391
|
-
};
|
|
392
|
-
const cacheKey = JSON.stringify(requestParams);
|
|
393
|
-
if (!this.cache.has(cacheKey)) {
|
|
394
|
-
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
395
|
-
.post(this.apiRoute, new URLSearchParams({ ...requestParams }), {
|
|
396
|
-
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
397
|
-
responseType: 'json',
|
|
398
|
-
})
|
|
399
|
-
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
400
|
-
throw new ResponseError(error.message);
|
|
401
|
-
}));
|
|
402
|
-
}
|
|
403
|
-
// @ts-expect-error the map already has the cache with key
|
|
404
|
-
return this.cache.get(cacheKey);
|
|
405
|
-
}
|
|
406
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, deps: [{ token: savedMethodsResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
407
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, providedIn: 'root' }); }
|
|
408
|
-
}
|
|
409
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, decorators: [{
|
|
410
|
-
type: Injectable,
|
|
411
|
-
args: [{
|
|
412
|
-
providedIn: 'root',
|
|
413
|
-
}]
|
|
414
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
415
|
-
type: Inject,
|
|
416
|
-
args: [savedMethodsResponseFactoryToken]
|
|
417
|
-
}] }, { type: SettingsService }, { type: SecureApiClient }] });
|
|
418
|
-
|
|
419
|
-
class UserBalanceResponse {
|
|
420
|
-
constructor(userBalance) {
|
|
421
|
-
this.isEnoughUserBalance = userBalance.is_enough_user_balance ?? false;
|
|
422
|
-
this.isEnoughUserRecurrentBalance =
|
|
423
|
-
userBalance.is_enough_user_recurrent_balance ?? false;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
const userBalanceResponseFactoryToken = new InjectionToken('UserBalanceResponse');
|
|
428
|
-
const userBalanceResponseFactoryProvider = {
|
|
429
|
-
provide: userBalanceResponseFactoryToken,
|
|
430
|
-
useValue: (...args) => new UserBalanceResponse(...args),
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
class UserBalanceService {
|
|
434
|
-
constructor(responseFactory, settingsService, secureApi) {
|
|
435
|
-
this.responseFactory = responseFactory;
|
|
436
|
-
this.settingsService = settingsService;
|
|
437
|
-
this.secureApi = secureApi;
|
|
438
|
-
this.apiRoute = 'balance/sufficiency';
|
|
439
|
-
this.cache = new Map();
|
|
440
|
-
}
|
|
441
|
-
async getUserBalance() {
|
|
442
|
-
return this.request();
|
|
443
|
-
}
|
|
444
|
-
getUserBalanceValue() {
|
|
445
|
-
return this.settingsService.user.user_balance;
|
|
446
|
-
}
|
|
447
|
-
async request() {
|
|
448
|
-
const requestParams = {
|
|
449
|
-
access_token: this.settingsService.token,
|
|
450
|
-
};
|
|
451
|
-
const cacheKey = JSON.stringify(requestParams);
|
|
452
|
-
if (!this.cache.has(cacheKey)) {
|
|
453
|
-
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
454
|
-
.post(this.apiRoute, new URLSearchParams({ ...requestParams }), {
|
|
455
|
-
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
456
|
-
responseType: 'json',
|
|
457
|
-
})
|
|
458
|
-
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
459
|
-
throw new ResponseError(error.message);
|
|
460
|
-
}));
|
|
461
|
-
}
|
|
462
|
-
// @ts-expect-error the map already has the cache with key
|
|
463
|
-
return this.cache.get(cacheKey);
|
|
464
|
-
}
|
|
465
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, deps: [{ token: userBalanceResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
466
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, providedIn: 'root' }); }
|
|
467
|
-
}
|
|
468
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, decorators: [{
|
|
469
|
-
type: Injectable,
|
|
470
|
-
args: [{
|
|
471
|
-
providedIn: 'root',
|
|
472
|
-
}]
|
|
473
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
474
|
-
type: Inject,
|
|
475
|
-
args: [userBalanceResponseFactoryToken]
|
|
476
|
-
}] }, { type: SettingsService }, { type: SecureApiClient }] });
|
|
477
|
-
|
|
478
|
-
class UrlService {
|
|
479
|
-
addSearchParams(url, params = {}) {
|
|
480
|
-
if (!url) {
|
|
481
|
-
return '';
|
|
482
|
-
}
|
|
483
|
-
const urlObject = new URL(url);
|
|
484
|
-
for (const [key, value] of Object.entries(params)) {
|
|
485
|
-
urlObject.searchParams.set(key, value);
|
|
486
|
-
}
|
|
487
|
-
return urlObject.toString();
|
|
488
|
-
}
|
|
489
|
-
getSearchParams(url) {
|
|
490
|
-
if (!url) {
|
|
491
|
-
return {};
|
|
492
|
-
}
|
|
493
|
-
const urlObject = new URL(url);
|
|
494
|
-
const searchParams = {};
|
|
495
|
-
for (const [key, value] of urlObject.searchParams) {
|
|
496
|
-
searchParams[key] = value;
|
|
497
|
-
}
|
|
498
|
-
return searchParams;
|
|
499
|
-
}
|
|
500
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
501
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, providedIn: 'root' }); }
|
|
502
|
-
}
|
|
503
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, decorators: [{
|
|
504
|
-
type: Injectable,
|
|
505
|
-
args: [{
|
|
506
|
-
providedIn: 'root',
|
|
507
|
-
}]
|
|
508
|
-
}] });
|
|
509
|
-
|
|
510
|
-
class PaymentConfigService {
|
|
511
|
-
constructor(urlService, settingsService) {
|
|
512
|
-
this.urlService = urlService;
|
|
513
|
-
this.settingsService = settingsService;
|
|
514
|
-
}
|
|
515
|
-
enrich(config) {
|
|
516
|
-
if (!config.returnUrl) {
|
|
517
|
-
throw new Error('URL is not provided in payment config');
|
|
518
|
-
}
|
|
519
|
-
return {
|
|
520
|
-
...config,
|
|
521
|
-
returnUrl: this.enrichReturnUrl(config.returnUrl, !!config.savePaymentMethod),
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
enrichReturnUrl(returnUrl, savePaymentMethod) {
|
|
525
|
-
const enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
526
|
-
token: this.settingsService.token,
|
|
527
|
-
isSavePaymentAccount: savePaymentMethod
|
|
528
|
-
? "1" /* XpsBoolean.true */
|
|
529
|
-
: "0" /* XpsBoolean.false */,
|
|
530
|
-
});
|
|
531
|
-
return enrichedUrl;
|
|
532
|
-
}
|
|
533
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, deps: [{ token: UrlService }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
534
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, providedIn: 'root' }); }
|
|
535
|
-
}
|
|
536
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
537
|
-
type: Injectable,
|
|
538
|
-
args: [{
|
|
539
|
-
providedIn: 'root',
|
|
540
|
-
}]
|
|
541
|
-
}], ctorParameters: () => [{ type: UrlService }, { type: SettingsService }] });
|
|
542
|
-
|
|
543
|
-
var XpsCommand;
|
|
544
|
-
(function (XpsCommand) {
|
|
545
|
-
XpsCommand["form"] = "form";
|
|
546
|
-
XpsCommand["check"] = "check";
|
|
547
|
-
XpsCommand["status"] = "status";
|
|
548
|
-
XpsCommand["checkout"] = "checkout";
|
|
549
|
-
XpsCommand["account"] = "account";
|
|
550
|
-
XpsCommand["create"] = "create";
|
|
551
|
-
})(XpsCommand || (XpsCommand = {}));
|
|
552
|
-
|
|
553
|
-
var FieldNames;
|
|
554
|
-
(function (FieldNames) {
|
|
555
|
-
FieldNames["address1"] = "address1";
|
|
556
|
-
FieldNames["address2"] = "address2";
|
|
557
|
-
FieldNames["address"] = "address";
|
|
558
|
-
FieldNames["allowRecurrentSubscription"] = "allowRecurrentSubscription";
|
|
559
|
-
FieldNames["allowSubscription"] = "allowSubscription";
|
|
560
|
-
FieldNames["apt"] = "apt";
|
|
561
|
-
FieldNames["availableCardTypes"] = "available_card_types";
|
|
562
|
-
FieldNames["bank"] = "bank";
|
|
563
|
-
FieldNames["birthDate"] = "birth_date";
|
|
564
|
-
FieldNames["cardMonth"] = "card_month";
|
|
565
|
-
FieldNames["cardYear"] = "card_year";
|
|
566
|
-
FieldNames["cardExpire"] = "card_expire";
|
|
567
|
-
FieldNames["cardNumber"] = "card_number";
|
|
568
|
-
FieldNames["cardholdername"] = "cardholdername";
|
|
569
|
-
FieldNames["city"] = "city";
|
|
570
|
-
FieldNames["couponCode"] = "couponCode";
|
|
571
|
-
FieldNames["cpfName"] = "cpf_name";
|
|
572
|
-
FieldNames["cpfNumber"] = "cpf_number";
|
|
573
|
-
FieldNames["cvv"] = "cvv";
|
|
574
|
-
FieldNames["description"] = "description";
|
|
575
|
-
FieldNames["email"] = "email";
|
|
576
|
-
FieldNames["psEmail"] = "psEmail";
|
|
577
|
-
FieldNames["psAccountCountry"] = "psAccountCountry";
|
|
578
|
-
FieldNames["bazitemail"] = "bazitemail";
|
|
579
|
-
FieldNames["euCheck"] = "eu_check";
|
|
580
|
-
FieldNames["extraCvv"] = "extra_cvv";
|
|
581
|
-
FieldNames["extraCardNumber"] = "extra_card_number";
|
|
582
|
-
FieldNames["extraCardType"] = "extra_card_type";
|
|
583
|
-
FieldNames["fName"] = "f_name";
|
|
584
|
-
FieldNames["installments"] = "installments";
|
|
585
|
-
FieldNames["lName"] = "l_name";
|
|
586
|
-
FieldNames["needInstallments"] = "needInstallments";
|
|
587
|
-
FieldNames["personId"] = "person_id";
|
|
588
|
-
FieldNames["personIdAr"] = "person_id_ar";
|
|
589
|
-
FieldNames["personIdCo"] = "person_id_co";
|
|
590
|
-
FieldNames["phone"] = "phone";
|
|
591
|
-
FieldNames["purchaseDescription"] = "purchaseDescription";
|
|
592
|
-
FieldNames["recurrentType"] = "recurrent_type";
|
|
593
|
-
FieldNames["rockstarTaxes"] = "rockstar_taxes";
|
|
594
|
-
FieldNames["state"] = "state";
|
|
595
|
-
FieldNames["street"] = "street";
|
|
596
|
-
FieldNames["streetNumber"] = "street_number";
|
|
597
|
-
FieldNames["take2Taxes"] = "take2_taxes";
|
|
598
|
-
FieldNames["termsAndConditions"] = "termsAndConditions";
|
|
599
|
-
FieldNames["termsAndConditionsAtariPp"] = "termsAndConditionsAtariPP";
|
|
600
|
-
FieldNames["termsAndConditionsAtariTc"] = "termsAndConditionsAtariTC";
|
|
601
|
-
FieldNames["termsAndConditionsHtcEula"] = "termsAndConditionsHtcEula";
|
|
602
|
-
FieldNames["termsAndConditionsRobloxEula"] = "termsAndConditionsRobloxEula";
|
|
603
|
-
FieldNames["termsAndConditionsRolandEula"] = "termsAndConditionsRolandEula";
|
|
604
|
-
FieldNames["termsAndConditionsDeusLoVultEula"] = "termsAndConditionsDeusLoVultEula";
|
|
605
|
-
FieldNames["termsAndConditionsOnzenga"] = "termsAndConditionsOnzenga";
|
|
606
|
-
FieldNames["licenseDisclaimer"] = "licenseDisclaimer";
|
|
607
|
-
FieldNames["xsollaTipsAmount"] = "xsollaTipsAmount";
|
|
608
|
-
FieldNames["zip"] = "zip";
|
|
609
|
-
FieldNames["allowSave"] = "allowSave";
|
|
610
|
-
FieldNames["koreaLimitsInstruction"] = "korea_limits_instruction";
|
|
611
|
-
FieldNames["tokenApplePay"] = "token_applepay";
|
|
612
|
-
FieldNames["fixInvoice"] = "fix_invoice";
|
|
613
|
-
FieldNames["fixPid"] = "fix_pid";
|
|
614
|
-
FieldNames["signature"] = "signature";
|
|
615
|
-
FieldNames["qr"] = "qr";
|
|
616
|
-
FieldNames["sum"] = "sum";
|
|
617
|
-
FieldNames["out"] = "out";
|
|
618
|
-
FieldNames["tinkoffDisclaimer"] = "ps.tinkoff.disclaimer";
|
|
619
|
-
FieldNames["ppEmail"] = "pp_email";
|
|
620
|
-
FieldNames["redeemPoints"] = "redeemPoints";
|
|
621
|
-
FieldNames["omnibusDirective"] = "omnibus_directive";
|
|
622
|
-
FieldNames["labelApplePay"] = "label_applePay";
|
|
623
|
-
FieldNames["countryCode"] = "countryCode";
|
|
624
|
-
FieldNames["merchantCapabilities"] = "merchantCapabilities";
|
|
625
|
-
FieldNames["requiredBillingContactFields"] = "requiredBillingContactFields";
|
|
626
|
-
FieldNames["requiredShippingContactFields"] = "requiredShippingContactFields";
|
|
627
|
-
FieldNames["supportedNetworks"] = "supportedNetworks";
|
|
628
|
-
FieldNames["acquirer"] = "acquirer";
|
|
629
|
-
FieldNames["isSandbox"] = "isSandbox";
|
|
630
|
-
FieldNames["payInstanceAccountId"] = "payInstanceAccountId";
|
|
631
|
-
FieldNames["getApplePaySessionUrl"] = "getApplePaySessionUrl";
|
|
632
|
-
FieldNames["payViaCheckoutUrl"] = "payViaCheckoutUrl";
|
|
633
|
-
FieldNames["googlePayInitData"] = "googlePayInitData";
|
|
634
|
-
FieldNames["googlePayPaymentData"] = "googlePayPaymentData";
|
|
635
|
-
})(FieldNames || (FieldNames = {}));
|
|
636
|
-
|
|
637
|
-
class SubmitResponse {
|
|
638
|
-
constructor(parameters, responseNumber = 0) {
|
|
639
|
-
this.responseNumber = responseNumber;
|
|
640
|
-
/* Todo split into properties */
|
|
641
|
-
this.parameters = parameters;
|
|
642
|
-
this.fields = Object.keys(parameters.form).map((key) => parameters.form[key]);
|
|
643
|
-
if (parameters.onlineBanking) {
|
|
644
|
-
this.onlineBanking = {
|
|
645
|
-
url: parameters.onlineBanking.value,
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
this.isNeedRedirect =
|
|
649
|
-
parameters.currentCommand === XpsCommand.account ||
|
|
650
|
-
(parameters.currentCommand === XpsCommand.checkout &&
|
|
651
|
-
Boolean(parameters.checkout));
|
|
652
|
-
this.buyData = parameters.buyData;
|
|
653
|
-
this.fixInvoice = this.fields.find((field) => field.name === FieldNames.fixInvoice)?.value;
|
|
654
|
-
this.signature = this.fields.find((field) => field.name === FieldNames.signature)?.value;
|
|
655
|
-
this.hasFatalErrors = parameters.textAll?.fatal;
|
|
656
|
-
this.userSession = parameters.userSession;
|
|
657
|
-
this.pid = parameters.pid;
|
|
658
|
-
this.errors = parameters.errors;
|
|
659
|
-
this.summary = parameters.summary;
|
|
660
|
-
this.title = parameters.title;
|
|
661
|
-
this.currentCommand = parameters.currentCommand;
|
|
662
|
-
this.messages = parameters.messages;
|
|
663
|
-
this.xsollaNumber = {
|
|
664
|
-
accountXsolla: parameters.accountXsolla,
|
|
665
|
-
isMap: parameters.isMap,
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
class InitializeResponse {
|
|
671
|
-
constructor(response) {
|
|
672
|
-
this.paymentForm = null;
|
|
673
|
-
this.paymentForm = this.extractPaymentForm(response);
|
|
674
|
-
}
|
|
675
|
-
extractPaymentForm(response) {
|
|
676
|
-
if (!response) {
|
|
677
|
-
return null;
|
|
678
|
-
}
|
|
679
|
-
return {
|
|
680
|
-
totalAmount: response.buyData.sum,
|
|
681
|
-
currency: response.buyData.currency,
|
|
682
|
-
fields: Object.keys(response.form).map((key) => response.form[key]),
|
|
683
|
-
taxDisclaimer: response.taxDisclaimer,
|
|
684
|
-
number: response.number,
|
|
685
|
-
barcode: response.barcode,
|
|
686
|
-
instruction: response.instruction,
|
|
687
|
-
offers: response.offers,
|
|
688
|
-
error: response.error,
|
|
689
|
-
errors: response.errors,
|
|
690
|
-
restrictions: response.restrictions,
|
|
691
|
-
info: response.info,
|
|
692
|
-
buyData: response.buyData,
|
|
693
|
-
pid: response.pid,
|
|
694
|
-
messages: response.messages ?? [],
|
|
695
|
-
title: response.title,
|
|
696
|
-
summary: response.summary,
|
|
697
|
-
skipForm: response.skipForm,
|
|
698
|
-
isSavedMethodPayment: !!response.form?.saved_method_id,
|
|
699
|
-
couponCode: response.form?.couponCode?.value || '',
|
|
700
|
-
publicId: response.public_id,
|
|
701
|
-
skipCheckout: response.skipCheckout,
|
|
702
|
-
koreaNotification: response.form.korea_limits_instruction,
|
|
703
|
-
isCheckout: response.isCheckout,
|
|
704
|
-
categories: response.categories,
|
|
705
|
-
hasFatalErrors: response.textAll?.fatal,
|
|
706
|
-
userSession: response.userSession,
|
|
707
|
-
statusText: response.status?.statusData?.stateText ?? null,
|
|
708
|
-
country: response.country ? response.country.iso : null,
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
const isSubmitResponse = (value) => {
|
|
714
|
-
return value instanceof SubmitResponse;
|
|
715
|
-
};
|
|
716
|
-
|
|
717
|
-
var InputEventName;
|
|
718
|
-
(function (InputEventName) {
|
|
719
|
-
InputEventName["blur"] = "blur";
|
|
720
|
-
InputEventName["focus"] = "focus";
|
|
721
|
-
})(InputEventName || (InputEventName = {}));
|
|
722
|
-
|
|
723
|
-
const googlePayPid = 3431;
|
|
724
|
-
|
|
725
|
-
var ErrorTags;
|
|
726
|
-
(function (ErrorTags) {
|
|
727
|
-
ErrorTags["APP"] = "appError";
|
|
728
|
-
ErrorTags["HTTP"] = "httpError";
|
|
729
|
-
ErrorTags["JS"] = "jsError";
|
|
730
|
-
ErrorTags["WS"] = "webSocket";
|
|
731
|
-
ErrorTags["ENCRYPT"] = "encrypt";
|
|
732
|
-
ErrorTags["APPLEPAY"] = "applepay";
|
|
733
|
-
ErrorTags["HEADLESS_UI"] = "headlessUi";
|
|
734
|
-
ErrorTags["GOOGLEPAY"] = "googlepay";
|
|
735
|
-
ErrorTags["PAYTM"] = "paytm";
|
|
736
|
-
})(ErrorTags || (ErrorTags = {}));
|
|
737
|
-
|
|
738
|
-
const fieldsAllowedToOverride = new Set([
|
|
739
|
-
FieldNames.allowSubscription,
|
|
740
|
-
FieldNames.allowSave,
|
|
741
|
-
]);
|
|
742
|
-
|
|
743
|
-
function isXpsBoolean(value) {
|
|
744
|
-
return value === "1" /* XpsBoolean.true */ || value === "0" /* XpsBoolean.false */;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
* Configuration for fields that can be overridden by partner.
|
|
749
|
-
* We can extend this configuration with additional fields in the future.
|
|
750
|
-
*/
|
|
751
|
-
const overrideFieldConfigs = {
|
|
752
|
-
[FieldNames.allowSubscription]: {
|
|
753
|
-
validator: isXpsBoolean,
|
|
754
|
-
defaultValue: "0" /* XpsBoolean.false */,
|
|
755
|
-
},
|
|
756
|
-
[FieldNames.allowSave]: {
|
|
757
|
-
validator: isXpsBoolean,
|
|
758
|
-
defaultValue: "0" /* XpsBoolean.false */,
|
|
759
|
-
},
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
class TaggedError extends Error {
|
|
763
|
-
constructor(message, tags) {
|
|
764
|
-
super(message);
|
|
765
|
-
this.tags = [];
|
|
766
|
-
this.parentTag = ErrorTags.HEADLESS_UI;
|
|
767
|
-
this.tags = this.childTag
|
|
768
|
-
? [this.parentTag, this.childTag]
|
|
769
|
-
: [this.parentTag];
|
|
770
|
-
if (tags) {
|
|
771
|
-
const newTags = tags.filter((t, i, arr) => !this.tags.includes(t) && arr.indexOf(t) == i);
|
|
772
|
-
this.tags = [...this.tags, ...newTags];
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
class ElkLoggerService {
|
|
778
|
-
constructor(window, settingsService, http, ngZone) {
|
|
779
|
-
this.window = window;
|
|
780
|
-
this.settingsService = settingsService;
|
|
781
|
-
this.http = http;
|
|
782
|
-
this.ngZone = ngZone;
|
|
783
|
-
this.vendors = new RegExp('node_modules\\/(@angular|zone).*.js$');
|
|
784
|
-
this.stackTrace = this.loadStackTrace();
|
|
785
|
-
}
|
|
786
|
-
handleError(error) {
|
|
787
|
-
this.ngZone.runOutsideAngular(() => {
|
|
788
|
-
if (isDevMode()) {
|
|
789
|
-
console.error(error);
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
this.parseError(error).catch(console.log);
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
log(message, tags, extra) {
|
|
796
|
-
const logTags = [ErrorTags.HEADLESS_UI, ...tags];
|
|
797
|
-
if (isDevMode()) {
|
|
798
|
-
console.log(message, tags);
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
const logMessage = {
|
|
802
|
-
additionalInfo: this.getAdditionalInfo(),
|
|
803
|
-
extra,
|
|
804
|
-
message,
|
|
805
|
-
};
|
|
806
|
-
this.sendLog(logMessage, logTags);
|
|
807
|
-
}
|
|
808
|
-
async parseError(error) {
|
|
809
|
-
const errorObj = error instanceof TaggedError
|
|
810
|
-
? error
|
|
811
|
-
: new TaggedError(error.message || error.toString());
|
|
812
|
-
errorObj.trace = await this.getErrorTrace(errorObj);
|
|
813
|
-
errorObj.additionalInfo = this.getAdditionalInfo();
|
|
814
|
-
const { tags } = errorObj;
|
|
815
|
-
const cleanError = this.removeErrorMetaFields(errorObj);
|
|
816
|
-
this.sendLog(cleanError, tags);
|
|
817
|
-
return errorObj;
|
|
818
|
-
}
|
|
819
|
-
async loadStackTrace() {
|
|
820
|
-
const library = await import('stacktrace-js');
|
|
821
|
-
return library.default;
|
|
822
|
-
}
|
|
823
|
-
async getErrorTrace(error) {
|
|
824
|
-
const stackTrace = await this.stackTrace;
|
|
825
|
-
const stackFramesArr = await stackTrace.fromError(error);
|
|
826
|
-
const filteredFramesArr = stackFramesArr.filter(({ fileName }) => fileName && !this.vendors.test(fileName));
|
|
827
|
-
return filteredFramesArr
|
|
828
|
-
.map((stackFrame) => stackFrame.toString())
|
|
829
|
-
.join('\n');
|
|
830
|
-
}
|
|
831
|
-
getAdditionalInfo() {
|
|
832
|
-
const extractUrlHost = (url) => url.replace(/^https?:\/\/([^/?#]+).*$/i, '$1');
|
|
833
|
-
return {
|
|
834
|
-
location: {
|
|
835
|
-
url: this.window.location.href,
|
|
836
|
-
},
|
|
837
|
-
project: {
|
|
838
|
-
id: this.settingsService.project.id,
|
|
839
|
-
},
|
|
840
|
-
referrer: {
|
|
841
|
-
url: this.window.document.referrer,
|
|
842
|
-
},
|
|
843
|
-
viewport: {
|
|
844
|
-
width: this.window.document.documentElement.clientWidth,
|
|
845
|
-
height: this.window.document.documentElement.clientHeight,
|
|
846
|
-
},
|
|
847
|
-
cdn_address: this.settingsService.settings.cdnUrl
|
|
848
|
-
? extractUrlHost(this.settingsService.settings.cdnUrl)
|
|
849
|
-
: 'none',
|
|
850
|
-
country: this.settingsService.user.country.value,
|
|
851
|
-
local: this.settingsService.user.country.localized_name,
|
|
852
|
-
};
|
|
853
|
-
}
|
|
854
|
-
removeErrorMetaFields(error) {
|
|
855
|
-
const metaPropList = [
|
|
856
|
-
'parentTag',
|
|
857
|
-
'childTag',
|
|
858
|
-
'RESTRICTED_KEYS_REGEXP',
|
|
859
|
-
'tags',
|
|
860
|
-
];
|
|
861
|
-
Object.keys(error).forEach((key) => {
|
|
862
|
-
if (metaPropList.includes(key))
|
|
863
|
-
delete error[key];
|
|
864
|
-
});
|
|
865
|
-
// implementing own 'message' property from prototype
|
|
866
|
-
return { ...error, message: error.message };
|
|
867
|
-
}
|
|
868
|
-
sendLog(message, tags) {
|
|
869
|
-
const url = `https://logs-01.xsolla.com/tag/${tags.join(',')}`;
|
|
870
|
-
firstValueFrom(this.http.post(url, message, {
|
|
871
|
-
headers: new HttpHeaders().set('Content-Type', 'text/plain'),
|
|
872
|
-
responseType: 'text',
|
|
873
|
-
})).catch((err) => console.error('Elk Logger: request error', err));
|
|
874
|
-
}
|
|
875
|
-
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 }); }
|
|
876
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, providedIn: 'root' }); }
|
|
877
|
-
}
|
|
878
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, decorators: [{
|
|
879
|
-
type: Injectable,
|
|
880
|
-
args: [{
|
|
881
|
-
providedIn: 'root',
|
|
882
|
-
}]
|
|
883
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
884
|
-
type: Inject,
|
|
885
|
-
args: [windowToken]
|
|
886
|
-
}] }, { type: SettingsService }, { type: i1.HttpClient }, { type: i0.NgZone }] });
|
|
887
|
-
|
|
888
|
-
const initializeResponseFactoryToken = new InjectionToken('InitializeResponse');
|
|
889
|
-
const initializeResponseFactoryProvider = {
|
|
890
|
-
provide: initializeResponseFactoryToken,
|
|
891
|
-
useValue: (...args) => new InitializeResponse(...args),
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
var UserBehaviourEventName;
|
|
895
|
-
(function (UserBehaviourEventName) {
|
|
896
|
-
UserBehaviourEventName["openPaystation"] = "open-paystation";
|
|
897
|
-
UserBehaviourEventName["showMethodHeader"] = "show-method-header";
|
|
898
|
-
UserBehaviourEventName["showErrorMessage"] = "show-error-message";
|
|
899
|
-
UserBehaviourEventName["openStatusError"] = "open-status-error";
|
|
900
|
-
UserBehaviourEventName["sysTrackedScripts"] = "sys-tracked_scripts";
|
|
901
|
-
})(UserBehaviourEventName || (UserBehaviourEventName = {}));
|
|
902
|
-
|
|
903
|
-
const userBehaviourEventTypes = {
|
|
904
|
-
open: 'open',
|
|
905
|
-
show: 'show',
|
|
906
|
-
click: 'click',
|
|
907
|
-
manual: 'manual',
|
|
908
|
-
store: 'store',
|
|
909
|
-
};
|
|
910
|
-
|
|
911
|
-
const masterCardAndVisaPaymentMethodId = 26;
|
|
912
|
-
const maestroPaymentMethodId = 490;
|
|
913
|
-
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
914
|
-
const creditCardPaymentMethodId = 1380;
|
|
915
|
-
const americanExpressMethodId = 714;
|
|
916
|
-
const specialCards = [
|
|
917
|
-
maestroPaymentMethodId,
|
|
918
|
-
masterCardAndVisaPaymentMethodId,
|
|
919
|
-
americanExpressMethodId,
|
|
920
|
-
];
|
|
921
|
-
const cardsWith3ds = [
|
|
922
|
-
masterCardAndVisaPaymentMethodId,
|
|
923
|
-
maestroPaymentMethodId,
|
|
924
|
-
creditCardPaymentMethodId,
|
|
925
|
-
];
|
|
926
|
-
|
|
927
|
-
const unknownValue = 'unknown';
|
|
928
|
-
const browsers = [
|
|
929
|
-
{
|
|
930
|
-
sentName: 'Mozilla Firefox',
|
|
931
|
-
shortName: 'Firefox',
|
|
932
|
-
regexpBrowserNameWithVersion: '(Firefox)\\/(.+)',
|
|
933
|
-
},
|
|
934
|
-
{
|
|
935
|
-
sentName: 'Samsung Internet',
|
|
936
|
-
shortName: 'SamsungBrowser',
|
|
937
|
-
regexpBrowserNameWithVersion: '(SamsungBrowser)\\/(.+)\\s',
|
|
938
|
-
},
|
|
939
|
-
{
|
|
940
|
-
sentName: 'Opera',
|
|
941
|
-
shortName: 'Opera',
|
|
942
|
-
regexpBrowserNameWithVersion: '(Opera)\\/(.+)',
|
|
943
|
-
},
|
|
944
|
-
{
|
|
945
|
-
sentName: 'Opera',
|
|
946
|
-
shortName: 'Opera',
|
|
947
|
-
regexpBrowserNameWithVersion: '(OPR)\\/(.+)',
|
|
948
|
-
},
|
|
949
|
-
{
|
|
950
|
-
sentName: 'Microsoft Edge (Legacy)',
|
|
951
|
-
shortName: 'MSEdge-legacy',
|
|
952
|
-
regexpBrowserNameWithVersion: '(Edge)\\/(.+)',
|
|
953
|
-
},
|
|
954
|
-
{
|
|
955
|
-
sentName: 'Microsoft Edge (Chromium)',
|
|
956
|
-
shortName: 'MSEdge',
|
|
957
|
-
regexpBrowserNameWithVersion: '(Edg)\\/(.+)',
|
|
958
|
-
},
|
|
959
|
-
{
|
|
960
|
-
sentName: 'Google Chrome or Chromium',
|
|
961
|
-
shortName: 'Chrome',
|
|
962
|
-
regexpBrowserNameWithVersion: '(Chrome)\\/(.+)\\s',
|
|
963
|
-
},
|
|
964
|
-
{
|
|
965
|
-
sentName: 'Apple Safari',
|
|
966
|
-
shortName: 'Safari',
|
|
967
|
-
regexpBrowserNameWithVersion: '(Safari)\\/(.+)',
|
|
968
|
-
},
|
|
969
|
-
];
|
|
970
|
-
|
|
971
|
-
var Device;
|
|
972
|
-
(function (Device) {
|
|
973
|
-
Device["mobile"] = "mobile";
|
|
974
|
-
Device["desktop"] = "desktop";
|
|
975
|
-
})(Device || (Device = {}));
|
|
282
|
+
var Device;
|
|
283
|
+
(function (Device) {
|
|
284
|
+
Device["mobile"] = "mobile";
|
|
285
|
+
Device["desktop"] = "desktop";
|
|
286
|
+
})(Device || (Device = {}));
|
|
976
287
|
|
|
977
288
|
const osList = [
|
|
978
289
|
{
|
|
@@ -1229,210 +540,969 @@ const osList = [
|
|
|
1229
540
|
},
|
|
1230
541
|
];
|
|
1231
542
|
|
|
1232
|
-
class UserAgentService {
|
|
1233
|
-
constructor(window) {
|
|
543
|
+
class UserAgentService {
|
|
544
|
+
constructor(window) {
|
|
545
|
+
this.window = window;
|
|
546
|
+
this._browserName = null;
|
|
547
|
+
this._browserVersion = null;
|
|
548
|
+
this._browserApp = null;
|
|
549
|
+
this._platform = null;
|
|
550
|
+
this._os = null;
|
|
551
|
+
this.getUserPlatform();
|
|
552
|
+
this.getBrowserInformation();
|
|
553
|
+
this.getOsInformation();
|
|
554
|
+
}
|
|
555
|
+
get browserVersion() {
|
|
556
|
+
return this._browserVersion;
|
|
557
|
+
}
|
|
558
|
+
get browserApp() {
|
|
559
|
+
return this._browserApp;
|
|
560
|
+
}
|
|
561
|
+
get platform() {
|
|
562
|
+
if (this._platform === unknownValue) {
|
|
563
|
+
return this.osType;
|
|
564
|
+
}
|
|
565
|
+
return this._platform;
|
|
566
|
+
}
|
|
567
|
+
get userAgent() {
|
|
568
|
+
return this.window.navigator.userAgent;
|
|
569
|
+
}
|
|
570
|
+
get browserDescription() {
|
|
571
|
+
if (this.browserName === unknownValue || this.browserName === null) {
|
|
572
|
+
return this.userAgent;
|
|
573
|
+
}
|
|
574
|
+
return this.browserName;
|
|
575
|
+
}
|
|
576
|
+
get isSafari() {
|
|
577
|
+
return this._browserName === 'Apple Safari';
|
|
578
|
+
}
|
|
579
|
+
get safariVersion() {
|
|
580
|
+
if (!this.isSafari) {
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
const versionRegExp = new RegExp('(Version)\\/(.+)\\s');
|
|
584
|
+
const version = versionRegExp.exec(this.userAgent);
|
|
585
|
+
if (!version) {
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
return Number(version[2].split('.')[0]);
|
|
589
|
+
}
|
|
590
|
+
get iOsVersion() {
|
|
591
|
+
if (this.osType !== 'ios') {
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
const version = /OS (\d+)_(\d+)_?(\d+)?/.exec(this.window.navigator.appVersion);
|
|
595
|
+
return version ? `${version[1]}.${version[2]}.${version[3] ?? 0}` : null;
|
|
596
|
+
}
|
|
597
|
+
get browserInfo() {
|
|
598
|
+
const browserInfo = {
|
|
599
|
+
name: this.browserDescription,
|
|
600
|
+
[this.browserApp?.toLowerCase() ?? unknownValue]: true,
|
|
601
|
+
version: this.browserVersion,
|
|
602
|
+
[this.browserEngine.toLowerCase()]: true,
|
|
603
|
+
ui_version: this.isMobileDevice ? Device.mobile : Device.desktop,
|
|
604
|
+
os: this.os,
|
|
605
|
+
};
|
|
606
|
+
if (this.isMobileDevice) {
|
|
607
|
+
browserInfo.mobile = true;
|
|
608
|
+
}
|
|
609
|
+
if (this.osType) {
|
|
610
|
+
// @ts-expect-error index is string
|
|
611
|
+
browserInfo[this.osType.toLowerCase()] = true;
|
|
612
|
+
}
|
|
613
|
+
if (this.window.navigator.platform?.includes('iPhone')) {
|
|
614
|
+
browserInfo.iphone = true;
|
|
615
|
+
}
|
|
616
|
+
if (this.window.navigator.platform?.includes('iPod')) {
|
|
617
|
+
browserInfo.ipod = true;
|
|
618
|
+
}
|
|
619
|
+
if (this.window.navigator.platform?.includes('iPad')) {
|
|
620
|
+
browserInfo.ipad = true;
|
|
621
|
+
browserInfo.tablet = true;
|
|
622
|
+
}
|
|
623
|
+
if (this.isAndroid) {
|
|
624
|
+
browserInfo.android = true;
|
|
625
|
+
}
|
|
626
|
+
return browserInfo;
|
|
627
|
+
}
|
|
628
|
+
get isMobileDevice() {
|
|
629
|
+
const deviceAgents = [
|
|
630
|
+
'Android',
|
|
631
|
+
'webOS',
|
|
632
|
+
'iPhone',
|
|
633
|
+
'iPad',
|
|
634
|
+
'iPod',
|
|
635
|
+
'BlackBerry',
|
|
636
|
+
'IEMobile',
|
|
637
|
+
'Opera Mini',
|
|
638
|
+
'Mobile',
|
|
639
|
+
'Tablet',
|
|
640
|
+
'Kindle',
|
|
641
|
+
'Playbook',
|
|
642
|
+
'Silk',
|
|
643
|
+
'Puffin',
|
|
644
|
+
'CriOS',
|
|
645
|
+
];
|
|
646
|
+
return new RegExp(deviceAgents.join('|'), 'i').test(this.userAgent);
|
|
647
|
+
}
|
|
648
|
+
get isIosAndNotIpad() {
|
|
649
|
+
return ['iPhone', 'iPod'].includes(this.window.navigator.platform);
|
|
650
|
+
}
|
|
651
|
+
getUserPlatform() {
|
|
652
|
+
const experimentalPlatformApi = this.window.navigator?.userAgentData;
|
|
653
|
+
const platform = experimentalPlatformApi?.platform ??
|
|
654
|
+
this.window?.navigator?.platform ??
|
|
655
|
+
unknownValue;
|
|
656
|
+
this._platform = platform.toLowerCase();
|
|
657
|
+
}
|
|
658
|
+
getBrowserInformation() {
|
|
659
|
+
for (const browser of browsers) {
|
|
660
|
+
const browserRegExp = new RegExp(browser.regexpBrowserNameWithVersion);
|
|
661
|
+
const browserNameWithVersion = browserRegExp.exec(this.userAgent);
|
|
662
|
+
if (browserNameWithVersion !== null) {
|
|
663
|
+
this._browserName = browser.sentName;
|
|
664
|
+
this._browserApp = browser.shortName;
|
|
665
|
+
this._browserVersion = browserNameWithVersion[2];
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
this._browserName = unknownValue;
|
|
669
|
+
this._browserApp = unknownValue;
|
|
670
|
+
this._browserVersion = unknownValue;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
getOsInformation() {
|
|
674
|
+
for (const os of osList) {
|
|
675
|
+
const osRegExp = new RegExp(os.regExp);
|
|
676
|
+
const osName = osRegExp.exec(this.userAgent);
|
|
677
|
+
if (osName !== null) {
|
|
678
|
+
this._os = os.name;
|
|
679
|
+
break;
|
|
680
|
+
}
|
|
681
|
+
this._os = unknownValue;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
get browserName() {
|
|
685
|
+
return this._browserName;
|
|
686
|
+
}
|
|
687
|
+
get isAndroid() {
|
|
688
|
+
return /Android\s+([\d.]+)/.test(this.userAgent);
|
|
689
|
+
}
|
|
690
|
+
get isXbox() {
|
|
691
|
+
return /xbox/i.test(this.userAgent);
|
|
692
|
+
}
|
|
693
|
+
get isLinux() {
|
|
694
|
+
return /linux/i.test(this.userAgent);
|
|
695
|
+
}
|
|
696
|
+
get isWindows() {
|
|
697
|
+
return /windows/i.test(this.userAgent);
|
|
698
|
+
}
|
|
699
|
+
get browserEngine() {
|
|
700
|
+
const engines = new Map([
|
|
701
|
+
['Firefox', 'Gecko'],
|
|
702
|
+
['Safari', 'Webkit'],
|
|
703
|
+
['MSEdge-legacy', 'EdgeHTML'],
|
|
704
|
+
['Chrome', 'Blink'],
|
|
705
|
+
['Opera', 'Blink'],
|
|
706
|
+
['MSEdge', 'Blink'],
|
|
707
|
+
['SamsungBrowser', 'Blink'],
|
|
708
|
+
]);
|
|
709
|
+
return engines.get(this.browserApp) ?? unknownValue;
|
|
710
|
+
}
|
|
711
|
+
get os() {
|
|
712
|
+
return this._os;
|
|
713
|
+
}
|
|
714
|
+
get osType() {
|
|
715
|
+
if (['iPhone', 'iPod', 'iPad'].includes(this.window.navigator.platform)) {
|
|
716
|
+
return 'ios';
|
|
717
|
+
}
|
|
718
|
+
if (this.window.navigator.platform?.includes('MacIntel')) {
|
|
719
|
+
return 'mac';
|
|
720
|
+
}
|
|
721
|
+
if (this.isXbox) {
|
|
722
|
+
return 'xbox';
|
|
723
|
+
}
|
|
724
|
+
if (this.isWindows) {
|
|
725
|
+
return 'windows';
|
|
726
|
+
}
|
|
727
|
+
if (this.isAndroid) {
|
|
728
|
+
return 'android';
|
|
729
|
+
}
|
|
730
|
+
if (this.isLinux) {
|
|
731
|
+
return 'linux';
|
|
732
|
+
}
|
|
733
|
+
return null;
|
|
734
|
+
}
|
|
735
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, deps: [{ token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
736
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, providedIn: 'root' }); }
|
|
737
|
+
}
|
|
738
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, decorators: [{
|
|
739
|
+
type: Injectable,
|
|
740
|
+
args: [{
|
|
741
|
+
providedIn: 'root',
|
|
742
|
+
}]
|
|
743
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
744
|
+
type: Inject,
|
|
745
|
+
args: [windowToken]
|
|
746
|
+
}] }] });
|
|
747
|
+
|
|
748
|
+
class CommonLogAttributesService {
|
|
749
|
+
constructor(window, settingsService, userAgentService) {
|
|
1234
750
|
this.window = window;
|
|
1235
|
-
this.
|
|
1236
|
-
this.
|
|
1237
|
-
this._browserApp = null;
|
|
1238
|
-
this._platform = null;
|
|
1239
|
-
this._os = null;
|
|
1240
|
-
this.getUserPlatform();
|
|
1241
|
-
this.getBrowserInformation();
|
|
1242
|
-
this.getOsInformation();
|
|
751
|
+
this.settingsService = settingsService;
|
|
752
|
+
this.userAgentService = userAgentService;
|
|
1243
753
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
754
|
+
getAttributes() {
|
|
755
|
+
const user = this.settingsService.unsafeUser;
|
|
756
|
+
const project = this.settingsService.unsafeProject;
|
|
757
|
+
const settings = this.settingsService.unsafeSettings;
|
|
758
|
+
return {
|
|
759
|
+
token: this.settingsService.token,
|
|
760
|
+
userId: user?.uuid,
|
|
761
|
+
userEmail: user?.email?.value,
|
|
762
|
+
projectId: project?.id,
|
|
763
|
+
merchantId: project?.merchantId,
|
|
764
|
+
locationUrl: this.window.location.href,
|
|
765
|
+
userAgent: this.userAgentService.userAgent,
|
|
766
|
+
referrerUrl: this.window.document.referrer,
|
|
767
|
+
viewportWidth: this.window.document.documentElement.clientWidth,
|
|
768
|
+
viewportHeight: this.window.document.documentElement.clientHeight,
|
|
769
|
+
cdnAddress: settings?.cdnUrl
|
|
770
|
+
? this.extractUrlHost(settings.cdnUrl)
|
|
771
|
+
: 'none',
|
|
772
|
+
country: user?.country?.value,
|
|
773
|
+
local: user?.country?.localized_name,
|
|
774
|
+
browserInfo: JSON.stringify(this.userAgentService.browserInfo),
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
extractUrlHost(url) {
|
|
778
|
+
return url.replace(/^https?:\/\/([^/?#]+).*$/i, '$1');
|
|
779
|
+
}
|
|
780
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CommonLogAttributesService, deps: [{ token: windowToken }, { token: SettingsService }, { token: UserAgentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
781
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CommonLogAttributesService, providedIn: 'root' }); }
|
|
782
|
+
}
|
|
783
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CommonLogAttributesService, decorators: [{
|
|
784
|
+
type: Injectable,
|
|
785
|
+
args: [{
|
|
786
|
+
providedIn: 'root',
|
|
787
|
+
}]
|
|
788
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
789
|
+
type: Inject,
|
|
790
|
+
args: [windowToken]
|
|
791
|
+
}] }, { type: SettingsService }, { type: UserAgentService }] });
|
|
792
|
+
|
|
793
|
+
class ElkLoggerService {
|
|
794
|
+
constructor(commonLogAttributesService, http, ngZone) {
|
|
795
|
+
this.commonLogAttributesService = commonLogAttributesService;
|
|
796
|
+
this.http = http;
|
|
797
|
+
this.ngZone = ngZone;
|
|
798
|
+
this.vendors = new RegExp('node_modules\\/(@angular|zone).*.js$');
|
|
799
|
+
this.stackTrace = this.loadStackTrace();
|
|
800
|
+
}
|
|
801
|
+
handleError(error) {
|
|
802
|
+
this.ngZone.runOutsideAngular(() => {
|
|
803
|
+
if (isDevMode()) {
|
|
804
|
+
console.error(error);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
this.parseError(error).catch(console.log);
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
log(message, tags, extra) {
|
|
811
|
+
const logTags = [ErrorTags.HEADLESS_UI, ...tags];
|
|
812
|
+
if (isDevMode()) {
|
|
813
|
+
console.log(message, tags);
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
const logMessage = {
|
|
817
|
+
additionalInfo: this.getAdditionalInfo(),
|
|
818
|
+
extra,
|
|
819
|
+
message,
|
|
820
|
+
};
|
|
821
|
+
this.sendLog(logMessage, logTags);
|
|
822
|
+
}
|
|
823
|
+
async parseError(error) {
|
|
824
|
+
const errorObj = error instanceof TaggedError
|
|
825
|
+
? error
|
|
826
|
+
: new TaggedError(error.message || error.toString());
|
|
827
|
+
errorObj.trace = await this.getErrorTrace(errorObj);
|
|
828
|
+
errorObj.additionalInfo = this.getAdditionalInfo();
|
|
829
|
+
const { tags } = errorObj;
|
|
830
|
+
const cleanError = this.removeErrorMetaFields(errorObj);
|
|
831
|
+
this.sendLog(cleanError, tags);
|
|
832
|
+
return errorObj;
|
|
833
|
+
}
|
|
834
|
+
async loadStackTrace() {
|
|
835
|
+
const library = await import('stacktrace-js');
|
|
836
|
+
return library.default;
|
|
837
|
+
}
|
|
838
|
+
async getErrorTrace(error) {
|
|
839
|
+
const stackTrace = await this.stackTrace;
|
|
840
|
+
const stackFramesArr = await stackTrace.fromError(error);
|
|
841
|
+
const filteredFramesArr = stackFramesArr.filter(({ fileName }) => fileName && !this.vendors.test(fileName));
|
|
842
|
+
return filteredFramesArr
|
|
843
|
+
.map((stackFrame) => stackFrame.toString())
|
|
844
|
+
.join('\n');
|
|
845
|
+
}
|
|
846
|
+
getAdditionalInfo() {
|
|
847
|
+
const commonLogAttributes = this.commonLogAttributesService.getAttributes();
|
|
848
|
+
return {
|
|
849
|
+
token: commonLogAttributes.token,
|
|
850
|
+
location: {
|
|
851
|
+
url: commonLogAttributes.locationUrl ?? '',
|
|
852
|
+
},
|
|
853
|
+
project: {
|
|
854
|
+
id: commonLogAttributes.projectId ?? null,
|
|
855
|
+
},
|
|
856
|
+
referrer: {
|
|
857
|
+
url: commonLogAttributes.referrerUrl ?? '',
|
|
858
|
+
},
|
|
859
|
+
viewport: {
|
|
860
|
+
width: commonLogAttributes.viewportWidth,
|
|
861
|
+
height: commonLogAttributes.viewportHeight,
|
|
862
|
+
},
|
|
863
|
+
cdn_address: commonLogAttributes.cdnAddress,
|
|
864
|
+
country: commonLogAttributes.country ?? '',
|
|
865
|
+
local: commonLogAttributes.local ?? '',
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
removeErrorMetaFields(error) {
|
|
869
|
+
const metaPropList = [
|
|
870
|
+
'parentTag',
|
|
871
|
+
'childTag',
|
|
872
|
+
'RESTRICTED_KEYS_REGEXP',
|
|
873
|
+
'tags',
|
|
874
|
+
];
|
|
875
|
+
Object.keys(error).forEach((key) => {
|
|
876
|
+
if (metaPropList.includes(key))
|
|
877
|
+
delete error[key];
|
|
878
|
+
});
|
|
879
|
+
// implementing own 'message' property from prototype
|
|
880
|
+
return { ...error, message: error.message };
|
|
881
|
+
}
|
|
882
|
+
sendLog(message, tags) {
|
|
883
|
+
const url = `https://logs-01.xsolla.com/tag/${tags.join(',')}`;
|
|
884
|
+
firstValueFrom(this.http.post(url, message, {
|
|
885
|
+
headers: new HttpHeaders().set('Content-Type', 'text/plain'),
|
|
886
|
+
responseType: 'text',
|
|
887
|
+
})).catch((err) => console.error('Elk Logger: request error', err));
|
|
888
|
+
}
|
|
889
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, deps: [{ token: CommonLogAttributesService }, { token: i1.HttpClient }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
890
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, providedIn: 'root' }); }
|
|
891
|
+
}
|
|
892
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, decorators: [{
|
|
893
|
+
type: Injectable,
|
|
894
|
+
args: [{
|
|
895
|
+
providedIn: 'root',
|
|
896
|
+
}]
|
|
897
|
+
}], ctorParameters: () => [{ type: CommonLogAttributesService }, { type: i1.HttpClient }, { type: i0.NgZone }] });
|
|
898
|
+
|
|
899
|
+
class LoggerService {
|
|
900
|
+
constructor(elkLoggerService) {
|
|
901
|
+
this.elkLoggerService = elkLoggerService;
|
|
902
|
+
this.handlers = [];
|
|
903
|
+
}
|
|
904
|
+
register(handler) {
|
|
905
|
+
this.handlers.push(handler);
|
|
906
|
+
}
|
|
907
|
+
error(error) {
|
|
908
|
+
this.elkLoggerService.handleError(error);
|
|
909
|
+
this.handlers.forEach((handler) => handler.handleError(error));
|
|
910
|
+
}
|
|
911
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoggerService, deps: [{ token: ElkLoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
912
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoggerService, providedIn: 'root' }); }
|
|
913
|
+
}
|
|
914
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoggerService, decorators: [{
|
|
915
|
+
type: Injectable,
|
|
916
|
+
args: [{
|
|
917
|
+
providedIn: 'root',
|
|
918
|
+
}]
|
|
919
|
+
}], ctorParameters: () => [{ type: ElkLoggerService }] });
|
|
920
|
+
|
|
921
|
+
class CountryService {
|
|
922
|
+
get userIpCountry() {
|
|
923
|
+
const user = this.settingsService.user;
|
|
924
|
+
return user?.ip_country ?? user?.country.value ?? '';
|
|
925
|
+
}
|
|
926
|
+
constructor(settingsService) {
|
|
927
|
+
this.settingsService = settingsService;
|
|
928
|
+
this.userDefinedCountry = null;
|
|
929
|
+
}
|
|
930
|
+
setCountry(country) {
|
|
931
|
+
this.userDefinedCountry = country;
|
|
932
|
+
}
|
|
933
|
+
getCountry() {
|
|
934
|
+
return this.userDefinedCountry ?? this.getTokenCountry();
|
|
935
|
+
}
|
|
936
|
+
getTokenCountry() {
|
|
937
|
+
return this.settingsService.user.country.value;
|
|
938
|
+
}
|
|
939
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
940
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, providedIn: 'root' }); }
|
|
941
|
+
}
|
|
942
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, decorators: [{
|
|
943
|
+
type: Injectable,
|
|
944
|
+
args: [{
|
|
945
|
+
providedIn: 'root',
|
|
946
|
+
}]
|
|
947
|
+
}], ctorParameters: () => [{ type: SettingsService }] });
|
|
948
|
+
|
|
949
|
+
class ResponseError extends AppError {
|
|
950
|
+
constructor(message) {
|
|
951
|
+
super('Response failed' + (message ? `: "${message}".` : '.'));
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
var BooleanNumber;
|
|
956
|
+
(function (BooleanNumber) {
|
|
957
|
+
BooleanNumber[BooleanNumber["false"] = 0] = "false";
|
|
958
|
+
BooleanNumber[BooleanNumber["true"] = 1] = "true";
|
|
959
|
+
})(BooleanNumber || (BooleanNumber = {}));
|
|
960
|
+
|
|
961
|
+
class PaymentMethodsResponse {
|
|
962
|
+
constructor(paymentMethods) {
|
|
963
|
+
this.especial = paymentMethods.especial.map((method) => this.mapPaymentMethod(method));
|
|
964
|
+
this.top = paymentMethods.top.map((method) => this.mapPaymentMethod(method));
|
|
965
|
+
this.remained = paymentMethods.remained.map((method) => this.mapPaymentMethod(method));
|
|
966
|
+
this.remainedCount = {
|
|
967
|
+
total: paymentMethods.remained_count.total,
|
|
968
|
+
visible: paymentMethods.remained_count.visible,
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
mapPaymentMethod(method) {
|
|
972
|
+
return {
|
|
973
|
+
id: method.id,
|
|
974
|
+
rank: method.rank,
|
|
975
|
+
name: method.name,
|
|
976
|
+
aliases: method.aliases,
|
|
977
|
+
categories: method.cat,
|
|
978
|
+
recommended: method.recommended === BooleanNumber.true,
|
|
979
|
+
enabledSaveAccount: method.enabled_save_account,
|
|
980
|
+
iconName: method.switch_icon_name,
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
const paymentMethodsResponseFactoryToken = new InjectionToken('PaymentMethodsResponse');
|
|
986
|
+
const paymentMethodsResponseFactoryProvider = {
|
|
987
|
+
provide: paymentMethodsResponseFactoryToken,
|
|
988
|
+
useValue: (...args) => new PaymentMethodsResponse(...args),
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
class PaymentMethodsService {
|
|
992
|
+
constructor(responseFactory, settingsService, countryService, secureApi) {
|
|
993
|
+
this.responseFactory = responseFactory;
|
|
994
|
+
this.settingsService = settingsService;
|
|
995
|
+
this.countryService = countryService;
|
|
996
|
+
this.secureApi = secureApi;
|
|
997
|
+
this.apiRoute = 'remained_payment_methods';
|
|
998
|
+
this.cache = new Map();
|
|
1246
999
|
}
|
|
1247
|
-
|
|
1248
|
-
return this.
|
|
1000
|
+
async getAllMethods() {
|
|
1001
|
+
return this.request();
|
|
1249
1002
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1003
|
+
async getList(isSaveMethodMode) {
|
|
1004
|
+
const response = await this.request(isSaveMethodMode);
|
|
1005
|
+
if (this.isFixedPaymentMethod) {
|
|
1006
|
+
return this.filterMethodsByFixedPaymentMethod(response.remained);
|
|
1253
1007
|
}
|
|
1254
|
-
return
|
|
1008
|
+
return response.remained;
|
|
1255
1009
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1010
|
+
async getQuickMethods() {
|
|
1011
|
+
const response = await this.request();
|
|
1012
|
+
return response.especial;
|
|
1258
1013
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1014
|
+
async request(isSaveMethodMode) {
|
|
1015
|
+
const requestParams = {
|
|
1016
|
+
access_token: this.settingsService.token,
|
|
1017
|
+
country: this.countryService.getCountry(),
|
|
1018
|
+
save_payment_account_only: isSaveMethodMode
|
|
1019
|
+
? "1" /* XpsBoolean.true */
|
|
1020
|
+
: "0" /* XpsBoolean.false */,
|
|
1021
|
+
refer: this.settingsService.refer,
|
|
1022
|
+
};
|
|
1023
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
1024
|
+
if (!this.cache.has(cacheKey)) {
|
|
1025
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
1026
|
+
.post(this.apiRoute, new URLSearchParams({
|
|
1027
|
+
...requestParams,
|
|
1028
|
+
refer: String(requestParams.refer),
|
|
1029
|
+
}), {
|
|
1030
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
1031
|
+
responseType: 'json',
|
|
1032
|
+
})
|
|
1033
|
+
.pipe(map((response) => this.responseFactory(response.payment_methods)))).catch((error) => {
|
|
1034
|
+
throw new ResponseError(error.message);
|
|
1035
|
+
}));
|
|
1262
1036
|
}
|
|
1263
|
-
|
|
1037
|
+
// @ts-expect-error the map already has the cache with key
|
|
1038
|
+
return this.cache.get(cacheKey);
|
|
1264
1039
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1040
|
+
filterMethodsByFixedPaymentMethod(methods) {
|
|
1041
|
+
const fixedPid = this.settingsService.purchase?.payment_system?.id;
|
|
1042
|
+
const paymentMethod = methods.find((method) => method.id === fixedPid);
|
|
1043
|
+
return paymentMethod ? [paymentMethod] : [];
|
|
1267
1044
|
}
|
|
1268
|
-
get
|
|
1269
|
-
|
|
1270
|
-
return null;
|
|
1271
|
-
}
|
|
1272
|
-
const versionRegExp = new RegExp('(Version)\\/(.+)\\s');
|
|
1273
|
-
const version = versionRegExp.exec(this.userAgent);
|
|
1274
|
-
if (!version) {
|
|
1275
|
-
return null;
|
|
1276
|
-
}
|
|
1277
|
-
return Number(version[2].split('.')[0]);
|
|
1045
|
+
get isFixedPaymentMethod() {
|
|
1046
|
+
return !!this.settingsService.purchase?.payment_system?.id;
|
|
1278
1047
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1048
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, deps: [{ token: paymentMethodsResponseFactoryToken }, { token: SettingsService }, { token: CountryService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1049
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, providedIn: 'root' }); }
|
|
1050
|
+
}
|
|
1051
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, decorators: [{
|
|
1052
|
+
type: Injectable,
|
|
1053
|
+
args: [{
|
|
1054
|
+
providedIn: 'root',
|
|
1055
|
+
}]
|
|
1056
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1057
|
+
type: Inject,
|
|
1058
|
+
args: [paymentMethodsResponseFactoryToken]
|
|
1059
|
+
}] }, { type: SettingsService }, { type: CountryService }, { type: SecureApiClient }] });
|
|
1060
|
+
|
|
1061
|
+
class SavedMethodsResponse {
|
|
1062
|
+
constructor(savedMethods) {
|
|
1063
|
+
this.list = savedMethods.list.map((method) => this.mapSavedMethod(method));
|
|
1285
1064
|
}
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1065
|
+
mapSavedMethod(method) {
|
|
1066
|
+
return {
|
|
1067
|
+
currency: method.currency,
|
|
1068
|
+
form: method.form,
|
|
1069
|
+
id: method.id,
|
|
1070
|
+
isSelected: method.isSelected,
|
|
1071
|
+
isBabkaPay: method.is_babka_pay,
|
|
1072
|
+
name: method.name,
|
|
1073
|
+
pid: method.pid,
|
|
1074
|
+
psName: method.psName,
|
|
1075
|
+
recurrentType: method.recurrent_type,
|
|
1076
|
+
replaced: method.replaced,
|
|
1077
|
+
type: method.type,
|
|
1078
|
+
cardExpiryDate: method.card_expiry_date,
|
|
1079
|
+
dateCreate: method.date_create,
|
|
1080
|
+
dateLastCharge: method.date_last_charge,
|
|
1081
|
+
iconName: method.switch_icon_name,
|
|
1082
|
+
userEmail: method.user_email,
|
|
1083
|
+
partner: method.partner,
|
|
1294
1084
|
};
|
|
1295
|
-
if (this.isMobileDevice) {
|
|
1296
|
-
browserInfo.mobile = true;
|
|
1297
|
-
}
|
|
1298
|
-
if (this.osType) {
|
|
1299
|
-
// @ts-expect-error index is string
|
|
1300
|
-
browserInfo[this.osType.toLowerCase()] = true;
|
|
1301
|
-
}
|
|
1302
|
-
if (this.window.navigator.platform?.includes('iPhone')) {
|
|
1303
|
-
browserInfo.iphone = true;
|
|
1304
|
-
}
|
|
1305
|
-
if (this.window.navigator.platform?.includes('iPod')) {
|
|
1306
|
-
browserInfo.ipod = true;
|
|
1307
|
-
}
|
|
1308
|
-
if (this.window.navigator.platform?.includes('iPad')) {
|
|
1309
|
-
browserInfo.ipad = true;
|
|
1310
|
-
browserInfo.tablet = true;
|
|
1311
|
-
}
|
|
1312
|
-
if (this.isAndroid) {
|
|
1313
|
-
browserInfo.android = true;
|
|
1314
|
-
}
|
|
1315
|
-
return browserInfo;
|
|
1316
|
-
}
|
|
1317
|
-
get isMobileDevice() {
|
|
1318
|
-
const deviceAgents = [
|
|
1319
|
-
'Android',
|
|
1320
|
-
'webOS',
|
|
1321
|
-
'iPhone',
|
|
1322
|
-
'iPad',
|
|
1323
|
-
'iPod',
|
|
1324
|
-
'BlackBerry',
|
|
1325
|
-
'IEMobile',
|
|
1326
|
-
'Opera Mini',
|
|
1327
|
-
'Mobile',
|
|
1328
|
-
'Tablet',
|
|
1329
|
-
'Kindle',
|
|
1330
|
-
'Playbook',
|
|
1331
|
-
'Silk',
|
|
1332
|
-
'Puffin',
|
|
1333
|
-
'CriOS',
|
|
1334
|
-
];
|
|
1335
|
-
return new RegExp(deviceAgents.join('|'), 'i').test(this.userAgent);
|
|
1336
1085
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
const savedMethodsResponseFactoryToken = new InjectionToken('SavedMethodsResponse');
|
|
1089
|
+
const savedMethodsResponseFactoryProvider = {
|
|
1090
|
+
provide: savedMethodsResponseFactoryToken,
|
|
1091
|
+
useValue: (...args) => new SavedMethodsResponse(...args),
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
class SavedMethodsService {
|
|
1095
|
+
constructor(responseFactory, settingsService, secureApi) {
|
|
1096
|
+
this.responseFactory = responseFactory;
|
|
1097
|
+
this.settingsService = settingsService;
|
|
1098
|
+
this.secureApi = secureApi;
|
|
1099
|
+
this.apiRoute = 'savedmethods';
|
|
1100
|
+
this.cache = new Map();
|
|
1339
1101
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1102
|
+
async getList(needResetCache = false) {
|
|
1103
|
+
if (needResetCache) {
|
|
1104
|
+
this.cache.clear();
|
|
1105
|
+
}
|
|
1106
|
+
const response = await this.request();
|
|
1107
|
+
return response.list;
|
|
1346
1108
|
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
this.
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1109
|
+
async request() {
|
|
1110
|
+
const requestParams = {
|
|
1111
|
+
access_token: this.settingsService.token,
|
|
1112
|
+
};
|
|
1113
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
1114
|
+
if (!this.cache.has(cacheKey)) {
|
|
1115
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
1116
|
+
.post(this.apiRoute, new URLSearchParams({ ...requestParams }), {
|
|
1117
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
1118
|
+
responseType: 'json',
|
|
1119
|
+
})
|
|
1120
|
+
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
1121
|
+
throw new ResponseError(error.message);
|
|
1122
|
+
}));
|
|
1360
1123
|
}
|
|
1124
|
+
// @ts-expect-error the map already has the cache with key
|
|
1125
|
+
return this.cache.get(cacheKey);
|
|
1126
|
+
}
|
|
1127
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, deps: [{ token: savedMethodsResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1128
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, providedIn: 'root' }); }
|
|
1129
|
+
}
|
|
1130
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, decorators: [{
|
|
1131
|
+
type: Injectable,
|
|
1132
|
+
args: [{
|
|
1133
|
+
providedIn: 'root',
|
|
1134
|
+
}]
|
|
1135
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1136
|
+
type: Inject,
|
|
1137
|
+
args: [savedMethodsResponseFactoryToken]
|
|
1138
|
+
}] }, { type: SettingsService }, { type: SecureApiClient }] });
|
|
1139
|
+
|
|
1140
|
+
class UserBalanceResponse {
|
|
1141
|
+
constructor(userBalance) {
|
|
1142
|
+
this.isEnoughUserBalance = userBalance.is_enough_user_balance ?? false;
|
|
1143
|
+
this.isEnoughUserRecurrentBalance =
|
|
1144
|
+
userBalance.is_enough_user_recurrent_balance ?? false;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
const userBalanceResponseFactoryToken = new InjectionToken('UserBalanceResponse');
|
|
1149
|
+
const userBalanceResponseFactoryProvider = {
|
|
1150
|
+
provide: userBalanceResponseFactoryToken,
|
|
1151
|
+
useValue: (...args) => new UserBalanceResponse(...args),
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1154
|
+
class UserBalanceService {
|
|
1155
|
+
constructor(responseFactory, settingsService, secureApi) {
|
|
1156
|
+
this.responseFactory = responseFactory;
|
|
1157
|
+
this.settingsService = settingsService;
|
|
1158
|
+
this.secureApi = secureApi;
|
|
1159
|
+
this.apiRoute = 'balance/sufficiency';
|
|
1160
|
+
this.cache = new Map();
|
|
1361
1161
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
this.
|
|
1162
|
+
async getUserBalance() {
|
|
1163
|
+
return this.request();
|
|
1164
|
+
}
|
|
1165
|
+
getUserBalanceValue() {
|
|
1166
|
+
return this.settingsService.user.user_balance;
|
|
1167
|
+
}
|
|
1168
|
+
async request() {
|
|
1169
|
+
const requestParams = {
|
|
1170
|
+
access_token: this.settingsService.token,
|
|
1171
|
+
};
|
|
1172
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
1173
|
+
if (!this.cache.has(cacheKey)) {
|
|
1174
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
1175
|
+
.post(this.apiRoute, new URLSearchParams({ ...requestParams }), {
|
|
1176
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
1177
|
+
responseType: 'json',
|
|
1178
|
+
})
|
|
1179
|
+
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
1180
|
+
throw new ResponseError(error.message);
|
|
1181
|
+
}));
|
|
1371
1182
|
}
|
|
1183
|
+
// @ts-expect-error the map already has the cache with key
|
|
1184
|
+
return this.cache.get(cacheKey);
|
|
1372
1185
|
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1186
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, deps: [{ token: userBalanceResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1187
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, providedIn: 'root' }); }
|
|
1188
|
+
}
|
|
1189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, decorators: [{
|
|
1190
|
+
type: Injectable,
|
|
1191
|
+
args: [{
|
|
1192
|
+
providedIn: 'root',
|
|
1193
|
+
}]
|
|
1194
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1195
|
+
type: Inject,
|
|
1196
|
+
args: [userBalanceResponseFactoryToken]
|
|
1197
|
+
}] }, { type: SettingsService }, { type: SecureApiClient }] });
|
|
1198
|
+
|
|
1199
|
+
class UrlService {
|
|
1200
|
+
addSearchParams(url, params = {}) {
|
|
1201
|
+
if (!url) {
|
|
1202
|
+
return '';
|
|
1203
|
+
}
|
|
1204
|
+
const urlObject = new URL(url);
|
|
1205
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1206
|
+
urlObject.searchParams.set(key, value);
|
|
1207
|
+
}
|
|
1208
|
+
return urlObject.toString();
|
|
1375
1209
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1210
|
+
getSearchParams(url) {
|
|
1211
|
+
if (!url) {
|
|
1212
|
+
return {};
|
|
1213
|
+
}
|
|
1214
|
+
const urlObject = new URL(url);
|
|
1215
|
+
const searchParams = {};
|
|
1216
|
+
for (const [key, value] of urlObject.searchParams) {
|
|
1217
|
+
searchParams[key] = value;
|
|
1218
|
+
}
|
|
1219
|
+
return searchParams;
|
|
1378
1220
|
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1221
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1222
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, providedIn: 'root' }); }
|
|
1223
|
+
}
|
|
1224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, decorators: [{
|
|
1225
|
+
type: Injectable,
|
|
1226
|
+
args: [{
|
|
1227
|
+
providedIn: 'root',
|
|
1228
|
+
}]
|
|
1229
|
+
}] });
|
|
1230
|
+
|
|
1231
|
+
class PaymentConfigService {
|
|
1232
|
+
constructor(urlService, settingsService) {
|
|
1233
|
+
this.urlService = urlService;
|
|
1234
|
+
this.settingsService = settingsService;
|
|
1381
1235
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1236
|
+
enrich(config) {
|
|
1237
|
+
if (!config.returnUrl) {
|
|
1238
|
+
throw new Error('URL is not provided in payment config');
|
|
1239
|
+
}
|
|
1240
|
+
return {
|
|
1241
|
+
...config,
|
|
1242
|
+
returnUrl: this.enrichReturnUrl(config.returnUrl, !!config.savePaymentMethod),
|
|
1243
|
+
};
|
|
1384
1244
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1245
|
+
enrichReturnUrl(returnUrl, savePaymentMethod) {
|
|
1246
|
+
const enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
1247
|
+
token: this.settingsService.token,
|
|
1248
|
+
isSavePaymentAccount: savePaymentMethod
|
|
1249
|
+
? "1" /* XpsBoolean.true */
|
|
1250
|
+
: "0" /* XpsBoolean.false */,
|
|
1251
|
+
});
|
|
1252
|
+
return enrichedUrl;
|
|
1387
1253
|
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
[
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1254
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, deps: [{ token: UrlService }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1255
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, providedIn: 'root' }); }
|
|
1256
|
+
}
|
|
1257
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
1258
|
+
type: Injectable,
|
|
1259
|
+
args: [{
|
|
1260
|
+
providedIn: 'root',
|
|
1261
|
+
}]
|
|
1262
|
+
}], ctorParameters: () => [{ type: UrlService }, { type: SettingsService }] });
|
|
1263
|
+
|
|
1264
|
+
var XpsCommand;
|
|
1265
|
+
(function (XpsCommand) {
|
|
1266
|
+
XpsCommand["form"] = "form";
|
|
1267
|
+
XpsCommand["check"] = "check";
|
|
1268
|
+
XpsCommand["status"] = "status";
|
|
1269
|
+
XpsCommand["checkout"] = "checkout";
|
|
1270
|
+
XpsCommand["account"] = "account";
|
|
1271
|
+
XpsCommand["create"] = "create";
|
|
1272
|
+
})(XpsCommand || (XpsCommand = {}));
|
|
1273
|
+
|
|
1274
|
+
var FieldNames;
|
|
1275
|
+
(function (FieldNames) {
|
|
1276
|
+
FieldNames["address1"] = "address1";
|
|
1277
|
+
FieldNames["address2"] = "address2";
|
|
1278
|
+
FieldNames["address"] = "address";
|
|
1279
|
+
FieldNames["allowRecurrentSubscription"] = "allowRecurrentSubscription";
|
|
1280
|
+
FieldNames["allowSubscription"] = "allowSubscription";
|
|
1281
|
+
FieldNames["apt"] = "apt";
|
|
1282
|
+
FieldNames["availableCardTypes"] = "available_card_types";
|
|
1283
|
+
FieldNames["bank"] = "bank";
|
|
1284
|
+
FieldNames["birthDate"] = "birth_date";
|
|
1285
|
+
FieldNames["cardMonth"] = "card_month";
|
|
1286
|
+
FieldNames["cardYear"] = "card_year";
|
|
1287
|
+
FieldNames["cardExpire"] = "card_expire";
|
|
1288
|
+
FieldNames["cardNumber"] = "card_number";
|
|
1289
|
+
FieldNames["cardholdername"] = "cardholdername";
|
|
1290
|
+
FieldNames["city"] = "city";
|
|
1291
|
+
FieldNames["couponCode"] = "couponCode";
|
|
1292
|
+
FieldNames["cpfName"] = "cpf_name";
|
|
1293
|
+
FieldNames["cpfNumber"] = "cpf_number";
|
|
1294
|
+
FieldNames["cvv"] = "cvv";
|
|
1295
|
+
FieldNames["description"] = "description";
|
|
1296
|
+
FieldNames["email"] = "email";
|
|
1297
|
+
FieldNames["psEmail"] = "psEmail";
|
|
1298
|
+
FieldNames["psAccountCountry"] = "psAccountCountry";
|
|
1299
|
+
FieldNames["bazitemail"] = "bazitemail";
|
|
1300
|
+
FieldNames["euCheck"] = "eu_check";
|
|
1301
|
+
FieldNames["extraCvv"] = "extra_cvv";
|
|
1302
|
+
FieldNames["extraCardNumber"] = "extra_card_number";
|
|
1303
|
+
FieldNames["extraCardType"] = "extra_card_type";
|
|
1304
|
+
FieldNames["fName"] = "f_name";
|
|
1305
|
+
FieldNames["installments"] = "installments";
|
|
1306
|
+
FieldNames["lName"] = "l_name";
|
|
1307
|
+
FieldNames["needInstallments"] = "needInstallments";
|
|
1308
|
+
FieldNames["personId"] = "person_id";
|
|
1309
|
+
FieldNames["personIdAr"] = "person_id_ar";
|
|
1310
|
+
FieldNames["personIdCo"] = "person_id_co";
|
|
1311
|
+
FieldNames["phone"] = "phone";
|
|
1312
|
+
FieldNames["purchaseDescription"] = "purchaseDescription";
|
|
1313
|
+
FieldNames["recurrentType"] = "recurrent_type";
|
|
1314
|
+
FieldNames["rockstarTaxes"] = "rockstar_taxes";
|
|
1315
|
+
FieldNames["state"] = "state";
|
|
1316
|
+
FieldNames["street"] = "street";
|
|
1317
|
+
FieldNames["streetNumber"] = "street_number";
|
|
1318
|
+
FieldNames["take2Taxes"] = "take2_taxes";
|
|
1319
|
+
FieldNames["termsAndConditions"] = "termsAndConditions";
|
|
1320
|
+
FieldNames["termsAndConditionsAtariPp"] = "termsAndConditionsAtariPP";
|
|
1321
|
+
FieldNames["termsAndConditionsAtariTc"] = "termsAndConditionsAtariTC";
|
|
1322
|
+
FieldNames["termsAndConditionsHtcEula"] = "termsAndConditionsHtcEula";
|
|
1323
|
+
FieldNames["termsAndConditionsRobloxEula"] = "termsAndConditionsRobloxEula";
|
|
1324
|
+
FieldNames["termsAndConditionsRolandEula"] = "termsAndConditionsRolandEula";
|
|
1325
|
+
FieldNames["termsAndConditionsDeusLoVultEula"] = "termsAndConditionsDeusLoVultEula";
|
|
1326
|
+
FieldNames["termsAndConditionsOnzenga"] = "termsAndConditionsOnzenga";
|
|
1327
|
+
FieldNames["licenseDisclaimer"] = "licenseDisclaimer";
|
|
1328
|
+
FieldNames["xsollaTipsAmount"] = "xsollaTipsAmount";
|
|
1329
|
+
FieldNames["zip"] = "zip";
|
|
1330
|
+
FieldNames["allowSave"] = "allowSave";
|
|
1331
|
+
FieldNames["koreaLimitsInstruction"] = "korea_limits_instruction";
|
|
1332
|
+
FieldNames["tokenApplePay"] = "token_applepay";
|
|
1333
|
+
FieldNames["fixInvoice"] = "fix_invoice";
|
|
1334
|
+
FieldNames["fixPid"] = "fix_pid";
|
|
1335
|
+
FieldNames["signature"] = "signature";
|
|
1336
|
+
FieldNames["qr"] = "qr";
|
|
1337
|
+
FieldNames["sum"] = "sum";
|
|
1338
|
+
FieldNames["out"] = "out";
|
|
1339
|
+
FieldNames["tinkoffDisclaimer"] = "ps.tinkoff.disclaimer";
|
|
1340
|
+
FieldNames["ppEmail"] = "pp_email";
|
|
1341
|
+
FieldNames["redeemPoints"] = "redeemPoints";
|
|
1342
|
+
FieldNames["omnibusDirective"] = "omnibus_directive";
|
|
1343
|
+
FieldNames["labelApplePay"] = "label_applePay";
|
|
1344
|
+
FieldNames["countryCode"] = "countryCode";
|
|
1345
|
+
FieldNames["merchantCapabilities"] = "merchantCapabilities";
|
|
1346
|
+
FieldNames["requiredBillingContactFields"] = "requiredBillingContactFields";
|
|
1347
|
+
FieldNames["requiredShippingContactFields"] = "requiredShippingContactFields";
|
|
1348
|
+
FieldNames["supportedNetworks"] = "supportedNetworks";
|
|
1349
|
+
FieldNames["acquirer"] = "acquirer";
|
|
1350
|
+
FieldNames["isSandbox"] = "isSandbox";
|
|
1351
|
+
FieldNames["payInstanceAccountId"] = "payInstanceAccountId";
|
|
1352
|
+
FieldNames["getApplePaySessionUrl"] = "getApplePaySessionUrl";
|
|
1353
|
+
FieldNames["payViaCheckoutUrl"] = "payViaCheckoutUrl";
|
|
1354
|
+
FieldNames["googlePayInitData"] = "googlePayInitData";
|
|
1355
|
+
FieldNames["googlePayPaymentData"] = "googlePayPaymentData";
|
|
1356
|
+
})(FieldNames || (FieldNames = {}));
|
|
1357
|
+
|
|
1358
|
+
class SubmitResponse {
|
|
1359
|
+
constructor(parameters, responseNumber = 0) {
|
|
1360
|
+
this.responseNumber = responseNumber;
|
|
1361
|
+
/* Todo split into properties */
|
|
1362
|
+
this.parameters = parameters;
|
|
1363
|
+
this.fields = Object.keys(parameters.form).map((key) => parameters.form[key]);
|
|
1364
|
+
if (parameters.onlineBanking) {
|
|
1365
|
+
this.onlineBanking = {
|
|
1366
|
+
url: parameters.onlineBanking.value,
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
this.isNeedRedirect =
|
|
1370
|
+
parameters.currentCommand === XpsCommand.account ||
|
|
1371
|
+
(parameters.currentCommand === XpsCommand.checkout &&
|
|
1372
|
+
Boolean(parameters.checkout));
|
|
1373
|
+
this.buyData = parameters.buyData;
|
|
1374
|
+
this.fixInvoice = this.fields.find((field) => field.name === FieldNames.fixInvoice)?.value;
|
|
1375
|
+
this.signature = this.fields.find((field) => field.name === FieldNames.signature)?.value;
|
|
1376
|
+
this.hasFatalErrors = parameters.textAll?.fatal;
|
|
1377
|
+
this.userSession = parameters.userSession;
|
|
1378
|
+
this.pid = parameters.pid;
|
|
1379
|
+
this.errors = parameters.errors;
|
|
1380
|
+
this.summary = parameters.summary;
|
|
1381
|
+
this.title = parameters.title;
|
|
1382
|
+
this.currentCommand = parameters.currentCommand;
|
|
1383
|
+
this.messages = parameters.messages;
|
|
1384
|
+
this.xsollaNumber = {
|
|
1385
|
+
accountXsolla: parameters.accountXsolla,
|
|
1386
|
+
isMap: parameters.isMap,
|
|
1387
|
+
};
|
|
1399
1388
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
class InitializeResponse {
|
|
1392
|
+
constructor(response) {
|
|
1393
|
+
this.paymentForm = null;
|
|
1394
|
+
this.paymentForm = this.extractPaymentForm(response);
|
|
1402
1395
|
}
|
|
1403
|
-
|
|
1404
|
-
if (
|
|
1405
|
-
return
|
|
1406
|
-
}
|
|
1407
|
-
if (this.window.navigator.platform?.includes('MacIntel')) {
|
|
1408
|
-
return 'mac';
|
|
1409
|
-
}
|
|
1410
|
-
if (this.isXbox) {
|
|
1411
|
-
return 'xbox';
|
|
1412
|
-
}
|
|
1413
|
-
if (this.isWindows) {
|
|
1414
|
-
return 'windows';
|
|
1415
|
-
}
|
|
1416
|
-
if (this.isAndroid) {
|
|
1417
|
-
return 'android';
|
|
1418
|
-
}
|
|
1419
|
-
if (this.isLinux) {
|
|
1420
|
-
return 'linux';
|
|
1396
|
+
extractPaymentForm(response) {
|
|
1397
|
+
if (!response) {
|
|
1398
|
+
return null;
|
|
1421
1399
|
}
|
|
1422
|
-
return
|
|
1400
|
+
return {
|
|
1401
|
+
totalAmount: response.buyData.sum,
|
|
1402
|
+
currency: response.buyData.currency,
|
|
1403
|
+
fields: Object.keys(response.form).map((key) => response.form[key]),
|
|
1404
|
+
taxDisclaimer: response.taxDisclaimer,
|
|
1405
|
+
number: response.number,
|
|
1406
|
+
barcode: response.barcode,
|
|
1407
|
+
instruction: response.instruction,
|
|
1408
|
+
offers: response.offers,
|
|
1409
|
+
error: response.error,
|
|
1410
|
+
errors: response.errors,
|
|
1411
|
+
restrictions: response.restrictions,
|
|
1412
|
+
info: response.info,
|
|
1413
|
+
buyData: response.buyData,
|
|
1414
|
+
pid: response.pid,
|
|
1415
|
+
messages: response.messages ?? [],
|
|
1416
|
+
title: response.title,
|
|
1417
|
+
summary: response.summary,
|
|
1418
|
+
skipForm: response.skipForm,
|
|
1419
|
+
isSavedMethodPayment: !!response.form?.saved_method_id,
|
|
1420
|
+
couponCode: response.form?.couponCode?.value || '',
|
|
1421
|
+
publicId: response.public_id,
|
|
1422
|
+
skipCheckout: response.skipCheckout,
|
|
1423
|
+
koreaNotification: response.form.korea_limits_instruction,
|
|
1424
|
+
isCheckout: response.isCheckout,
|
|
1425
|
+
categories: response.categories,
|
|
1426
|
+
hasFatalErrors: response.textAll?.fatal,
|
|
1427
|
+
userSession: response.userSession,
|
|
1428
|
+
statusText: response.status?.statusData?.stateText ?? null,
|
|
1429
|
+
country: response.country ? response.country.iso : null,
|
|
1430
|
+
};
|
|
1423
1431
|
}
|
|
1424
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, deps: [{ token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1425
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, providedIn: 'root' }); }
|
|
1426
1432
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1433
|
+
|
|
1434
|
+
const isSubmitResponse = (value) => {
|
|
1435
|
+
return value instanceof SubmitResponse;
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
var InputEventName;
|
|
1439
|
+
(function (InputEventName) {
|
|
1440
|
+
InputEventName["blur"] = "blur";
|
|
1441
|
+
InputEventName["focus"] = "focus";
|
|
1442
|
+
})(InputEventName || (InputEventName = {}));
|
|
1443
|
+
|
|
1444
|
+
const fieldsAllowedToOverride = new Set([
|
|
1445
|
+
FieldNames.allowSubscription,
|
|
1446
|
+
FieldNames.allowSave,
|
|
1447
|
+
]);
|
|
1448
|
+
|
|
1449
|
+
function isXpsBoolean(value) {
|
|
1450
|
+
return value === "1" /* XpsBoolean.true */ || value === "0" /* XpsBoolean.false */;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* Configuration for fields that can be overridden by partner.
|
|
1455
|
+
* We can extend this configuration with additional fields in the future.
|
|
1456
|
+
*/
|
|
1457
|
+
const overrideFieldConfigs = {
|
|
1458
|
+
[FieldNames.allowSubscription]: {
|
|
1459
|
+
validator: isXpsBoolean,
|
|
1460
|
+
defaultValue: "0" /* XpsBoolean.false */,
|
|
1461
|
+
},
|
|
1462
|
+
[FieldNames.allowSave]: {
|
|
1463
|
+
validator: isXpsBoolean,
|
|
1464
|
+
defaultValue: "0" /* XpsBoolean.false */,
|
|
1465
|
+
},
|
|
1466
|
+
};
|
|
1467
|
+
|
|
1468
|
+
const initializeResponseFactoryToken = new InjectionToken('InitializeResponse');
|
|
1469
|
+
const initializeResponseFactoryProvider = {
|
|
1470
|
+
provide: initializeResponseFactoryToken,
|
|
1471
|
+
useValue: (...args) => new InitializeResponse(...args),
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
var UserBehaviourEventName;
|
|
1475
|
+
(function (UserBehaviourEventName) {
|
|
1476
|
+
UserBehaviourEventName["openPaystation"] = "open-paystation";
|
|
1477
|
+
UserBehaviourEventName["showMethodHeader"] = "show-method-header";
|
|
1478
|
+
UserBehaviourEventName["showErrorMessage"] = "show-error-message";
|
|
1479
|
+
UserBehaviourEventName["openStatusError"] = "open-status-error";
|
|
1480
|
+
UserBehaviourEventName["sysTrackedScripts"] = "sys-tracked_scripts";
|
|
1481
|
+
})(UserBehaviourEventName || (UserBehaviourEventName = {}));
|
|
1482
|
+
|
|
1483
|
+
const userBehaviourEventTypes = {
|
|
1484
|
+
open: 'open',
|
|
1485
|
+
show: 'show',
|
|
1486
|
+
click: 'click',
|
|
1487
|
+
manual: 'manual',
|
|
1488
|
+
store: 'store',
|
|
1489
|
+
};
|
|
1490
|
+
|
|
1491
|
+
const masterCardAndVisaPaymentMethodId = 26;
|
|
1492
|
+
const maestroPaymentMethodId = 490;
|
|
1493
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
1494
|
+
const creditCardPaymentMethodId = 1380;
|
|
1495
|
+
const americanExpressMethodId = 714;
|
|
1496
|
+
const specialCards = [
|
|
1497
|
+
maestroPaymentMethodId,
|
|
1498
|
+
masterCardAndVisaPaymentMethodId,
|
|
1499
|
+
americanExpressMethodId,
|
|
1500
|
+
];
|
|
1501
|
+
const cardsWith3ds = [
|
|
1502
|
+
masterCardAndVisaPaymentMethodId,
|
|
1503
|
+
maestroPaymentMethodId,
|
|
1504
|
+
creditCardPaymentMethodId,
|
|
1505
|
+
];
|
|
1436
1506
|
|
|
1437
1507
|
class XpsApiService {
|
|
1438
1508
|
constructor(window, secureApiClient, settingsService, countryService, userAgentService) {
|
|
@@ -1830,6 +1900,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
1830
1900
|
type: Injectable
|
|
1831
1901
|
}] });
|
|
1832
1902
|
|
|
1903
|
+
const googlePayPid = 3431;
|
|
1904
|
+
|
|
1833
1905
|
class SpecialButtonActionCreator {
|
|
1834
1906
|
constructor() {
|
|
1835
1907
|
this.type = 'special_button';
|
|
@@ -3975,10 +4047,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
3975
4047
|
type: Injectable
|
|
3976
4048
|
}], ctorParameters: () => [{ type: SyncService }] });
|
|
3977
4049
|
|
|
4050
|
+
const cpfLength = 11;
|
|
4051
|
+
const firstCheckDigitPosition = 9;
|
|
4052
|
+
const secondCheckDigitPosition = 10;
|
|
4053
|
+
const maxCheckDigit = 10;
|
|
4054
|
+
const repeatedDigitsRegex = /^(\d)\1+$/;
|
|
4055
|
+
const allowedCharactersRegex = /[^0-9 .-]+/;
|
|
4056
|
+
const moduloDivisor = 11;
|
|
4057
|
+
/**
|
|
4058
|
+
* Checks number match CPF validation algorithm.
|
|
4059
|
+
* Based on https://en.wikipedia.org/wiki/CPF_number
|
|
4060
|
+
*/
|
|
4061
|
+
const cpfFormulaValidator = ({ value }) => {
|
|
4062
|
+
if (isEmptyInputValue(value) || !isString(value)) {
|
|
4063
|
+
return null;
|
|
4064
|
+
}
|
|
4065
|
+
const error = {
|
|
4066
|
+
rewritableError: {
|
|
4067
|
+
message: TranslateHelper.t('cpf-number.converter.validation.pattern', 'Enter a valid CPF number'),
|
|
4068
|
+
},
|
|
4069
|
+
};
|
|
4070
|
+
if (allowedCharactersRegex.test(value)) {
|
|
4071
|
+
// accept only spaces, digits, dots and dashes
|
|
4072
|
+
return error;
|
|
4073
|
+
}
|
|
4074
|
+
// Remove non-numeric characters from CPF
|
|
4075
|
+
const cpf = value.replace(/\D/g, '');
|
|
4076
|
+
// Check if CPF has 11 digits
|
|
4077
|
+
if (cpf.length !== cpfLength) {
|
|
4078
|
+
return error;
|
|
4079
|
+
}
|
|
4080
|
+
// Disallow CPFs with all same digits (e.g., "11111111111")
|
|
4081
|
+
if (repeatedDigitsRegex.test(cpf)) {
|
|
4082
|
+
return error;
|
|
4083
|
+
}
|
|
4084
|
+
function calculateCheckDigit(cpfNumber, checkDigitPosition) {
|
|
4085
|
+
let sum = 0;
|
|
4086
|
+
for (let i = 0; i < checkDigitPosition; i++) {
|
|
4087
|
+
sum += parseInt(cpfNumber.charAt(i)) * (checkDigitPosition + 1 - i);
|
|
4088
|
+
}
|
|
4089
|
+
const checkDigit = (sum * maxCheckDigit) % moduloDivisor;
|
|
4090
|
+
return checkDigit >= maxCheckDigit ? 0 : checkDigit;
|
|
4091
|
+
}
|
|
4092
|
+
// Validate the check digits
|
|
4093
|
+
for (const position of [firstCheckDigitPosition, secondCheckDigitPosition]) {
|
|
4094
|
+
const checkDigit = calculateCheckDigit(cpf, position);
|
|
4095
|
+
if (checkDigit !== parseInt(cpf.charAt(position))) {
|
|
4096
|
+
return error;
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
return null;
|
|
4100
|
+
};
|
|
4101
|
+
|
|
3978
4102
|
class CpfNumberConverter extends Converter {
|
|
3979
4103
|
constructor(syncService) {
|
|
3980
4104
|
super(syncService);
|
|
3981
4105
|
}
|
|
4106
|
+
getValidators(field) {
|
|
4107
|
+
return super.getValidators(field).concat([cpfFormulaValidator]);
|
|
4108
|
+
}
|
|
3982
4109
|
createControlConfig(field) {
|
|
3983
4110
|
const config = this.createDefaultControlConfig(TextControlConfig, field);
|
|
3984
4111
|
config.maskConfig = {
|
|
@@ -5669,8 +5796,8 @@ class CentrifugoWebSocketService {
|
|
|
5669
5796
|
reconnection: 1000,
|
|
5670
5797
|
reconnectionMaxDeviation: 1000,
|
|
5671
5798
|
}; }
|
|
5672
|
-
constructor(
|
|
5673
|
-
this.
|
|
5799
|
+
constructor(loggerService) {
|
|
5800
|
+
this.loggerService = loggerService;
|
|
5674
5801
|
this.type = WebSocketClientType.centrifugo;
|
|
5675
5802
|
this.reconnectionTimerId = null;
|
|
5676
5803
|
this.isConnectionOpen = false;
|
|
@@ -5690,8 +5817,8 @@ class CentrifugoWebSocketService {
|
|
|
5690
5817
|
catch (error) {
|
|
5691
5818
|
// @ts-expect-error error is unknown
|
|
5692
5819
|
const message = (error?.message || error);
|
|
5693
|
-
const
|
|
5694
|
-
this.
|
|
5820
|
+
const wsError = new WsError(`unknown websocket error: ${message}`, channel);
|
|
5821
|
+
this.loggerService.error(wsError);
|
|
5695
5822
|
}
|
|
5696
5823
|
}
|
|
5697
5824
|
close() {
|
|
@@ -5770,9 +5897,9 @@ class CentrifugoWebSocketService {
|
|
|
5770
5897
|
})
|
|
5771
5898
|
.on('error', (ctx) => {
|
|
5772
5899
|
const message = `code ${ctx.error.code} - ${ctx.error.message}`;
|
|
5773
|
-
this.
|
|
5900
|
+
this.loggerService.error(new TaggedError(`connection error: ${message}`, [ErrorTags.WS], {
|
|
5774
5901
|
channel: websocketChannel,
|
|
5775
|
-
});
|
|
5902
|
+
}));
|
|
5776
5903
|
})
|
|
5777
5904
|
.connect();
|
|
5778
5905
|
this.subscription = this.connection.newSubscription(websocketChannel, this.getSubscriptionOptions(websocketChannel));
|
|
@@ -5783,16 +5910,16 @@ class CentrifugoWebSocketService {
|
|
|
5783
5910
|
})
|
|
5784
5911
|
.on('publication', (ctx) => {
|
|
5785
5912
|
const message = ctx.data;
|
|
5786
|
-
this.
|
|
5913
|
+
this.loggerService.error(new TaggedError(`websocket message received: ${message}`, [ErrorTags.WS], {
|
|
5787
5914
|
channel: websocketChannel,
|
|
5788
|
-
});
|
|
5915
|
+
}));
|
|
5789
5916
|
this.incomingMessages$.next(ctx);
|
|
5790
5917
|
})
|
|
5791
5918
|
.on('error', (ctx) => {
|
|
5792
5919
|
const message = `code ${ctx.error.code} - ${ctx.error.message}`;
|
|
5793
|
-
this.
|
|
5920
|
+
this.loggerService.error(new TaggedError(`subscription error: ${message}`, [ErrorTags.WS], {
|
|
5794
5921
|
channel: websocketChannel,
|
|
5795
|
-
});
|
|
5922
|
+
}));
|
|
5796
5923
|
})
|
|
5797
5924
|
.subscribe();
|
|
5798
5925
|
});
|
|
@@ -5808,9 +5935,9 @@ class CentrifugoWebSocketService {
|
|
|
5808
5935
|
/* If connection error, cause any connection error isn't 0 */
|
|
5809
5936
|
if (ctx.code !== 0) {
|
|
5810
5937
|
const message = `code ${ctx.code} - ${ctx.reason}`;
|
|
5811
|
-
this.
|
|
5938
|
+
this.loggerService.error(new TaggedError(`disconnected error: ${message}`, [ErrorTags.WS], {
|
|
5812
5939
|
channel: websocketChannel,
|
|
5813
|
-
});
|
|
5940
|
+
}));
|
|
5814
5941
|
(async () => {
|
|
5815
5942
|
await this.waitWhileNotReconnect();
|
|
5816
5943
|
})();
|
|
@@ -5837,9 +5964,9 @@ class CentrifugoWebSocketService {
|
|
|
5837
5964
|
}
|
|
5838
5965
|
const afterTimer = performance.now();
|
|
5839
5966
|
const timerDuration = afterTimer - beforeTimer;
|
|
5840
|
-
this.
|
|
5967
|
+
this.loggerService.error(new TaggedError(`fallback to reconnection timer: duration ${timerDuration}ms`, [ErrorTags.WS], {
|
|
5841
5968
|
channel: this.channel,
|
|
5842
|
-
});
|
|
5969
|
+
}));
|
|
5843
5970
|
this.successfulReconnectionEventsProxy$.next();
|
|
5844
5971
|
}
|
|
5845
5972
|
getSubscriptionOptions(websocketChannel) {
|
|
@@ -5852,7 +5979,7 @@ class CentrifugoWebSocketService {
|
|
|
5852
5979
|
}
|
|
5853
5980
|
return options;
|
|
5854
5981
|
}
|
|
5855
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CentrifugoWebSocketService, deps: [{ token:
|
|
5982
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CentrifugoWebSocketService, deps: [{ token: LoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5856
5983
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CentrifugoWebSocketService, providedIn: 'root' }); }
|
|
5857
5984
|
}
|
|
5858
5985
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CentrifugoWebSocketService, decorators: [{
|
|
@@ -5860,7 +5987,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
5860
5987
|
args: [{
|
|
5861
5988
|
providedIn: 'root',
|
|
5862
5989
|
}]
|
|
5863
|
-
}], ctorParameters: () => [{ type:
|
|
5990
|
+
}], ctorParameters: () => [{ type: LoggerService }] });
|
|
5864
5991
|
|
|
5865
5992
|
// @todo: remove this factory and switch to centrifugo client after centrifugo issues resolved
|
|
5866
5993
|
class WebSocketFactory {
|
|
@@ -6308,8 +6435,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
6308
6435
|
}] });
|
|
6309
6436
|
|
|
6310
6437
|
class InitializeSpecialButtonActionCreator {
|
|
6311
|
-
constructor(
|
|
6312
|
-
this.
|
|
6438
|
+
constructor(loggerService) {
|
|
6439
|
+
this.loggerService = loggerService;
|
|
6313
6440
|
this.type = 'special_button';
|
|
6314
6441
|
this.pids = [googlePayPid];
|
|
6315
6442
|
this.sdkPaymentMethodsName = new Map([
|
|
@@ -6333,19 +6460,19 @@ class InitializeSpecialButtonActionCreator {
|
|
|
6333
6460
|
getPaymentMethodName(pid = 0) {
|
|
6334
6461
|
const buttonName = this.sdkPaymentMethodsName.get(pid);
|
|
6335
6462
|
if (!buttonName) {
|
|
6336
|
-
this.
|
|
6463
|
+
this.loggerService.error(new TaggedError('No special button for provided pid', [ErrorTags.GOOGLEPAY], {
|
|
6337
6464
|
pid,
|
|
6338
|
-
});
|
|
6465
|
+
}));
|
|
6339
6466
|
throw new Error('Special button not found');
|
|
6340
6467
|
}
|
|
6341
6468
|
return buttonName;
|
|
6342
6469
|
}
|
|
6343
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator, deps: [{ token:
|
|
6470
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator, deps: [{ token: LoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6344
6471
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator }); }
|
|
6345
6472
|
}
|
|
6346
6473
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator, decorators: [{
|
|
6347
6474
|
type: Injectable
|
|
6348
|
-
}], ctorParameters: () => [{ type:
|
|
6475
|
+
}], ctorParameters: () => [{ type: LoggerService }] });
|
|
6349
6476
|
|
|
6350
6477
|
const initializeNextActionsToken = new InjectionToken('InitializeNextActions');
|
|
6351
6478
|
const initializeNextActions = [
|
|
@@ -6871,7 +6998,11 @@ class BehaviourStrategy {
|
|
|
6871
6998
|
isSuitable() {
|
|
6872
6999
|
return false;
|
|
6873
7000
|
}
|
|
7001
|
+
onInit() { }
|
|
6874
7002
|
onDestroy() { }
|
|
7003
|
+
canAutoSubmit() {
|
|
7004
|
+
return false;
|
|
7005
|
+
}
|
|
6875
7006
|
setPaymentData(paymentData) {
|
|
6876
7007
|
this.paymentData = paymentData;
|
|
6877
7008
|
}
|
|
@@ -6921,9 +7052,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
6921
7052
|
type: Injectable
|
|
6922
7053
|
}], ctorParameters: () => [] });
|
|
6923
7054
|
|
|
7055
|
+
class GooglePayInstantFlowStrategy extends BehaviourStrategy {
|
|
7056
|
+
constructor() {
|
|
7057
|
+
super();
|
|
7058
|
+
}
|
|
7059
|
+
isSuitable() {
|
|
7060
|
+
if (!isInitializeResponse(this.paymentData)) {
|
|
7061
|
+
return false;
|
|
7062
|
+
}
|
|
7063
|
+
const isInstantPayFlow = this.paymentData.paymentForm?.fields.some((field) => {
|
|
7064
|
+
return field.name === FieldNames.googlePayInitData;
|
|
7065
|
+
});
|
|
7066
|
+
return (this.paymentData.paymentForm?.pid === googlePay && !!isInstantPayFlow);
|
|
7067
|
+
}
|
|
7068
|
+
onInit() {
|
|
7069
|
+
this.hideField(FieldNames.zip);
|
|
7070
|
+
this.hideField(FieldNames.email);
|
|
7071
|
+
}
|
|
7072
|
+
hideField(fieldName) {
|
|
7073
|
+
if (!isInitializeResponse(this.paymentData)) {
|
|
7074
|
+
return;
|
|
7075
|
+
}
|
|
7076
|
+
const fieldForHide = this.paymentData.paymentForm?.fields.find((field) => {
|
|
7077
|
+
return field.name === fieldName;
|
|
7078
|
+
});
|
|
7079
|
+
if (fieldForHide) {
|
|
7080
|
+
fieldForHide.isVisible = "0" /* XpsBoolean.false */;
|
|
7081
|
+
}
|
|
7082
|
+
}
|
|
7083
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayInstantFlowStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7084
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayInstantFlowStrategy }); }
|
|
7085
|
+
}
|
|
7086
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayInstantFlowStrategy, decorators: [{
|
|
7087
|
+
type: Injectable
|
|
7088
|
+
}], ctorParameters: () => [] });
|
|
7089
|
+
|
|
7090
|
+
class GooglePayRegularFlowStrategy extends BehaviourStrategy {
|
|
7091
|
+
constructor() {
|
|
7092
|
+
super();
|
|
7093
|
+
}
|
|
7094
|
+
isSuitable() {
|
|
7095
|
+
if (!isInitializeResponse(this.paymentData)) {
|
|
7096
|
+
return false;
|
|
7097
|
+
}
|
|
7098
|
+
const isInstantPayFlow = this.paymentData.paymentForm?.fields.some((field) => {
|
|
7099
|
+
return field.name === FieldNames.googlePayInitData;
|
|
7100
|
+
});
|
|
7101
|
+
return this.paymentData.paymentForm?.pid === googlePay && !isInstantPayFlow;
|
|
7102
|
+
}
|
|
7103
|
+
canAutoSubmit() {
|
|
7104
|
+
const visibleFields = this.getVisibleFields();
|
|
7105
|
+
return visibleFields.length === 0;
|
|
7106
|
+
}
|
|
7107
|
+
getVisibleFields() {
|
|
7108
|
+
if (!isInitializeResponse(this.paymentData)) {
|
|
7109
|
+
return [];
|
|
7110
|
+
}
|
|
7111
|
+
return (this.paymentData.paymentForm?.fields.filter((field) => field.isVisible === "1" /* XpsBoolean.true */ && field.isMandatory) ?? []);
|
|
7112
|
+
}
|
|
7113
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayRegularFlowStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7114
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayRegularFlowStrategy }); }
|
|
7115
|
+
}
|
|
7116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayRegularFlowStrategy, decorators: [{
|
|
7117
|
+
type: Injectable
|
|
7118
|
+
}], ctorParameters: () => [] });
|
|
7119
|
+
|
|
6924
7120
|
const behaviourStrategiesToken = new InjectionToken('BehaviourStrategies');
|
|
6925
7121
|
const behaviourStrategies = [
|
|
6926
7122
|
ApplePayWithShippingAddressStrategy,
|
|
7123
|
+
GooglePayInstantFlowStrategy,
|
|
7124
|
+
GooglePayRegularFlowStrategy,
|
|
6927
7125
|
];
|
|
6928
7126
|
|
|
6929
7127
|
class PaymentBehaviourService {
|
|
@@ -6965,8 +7163,8 @@ class PaymentService {
|
|
|
6965
7163
|
get formResponseValue() {
|
|
6966
7164
|
return this._formResponse$.getValue();
|
|
6967
7165
|
}
|
|
6968
|
-
constructor(
|
|
6969
|
-
this.
|
|
7166
|
+
constructor(loggerService, initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, initializeNextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, printInstructionService, paymentBehaviourService) {
|
|
7167
|
+
this.loggerService = loggerService;
|
|
6970
7168
|
this.initializeService = initializeService;
|
|
6971
7169
|
this.submitService = submitService;
|
|
6972
7170
|
this.syncService = syncService;
|
|
@@ -7057,9 +7255,9 @@ class PaymentService {
|
|
|
7057
7255
|
}
|
|
7058
7256
|
async submitWithFields(fields) {
|
|
7059
7257
|
if (!this.form) {
|
|
7060
|
-
this.
|
|
7258
|
+
this.loggerService.error(new TaggedError('submit error: trying to submit with no form', [
|
|
7061
7259
|
ErrorTags.GOOGLEPAY,
|
|
7062
|
-
]);
|
|
7260
|
+
]));
|
|
7063
7261
|
throw new Error('form is empty!');
|
|
7064
7262
|
}
|
|
7065
7263
|
this.isSavingMethodMode = this.fields.some(({ name, value }) => name === 'savePsAccountOnly' && value === "1" /* XpsBoolean.true */);
|
|
@@ -7381,16 +7579,13 @@ class PaymentService {
|
|
|
7381
7579
|
}
|
|
7382
7580
|
const isRedirectMethod = response.paymentForm.isCheckout;
|
|
7383
7581
|
const canSkipForm = response.paymentForm.skipForm;
|
|
7384
|
-
const
|
|
7385
|
-
|
|
7386
|
-
return ((!isRedirectMethod && canSkipForm) ||
|
|
7387
|
-
(visibleFields.length === 0 &&
|
|
7388
|
-
suitablePids.includes(response.paymentForm.pid)));
|
|
7582
|
+
const isSuitableByStrategy = this.autoSubmitBehaviourStrategies(this.config);
|
|
7583
|
+
return (!isRedirectMethod && canSkipForm) || isSuitableByStrategy;
|
|
7389
7584
|
}
|
|
7390
7585
|
getSdkPaymentDataFromResponse(data) {
|
|
7391
7586
|
if (isSubmitResponse(data)) {
|
|
7392
7587
|
return {
|
|
7393
|
-
checkoutData: data.parameters
|
|
7588
|
+
checkoutData: data.parameters?.checkout.data.data,
|
|
7394
7589
|
fields: data.fields,
|
|
7395
7590
|
summary: data.summary,
|
|
7396
7591
|
};
|
|
@@ -7413,7 +7608,13 @@ class PaymentService {
|
|
|
7413
7608
|
strategy.onDestroy();
|
|
7414
7609
|
});
|
|
7415
7610
|
}
|
|
7416
|
-
|
|
7611
|
+
autoSubmitBehaviourStrategies(config) {
|
|
7612
|
+
const behaviourStrategies = this.paymentBehaviourService.getApplicableBehaviourStrategies(this.data, config);
|
|
7613
|
+
return behaviourStrategies.some((strategy) => {
|
|
7614
|
+
return strategy.canAutoSubmit();
|
|
7615
|
+
});
|
|
7616
|
+
}
|
|
7617
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, deps: [{ token: LoggerService }, { 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 }, { token: PaymentBehaviourService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7417
7618
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, providedIn: 'root' }); }
|
|
7418
7619
|
}
|
|
7419
7620
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, decorators: [{
|
|
@@ -7421,7 +7622,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
7421
7622
|
args: [{
|
|
7422
7623
|
providedIn: 'root',
|
|
7423
7624
|
}]
|
|
7424
|
-
}], ctorParameters: () => [{ type:
|
|
7625
|
+
}], ctorParameters: () => [{ type: LoggerService }, { 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 }, { type: PaymentBehaviourService }] });
|
|
7425
7626
|
|
|
7426
7627
|
const euCountries = new Set([
|
|
7427
7628
|
'AT',
|
|
@@ -8074,8 +8275,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
8074
8275
|
}] }] });
|
|
8075
8276
|
|
|
8076
8277
|
class CoreLibraryService {
|
|
8077
|
-
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService, scriptTrackerService, translateService) {
|
|
8278
|
+
constructor(settingsService, loggerService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService, scriptTrackerService, translateService, commonLogAttributesService) {
|
|
8078
8279
|
this.settingsService = settingsService;
|
|
8280
|
+
this.loggerService = loggerService;
|
|
8079
8281
|
this.countryService = countryService;
|
|
8080
8282
|
this.paymentMethodsService = paymentMethodsService;
|
|
8081
8283
|
this.savedMethodsService = savedMethodsService;
|
|
@@ -8098,6 +8300,7 @@ class CoreLibraryService {
|
|
|
8098
8300
|
this.sendInstructionService = sendInstructionService;
|
|
8099
8301
|
this.scriptTrackerService = scriptTrackerService;
|
|
8100
8302
|
this.translateService = translateService;
|
|
8303
|
+
this.commonLogAttributesService = commonLogAttributesService;
|
|
8101
8304
|
this.paymentMethods = {
|
|
8102
8305
|
getList: async (isSaveMethodMode) => this.paymentMethodsService.getList(isSaveMethodMode),
|
|
8103
8306
|
getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
|
|
@@ -8211,6 +8414,9 @@ class CoreLibraryService {
|
|
|
8211
8414
|
getUserBalanceValue() {
|
|
8212
8415
|
return this.userBalanceService.getUserBalanceValue();
|
|
8213
8416
|
}
|
|
8417
|
+
registerLogHandler(handler) {
|
|
8418
|
+
this.loggerService.register(handler);
|
|
8419
|
+
}
|
|
8214
8420
|
get paymentForm$() {
|
|
8215
8421
|
return this.paymentService.paymentForm$;
|
|
8216
8422
|
}
|
|
@@ -8226,7 +8432,10 @@ class CoreLibraryService {
|
|
|
8226
8432
|
get isApplePayInstantFlowEnabled() {
|
|
8227
8433
|
return this.settingsService.isApplePayInstantFlowEnabled;
|
|
8228
8434
|
}
|
|
8229
|
-
|
|
8435
|
+
get commonLogAttributes() {
|
|
8436
|
+
return this.commonLogAttributesService.getAttributes();
|
|
8437
|
+
}
|
|
8438
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: LoggerService }, { 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 }, { token: i24.TranslateService }, { token: CommonLogAttributesService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
8230
8439
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
|
|
8231
8440
|
}
|
|
8232
8441
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
@@ -8234,7 +8443,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
8234
8443
|
args: [{
|
|
8235
8444
|
providedIn: 'root',
|
|
8236
8445
|
}]
|
|
8237
|
-
}], 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 }, { type:
|
|
8446
|
+
}], ctorParameters: () => [{ type: SettingsService }, { type: LoggerService }, { 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 }, { type: i24.TranslateService }, { type: CommonLogAttributesService }] });
|
|
8238
8447
|
|
|
8239
8448
|
class HttpError extends AppError {
|
|
8240
8449
|
constructor(error, req) {
|
|
@@ -8527,10 +8736,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
8527
8736
|
}], ctorParameters: () => [{ type: SummaryFinanceDetailsAdapterService }] });
|
|
8528
8737
|
|
|
8529
8738
|
class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
8530
|
-
constructor(window,
|
|
8739
|
+
constructor(window, loggerService, applePayCartService) {
|
|
8531
8740
|
super();
|
|
8532
8741
|
this.window = window;
|
|
8533
|
-
this.
|
|
8742
|
+
this.loggerService = loggerService;
|
|
8534
8743
|
this.applePayCartService = applePayCartService;
|
|
8535
8744
|
this.paymentClient = null;
|
|
8536
8745
|
}
|
|
@@ -8540,9 +8749,9 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8540
8749
|
startSession(params, additionalParams, applePayFinallyCallback) {
|
|
8541
8750
|
if (!this.paymentClient) {
|
|
8542
8751
|
console.error(ApplePayErrors.braintreeInitializeError);
|
|
8543
|
-
this.
|
|
8752
|
+
this.loggerService.error(new TaggedError(ApplePayErrors.braintreeInitializeError, [
|
|
8544
8753
|
ErrorTags.APPLEPAY,
|
|
8545
|
-
]);
|
|
8754
|
+
]));
|
|
8546
8755
|
return;
|
|
8547
8756
|
}
|
|
8548
8757
|
const request = this.buildPaymentRequest(params);
|
|
@@ -8613,7 +8822,7 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8613
8822
|
};
|
|
8614
8823
|
session.begin();
|
|
8615
8824
|
}
|
|
8616
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: BraintreeHandler, deps: [{ token: windowToken }, { token:
|
|
8825
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: BraintreeHandler, deps: [{ token: windowToken }, { token: LoggerService }, { token: ApplePayCartService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
8617
8826
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: BraintreeHandler }); }
|
|
8618
8827
|
}
|
|
8619
8828
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: BraintreeHandler, decorators: [{
|
|
@@ -8621,7 +8830,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
8621
8830
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
8622
8831
|
type: Inject,
|
|
8623
8832
|
args: [windowToken]
|
|
8624
|
-
}] }, { type:
|
|
8833
|
+
}] }, { type: LoggerService }, { type: ApplePayCartService }] });
|
|
8625
8834
|
|
|
8626
8835
|
class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
8627
8836
|
constructor(window, http, applePayCartService) {
|
|
@@ -9123,9 +9332,9 @@ class GooglePayService {
|
|
|
9123
9332
|
get googlePaymentClientWasInitialized() {
|
|
9124
9333
|
return !!this.googlePaymentClient;
|
|
9125
9334
|
}
|
|
9126
|
-
constructor(window,
|
|
9335
|
+
constructor(window, loggerService, paymentSystemProcessingService, googlePayCheckoutPaymentService, googlePayInstantPaymentService, injector) {
|
|
9127
9336
|
this.window = window;
|
|
9128
|
-
this.
|
|
9337
|
+
this.loggerService = loggerService;
|
|
9129
9338
|
this.paymentSystemProcessingService = paymentSystemProcessingService;
|
|
9130
9339
|
this.googlePayCheckoutPaymentService = googlePayCheckoutPaymentService;
|
|
9131
9340
|
this.googlePayInstantPaymentService = googlePayInstantPaymentService;
|
|
@@ -9159,7 +9368,9 @@ class GooglePayService {
|
|
|
9159
9368
|
.pipe(filter$1(Boolean), take(1))
|
|
9160
9369
|
.subscribe(() => {
|
|
9161
9370
|
if (!this.googlePaymentClient) {
|
|
9162
|
-
this.
|
|
9371
|
+
this.loggerService.error(new TaggedError('Google payment client is not initialized', [
|
|
9372
|
+
ErrorTags.GOOGLEPAY,
|
|
9373
|
+
]));
|
|
9163
9374
|
throw new AppError(`Google Pay: Google payment client is not initialized`);
|
|
9164
9375
|
}
|
|
9165
9376
|
this.paymentService = this.getPaymentService();
|
|
@@ -9168,9 +9379,7 @@ class GooglePayService {
|
|
|
9168
9379
|
checkDeviceData: data,
|
|
9169
9380
|
});
|
|
9170
9381
|
if (!initData) {
|
|
9171
|
-
this.
|
|
9172
|
-
ErrorTags.GOOGLEPAY,
|
|
9173
|
-
]);
|
|
9382
|
+
this.loggerService.error(new TaggedError('No initialization data', [ErrorTags.GOOGLEPAY]));
|
|
9174
9383
|
throw new AppError('Google Pay: no initialization data');
|
|
9175
9384
|
}
|
|
9176
9385
|
this.googlePaymentClient
|
|
@@ -9197,18 +9406,18 @@ class GooglePayService {
|
|
|
9197
9406
|
}
|
|
9198
9407
|
async proceedCheckout() {
|
|
9199
9408
|
if (!this.googlePaymentClient) {
|
|
9200
|
-
this.
|
|
9409
|
+
this.loggerService.error(new TaggedError('Google payment client is not initialized to proceed checkout', [ErrorTags.GOOGLEPAY]));
|
|
9201
9410
|
throw new AppError(`Google Pay. proceedCheckout: no google payment client`);
|
|
9202
9411
|
}
|
|
9203
9412
|
if (!this.paymentService) {
|
|
9204
|
-
this.
|
|
9413
|
+
this.loggerService.error(new TaggedError('Google payment service is not initialized to proceed checkout', [ErrorTags.GOOGLEPAY]));
|
|
9205
9414
|
throw new AppError(`Google Pay. proceedCheckout: no google payment service`);
|
|
9206
9415
|
}
|
|
9207
9416
|
const paymentDataRequest = this.paymentService.getPaymentRequest();
|
|
9208
9417
|
if (!paymentDataRequest) {
|
|
9209
|
-
this.
|
|
9418
|
+
this.loggerService.error(new TaggedError('No data for payment data request', [
|
|
9210
9419
|
ErrorTags.GOOGLEPAY,
|
|
9211
|
-
]);
|
|
9420
|
+
]));
|
|
9212
9421
|
throw new AppError(`Google Pay: No data for payment data request`);
|
|
9213
9422
|
}
|
|
9214
9423
|
const checkStatusAction = this.injector
|
|
@@ -9217,7 +9426,7 @@ class GooglePayService {
|
|
|
9217
9426
|
try {
|
|
9218
9427
|
const paymentData = await this.googlePaymentClient.loadPaymentData(paymentDataRequest);
|
|
9219
9428
|
if (!paymentData?.paymentMethodData?.tokenizationData?.token) {
|
|
9220
|
-
this.
|
|
9429
|
+
this.loggerService.error(new TaggedError('Token is missing', [ErrorTags.GOOGLEPAY]));
|
|
9221
9430
|
throw new AppError('Google Pay: token is missing');
|
|
9222
9431
|
}
|
|
9223
9432
|
this.paymentService.handleSuccessfulPayment?.(paymentData);
|
|
@@ -9290,7 +9499,7 @@ class GooglePayService {
|
|
|
9290
9499
|
isCanceledStatus(statusCode) {
|
|
9291
9500
|
return statusCode.toLowerCase() === 'canceled';
|
|
9292
9501
|
}
|
|
9293
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token:
|
|
9502
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token: LoggerService }, { token: PaymentSystemProcessingService }, { token: GooglePayCheckoutPaymentService }, { token: GooglePayInstantPaymentService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9294
9503
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, providedIn: 'root' }); }
|
|
9295
9504
|
}
|
|
9296
9505
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, decorators: [{
|
|
@@ -9301,7 +9510,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
9301
9510
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
9302
9511
|
type: Inject,
|
|
9303
9512
|
args: [windowToken]
|
|
9304
|
-
}] }, { type:
|
|
9513
|
+
}] }, { type: LoggerService }, { type: PaymentSystemProcessingService }, { type: GooglePayCheckoutPaymentService }, { type: GooglePayInstantPaymentService }, { type: i0.Injector }] });
|
|
9305
9514
|
|
|
9306
9515
|
var ApplePayIntegrationType;
|
|
9307
9516
|
(function (ApplePayIntegrationType) {
|
|
@@ -9481,9 +9690,9 @@ class ApplePaySdkService {
|
|
|
9481
9690
|
listenApplePayPostMessages();
|
|
9482
9691
|
};
|
|
9483
9692
|
script.onerror = (error) => {
|
|
9484
|
-
this.loggerService.
|
|
9693
|
+
this.loggerService.error(new TaggedError('Apple pay: script sdk loading error', [ErrorTags.APPLEPAY],
|
|
9485
9694
|
// @ts-expect-error error type
|
|
9486
|
-
{ error: error?.message ? error.toString() : JSON.stringify(error) });
|
|
9695
|
+
{ error: error?.message ? error.toString() : JSON.stringify(error) }));
|
|
9487
9696
|
console.error('Apple pay: script sdk loading error', error);
|
|
9488
9697
|
};
|
|
9489
9698
|
}
|
|
@@ -9498,7 +9707,7 @@ class ApplePaySdkService {
|
|
|
9498
9707
|
const scriptsElements = this.window.document.querySelectorAll('script');
|
|
9499
9708
|
return Array.from(scriptsElements).some((element) => element.src === this.jsSdk);
|
|
9500
9709
|
}
|
|
9501
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePaySdkService, deps: [{ token: windowToken }, { token:
|
|
9710
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePaySdkService, deps: [{ token: windowToken }, { token: LoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9502
9711
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePaySdkService, providedIn: 'root' }); }
|
|
9503
9712
|
}
|
|
9504
9713
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePaySdkService, decorators: [{
|
|
@@ -9509,7 +9718,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
9509
9718
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
9510
9719
|
type: Inject,
|
|
9511
9720
|
args: [windowToken]
|
|
9512
|
-
}] }, { type:
|
|
9721
|
+
}] }, { type: LoggerService }] });
|
|
9513
9722
|
|
|
9514
9723
|
class SocketBridgeService {
|
|
9515
9724
|
constructor(secureApiClient) {
|
|
@@ -9645,13 +9854,13 @@ class ApplePayService {
|
|
|
9645
9854
|
.getWindowReturnMessage$()
|
|
9646
9855
|
.pipe(takeUntil(this.destroy$));
|
|
9647
9856
|
}
|
|
9648
|
-
constructor(window, summaryFinanceDetailsAdapterService, braintreeHandler, checkoutHandler, appleParamsBuilder,
|
|
9857
|
+
constructor(window, summaryFinanceDetailsAdapterService, braintreeHandler, checkoutHandler, appleParamsBuilder, loggerService, applePaySdkService, externalWindowCommunicationService, settingsService) {
|
|
9649
9858
|
this.window = window;
|
|
9650
9859
|
this.summaryFinanceDetailsAdapterService = summaryFinanceDetailsAdapterService;
|
|
9651
9860
|
this.braintreeHandler = braintreeHandler;
|
|
9652
9861
|
this.checkoutHandler = checkoutHandler;
|
|
9653
9862
|
this.appleParamsBuilder = appleParamsBuilder;
|
|
9654
|
-
this.
|
|
9863
|
+
this.loggerService = loggerService;
|
|
9655
9864
|
this.applePaySdkService = applePaySdkService;
|
|
9656
9865
|
this.externalWindowCommunicationService = externalWindowCommunicationService;
|
|
9657
9866
|
this.settingsService = settingsService;
|
|
@@ -9698,9 +9907,9 @@ class ApplePayService {
|
|
|
9698
9907
|
}
|
|
9699
9908
|
catch (error) {
|
|
9700
9909
|
console.error(ApplePayErrors.braintreeInitializeError, error);
|
|
9701
|
-
this.
|
|
9910
|
+
this.loggerService.error(new TaggedError(ApplePayErrors.braintreeInitializeError, [
|
|
9702
9911
|
ErrorTags.APPLEPAY,
|
|
9703
|
-
]);
|
|
9912
|
+
]));
|
|
9704
9913
|
}
|
|
9705
9914
|
if (!this.paymentClient || !this.isDeviceCapable) {
|
|
9706
9915
|
this.emitError(ApplePayErrors.deviceIsNotCapableError);
|
|
@@ -9838,7 +10047,7 @@ class ApplePayService {
|
|
|
9838
10047
|
this.applePayQrOpened.next();
|
|
9839
10048
|
}
|
|
9840
10049
|
}
|
|
9841
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, deps: [{ token: windowToken }, { token: SummaryFinanceDetailsAdapterService }, { token: BraintreeHandler }, { token: CheckoutHandler }, { token: ApplePayParamsBuilderService }, { token:
|
|
10050
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, deps: [{ token: windowToken }, { token: SummaryFinanceDetailsAdapterService }, { token: BraintreeHandler }, { token: CheckoutHandler }, { token: ApplePayParamsBuilderService }, { token: LoggerService }, { token: ApplePaySdkService }, { token: ApplePayExternalWindowCommunicationService }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9842
10051
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, providedIn: 'root' }); }
|
|
9843
10052
|
}
|
|
9844
10053
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, decorators: [{
|
|
@@ -9849,7 +10058,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
9849
10058
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
9850
10059
|
type: Inject,
|
|
9851
10060
|
args: [windowToken]
|
|
9852
|
-
}] }, { type: SummaryFinanceDetailsAdapterService }, { type: BraintreeHandler }, { type: CheckoutHandler }, { type: ApplePayParamsBuilderService }, { type:
|
|
10061
|
+
}] }, { type: SummaryFinanceDetailsAdapterService }, { type: BraintreeHandler }, { type: CheckoutHandler }, { type: ApplePayParamsBuilderService }, { type: LoggerService }, { type: ApplePaySdkService }, { type: ApplePayExternalWindowCommunicationService }, { type: SettingsService }] });
|
|
9853
10062
|
|
|
9854
10063
|
/*
|
|
9855
10064
|
* Public API Surface of core-library
|
|
@@ -9859,5 +10068,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
9859
10068
|
* Generated bundle index. Do not edit.
|
|
9860
10069
|
*/
|
|
9861
10070
|
|
|
9862
|
-
export { ApplePayCartService, ApplePayService, CoreLibraryModule, CoreLibraryService, CreditCardTypes, FieldNames, GooglePayService, PaymentSystemProcessingService, userBehaviourEventTypes };
|
|
10071
|
+
export { ApplePayCartService, ApplePayService, CoreLibraryModule, CoreLibraryService, CreditCardTypes, ErrorTags, FieldNames, GooglePayService, PaymentSystemProcessingService, TaggedError, userBehaviourEventTypes };
|
|
9863
10072
|
//# sourceMappingURL=xsolla-payment-client-core.mjs.map
|