@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/dist/index.mjs CHANGED
@@ -100,7 +100,7 @@ class Emitter {
100
100
  }
101
101
  }
102
102
 
103
- const SDK_VERSION = "1.4.5";
103
+ const SDK_VERSION = "1.4.6";
104
104
 
105
105
  /**
106
106
  * Build-time configuration
@@ -5293,6 +5293,15 @@ const DEVELOPER_DISPLAY_OPTION_KEYS = [
5293
5293
  'buttonHeight',
5294
5294
  'buttonRadius',
5295
5295
  ];
5296
+ const CHECKOUT_DETAIL_OPTION_KEYS = [
5297
+ 'lineItems',
5298
+ 'emailRequired',
5299
+ 'phoneNumberRequired',
5300
+ 'billingAddressRequired',
5301
+ 'shippingAddressRequired',
5302
+ 'allowedShippingCountries',
5303
+ 'shippingRates',
5304
+ ];
5296
5305
  /**
5297
5306
  * Reviewable merchant-callback, layout, and payload limits for Express
5298
5307
  * Checkout. These are SDK behavior bounds, distinct from the cross-frame
@@ -6037,7 +6046,7 @@ class ExpressCheckoutElementImpl {
6037
6046
  this.activeAttempt.approved = true;
6038
6047
  }
6039
6048
  this.activeOptions = structuredCloneSafe(this.options);
6040
- this.group.resolveWalletClick(this.componentId, requestId, true, this.options);
6049
+ this.group.resolveWalletClick(this.componentId, requestId, true, checkoutDetailOptions(this.options));
6041
6050
  return;
6042
6051
  }
6043
6052
  let settled = false;
@@ -6753,19 +6762,8 @@ class ExpressCheckoutElementImpl {
6753
6762
  }
6754
6763
  const OPTION_KEYS = new Set([
6755
6764
  'paymentMethodOrder',
6756
- 'paymentMethods',
6757
- 'layout',
6758
- 'buttonType',
6759
- 'buttonTheme',
6760
- 'buttonHeight',
6761
- 'buttonRadius',
6762
- 'emailRequired',
6763
- 'phoneNumberRequired',
6764
- 'billingAddressRequired',
6765
- 'shippingAddressRequired',
6766
- 'allowedShippingCountries',
6767
- 'lineItems',
6768
- 'shippingRates',
6765
+ ...DEVELOPER_DISPLAY_OPTION_KEYS,
6766
+ ...CHECKOUT_DETAIL_OPTION_KEYS,
6769
6767
  ]);
6770
6768
  function developerDisplayOptions(options) {
6771
6769
  return structuredCloneSafe({
@@ -6918,16 +6916,7 @@ function validateRows(rows, labelKey, requireId = false) {
6918
6916
  function validateClickResolveOptions(options) {
6919
6917
  if (options === undefined)
6920
6918
  return undefined;
6921
- const allowed = new Set([
6922
- 'amount',
6923
- 'lineItems',
6924
- 'emailRequired',
6925
- 'phoneNumberRequired',
6926
- 'billingAddressRequired',
6927
- 'shippingAddressRequired',
6928
- 'allowedShippingCountries',
6929
- 'shippingRates',
6930
- ]);
6919
+ const allowed = new Set(['amount', ...CHECKOUT_DETAIL_OPTION_KEYS]);
6931
6920
  if (!isRecord(options) || Object.keys(options).some((key) => !allowed.has(key))) {
6932
6921
  throw invalidOptions();
6933
6922
  }
@@ -6963,6 +6952,21 @@ function validateClickResolveOptions(options) {
6963
6952
  : {}),
6964
6953
  });
6965
6954
  }
6955
+ /**
6956
+ * Selects the checkout details a wallet click may carry. The hosted component
6957
+ * rejects a click resolution containing presentation options, so an
6958
+ * auto-approved wallet attempt must never forward the full element options.
6959
+ */
6960
+ function checkoutDetailOptions(options) {
6961
+ const details = {};
6962
+ for (const key of CHECKOUT_DETAIL_OPTION_KEYS) {
6963
+ if (options[key] !== undefined)
6964
+ Object.assign(details, { [key]: options[key] });
6965
+ }
6966
+ if (Object.keys(details).length === 0)
6967
+ return undefined;
6968
+ return validateClickResolveOptions(details);
6969
+ }
6966
6970
  function validatePaymentMethodOrder(order) {
6967
6971
  if (order !== undefined &&
6968
6972
  (!Array.isArray(order) ||