stripe-pwa-elements 3.2.0 → 4.0.1
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-Cd2VI_N2.js} +216 -77
- 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 +41 -26
- package/dist/cjs/stripe-card-element-modal.cjs.entry.js +6 -7
- package/dist/cjs/stripe-card-element_2.cjs.entry.js +129 -72
- package/dist/cjs/stripe-currency-selector.cjs.entry.js +20 -10
- package/dist/cjs/stripe-elements.cjs.js +31 -5
- package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +32 -22
- package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +20 -10
- package/dist/cjs/stripe-payment-element.cjs.entry.js +283 -167
- package/dist/cjs/stripe-payment-request-button.cjs.entry.js +30 -18
- package/dist/collection/collection-manifest.json +6 -5
- package/dist/collection/components/stripe-address-element/stripe-address-element.js +36 -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 +62 -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 +17 -6
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +35 -20
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +19 -7
- package/dist/collection/components/stripe-modal/stripe-modal.js +18 -7
- 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 +162 -162
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +48 -19
- 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 +27 -10
- 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-VTa1Gc94.js} +216 -77
- 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 +41 -26
- package/dist/esm/stripe-card-element-modal.entry.js +6 -7
- package/dist/esm/stripe-card-element_2.entry.js +129 -72
- package/dist/esm/stripe-currency-selector.entry.js +20 -10
- package/dist/esm/stripe-elements.js +32 -6
- package/dist/esm/stripe-express-checkout-element.entry.js +32 -22
- package/dist/esm/stripe-link-authentication-element.entry.js +20 -10
- package/dist/esm/stripe-payment-element.entry.js +283 -167
- package/dist/esm/stripe-payment-request-button.entry.js +27 -15
- package/dist/stripe-elements/index.esm.js +0 -2
- package/dist/stripe-elements/p-1bd46766.entry.js +1 -0
- package/dist/stripe-elements/p-1c6e0a45.entry.js +1 -0
- package/dist/stripe-elements/p-3f42ca0c.entry.js +1 -0
- package/dist/stripe-elements/p-5cf62945.entry.js +1 -0
- package/dist/stripe-elements/p-74de1556.entry.js +1 -0
- package/dist/stripe-elements/p-76e57d78.entry.js +1 -0
- package/dist/stripe-elements/p-840d499f.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-CrjrbGJ3.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-ae0c336e.entry.js +1 -0
- package/dist/stripe-elements/p-cfd8e081.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-address-element/stripe-address-element.d.ts +6 -0
- package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +11 -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-currency-selector/stripe-currency-selector.d.ts +6 -0
- package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +6 -0
- package/dist/types/components/stripe-link-authentication-element/stripe-link-authentication-element.d.ts +6 -0
- package/dist/types/components/stripe-modal/stripe-modal.d.ts +1 -0
- package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +20 -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 +14 -1
- package/dist/types/components.d.ts +139 -29
- package/dist/types/index.d.ts +1 -0
- package/dist/types/services/interfaces.d.ts +4 -3
- package/dist/types/services/stripe-service.d.ts +8 -4
- 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,
|
|
@@ -2975,6 +3099,8 @@ class StripeServiceClass {
|
|
|
2975
3099
|
applicationName: 'stripe-pwa-elements',
|
|
2976
3100
|
isCheckoutSession: false,
|
|
2977
3101
|
});
|
|
3102
|
+
/** Incremented on every init so that a slower, older call cannot overwrite newer state */
|
|
3103
|
+
this.initGeneration = 0;
|
|
2978
3104
|
this.changeListeners = new Map();
|
|
2979
3105
|
}
|
|
2980
3106
|
/**
|
|
@@ -3002,20 +3128,28 @@ class StripeServiceClass {
|
|
|
3002
3128
|
/**
|
|
3003
3129
|
* Initialize Stripe.js client with Payment Intent mode
|
|
3004
3130
|
* @param publishableKey - Your Stripe publishable API key
|
|
3005
|
-
* @param options - Optional configuration
|
|
3131
|
+
* @param options - Optional configuration (`clientSecret` is the PaymentIntent / SetupIntent client secret)
|
|
3006
3132
|
*/
|
|
3007
3133
|
async initialize(publishableKey, options) {
|
|
3134
|
+
const generation = ++this.initGeneration;
|
|
3135
|
+
// Capture the previous config before overwriting it, so we can detect real changes
|
|
3136
|
+
const isUpToDate = this.store.state.stripe != null &&
|
|
3137
|
+
!this.store.state.isCheckoutSession &&
|
|
3138
|
+
this.store.state.publishableKey === publishableKey &&
|
|
3139
|
+
this.store.state.stripeAccount === (options === null || options === void 0 ? void 0 : options.stripeAccount) &&
|
|
3140
|
+
this.intentClientSecret === (options === null || options === void 0 ? void 0 : options.clientSecret);
|
|
3008
3141
|
// Update configuration
|
|
3009
3142
|
this.store.state.publishableKey = publishableKey;
|
|
3010
3143
|
this.store.state.isCheckoutSession = false;
|
|
3011
|
-
|
|
3144
|
+
this.intentClientSecret = options === null || options === void 0 ? void 0 : options.clientSecret;
|
|
3145
|
+
if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
|
|
3012
3146
|
this.store.state.stripeAccount = options.stripeAccount;
|
|
3013
3147
|
}
|
|
3014
|
-
if (options === null || options === void 0 ? void 0 : options.applicationName) {
|
|
3148
|
+
if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
|
|
3015
3149
|
this.store.state.applicationName = options.applicationName;
|
|
3016
3150
|
}
|
|
3017
3151
|
// If Stripe.js already loaded with same config, do nothing
|
|
3018
|
-
if (
|
|
3152
|
+
if (isUpToDate) {
|
|
3019
3153
|
return;
|
|
3020
3154
|
}
|
|
3021
3155
|
this.store.state.loadStripeStatus = 'loading';
|
|
@@ -3023,12 +3157,16 @@ class StripeServiceClass {
|
|
|
3023
3157
|
const stripe = await loadStripe(publishableKey, {
|
|
3024
3158
|
stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
|
|
3025
3159
|
});
|
|
3160
|
+
if (generation !== this.initGeneration) {
|
|
3161
|
+
return;
|
|
3162
|
+
}
|
|
3026
3163
|
// Register app info
|
|
3027
3164
|
stripe.registerAppInfo({
|
|
3028
3165
|
name: this.store.state.applicationName,
|
|
3029
3166
|
});
|
|
3030
3167
|
this.store.state.stripe = stripe;
|
|
3031
|
-
|
|
3168
|
+
// Payment Element requires the client secret at Elements creation time
|
|
3169
|
+
this.store.state.elements = (options === null || options === void 0 ? void 0 : options.clientSecret) != null && options.clientSecret !== '' ? stripe.elements({ clientSecret: options.clientSecret }) : stripe.elements();
|
|
3032
3170
|
this.store.state.checkout = undefined;
|
|
3033
3171
|
this.store.state.loadStripeStatus = 'success';
|
|
3034
3172
|
}
|
|
@@ -3041,16 +3179,17 @@ class StripeServiceClass {
|
|
|
3041
3179
|
* Initialize Stripe.js client with Checkout Session mode
|
|
3042
3180
|
* @param publishableKey - Your Stripe publishable API key
|
|
3043
3181
|
* @param checkoutSessionClientSecret - The client secret from Checkout Session
|
|
3044
|
-
* @param options - Optional configuration
|
|
3182
|
+
* @param options - Optional configuration (`clientSecret` is the PaymentIntent / SetupIntent client secret)
|
|
3045
3183
|
*/
|
|
3046
3184
|
async initializeWithCheckoutSession(publishableKey, checkoutSessionClientSecret, options) {
|
|
3185
|
+
const generation = ++this.initGeneration;
|
|
3047
3186
|
// Update configuration
|
|
3048
3187
|
this.store.state.publishableKey = publishableKey;
|
|
3049
3188
|
this.store.state.isCheckoutSession = true;
|
|
3050
|
-
if (options === null || options === void 0 ? void 0 : options.stripeAccount) {
|
|
3189
|
+
if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
|
|
3051
3190
|
this.store.state.stripeAccount = options.stripeAccount;
|
|
3052
3191
|
}
|
|
3053
|
-
if (options === null || options === void 0 ? void 0 : options.applicationName) {
|
|
3192
|
+
if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
|
|
3054
3193
|
this.store.state.applicationName = options.applicationName;
|
|
3055
3194
|
}
|
|
3056
3195
|
this.store.state.loadStripeStatus = 'loading';
|
|
@@ -3058,13 +3197,16 @@ class StripeServiceClass {
|
|
|
3058
3197
|
const stripe = await loadStripe(publishableKey, {
|
|
3059
3198
|
stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
|
|
3060
3199
|
});
|
|
3200
|
+
if (generation !== this.initGeneration) {
|
|
3201
|
+
return;
|
|
3202
|
+
}
|
|
3061
3203
|
// Register app info
|
|
3062
3204
|
stripe.registerAppInfo({
|
|
3063
3205
|
name: this.store.state.applicationName,
|
|
3064
3206
|
});
|
|
3065
3207
|
this.store.state.stripe = stripe;
|
|
3066
3208
|
// Initialize Checkout instance instead of Elements
|
|
3067
|
-
const checkout = stripe.
|
|
3209
|
+
const checkout = stripe.initCheckoutElementsSdk({
|
|
3068
3210
|
clientSecret: checkoutSessionClientSecret,
|
|
3069
3211
|
elementsOptions: options === null || options === void 0 ? void 0 : options.elementsOptions,
|
|
3070
3212
|
});
|
|
@@ -3134,7 +3276,7 @@ new StripeServiceClass();
|
|
|
3134
3276
|
function findElement(containerElement, selector, timeout = 5000) {
|
|
3135
3277
|
return new Promise((resolve, reject) => {
|
|
3136
3278
|
const elem = containerElement.querySelector(selector);
|
|
3137
|
-
if (elem) {
|
|
3279
|
+
if (elem != null) {
|
|
3138
3280
|
return resolve(elem);
|
|
3139
3281
|
}
|
|
3140
3282
|
const timeoutId = setTimeout(() => {
|
|
@@ -3143,7 +3285,7 @@ function findElement(containerElement, selector, timeout = 5000) {
|
|
|
3143
3285
|
}, timeout);
|
|
3144
3286
|
const observer = new MutationObserver(() => {
|
|
3145
3287
|
const elem = containerElement.querySelector(selector);
|
|
3146
|
-
if (elem) {
|
|
3288
|
+
if (elem != null) {
|
|
3147
3289
|
clearTimeout(timeoutId);
|
|
3148
3290
|
observer.disconnect();
|
|
3149
3291
|
resolve(elem);
|
|
@@ -3186,11 +3328,11 @@ class CardElementManager {
|
|
|
3186
3328
|
*/
|
|
3187
3329
|
async initialize(containerElement) {
|
|
3188
3330
|
const elements = this.stripeService.getElements();
|
|
3189
|
-
if (
|
|
3331
|
+
if (elements == null) {
|
|
3190
3332
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3191
3333
|
}
|
|
3192
3334
|
// Unmount if already initialized
|
|
3193
|
-
if (this.cardElements) {
|
|
3335
|
+
if (this.cardElements != null) {
|
|
3194
3336
|
this.unmount();
|
|
3195
3337
|
}
|
|
3196
3338
|
// Create and mount card number element
|
|
@@ -3241,7 +3383,7 @@ class CardElementManager {
|
|
|
3241
3383
|
*/
|
|
3242
3384
|
unmount() {
|
|
3243
3385
|
var _a, _b, _c;
|
|
3244
|
-
if (
|
|
3386
|
+
if (this.cardElements == null) {
|
|
3245
3387
|
return;
|
|
3246
3388
|
}
|
|
3247
3389
|
(_a = this.cardElements.cardNumber) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
@@ -3303,13 +3445,13 @@ class PaymentElementManager {
|
|
|
3303
3445
|
async initialize(containerElement, options) {
|
|
3304
3446
|
const isCheckoutSession = this.stripeService.state.isCheckoutSession;
|
|
3305
3447
|
// Unmount if already initialized
|
|
3306
|
-
if (this.paymentElement) {
|
|
3448
|
+
if (this.paymentElement != null) {
|
|
3307
3449
|
this.unmount();
|
|
3308
3450
|
}
|
|
3309
3451
|
if (isCheckoutSession) {
|
|
3310
3452
|
// Checkout Session mode: use checkout.createPaymentElement()
|
|
3311
3453
|
const checkout = this.stripeService.getCheckout();
|
|
3312
|
-
if (
|
|
3454
|
+
if (checkout == null) {
|
|
3313
3455
|
throw new Error('StripeService not initialized with Checkout Session. Call StripeService.initializeWithCheckoutSession() first.');
|
|
3314
3456
|
}
|
|
3315
3457
|
// Create payment element using Checkout instance
|
|
@@ -3318,7 +3460,7 @@ class PaymentElementManager {
|
|
|
3318
3460
|
else {
|
|
3319
3461
|
// Payment Intent mode: use elements.create('payment')
|
|
3320
3462
|
const elements = this.stripeService.getElements();
|
|
3321
|
-
if (
|
|
3463
|
+
if (elements == null) {
|
|
3322
3464
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3323
3465
|
}
|
|
3324
3466
|
// Create payment element with options
|
|
@@ -3355,7 +3497,7 @@ class PaymentElementManager {
|
|
|
3355
3497
|
* Unmount payment element
|
|
3356
3498
|
*/
|
|
3357
3499
|
unmount() {
|
|
3358
|
-
if (
|
|
3500
|
+
if (this.paymentElement == null) {
|
|
3359
3501
|
return;
|
|
3360
3502
|
}
|
|
3361
3503
|
this.paymentElement.unmount();
|
|
@@ -3394,11 +3536,11 @@ class AddressElementManager {
|
|
|
3394
3536
|
*/
|
|
3395
3537
|
async initialize(containerElement, options) {
|
|
3396
3538
|
const elements = this.stripeService.getElements();
|
|
3397
|
-
if (
|
|
3539
|
+
if (elements == null) {
|
|
3398
3540
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3399
3541
|
}
|
|
3400
3542
|
// Unmount if already initialized
|
|
3401
|
-
if (this.addressElement) {
|
|
3543
|
+
if (this.addressElement != null) {
|
|
3402
3544
|
this.unmount();
|
|
3403
3545
|
}
|
|
3404
3546
|
// Create and mount address element
|
|
@@ -3436,7 +3578,7 @@ class AddressElementManager {
|
|
|
3436
3578
|
* Unmount address element
|
|
3437
3579
|
*/
|
|
3438
3580
|
unmount() {
|
|
3439
|
-
if (
|
|
3581
|
+
if (this.addressElement == null) {
|
|
3440
3582
|
return;
|
|
3441
3583
|
}
|
|
3442
3584
|
this.addressElement.unmount();
|
|
@@ -3484,11 +3626,11 @@ class LinkAuthenticationElementManager {
|
|
|
3484
3626
|
*/
|
|
3485
3627
|
async initialize(containerElement, options) {
|
|
3486
3628
|
const elements = this.stripeService.getElements();
|
|
3487
|
-
if (
|
|
3629
|
+
if (elements == null) {
|
|
3488
3630
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3489
3631
|
}
|
|
3490
3632
|
// Unmount if already initialized
|
|
3491
|
-
if (this.linkAuthenticationElement) {
|
|
3633
|
+
if (this.linkAuthenticationElement != null) {
|
|
3492
3634
|
this.unmount();
|
|
3493
3635
|
}
|
|
3494
3636
|
// Create link authentication element
|
|
@@ -3527,7 +3669,7 @@ class LinkAuthenticationElementManager {
|
|
|
3527
3669
|
* Unmount link authentication element
|
|
3528
3670
|
*/
|
|
3529
3671
|
unmount() {
|
|
3530
|
-
if (
|
|
3672
|
+
if (this.linkAuthenticationElement == null) {
|
|
3531
3673
|
return;
|
|
3532
3674
|
}
|
|
3533
3675
|
this.linkAuthenticationElement.unmount();
|
|
@@ -3567,11 +3709,11 @@ class CurrencySelectorElementManager {
|
|
|
3567
3709
|
*/
|
|
3568
3710
|
async initialize(containerElement, options) {
|
|
3569
3711
|
const elements = this.stripeService.getElements();
|
|
3570
|
-
if (
|
|
3712
|
+
if (elements == null) {
|
|
3571
3713
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3572
3714
|
}
|
|
3573
3715
|
// Unmount if already initialized
|
|
3574
|
-
if (this.currencySelectorElement) {
|
|
3716
|
+
if (this.currencySelectorElement != null) {
|
|
3575
3717
|
this.unmount();
|
|
3576
3718
|
}
|
|
3577
3719
|
// Find mount point first to avoid element leak if findElement throws
|
|
@@ -3617,7 +3759,7 @@ class CurrencySelectorElementManager {
|
|
|
3617
3759
|
* Unmount currency selector element
|
|
3618
3760
|
*/
|
|
3619
3761
|
unmount() {
|
|
3620
|
-
if (
|
|
3762
|
+
if (this.currencySelectorElement == null) {
|
|
3621
3763
|
return;
|
|
3622
3764
|
}
|
|
3623
3765
|
this.currencySelectorElement.unmount();
|
|
@@ -3657,11 +3799,11 @@ class ExpressCheckoutElementManager {
|
|
|
3657
3799
|
*/
|
|
3658
3800
|
async initialize(containerElement, options, eventHandlers) {
|
|
3659
3801
|
const elements = this.stripeService.getElements();
|
|
3660
|
-
if (
|
|
3802
|
+
if (elements == null) {
|
|
3661
3803
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3662
3804
|
}
|
|
3663
3805
|
// Unmount if already initialized
|
|
3664
|
-
if (this.expressCheckoutElement) {
|
|
3806
|
+
if (this.expressCheckoutElement != null) {
|
|
3665
3807
|
this.unmount();
|
|
3666
3808
|
}
|
|
3667
3809
|
// Convert buttonHeight from string to number if present
|
|
@@ -3679,19 +3821,19 @@ class ExpressCheckoutElementManager {
|
|
|
3679
3821
|
// Find the mount point
|
|
3680
3822
|
const mountPoint = await findElement(containerElement, '#express-checkout-element');
|
|
3681
3823
|
// Set up event handlers before mounting
|
|
3682
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onConfirm) {
|
|
3824
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onConfirm) != null) {
|
|
3683
3825
|
expressCheckout.on('confirm', eventHandlers.onConfirm);
|
|
3684
3826
|
}
|
|
3685
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick) {
|
|
3827
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick) != null) {
|
|
3686
3828
|
expressCheckout.on('click', eventHandlers.onClick);
|
|
3687
3829
|
}
|
|
3688
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onCancel) {
|
|
3830
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onCancel) != null) {
|
|
3689
3831
|
expressCheckout.on('cancel', eventHandlers.onCancel);
|
|
3690
3832
|
}
|
|
3691
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingAddressChange) {
|
|
3833
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingAddressChange) != null) {
|
|
3692
3834
|
expressCheckout.on('shippingaddresschange', eventHandlers.onShippingAddressChange);
|
|
3693
3835
|
}
|
|
3694
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingRateChange) {
|
|
3836
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingRateChange) != null) {
|
|
3695
3837
|
expressCheckout.on('shippingratechange', eventHandlers.onShippingRateChange);
|
|
3696
3838
|
}
|
|
3697
3839
|
// Add ready event handler
|
|
@@ -3714,7 +3856,7 @@ class ExpressCheckoutElementManager {
|
|
|
3714
3856
|
* @param options - Partial options to update
|
|
3715
3857
|
*/
|
|
3716
3858
|
update(options) {
|
|
3717
|
-
if (
|
|
3859
|
+
if (this.expressCheckoutElement == null) {
|
|
3718
3860
|
console.warn('Express Checkout Element not initialized. Cannot update options.');
|
|
3719
3861
|
return;
|
|
3720
3862
|
}
|
|
@@ -3745,7 +3887,7 @@ class ExpressCheckoutElementManager {
|
|
|
3745
3887
|
* Unmount express checkout element
|
|
3746
3888
|
*/
|
|
3747
3889
|
unmount() {
|
|
3748
|
-
if (
|
|
3890
|
+
if (this.expressCheckoutElement == null) {
|
|
3749
3891
|
return;
|
|
3750
3892
|
}
|
|
3751
3893
|
this.expressCheckoutElement.unmount();
|
|
@@ -3816,6 +3958,3 @@ class ServiceFactory {
|
|
|
3816
3958
|
const serviceFactory = new ServiceFactory();
|
|
3817
3959
|
|
|
3818
3960
|
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
|