@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.mjs CHANGED
@@ -440,6 +440,7 @@ var CheckoutElement = class _CheckoutElement {
440
440
  this.options = opts.initialOptions;
441
441
  this.colorScheme = opts.colorScheme;
442
442
  this.appearance = opts.appearance;
443
+ this.locale = opts.locale;
443
444
  this.mode = opts.initialOptions?.mode;
444
445
  this.onDestroy = opts.onDestroy;
445
446
  this.installInputActions();
@@ -817,7 +818,8 @@ var CheckoutElement = class _CheckoutElement {
817
818
  * (no flash on the first frame); if the initial appearance contains variables or rules, append
818
819
  * `&appearance=<encodeURIComponent(JSON.stringify(appearance))>` (takes effect on the first
819
820
  * frame, no flash). An appearance containing only colorScheme (no variables/rules) is not
820
- * appended, to avoid an empty appearance string. For expressCheckout, additionally append the
821
+ * appended, to avoid an empty appearance string. If an initial locale is provided, append
822
+ * `&locale=<value>` (first frame renders in that language). For expressCheckout, additionally append the
821
823
  * wallet toggles / per-wallet buttonType / global buttonHeight (see {@link resolveExpressQuery}).
822
824
  *
823
825
  * elementId is sent with the src so the hosted child echoes it verbatim in iframe-resize
@@ -840,6 +842,9 @@ var CheckoutElement = class _CheckoutElement {
840
842
  if (this.colorScheme) {
841
843
  query += `&colorScheme=${encodeURIComponent(this.colorScheme)}`;
842
844
  }
845
+ if (this.locale) {
846
+ query += `&locale=${encodeURIComponent(this.locale)}`;
847
+ }
843
848
  const effectiveAppearance = this.perElementAppearance() ?? this.appearance;
844
849
  if (effectiveAppearance && (effectiveAppearance.variables || effectiveAppearance.rules)) {
845
850
  query += `&appearance=${encodeURIComponent(JSON.stringify(effectiveAppearance))}`;
@@ -995,6 +1000,7 @@ var CheckoutInstance = class {
995
1000
  this.transport = opts.transport;
996
1001
  this.session = opts.session;
997
1002
  this.appearance = opts.appearance;
1003
+ this.locale = opts.locale;
998
1004
  this.paymentResultHandler = (payload) => {
999
1005
  this.handlePaymentResult(payload);
1000
1006
  };
@@ -1026,6 +1032,7 @@ var CheckoutInstance = class {
1026
1032
  initialOptions: options,
1027
1033
  colorScheme: this.appearance?.colorScheme,
1028
1034
  appearance: this.appearance,
1035
+ locale: this.locale,
1029
1036
  onDestroy: (id) => this.releaseElement(id)
1030
1037
  };
1031
1038
  const element = CheckoutElement.create(elementOpts);
@@ -1414,7 +1421,8 @@ async function createCheckout(opts) {
1414
1421
  capabilities: initResp.capabilities,
1415
1422
  session: initResp.session,
1416
1423
  initialWarnings: initResp.warnings,
1417
- appearance: opts.appearance
1424
+ appearance: opts.appearance,
1425
+ locale: opts.locale
1418
1426
  });
1419
1427
  }
1420
1428
  function waitForHello(transport) {
@@ -1447,7 +1455,7 @@ if (typeof window !== "undefined") {
1447
1455
  const w = window;
1448
1456
  w.SunbayCheckout = { ...w.SunbayCheckout ?? {}, createCheckout };
1449
1457
  }
1450
- var version = true ? "0.1.0" : "0.0.0";
1458
+ var version = true ? "0.1.1" : "0.0.0";
1451
1459
  export {
1452
1460
  CheckoutElement,
1453
1461
  CheckoutInstance,