@sunbay/checkout-sdk-js 0.1.0 → 0.1.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/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -2
- package/dist/index.d.ts +23 -2
- package/dist/index.global.js +11 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +11 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -463,6 +463,7 @@ var CheckoutElement = class _CheckoutElement {
|
|
|
463
463
|
this.options = opts.initialOptions;
|
|
464
464
|
this.colorScheme = opts.colorScheme;
|
|
465
465
|
this.appearance = opts.appearance;
|
|
466
|
+
this.locale = opts.locale;
|
|
466
467
|
this.mode = opts.initialOptions?.mode;
|
|
467
468
|
this.onDestroy = opts.onDestroy;
|
|
468
469
|
this.installInputActions();
|
|
@@ -840,7 +841,8 @@ var CheckoutElement = class _CheckoutElement {
|
|
|
840
841
|
* (no flash on the first frame); if the initial appearance contains variables or rules, append
|
|
841
842
|
* `&appearance=<encodeURIComponent(JSON.stringify(appearance))>` (takes effect on the first
|
|
842
843
|
* frame, no flash). An appearance containing only colorScheme (no variables/rules) is not
|
|
843
|
-
* appended, to avoid an empty appearance string.
|
|
844
|
+
* appended, to avoid an empty appearance string. If an initial locale is provided, append
|
|
845
|
+
* `&locale=<value>` (first frame renders in that language). For expressCheckout, additionally append the
|
|
844
846
|
* wallet toggles / per-wallet buttonType / global buttonHeight (see {@link resolveExpressQuery}).
|
|
845
847
|
*
|
|
846
848
|
* elementId is sent with the src so the hosted child echoes it verbatim in iframe-resize
|
|
@@ -863,6 +865,9 @@ var CheckoutElement = class _CheckoutElement {
|
|
|
863
865
|
if (this.colorScheme) {
|
|
864
866
|
query += `&colorScheme=${encodeURIComponent(this.colorScheme)}`;
|
|
865
867
|
}
|
|
868
|
+
if (this.locale) {
|
|
869
|
+
query += `&locale=${encodeURIComponent(this.locale)}`;
|
|
870
|
+
}
|
|
866
871
|
const effectiveAppearance = this.perElementAppearance() ?? this.appearance;
|
|
867
872
|
if (effectiveAppearance && (effectiveAppearance.variables || effectiveAppearance.rules)) {
|
|
868
873
|
query += `&appearance=${encodeURIComponent(JSON.stringify(effectiveAppearance))}`;
|
|
@@ -1016,6 +1021,7 @@ var CheckoutInstance = class {
|
|
|
1016
1021
|
this.transport = opts.transport;
|
|
1017
1022
|
this.session = opts.session;
|
|
1018
1023
|
this.appearance = opts.appearance;
|
|
1024
|
+
this.locale = opts.locale;
|
|
1019
1025
|
this.paymentResultHandler = (payload) => {
|
|
1020
1026
|
this.handlePaymentResult(payload);
|
|
1021
1027
|
};
|
|
@@ -1047,6 +1053,7 @@ var CheckoutInstance = class {
|
|
|
1047
1053
|
initialOptions: options,
|
|
1048
1054
|
colorScheme: this.appearance?.colorScheme,
|
|
1049
1055
|
appearance: this.appearance,
|
|
1056
|
+
locale: this.locale,
|
|
1050
1057
|
onDestroy: (id) => this.releaseElement(id)
|
|
1051
1058
|
};
|
|
1052
1059
|
const element = CheckoutElement.create(elementOpts);
|
|
@@ -1432,7 +1439,8 @@ async function createCheckout(opts) {
|
|
|
1432
1439
|
capabilities: initResp.capabilities,
|
|
1433
1440
|
session: initResp.session,
|
|
1434
1441
|
initialWarnings: initResp.warnings,
|
|
1435
|
-
appearance: opts.appearance
|
|
1442
|
+
appearance: opts.appearance,
|
|
1443
|
+
locale: opts.locale
|
|
1436
1444
|
});
|
|
1437
1445
|
}
|
|
1438
1446
|
function waitForHello(transport) {
|
|
@@ -1462,7 +1470,7 @@ if (typeof window !== "undefined") {
|
|
|
1462
1470
|
const w = window;
|
|
1463
1471
|
w.SunbayCheckout = { ...w.SunbayCheckout ?? {}, createCheckout };
|
|
1464
1472
|
}
|
|
1465
|
-
var version = true ? "0.1.
|
|
1473
|
+
var version = true ? "0.1.1" : "0.0.0";
|
|
1466
1474
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1467
1475
|
0 && (module.exports = {
|
|
1468
1476
|
CheckoutElement,
|