@aglyn/plugins-commerce 1.14.0 → 1.15.1

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.
Files changed (214) hide show
  1. package/package.json +13 -13
  2. package/src/lib/components/account-subscriptions.d.ts +51 -0
  3. package/src/lib/components/account-subscriptions.js +168 -0
  4. package/src/lib/components/account-subscriptions.js.map +1 -0
  5. package/src/lib/components/account.js +12 -48
  6. package/src/lib/components/account.js.map +1 -1
  7. package/src/lib/components/cart.js +38 -9
  8. package/src/lib/components/cart.js.map +1 -1
  9. package/src/lib/components/commerce-console-page.js +6 -0
  10. package/src/lib/components/commerce-console-page.js.map +1 -1
  11. package/src/lib/components/commerce-console-sections.d.ts +1 -1
  12. package/src/lib/components/commerce-console-sections.js +5 -0
  13. package/src/lib/components/commerce-console-sections.js.map +1 -1
  14. package/src/lib/components/console/paid-media.d.ts +1 -0
  15. package/src/lib/components/console/paid-media.js +15 -4
  16. package/src/lib/components/console/paid-media.js.map +1 -1
  17. package/src/lib/components/console/payments-settings-card.component.js +1 -1
  18. package/src/lib/components/console/payments-settings-card.component.js.map +1 -1
  19. package/src/lib/components/console/pos/pos-hardware-api.d.ts +10 -1
  20. package/src/lib/components/console/pos/pos-hardware-api.js.map +1 -1
  21. package/src/lib/components/console/pos/pos-hardware-buyer.component.js +2 -2
  22. package/src/lib/components/console/pos/pos-hardware-buyer.component.js.map +1 -1
  23. package/src/lib/components/console/pos/pos-hardware-sale-api.d.ts +2 -0
  24. package/src/lib/components/console/pos/pos-hardware-sale-api.js.map +1 -1
  25. package/src/lib/components/console/pos-cellular-control.component.d.ts +1 -1
  26. package/src/lib/components/console/pos-cellular-control.component.js +5 -5
  27. package/src/lib/components/console/pos-cellular-control.component.js.map +1 -1
  28. package/src/lib/components/console/pos-devices-card.component.js +2 -2
  29. package/src/lib/components/console/pos-devices-card.component.js.map +1 -1
  30. package/src/lib/components/console/pos-hardware-card.component.d.ts +5 -0
  31. package/src/lib/components/console/pos-hardware-card.component.js +77 -8
  32. package/src/lib/components/console/pos-hardware-card.component.js.map +1 -1
  33. package/src/lib/components/console/pos-hardware-orders-staff-page.component.js +137 -19
  34. package/src/lib/components/console/pos-hardware-orders-staff-page.component.js.map +1 -1
  35. package/src/lib/components/console/pos-page.component.js +19 -2
  36. package/src/lib/components/console/pos-page.component.js.map +1 -1
  37. package/src/lib/components/console/product-editor-dialog.component.js +21 -2
  38. package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
  39. package/src/lib/components/console/subscription-detail-dialog.component.d.ts +58 -0
  40. package/src/lib/components/console/subscription-detail-dialog.component.js +201 -0
  41. package/src/lib/components/console/subscription-detail-dialog.component.js.map +1 -0
  42. package/src/lib/components/console/subscriptions-card.component.d.ts +60 -0
  43. package/src/lib/components/console/subscriptions-card.component.js +282 -0
  44. package/src/lib/components/console/subscriptions-card.component.js.map +1 -0
  45. package/src/lib/components/hardware-terms-consent.d.ts +22 -0
  46. package/src/lib/components/hardware-terms-consent.js +85 -0
  47. package/src/lib/components/hardware-terms-consent.js.map +1 -0
  48. package/src/lib/components/product-detail.js +32 -8
  49. package/src/lib/components/product-detail.js.map +1 -1
  50. package/src/lib/components/quote-page-body.js +7 -3
  51. package/src/lib/components/quote-page-body.js.map +1 -1
  52. package/src/lib/components/related-products.js +6 -3
  53. package/src/lib/components/related-products.js.map +1 -1
  54. package/src/lib/components/storefront-payment-element.d.ts +7 -1
  55. package/src/lib/components/storefront-payment-element.js +11 -7
  56. package/src/lib/components/storefront-payment-element.js.map +1 -1
  57. package/src/lib/constants/operator-alerts.d.ts +1 -1
  58. package/src/lib/constants/operator-alerts.js +4 -4
  59. package/src/lib/constants/operator-alerts.js.map +1 -1
  60. package/src/lib/model/commerce-orders.d.ts +6 -2
  61. package/src/lib/model/commerce-orders.js.map +1 -1
  62. package/src/lib/model/commerce-payment-methods.d.ts +27 -16
  63. package/src/lib/model/commerce-payment-methods.js +11 -83
  64. package/src/lib/model/commerce-payment-methods.js.map +1 -1
  65. package/src/lib/model/commerce.d.ts +6 -0
  66. package/src/lib/model/commerce.js.map +1 -1
  67. package/src/lib/model/index.d.ts +1 -0
  68. package/src/lib/model/index.js +1 -0
  69. package/src/lib/model/index.js.map +1 -1
  70. package/src/lib/model/paid-media.d.ts +8 -0
  71. package/src/lib/model/paid-media.js +13 -0
  72. package/src/lib/model/paid-media.js.map +1 -1
  73. package/src/lib/model/pos-hardware-in-person.d.ts +23 -2
  74. package/src/lib/model/pos-hardware-in-person.js +52 -20
  75. package/src/lib/model/pos-hardware-in-person.js.map +1 -1
  76. package/src/lib/model/pos-hardware-tax-summary.d.ts +5 -1
  77. package/src/lib/model/pos-hardware-tax-summary.js +2 -1
  78. package/src/lib/model/pos-hardware-tax-summary.js.map +1 -1
  79. package/src/lib/model/pos-hardware-terms.d.ts +37 -2
  80. package/src/lib/model/pos-hardware-terms.js +68 -3
  81. package/src/lib/model/pos-hardware-terms.js.map +1 -1
  82. package/src/lib/model/pos-hardware.d.ts +101 -15
  83. package/src/lib/model/pos-hardware.js +128 -18
  84. package/src/lib/model/pos-hardware.js.map +1 -1
  85. package/src/lib/model/pos-reader-splash.js +2 -2
  86. package/src/lib/model/pos-reader-splash.js.map +1 -1
  87. package/src/lib/model/product-write.d.ts +3 -0
  88. package/src/lib/model/subscription-view.d.ts +90 -0
  89. package/src/lib/model/subscription-view.js +176 -0
  90. package/src/lib/model/subscription-view.js.map +1 -0
  91. package/src/lib/server/billing-webhook.d.ts +27 -6
  92. package/src/lib/server/billing-webhook.js +271 -81
  93. package/src/lib/server/billing-webhook.js.map +1 -1
  94. package/src/lib/server/cancel-order.js +4 -3
  95. package/src/lib/server/cancel-order.js.map +1 -1
  96. package/src/lib/server/cart-checkout.js +105 -23
  97. package/src/lib/server/cart-checkout.js.map +1 -1
  98. package/src/lib/server/cart.js +15 -3
  99. package/src/lib/server/cart.js.map +1 -1
  100. package/src/lib/server/catalog.js +58 -22
  101. package/src/lib/server/catalog.js.map +1 -1
  102. package/src/lib/server/checkout-session-expiry.d.ts +1 -1
  103. package/src/lib/server/checkout-session-expiry.js +19 -5
  104. package/src/lib/server/checkout-session-expiry.js.map +1 -1
  105. package/src/lib/server/checkout-status.js +4 -3
  106. package/src/lib/server/checkout-status.js.map +1 -1
  107. package/src/lib/server/checkout.js +98 -26
  108. package/src/lib/server/checkout.js.map +1 -1
  109. package/src/lib/server/connect.js +42 -11
  110. package/src/lib/server/connect.js.map +1 -1
  111. package/src/lib/server/draft-order.js +36 -7
  112. package/src/lib/server/draft-order.js.map +1 -1
  113. package/src/lib/server/manual-tax-rate.d.ts +11 -3
  114. package/src/lib/server/manual-tax-rate.js +10 -6
  115. package/src/lib/server/manual-tax-rate.js.map +1 -1
  116. package/src/lib/server/membership-account.d.ts +22 -0
  117. package/src/lib/server/membership-account.js +52 -8
  118. package/src/lib/server/membership-account.js.map +1 -1
  119. package/src/lib/server/native-checkout.d.ts +10 -3
  120. package/src/lib/server/native-checkout.js +8 -3
  121. package/src/lib/server/native-checkout.js.map +1 -1
  122. package/src/lib/server/payment-method-domains.d.ts +50 -9
  123. package/src/lib/server/payment-method-domains.js +150 -51
  124. package/src/lib/server/payment-method-domains.js.map +1 -1
  125. package/src/lib/server/payment-methods.js +3 -2
  126. package/src/lib/server/payment-methods.js.map +1 -1
  127. package/src/lib/server/pos-auth.d.ts +3 -3
  128. package/src/lib/server/pos-auth.js +3 -3
  129. package/src/lib/server/pos-auth.js.map +1 -1
  130. package/src/lib/server/pos-cellular-billing.js +1 -1
  131. package/src/lib/server/pos-cellular-billing.js.map +1 -1
  132. package/src/lib/server/pos-cellular-notify.js +1 -1
  133. package/src/lib/server/pos-cellular-notify.js.map +1 -1
  134. package/src/lib/server/pos-cellular.js +1 -1
  135. package/src/lib/server/pos-cellular.js.map +1 -1
  136. package/src/lib/server/pos-hardware-admin.js +86 -13
  137. package/src/lib/server/pos-hardware-admin.js.map +1 -1
  138. package/src/lib/server/pos-hardware-attach.js +5 -5
  139. package/src/lib/server/pos-hardware-attach.js.map +1 -1
  140. package/src/lib/server/pos-hardware-cancel.js +65 -0
  141. package/src/lib/server/pos-hardware-cancel.js.map +1 -1
  142. package/src/lib/server/pos-hardware-closure-notices.js +2 -5
  143. package/src/lib/server/pos-hardware-closure-notices.js.map +1 -1
  144. package/src/lib/server/pos-hardware-closure.js +5 -8
  145. package/src/lib/server/pos-hardware-closure.js.map +1 -1
  146. package/src/lib/server/pos-hardware-in-person.d.ts +2 -1
  147. package/src/lib/server/pos-hardware-in-person.js +72 -17
  148. package/src/lib/server/pos-hardware-in-person.js.map +1 -1
  149. package/src/lib/server/pos-hardware-notify.d.ts +2 -0
  150. package/src/lib/server/pos-hardware-notify.js +30 -5
  151. package/src/lib/server/pos-hardware-notify.js.map +1 -1
  152. package/src/lib/server/pos-hardware-readers.d.ts +25 -0
  153. package/src/lib/server/pos-hardware-readers.js +206 -85
  154. package/src/lib/server/pos-hardware-readers.js.map +1 -1
  155. package/src/lib/server/pos-hardware-returns.d.ts +8 -3
  156. package/src/lib/server/pos-hardware-returns.js +39 -7
  157. package/src/lib/server/pos-hardware-returns.js.map +1 -1
  158. package/src/lib/server/pos-hardware-sale-fields.d.ts +76 -0
  159. package/src/lib/server/pos-hardware-sale-fields.js +114 -1
  160. package/src/lib/server/pos-hardware-sale-fields.js.map +1 -1
  161. package/src/lib/server/pos-hardware-sale.d.ts +2 -0
  162. package/src/lib/server/pos-hardware-sale.js +1 -0
  163. package/src/lib/server/pos-hardware-sale.js.map +1 -1
  164. package/src/lib/server/pos-hardware-tax-return-source.js +7 -4
  165. package/src/lib/server/pos-hardware-tax-return-source.js.map +1 -1
  166. package/src/lib/server/pos-hardware-webhook.js +16 -3
  167. package/src/lib/server/pos-hardware-webhook.js.map +1 -1
  168. package/src/lib/server/pos-hardware.d.ts +14 -3
  169. package/src/lib/server/pos-hardware.js +83 -18
  170. package/src/lib/server/pos-hardware.js.map +1 -1
  171. package/src/lib/server/pos-ops-routes.js +2 -10
  172. package/src/lib/server/pos-ops-routes.js.map +1 -1
  173. package/src/lib/server/pos-order.js +5 -1
  174. package/src/lib/server/pos-order.js.map +1 -1
  175. package/src/lib/server/pos-stripe.d.ts +7 -7
  176. package/src/lib/server/pos-stripe.js +15 -13
  177. package/src/lib/server/pos-stripe.js.map +1 -1
  178. package/src/lib/server/pos-terminal.js +11 -3
  179. package/src/lib/server/pos-terminal.js.map +1 -1
  180. package/src/lib/server/quote-pay.d.ts +23 -1
  181. package/src/lib/server/quote-pay.js +111 -27
  182. package/src/lib/server/quote-pay.js.map +1 -1
  183. package/src/lib/server/quote.d.ts +2 -1
  184. package/src/lib/server/quote.js +12 -11
  185. package/src/lib/server/quote.js.map +1 -1
  186. package/src/lib/server/refund.js +13 -6
  187. package/src/lib/server/refund.js.map +1 -1
  188. package/src/lib/server/related.js +10 -3
  189. package/src/lib/server/related.js.map +1 -1
  190. package/src/lib/server/reserve.js +19 -6
  191. package/src/lib/server/reserve.js.map +1 -1
  192. package/src/lib/server/revenue-source.d.ts +6 -0
  193. package/src/lib/server/revenue-source.js +25 -9
  194. package/src/lib/server/revenue-source.js.map +1 -1
  195. package/src/lib/server/seller-stripe-account.d.ts +45 -0
  196. package/src/lib/server/seller-stripe-account.js +99 -0
  197. package/src/lib/server/seller-stripe-account.js.map +1 -0
  198. package/src/lib/server/storefront-tax-record.js +6 -1
  199. package/src/lib/server/storefront-tax-record.js.map +1 -1
  200. package/src/lib/server/storefront-tax.d.ts +33 -2
  201. package/src/lib/server/storefront-tax.js +39 -3
  202. package/src/lib/server/storefront-tax.js.map +1 -1
  203. package/src/lib/server/stream.d.ts +2 -0
  204. package/src/lib/server/stream.js +22 -2
  205. package/src/lib/server/stream.js.map +1 -1
  206. package/src/lib/server/stripe-refund.d.ts +15 -0
  207. package/src/lib/server/stripe-refund.js +54 -26
  208. package/src/lib/server/stripe-refund.js.map +1 -1
  209. package/src/lib/server/subscription-portal.js +8 -3
  210. package/src/lib/server/subscription-portal.js.map +1 -1
  211. package/src/lib/server/tax-return-source.js +5 -1
  212. package/src/lib/server/tax-return-source.js.map +1 -1
  213. package/src/lib/server.js +2 -2
  214. package/src/lib/server.js.map +1 -1
@@ -14,6 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { type BuyNowPayLaterPaymentMethodType } from '@aglyn/aglyn/app-utils/buy-now-pay-later';
17
18
  /**
18
19
  * The storefront payment methods a merchant chooses between (AGL-3629).
19
20
  *
@@ -37,17 +38,29 @@
37
38
  * reaches the hosted page; Apple Pay and Google Pay on a hosted Stripe page
38
39
  * follow the device and cannot be hidden per merchant.
39
40
  *
41
+ * ## Buy-now-pay-later is never offered (AGL-4198)
42
+ *
43
+ * Klarna, Afterpay and Affirm are not in this catalog and are excluded on every
44
+ * session (`BUY_NOW_PAY_LATER_PAYMENT_METHOD_TYPES`), whatever a store chose
45
+ * before. They cost Stripe about 6% + 30¢ against 2.9% + 30¢ for a card, and
46
+ * the platform's fee is fixed before the shopper picks how to pay, so offering
47
+ * them would size every fee for the dearest method.
48
+ *
40
49
  * ## Why toggling a method never moves a fee
41
50
  *
42
- * `application_fee_amount` is priced against the dearest method the platform
43
- * could offer (`SALE_PROCESSING_PERCENT`, the BNPL rate), because the shopper
44
- * picks how to pay after the fee is fixed. Every method here costs Stripe that
45
- * much or less, so turning one off or on changes what a shopper may choose and
46
- * never what the platform recovers.
51
+ * `application_fee_amount` is priced at the card rate
52
+ * (`SALE_PROCESSING_PERCENT`). Every method in this catalog costs Stripe that
53
+ * much or less (Apple Pay, Google Pay, Link, Cash App Pay and Amazon Pay are
54
+ * 2.9% + 30¢ on Stripe's US pricing, stablecoins 1.5%), so turning one off or
55
+ * on changes what a shopper may choose and never what the platform recovers.
56
+ * A method added here must cost no more than a card; the catalog spec holds
57
+ * the list.
47
58
  */
48
59
  /** A method the merchant may switch off (or, for crypto, on). */
49
- export type StorefrontPaymentMethodId = 'apple_pay' | 'google_pay' | 'link' | 'klarna' | 'afterpay_clearpay' | 'affirm' | 'cashapp' | 'amazon_pay' | 'crypto';
50
- export type StorefrontPaymentMethodKind = 'wallet' | 'bnpl' | 'crypto';
60
+ export type StorefrontPaymentMethodId = 'apple_pay' | 'google_pay' | 'link' | 'cashapp' | 'amazon_pay' | 'crypto';
61
+ export type StorefrontPaymentMethodKind = 'wallet' | 'crypto';
62
+ /** A method a session excludes: one the merchant switched off, or buy-now-pay-later. */
63
+ export type ExcludedPaymentMethodType = StorefrontPaymentMethodId | BuyNowPayLaterPaymentMethodType;
51
64
  /** How a toggle reaches Stripe. */
52
65
  export type StorefrontPaymentMethodControl =
53
66
  /** The Payment Element's `wallets` option (and, for Link, the session). */
@@ -115,8 +128,8 @@ export interface StorefrontCheckoutWallets {
115
128
  link: StorefrontWalletDisplay;
116
129
  }
117
130
  export interface StorefrontPaymentMethodControls {
118
- /** Sent as `excluded_payment_method_types[n]`, in catalog order. */
119
- excluded: StorefrontPaymentMethodId[];
131
+ /** Sent as `excluded_payment_method_types[n]`: buy-now-pay-later, then the merchant's, in catalog order. */
132
+ excluded: ExcludedPaymentMethodType[];
120
133
  /** Handed to the Payment Element. */
121
134
  wallets: StorefrontCheckoutWallets;
122
135
  }
@@ -124,16 +137,14 @@ export interface StorefrontPaymentMethodControls {
124
137
  * What one checkout session sends Stripe for the merchant's choices.
125
138
  *
126
139
  * A method the merchant left on is NOT added anywhere: dynamic payment methods
127
- * already offer it when the platform does and the order qualifies. Only the
128
- * methods turned off are named, which is why a merchant who never opened the
129
- * card produces the same session as before AGL-3629 — except crypto, which is
130
- * excluded until chosen, and was never offered by the platform before either.
140
+ * already offer it when the platform does and the order qualifies. Named are
141
+ * buy-now-pay-later, always (AGL-4198), then the methods turned off, which
142
+ * include crypto until it is chosen.
131
143
  */
132
144
  export declare function resolveStorefrontPaymentMethodControls(settings: StorefrontPaymentMethodSettings | null | undefined): StorefrontPaymentMethodControls;
133
145
  /**
134
- * Write the controls onto a Checkout Session param set. Leaves the params
135
- * untouched when the merchant hid nothing, so a store with default settings —
136
- * apart from the crypto opt-in — sends what it always sent.
146
+ * Write the controls onto a Checkout Session param set: every exclusion in
147
+ * order, and Link hidden on the session when the merchant hid it.
137
148
  */
138
149
  export declare function appendStorefrontPaymentMethodParams(params: URLSearchParams, controls: StorefrontPaymentMethodControls): void;
139
150
  /** True when the browser has to be told about a hidden wallet at all. */
@@ -13,37 +13,8 @@
13
13
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
- */ /**
17
- * The storefront payment methods a merchant chooses between (AGL-3629).
18
- *
19
- * ## Who decides what a shopper sees
20
- *
21
- * Every storefront charge is a DESTINATION charge with no `on_behalf_of`, so
22
- * the PLATFORM is the merchant of record and Stripe offers the methods the
23
- * platform's payment method configuration turns on ("dynamic payment
24
- * methods"), filtered by currency, amount, the shopper's country and device.
25
- * No session pins `payment_method_types`. A merchant therefore cannot ADD a
26
- * method the platform does not offer — they can only take one away, and that
27
- * is what the two levers below do:
28
- *
29
- * - `excluded_payment_method_types` on the Checkout Session, for every method
30
- * Stripe lets a session exclude. Measured accepted at both the account
31
- * default API version and the native checkout's pinned dahlia version, so
32
- * it applies to the in-page checkout AND the hosted Stripe page alike.
33
- * - The Payment Element's `wallets` option for Apple Pay, Google Pay and
34
- * Link, which Stripe documents as NOT excludable per session. Link is also
35
- * hidden on the session with `wallet_options[link][display]=never`, which
36
- * reaches the hosted page; Apple Pay and Google Pay on a hosted Stripe page
37
- * follow the device and cannot be hidden per merchant.
38
- *
39
- * ## Why toggling a method never moves a fee
40
- *
41
- * `application_fee_amount` is priced against the dearest method the platform
42
- * could offer (`SALE_PROCESSING_PERCENT`, the BNPL rate), because the shopper
43
- * picks how to pay after the fee is fixed. Every method here costs Stripe that
44
- * much or less, so turning one off or on changes what a shopper may choose and
45
- * never what the platform recovers.
46
- */ /** A method the merchant may switch off (or, for crypto, on). */ /**
16
+ */ import { BUY_NOW_PAY_LATER_PAYMENT_METHOD_TYPES } from "@aglyn/aglyn/app-utils/buy-now-pay-later";
17
+ /**
47
18
  * The catalog, in the order the settings card lists it. Limits are Stripe's
48
19
  * published US figures (docs.stripe.com/payments/buy-now-pay-later and each
49
20
  * method's page, read 2026-10-07); Stripe applies them itself, and they are
@@ -85,50 +56,6 @@
85
56
  subscriptions: true,
86
57
  needsDomain: true
87
58
  },
88
- {
89
- id: 'klarna',
90
- label: 'Klarna',
91
- kind: 'bnpl',
92
- control: 'exclude',
93
- defaultOn: true,
94
- capability: 'klarna_payments',
95
- configurationKey: 'klarna',
96
- requirements: 'US shoppers paying in USD. Pay in full, in 30 days, in 4, or monthly financing.',
97
- limits: 'From $10; the highest amount depends on the shopper (financing up to $10,000).',
98
- minCents: 1000,
99
- subscriptions: true,
100
- needsDomain: false
101
- },
102
- {
103
- id: 'afterpay_clearpay',
104
- label: 'Afterpay',
105
- kind: 'bnpl',
106
- control: 'exclude',
107
- defaultOn: true,
108
- capability: 'afterpay_clearpay_payments',
109
- configurationKey: 'afterpay_clearpay',
110
- requirements: 'US shoppers paying in USD. Pay in 4 interest-free installments.',
111
- limits: '$1 to $4,000. One-time purchases only.',
112
- minCents: 100,
113
- maxCents: 400000,
114
- subscriptions: false,
115
- needsDomain: false
116
- },
117
- {
118
- id: 'affirm',
119
- label: 'Affirm',
120
- kind: 'bnpl',
121
- control: 'exclude',
122
- defaultOn: true,
123
- capability: 'affirm_payments',
124
- configurationKey: 'affirm',
125
- requirements: 'US shoppers paying in USD. Pay in 4, or monthly installments up to 36 months.',
126
- limits: '$50 to $30,000. One-time purchases only.',
127
- minCents: 5000,
128
- maxCents: 3000000,
129
- subscriptions: false,
130
- needsDomain: false
131
- },
132
59
  {
133
60
  id: 'cashapp',
134
61
  label: 'Cash App Pay',
@@ -198,12 +125,14 @@ export function storefrontPaymentMethodSpec(id) {
198
125
  * What one checkout session sends Stripe for the merchant's choices.
199
126
  *
200
127
  * A method the merchant left on is NOT added anywhere: dynamic payment methods
201
- * already offer it when the platform does and the order qualifies. Only the
202
- * methods turned off are named, which is why a merchant who never opened the
203
- * card produces the same session as before AGL-3629 — except crypto, which is
204
- * excluded until chosen, and was never offered by the platform before either.
128
+ * already offer it when the platform does and the order qualifies. Named are
129
+ * buy-now-pay-later, always (AGL-4198), then the methods turned off, which
130
+ * include crypto until it is chosen.
205
131
  */ export function resolveStorefrontPaymentMethodControls(settings) {
206
- const excluded = STOREFRONT_PAYMENT_METHODS.filter((method)=>method.control === 'exclude' && !isStorefrontPaymentMethodOn(settings, method.id)).map((method)=>method.id);
132
+ const excluded = [
133
+ ...BUY_NOW_PAY_LATER_PAYMENT_METHOD_TYPES,
134
+ ...STOREFRONT_PAYMENT_METHODS.filter((method)=>method.control === 'exclude' && !isStorefrontPaymentMethodOn(settings, method.id)).map((method)=>method.id)
135
+ ];
207
136
  const display = (id)=>isStorefrontPaymentMethodOn(settings, id) ? 'auto' : 'never';
208
137
  return {
209
138
  excluded,
@@ -215,9 +144,8 @@ export function storefrontPaymentMethodSpec(id) {
215
144
  };
216
145
  }
217
146
  /**
218
- * Write the controls onto a Checkout Session param set. Leaves the params
219
- * untouched when the merchant hid nothing, so a store with default settings —
220
- * apart from the crypto opt-in — sends what it always sent.
147
+ * Write the controls onto a Checkout Session param set: every exclusion in
148
+ * order, and Link hidden on the session when the merchant hid it.
221
149
  */ export function appendStorefrontPaymentMethodParams(params, controls) {
222
150
  controls.excluded.forEach((id, index)=>{
223
151
  params.set(`excluded_payment_method_types[${index}]`, id);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/commerce-payment-methods.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The storefront payment methods a merchant chooses between (AGL-3629).\n *\n * ## Who decides what a shopper sees\n *\n * Every storefront charge is a DESTINATION charge with no `on_behalf_of`, so\n * the PLATFORM is the merchant of record and Stripe offers the methods the\n * platform's payment method configuration turns on (\"dynamic payment\n * methods\"), filtered by currency, amount, the shopper's country and device.\n * No session pins `payment_method_types`. A merchant therefore cannot ADD a\n * method the platform does not offer — they can only take one away, and that\n * is what the two levers below do:\n *\n * - `excluded_payment_method_types` on the Checkout Session, for every method\n * Stripe lets a session exclude. Measured accepted at both the account\n * default API version and the native checkout's pinned dahlia version, so\n * it applies to the in-page checkout AND the hosted Stripe page alike.\n * - The Payment Element's `wallets` option for Apple Pay, Google Pay and\n * Link, which Stripe documents as NOT excludable per session. Link is also\n * hidden on the session with `wallet_options[link][display]=never`, which\n * reaches the hosted page; Apple Pay and Google Pay on a hosted Stripe page\n * follow the device and cannot be hidden per merchant.\n *\n * ## Why toggling a method never moves a fee\n *\n * `application_fee_amount` is priced against the dearest method the platform\n * could offer (`SALE_PROCESSING_PERCENT`, the BNPL rate), because the shopper\n * picks how to pay after the fee is fixed. Every method here costs Stripe that\n * much or less, so turning one off or on changes what a shopper may choose and\n * never what the platform recovers.\n */\n\n/** A method the merchant may switch off (or, for crypto, on). */\nexport type StorefrontPaymentMethodId =\n | 'apple_pay'\n | 'google_pay'\n | 'link'\n | 'klarna'\n | 'afterpay_clearpay'\n | 'affirm'\n | 'cashapp'\n | 'amazon_pay'\n | 'crypto'\n\nexport type StorefrontPaymentMethodKind = 'wallet' | 'bnpl' | 'crypto'\n\n/** How a toggle reaches Stripe. */\nexport type StorefrontPaymentMethodControl =\n /** The Payment Element's `wallets` option (and, for Link, the session). */\n | 'wallet'\n /** `excluded_payment_method_types` on the Checkout Session. */\n | 'exclude'\n\nexport interface StorefrontPaymentMethodSpec {\n id: StorefrontPaymentMethodId\n label: string\n kind: StorefrontPaymentMethodKind\n control: StorefrontPaymentMethodControl\n /**\n * On when the merchant has never chosen. Every method that was already\n * reaching shoppers before AGL-3629 defaults on, so saving nothing changes\n * nothing; crypto, which settles differently and cannot be disputed,\n * defaults off and is the merchant's to opt into.\n */\n defaultOn: boolean\n /**\n * The connected-account capability Stripe asks platforms to request before\n * the method is accepted for that account. Absent for the card wallets,\n * which ride `card_payments`.\n */\n capability?: string\n /** The platform payment method configuration's key for this method. */\n configurationKey: string\n /** What a shopper needs, in a sentence the settings card shows. */\n requirements: string\n /** Amount and currency limits, as Stripe publishes them for US accounts. */\n limits: string\n /** Lowest charge Stripe offers it for, in USD cents, when published. */\n minCents?: number\n /** Highest charge Stripe offers it for, in USD cents, when published. */\n maxCents?: number\n /** False where Stripe does not offer it in a subscription-mode session. */\n subscriptions: boolean\n /** Shown on a registered domain only (Apple Pay must be; the rest benefit). */\n needsDomain: boolean\n}\n\n/**\n * The catalog, in the order the settings card lists it. Limits are Stripe's\n * published US figures (docs.stripe.com/payments/buy-now-pay-later and each\n * method's page, read 2026-10-07); Stripe applies them itself, and they are\n * here so a merchant can read why a method did not appear on an order.\n */\nexport const STOREFRONT_PAYMENT_METHODS: readonly StorefrontPaymentMethodSpec[] = [\n {\n id: 'apple_pay',\n label: 'Apple Pay',\n kind: 'wallet',\n control: 'wallet',\n defaultOn: true,\n configurationKey: 'apple_pay',\n requirements:\n 'Safari on a Mac, iPhone or iPad with a card in Apple Wallet. Your site’s domain is registered with Apple Pay for you.',\n limits: 'Same as cards.',\n subscriptions: true,\n needsDomain: true,\n },\n {\n id: 'google_pay',\n label: 'Google Pay',\n kind: 'wallet',\n control: 'wallet',\n defaultOn: true,\n configurationKey: 'google_pay',\n requirements:\n 'Chrome or an Android device with a card saved to Google Pay. With Stripe Tax on, Google Pay shows when the checkout collects a shipping address.',\n limits: 'Same as cards.',\n subscriptions: true,\n needsDomain: true,\n },\n {\n id: 'link',\n label: 'Link',\n kind: 'wallet',\n control: 'wallet',\n defaultOn: true,\n configurationKey: 'link',\n requirements: 'Shoppers who saved a card or bank with Link check out in one step.',\n limits: 'Same as cards.',\n subscriptions: true,\n needsDomain: true,\n },\n {\n id: 'klarna',\n label: 'Klarna',\n kind: 'bnpl',\n control: 'exclude',\n defaultOn: true,\n capability: 'klarna_payments',\n configurationKey: 'klarna',\n requirements:\n 'US shoppers paying in USD. Pay in full, in 30 days, in 4, or monthly financing.',\n limits: 'From $10; the highest amount depends on the shopper (financing up to $10,000).',\n minCents: 1000,\n subscriptions: true,\n needsDomain: false,\n },\n {\n id: 'afterpay_clearpay',\n label: 'Afterpay',\n kind: 'bnpl',\n control: 'exclude',\n defaultOn: true,\n capability: 'afterpay_clearpay_payments',\n configurationKey: 'afterpay_clearpay',\n requirements: 'US shoppers paying in USD. Pay in 4 interest-free installments.',\n limits: '$1 to $4,000. One-time purchases only.',\n minCents: 100,\n maxCents: 400_000,\n subscriptions: false,\n needsDomain: false,\n },\n {\n id: 'affirm',\n label: 'Affirm',\n kind: 'bnpl',\n control: 'exclude',\n defaultOn: true,\n capability: 'affirm_payments',\n configurationKey: 'affirm',\n requirements:\n 'US shoppers paying in USD. Pay in 4, or monthly installments up to 36 months.',\n limits: '$50 to $30,000. One-time purchases only.',\n minCents: 5_000,\n maxCents: 3_000_000,\n subscriptions: false,\n needsDomain: false,\n },\n {\n id: 'cashapp',\n label: 'Cash App Pay',\n kind: 'wallet',\n control: 'exclude',\n defaultOn: true,\n capability: 'cashapp_payments',\n configurationKey: 'cashapp',\n requirements: 'US shoppers with Cash App, paying in USD.',\n limits: 'USD only.',\n subscriptions: true,\n needsDomain: false,\n },\n {\n id: 'amazon_pay',\n label: 'Amazon Pay',\n kind: 'wallet',\n control: 'exclude',\n defaultOn: true,\n capability: 'amazon_pay_payments',\n configurationKey: 'amazon_pay',\n requirements: 'Shoppers pay with the card and address saved to their Amazon account.',\n limits: 'USD only.',\n subscriptions: true,\n needsDomain: true,\n },\n {\n id: 'crypto',\n label: 'Stablecoins (crypto)',\n kind: 'crypto',\n control: 'exclude',\n defaultOn: false,\n capability: 'crypto_payments',\n configurationKey: 'crypto',\n requirements:\n 'Shoppers pay in USDC or another supported stablecoin from their crypto wallet; you are paid in USD. Refunds go back to the shopper’s wallet as stablecoins, and these payments cannot be disputed.',\n limits: 'USD only, up to $10,000 per payment.',\n maxCents: 1_000_000,\n subscriptions: true,\n needsDomain: false,\n },\n]\n\n/** The merchant's choices, as stored on `hosts/{hostId}/settings/store`. */\nexport type StorefrontPaymentMethodSettings = Partial<\n Record<StorefrontPaymentMethodId, boolean>\n>\n\nexport const STOREFRONT_PAYMENT_METHOD_IDS: readonly StorefrontPaymentMethodId[] =\n STOREFRONT_PAYMENT_METHODS.map((method) => method.id)\n\nexport function storefrontPaymentMethodSpec(\n id: string,\n): StorefrontPaymentMethodSpec | undefined {\n return STOREFRONT_PAYMENT_METHODS.find((method) => method.id === id)\n}\n\n/**\n * Keep only booleans under known ids. The settings document is written by the\n * console, so anything else on it — a string, a removed method, a typo — is\n * read as \"never chosen\" rather than trusted.\n */\nexport function normalizeStorefrontPaymentMethodSettings(\n raw: unknown,\n): StorefrontPaymentMethodSettings {\n const out: StorefrontPaymentMethodSettings = {}\n if (!raw || typeof raw !== 'object') return out\n for (const id of STOREFRONT_PAYMENT_METHOD_IDS) {\n const value = (raw as Record<string, unknown>)[id]\n if (typeof value === 'boolean') out[id] = value\n }\n return out\n}\n\n/** Whether the merchant offers a method: their choice, else its default. */\nexport function isStorefrontPaymentMethodOn(\n settings: StorefrontPaymentMethodSettings | null | undefined,\n id: StorefrontPaymentMethodId,\n): boolean {\n const chosen = settings?.[id]\n if (typeof chosen === 'boolean') return chosen\n return storefrontPaymentMethodSpec(id)?.defaultOn ?? false\n}\n\n/** `auto` lets Stripe decide from the device; `never` hides the wallet. */\nexport type StorefrontWalletDisplay = 'auto' | 'never'\n\n/** The Payment Element's `wallets` option, as the browser receives it. */\nexport interface StorefrontCheckoutWallets {\n applePay: StorefrontWalletDisplay\n googlePay: StorefrontWalletDisplay\n link: StorefrontWalletDisplay\n}\n\nexport interface StorefrontPaymentMethodControls {\n /** Sent as `excluded_payment_method_types[n]`, in catalog order. */\n excluded: StorefrontPaymentMethodId[]\n /** Handed to the Payment Element. */\n wallets: StorefrontCheckoutWallets\n}\n\n/**\n * What one checkout session sends Stripe for the merchant's choices.\n *\n * A method the merchant left on is NOT added anywhere: dynamic payment methods\n * already offer it when the platform does and the order qualifies. Only the\n * methods turned off are named, which is why a merchant who never opened the\n * card produces the same session as before AGL-3629 — except crypto, which is\n * excluded until chosen, and was never offered by the platform before either.\n */\nexport function resolveStorefrontPaymentMethodControls(\n settings: StorefrontPaymentMethodSettings | null | undefined,\n): StorefrontPaymentMethodControls {\n const excluded = STOREFRONT_PAYMENT_METHODS.filter(\n (method) =>\n method.control === 'exclude' && !isStorefrontPaymentMethodOn(settings, method.id),\n ).map((method) => method.id)\n const display = (id: StorefrontPaymentMethodId): StorefrontWalletDisplay =>\n isStorefrontPaymentMethodOn(settings, id) ? 'auto' : 'never'\n return {\n excluded,\n wallets: {\n applePay: display('apple_pay'),\n googlePay: display('google_pay'),\n link: display('link'),\n },\n }\n}\n\n/**\n * Write the controls onto a Checkout Session param set. Leaves the params\n * untouched when the merchant hid nothing, so a store with default settings —\n * apart from the crypto opt-in — sends what it always sent.\n */\nexport function appendStorefrontPaymentMethodParams(\n params: URLSearchParams,\n controls: StorefrontPaymentMethodControls,\n): void {\n controls.excluded.forEach((id, index) => {\n params.set(`excluded_payment_method_types[${index}]`, id)\n })\n if (controls.wallets.link === 'never') {\n params.set('wallet_options[link][display]', 'never')\n }\n}\n\n/** True when the browser has to be told about a hidden wallet at all. */\nexport function storefrontWalletsHideAny(wallets: StorefrontCheckoutWallets): boolean {\n return (\n wallets.applePay === 'never' ||\n wallets.googlePay === 'never' ||\n wallets.link === 'never'\n )\n}\n\n/**\n * The `wallets` a checkout response carries, as the browser reads it. Anything\n * that is not exactly `'auto'` or `'never'` is dropped, so a malformed or old\n * response shows every wallet rather than breaking the payment form.\n */\nexport function readStorefrontCheckoutWallets(\n raw: unknown,\n): StorefrontCheckoutWallets | undefined {\n if (!raw || typeof raw !== 'object') return undefined\n const value = (key: string): StorefrontWalletDisplay =>\n (raw as Record<string, unknown>)[key] === 'never' ? 'never' : 'auto'\n const wallets: StorefrontCheckoutWallets = {\n applePay: value('applePay'),\n googlePay: value('googlePay'),\n link: value('link'),\n }\n return storefrontWalletsHideAny(wallets) ? wallets : undefined\n}\n"],"names":["STOREFRONT_PAYMENT_METHODS","id","label","kind","control","defaultOn","configurationKey","requirements","limits","subscriptions","needsDomain","capability","minCents","maxCents","STOREFRONT_PAYMENT_METHOD_IDS","map","method","storefrontPaymentMethodSpec","find","normalizeStorefrontPaymentMethodSettings","raw","out","value","isStorefrontPaymentMethodOn","settings","chosen","resolveStorefrontPaymentMethodControls","excluded","filter","display","wallets","applePay","googlePay","link","appendStorefrontPaymentMethodParams","params","controls","forEach","index","set","storefrontWalletsHideAny","readStorefrontCheckoutWallets","undefined","key"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BC,GAED,+DAA+D,GAuD/D;;;;;CAKC,GACD,OAAO,MAAMA,6BAAqE;IAChF;QACEC,IAAI;QACJC,OAAO;QACPC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXC,kBAAkB;QAClBC,cACE;QACFC,QAAQ;QACRC,eAAe;QACfC,aAAa;IACf;IACA;QACET,IAAI;QACJC,OAAO;QACPC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXC,kBAAkB;QAClBC,cACE;QACFC,QAAQ;QACRC,eAAe;QACfC,aAAa;IACf;IACA;QACET,IAAI;QACJC,OAAO;QACPC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXC,kBAAkB;QAClBC,cAAc;QACdC,QAAQ;QACRC,eAAe;QACfC,aAAa;IACf;IACA;QACET,IAAI;QACJC,OAAO;QACPC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AQG,IAAI,KAAK;AAErB;AAEA;;;;CAIC,GACD,OAAO,SAASQ,8BACdrB,GAAY;IAEZ,IAAI,CAACA,OAAO,OAAOA,QAAQ,UAAU,OAAOsB;IAC5C,MAAMpB,QAAQ,CAACqB,MACb,AAACvB,GAA+B,CAACuB,IAAI,KAAK,UAAU,UAAU;IAChE,MAAMb,UAAqC;QACzCC,UAAUT,MAAM;QAChBU,WAAWV,MAAM;QACjBW,MAAMX,MAAM;IACd;IACA,OAAOkB,yBAAyBV,WAAWA,UAAUY;AACvD"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/commerce-payment-methods.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n BUY_NOW_PAY_LATER_PAYMENT_METHOD_TYPES,\n type BuyNowPayLaterPaymentMethodType,\n} from '@aglyn/aglyn/app-utils/buy-now-pay-later'\n\n/**\n * The storefront payment methods a merchant chooses between (AGL-3629).\n *\n * ## Who decides what a shopper sees\n *\n * Every storefront charge is a DESTINATION charge with no `on_behalf_of`, so\n * the PLATFORM is the merchant of record and Stripe offers the methods the\n * platform's payment method configuration turns on (\"dynamic payment\n * methods\"), filtered by currency, amount, the shopper's country and device.\n * No session pins `payment_method_types`. A merchant therefore cannot ADD a\n * method the platform does not offer — they can only take one away, and that\n * is what the two levers below do:\n *\n * - `excluded_payment_method_types` on the Checkout Session, for every method\n * Stripe lets a session exclude. Measured accepted at both the account\n * default API version and the native checkout's pinned dahlia version, so\n * it applies to the in-page checkout AND the hosted Stripe page alike.\n * - The Payment Element's `wallets` option for Apple Pay, Google Pay and\n * Link, which Stripe documents as NOT excludable per session. Link is also\n * hidden on the session with `wallet_options[link][display]=never`, which\n * reaches the hosted page; Apple Pay and Google Pay on a hosted Stripe page\n * follow the device and cannot be hidden per merchant.\n *\n * ## Buy-now-pay-later is never offered (AGL-4198)\n *\n * Klarna, Afterpay and Affirm are not in this catalog and are excluded on every\n * session (`BUY_NOW_PAY_LATER_PAYMENT_METHOD_TYPES`), whatever a store chose\n * before. They cost Stripe about 6% + 30¢ against 2.9% + 30¢ for a card, and\n * the platform's fee is fixed before the shopper picks how to pay, so offering\n * them would size every fee for the dearest method.\n *\n * ## Why toggling a method never moves a fee\n *\n * `application_fee_amount` is priced at the card rate\n * (`SALE_PROCESSING_PERCENT`). Every method in this catalog costs Stripe that\n * much or less (Apple Pay, Google Pay, Link, Cash App Pay and Amazon Pay are\n * 2.9% + 30¢ on Stripe's US pricing, stablecoins 1.5%), so turning one off or\n * on changes what a shopper may choose and never what the platform recovers.\n * A method added here must cost no more than a card; the catalog spec holds\n * the list.\n */\n\n/** A method the merchant may switch off (or, for crypto, on). */\nexport type StorefrontPaymentMethodId =\n | 'apple_pay'\n | 'google_pay'\n | 'link'\n | 'cashapp'\n | 'amazon_pay'\n | 'crypto'\n\nexport type StorefrontPaymentMethodKind = 'wallet' | 'crypto'\n\n/** A method a session excludes: one the merchant switched off, or buy-now-pay-later. */\nexport type ExcludedPaymentMethodType = StorefrontPaymentMethodId | BuyNowPayLaterPaymentMethodType\n\n/** How a toggle reaches Stripe. */\nexport type StorefrontPaymentMethodControl =\n /** The Payment Element's `wallets` option (and, for Link, the session). */\n | 'wallet'\n /** `excluded_payment_method_types` on the Checkout Session. */\n | 'exclude'\n\nexport interface StorefrontPaymentMethodSpec {\n id: StorefrontPaymentMethodId\n label: string\n kind: StorefrontPaymentMethodKind\n control: StorefrontPaymentMethodControl\n /**\n * On when the merchant has never chosen. Every method that was already\n * reaching shoppers before AGL-3629 defaults on, so saving nothing changes\n * nothing; crypto, which settles differently and cannot be disputed,\n * defaults off and is the merchant's to opt into.\n */\n defaultOn: boolean\n /**\n * The connected-account capability Stripe asks platforms to request before\n * the method is accepted for that account. Absent for the card wallets,\n * which ride `card_payments`.\n */\n capability?: string\n /** The platform payment method configuration's key for this method. */\n configurationKey: string\n /** What a shopper needs, in a sentence the settings card shows. */\n requirements: string\n /** Amount and currency limits, as Stripe publishes them for US accounts. */\n limits: string\n /** Lowest charge Stripe offers it for, in USD cents, when published. */\n minCents?: number\n /** Highest charge Stripe offers it for, in USD cents, when published. */\n maxCents?: number\n /** False where Stripe does not offer it in a subscription-mode session. */\n subscriptions: boolean\n /** Shown on a registered domain only (Apple Pay must be; the rest benefit). */\n needsDomain: boolean\n}\n\n/**\n * The catalog, in the order the settings card lists it. Limits are Stripe's\n * published US figures (docs.stripe.com/payments/buy-now-pay-later and each\n * method's page, read 2026-10-07); Stripe applies them itself, and they are\n * here so a merchant can read why a method did not appear on an order.\n */\nexport const STOREFRONT_PAYMENT_METHODS: readonly StorefrontPaymentMethodSpec[] = [\n {\n id: 'apple_pay',\n label: 'Apple Pay',\n kind: 'wallet',\n control: 'wallet',\n defaultOn: true,\n configurationKey: 'apple_pay',\n requirements:\n 'Safari on a Mac, iPhone or iPad with a card in Apple Wallet. Your site’s domain is registered with Apple Pay for you.',\n limits: 'Same as cards.',\n subscriptions: true,\n needsDomain: true,\n },\n {\n id: 'google_pay',\n label: 'Google Pay',\n kind: 'wallet',\n control: 'wallet',\n defaultOn: true,\n configurationKey: 'google_pay',\n requirements:\n 'Chrome or an Android device with a card saved to Google Pay. With Stripe Tax on, Google Pay shows when the checkout collects a shipping address.',\n limits: 'Same as cards.',\n subscriptions: true,\n needsDomain: true,\n },\n {\n id: 'link',\n label: 'Link',\n kind: 'wallet',\n control: 'wallet',\n defaultOn: true,\n configurationKey: 'link',\n requirements: 'Shoppers who saved a card or bank with Link check out in one step.',\n limits: 'Same as cards.',\n subscriptions: true,\n needsDomain: true,\n },\n {\n id: 'cashapp',\n label: 'Cash App Pay',\n kind: 'wallet',\n control: 'exclude',\n defaultOn: true,\n capability: 'cashapp_payments',\n configurationKey: 'cashapp',\n requirements: 'US shoppers with Cash App, paying in USD.',\n limits: 'USD only.',\n subscriptions: true,\n needsDomain: false,\n },\n {\n id: 'amazon_pay',\n label: 'Amazon Pay',\n kind: 'wallet',\n control: 'exclude',\n defaultOn: true,\n capability: 'amazon_pay_payments',\n configurationKey: 'amazon_pay',\n requirements: 'Shoppers pay with the card and address saved to their Amazon account.',\n limits: 'USD only.',\n subscriptions: true,\n needsDomain: true,\n },\n {\n id: 'crypto',\n label: 'Stablecoins (crypto)',\n kind: 'crypto',\n control: 'exclude',\n defaultOn: false,\n capability: 'crypto_payments',\n configurationKey: 'crypto',\n requirements:\n 'Shoppers pay in USDC or another supported stablecoin from their crypto wallet; you are paid in USD. Refunds go back to the shopper’s wallet as stablecoins, and these payments cannot be disputed.',\n limits: 'USD only, up to $10,000 per payment.',\n maxCents: 1_000_000,\n subscriptions: true,\n needsDomain: false,\n },\n]\n\n/** The merchant's choices, as stored on `hosts/{hostId}/settings/store`. */\nexport type StorefrontPaymentMethodSettings = Partial<\n Record<StorefrontPaymentMethodId, boolean>\n>\n\nexport const STOREFRONT_PAYMENT_METHOD_IDS: readonly StorefrontPaymentMethodId[] =\n STOREFRONT_PAYMENT_METHODS.map((method) => method.id)\n\nexport function storefrontPaymentMethodSpec(\n id: string,\n): StorefrontPaymentMethodSpec | undefined {\n return STOREFRONT_PAYMENT_METHODS.find((method) => method.id === id)\n}\n\n/**\n * Keep only booleans under known ids. The settings document is written by the\n * console, so anything else on it — a string, a removed method, a typo — is\n * read as \"never chosen\" rather than trusted.\n */\nexport function normalizeStorefrontPaymentMethodSettings(\n raw: unknown,\n): StorefrontPaymentMethodSettings {\n const out: StorefrontPaymentMethodSettings = {}\n if (!raw || typeof raw !== 'object') return out\n for (const id of STOREFRONT_PAYMENT_METHOD_IDS) {\n const value = (raw as Record<string, unknown>)[id]\n if (typeof value === 'boolean') out[id] = value\n }\n return out\n}\n\n/** Whether the merchant offers a method: their choice, else its default. */\nexport function isStorefrontPaymentMethodOn(\n settings: StorefrontPaymentMethodSettings | null | undefined,\n id: StorefrontPaymentMethodId,\n): boolean {\n const chosen = settings?.[id]\n if (typeof chosen === 'boolean') return chosen\n return storefrontPaymentMethodSpec(id)?.defaultOn ?? false\n}\n\n/** `auto` lets Stripe decide from the device; `never` hides the wallet. */\nexport type StorefrontWalletDisplay = 'auto' | 'never'\n\n/** The Payment Element's `wallets` option, as the browser receives it. */\nexport interface StorefrontCheckoutWallets {\n applePay: StorefrontWalletDisplay\n googlePay: StorefrontWalletDisplay\n link: StorefrontWalletDisplay\n}\n\nexport interface StorefrontPaymentMethodControls {\n /** Sent as `excluded_payment_method_types[n]`: buy-now-pay-later, then the merchant's, in catalog order. */\n excluded: ExcludedPaymentMethodType[]\n /** Handed to the Payment Element. */\n wallets: StorefrontCheckoutWallets\n}\n\n/**\n * What one checkout session sends Stripe for the merchant's choices.\n *\n * A method the merchant left on is NOT added anywhere: dynamic payment methods\n * already offer it when the platform does and the order qualifies. Named are\n * buy-now-pay-later, always (AGL-4198), then the methods turned off, which\n * include crypto until it is chosen.\n */\nexport function resolveStorefrontPaymentMethodControls(\n settings: StorefrontPaymentMethodSettings | null | undefined,\n): StorefrontPaymentMethodControls {\n const excluded: ExcludedPaymentMethodType[] = [\n ...BUY_NOW_PAY_LATER_PAYMENT_METHOD_TYPES,\n ...STOREFRONT_PAYMENT_METHODS.filter(\n (method) =>\n method.control === 'exclude' && !isStorefrontPaymentMethodOn(settings, method.id),\n ).map((method) => method.id),\n ]\n const display = (id: StorefrontPaymentMethodId): StorefrontWalletDisplay =>\n isStorefrontPaymentMethodOn(settings, id) ? 'auto' : 'never'\n return {\n excluded,\n wallets: {\n applePay: display('apple_pay'),\n googlePay: display('google_pay'),\n link: display('link'),\n },\n }\n}\n\n/**\n * Write the controls onto a Checkout Session param set: every exclusion in\n * order, and Link hidden on the session when the merchant hid it.\n */\nexport function appendStorefrontPaymentMethodParams(\n params: URLSearchParams,\n controls: StorefrontPaymentMethodControls,\n): void {\n controls.excluded.forEach((id, index) => {\n params.set(`excluded_payment_method_types[${index}]`, id)\n })\n if (controls.wallets.link === 'never') {\n params.set('wallet_options[link][display]', 'never')\n }\n}\n\n/** True when the browser has to be told about a hidden wallet at all. */\nexport function storefrontWalletsHideAny(wallets: StorefrontCheckoutWallets): boolean {\n return (\n wallets.applePay === 'never' ||\n wallets.googlePay === 'never' ||\n wallets.link === 'never'\n )\n}\n\n/**\n * The `wallets` a checkout response carries, as the browser reads it. Anything\n * that is not exactly `'auto'` or `'never'` is dropped, so a malformed or old\n * response shows every wallet rather than breaking the payment form.\n */\nexport function readStorefrontCheckoutWallets(\n raw: unknown,\n): StorefrontCheckoutWallets | undefined {\n if (!raw || typeof raw !== 'object') return undefined\n const value = (key: string): StorefrontWalletDisplay =>\n (raw as Record<string, unknown>)[key] === 'never' ? 'never' : 'auto'\n const wallets: StorefrontCheckoutWallets = {\n applePay: value('applePay'),\n googlePay: value('googlePay'),\n link: value('link'),\n }\n return storefrontWalletsHideAny(wallets) ? wallets : undefined\n}\n"],"names":["BUY_NOW_PAY_LATER_PAYMENT_METHOD_TYPES","STOREFRONT_PAYMENT_METHODS","id","label","kind","control","defaultOn","configurationKey","requirements","limits","subscriptions","needsDomain","capability","maxCents","STOREFRONT_PAYMENT_METHOD_IDS","map","method","storefrontPaymentMethodSpec","find","normalizeStorefrontPaymentMethodSettings","raw","out","value","isStorefrontPaymentMethodOn","settings","chosen","resolveStorefrontPaymentMethodControls","excluded","filter","display","wallets","applePay","googlePay","link","appendStorefrontPaymentMethodParams","params","controls","forEach","index","set","storefrontWalletsHideAny","readStorefrontCheckoutWallets","undefined","key"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,sCAAsC,QAEjC,2CAA0C;AAmGjD;;;;;CAKC,GACD,OAAO,MAAMC,6BAAqE;IACh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8BACdrB,GAAY;IAEZ,IAAI,CAACA,OAAO,OAAOA,QAAQ,UAAU,OAAOsB;IAC5C,MAAMpB,QAAQ,CAACqB,MACb,AAACvB,GAA+B,CAACuB,IAAI,KAAK,UAAU,UAAU;IAChE,MAAMb,UAAqC;QACzCC,UAAUT,MAAM;QAChBU,WAAWV,MAAM;QACjBW,MAAMX,MAAM;IACd;IACA,OAAOkB,yBAAyBV,WAAWA,UAAUY;AACvD"}
@@ -245,6 +245,12 @@ export interface HostProduct {
245
245
  url: string;
246
246
  title?: string;
247
247
  }>;
248
+ /**
249
+ * Other products whose buyers or subscribers may also watch this product's
250
+ * gated videos (AGL-4188): one tutorial library for every plan. Set by the
251
+ * merchant on the product, so a page cannot widen it.
252
+ */
253
+ videoAccessProductIds?: string[];
248
254
  /** Manual related products for the upsell block (AGL-325). */
249
255
  relatedProductIds?: string[];
250
256
  /**