stripe-pwa-elements 3.2.0 → 4.0.0
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/dist/cjs/app-globals-V2Kpy_OQ.js +0 -3
- package/dist/cjs/error-FFC4kSs5.js +0 -3
- package/dist/cjs/{factory-CbbbSvkg.js → factory-da3xAKkz.js} +194 -73
- package/dist/cjs/{index-Ba1pBePA.js → index-CYbA1N_k.js} +24 -6
- package/dist/cjs/index-Dkb0SxZc.js +4694 -0
- package/dist/cjs/index.cjs.js +0 -1
- package/dist/cjs/ion-icon.cjs.entry.js +22 -13
- package/dist/cjs/loader.cjs.js +2 -3
- package/dist/cjs/stripe-address-element.cjs.entry.js +34 -26
- package/dist/cjs/stripe-card-element-modal.cjs.entry.js +6 -7
- package/dist/cjs/stripe-card-element_2.cjs.entry.js +106 -67
- package/dist/cjs/stripe-currency-selector.cjs.entry.js +13 -10
- package/dist/cjs/stripe-elements.cjs.js +31 -5
- package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +25 -22
- package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +13 -10
- package/dist/cjs/stripe-payment-element.cjs.entry.js +190 -131
- package/dist/cjs/stripe-payment-request-button.cjs.entry.js +12 -7
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/stripe-address-element/stripe-address-element.js +29 -21
- package/dist/collection/components/stripe-card-element/stripe-card-element.helpers.js +57 -0
- package/dist/collection/components/stripe-card-element/stripe-card-element.js +55 -68
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +15 -11
- package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +10 -6
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +28 -20
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +12 -7
- package/dist/collection/components/stripe-modal/stripe-modal.js +0 -1
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.helpers.js +114 -0
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +69 -126
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +34 -12
- package/dist/collection/index.js +0 -1
- package/dist/collection/interfaces.js +0 -1
- package/dist/collection/services/address-element-manager.js +3 -4
- package/dist/collection/services/card-element-manager.js +3 -4
- package/dist/collection/services/currency-selector-element-manager.js +3 -4
- package/dist/collection/services/express-checkout-element-manager.js +9 -10
- package/dist/collection/services/factory.js +0 -1
- package/dist/collection/services/interfaces.js +0 -1
- package/dist/collection/services/link-authentication-element-manager.js +3 -4
- package/dist/collection/services/payment-element-manager.js +4 -5
- package/dist/collection/services/stripe-service.js +5 -6
- package/dist/collection/utils/element-finder.js +2 -3
- package/dist/collection/utils/error.js +0 -1
- package/dist/collection/utils/i18n.js +0 -1
- package/dist/collection/utils/platform.js +0 -1
- package/dist/collection/utils/test-setup.js +0 -1
- package/dist/collection/utils/utils.js +2 -3
- package/dist/components/error.js +1 -16
- package/dist/components/factory.js +1 -3736
- package/dist/components/icon.js +1 -459
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -4
- package/dist/components/index2.js +1 -192
- package/dist/components/ion-icon.js +1 -9
- package/dist/components/stripe-address-element.js +1 -327
- package/dist/components/stripe-card-element-modal.js +1 -174
- package/dist/components/stripe-card-element.js +1 -9
- package/dist/components/stripe-card-element2.js +1 -440
- package/dist/components/stripe-currency-selector.js +1 -218
- package/dist/components/stripe-express-checkout-element.js +1 -332
- package/dist/components/stripe-link-authentication-element.js +1 -256
- package/dist/components/stripe-modal.js +1 -9
- package/dist/components/stripe-modal2.js +1 -112
- package/dist/components/stripe-payment-element.js +1 -510
- package/dist/components/stripe-payment-request-button.js +1 -9
- package/dist/components/stripe-payment-request-button2.js +1 -224
- package/dist/components/utils.js +1 -89
- package/dist/esm/app-globals-DQuL1Twl.js +0 -3
- package/dist/esm/error-XRfh5Wrs.js +0 -3
- package/dist/esm/{factory-Drde6-y7.js → factory-DeqoYLf_.js} +194 -73
- package/dist/esm/index-C6bbmyga.js +4677 -0
- package/dist/esm/{index-BHDCxQOb.js → index-CBXaOfXU.js} +24 -6
- package/dist/esm/index.js +0 -1
- package/dist/esm/ion-icon.entry.js +22 -13
- package/dist/esm/loader.js +3 -4
- package/dist/esm/stripe-address-element.entry.js +34 -26
- package/dist/esm/stripe-card-element-modal.entry.js +6 -7
- package/dist/esm/stripe-card-element_2.entry.js +106 -67
- package/dist/esm/stripe-currency-selector.entry.js +13 -10
- package/dist/esm/stripe-elements.js +32 -6
- package/dist/esm/stripe-express-checkout-element.entry.js +25 -22
- package/dist/esm/stripe-link-authentication-element.entry.js +13 -10
- package/dist/esm/stripe-payment-element.entry.js +190 -131
- package/dist/esm/stripe-payment-request-button.entry.js +12 -7
- package/dist/stripe-elements/index.esm.js +0 -2
- package/dist/stripe-elements/p--sA2m1ad.js +1 -0
- package/dist/stripe-elements/p-38e7b187.entry.js +1 -0
- package/dist/stripe-elements/p-44495284.entry.js +1 -0
- package/dist/stripe-elements/p-4ba675fa.entry.js +1 -0
- package/dist/stripe-elements/p-5cf62945.entry.js +1 -0
- package/dist/stripe-elements/p-C6bbmyga.js +2 -0
- package/dist/stripe-elements/p-CBXaOfXU.js +1 -0
- package/dist/stripe-elements/p-DQuL1Twl.js +1 -2
- package/dist/stripe-elements/p-XRfh5Wrs.js +1 -2
- package/dist/stripe-elements/p-c24ae181.entry.js +1 -0
- package/dist/stripe-elements/p-d9e86451.entry.js +1 -0
- package/dist/stripe-elements/p-f09c86a0.entry.js +1 -0
- package/dist/stripe-elements/p-f64f394d.entry.js +1 -0
- package/dist/stripe-elements/p-f6d2425e.entry.js +1 -0
- package/dist/stripe-elements/stripe-elements.esm.js +1 -2
- package/dist/stripe-elements/svg/.gitignore +4 -0
- package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +5 -1
- package/dist/types/components/stripe-card-element/stripe-card-element.helpers.d.ts +29 -0
- package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +4 -4
- package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +2 -2
- package/dist/types/components/stripe-payment-element/stripe-payment-element.helpers.d.ts +54 -0
- package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +8 -0
- package/dist/types/components.d.ts +139 -29
- package/dist/types/index.d.ts +1 -0
- package/dist/types/services/interfaces.d.ts +3 -3
- package/dist/types/services/stripe-service.d.ts +2 -2
- package/dist/types/stencil-public-runtime.d.ts +110 -5
- package/package.json +50 -30
- package/readme.md +386 -133
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
- package/dist/cjs/error-FFC4kSs5.js.map +0 -1
- package/dist/cjs/factory-CbbbSvkg.js.map +0 -1
- package/dist/cjs/index-BXVW_rzh.js +0 -1932
- package/dist/cjs/index-BXVW_rzh.js.map +0 -1
- package/dist/cjs/index-Ba1pBePA.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/ion-icon.entry.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/stripe-address-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-card-element-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-card-element.stripe-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-currency-selector.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-elements.cjs.js.map +0 -1
- package/dist/cjs/stripe-express-checkout-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-link-authentication-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-payment-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-payment-request-button.entry.cjs.js.map +0 -1
- package/dist/collection/components/stripe-address-element/stripe-address-element.js.map +0 -1
- package/dist/collection/components/stripe-card-element/stripe-card-element.js.map +0 -1
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js.map +0 -1
- package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js.map +0 -1
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js.map +0 -1
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js.map +0 -1
- package/dist/collection/components/stripe-modal/stripe-modal.js.map +0 -1
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js.map +0 -1
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/interfaces.js.map +0 -1
- package/dist/collection/services/address-element-manager.js.map +0 -1
- package/dist/collection/services/card-element-manager.js.map +0 -1
- package/dist/collection/services/currency-selector-element-manager.js.map +0 -1
- package/dist/collection/services/express-checkout-element-manager.js.map +0 -1
- package/dist/collection/services/factory.js.map +0 -1
- package/dist/collection/services/interfaces.js.map +0 -1
- package/dist/collection/services/link-authentication-element-manager.js.map +0 -1
- package/dist/collection/services/payment-element-manager.js.map +0 -1
- package/dist/collection/services/stripe-service.js.map +0 -1
- package/dist/collection/utils/element-finder.js.map +0 -1
- package/dist/collection/utils/error.js.map +0 -1
- package/dist/collection/utils/i18n.js.map +0 -1
- package/dist/collection/utils/platform.js.map +0 -1
- package/dist/collection/utils/test-setup.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/error.js.map +0 -1
- package/dist/components/factory.js.map +0 -1
- package/dist/components/icon.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/index2.js.map +0 -1
- package/dist/components/ion-icon.js.map +0 -1
- package/dist/components/stripe-address-element.js.map +0 -1
- package/dist/components/stripe-card-element-modal.js.map +0 -1
- package/dist/components/stripe-card-element.js.map +0 -1
- package/dist/components/stripe-card-element2.js.map +0 -1
- package/dist/components/stripe-currency-selector.js.map +0 -1
- package/dist/components/stripe-express-checkout-element.js.map +0 -1
- package/dist/components/stripe-link-authentication-element.js.map +0 -1
- package/dist/components/stripe-modal.js.map +0 -1
- package/dist/components/stripe-modal2.js.map +0 -1
- package/dist/components/stripe-payment-element.js.map +0 -1
- package/dist/components/stripe-payment-request-button.js.map +0 -1
- package/dist/components/stripe-payment-request-button2.js.map +0 -1
- package/dist/components/utils.js.map +0 -1
- package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
- package/dist/esm/error-XRfh5Wrs.js.map +0 -1
- package/dist/esm/factory-Drde6-y7.js.map +0 -1
- package/dist/esm/index-BHDCxQOb.js.map +0 -1
- package/dist/esm/index-DJwTOfxZ.js +0 -1920
- package/dist/esm/index-DJwTOfxZ.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/ion-icon.entry.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/stripe-address-element.entry.js.map +0 -1
- package/dist/esm/stripe-card-element-modal.entry.js.map +0 -1
- package/dist/esm/stripe-card-element.stripe-modal.entry.js.map +0 -1
- package/dist/esm/stripe-currency-selector.entry.js.map +0 -1
- package/dist/esm/stripe-elements.js.map +0 -1
- package/dist/esm/stripe-express-checkout-element.entry.js.map +0 -1
- package/dist/esm/stripe-link-authentication-element.entry.js.map +0 -1
- package/dist/esm/stripe-payment-element.entry.js.map +0 -1
- package/dist/esm/stripe-payment-request-button.entry.js.map +0 -1
- package/dist/stripe-elements/index.esm.js.map +0 -1
- package/dist/stripe-elements/ion-icon.entry.esm.js.map +0 -1
- package/dist/stripe-elements/loader.esm.js.map +0 -1
- package/dist/stripe-elements/p-02f6e421.entry.js +0 -2
- package/dist/stripe-elements/p-02f6e421.entry.js.map +0 -1
- package/dist/stripe-elements/p-19888fa6.entry.js +0 -2
- package/dist/stripe-elements/p-19888fa6.entry.js.map +0 -1
- package/dist/stripe-elements/p-4d505729.entry.js +0 -2
- package/dist/stripe-elements/p-4d505729.entry.js.map +0 -1
- package/dist/stripe-elements/p-7e7ad92a.entry.js +0 -2
- package/dist/stripe-elements/p-7e7ad92a.entry.js.map +0 -1
- package/dist/stripe-elements/p-8bb4212c.entry.js +0 -2
- package/dist/stripe-elements/p-8bb4212c.entry.js.map +0 -1
- package/dist/stripe-elements/p-9aee2b6b.entry.js +0 -2
- package/dist/stripe-elements/p-9aee2b6b.entry.js.map +0 -1
- package/dist/stripe-elements/p-BHDCxQOb.js +0 -2
- package/dist/stripe-elements/p-BHDCxQOb.js.map +0 -1
- package/dist/stripe-elements/p-DI2vmGaI.js +0 -2
- package/dist/stripe-elements/p-DI2vmGaI.js.map +0 -1
- package/dist/stripe-elements/p-DJwTOfxZ.js +0 -3
- package/dist/stripe-elements/p-DJwTOfxZ.js.map +0 -1
- package/dist/stripe-elements/p-DQuL1Twl.js.map +0 -1
- package/dist/stripe-elements/p-XRfh5Wrs.js.map +0 -1
- package/dist/stripe-elements/p-ba251393.entry.js +0 -2
- package/dist/stripe-elements/p-ba251393.entry.js.map +0 -1
- package/dist/stripe-elements/p-c649edfc.entry.js +0 -2
- package/dist/stripe-elements/p-c649edfc.entry.js.map +0 -1
- package/dist/stripe-elements/p-e8bb43ae.entry.js +0 -2
- package/dist/stripe-elements/p-e8bb43ae.entry.js.map +0 -1
- package/dist/stripe-elements/stripe-address-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-card-element-modal.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-card-element.stripe-modal.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-currency-selector.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-elements.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-express-checkout-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-link-authentication-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-payment-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-payment-request-button.entry.esm.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as loadStripe } from './index-
|
|
1
|
+
import { S as StencilCore } from './index-C6bbmyga.js';
|
|
2
|
+
import { l as loadStripe } from './index-CBXaOfXU.js';
|
|
3
3
|
|
|
4
4
|
const getPlatforms = (win) => setupPlatforms(win);
|
|
5
5
|
const setupPlatforms = (win = window) => {
|
|
@@ -276,7 +276,7 @@ const deepFind = (obj, path, keySeparator = '.') => {
|
|
|
276
276
|
}
|
|
277
277
|
return current;
|
|
278
278
|
};
|
|
279
|
-
const getCleanedCode = code => code?.replace(
|
|
279
|
+
const getCleanedCode = code => code?.replace(/_/g, '-');
|
|
280
280
|
|
|
281
281
|
const consoleLogger = {
|
|
282
282
|
type: 'logger',
|
|
@@ -537,7 +537,16 @@ function keysFromSelector(selector, opts) {
|
|
|
537
537
|
const {
|
|
538
538
|
[PATH_KEY]: path
|
|
539
539
|
} = selector(createProxy());
|
|
540
|
-
|
|
540
|
+
const keySeparator = opts?.keySeparator ?? '.';
|
|
541
|
+
const nsSeparator = opts?.nsSeparator ?? ':';
|
|
542
|
+
if (path.length > 1 && nsSeparator) {
|
|
543
|
+
const ns = opts?.ns;
|
|
544
|
+
const nsArray = Array.isArray(ns) ? ns : null;
|
|
545
|
+
if (nsArray && nsArray.length > 1 && nsArray.slice(1).includes(path[0])) {
|
|
546
|
+
return `${path[0]}${nsSeparator}${path.slice(1).join(keySeparator)}`;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return path.join(keySeparator);
|
|
541
550
|
}
|
|
542
551
|
|
|
543
552
|
const checkedLoadedFor = {};
|
|
@@ -611,6 +620,10 @@ class Translator extends EventEmitter {
|
|
|
611
620
|
...opt
|
|
612
621
|
});
|
|
613
622
|
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
623
|
+
keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
|
|
624
|
+
...this.options,
|
|
625
|
+
...opt
|
|
626
|
+
}) : String(k));
|
|
614
627
|
const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
|
|
615
628
|
const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
|
|
616
629
|
const {
|
|
@@ -857,6 +870,10 @@ class Translator extends EventEmitter {
|
|
|
857
870
|
let usedLng;
|
|
858
871
|
let usedNS;
|
|
859
872
|
if (isString(keys)) keys = [keys];
|
|
873
|
+
if (Array.isArray(keys)) keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
|
|
874
|
+
...this.options,
|
|
875
|
+
...opt
|
|
876
|
+
}) : k);
|
|
860
877
|
keys.forEach(k => {
|
|
861
878
|
if (this.isValidLookup(found)) return;
|
|
862
879
|
const extracted = this.extractFromKey(k, opt);
|
|
@@ -1097,9 +1114,6 @@ class PluralResolver {
|
|
|
1097
1114
|
this.logger = baseLogger.create('pluralResolver');
|
|
1098
1115
|
this.pluralRulesCache = {};
|
|
1099
1116
|
}
|
|
1100
|
-
addRule(lng, obj) {
|
|
1101
|
-
this.rules[lng] = obj;
|
|
1102
|
-
}
|
|
1103
1117
|
clearCache() {
|
|
1104
1118
|
this.pluralRulesCache = {};
|
|
1105
1119
|
}
|
|
@@ -1119,7 +1133,7 @@ class PluralResolver {
|
|
|
1119
1133
|
type
|
|
1120
1134
|
});
|
|
1121
1135
|
} catch (err) {
|
|
1122
|
-
if (
|
|
1136
|
+
if (typeof Intl === 'undefined') {
|
|
1123
1137
|
this.logger.error('No Intl support, please use an Intl polyfill!');
|
|
1124
1138
|
return dummyRule;
|
|
1125
1139
|
}
|
|
@@ -1300,13 +1314,13 @@ class Interpolator {
|
|
|
1300
1314
|
const handleHasOptions = (key, inheritedOptions) => {
|
|
1301
1315
|
const sep = this.nestingOptionsSeparator;
|
|
1302
1316
|
if (key.indexOf(sep) < 0) return key;
|
|
1303
|
-
const c = key.split(new RegExp(`${sep}[ ]*{`));
|
|
1317
|
+
const c = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
|
|
1304
1318
|
let optionsString = `{${c[1]}`;
|
|
1305
1319
|
key = c[0];
|
|
1306
1320
|
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
1307
1321
|
const matchedSingleQuotes = optionsString.match(/'/g);
|
|
1308
1322
|
const matchedDoubleQuotes = optionsString.match(/"/g);
|
|
1309
|
-
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes
|
|
1323
|
+
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || (matchedDoubleQuotes?.length ?? 0) % 2 !== 0) {
|
|
1310
1324
|
optionsString = optionsString.replace(/'/g, '"');
|
|
1311
1325
|
}
|
|
1312
1326
|
try {
|
|
@@ -1788,6 +1802,28 @@ const bindMemberFunctions = inst => {
|
|
|
1788
1802
|
}
|
|
1789
1803
|
});
|
|
1790
1804
|
};
|
|
1805
|
+
const SUPPORT_NOTICE_KEY = '__i18next_supportNoticeShown';
|
|
1806
|
+
const getSupportNoticeShown = () => {
|
|
1807
|
+
if (typeof globalThis !== 'undefined' && !!globalThis[SUPPORT_NOTICE_KEY]) return true;
|
|
1808
|
+
if (typeof process !== 'undefined' && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE) return true;
|
|
1809
|
+
if (typeof process !== 'undefined' && process.env && "production" === 'production') return true;
|
|
1810
|
+
return false;
|
|
1811
|
+
};
|
|
1812
|
+
const setSupportNoticeShown = () => {
|
|
1813
|
+
if (typeof globalThis !== 'undefined') globalThis[SUPPORT_NOTICE_KEY] = true;
|
|
1814
|
+
};
|
|
1815
|
+
const usesLocize = inst => {
|
|
1816
|
+
if (inst?.modules?.backend?.name?.indexOf('Locize') > 0) return true;
|
|
1817
|
+
if (inst?.modules?.backend?.constructor?.name?.indexOf('Locize') > 0) return true;
|
|
1818
|
+
if (inst?.options?.backend?.backends) {
|
|
1819
|
+
if (inst.options.backend.backends.some(b => b?.name?.indexOf('Locize') > 0 || b?.constructor?.name?.indexOf('Locize') > 0)) return true;
|
|
1820
|
+
}
|
|
1821
|
+
if (inst?.options?.backend?.projectId) return true;
|
|
1822
|
+
if (inst?.options?.backend?.backendOptions) {
|
|
1823
|
+
if (inst.options.backend.backendOptions.some(b => b?.projectId)) return true;
|
|
1824
|
+
}
|
|
1825
|
+
return false;
|
|
1826
|
+
};
|
|
1791
1827
|
class I18n extends EventEmitter {
|
|
1792
1828
|
constructor(options = {}, callback) {
|
|
1793
1829
|
super();
|
|
@@ -1837,6 +1873,13 @@ class I18n extends EventEmitter {
|
|
|
1837
1873
|
if (options.nsSeparator !== undefined) {
|
|
1838
1874
|
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
1839
1875
|
}
|
|
1876
|
+
if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
|
|
1877
|
+
this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
1878
|
+
}
|
|
1879
|
+
if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
|
|
1880
|
+
if (typeof console !== 'undefined' && typeof console.info !== 'undefined') console.info('🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙');
|
|
1881
|
+
setSupportNoticeShown();
|
|
1882
|
+
}
|
|
1840
1883
|
const createClassOnDemand = ClassOrObject => {
|
|
1841
1884
|
if (!ClassOrObject) return null;
|
|
1842
1885
|
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
@@ -2097,21 +2140,20 @@ class I18n extends EventEmitter {
|
|
|
2097
2140
|
o.lngs = o.lngs || fixedT.lngs;
|
|
2098
2141
|
o.ns = o.ns || fixedT.ns;
|
|
2099
2142
|
if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
2143
|
+
const selectorOpts = {
|
|
2144
|
+
...this.options,
|
|
2145
|
+
...o
|
|
2146
|
+
};
|
|
2147
|
+
if (typeof o.keyPrefix === 'function') o.keyPrefix = keysFromSelector(o.keyPrefix, selectorOpts);
|
|
2100
2148
|
const keySeparator = this.options.keySeparator || '.';
|
|
2101
2149
|
let resultKey;
|
|
2102
2150
|
if (o.keyPrefix && Array.isArray(key)) {
|
|
2103
2151
|
resultKey = key.map(k => {
|
|
2104
|
-
if (typeof k === 'function') k = keysFromSelector(k,
|
|
2105
|
-
...this.options,
|
|
2106
|
-
...opts
|
|
2107
|
-
});
|
|
2152
|
+
if (typeof k === 'function') k = keysFromSelector(k, selectorOpts);
|
|
2108
2153
|
return `${o.keyPrefix}${keySeparator}${k}`;
|
|
2109
2154
|
});
|
|
2110
2155
|
} else {
|
|
2111
|
-
if (typeof key === 'function') key = keysFromSelector(key,
|
|
2112
|
-
...this.options,
|
|
2113
|
-
...opts
|
|
2114
|
-
});
|
|
2156
|
+
if (typeof key === 'function') key = keysFromSelector(key, selectorOpts);
|
|
2115
2157
|
resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
|
|
2116
2158
|
}
|
|
2117
2159
|
return this.t(resultKey, o);
|
|
@@ -2252,6 +2294,19 @@ class I18n extends EventEmitter {
|
|
|
2252
2294
|
clone.store = new ResourceStore(clonedData, mergedOptions);
|
|
2253
2295
|
clone.services.resourceStore = clone.store;
|
|
2254
2296
|
}
|
|
2297
|
+
if (options.interpolation) {
|
|
2298
|
+
const defOpts = get();
|
|
2299
|
+
const mergedInterpolation = {
|
|
2300
|
+
...defOpts.interpolation,
|
|
2301
|
+
...this.options.interpolation,
|
|
2302
|
+
...options.interpolation
|
|
2303
|
+
};
|
|
2304
|
+
const mergedForInterpolator = {
|
|
2305
|
+
...mergedOptions,
|
|
2306
|
+
interpolation: mergedInterpolation
|
|
2307
|
+
};
|
|
2308
|
+
clone.services.interpolator = new Interpolator(mergedForInterpolator);
|
|
2309
|
+
}
|
|
2255
2310
|
clone.translator = new Translator(clone.services, mergedOptions);
|
|
2256
2311
|
clone.translator.on('*', (event, ...args) => {
|
|
2257
2312
|
clone.emit(event, ...args);
|
|
@@ -2758,12 +2813,13 @@ instance.use(Browser).init({
|
|
|
2758
2813
|
const i18n = instance;
|
|
2759
2814
|
|
|
2760
2815
|
const appendToMap = (map, propName, value) => {
|
|
2761
|
-
|
|
2762
|
-
if (!
|
|
2763
|
-
|
|
2816
|
+
let refs = map.get(propName);
|
|
2817
|
+
if (!refs) {
|
|
2818
|
+
refs = [];
|
|
2819
|
+
map.set(propName, refs);
|
|
2764
2820
|
}
|
|
2765
|
-
|
|
2766
|
-
|
|
2821
|
+
if (!refs.some((ref) => ref.deref() === value)) {
|
|
2822
|
+
refs.push(new WeakRef(value));
|
|
2767
2823
|
}
|
|
2768
2824
|
};
|
|
2769
2825
|
const debounce = (fn, ms) => {
|
|
@@ -2791,33 +2847,54 @@ const debounce = (fn, ms) => {
|
|
|
2791
2847
|
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
2792
2848
|
const cleanupElements = debounce((map) => {
|
|
2793
2849
|
for (let key of map.keys()) {
|
|
2794
|
-
|
|
2850
|
+
const refs = map.get(key).filter((ref) => {
|
|
2851
|
+
const elm = ref.deref();
|
|
2852
|
+
return elm && isConnected(elm);
|
|
2853
|
+
});
|
|
2854
|
+
map.set(key, refs);
|
|
2795
2855
|
}
|
|
2796
2856
|
}, 2_000);
|
|
2857
|
+
const core = StencilCore;
|
|
2858
|
+
const forceUpdate = core.forceUpdate;
|
|
2859
|
+
const getRenderingRef = core.getRenderingRef;
|
|
2797
2860
|
const stencilSubscription = () => {
|
|
2798
|
-
if (typeof getRenderingRef !== 'function') {
|
|
2861
|
+
if (typeof getRenderingRef !== 'function' || typeof forceUpdate !== 'function') {
|
|
2799
2862
|
// If we are not in a stencil project, we do nothing.
|
|
2800
2863
|
// This function is not really exported by @stencil/core.
|
|
2801
2864
|
return {};
|
|
2802
2865
|
}
|
|
2866
|
+
const ensureForceUpdate = forceUpdate;
|
|
2867
|
+
const ensureGetRenderingRef = getRenderingRef;
|
|
2803
2868
|
const elmsToUpdate = new Map();
|
|
2804
2869
|
return {
|
|
2805
2870
|
dispose: () => elmsToUpdate.clear(),
|
|
2806
2871
|
get: (propName) => {
|
|
2807
|
-
const elm =
|
|
2872
|
+
const elm = ensureGetRenderingRef();
|
|
2808
2873
|
if (elm) {
|
|
2809
2874
|
appendToMap(elmsToUpdate, propName, elm);
|
|
2810
2875
|
}
|
|
2811
2876
|
},
|
|
2812
2877
|
set: (propName) => {
|
|
2813
|
-
const
|
|
2814
|
-
if (
|
|
2815
|
-
|
|
2878
|
+
const refs = elmsToUpdate.get(propName);
|
|
2879
|
+
if (refs) {
|
|
2880
|
+
const nextRefs = refs.filter((ref) => {
|
|
2881
|
+
const elm = ref.deref();
|
|
2882
|
+
if (!elm)
|
|
2883
|
+
return false;
|
|
2884
|
+
return ensureForceUpdate(elm);
|
|
2885
|
+
});
|
|
2886
|
+
elmsToUpdate.set(propName, nextRefs);
|
|
2816
2887
|
}
|
|
2817
2888
|
cleanupElements(elmsToUpdate);
|
|
2818
2889
|
},
|
|
2819
2890
|
reset: () => {
|
|
2820
|
-
elmsToUpdate.forEach((
|
|
2891
|
+
elmsToUpdate.forEach((refs) => {
|
|
2892
|
+
refs.forEach((ref) => {
|
|
2893
|
+
const elm = ref.deref();
|
|
2894
|
+
if (elm)
|
|
2895
|
+
ensureForceUpdate(elm);
|
|
2896
|
+
});
|
|
2897
|
+
});
|
|
2821
2898
|
cleanupElements(elmsToUpdate);
|
|
2822
2899
|
},
|
|
2823
2900
|
};
|
|
@@ -2825,8 +2902,11 @@ const stencilSubscription = () => {
|
|
|
2825
2902
|
|
|
2826
2903
|
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
2827
2904
|
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
2828
|
-
const
|
|
2829
|
-
|
|
2905
|
+
const resolveDefaultState = () => (unwrap(defaultState) ?? {});
|
|
2906
|
+
const initialState = resolveDefaultState();
|
|
2907
|
+
let states = new Map(Object.entries(initialState));
|
|
2908
|
+
const proxyAvailable = typeof Proxy !== 'undefined';
|
|
2909
|
+
const plainState = proxyAvailable ? null : {};
|
|
2830
2910
|
const handlers = {
|
|
2831
2911
|
dispose: [],
|
|
2832
2912
|
get: [],
|
|
@@ -2838,7 +2918,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2838
2918
|
const reset = () => {
|
|
2839
2919
|
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
2840
2920
|
// otherwise, the state won't be properly reset
|
|
2841
|
-
states = new Map(Object.entries(
|
|
2921
|
+
states = new Map(Object.entries(resolveDefaultState()));
|
|
2922
|
+
if (!proxyAvailable) {
|
|
2923
|
+
syncPlainStateKeys();
|
|
2924
|
+
}
|
|
2842
2925
|
handlers.reset.forEach((cb) => cb());
|
|
2843
2926
|
};
|
|
2844
2927
|
const dispose = () => {
|
|
@@ -2855,12 +2938,14 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2855
2938
|
const oldValue = states.get(propName);
|
|
2856
2939
|
if (shouldUpdate(value, oldValue, propName)) {
|
|
2857
2940
|
states.set(propName, value);
|
|
2941
|
+
if (!proxyAvailable) {
|
|
2942
|
+
ensurePlainProperty(propName);
|
|
2943
|
+
}
|
|
2858
2944
|
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
2859
2945
|
}
|
|
2860
2946
|
};
|
|
2861
|
-
const state = (
|
|
2862
|
-
? {
|
|
2863
|
-
: new Proxy(unwrappedState, {
|
|
2947
|
+
const state = (proxyAvailable
|
|
2948
|
+
? new Proxy(initialState, {
|
|
2864
2949
|
get(_, propName) {
|
|
2865
2950
|
return get(propName);
|
|
2866
2951
|
},
|
|
@@ -2880,7 +2965,11 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2880
2965
|
set(propName, value);
|
|
2881
2966
|
return true;
|
|
2882
2967
|
},
|
|
2883
|
-
})
|
|
2968
|
+
})
|
|
2969
|
+
: (() => {
|
|
2970
|
+
syncPlainStateKeys();
|
|
2971
|
+
return plainState;
|
|
2972
|
+
})());
|
|
2884
2973
|
const on = (eventName, callback) => {
|
|
2885
2974
|
handlers[eventName].push(callback);
|
|
2886
2975
|
return () => {
|
|
@@ -2893,7 +2982,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2893
2982
|
cb(newValue);
|
|
2894
2983
|
}
|
|
2895
2984
|
};
|
|
2896
|
-
const resetHandler = () =>
|
|
2985
|
+
const resetHandler = () => {
|
|
2986
|
+
const snapshot = resolveDefaultState();
|
|
2987
|
+
cb(snapshot[propName]);
|
|
2988
|
+
};
|
|
2897
2989
|
// Register the handlers
|
|
2898
2990
|
const unSet = on('set', setHandler);
|
|
2899
2991
|
const unReset = on('reset', resetHandler);
|
|
@@ -2936,6 +3028,38 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2936
3028
|
changeListeners.delete(listener);
|
|
2937
3029
|
}
|
|
2938
3030
|
};
|
|
3031
|
+
function ensurePlainProperty(key) {
|
|
3032
|
+
if (proxyAvailable || !plainState) {
|
|
3033
|
+
return;
|
|
3034
|
+
}
|
|
3035
|
+
if (Object.prototype.hasOwnProperty.call(plainState, key)) {
|
|
3036
|
+
return;
|
|
3037
|
+
}
|
|
3038
|
+
Object.defineProperty(plainState, key, {
|
|
3039
|
+
configurable: true,
|
|
3040
|
+
enumerable: true,
|
|
3041
|
+
get() {
|
|
3042
|
+
return get(key);
|
|
3043
|
+
},
|
|
3044
|
+
set(value) {
|
|
3045
|
+
set(key, value);
|
|
3046
|
+
},
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
function syncPlainStateKeys() {
|
|
3050
|
+
if (proxyAvailable || !plainState) {
|
|
3051
|
+
return;
|
|
3052
|
+
}
|
|
3053
|
+
const knownKeys = new Set(states.keys());
|
|
3054
|
+
for (const key of Object.keys(plainState)) {
|
|
3055
|
+
if (!knownKeys.has(key)) {
|
|
3056
|
+
delete plainState[key];
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
for (const key of knownKeys) {
|
|
3060
|
+
ensurePlainProperty(key);
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
2939
3063
|
return {
|
|
2940
3064
|
state,
|
|
2941
3065
|
get,
|
|
@@ -3008,10 +3132,10 @@ class StripeServiceClass {
|
|
|
3008
3132
|
// Update configuration
|
|
3009
3133
|
this.store.state.publishableKey = publishableKey;
|
|
3010
3134
|
this.store.state.isCheckoutSession = false;
|
|
3011
|
-
if (options === null || options === void 0 ? void 0 : options.stripeAccount) {
|
|
3135
|
+
if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
|
|
3012
3136
|
this.store.state.stripeAccount = options.stripeAccount;
|
|
3013
3137
|
}
|
|
3014
|
-
if (options === null || options === void 0 ? void 0 : options.applicationName) {
|
|
3138
|
+
if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
|
|
3015
3139
|
this.store.state.applicationName = options.applicationName;
|
|
3016
3140
|
}
|
|
3017
3141
|
// If Stripe.js already loaded with same config, do nothing
|
|
@@ -3047,10 +3171,10 @@ class StripeServiceClass {
|
|
|
3047
3171
|
// Update configuration
|
|
3048
3172
|
this.store.state.publishableKey = publishableKey;
|
|
3049
3173
|
this.store.state.isCheckoutSession = true;
|
|
3050
|
-
if (options === null || options === void 0 ? void 0 : options.stripeAccount) {
|
|
3174
|
+
if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
|
|
3051
3175
|
this.store.state.stripeAccount = options.stripeAccount;
|
|
3052
3176
|
}
|
|
3053
|
-
if (options === null || options === void 0 ? void 0 : options.applicationName) {
|
|
3177
|
+
if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
|
|
3054
3178
|
this.store.state.applicationName = options.applicationName;
|
|
3055
3179
|
}
|
|
3056
3180
|
this.store.state.loadStripeStatus = 'loading';
|
|
@@ -3064,7 +3188,7 @@ class StripeServiceClass {
|
|
|
3064
3188
|
});
|
|
3065
3189
|
this.store.state.stripe = stripe;
|
|
3066
3190
|
// Initialize Checkout instance instead of Elements
|
|
3067
|
-
const checkout = stripe.
|
|
3191
|
+
const checkout = stripe.initCheckoutElementsSdk({
|
|
3068
3192
|
clientSecret: checkoutSessionClientSecret,
|
|
3069
3193
|
elementsOptions: options === null || options === void 0 ? void 0 : options.elementsOptions,
|
|
3070
3194
|
});
|
|
@@ -3134,7 +3258,7 @@ new StripeServiceClass();
|
|
|
3134
3258
|
function findElement(containerElement, selector, timeout = 5000) {
|
|
3135
3259
|
return new Promise((resolve, reject) => {
|
|
3136
3260
|
const elem = containerElement.querySelector(selector);
|
|
3137
|
-
if (elem) {
|
|
3261
|
+
if (elem != null) {
|
|
3138
3262
|
return resolve(elem);
|
|
3139
3263
|
}
|
|
3140
3264
|
const timeoutId = setTimeout(() => {
|
|
@@ -3143,7 +3267,7 @@ function findElement(containerElement, selector, timeout = 5000) {
|
|
|
3143
3267
|
}, timeout);
|
|
3144
3268
|
const observer = new MutationObserver(() => {
|
|
3145
3269
|
const elem = containerElement.querySelector(selector);
|
|
3146
|
-
if (elem) {
|
|
3270
|
+
if (elem != null) {
|
|
3147
3271
|
clearTimeout(timeoutId);
|
|
3148
3272
|
observer.disconnect();
|
|
3149
3273
|
resolve(elem);
|
|
@@ -3186,11 +3310,11 @@ class CardElementManager {
|
|
|
3186
3310
|
*/
|
|
3187
3311
|
async initialize(containerElement) {
|
|
3188
3312
|
const elements = this.stripeService.getElements();
|
|
3189
|
-
if (
|
|
3313
|
+
if (elements == null) {
|
|
3190
3314
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3191
3315
|
}
|
|
3192
3316
|
// Unmount if already initialized
|
|
3193
|
-
if (this.cardElements) {
|
|
3317
|
+
if (this.cardElements != null) {
|
|
3194
3318
|
this.unmount();
|
|
3195
3319
|
}
|
|
3196
3320
|
// Create and mount card number element
|
|
@@ -3241,7 +3365,7 @@ class CardElementManager {
|
|
|
3241
3365
|
*/
|
|
3242
3366
|
unmount() {
|
|
3243
3367
|
var _a, _b, _c;
|
|
3244
|
-
if (
|
|
3368
|
+
if (this.cardElements == null) {
|
|
3245
3369
|
return;
|
|
3246
3370
|
}
|
|
3247
3371
|
(_a = this.cardElements.cardNumber) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
@@ -3303,13 +3427,13 @@ class PaymentElementManager {
|
|
|
3303
3427
|
async initialize(containerElement, options) {
|
|
3304
3428
|
const isCheckoutSession = this.stripeService.state.isCheckoutSession;
|
|
3305
3429
|
// Unmount if already initialized
|
|
3306
|
-
if (this.paymentElement) {
|
|
3430
|
+
if (this.paymentElement != null) {
|
|
3307
3431
|
this.unmount();
|
|
3308
3432
|
}
|
|
3309
3433
|
if (isCheckoutSession) {
|
|
3310
3434
|
// Checkout Session mode: use checkout.createPaymentElement()
|
|
3311
3435
|
const checkout = this.stripeService.getCheckout();
|
|
3312
|
-
if (
|
|
3436
|
+
if (checkout == null) {
|
|
3313
3437
|
throw new Error('StripeService not initialized with Checkout Session. Call StripeService.initializeWithCheckoutSession() first.');
|
|
3314
3438
|
}
|
|
3315
3439
|
// Create payment element using Checkout instance
|
|
@@ -3318,7 +3442,7 @@ class PaymentElementManager {
|
|
|
3318
3442
|
else {
|
|
3319
3443
|
// Payment Intent mode: use elements.create('payment')
|
|
3320
3444
|
const elements = this.stripeService.getElements();
|
|
3321
|
-
if (
|
|
3445
|
+
if (elements == null) {
|
|
3322
3446
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3323
3447
|
}
|
|
3324
3448
|
// Create payment element with options
|
|
@@ -3355,7 +3479,7 @@ class PaymentElementManager {
|
|
|
3355
3479
|
* Unmount payment element
|
|
3356
3480
|
*/
|
|
3357
3481
|
unmount() {
|
|
3358
|
-
if (
|
|
3482
|
+
if (this.paymentElement == null) {
|
|
3359
3483
|
return;
|
|
3360
3484
|
}
|
|
3361
3485
|
this.paymentElement.unmount();
|
|
@@ -3394,11 +3518,11 @@ class AddressElementManager {
|
|
|
3394
3518
|
*/
|
|
3395
3519
|
async initialize(containerElement, options) {
|
|
3396
3520
|
const elements = this.stripeService.getElements();
|
|
3397
|
-
if (
|
|
3521
|
+
if (elements == null) {
|
|
3398
3522
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3399
3523
|
}
|
|
3400
3524
|
// Unmount if already initialized
|
|
3401
|
-
if (this.addressElement) {
|
|
3525
|
+
if (this.addressElement != null) {
|
|
3402
3526
|
this.unmount();
|
|
3403
3527
|
}
|
|
3404
3528
|
// Create and mount address element
|
|
@@ -3436,7 +3560,7 @@ class AddressElementManager {
|
|
|
3436
3560
|
* Unmount address element
|
|
3437
3561
|
*/
|
|
3438
3562
|
unmount() {
|
|
3439
|
-
if (
|
|
3563
|
+
if (this.addressElement == null) {
|
|
3440
3564
|
return;
|
|
3441
3565
|
}
|
|
3442
3566
|
this.addressElement.unmount();
|
|
@@ -3484,11 +3608,11 @@ class LinkAuthenticationElementManager {
|
|
|
3484
3608
|
*/
|
|
3485
3609
|
async initialize(containerElement, options) {
|
|
3486
3610
|
const elements = this.stripeService.getElements();
|
|
3487
|
-
if (
|
|
3611
|
+
if (elements == null) {
|
|
3488
3612
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3489
3613
|
}
|
|
3490
3614
|
// Unmount if already initialized
|
|
3491
|
-
if (this.linkAuthenticationElement) {
|
|
3615
|
+
if (this.linkAuthenticationElement != null) {
|
|
3492
3616
|
this.unmount();
|
|
3493
3617
|
}
|
|
3494
3618
|
// Create link authentication element
|
|
@@ -3527,7 +3651,7 @@ class LinkAuthenticationElementManager {
|
|
|
3527
3651
|
* Unmount link authentication element
|
|
3528
3652
|
*/
|
|
3529
3653
|
unmount() {
|
|
3530
|
-
if (
|
|
3654
|
+
if (this.linkAuthenticationElement == null) {
|
|
3531
3655
|
return;
|
|
3532
3656
|
}
|
|
3533
3657
|
this.linkAuthenticationElement.unmount();
|
|
@@ -3567,11 +3691,11 @@ class CurrencySelectorElementManager {
|
|
|
3567
3691
|
*/
|
|
3568
3692
|
async initialize(containerElement, options) {
|
|
3569
3693
|
const elements = this.stripeService.getElements();
|
|
3570
|
-
if (
|
|
3694
|
+
if (elements == null) {
|
|
3571
3695
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3572
3696
|
}
|
|
3573
3697
|
// Unmount if already initialized
|
|
3574
|
-
if (this.currencySelectorElement) {
|
|
3698
|
+
if (this.currencySelectorElement != null) {
|
|
3575
3699
|
this.unmount();
|
|
3576
3700
|
}
|
|
3577
3701
|
// Find mount point first to avoid element leak if findElement throws
|
|
@@ -3617,7 +3741,7 @@ class CurrencySelectorElementManager {
|
|
|
3617
3741
|
* Unmount currency selector element
|
|
3618
3742
|
*/
|
|
3619
3743
|
unmount() {
|
|
3620
|
-
if (
|
|
3744
|
+
if (this.currencySelectorElement == null) {
|
|
3621
3745
|
return;
|
|
3622
3746
|
}
|
|
3623
3747
|
this.currencySelectorElement.unmount();
|
|
@@ -3657,11 +3781,11 @@ class ExpressCheckoutElementManager {
|
|
|
3657
3781
|
*/
|
|
3658
3782
|
async initialize(containerElement, options, eventHandlers) {
|
|
3659
3783
|
const elements = this.stripeService.getElements();
|
|
3660
|
-
if (
|
|
3784
|
+
if (elements == null) {
|
|
3661
3785
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3662
3786
|
}
|
|
3663
3787
|
// Unmount if already initialized
|
|
3664
|
-
if (this.expressCheckoutElement) {
|
|
3788
|
+
if (this.expressCheckoutElement != null) {
|
|
3665
3789
|
this.unmount();
|
|
3666
3790
|
}
|
|
3667
3791
|
// Convert buttonHeight from string to number if present
|
|
@@ -3679,19 +3803,19 @@ class ExpressCheckoutElementManager {
|
|
|
3679
3803
|
// Find the mount point
|
|
3680
3804
|
const mountPoint = await findElement(containerElement, '#express-checkout-element');
|
|
3681
3805
|
// Set up event handlers before mounting
|
|
3682
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onConfirm) {
|
|
3806
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onConfirm) != null) {
|
|
3683
3807
|
expressCheckout.on('confirm', eventHandlers.onConfirm);
|
|
3684
3808
|
}
|
|
3685
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick) {
|
|
3809
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick) != null) {
|
|
3686
3810
|
expressCheckout.on('click', eventHandlers.onClick);
|
|
3687
3811
|
}
|
|
3688
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onCancel) {
|
|
3812
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onCancel) != null) {
|
|
3689
3813
|
expressCheckout.on('cancel', eventHandlers.onCancel);
|
|
3690
3814
|
}
|
|
3691
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingAddressChange) {
|
|
3815
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingAddressChange) != null) {
|
|
3692
3816
|
expressCheckout.on('shippingaddresschange', eventHandlers.onShippingAddressChange);
|
|
3693
3817
|
}
|
|
3694
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingRateChange) {
|
|
3818
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingRateChange) != null) {
|
|
3695
3819
|
expressCheckout.on('shippingratechange', eventHandlers.onShippingRateChange);
|
|
3696
3820
|
}
|
|
3697
3821
|
// Add ready event handler
|
|
@@ -3714,7 +3838,7 @@ class ExpressCheckoutElementManager {
|
|
|
3714
3838
|
* @param options - Partial options to update
|
|
3715
3839
|
*/
|
|
3716
3840
|
update(options) {
|
|
3717
|
-
if (
|
|
3841
|
+
if (this.expressCheckoutElement == null) {
|
|
3718
3842
|
console.warn('Express Checkout Element not initialized. Cannot update options.');
|
|
3719
3843
|
return;
|
|
3720
3844
|
}
|
|
@@ -3745,7 +3869,7 @@ class ExpressCheckoutElementManager {
|
|
|
3745
3869
|
* Unmount express checkout element
|
|
3746
3870
|
*/
|
|
3747
3871
|
unmount() {
|
|
3748
|
-
if (
|
|
3872
|
+
if (this.expressCheckoutElement == null) {
|
|
3749
3873
|
return;
|
|
3750
3874
|
}
|
|
3751
3875
|
this.expressCheckoutElement.unmount();
|
|
@@ -3816,6 +3940,3 @@ class ServiceFactory {
|
|
|
3816
3940
|
const serviceFactory = new ServiceFactory();
|
|
3817
3941
|
|
|
3818
3942
|
export { checkPlatform as c, i18n as i, serviceFactory as s };
|
|
3819
|
-
//# sourceMappingURL=factory-Drde6-y7.js.map
|
|
3820
|
-
|
|
3821
|
-
//# sourceMappingURL=factory-Drde6-y7.js.map
|