@paypercut/checkout-js 1.4.5 → 1.4.6

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/README.md CHANGED
@@ -1761,7 +1761,7 @@ Tip: Prefer subscribing with the SdkEvent enum for stronger typing.
1761
1761
  <body>
1762
1762
  <div id="checkout"></div>
1763
1763
 
1764
- <script src="https://cdn.jsdelivr.net/npm/@paypercut/checkout-js@1.4.5/dist/paypercut-checkout.iife.min.js"></script>
1764
+ <script src="https://cdn.jsdelivr.net/npm/@paypercut/checkout-js@1.4.6/dist/paypercut-checkout.iife.min.js"></script>
1765
1765
  <script>
1766
1766
  const checkout = PaypercutCheckout({
1767
1767
  id: '01KB23M9EC960C50G3AH14FTTT',
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
4
- const SDK_VERSION = "1.4.5";
4
+ const SDK_VERSION = "1.4.6";
5
5
 
6
6
  const ELEMENTS_APPEARANCE_VARIABLE_NAMES = [
7
7
  'colorPrimary',
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "1.4.5";
1
+ const SDK_VERSION = "1.4.6";
2
2
 
3
3
  const ELEMENTS_APPEARANCE_VARIABLE_NAMES = [
4
4
  'colorPrimary',
package/dist/index.cjs CHANGED
@@ -105,7 +105,7 @@ class Emitter {
105
105
  }
106
106
  }
107
107
 
108
- const SDK_VERSION = "1.4.5";
108
+ const SDK_VERSION = "1.4.6";
109
109
 
110
110
  /**
111
111
  * Build-time configuration
@@ -5298,6 +5298,15 @@ const DEVELOPER_DISPLAY_OPTION_KEYS = [
5298
5298
  'buttonHeight',
5299
5299
  'buttonRadius',
5300
5300
  ];
5301
+ const CHECKOUT_DETAIL_OPTION_KEYS = [
5302
+ 'lineItems',
5303
+ 'emailRequired',
5304
+ 'phoneNumberRequired',
5305
+ 'billingAddressRequired',
5306
+ 'shippingAddressRequired',
5307
+ 'allowedShippingCountries',
5308
+ 'shippingRates',
5309
+ ];
5301
5310
  /**
5302
5311
  * Reviewable merchant-callback, layout, and payload limits for Express
5303
5312
  * Checkout. These are SDK behavior bounds, distinct from the cross-frame
@@ -6042,7 +6051,7 @@ class ExpressCheckoutElementImpl {
6042
6051
  this.activeAttempt.approved = true;
6043
6052
  }
6044
6053
  this.activeOptions = structuredCloneSafe(this.options);
6045
- this.group.resolveWalletClick(this.componentId, requestId, true, this.options);
6054
+ this.group.resolveWalletClick(this.componentId, requestId, true, checkoutDetailOptions(this.options));
6046
6055
  return;
6047
6056
  }
6048
6057
  let settled = false;
@@ -6758,19 +6767,8 @@ class ExpressCheckoutElementImpl {
6758
6767
  }
6759
6768
  const OPTION_KEYS = new Set([
6760
6769
  'paymentMethodOrder',
6761
- 'paymentMethods',
6762
- 'layout',
6763
- 'buttonType',
6764
- 'buttonTheme',
6765
- 'buttonHeight',
6766
- 'buttonRadius',
6767
- 'emailRequired',
6768
- 'phoneNumberRequired',
6769
- 'billingAddressRequired',
6770
- 'shippingAddressRequired',
6771
- 'allowedShippingCountries',
6772
- 'lineItems',
6773
- 'shippingRates',
6770
+ ...DEVELOPER_DISPLAY_OPTION_KEYS,
6771
+ ...CHECKOUT_DETAIL_OPTION_KEYS,
6774
6772
  ]);
6775
6773
  function developerDisplayOptions(options) {
6776
6774
  return structuredCloneSafe({
@@ -6923,16 +6921,7 @@ function validateRows(rows, labelKey, requireId = false) {
6923
6921
  function validateClickResolveOptions(options) {
6924
6922
  if (options === undefined)
6925
6923
  return undefined;
6926
- const allowed = new Set([
6927
- 'amount',
6928
- 'lineItems',
6929
- 'emailRequired',
6930
- 'phoneNumberRequired',
6931
- 'billingAddressRequired',
6932
- 'shippingAddressRequired',
6933
- 'allowedShippingCountries',
6934
- 'shippingRates',
6935
- ]);
6924
+ const allowed = new Set(['amount', ...CHECKOUT_DETAIL_OPTION_KEYS]);
6936
6925
  if (!isRecord(options) || Object.keys(options).some((key) => !allowed.has(key))) {
6937
6926
  throw invalidOptions();
6938
6927
  }
@@ -6968,6 +6957,21 @@ function validateClickResolveOptions(options) {
6968
6957
  : {}),
6969
6958
  });
6970
6959
  }
6960
+ /**
6961
+ * Selects the checkout details a wallet click may carry. The hosted component
6962
+ * rejects a click resolution containing presentation options, so an
6963
+ * auto-approved wallet attempt must never forward the full element options.
6964
+ */
6965
+ function checkoutDetailOptions(options) {
6966
+ const details = {};
6967
+ for (const key of CHECKOUT_DETAIL_OPTION_KEYS) {
6968
+ if (options[key] !== undefined)
6969
+ Object.assign(details, { [key]: options[key] });
6970
+ }
6971
+ if (Object.keys(details).length === 0)
6972
+ return undefined;
6973
+ return validateClickResolveOptions(details);
6974
+ }
6971
6975
  function validatePaymentMethodOrder(order) {
6972
6976
  if (order !== undefined &&
6973
6977
  (!Array.isArray(order) ||