@aglyn/aglyn 1.13.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 (51) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/crm.js +8 -7
  3. package/src/lib/app-utils/crm.js.map +1 -1
  4. package/src/lib/app-utils/docs-help-sections.generated.js +4 -3
  5. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  6. package/src/lib/app-utils/docs-help.generated.d.ts +3 -3
  7. package/src/lib/app-utils/docs-help.generated.js +5 -1
  8. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  9. package/src/lib/app-utils/docs-index.generated.js +22 -22
  10. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  11. package/src/lib/app-utils/dynamic-list-rule.js +9 -5
  12. package/src/lib/app-utils/dynamic-list-rule.js.map +1 -1
  13. package/src/lib/app-utils/entity-picker-context.d.ts +6 -0
  14. package/src/lib/app-utils/entity-picker-context.js.map +1 -1
  15. package/src/lib/app-utils/host-status.js +1 -1
  16. package/src/lib/app-utils/host-status.js.map +1 -1
  17. package/src/lib/app-utils/native-nav.d.ts +2 -2
  18. package/src/lib/app-utils/native-nav.js +2 -2
  19. package/src/lib/app-utils/native-nav.js.map +1 -1
  20. package/src/lib/app-utils/org-role-grants.js +1 -1
  21. package/src/lib/app-utils/org-role-grants.js.map +1 -1
  22. package/src/lib/app-utils/page-header-record-context.d.ts +15 -0
  23. package/src/lib/app-utils/page-header-record-context.js +13 -4
  24. package/src/lib/app-utils/page-header-record-context.js.map +1 -1
  25. package/src/lib/app-utils/plan-entitlements.d.ts +38 -11
  26. package/src/lib/app-utils/plan-entitlements.js +39 -13
  27. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  28. package/src/lib/app-utils/release-flags.d.ts +1 -1
  29. package/src/lib/app-utils/release-flags.js +24 -0
  30. package/src/lib/app-utils/release-flags.js.map +1 -1
  31. package/src/lib/app-utils/site-context.d.ts +9 -0
  32. package/src/lib/app-utils/site-context.js.map +1 -1
  33. package/src/lib/app-utils/site-placement.d.ts +25 -7
  34. package/src/lib/app-utils/site-placement.js +17 -25
  35. package/src/lib/app-utils/site-placement.js.map +1 -1
  36. package/src/lib/app-utils/site-starter.d.ts +6 -0
  37. package/src/lib/app-utils/site-starter.js +15 -0
  38. package/src/lib/app-utils/site-starter.js.map +1 -1
  39. package/src/lib/plugin-manager/first-party-plugins.generated.js +1 -0
  40. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  41. package/src/lib/plugin-manager/plugin-contact-capture.d.ts +10 -0
  42. package/src/lib/plugin-manager/plugin-contact-capture.js +11 -0
  43. package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
  44. package/src/lib/plugin-manager/plugin-record-lists.d.ts +18 -0
  45. package/src/lib/plugin-manager/plugin-record-lists.js +13 -0
  46. package/src/lib/plugin-manager/plugin-record-lists.js.map +1 -1
  47. package/src/lib/plugin-manager/video-embed-provider.d.ts +28 -0
  48. package/src/lib/plugin-manager/video-embed-provider.js +21 -0
  49. package/src/lib/plugin-manager/video-embed-provider.js.map +1 -1
  50. package/src/lib/plugin-manager/video-embed-providers.generated.js +3 -1
  51. package/src/lib/plugin-manager/video-embed-providers.generated.js.map +1 -1
@@ -1908,8 +1908,8 @@ export declare function resolveTransactionFeePct(org: Partial<AglynOrgBilling> |
1908
1908
  *
1909
1909
  * WHY THE DEAREST METHOD AND NOT 2.9%. The shopper picks how to pay AFTER the
1910
1910
  * session is created, and `application_fee_amount` is a fixed number Stripe
1911
- * will not let us revise once the charge settles. No storefront path pins
1912
- * `payment_method_types`, so the platform's payment method configuration
1911
+ * will not let us revise once the charge settles. No storefront or booking
1912
+ * path pins `payment_method_types` or excludes buy-now-pay-later, so the platform's payment method configuration
1913
1913
  * decides the set — and per AGL-2343 that configuration has `klarna` and
1914
1914
  * `affirm` on beside the card family. Pricing this at the card rate would be
1915
1915
  * wrong exactly on the orders where it cost the most, which is the same
@@ -1922,9 +1922,10 @@ export declare function resolveTransactionFeePct(org: Partial<AglynOrgBilling> |
1922
1922
  * `SALE_PROCESSING_PERCENT` below is then the single identifier to
1923
1923
  * repoint. That is a product decision about which payment methods a storefront
1924
1924
  * offers, not this one; it is recorded on AGL-2152 and in the Pricing Decision
1925
- * Log so it can be taken deliberately.
1925
+ * Log so it can be taken deliberately. Quote and invoice pay links have taken
1926
+ * it: they exclude buy-now-pay-later and pass `PAY_LINK_PROCESSING_PERCENT`.
1926
1927
  */
1927
- export declare function saleProcessingCostCents(chargeCents: number): number;
1928
+ export declare function saleProcessingCostCents(chargeCents: number, processingPercent?: number): number;
1928
1929
  /**
1929
1930
  * The Stripe Connect `application_fee_amount` for ONE storefront sale
1930
1931
  * (AGL-2152) — the platform's advertised take PLUS Stripe's processing cost,
@@ -1949,8 +1950,14 @@ export declare function saleProcessingCostCents(chargeCents: number): number;
1949
1950
  * Clamped to `chargeCents` because Stripe rejects an application fee larger
1950
1951
  * than the charge. That clamp can only bind below ~32¢, under Stripe's own 50¢
1951
1952
  * charge minimum, so it never trims a real order's fee.
1953
+ *
1954
+ * `processingPercent` is the rate the processing half is priced at. It
1955
+ * defaults to `SALE_PROCESSING_PERCENT`, the dearest method a storefront or
1956
+ * booking session may offer. A quote's or an invoice's pay link passes
1957
+ * `PAY_LINK_PROCESSING_PERCENT`, the card rate, because those sessions never
1958
+ * offer buy-now-pay-later.
1952
1959
  */
1953
- export declare function resolveTransactionFeeCents(org: Partial<AglynOrgBilling> | null | undefined, productType: 'physical' | 'digital' | 'service', feeBaseCents: number, chargeCents?: number): number;
1960
+ export declare function resolveTransactionFeeCents(org: Partial<AglynOrgBilling> | null | undefined, productType: 'physical' | 'digital' | 'service', feeBaseCents: number, chargeCents?: number, processingPercent?: number): number;
1954
1961
  /**
1955
1962
  * Stripe's processing cost on a RECURRING charge of `amountCents`, as the
1956
1963
  * percent a Subscription's `application_fee_percent` can carry (AGL-2655).
@@ -2034,12 +2041,14 @@ export declare function bindingMarketplaceFeePct(): number;
2034
2041
  * they exist only as inputs to a platform take and to figures a seller reads;
2035
2042
  * changing one never changes a price list.
2036
2043
  *
2037
- * THE BNPL RATE IS THE ONE THAT BINDS, and it is not hypothetical: the live
2038
- * default payment method configuration has `klarna` and `affirm` enabled
2039
- * alongside `card`, `cashapp`, `link`, `amazon_pay` and `apple_pay`, and no
2040
- * checkout session pins `payment_method_types`, so a buyer may pay by either.
2041
- * A cost computed from the cheapest method would be wrong exactly when it
2042
- * mattered.
2044
+ * THE BNPL RATE IS THE ONE THAT BINDS on a storefront, a booking and a
2045
+ * marketplace listing, and it is not hypothetical: the live default payment
2046
+ * method configuration has `klarna` and `affirm` enabled alongside `card`,
2047
+ * `cashapp`, `link`, `amazon_pay` and `apple_pay`, and those sessions do not
2048
+ * exclude them, so a buyer may pay by either. A cost computed from the
2049
+ * cheapest method would be wrong exactly when it mattered. A quote's or an
2050
+ * invoice's pay link is the exception: it excludes every BNPL method and so
2051
+ * is priced at the card rate (`PAY_LINK_PROCESSING_PERCENT`).
2043
2052
  */
2044
2053
  export declare const CARD_PROCESSING_PERCENT = 2.9;
2045
2054
  /** Klarna/Affirm, roughly. See the note above — this is the binding one. */
@@ -2061,6 +2070,24 @@ export declare const PROCESSING_FIXED_CENTS = 30;
2061
2070
  * different flow.
2062
2071
  */
2063
2072
  export declare const SALE_PROCESSING_PERCENT = 6;
2073
+ /**
2074
+ * The processing rate a QUOTE's or an INVOICE's pay link is priced against:
2075
+ * the card rate, 2.9% + 30¢.
2076
+ *
2077
+ * Those sessions always exclude Klarna, Afterpay and Affirm
2078
+ * (`payLinkPaymentMethodControls` in the commerce plugin), so what a buyer
2079
+ * can still choose is the card family: a card, Apple Pay, Google Pay, Link,
2080
+ * Cash App Pay and Amazon Pay, all 2.9% + 30¢ on Stripe's published US
2081
+ * pricing, and stablecoins, at 1.5% when a seller turns them on. The card
2082
+ * rate is therefore the dearest a pay link can cost, as `SALE_PROCESSING_PERCENT`
2083
+ * is for a storefront. An international card adds Stripe's 1.5% surcharge,
2084
+ * which this does not recover, the same as the register's card payments.
2085
+ *
2086
+ * Its own name for the reason `SALE_PROCESSING_PERCENT` has one: a storefront,
2087
+ * a booking and the marketplace floor stay on the rate their own sessions can
2088
+ * cost, and repointing this one moves pay links only.
2089
+ */
2090
+ export declare const PAY_LINK_PROCESSING_PERCENT = 2.9;
2064
2091
  /** Stripe's per-transaction fixed component, in cents. Not rate-dependent. */
2065
2092
  export declare const SALE_PROCESSING_FIXED_CENTS = 30;
2066
2093
  /**
@@ -3208,8 +3208,8 @@ function resolvePlan(org) {
3208
3208
  *
3209
3209
  * WHY THE DEAREST METHOD AND NOT 2.9%. The shopper picks how to pay AFTER the
3210
3210
  * session is created, and `application_fee_amount` is a fixed number Stripe
3211
- * will not let us revise once the charge settles. No storefront path pins
3212
- * `payment_method_types`, so the platform's payment method configuration
3211
+ * will not let us revise once the charge settles. No storefront or booking
3212
+ * path pins `payment_method_types` or excludes buy-now-pay-later, so the platform's payment method configuration
3213
3213
  * decides the set — and per AGL-2343 that configuration has `klarna` and
3214
3214
  * `affirm` on beside the card family. Pricing this at the card rate would be
3215
3215
  * wrong exactly on the orders where it cost the most, which is the same
@@ -3222,14 +3222,15 @@ function resolvePlan(org) {
3222
3222
  * `SALE_PROCESSING_PERCENT` below is then the single identifier to
3223
3223
  * repoint. That is a product decision about which payment methods a storefront
3224
3224
  * offers, not this one; it is recorded on AGL-2152 and in the Pricing Decision
3225
- * Log so it can be taken deliberately.
3225
+ * Log so it can be taken deliberately. Quote and invoice pay links have taken
3226
+ * it: they exclude buy-now-pay-later and pass `PAY_LINK_PROCESSING_PERCENT`.
3226
3227
  */ // `SALE_PROCESSING_PERCENT` and `SALE_PROCESSING_FIXED_CENTS` are declared
3227
3228
  // beside the processing constants they are defined from, further down this
3228
3229
  // file — a `const` cannot be read before its declaration is evaluated, and
3229
3230
  // this function is only ever CALLED, never evaluated at import.
3230
- export function saleProcessingCostCents(chargeCents) {
3231
+ export function saleProcessingCostCents(chargeCents, processingPercent = SALE_PROCESSING_PERCENT) {
3231
3232
  if (!Number.isFinite(chargeCents) || chargeCents <= 0) return 0;
3232
- return Math.ceil(chargeCents * SALE_PROCESSING_PERCENT / 100) + SALE_PROCESSING_FIXED_CENTS;
3233
+ return Math.ceil(chargeCents * processingPercent / 100) + SALE_PROCESSING_FIXED_CENTS;
3233
3234
  }
3234
3235
  /**
3235
3236
  * The Stripe Connect `application_fee_amount` for ONE storefront sale
@@ -3255,7 +3256,13 @@ export function saleProcessingCostCents(chargeCents) {
3255
3256
  * Clamped to `chargeCents` because Stripe rejects an application fee larger
3256
3257
  * than the charge. That clamp can only bind below ~32¢, under Stripe's own 50¢
3257
3258
  * charge minimum, so it never trims a real order's fee.
3258
- */ export function resolveTransactionFeeCents(org, productType, feeBaseCents, chargeCents = feeBaseCents) {
3259
+ *
3260
+ * `processingPercent` is the rate the processing half is priced at. It
3261
+ * defaults to `SALE_PROCESSING_PERCENT`, the dearest method a storefront or
3262
+ * booking session may offer. A quote's or an invoice's pay link passes
3263
+ * `PAY_LINK_PROCESSING_PERCENT`, the card rate, because those sessions never
3264
+ * offer buy-now-pay-later.
3265
+ */ export function resolveTransactionFeeCents(org, productType, feeBaseCents, chargeCents = feeBaseCents, processingPercent = SALE_PROCESSING_PERCENT) {
3259
3266
  const charge = Number.isFinite(chargeCents) && chargeCents > 0 ? Math.round(chargeCents) : 0;
3260
3267
  if (charge <= 0) return 0;
3261
3268
  const base = Number.isFinite(feeBaseCents) && feeBaseCents > 0 ? Math.round(feeBaseCents) : 0;
@@ -3263,7 +3270,7 @@ export function saleProcessingCostCents(chargeCents) {
3263
3270
  // The `Math.max(1, …)` every door already applied: a rate above zero on
3264
3271
  // goods the shopper pays for is a fee however small it rounds to.
3265
3272
  const take = pct > 0 && base > 0 ? Math.max(1, Math.round(base * pct / 100)) : 0;
3266
- return Math.min(charge, take + saleProcessingCostCents(charge));
3273
+ return Math.min(charge, take + saleProcessingCostCents(charge, processingPercent));
3267
3274
  }
3268
3275
  /**
3269
3276
  * Stripe's processing cost on a RECURRING charge of `amountCents`, as the
@@ -3381,12 +3388,14 @@ export function saleProcessingCostCents(chargeCents) {
3381
3388
  * they exist only as inputs to a platform take and to figures a seller reads;
3382
3389
  * changing one never changes a price list.
3383
3390
  *
3384
- * THE BNPL RATE IS THE ONE THAT BINDS, and it is not hypothetical: the live
3385
- * default payment method configuration has `klarna` and `affirm` enabled
3386
- * alongside `card`, `cashapp`, `link`, `amazon_pay` and `apple_pay`, and no
3387
- * checkout session pins `payment_method_types`, so a buyer may pay by either.
3388
- * A cost computed from the cheapest method would be wrong exactly when it
3389
- * mattered.
3391
+ * THE BNPL RATE IS THE ONE THAT BINDS on a storefront, a booking and a
3392
+ * marketplace listing, and it is not hypothetical: the live default payment
3393
+ * method configuration has `klarna` and `affirm` enabled alongside `card`,
3394
+ * `cashapp`, `link`, `amazon_pay` and `apple_pay`, and those sessions do not
3395
+ * exclude them, so a buyer may pay by either. A cost computed from the
3396
+ * cheapest method would be wrong exactly when it mattered. A quote's or an
3397
+ * invoice's pay link is the exception: it excludes every BNPL method and so
3398
+ * is priced at the card rate (`PAY_LINK_PROCESSING_PERCENT`).
3390
3399
  */ export const CARD_PROCESSING_PERCENT = 2.9;
3391
3400
  /** Klarna/Affirm, roughly. See the note above — this is the binding one. */ export const BNPL_PROCESSING_PERCENT = 6;
3392
3401
  /** Stripe's per-transaction fixed component, in cents. */ export const PROCESSING_FIXED_CENTS = 30;
@@ -3404,6 +3413,23 @@ export function saleProcessingCostCents(chargeCents) {
3404
3413
  * marketplace listing floor, which is derived from the binding rate for a
3405
3414
  * different flow.
3406
3415
  */ export const SALE_PROCESSING_PERCENT = BNPL_PROCESSING_PERCENT;
3416
+ /**
3417
+ * The processing rate a QUOTE's or an INVOICE's pay link is priced against:
3418
+ * the card rate, 2.9% + 30¢.
3419
+ *
3420
+ * Those sessions always exclude Klarna, Afterpay and Affirm
3421
+ * (`payLinkPaymentMethodControls` in the commerce plugin), so what a buyer
3422
+ * can still choose is the card family: a card, Apple Pay, Google Pay, Link,
3423
+ * Cash App Pay and Amazon Pay, all 2.9% + 30¢ on Stripe's published US
3424
+ * pricing, and stablecoins, at 1.5% when a seller turns them on. The card
3425
+ * rate is therefore the dearest a pay link can cost, as `SALE_PROCESSING_PERCENT`
3426
+ * is for a storefront. An international card adds Stripe's 1.5% surcharge,
3427
+ * which this does not recover, the same as the register's card payments.
3428
+ *
3429
+ * Its own name for the reason `SALE_PROCESSING_PERCENT` has one: a storefront,
3430
+ * a booking and the marketplace floor stay on the rate their own sessions can
3431
+ * cost, and repointing this one moves pay links only.
3432
+ */ export const PAY_LINK_PROCESSING_PERCENT = CARD_PROCESSING_PERCENT;
3407
3433
  /** Stripe's per-transaction fixed component, in cents. Not rate-dependent. */ export const SALE_PROCESSING_FIXED_CENTS = PROCESSING_FIXED_CENTS;
3408
3434
  /**
3409
3435
  * The cheapest plan whose BASE features include `feature`, in ladder order —