@delopay/sdk 0.128.0 → 0.130.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,
@@ -5416,6 +5417,7 @@ var SURCHARGE_POSITIONS = [
5416
5417
  "cornerStart",
5417
5418
  "cornerEnd"
5418
5419
  ];
5420
+ var NATIVE_ELEMENT_POSITIONS = ["top", "bottom"];
5419
5421
  var SURCHARGE_STYLES = [
5420
5422
  "plain",
5421
5423
  "underline",
@@ -5828,6 +5830,9 @@ var DEFAULT_BRANDING_BASE = {
5828
5830
  // find out about on the statement.
5829
5831
  showSurcharge: true,
5830
5832
  surchargePosition: "trailing",
5833
+ // The button is the surface a buyer recognises fastest; it leads its section
5834
+ // unless the merchant says otherwise.
5835
+ nativeElementPosition: "top",
5831
5836
  surchargeStyle: "badge",
5832
5837
  surchargeSize: "sm",
5833
5838
  surchargeShape: "pill",
@@ -6468,6 +6473,11 @@ function decodeBranding(source) {
6468
6473
  SURCHARGE_POSITIONS,
6469
6474
  DEFAULT_BRANDING.surchargePosition
6470
6475
  ),
6476
+ nativeElementPosition: pickEnum(
6477
+ extras["nativeElementPosition"],
6478
+ NATIVE_ELEMENT_POSITIONS,
6479
+ DEFAULT_BRANDING.nativeElementPosition
6480
+ ),
6471
6481
  surchargeStyle: pickEnum(
6472
6482
  extras["surchargeStyle"],
6473
6483
  SURCHARGE_STYLES,
@@ -6587,6 +6597,7 @@ function encodeBranding(branding, base) {
6587
6597
  buttonSize: branding.buttonSize,
6588
6598
  showSurcharge: String(branding.showSurcharge),
6589
6599
  surchargePosition: branding.surchargePosition,
6600
+ nativeElementPosition: branding.nativeElementPosition,
6590
6601
  surchargeStyle: branding.surchargeStyle,
6591
6602
  surchargeSize: branding.surchargeSize,
6592
6603
  surchargeShape: branding.surchargeShape,
@@ -6745,6 +6756,11 @@ function parseImportedBranding(raw) {
6745
6756
  SURCHARGE_POSITIONS,
6746
6757
  dflt.surchargePosition
6747
6758
  ),
6759
+ nativeElementPosition: pickEnum(
6760
+ root["nativeElementPosition"],
6761
+ NATIVE_ELEMENT_POSITIONS,
6762
+ dflt.nativeElementPosition
6763
+ ),
6748
6764
  surchargeStyle: pickEnum(
6749
6765
  root["surchargeStyle"],
6750
6766
  SURCHARGE_STYLES,
@@ -7207,6 +7223,30 @@ var CheckoutSession = class {
7207
7223
  headers: this.pkHeaders(options?.headers)
7208
7224
  });
7209
7225
  }
7226
+ /**
7227
+ * Mint the processor-side session a browser SDK completes — the PayPal
7228
+ * order that PayPal's buttons or Card Fields attach the buyer's choice to.
7229
+ * The client secret is attached automatically.
7230
+ *
7231
+ * For PayPal Card Fields (be#1387) pass `payment_method: 'card'` and the
7232
+ * `merchant_connector_id` the checkout was rendered with; the order id comes
7233
+ * back in `next_action.next_action_data.order_id` and is what the SDK's
7234
+ * `createOrder` returns. The confirm that captures it sends the same order
7235
+ * and account as `payment_method_data.card_reference`.
7236
+ *
7237
+ * `POST /payments/{paymentId}/post-session-tokens` (publishable key)
7238
+ */
7239
+ async postSessionTokens(params, options) {
7240
+ return this.client.request(
7241
+ "POST",
7242
+ `/payments/${encodeURIComponent(this.paymentId)}/post-session-tokens`,
7243
+ {
7244
+ body: { ...params, client_secret: this.requireClientSecret() },
7245
+ ...options,
7246
+ headers: this.pkHeaders(options?.headers)
7247
+ }
7248
+ );
7249
+ }
7210
7250
  /**
7211
7251
  * Abandon the attempt the buyer left open on a connector's hosted page
7212
7252
  * (the payment sits in `requires_customer_action`) and open a fresh attempt
@@ -7663,6 +7703,7 @@ var encodeNativePanes = encodePanes;
7663
7703
  MAX_SECTION_ORDER,
7664
7704
  METHOD_SECTIONS,
7665
7705
  MIN_SECTION_ORDER,
7706
+ NATIVE_ELEMENT_POSITIONS,
7666
7707
  NATIVE_PANES_MAX,
7667
7708
  NATIVE_PANE_CATEGORY_KEYS,
7668
7709
  NATIVE_PANE_ICON_KEYS,