@delopay/sdk 0.121.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;
@@ -6787,6 +6810,28 @@ var CheckoutSession = class {
6787
6810
  headers: this.pkHeaders(options?.headers)
6788
6811
  });
6789
6812
  }
6813
+ /**
6814
+ * Abandon the attempt the buyer left open on a connector's hosted page
6815
+ * (the payment sits in `requires_customer_action`) and open a fresh attempt
6816
+ * awaiting a payment method, so the same payment can be confirmed again
6817
+ * with another method or connector. Nothing has been authorised on the
6818
+ * abandoned attempt; it is voided locally and kept in the attempt history.
6819
+ * Idempotent: a payment already in `requires_payment_method` comes back
6820
+ * unchanged with `abandoned_attempt_id: null`.
6821
+ *
6822
+ * `POST /payments/{paymentId}/abandon-attempt` (publishable key + client secret)
6823
+ */
6824
+ async abandonAttempt(options) {
6825
+ return this.client.request(
6826
+ "POST",
6827
+ `/payments/${encodeURIComponent(this.paymentId)}/abandon-attempt`,
6828
+ {
6829
+ body: { client_secret: this.requireClientSecret() },
6830
+ ...options,
6831
+ headers: this.pkHeaders(options?.headers)
6832
+ }
6833
+ );
6834
+ }
6790
6835
  /**
6791
6836
  * Payment methods available for this payment.
6792
6837
  *
@@ -7224,6 +7269,8 @@ export {
7224
7269
  SURCHARGE_LABEL_MODES,
7225
7270
  SURCHARGE_FIGURE_MODES,
7226
7271
  CHECKOUT_LOCALES,
7272
+ RTL_CHECKOUT_LOCALES,
7273
+ checkoutLocaleDir,
7227
7274
  LOCALIZABLE_COPY_FIELDS,
7228
7275
  copyTranslationsKey,
7229
7276
  checkoutCopy,
@@ -7314,4 +7361,4 @@ export {
7314
7361
  decodeNativePanes,
7315
7362
  encodeNativePanes
7316
7363
  };
7317
- //# sourceMappingURL=chunk-U4PY43DZ.js.map
7364
+ //# sourceMappingURL=chunk-JQXBXZ2L.js.map