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,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var index$1 = require('./index-
|
|
3
|
+
var index = require('./index-Dkb0SxZc.js');
|
|
4
|
+
var index$1 = require('./index-CYbA1N_k.js');
|
|
5
5
|
|
|
6
6
|
const getPlatforms = (win) => setupPlatforms(win);
|
|
7
7
|
const setupPlatforms = (win = window) => {
|
|
@@ -278,7 +278,7 @@ const deepFind = (obj, path, keySeparator = '.') => {
|
|
|
278
278
|
}
|
|
279
279
|
return current;
|
|
280
280
|
};
|
|
281
|
-
const getCleanedCode = code => code?.replace(
|
|
281
|
+
const getCleanedCode = code => code?.replace(/_/g, '-');
|
|
282
282
|
|
|
283
283
|
const consoleLogger = {
|
|
284
284
|
type: 'logger',
|
|
@@ -539,7 +539,16 @@ function keysFromSelector(selector, opts) {
|
|
|
539
539
|
const {
|
|
540
540
|
[PATH_KEY]: path
|
|
541
541
|
} = selector(createProxy());
|
|
542
|
-
|
|
542
|
+
const keySeparator = opts?.keySeparator ?? '.';
|
|
543
|
+
const nsSeparator = opts?.nsSeparator ?? ':';
|
|
544
|
+
if (path.length > 1 && nsSeparator) {
|
|
545
|
+
const ns = opts?.ns;
|
|
546
|
+
const nsArray = Array.isArray(ns) ? ns : null;
|
|
547
|
+
if (nsArray && nsArray.length > 1 && nsArray.slice(1).includes(path[0])) {
|
|
548
|
+
return `${path[0]}${nsSeparator}${path.slice(1).join(keySeparator)}`;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return path.join(keySeparator);
|
|
543
552
|
}
|
|
544
553
|
|
|
545
554
|
const checkedLoadedFor = {};
|
|
@@ -613,6 +622,10 @@ class Translator extends EventEmitter {
|
|
|
613
622
|
...opt
|
|
614
623
|
});
|
|
615
624
|
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
625
|
+
keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
|
|
626
|
+
...this.options,
|
|
627
|
+
...opt
|
|
628
|
+
}) : String(k));
|
|
616
629
|
const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
|
|
617
630
|
const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
|
|
618
631
|
const {
|
|
@@ -859,6 +872,10 @@ class Translator extends EventEmitter {
|
|
|
859
872
|
let usedLng;
|
|
860
873
|
let usedNS;
|
|
861
874
|
if (isString(keys)) keys = [keys];
|
|
875
|
+
if (Array.isArray(keys)) keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
|
|
876
|
+
...this.options,
|
|
877
|
+
...opt
|
|
878
|
+
}) : k);
|
|
862
879
|
keys.forEach(k => {
|
|
863
880
|
if (this.isValidLookup(found)) return;
|
|
864
881
|
const extracted = this.extractFromKey(k, opt);
|
|
@@ -1099,9 +1116,6 @@ class PluralResolver {
|
|
|
1099
1116
|
this.logger = baseLogger.create('pluralResolver');
|
|
1100
1117
|
this.pluralRulesCache = {};
|
|
1101
1118
|
}
|
|
1102
|
-
addRule(lng, obj) {
|
|
1103
|
-
this.rules[lng] = obj;
|
|
1104
|
-
}
|
|
1105
1119
|
clearCache() {
|
|
1106
1120
|
this.pluralRulesCache = {};
|
|
1107
1121
|
}
|
|
@@ -1121,7 +1135,7 @@ class PluralResolver {
|
|
|
1121
1135
|
type
|
|
1122
1136
|
});
|
|
1123
1137
|
} catch (err) {
|
|
1124
|
-
if (
|
|
1138
|
+
if (typeof Intl === 'undefined') {
|
|
1125
1139
|
this.logger.error('No Intl support, please use an Intl polyfill!');
|
|
1126
1140
|
return dummyRule;
|
|
1127
1141
|
}
|
|
@@ -1302,13 +1316,13 @@ class Interpolator {
|
|
|
1302
1316
|
const handleHasOptions = (key, inheritedOptions) => {
|
|
1303
1317
|
const sep = this.nestingOptionsSeparator;
|
|
1304
1318
|
if (key.indexOf(sep) < 0) return key;
|
|
1305
|
-
const c = key.split(new RegExp(`${sep}[ ]*{`));
|
|
1319
|
+
const c = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
|
|
1306
1320
|
let optionsString = `{${c[1]}`;
|
|
1307
1321
|
key = c[0];
|
|
1308
1322
|
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
1309
1323
|
const matchedSingleQuotes = optionsString.match(/'/g);
|
|
1310
1324
|
const matchedDoubleQuotes = optionsString.match(/"/g);
|
|
1311
|
-
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes
|
|
1325
|
+
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || (matchedDoubleQuotes?.length ?? 0) % 2 !== 0) {
|
|
1312
1326
|
optionsString = optionsString.replace(/'/g, '"');
|
|
1313
1327
|
}
|
|
1314
1328
|
try {
|
|
@@ -1790,6 +1804,28 @@ const bindMemberFunctions = inst => {
|
|
|
1790
1804
|
}
|
|
1791
1805
|
});
|
|
1792
1806
|
};
|
|
1807
|
+
const SUPPORT_NOTICE_KEY = '__i18next_supportNoticeShown';
|
|
1808
|
+
const getSupportNoticeShown = () => {
|
|
1809
|
+
if (typeof globalThis !== 'undefined' && !!globalThis[SUPPORT_NOTICE_KEY]) return true;
|
|
1810
|
+
if (typeof process !== 'undefined' && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE) return true;
|
|
1811
|
+
if (typeof process !== 'undefined' && process.env && "production" === 'production') return true;
|
|
1812
|
+
return false;
|
|
1813
|
+
};
|
|
1814
|
+
const setSupportNoticeShown = () => {
|
|
1815
|
+
if (typeof globalThis !== 'undefined') globalThis[SUPPORT_NOTICE_KEY] = true;
|
|
1816
|
+
};
|
|
1817
|
+
const usesLocize = inst => {
|
|
1818
|
+
if (inst?.modules?.backend?.name?.indexOf('Locize') > 0) return true;
|
|
1819
|
+
if (inst?.modules?.backend?.constructor?.name?.indexOf('Locize') > 0) return true;
|
|
1820
|
+
if (inst?.options?.backend?.backends) {
|
|
1821
|
+
if (inst.options.backend.backends.some(b => b?.name?.indexOf('Locize') > 0 || b?.constructor?.name?.indexOf('Locize') > 0)) return true;
|
|
1822
|
+
}
|
|
1823
|
+
if (inst?.options?.backend?.projectId) return true;
|
|
1824
|
+
if (inst?.options?.backend?.backendOptions) {
|
|
1825
|
+
if (inst.options.backend.backendOptions.some(b => b?.projectId)) return true;
|
|
1826
|
+
}
|
|
1827
|
+
return false;
|
|
1828
|
+
};
|
|
1793
1829
|
class I18n extends EventEmitter {
|
|
1794
1830
|
constructor(options = {}, callback) {
|
|
1795
1831
|
super();
|
|
@@ -1839,6 +1875,13 @@ class I18n extends EventEmitter {
|
|
|
1839
1875
|
if (options.nsSeparator !== undefined) {
|
|
1840
1876
|
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
1841
1877
|
}
|
|
1878
|
+
if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
|
|
1879
|
+
this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
1880
|
+
}
|
|
1881
|
+
if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
|
|
1882
|
+
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 💙');
|
|
1883
|
+
setSupportNoticeShown();
|
|
1884
|
+
}
|
|
1842
1885
|
const createClassOnDemand = ClassOrObject => {
|
|
1843
1886
|
if (!ClassOrObject) return null;
|
|
1844
1887
|
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
@@ -2099,21 +2142,20 @@ class I18n extends EventEmitter {
|
|
|
2099
2142
|
o.lngs = o.lngs || fixedT.lngs;
|
|
2100
2143
|
o.ns = o.ns || fixedT.ns;
|
|
2101
2144
|
if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
2145
|
+
const selectorOpts = {
|
|
2146
|
+
...this.options,
|
|
2147
|
+
...o
|
|
2148
|
+
};
|
|
2149
|
+
if (typeof o.keyPrefix === 'function') o.keyPrefix = keysFromSelector(o.keyPrefix, selectorOpts);
|
|
2102
2150
|
const keySeparator = this.options.keySeparator || '.';
|
|
2103
2151
|
let resultKey;
|
|
2104
2152
|
if (o.keyPrefix && Array.isArray(key)) {
|
|
2105
2153
|
resultKey = key.map(k => {
|
|
2106
|
-
if (typeof k === 'function') k = keysFromSelector(k,
|
|
2107
|
-
...this.options,
|
|
2108
|
-
...opts
|
|
2109
|
-
});
|
|
2154
|
+
if (typeof k === 'function') k = keysFromSelector(k, selectorOpts);
|
|
2110
2155
|
return `${o.keyPrefix}${keySeparator}${k}`;
|
|
2111
2156
|
});
|
|
2112
2157
|
} else {
|
|
2113
|
-
if (typeof key === 'function') key = keysFromSelector(key,
|
|
2114
|
-
...this.options,
|
|
2115
|
-
...opts
|
|
2116
|
-
});
|
|
2158
|
+
if (typeof key === 'function') key = keysFromSelector(key, selectorOpts);
|
|
2117
2159
|
resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
|
|
2118
2160
|
}
|
|
2119
2161
|
return this.t(resultKey, o);
|
|
@@ -2254,6 +2296,19 @@ class I18n extends EventEmitter {
|
|
|
2254
2296
|
clone.store = new ResourceStore(clonedData, mergedOptions);
|
|
2255
2297
|
clone.services.resourceStore = clone.store;
|
|
2256
2298
|
}
|
|
2299
|
+
if (options.interpolation) {
|
|
2300
|
+
const defOpts = get();
|
|
2301
|
+
const mergedInterpolation = {
|
|
2302
|
+
...defOpts.interpolation,
|
|
2303
|
+
...this.options.interpolation,
|
|
2304
|
+
...options.interpolation
|
|
2305
|
+
};
|
|
2306
|
+
const mergedForInterpolator = {
|
|
2307
|
+
...mergedOptions,
|
|
2308
|
+
interpolation: mergedInterpolation
|
|
2309
|
+
};
|
|
2310
|
+
clone.services.interpolator = new Interpolator(mergedForInterpolator);
|
|
2311
|
+
}
|
|
2257
2312
|
clone.translator = new Translator(clone.services, mergedOptions);
|
|
2258
2313
|
clone.translator.on('*', (event, ...args) => {
|
|
2259
2314
|
clone.emit(event, ...args);
|
|
@@ -2760,12 +2815,13 @@ instance.use(Browser).init({
|
|
|
2760
2815
|
const i18n = instance;
|
|
2761
2816
|
|
|
2762
2817
|
const appendToMap = (map, propName, value) => {
|
|
2763
|
-
|
|
2764
|
-
if (!
|
|
2765
|
-
|
|
2818
|
+
let refs = map.get(propName);
|
|
2819
|
+
if (!refs) {
|
|
2820
|
+
refs = [];
|
|
2821
|
+
map.set(propName, refs);
|
|
2766
2822
|
}
|
|
2767
|
-
|
|
2768
|
-
|
|
2823
|
+
if (!refs.some((ref) => ref.deref() === value)) {
|
|
2824
|
+
refs.push(new WeakRef(value));
|
|
2769
2825
|
}
|
|
2770
2826
|
};
|
|
2771
2827
|
const debounce = (fn, ms) => {
|
|
@@ -2793,33 +2849,54 @@ const debounce = (fn, ms) => {
|
|
|
2793
2849
|
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
2794
2850
|
const cleanupElements = debounce((map) => {
|
|
2795
2851
|
for (let key of map.keys()) {
|
|
2796
|
-
|
|
2852
|
+
const refs = map.get(key).filter((ref) => {
|
|
2853
|
+
const elm = ref.deref();
|
|
2854
|
+
return elm && isConnected(elm);
|
|
2855
|
+
});
|
|
2856
|
+
map.set(key, refs);
|
|
2797
2857
|
}
|
|
2798
2858
|
}, 2_000);
|
|
2859
|
+
const core = index.StencilCore;
|
|
2860
|
+
const forceUpdate = core.forceUpdate;
|
|
2861
|
+
const getRenderingRef = core.getRenderingRef;
|
|
2799
2862
|
const stencilSubscription = () => {
|
|
2800
|
-
if (typeof
|
|
2863
|
+
if (typeof getRenderingRef !== 'function' || typeof forceUpdate !== 'function') {
|
|
2801
2864
|
// If we are not in a stencil project, we do nothing.
|
|
2802
2865
|
// This function is not really exported by @stencil/core.
|
|
2803
2866
|
return {};
|
|
2804
2867
|
}
|
|
2868
|
+
const ensureForceUpdate = forceUpdate;
|
|
2869
|
+
const ensureGetRenderingRef = getRenderingRef;
|
|
2805
2870
|
const elmsToUpdate = new Map();
|
|
2806
2871
|
return {
|
|
2807
2872
|
dispose: () => elmsToUpdate.clear(),
|
|
2808
2873
|
get: (propName) => {
|
|
2809
|
-
const elm =
|
|
2874
|
+
const elm = ensureGetRenderingRef();
|
|
2810
2875
|
if (elm) {
|
|
2811
2876
|
appendToMap(elmsToUpdate, propName, elm);
|
|
2812
2877
|
}
|
|
2813
2878
|
},
|
|
2814
2879
|
set: (propName) => {
|
|
2815
|
-
const
|
|
2816
|
-
if (
|
|
2817
|
-
|
|
2880
|
+
const refs = elmsToUpdate.get(propName);
|
|
2881
|
+
if (refs) {
|
|
2882
|
+
const nextRefs = refs.filter((ref) => {
|
|
2883
|
+
const elm = ref.deref();
|
|
2884
|
+
if (!elm)
|
|
2885
|
+
return false;
|
|
2886
|
+
return ensureForceUpdate(elm);
|
|
2887
|
+
});
|
|
2888
|
+
elmsToUpdate.set(propName, nextRefs);
|
|
2818
2889
|
}
|
|
2819
2890
|
cleanupElements(elmsToUpdate);
|
|
2820
2891
|
},
|
|
2821
2892
|
reset: () => {
|
|
2822
|
-
elmsToUpdate.forEach((
|
|
2893
|
+
elmsToUpdate.forEach((refs) => {
|
|
2894
|
+
refs.forEach((ref) => {
|
|
2895
|
+
const elm = ref.deref();
|
|
2896
|
+
if (elm)
|
|
2897
|
+
ensureForceUpdate(elm);
|
|
2898
|
+
});
|
|
2899
|
+
});
|
|
2823
2900
|
cleanupElements(elmsToUpdate);
|
|
2824
2901
|
},
|
|
2825
2902
|
};
|
|
@@ -2827,8 +2904,11 @@ const stencilSubscription = () => {
|
|
|
2827
2904
|
|
|
2828
2905
|
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
2829
2906
|
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
2830
|
-
const
|
|
2831
|
-
|
|
2907
|
+
const resolveDefaultState = () => (unwrap(defaultState) ?? {});
|
|
2908
|
+
const initialState = resolveDefaultState();
|
|
2909
|
+
let states = new Map(Object.entries(initialState));
|
|
2910
|
+
const proxyAvailable = typeof Proxy !== 'undefined';
|
|
2911
|
+
const plainState = proxyAvailable ? null : {};
|
|
2832
2912
|
const handlers = {
|
|
2833
2913
|
dispose: [],
|
|
2834
2914
|
get: [],
|
|
@@ -2840,7 +2920,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2840
2920
|
const reset = () => {
|
|
2841
2921
|
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
2842
2922
|
// otherwise, the state won't be properly reset
|
|
2843
|
-
states = new Map(Object.entries(
|
|
2923
|
+
states = new Map(Object.entries(resolveDefaultState()));
|
|
2924
|
+
if (!proxyAvailable) {
|
|
2925
|
+
syncPlainStateKeys();
|
|
2926
|
+
}
|
|
2844
2927
|
handlers.reset.forEach((cb) => cb());
|
|
2845
2928
|
};
|
|
2846
2929
|
const dispose = () => {
|
|
@@ -2857,12 +2940,14 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2857
2940
|
const oldValue = states.get(propName);
|
|
2858
2941
|
if (shouldUpdate(value, oldValue, propName)) {
|
|
2859
2942
|
states.set(propName, value);
|
|
2943
|
+
if (!proxyAvailable) {
|
|
2944
|
+
ensurePlainProperty(propName);
|
|
2945
|
+
}
|
|
2860
2946
|
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
2861
2947
|
}
|
|
2862
2948
|
};
|
|
2863
|
-
const state = (
|
|
2864
|
-
? {
|
|
2865
|
-
: new Proxy(unwrappedState, {
|
|
2949
|
+
const state = (proxyAvailable
|
|
2950
|
+
? new Proxy(initialState, {
|
|
2866
2951
|
get(_, propName) {
|
|
2867
2952
|
return get(propName);
|
|
2868
2953
|
},
|
|
@@ -2882,7 +2967,11 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2882
2967
|
set(propName, value);
|
|
2883
2968
|
return true;
|
|
2884
2969
|
},
|
|
2885
|
-
})
|
|
2970
|
+
})
|
|
2971
|
+
: (() => {
|
|
2972
|
+
syncPlainStateKeys();
|
|
2973
|
+
return plainState;
|
|
2974
|
+
})());
|
|
2886
2975
|
const on = (eventName, callback) => {
|
|
2887
2976
|
handlers[eventName].push(callback);
|
|
2888
2977
|
return () => {
|
|
@@ -2895,7 +2984,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2895
2984
|
cb(newValue);
|
|
2896
2985
|
}
|
|
2897
2986
|
};
|
|
2898
|
-
const resetHandler = () =>
|
|
2987
|
+
const resetHandler = () => {
|
|
2988
|
+
const snapshot = resolveDefaultState();
|
|
2989
|
+
cb(snapshot[propName]);
|
|
2990
|
+
};
|
|
2899
2991
|
// Register the handlers
|
|
2900
2992
|
const unSet = on('set', setHandler);
|
|
2901
2993
|
const unReset = on('reset', resetHandler);
|
|
@@ -2938,6 +3030,38 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2938
3030
|
changeListeners.delete(listener);
|
|
2939
3031
|
}
|
|
2940
3032
|
};
|
|
3033
|
+
function ensurePlainProperty(key) {
|
|
3034
|
+
if (proxyAvailable || !plainState) {
|
|
3035
|
+
return;
|
|
3036
|
+
}
|
|
3037
|
+
if (Object.prototype.hasOwnProperty.call(plainState, key)) {
|
|
3038
|
+
return;
|
|
3039
|
+
}
|
|
3040
|
+
Object.defineProperty(plainState, key, {
|
|
3041
|
+
configurable: true,
|
|
3042
|
+
enumerable: true,
|
|
3043
|
+
get() {
|
|
3044
|
+
return get(key);
|
|
3045
|
+
},
|
|
3046
|
+
set(value) {
|
|
3047
|
+
set(key, value);
|
|
3048
|
+
},
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
function syncPlainStateKeys() {
|
|
3052
|
+
if (proxyAvailable || !plainState) {
|
|
3053
|
+
return;
|
|
3054
|
+
}
|
|
3055
|
+
const knownKeys = new Set(states.keys());
|
|
3056
|
+
for (const key of Object.keys(plainState)) {
|
|
3057
|
+
if (!knownKeys.has(key)) {
|
|
3058
|
+
delete plainState[key];
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
for (const key of knownKeys) {
|
|
3062
|
+
ensurePlainProperty(key);
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
2941
3065
|
return {
|
|
2942
3066
|
state,
|
|
2943
3067
|
get,
|
|
@@ -2977,6 +3101,8 @@ class StripeServiceClass {
|
|
|
2977
3101
|
applicationName: 'stripe-pwa-elements',
|
|
2978
3102
|
isCheckoutSession: false,
|
|
2979
3103
|
});
|
|
3104
|
+
/** Incremented on every init so that a slower, older call cannot overwrite newer state */
|
|
3105
|
+
this.initGeneration = 0;
|
|
2980
3106
|
this.changeListeners = new Map();
|
|
2981
3107
|
}
|
|
2982
3108
|
/**
|
|
@@ -3004,20 +3130,28 @@ class StripeServiceClass {
|
|
|
3004
3130
|
/**
|
|
3005
3131
|
* Initialize Stripe.js client with Payment Intent mode
|
|
3006
3132
|
* @param publishableKey - Your Stripe publishable API key
|
|
3007
|
-
* @param options - Optional configuration
|
|
3133
|
+
* @param options - Optional configuration (`clientSecret` is the PaymentIntent / SetupIntent client secret)
|
|
3008
3134
|
*/
|
|
3009
3135
|
async initialize(publishableKey, options) {
|
|
3136
|
+
const generation = ++this.initGeneration;
|
|
3137
|
+
// Capture the previous config before overwriting it, so we can detect real changes
|
|
3138
|
+
const isUpToDate = this.store.state.stripe != null &&
|
|
3139
|
+
!this.store.state.isCheckoutSession &&
|
|
3140
|
+
this.store.state.publishableKey === publishableKey &&
|
|
3141
|
+
this.store.state.stripeAccount === (options === null || options === void 0 ? void 0 : options.stripeAccount) &&
|
|
3142
|
+
this.intentClientSecret === (options === null || options === void 0 ? void 0 : options.clientSecret);
|
|
3010
3143
|
// Update configuration
|
|
3011
3144
|
this.store.state.publishableKey = publishableKey;
|
|
3012
3145
|
this.store.state.isCheckoutSession = false;
|
|
3013
|
-
|
|
3146
|
+
this.intentClientSecret = options === null || options === void 0 ? void 0 : options.clientSecret;
|
|
3147
|
+
if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
|
|
3014
3148
|
this.store.state.stripeAccount = options.stripeAccount;
|
|
3015
3149
|
}
|
|
3016
|
-
if (options === null || options === void 0 ? void 0 : options.applicationName) {
|
|
3150
|
+
if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
|
|
3017
3151
|
this.store.state.applicationName = options.applicationName;
|
|
3018
3152
|
}
|
|
3019
3153
|
// If Stripe.js already loaded with same config, do nothing
|
|
3020
|
-
if (
|
|
3154
|
+
if (isUpToDate) {
|
|
3021
3155
|
return;
|
|
3022
3156
|
}
|
|
3023
3157
|
this.store.state.loadStripeStatus = 'loading';
|
|
@@ -3025,12 +3159,16 @@ class StripeServiceClass {
|
|
|
3025
3159
|
const stripe = await index$1.loadStripe(publishableKey, {
|
|
3026
3160
|
stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
|
|
3027
3161
|
});
|
|
3162
|
+
if (generation !== this.initGeneration) {
|
|
3163
|
+
return;
|
|
3164
|
+
}
|
|
3028
3165
|
// Register app info
|
|
3029
3166
|
stripe.registerAppInfo({
|
|
3030
3167
|
name: this.store.state.applicationName,
|
|
3031
3168
|
});
|
|
3032
3169
|
this.store.state.stripe = stripe;
|
|
3033
|
-
|
|
3170
|
+
// Payment Element requires the client secret at Elements creation time
|
|
3171
|
+
this.store.state.elements = (options === null || options === void 0 ? void 0 : options.clientSecret) != null && options.clientSecret !== '' ? stripe.elements({ clientSecret: options.clientSecret }) : stripe.elements();
|
|
3034
3172
|
this.store.state.checkout = undefined;
|
|
3035
3173
|
this.store.state.loadStripeStatus = 'success';
|
|
3036
3174
|
}
|
|
@@ -3043,16 +3181,17 @@ class StripeServiceClass {
|
|
|
3043
3181
|
* Initialize Stripe.js client with Checkout Session mode
|
|
3044
3182
|
* @param publishableKey - Your Stripe publishable API key
|
|
3045
3183
|
* @param checkoutSessionClientSecret - The client secret from Checkout Session
|
|
3046
|
-
* @param options - Optional configuration
|
|
3184
|
+
* @param options - Optional configuration (`clientSecret` is the PaymentIntent / SetupIntent client secret)
|
|
3047
3185
|
*/
|
|
3048
3186
|
async initializeWithCheckoutSession(publishableKey, checkoutSessionClientSecret, options) {
|
|
3187
|
+
const generation = ++this.initGeneration;
|
|
3049
3188
|
// Update configuration
|
|
3050
3189
|
this.store.state.publishableKey = publishableKey;
|
|
3051
3190
|
this.store.state.isCheckoutSession = true;
|
|
3052
|
-
if (options === null || options === void 0 ? void 0 : options.stripeAccount) {
|
|
3191
|
+
if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
|
|
3053
3192
|
this.store.state.stripeAccount = options.stripeAccount;
|
|
3054
3193
|
}
|
|
3055
|
-
if (options === null || options === void 0 ? void 0 : options.applicationName) {
|
|
3194
|
+
if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
|
|
3056
3195
|
this.store.state.applicationName = options.applicationName;
|
|
3057
3196
|
}
|
|
3058
3197
|
this.store.state.loadStripeStatus = 'loading';
|
|
@@ -3060,13 +3199,16 @@ class StripeServiceClass {
|
|
|
3060
3199
|
const stripe = await index$1.loadStripe(publishableKey, {
|
|
3061
3200
|
stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
|
|
3062
3201
|
});
|
|
3202
|
+
if (generation !== this.initGeneration) {
|
|
3203
|
+
return;
|
|
3204
|
+
}
|
|
3063
3205
|
// Register app info
|
|
3064
3206
|
stripe.registerAppInfo({
|
|
3065
3207
|
name: this.store.state.applicationName,
|
|
3066
3208
|
});
|
|
3067
3209
|
this.store.state.stripe = stripe;
|
|
3068
3210
|
// Initialize Checkout instance instead of Elements
|
|
3069
|
-
const checkout = stripe.
|
|
3211
|
+
const checkout = stripe.initCheckoutElementsSdk({
|
|
3070
3212
|
clientSecret: checkoutSessionClientSecret,
|
|
3071
3213
|
elementsOptions: options === null || options === void 0 ? void 0 : options.elementsOptions,
|
|
3072
3214
|
});
|
|
@@ -3136,7 +3278,7 @@ new StripeServiceClass();
|
|
|
3136
3278
|
function findElement(containerElement, selector, timeout = 5000) {
|
|
3137
3279
|
return new Promise((resolve, reject) => {
|
|
3138
3280
|
const elem = containerElement.querySelector(selector);
|
|
3139
|
-
if (elem) {
|
|
3281
|
+
if (elem != null) {
|
|
3140
3282
|
return resolve(elem);
|
|
3141
3283
|
}
|
|
3142
3284
|
const timeoutId = setTimeout(() => {
|
|
@@ -3145,7 +3287,7 @@ function findElement(containerElement, selector, timeout = 5000) {
|
|
|
3145
3287
|
}, timeout);
|
|
3146
3288
|
const observer = new MutationObserver(() => {
|
|
3147
3289
|
const elem = containerElement.querySelector(selector);
|
|
3148
|
-
if (elem) {
|
|
3290
|
+
if (elem != null) {
|
|
3149
3291
|
clearTimeout(timeoutId);
|
|
3150
3292
|
observer.disconnect();
|
|
3151
3293
|
resolve(elem);
|
|
@@ -3188,11 +3330,11 @@ class CardElementManager {
|
|
|
3188
3330
|
*/
|
|
3189
3331
|
async initialize(containerElement) {
|
|
3190
3332
|
const elements = this.stripeService.getElements();
|
|
3191
|
-
if (
|
|
3333
|
+
if (elements == null) {
|
|
3192
3334
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3193
3335
|
}
|
|
3194
3336
|
// Unmount if already initialized
|
|
3195
|
-
if (this.cardElements) {
|
|
3337
|
+
if (this.cardElements != null) {
|
|
3196
3338
|
this.unmount();
|
|
3197
3339
|
}
|
|
3198
3340
|
// Create and mount card number element
|
|
@@ -3243,7 +3385,7 @@ class CardElementManager {
|
|
|
3243
3385
|
*/
|
|
3244
3386
|
unmount() {
|
|
3245
3387
|
var _a, _b, _c;
|
|
3246
|
-
if (
|
|
3388
|
+
if (this.cardElements == null) {
|
|
3247
3389
|
return;
|
|
3248
3390
|
}
|
|
3249
3391
|
(_a = this.cardElements.cardNumber) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
@@ -3305,13 +3447,13 @@ class PaymentElementManager {
|
|
|
3305
3447
|
async initialize(containerElement, options) {
|
|
3306
3448
|
const isCheckoutSession = this.stripeService.state.isCheckoutSession;
|
|
3307
3449
|
// Unmount if already initialized
|
|
3308
|
-
if (this.paymentElement) {
|
|
3450
|
+
if (this.paymentElement != null) {
|
|
3309
3451
|
this.unmount();
|
|
3310
3452
|
}
|
|
3311
3453
|
if (isCheckoutSession) {
|
|
3312
3454
|
// Checkout Session mode: use checkout.createPaymentElement()
|
|
3313
3455
|
const checkout = this.stripeService.getCheckout();
|
|
3314
|
-
if (
|
|
3456
|
+
if (checkout == null) {
|
|
3315
3457
|
throw new Error('StripeService not initialized with Checkout Session. Call StripeService.initializeWithCheckoutSession() first.');
|
|
3316
3458
|
}
|
|
3317
3459
|
// Create payment element using Checkout instance
|
|
@@ -3320,7 +3462,7 @@ class PaymentElementManager {
|
|
|
3320
3462
|
else {
|
|
3321
3463
|
// Payment Intent mode: use elements.create('payment')
|
|
3322
3464
|
const elements = this.stripeService.getElements();
|
|
3323
|
-
if (
|
|
3465
|
+
if (elements == null) {
|
|
3324
3466
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3325
3467
|
}
|
|
3326
3468
|
// Create payment element with options
|
|
@@ -3357,7 +3499,7 @@ class PaymentElementManager {
|
|
|
3357
3499
|
* Unmount payment element
|
|
3358
3500
|
*/
|
|
3359
3501
|
unmount() {
|
|
3360
|
-
if (
|
|
3502
|
+
if (this.paymentElement == null) {
|
|
3361
3503
|
return;
|
|
3362
3504
|
}
|
|
3363
3505
|
this.paymentElement.unmount();
|
|
@@ -3396,11 +3538,11 @@ class AddressElementManager {
|
|
|
3396
3538
|
*/
|
|
3397
3539
|
async initialize(containerElement, options) {
|
|
3398
3540
|
const elements = this.stripeService.getElements();
|
|
3399
|
-
if (
|
|
3541
|
+
if (elements == null) {
|
|
3400
3542
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3401
3543
|
}
|
|
3402
3544
|
// Unmount if already initialized
|
|
3403
|
-
if (this.addressElement) {
|
|
3545
|
+
if (this.addressElement != null) {
|
|
3404
3546
|
this.unmount();
|
|
3405
3547
|
}
|
|
3406
3548
|
// Create and mount address element
|
|
@@ -3438,7 +3580,7 @@ class AddressElementManager {
|
|
|
3438
3580
|
* Unmount address element
|
|
3439
3581
|
*/
|
|
3440
3582
|
unmount() {
|
|
3441
|
-
if (
|
|
3583
|
+
if (this.addressElement == null) {
|
|
3442
3584
|
return;
|
|
3443
3585
|
}
|
|
3444
3586
|
this.addressElement.unmount();
|
|
@@ -3486,11 +3628,11 @@ class LinkAuthenticationElementManager {
|
|
|
3486
3628
|
*/
|
|
3487
3629
|
async initialize(containerElement, options) {
|
|
3488
3630
|
const elements = this.stripeService.getElements();
|
|
3489
|
-
if (
|
|
3631
|
+
if (elements == null) {
|
|
3490
3632
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3491
3633
|
}
|
|
3492
3634
|
// Unmount if already initialized
|
|
3493
|
-
if (this.linkAuthenticationElement) {
|
|
3635
|
+
if (this.linkAuthenticationElement != null) {
|
|
3494
3636
|
this.unmount();
|
|
3495
3637
|
}
|
|
3496
3638
|
// Create link authentication element
|
|
@@ -3529,7 +3671,7 @@ class LinkAuthenticationElementManager {
|
|
|
3529
3671
|
* Unmount link authentication element
|
|
3530
3672
|
*/
|
|
3531
3673
|
unmount() {
|
|
3532
|
-
if (
|
|
3674
|
+
if (this.linkAuthenticationElement == null) {
|
|
3533
3675
|
return;
|
|
3534
3676
|
}
|
|
3535
3677
|
this.linkAuthenticationElement.unmount();
|
|
@@ -3569,11 +3711,11 @@ class CurrencySelectorElementManager {
|
|
|
3569
3711
|
*/
|
|
3570
3712
|
async initialize(containerElement, options) {
|
|
3571
3713
|
const elements = this.stripeService.getElements();
|
|
3572
|
-
if (
|
|
3714
|
+
if (elements == null) {
|
|
3573
3715
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3574
3716
|
}
|
|
3575
3717
|
// Unmount if already initialized
|
|
3576
|
-
if (this.currencySelectorElement) {
|
|
3718
|
+
if (this.currencySelectorElement != null) {
|
|
3577
3719
|
this.unmount();
|
|
3578
3720
|
}
|
|
3579
3721
|
// Find mount point first to avoid element leak if findElement throws
|
|
@@ -3619,7 +3761,7 @@ class CurrencySelectorElementManager {
|
|
|
3619
3761
|
* Unmount currency selector element
|
|
3620
3762
|
*/
|
|
3621
3763
|
unmount() {
|
|
3622
|
-
if (
|
|
3764
|
+
if (this.currencySelectorElement == null) {
|
|
3623
3765
|
return;
|
|
3624
3766
|
}
|
|
3625
3767
|
this.currencySelectorElement.unmount();
|
|
@@ -3659,11 +3801,11 @@ class ExpressCheckoutElementManager {
|
|
|
3659
3801
|
*/
|
|
3660
3802
|
async initialize(containerElement, options, eventHandlers) {
|
|
3661
3803
|
const elements = this.stripeService.getElements();
|
|
3662
|
-
if (
|
|
3804
|
+
if (elements == null) {
|
|
3663
3805
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3664
3806
|
}
|
|
3665
3807
|
// Unmount if already initialized
|
|
3666
|
-
if (this.expressCheckoutElement) {
|
|
3808
|
+
if (this.expressCheckoutElement != null) {
|
|
3667
3809
|
this.unmount();
|
|
3668
3810
|
}
|
|
3669
3811
|
// Convert buttonHeight from string to number if present
|
|
@@ -3681,19 +3823,19 @@ class ExpressCheckoutElementManager {
|
|
|
3681
3823
|
// Find the mount point
|
|
3682
3824
|
const mountPoint = await findElement(containerElement, '#express-checkout-element');
|
|
3683
3825
|
// Set up event handlers before mounting
|
|
3684
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onConfirm) {
|
|
3826
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onConfirm) != null) {
|
|
3685
3827
|
expressCheckout.on('confirm', eventHandlers.onConfirm);
|
|
3686
3828
|
}
|
|
3687
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick) {
|
|
3829
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick) != null) {
|
|
3688
3830
|
expressCheckout.on('click', eventHandlers.onClick);
|
|
3689
3831
|
}
|
|
3690
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onCancel) {
|
|
3832
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onCancel) != null) {
|
|
3691
3833
|
expressCheckout.on('cancel', eventHandlers.onCancel);
|
|
3692
3834
|
}
|
|
3693
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingAddressChange) {
|
|
3835
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingAddressChange) != null) {
|
|
3694
3836
|
expressCheckout.on('shippingaddresschange', eventHandlers.onShippingAddressChange);
|
|
3695
3837
|
}
|
|
3696
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingRateChange) {
|
|
3838
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingRateChange) != null) {
|
|
3697
3839
|
expressCheckout.on('shippingratechange', eventHandlers.onShippingRateChange);
|
|
3698
3840
|
}
|
|
3699
3841
|
// Add ready event handler
|
|
@@ -3716,7 +3858,7 @@ class ExpressCheckoutElementManager {
|
|
|
3716
3858
|
* @param options - Partial options to update
|
|
3717
3859
|
*/
|
|
3718
3860
|
update(options) {
|
|
3719
|
-
if (
|
|
3861
|
+
if (this.expressCheckoutElement == null) {
|
|
3720
3862
|
console.warn('Express Checkout Element not initialized. Cannot update options.');
|
|
3721
3863
|
return;
|
|
3722
3864
|
}
|
|
@@ -3747,7 +3889,7 @@ class ExpressCheckoutElementManager {
|
|
|
3747
3889
|
* Unmount express checkout element
|
|
3748
3890
|
*/
|
|
3749
3891
|
unmount() {
|
|
3750
|
-
if (
|
|
3892
|
+
if (this.expressCheckoutElement == null) {
|
|
3751
3893
|
return;
|
|
3752
3894
|
}
|
|
3753
3895
|
this.expressCheckoutElement.unmount();
|
|
@@ -3820,6 +3962,3 @@ const serviceFactory = new ServiceFactory();
|
|
|
3820
3962
|
exports.checkPlatform = checkPlatform;
|
|
3821
3963
|
exports.i18n = i18n;
|
|
3822
3964
|
exports.serviceFactory = serviceFactory;
|
|
3823
|
-
//# sourceMappingURL=factory-CbbbSvkg.js.map
|
|
3824
|
-
|
|
3825
|
-
//# sourceMappingURL=factory-CbbbSvkg.js.map
|