@delopay/sdk 0.122.0 → 0.123.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5214,7 +5214,26 @@ var SURCHARGE_FIGURE_MODES = [
5214
5214
  "amountThenPercent",
5215
5215
  "percentThenAmount"
5216
5216
  ];
5217
- var CHECKOUT_LOCALES = ["en", "de"];
5217
+ var CHECKOUT_LOCALES = [
5218
+ "en",
5219
+ "de",
5220
+ "fr",
5221
+ "es",
5222
+ "it",
5223
+ "nl",
5224
+ // Simplified and traditional are separate dictionaries in the checkout,
5225
+ // not region variants: they use different characters, so a merchant who
5226
+ // writes one has not written the other.
5227
+ "zh",
5228
+ "zh-Hant",
5229
+ "hi",
5230
+ "ar"
5231
+ ];
5232
+ var RTL_CHECKOUT_LOCALES = ["ar"];
5233
+ function checkoutLocaleDir(locale) {
5234
+ const base = String(locale ?? "").toLowerCase().split("-")[0];
5235
+ return RTL_CHECKOUT_LOCALES.includes(base) ? "rtl" : "ltr";
5236
+ }
5218
5237
  var LOCALIZABLE_COPY_FIELDS = [
5219
5238
  "headerText",
5220
5239
  "payButtonLabel",
@@ -5938,14 +5957,18 @@ function visibleCustomFields(fields, ctx) {
5938
5957
  }
5939
5958
  function translationFor(map, locale) {
5940
5959
  if (!locale) return null;
5941
- const own = (k) => {
5942
- const v = Object.prototype.hasOwnProperty.call(map, k) ? map[k] : void 0;
5943
- return typeof v === "string" && v.length > 0 ? v : null;
5944
- };
5945
- const exact = own(locale);
5946
- if (exact) return exact;
5947
- const base = locale.split("-")[0];
5948
- return base && base !== locale ? own(base) : null;
5960
+ const folded = /* @__PURE__ */ new Map();
5961
+ for (const [k, v] of Object.entries(map)) {
5962
+ if (typeof v === "string" && v.length > 0 && !folded.has(k.toLowerCase())) {
5963
+ folded.set(k.toLowerCase(), v);
5964
+ }
5965
+ }
5966
+ const parts = locale.toLowerCase().split("-");
5967
+ for (let i = parts.length; i > 0; i -= 1) {
5968
+ const hit = folded.get(parts.slice(0, i).join("-"));
5969
+ if (hit) return hit;
5970
+ }
5971
+ return null;
5949
5972
  }
5950
5973
  function customFieldText(field, part, locale) {
5951
5974
  const map = part === "label" ? field.labelTranslations : part === "placeholder" ? field.placeholderTranslations : field.helpTextTranslations;
@@ -7246,6 +7269,8 @@ export {
7246
7269
  SURCHARGE_LABEL_MODES,
7247
7270
  SURCHARGE_FIGURE_MODES,
7248
7271
  CHECKOUT_LOCALES,
7272
+ RTL_CHECKOUT_LOCALES,
7273
+ checkoutLocaleDir,
7249
7274
  LOCALIZABLE_COPY_FIELDS,
7250
7275
  copyTranslationsKey,
7251
7276
  checkoutCopy,
@@ -7336,4 +7361,4 @@ export {
7336
7361
  decodeNativePanes,
7337
7362
  encodeNativePanes
7338
7363
  };
7339
- //# sourceMappingURL=chunk-TNZHQGX7.js.map
7364
+ //# sourceMappingURL=chunk-JQXBXZ2L.js.map