@delopay/sdk 0.129.0 → 0.131.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
@@ -58,6 +58,7 @@ __export(index_exports, {
58
58
  MAX_SECTION_ORDER: () => MAX_SECTION_ORDER,
59
59
  METHOD_SECTIONS: () => METHOD_SECTIONS,
60
60
  MIN_SECTION_ORDER: () => MIN_SECTION_ORDER,
61
+ NATIVE_ELEMENT_POSITIONS: () => NATIVE_ELEMENT_POSITIONS,
61
62
  NATIVE_PANES_MAX: () => NATIVE_PANES_MAX,
62
63
  NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
63
64
  NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
@@ -874,6 +875,23 @@ var Connectors = class {
874
875
  { body: params }
875
876
  );
876
877
  }
878
+ /**
879
+ * Register checkout/shop domains as Airwallex Apple Pay domains, so Apple Pay
880
+ * renders on those pages.
881
+ * `POST /account/{merchantId}/connectors/{connectorId}/airwallex/apple-pay-domains`
882
+ *
883
+ * Airwallex connectors only. One call registers against a single credential
884
+ * set (`environment`, default `'live'`) — call twice to cover live and
885
+ * sandbox. Idempotent: a host already on the account comes back
886
+ * `already_registered` without a write.
887
+ */
888
+ async registerAirwallexApplePayDomains(merchantId, connectorId, params) {
889
+ return this.request(
890
+ "POST",
891
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/airwallex/apple-pay-domains`,
892
+ { body: params }
893
+ );
894
+ }
877
895
  /** Get registered webhooks for a connector. `GET /account/{merchantId}/connectors/webhooks/{connectorId}` */
878
896
  async getWebhook(merchantId, connectorId) {
879
897
  return this.request(
@@ -5416,6 +5434,7 @@ var SURCHARGE_POSITIONS = [
5416
5434
  "cornerStart",
5417
5435
  "cornerEnd"
5418
5436
  ];
5437
+ var NATIVE_ELEMENT_POSITIONS = ["top", "bottom"];
5419
5438
  var SURCHARGE_STYLES = [
5420
5439
  "plain",
5421
5440
  "underline",
@@ -5828,6 +5847,9 @@ var DEFAULT_BRANDING_BASE = {
5828
5847
  // find out about on the statement.
5829
5848
  showSurcharge: true,
5830
5849
  surchargePosition: "trailing",
5850
+ // The button is the surface a buyer recognises fastest; it leads its section
5851
+ // unless the merchant says otherwise.
5852
+ nativeElementPosition: "top",
5831
5853
  surchargeStyle: "badge",
5832
5854
  surchargeSize: "sm",
5833
5855
  surchargeShape: "pill",
@@ -6468,6 +6490,11 @@ function decodeBranding(source) {
6468
6490
  SURCHARGE_POSITIONS,
6469
6491
  DEFAULT_BRANDING.surchargePosition
6470
6492
  ),
6493
+ nativeElementPosition: pickEnum(
6494
+ extras["nativeElementPosition"],
6495
+ NATIVE_ELEMENT_POSITIONS,
6496
+ DEFAULT_BRANDING.nativeElementPosition
6497
+ ),
6471
6498
  surchargeStyle: pickEnum(
6472
6499
  extras["surchargeStyle"],
6473
6500
  SURCHARGE_STYLES,
@@ -6587,6 +6614,7 @@ function encodeBranding(branding, base) {
6587
6614
  buttonSize: branding.buttonSize,
6588
6615
  showSurcharge: String(branding.showSurcharge),
6589
6616
  surchargePosition: branding.surchargePosition,
6617
+ nativeElementPosition: branding.nativeElementPosition,
6590
6618
  surchargeStyle: branding.surchargeStyle,
6591
6619
  surchargeSize: branding.surchargeSize,
6592
6620
  surchargeShape: branding.surchargeShape,
@@ -6745,6 +6773,11 @@ function parseImportedBranding(raw) {
6745
6773
  SURCHARGE_POSITIONS,
6746
6774
  dflt.surchargePosition
6747
6775
  ),
6776
+ nativeElementPosition: pickEnum(
6777
+ root["nativeElementPosition"],
6778
+ NATIVE_ELEMENT_POSITIONS,
6779
+ dflt.nativeElementPosition
6780
+ ),
6748
6781
  surchargeStyle: pickEnum(
6749
6782
  root["surchargeStyle"],
6750
6783
  SURCHARGE_STYLES,
@@ -7275,6 +7308,14 @@ var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
7275
7308
  function parseVisibility(raw) {
7276
7309
  return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
7277
7310
  }
7311
+ var PANE_NATIVE_ELEMENTS = [
7312
+ "everywhere",
7313
+ "embedded_only",
7314
+ "external_only"
7315
+ ];
7316
+ function parseNativeElement(raw) {
7317
+ return PANE_NATIVE_ELEMENTS.find((value) => value === raw) ?? "everywhere";
7318
+ }
7278
7319
  function paneViewVisibility(view) {
7279
7320
  const declared = PANE_VISIBILITIES.find((value) => value === view.visibility);
7280
7321
  if (declared) return declared;
@@ -7506,7 +7547,8 @@ function defaultPane(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
7506
7547
  iconSvg: "",
7507
7548
  displayOrder: 0,
7508
7549
  visibility: "always",
7509
- openIn: "tab"
7550
+ openIn: "tab",
7551
+ nativeElement: "everywhere"
7510
7552
  };
7511
7553
  }
7512
7554
  function clonePane(pane) {
@@ -7552,7 +7594,8 @@ function decodePanes(raw) {
7552
7594
  // Anything unrecognised degrades to `always` rather than dropping the row.
7553
7595
  visibility: parseVisibility(entry["visibility"]),
7554
7596
  // Same tolerance: an unknown value degrades to the default `tab`.
7555
- openIn: entry["open_in"] === "popup" ? "popup" : "tab"
7597
+ openIn: entry["open_in"] === "popup" ? "popup" : "tab",
7598
+ nativeElement: parseNativeElement(entry["native_element"])
7556
7599
  });
7557
7600
  const indexByMethod = /* @__PURE__ */ new Map();
7558
7601
  const out = [];
@@ -7604,7 +7647,12 @@ function encodePanes(panes) {
7604
7647
  // never went through `decodePanes`. A decoded pane always holds a valid
7605
7648
  // value, so this is a no-op on the round-trip path.
7606
7649
  visibility: parseVisibility(pane.visibility),
7607
- open_in: pane.openIn === "popup" ? "popup" : "tab"
7650
+ open_in: pane.openIn === "popup" ? "popup" : "tab",
7651
+ // Omitted at the default: `everywhere` is what the router decodes an
7652
+ // absent key to, so leaving it out changes nothing — and keeps a blob
7653
+ // stored before the field existed byte-identical on re-encode, which
7654
+ // is what the wire-compatibility test pins.
7655
+ ...parseNativeElement(pane.nativeElement) === "everywhere" ? {} : { native_element: parseNativeElement(pane.nativeElement) }
7608
7656
  };
7609
7657
  });
7610
7658
  }
@@ -7687,6 +7735,7 @@ var encodeNativePanes = encodePanes;
7687
7735
  MAX_SECTION_ORDER,
7688
7736
  METHOD_SECTIONS,
7689
7737
  MIN_SECTION_ORDER,
7738
+ NATIVE_ELEMENT_POSITIONS,
7690
7739
  NATIVE_PANES_MAX,
7691
7740
  NATIVE_PANE_CATEGORY_KEYS,
7692
7741
  NATIVE_PANE_ICON_KEYS,