@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.
package/dist/internal.cjs CHANGED
@@ -73,6 +73,7 @@ __export(internal_exports, {
73
73
  PANE_ICON_KEYS: () => PANE_ICON_KEYS,
74
74
  PlatformBilling: () => PlatformBilling,
75
75
  PlatformFees: () => PlatformFees,
76
+ RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
76
77
  Regions: () => Regions,
77
78
  Risk: () => Risk,
78
79
  STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
@@ -100,6 +101,7 @@ __export(internal_exports, {
100
101
  buildBrandingExport: () => buildBrandingExport,
101
102
  buttonPadValue: () => buttonPadValue,
102
103
  checkoutCopy: () => checkoutCopy,
104
+ checkoutLocaleDir: () => checkoutLocaleDir,
103
105
  cloneBranding: () => cloneBranding,
104
106
  cloneCustomField: () => cloneCustomField,
105
107
  cloneNativePane: () => cloneNativePane,
@@ -807,6 +809,32 @@ var Connectors = class {
807
809
  { body: params }
808
810
  );
809
811
  }
812
+ /**
813
+ * What the processor says about this connector account: whether it will
814
+ * accept charges, which capabilities are live, and anything it is still
815
+ * waiting on.
816
+ *
817
+ * This is **not** {@link Connectors.verify}. That one asks whether the stored
818
+ * credentials work, by running a test-card authorization; a processor can
819
+ * revoke an account's ability to take payments while the credentials stay
820
+ * perfectly valid, and then a credential check reports healthy while every
821
+ * checkout silently stalls. This asks the account's own status instead, and
822
+ * is a plain read — it costs the merchant nothing and is safe to call twice.
823
+ *
824
+ * Connectors with no probe answer `state: 'unknown'` with
825
+ * `unknown_reason: 'connector_not_supported'`, rather than an error — every
826
+ * `'unknown'` carries a reason code you render your own words for. A router
827
+ * without this endpoint answers 404 — render that as "this build cannot
828
+ * report health", never as "healthy".
829
+ *
830
+ * `GET /account/{accountId}/connectors/{connectorId}/health`
831
+ */
832
+ async health(accountId, connectorId) {
833
+ return this.request(
834
+ "GET",
835
+ `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/health`
836
+ );
837
+ }
810
838
  /** Verify connector credentials. `POST /account/connectors/verify` */
811
839
  async verify(params) {
812
840
  return this.request("POST", "/account/connectors/verify", { body: params });
@@ -5381,7 +5409,26 @@ var SURCHARGE_FIGURE_MODES = [
5381
5409
  "amountThenPercent",
5382
5410
  "percentThenAmount"
5383
5411
  ];
5384
- var CHECKOUT_LOCALES = ["en", "de"];
5412
+ var CHECKOUT_LOCALES = [
5413
+ "en",
5414
+ "de",
5415
+ "fr",
5416
+ "es",
5417
+ "it",
5418
+ "nl",
5419
+ // Simplified and traditional are separate dictionaries in the checkout,
5420
+ // not region variants: they use different characters, so a merchant who
5421
+ // writes one has not written the other.
5422
+ "zh",
5423
+ "zh-Hant",
5424
+ "hi",
5425
+ "ar"
5426
+ ];
5427
+ var RTL_CHECKOUT_LOCALES = ["ar"];
5428
+ function checkoutLocaleDir(locale) {
5429
+ const base = String(locale ?? "").toLowerCase().split("-")[0];
5430
+ return RTL_CHECKOUT_LOCALES.includes(base) ? "rtl" : "ltr";
5431
+ }
5385
5432
  var LOCALIZABLE_COPY_FIELDS = [
5386
5433
  "headerText",
5387
5434
  "payButtonLabel",
@@ -6105,14 +6152,18 @@ function visibleCustomFields(fields, ctx) {
6105
6152
  }
6106
6153
  function translationFor(map, locale) {
6107
6154
  if (!locale) return null;
6108
- const own = (k) => {
6109
- const v = Object.prototype.hasOwnProperty.call(map, k) ? map[k] : void 0;
6110
- return typeof v === "string" && v.length > 0 ? v : null;
6111
- };
6112
- const exact = own(locale);
6113
- if (exact) return exact;
6114
- const base = locale.split("-")[0];
6115
- return base && base !== locale ? own(base) : null;
6155
+ const folded = /* @__PURE__ */ new Map();
6156
+ for (const [k, v] of Object.entries(map)) {
6157
+ if (typeof v === "string" && v.length > 0 && !folded.has(k.toLowerCase())) {
6158
+ folded.set(k.toLowerCase(), v);
6159
+ }
6160
+ }
6161
+ const parts = locale.toLowerCase().split("-");
6162
+ for (let i = parts.length; i > 0; i -= 1) {
6163
+ const hit = folded.get(parts.slice(0, i).join("-"));
6164
+ if (hit) return hit;
6165
+ }
6166
+ return null;
6116
6167
  }
6117
6168
  function customFieldText(field, part, locale) {
6118
6169
  const map = part === "label" ? field.labelTranslations : part === "placeholder" ? field.placeholderTranslations : field.helpTextTranslations;
@@ -8399,6 +8450,7 @@ var DelopayInternal = class extends Delopay {
8399
8450
  PANE_ICON_KEYS,
8400
8451
  PlatformBilling,
8401
8452
  PlatformFees,
8453
+ RTL_CHECKOUT_LOCALES,
8402
8454
  Regions,
8403
8455
  Risk,
8404
8456
  STRIPE_FALLBACK_PANE_CATALOG,
@@ -8426,6 +8478,7 @@ var DelopayInternal = class extends Delopay {
8426
8478
  buildBrandingExport,
8427
8479
  buttonPadValue,
8428
8480
  checkoutCopy,
8481
+ checkoutLocaleDir,
8429
8482
  cloneBranding,
8430
8483
  cloneCustomField,
8431
8484
  cloneNativePane,