@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/index.cjs CHANGED
@@ -61,6 +61,7 @@ __export(index_exports, {
61
61
  PANES_MAX: () => PANES_MAX,
62
62
  PANE_CATEGORY_KEYS: () => PANE_CATEGORY_KEYS,
63
63
  PANE_ICON_KEYS: () => PANE_ICON_KEYS,
64
+ RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
64
65
  Regions: () => Regions,
65
66
  Risk: () => Risk,
66
67
  STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
@@ -88,6 +89,7 @@ __export(index_exports, {
88
89
  buildBrandingExport: () => buildBrandingExport,
89
90
  buttonPadValue: () => buttonPadValue,
90
91
  checkoutCopy: () => checkoutCopy,
92
+ checkoutLocaleDir: () => checkoutLocaleDir,
91
93
  cloneBranding: () => cloneBranding,
92
94
  cloneCustomField: () => cloneCustomField,
93
95
  cloneNativePane: () => cloneNativePane,
@@ -795,6 +797,32 @@ var Connectors = class {
795
797
  { body: params }
796
798
  );
797
799
  }
800
+ /**
801
+ * What the processor says about this connector account: whether it will
802
+ * accept charges, which capabilities are live, and anything it is still
803
+ * waiting on.
804
+ *
805
+ * This is **not** {@link Connectors.verify}. That one asks whether the stored
806
+ * credentials work, by running a test-card authorization; a processor can
807
+ * revoke an account's ability to take payments while the credentials stay
808
+ * perfectly valid, and then a credential check reports healthy while every
809
+ * checkout silently stalls. This asks the account's own status instead, and
810
+ * is a plain read — it costs the merchant nothing and is safe to call twice.
811
+ *
812
+ * Connectors with no probe answer `state: 'unknown'` with
813
+ * `unknown_reason: 'connector_not_supported'`, rather than an error — every
814
+ * `'unknown'` carries a reason code you render your own words for. A router
815
+ * without this endpoint answers 404 — render that as "this build cannot
816
+ * report health", never as "healthy".
817
+ *
818
+ * `GET /account/{accountId}/connectors/{connectorId}/health`
819
+ */
820
+ async health(accountId, connectorId) {
821
+ return this.request(
822
+ "GET",
823
+ `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/health`
824
+ );
825
+ }
798
826
  /** Verify connector credentials. `POST /account/connectors/verify` */
799
827
  async verify(params) {
800
828
  return this.request("POST", "/account/connectors/verify", { body: params });
@@ -5369,7 +5397,26 @@ var SURCHARGE_FIGURE_MODES = [
5369
5397
  "amountThenPercent",
5370
5398
  "percentThenAmount"
5371
5399
  ];
5372
- var CHECKOUT_LOCALES = ["en", "de"];
5400
+ var CHECKOUT_LOCALES = [
5401
+ "en",
5402
+ "de",
5403
+ "fr",
5404
+ "es",
5405
+ "it",
5406
+ "nl",
5407
+ // Simplified and traditional are separate dictionaries in the checkout,
5408
+ // not region variants: they use different characters, so a merchant who
5409
+ // writes one has not written the other.
5410
+ "zh",
5411
+ "zh-Hant",
5412
+ "hi",
5413
+ "ar"
5414
+ ];
5415
+ var RTL_CHECKOUT_LOCALES = ["ar"];
5416
+ function checkoutLocaleDir(locale) {
5417
+ const base = String(locale ?? "").toLowerCase().split("-")[0];
5418
+ return RTL_CHECKOUT_LOCALES.includes(base) ? "rtl" : "ltr";
5419
+ }
5373
5420
  var LOCALIZABLE_COPY_FIELDS = [
5374
5421
  "headerText",
5375
5422
  "payButtonLabel",
@@ -6093,14 +6140,18 @@ function visibleCustomFields(fields, ctx) {
6093
6140
  }
6094
6141
  function translationFor(map, locale) {
6095
6142
  if (!locale) return null;
6096
- const own = (k) => {
6097
- const v = Object.prototype.hasOwnProperty.call(map, k) ? map[k] : void 0;
6098
- return typeof v === "string" && v.length > 0 ? v : null;
6099
- };
6100
- const exact = own(locale);
6101
- if (exact) return exact;
6102
- const base = locale.split("-")[0];
6103
- return base && base !== locale ? own(base) : null;
6143
+ const folded = /* @__PURE__ */ new Map();
6144
+ for (const [k, v] of Object.entries(map)) {
6145
+ if (typeof v === "string" && v.length > 0 && !folded.has(k.toLowerCase())) {
6146
+ folded.set(k.toLowerCase(), v);
6147
+ }
6148
+ }
6149
+ const parts = locale.toLowerCase().split("-");
6150
+ for (let i = parts.length; i > 0; i -= 1) {
6151
+ const hit = folded.get(parts.slice(0, i).join("-"));
6152
+ if (hit) return hit;
6153
+ }
6154
+ return null;
6104
6155
  }
6105
6156
  function customFieldText(field, part, locale) {
6106
6157
  const map = part === "label" ? field.labelTranslations : part === "placeholder" ? field.placeholderTranslations : field.helpTextTranslations;
@@ -7401,6 +7452,7 @@ var encodeNativePanes = encodePanes;
7401
7452
  PANES_MAX,
7402
7453
  PANE_CATEGORY_KEYS,
7403
7454
  PANE_ICON_KEYS,
7455
+ RTL_CHECKOUT_LOCALES,
7404
7456
  Regions,
7405
7457
  Risk,
7406
7458
  STRIPE_FALLBACK_PANE_CATALOG,
@@ -7428,6 +7480,7 @@ var encodeNativePanes = encodePanes;
7428
7480
  buildBrandingExport,
7429
7481
  buttonPadValue,
7430
7482
  checkoutCopy,
7483
+ checkoutLocaleDir,
7431
7484
  cloneBranding,
7432
7485
  cloneCustomField,
7433
7486
  cloneNativePane,