@aglyn/plugins-commerce 1.14.0 → 1.15.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.
Files changed (152) 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 +30 -6
  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 +280 -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 +25 -5
  49. package/src/lib/components/product-detail.js.map +1 -1
  50. package/src/lib/constants/operator-alerts.d.ts +1 -1
  51. package/src/lib/constants/operator-alerts.js +4 -4
  52. package/src/lib/constants/operator-alerts.js.map +1 -1
  53. package/src/lib/model/commerce-orders.d.ts +6 -2
  54. package/src/lib/model/commerce-orders.js.map +1 -1
  55. package/src/lib/model/commerce-payment-methods.d.ts +24 -0
  56. package/src/lib/model/commerce-payment-methods.js +35 -0
  57. package/src/lib/model/commerce-payment-methods.js.map +1 -1
  58. package/src/lib/model/commerce.d.ts +6 -0
  59. package/src/lib/model/commerce.js.map +1 -1
  60. package/src/lib/model/index.d.ts +1 -0
  61. package/src/lib/model/index.js +1 -0
  62. package/src/lib/model/index.js.map +1 -1
  63. package/src/lib/model/paid-media.d.ts +8 -0
  64. package/src/lib/model/paid-media.js +13 -0
  65. package/src/lib/model/paid-media.js.map +1 -1
  66. package/src/lib/model/pos-hardware-in-person.d.ts +23 -2
  67. package/src/lib/model/pos-hardware-in-person.js +52 -20
  68. package/src/lib/model/pos-hardware-in-person.js.map +1 -1
  69. package/src/lib/model/pos-hardware-tax-summary.d.ts +5 -1
  70. package/src/lib/model/pos-hardware-tax-summary.js +2 -1
  71. package/src/lib/model/pos-hardware-tax-summary.js.map +1 -1
  72. package/src/lib/model/pos-hardware-terms.d.ts +37 -2
  73. package/src/lib/model/pos-hardware-terms.js +68 -3
  74. package/src/lib/model/pos-hardware-terms.js.map +1 -1
  75. package/src/lib/model/pos-hardware.d.ts +101 -15
  76. package/src/lib/model/pos-hardware.js +128 -18
  77. package/src/lib/model/pos-hardware.js.map +1 -1
  78. package/src/lib/model/pos-reader-splash.js +2 -2
  79. package/src/lib/model/pos-reader-splash.js.map +1 -1
  80. package/src/lib/model/product-write.d.ts +3 -0
  81. package/src/lib/model/subscription-view.d.ts +90 -0
  82. package/src/lib/model/subscription-view.js +176 -0
  83. package/src/lib/model/subscription-view.js.map +1 -0
  84. package/src/lib/server/billing-webhook.d.ts +4 -6
  85. package/src/lib/server/billing-webhook.js +109 -51
  86. package/src/lib/server/billing-webhook.js.map +1 -1
  87. package/src/lib/server/cart-checkout.js +45 -10
  88. package/src/lib/server/cart-checkout.js.map +1 -1
  89. package/src/lib/server/cart.js +15 -3
  90. package/src/lib/server/cart.js.map +1 -1
  91. package/src/lib/server/checkout.js +58 -16
  92. package/src/lib/server/checkout.js.map +1 -1
  93. package/src/lib/server/draft-order.js +7 -3
  94. package/src/lib/server/draft-order.js.map +1 -1
  95. package/src/lib/server/membership-account.d.ts +22 -0
  96. package/src/lib/server/membership-account.js +52 -8
  97. package/src/lib/server/membership-account.js.map +1 -1
  98. package/src/lib/server/pos-auth.d.ts +3 -3
  99. package/src/lib/server/pos-auth.js +3 -3
  100. package/src/lib/server/pos-auth.js.map +1 -1
  101. package/src/lib/server/pos-cellular-billing.js +1 -1
  102. package/src/lib/server/pos-cellular-billing.js.map +1 -1
  103. package/src/lib/server/pos-cellular-notify.js +1 -1
  104. package/src/lib/server/pos-cellular-notify.js.map +1 -1
  105. package/src/lib/server/pos-cellular.js +1 -1
  106. package/src/lib/server/pos-cellular.js.map +1 -1
  107. package/src/lib/server/pos-hardware-admin.js +86 -13
  108. package/src/lib/server/pos-hardware-admin.js.map +1 -1
  109. package/src/lib/server/pos-hardware-attach.js +5 -5
  110. package/src/lib/server/pos-hardware-attach.js.map +1 -1
  111. package/src/lib/server/pos-hardware-cancel.js +65 -0
  112. package/src/lib/server/pos-hardware-cancel.js.map +1 -1
  113. package/src/lib/server/pos-hardware-closure-notices.js +2 -5
  114. package/src/lib/server/pos-hardware-closure-notices.js.map +1 -1
  115. package/src/lib/server/pos-hardware-closure.js +5 -8
  116. package/src/lib/server/pos-hardware-closure.js.map +1 -1
  117. package/src/lib/server/pos-hardware-in-person.d.ts +2 -1
  118. package/src/lib/server/pos-hardware-in-person.js +72 -17
  119. package/src/lib/server/pos-hardware-in-person.js.map +1 -1
  120. package/src/lib/server/pos-hardware-notify.d.ts +2 -0
  121. package/src/lib/server/pos-hardware-notify.js +30 -5
  122. package/src/lib/server/pos-hardware-notify.js.map +1 -1
  123. package/src/lib/server/pos-hardware-readers.d.ts +25 -0
  124. package/src/lib/server/pos-hardware-readers.js +206 -85
  125. package/src/lib/server/pos-hardware-readers.js.map +1 -1
  126. package/src/lib/server/pos-hardware-returns.d.ts +8 -3
  127. package/src/lib/server/pos-hardware-returns.js +39 -7
  128. package/src/lib/server/pos-hardware-returns.js.map +1 -1
  129. package/src/lib/server/pos-hardware-sale-fields.d.ts +76 -0
  130. package/src/lib/server/pos-hardware-sale-fields.js +114 -1
  131. package/src/lib/server/pos-hardware-sale-fields.js.map +1 -1
  132. package/src/lib/server/pos-hardware-sale.d.ts +2 -0
  133. package/src/lib/server/pos-hardware-sale.js +1 -0
  134. package/src/lib/server/pos-hardware-sale.js.map +1 -1
  135. package/src/lib/server/pos-hardware-tax-return-source.js +7 -4
  136. package/src/lib/server/pos-hardware-tax-return-source.js.map +1 -1
  137. package/src/lib/server/pos-hardware-webhook.js +16 -3
  138. package/src/lib/server/pos-hardware-webhook.js.map +1 -1
  139. package/src/lib/server/pos-hardware.d.ts +14 -3
  140. package/src/lib/server/pos-hardware.js +83 -18
  141. package/src/lib/server/pos-hardware.js.map +1 -1
  142. package/src/lib/server/pos-ops-routes.js +2 -10
  143. package/src/lib/server/pos-ops-routes.js.map +1 -1
  144. package/src/lib/server/quote-pay.js +8 -4
  145. package/src/lib/server/quote-pay.js.map +1 -1
  146. package/src/lib/server/stream.d.ts +2 -0
  147. package/src/lib/server/stream.js +22 -2
  148. package/src/lib/server/stream.js.map +1 -1
  149. package/src/lib/server/tax-return-source.js +5 -1
  150. package/src/lib/server/tax-return-source.js.map +1 -1
  151. package/src/lib/server.js +2 -2
  152. package/src/lib/server.js.map +1 -1
@@ -43,6 +43,17 @@
43
43
  * picks how to pay after the fee is fixed. Every method here costs Stripe that
44
44
  * much or less, so turning one off or on changes what a shopper may choose and
45
45
  * never what the platform recovers.
46
+ *
47
+ * ## Quotes and invoices pay by card, never buy-now-pay-later
48
+ *
49
+ * A quote's or an invoice's pay link always excludes every `bnpl` method,
50
+ * whatever the store chose (`payLinkPaymentMethodControls`), and its fee is
51
+ * priced at the card rate (`PAY_LINK_PROCESSING_PERCENT`). That holds only
52
+ * while every method a pay link can still offer costs Stripe no more than a
53
+ * card: Apple Pay, Google Pay, Link, Cash App Pay and Amazon Pay are 2.9% +
54
+ * 30¢ on Stripe's US pricing, and stablecoins 1.5%. `PAY_LINK_METHOD_IDS`
55
+ * lists them, and a spec fails when a method is added to the catalog without
56
+ * being placed on one side or the other.
46
57
  */ /** A method the merchant may switch off (or, for crypto, on). */ /**
47
58
  * The catalog, in the order the settings card lists it. Limits are Stripe's
48
59
  * published US figures (docs.stripe.com/payments/buy-now-pay-later and each
@@ -226,6 +237,30 @@ export function storefrontPaymentMethodSpec(id) {
226
237
  params.set('wallet_options[link][display]', 'never');
227
238
  }
228
239
  }
240
+ /**
241
+ * The methods a quote's or an invoice's pay link may still offer, each of
242
+ * which Stripe prices at the card rate or below (see the note at the top of
243
+ * this file). Every other catalog method is excluded from a pay link.
244
+ */ export const PAY_LINK_METHOD_IDS = [
245
+ 'apple_pay',
246
+ 'google_pay',
247
+ 'link',
248
+ 'cashapp',
249
+ 'amazon_pay',
250
+ 'crypto'
251
+ ];
252
+ /**
253
+ * The store's choices as a quote's or an invoice's pay link sends them: what
254
+ * the store turned off, plus every method that is not on `PAY_LINK_METHOD_IDS`
255
+ * (Klarna, Afterpay and Affirm), excluded however the store set it. Catalog
256
+ * order, so the params read the same as a storefront session's.
257
+ */ export function payLinkPaymentMethodControls(controls) {
258
+ const excluded = STOREFRONT_PAYMENT_METHODS.filter((method)=>method.control === 'exclude' && (controls.excluded.includes(method.id) || !PAY_LINK_METHOD_IDS.includes(method.id))).map((method)=>method.id);
259
+ return {
260
+ excluded,
261
+ wallets: controls.wallets
262
+ };
263
+ }
229
264
  /** True when the browser has to be told about a hidden wallet at all. */ export function storefrontWalletsHideAny(wallets) {
230
265
  return wallets.applePay === 'never' || wallets.googlePay === 'never' || wallets.link === 'never';
231
266
  }
@@ -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,MAAM;QACNC,SAAS;QACTC,WAAW;QACXM,YAAY;QACZL,kBAAkB;QAClBC,cACE;QACFC,QAAQ;QACRI,UAAU;QACVH,eAAe;QACfC,aAAa;IACf;IACA;QACET,IAAI;QACJC,OAAO;QACPC,MAAM;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vB,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\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 * ## Quotes and invoices pay by card, never buy-now-pay-later\n *\n * A quote's or an invoice's pay link always excludes every `bnpl` method,\n * whatever the store chose (`payLinkPaymentMethodControls`), and its fee is\n * priced at the card rate (`PAY_LINK_PROCESSING_PERCENT`). That holds only\n * while every method a pay link can still offer costs Stripe no more than a\n * card: Apple Pay, Google Pay, Link, Cash App Pay and Amazon Pay are 2.9% +\n * 30¢ on Stripe's US pricing, and stablecoins 1.5%. `PAY_LINK_METHOD_IDS`\n * lists them, and a spec fails when a method is added to the catalog without\n * being placed on one side or the other.\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/**\n * The methods a quote's or an invoice's pay link may still offer, each of\n * which Stripe prices at the card rate or below (see the note at the top of\n * this file). Every other catalog method is excluded from a pay link.\n */\nexport const PAY_LINK_METHOD_IDS: readonly StorefrontPaymentMethodId[] = [\n 'apple_pay',\n 'google_pay',\n 'link',\n 'cashapp',\n 'amazon_pay',\n 'crypto',\n]\n\n/**\n * The store's choices as a quote's or an invoice's pay link sends them: what\n * the store turned off, plus every method that is not on `PAY_LINK_METHOD_IDS`\n * (Klarna, Afterpay and Affirm), excluded however the store set it. Catalog\n * order, so the params read the same as a storefront session's.\n */\nexport function payLinkPaymentMethodControls(\n controls: StorefrontPaymentMethodControls,\n): StorefrontPaymentMethodControls {\n const excluded = STOREFRONT_PAYMENT_METHODS.filter(\n (method) =>\n method.control === 'exclude' &&\n (controls.excluded.includes(method.id) || !PAY_LINK_METHOD_IDS.includes(method.id)),\n ).map((method) => method.id)\n return { excluded, wallets: controls.wallets }\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","PAY_LINK_METHOD_IDS","payLinkPaymentMethodControls","includes","storefrontWalletsHideAny","readStorefrontCheckoutWallets","undefined","key"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCC,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,MAAM;QACNC,SAAS;QACTC,WAAW;QACXM,YAAY;QACZL,kBAAkB;QAClBC,cACE;QACFC,QAAQ;QACRI,UAAU;QACVH,eAAe;QACfC,aAAa;IACf;IACA;QACET,IAAI;QACJC,OAAO;QACPC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXM,YAAY;QACZL,kBAAkB;QAClBC,cAAc;QACdC,QAAQ;QACRI,UAAU;QACVC,UAAU;QACVJ,eAAe;QACfC,aAAa;IACf;IACA;QACET,IAAI;QACJC,OAAO;QACPC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXM,YAAY;QACZL,kBAAkB;QAClBC,cACE;QACFC,QAAQ;QACRI,UAAU;QACVC,UAAU;QACVJ,eAAe;QACfC,aAAa;IACf;IACA;QACET,IAAI;QACJC,OAAO;QACPC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXM,YAAY;QACZL,kBAAkB;QAClBC,cAAc;QACdC,QAAQ;QACRC,eAAe;QACfC,aAAa;IACf;IACA;QACET,IAAI;QACJC,OAAO;QACPC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXM,YAAY;QACZL,kBAAkB;QAClBC,cAAc;QACdC,QAAQ;QACRC,eAAe;QACfC,aAAa;IACf;IACA;QACET,IAAI;QACJC,OAAO;QACPC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXM,YAAY;QACZL,kBAAkB;QAClBC,cACE;QACFC,QAAQ;QACRK,UAAU;QACVJ,eAAe;QACfC,aAAa;IACf;CACD,CAAA;AAOD,OAAO,MAAMI,gCACXd,2BAA2Be,GAAG,CAAC,CAACC,SAAWA,OAAOf,EAAE,EAAC;AAEvD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C;IACxD;IACA,IAAImC,SAASN,OAAO,CAACG,IAAI,KAAK,SAAS;QACrCE,OAAOI,GAAG,CAAC,iCAAiC;IAC9C;AACF;AAEA;;;;CAIC,GACD,OAAO,MAAMC,sBAA4D;IACvE;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,SAASC,6BACdL,QAAyC;IAEzC,MAAMT,WAAW3B,2BAA2B4B,MAAM,CAChD,CAACZ,SACCA,OAAOZ,OAAO,KAAK,aAClBgC,CAAAA,SAAST,QAAQ,CAACe,QAAQ,CAAC1B,OAAOf,EAAE,KAAK,CAACuC,oBAAoBE,QAAQ,CAAC1B,OAAOf,EAAE,CAAA,GACnFc,GAAG,CAAC,CAACC,SAAWA,OAAOf,EAAE;IAC3B,OAAO;QAAE0B;QAAUG,SAASM,SAASN,OAAO;IAAC;AAC/C;AAEA,uEAAuE,GACvE,OAAO,SAASa,yBAAyBb,OAAkC;IACzE,OACEA,QAAQC,QAAQ,KAAK,WACrBD,QAAQE,SAAS,KAAK,WACtBF,QAAQG,IAAI,KAAK;AAErB;AAEA;;;;CAIC,GACD,OAAO,SAASW,8BACdxB,GAAY;IAEZ,IAAI,CAACA,OAAO,OAAOA,QAAQ,UAAU,OAAOyB;IAC5C,MAAMvB,QAAQ,CAACwB,MACb,AAAC1B,GAA+B,CAAC0B,IAAI,KAAK,UAAU,UAAU;IAChE,MAAMhB,UAAqC;QACzCC,UAAUT,MAAM;QAChBU,WAAWV,MAAM;QACjBW,MAAMX,MAAM;IACd;IACA,OAAOqB,yBAAyBb,WAAWA,UAAUe;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
  /**