@delopay/sdk 0.122.0 → 0.124.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.
@@ -640,6 +640,32 @@ var Connectors = class {
640
640
  { body: params }
641
641
  );
642
642
  }
643
+ /**
644
+ * What the processor says about this connector account: whether it will
645
+ * accept charges, which capabilities are live, and anything it is still
646
+ * waiting on.
647
+ *
648
+ * This is **not** {@link Connectors.verify}. That one asks whether the stored
649
+ * credentials work, by running a test-card authorization; a processor can
650
+ * revoke an account's ability to take payments while the credentials stay
651
+ * perfectly valid, and then a credential check reports healthy while every
652
+ * checkout silently stalls. This asks the account's own status instead, and
653
+ * is a plain read — it costs the merchant nothing and is safe to call twice.
654
+ *
655
+ * Connectors with no probe answer `state: 'unknown'` with
656
+ * `unknown_reason: 'connector_not_supported'`, rather than an error — every
657
+ * `'unknown'` carries a reason code you render your own words for. A router
658
+ * without this endpoint answers 404 — render that as "this build cannot
659
+ * report health", never as "healthy".
660
+ *
661
+ * `GET /account/{accountId}/connectors/{connectorId}/health`
662
+ */
663
+ async health(accountId, connectorId) {
664
+ return this.request(
665
+ "GET",
666
+ `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/health`
667
+ );
668
+ }
643
669
  /** Verify connector credentials. `POST /account/connectors/verify` */
644
670
  async verify(params) {
645
671
  return this.request("POST", "/account/connectors/verify", { body: params });
@@ -5214,7 +5240,26 @@ var SURCHARGE_FIGURE_MODES = [
5214
5240
  "amountThenPercent",
5215
5241
  "percentThenAmount"
5216
5242
  ];
5217
- var CHECKOUT_LOCALES = ["en", "de"];
5243
+ var CHECKOUT_LOCALES = [
5244
+ "en",
5245
+ "de",
5246
+ "fr",
5247
+ "es",
5248
+ "it",
5249
+ "nl",
5250
+ // Simplified and traditional are separate dictionaries in the checkout,
5251
+ // not region variants: they use different characters, so a merchant who
5252
+ // writes one has not written the other.
5253
+ "zh",
5254
+ "zh-Hant",
5255
+ "hi",
5256
+ "ar"
5257
+ ];
5258
+ var RTL_CHECKOUT_LOCALES = ["ar"];
5259
+ function checkoutLocaleDir(locale) {
5260
+ const base = String(locale ?? "").toLowerCase().split("-")[0];
5261
+ return RTL_CHECKOUT_LOCALES.includes(base) ? "rtl" : "ltr";
5262
+ }
5218
5263
  var LOCALIZABLE_COPY_FIELDS = [
5219
5264
  "headerText",
5220
5265
  "payButtonLabel",
@@ -5938,14 +5983,18 @@ function visibleCustomFields(fields, ctx) {
5938
5983
  }
5939
5984
  function translationFor(map, locale) {
5940
5985
  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;
5986
+ const folded = /* @__PURE__ */ new Map();
5987
+ for (const [k, v] of Object.entries(map)) {
5988
+ if (typeof v === "string" && v.length > 0 && !folded.has(k.toLowerCase())) {
5989
+ folded.set(k.toLowerCase(), v);
5990
+ }
5991
+ }
5992
+ const parts = locale.toLowerCase().split("-");
5993
+ for (let i = parts.length; i > 0; i -= 1) {
5994
+ const hit = folded.get(parts.slice(0, i).join("-"));
5995
+ if (hit) return hit;
5996
+ }
5997
+ return null;
5949
5998
  }
5950
5999
  function customFieldText(field, part, locale) {
5951
6000
  const map = part === "label" ? field.labelTranslations : part === "placeholder" ? field.placeholderTranslations : field.helpTextTranslations;
@@ -7246,6 +7295,8 @@ export {
7246
7295
  SURCHARGE_LABEL_MODES,
7247
7296
  SURCHARGE_FIGURE_MODES,
7248
7297
  CHECKOUT_LOCALES,
7298
+ RTL_CHECKOUT_LOCALES,
7299
+ checkoutLocaleDir,
7249
7300
  LOCALIZABLE_COPY_FIELDS,
7250
7301
  copyTranslationsKey,
7251
7302
  checkoutCopy,
@@ -7336,4 +7387,4 @@ export {
7336
7387
  decodeNativePanes,
7337
7388
  encodeNativePanes
7338
7389
  };
7339
- //# sourceMappingURL=chunk-TNZHQGX7.js.map
7390
+ //# sourceMappingURL=chunk-4TVKPQTZ.js.map