@aglyn/plugins-commerce 1.0.0-beta.287 → 1.0.0-beta.289

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 (109) hide show
  1. package/README.md +2 -2
  2. package/package.json +13 -13
  3. package/src/lib/components/commerce-console-page.js +29 -2
  4. package/src/lib/components/commerce-console-page.js.map +1 -1
  5. package/src/lib/components/console/commerce-analytics-card.component.js +4 -2
  6. package/src/lib/components/console/commerce-analytics-card.component.js.map +1 -1
  7. package/src/lib/components/console/host-orders-card.component.js +5 -1
  8. package/src/lib/components/console/host-orders-card.component.js.map +1 -1
  9. package/src/lib/components/console/host-quotes-card.component.d.ts +34 -0
  10. package/src/lib/components/console/host-quotes-card.component.js +247 -0
  11. package/src/lib/components/console/host-quotes-card.component.js.map +1 -0
  12. package/src/lib/components/console/order-webhooks-card.component.js +1 -1
  13. package/src/lib/components/console/order-webhooks-card.component.js.map +1 -1
  14. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js +33 -28
  15. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js.map +1 -1
  16. package/src/lib/components/console/quote-editor-dialog.component.d.ts +45 -0
  17. package/src/lib/components/console/quote-editor-dialog.component.js +1266 -0
  18. package/src/lib/components/console/quote-editor-dialog.component.js.map +1 -0
  19. package/src/lib/components/console/quote-pay-link.component.d.ts +38 -0
  20. package/src/lib/components/console/quote-pay-link.component.js +213 -0
  21. package/src/lib/components/console/quote-pay-link.component.js.map +1 -0
  22. package/src/lib/components/console/quote-settings-card.component.d.ts +29 -0
  23. package/src/lib/components/console/quote-settings-card.component.js +121 -0
  24. package/src/lib/components/console/quote-settings-card.component.js.map +1 -0
  25. package/src/lib/components/console/tax-settings-card.component.js +4 -1
  26. package/src/lib/components/console/tax-settings-card.component.js.map +1 -1
  27. package/src/lib/components/quote-page-body.d.ts +33 -0
  28. package/src/lib/components/quote-page-body.js +696 -0
  29. package/src/lib/components/quote-page-body.js.map +1 -0
  30. package/src/lib/components/quote-page.d.ts +29 -0
  31. package/src/lib/components/quote-page.js +96 -0
  32. package/src/lib/components/quote-page.js.map +1 -0
  33. package/src/lib/components/storefront-payment-element.d.ts +7 -1
  34. package/src/lib/components/storefront-payment-element.js +8 -3
  35. package/src/lib/components/storefront-payment-element.js.map +1 -1
  36. package/src/lib/constants/orders-list-query.js +6 -1
  37. package/src/lib/constants/orders-list-query.js.map +1 -1
  38. package/src/lib/constants/quote-page.d.ts +30 -0
  39. package/src/lib/constants/quote-page.js +35 -0
  40. package/src/lib/constants/quote-page.js.map +1 -0
  41. package/src/lib/declarations.js +5 -1
  42. package/src/lib/declarations.js.map +1 -1
  43. package/src/lib/model/commerce-orders.d.ts +25 -2
  44. package/src/lib/model/commerce-orders.js +10 -1
  45. package/src/lib/model/commerce-orders.js.map +1 -1
  46. package/src/lib/model/commerce-quote-pay.d.ts +229 -0
  47. package/src/lib/model/commerce-quote-pay.js +393 -0
  48. package/src/lib/model/commerce-quote-pay.js.map +1 -0
  49. package/src/lib/model/commerce-quotes.d.ts +279 -0
  50. package/src/lib/model/commerce-quotes.js +522 -0
  51. package/src/lib/model/commerce-quotes.js.map +1 -0
  52. package/src/lib/model/index.d.ts +2 -0
  53. package/src/lib/model/index.js +2 -0
  54. package/src/lib/model/index.js.map +1 -1
  55. package/src/lib/model/plugin-permissions.d.ts +8 -1
  56. package/src/lib/model/plugin-permissions.js +21 -1
  57. package/src/lib/model/plugin-permissions.js.map +1 -1
  58. package/src/lib/model/workspace-site-permissions.d.ts +26 -0
  59. package/src/lib/model/workspace-site-permissions.js +81 -0
  60. package/src/lib/model/workspace-site-permissions.js.map +1 -0
  61. package/src/lib/server/api-v1/orders-and-products.js +6 -2
  62. package/src/lib/server/api-v1/orders-and-products.js.map +1 -1
  63. package/src/lib/server/billing-webhook.js +127 -52
  64. package/src/lib/server/billing-webhook.js.map +1 -1
  65. package/src/lib/server/checkout-session-expiry.d.ts +36 -0
  66. package/src/lib/server/checkout-session-expiry.js +63 -0
  67. package/src/lib/server/checkout-session-expiry.js.map +1 -0
  68. package/src/lib/server/commerce-site-keys.d.ts +19 -0
  69. package/src/lib/server/commerce-site-keys.js +23 -2
  70. package/src/lib/server/commerce-site-keys.js.map +1 -1
  71. package/src/lib/server/draft-order.js +16 -8
  72. package/src/lib/server/draft-order.js.map +1 -1
  73. package/src/lib/server/order-webhooks.js +8 -8
  74. package/src/lib/server/order-webhooks.js.map +1 -1
  75. package/src/lib/server/person-eraser.d.ts +7 -0
  76. package/src/lib/server/person-eraser.js +24 -2
  77. package/src/lib/server/person-eraser.js.map +1 -1
  78. package/src/lib/server/pos-ops-gate.d.ts +13 -5
  79. package/src/lib/server/pos-ops-gate.js +12 -14
  80. package/src/lib/server/pos-ops-gate.js.map +1 -1
  81. package/src/lib/server/pos-refund-authority.d.ts +3 -1
  82. package/src/lib/server/pos-refund-authority.js +3 -2
  83. package/src/lib/server/pos-refund-authority.js.map +1 -1
  84. package/src/lib/server/pos-return.js +6 -7
  85. package/src/lib/server/pos-return.js.map +1 -1
  86. package/src/lib/server/pos-staff-pin.js +7 -7
  87. package/src/lib/server/pos-staff-pin.js.map +1 -1
  88. package/src/lib/server/quote-link-token.d.ts +39 -0
  89. package/src/lib/server/quote-link-token.js +97 -0
  90. package/src/lib/server/quote-link-token.js.map +1 -0
  91. package/src/lib/server/quote-pay.d.ts +83 -0
  92. package/src/lib/server/quote-pay.js +606 -0
  93. package/src/lib/server/quote-pay.js.map +1 -0
  94. package/src/lib/server/quote.d.ts +49 -0
  95. package/src/lib/server/quote.js +513 -0
  96. package/src/lib/server/quote.js.map +1 -0
  97. package/src/lib/server/refund.js +26 -36
  98. package/src/lib/server/refund.js.map +1 -1
  99. package/src/lib/server/related.js +2 -0
  100. package/src/lib/server/related.js.map +1 -1
  101. package/src/lib/server/site-page-resolver.d.ts +2 -0
  102. package/src/lib/server/site-page-resolver.js +75 -0
  103. package/src/lib/server/site-page-resolver.js.map +1 -1
  104. package/src/lib/server.js +14 -0
  105. package/src/lib/server.js.map +1 -1
  106. package/src/lib/site.js +6 -0
  107. package/src/lib/site.js.map +1 -1
  108. package/src/lib/transfer/tracking.server.js +6 -0
  109. package/src/lib/transfer/tracking.server.js.map +1 -1
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { hostPublicOrigin } from "@aglyn/aglyn/server";
17
+ import { createHmac, timingSafeEqual } from "crypto";
18
+ import { quotePageHref } from "../constants/quote-page.js";
19
+ import { tokenSigningSecret } from "./download.js";
20
+ /**
21
+ * A quote's pay link (AGL-4094): `/pay-quote?q=<quoteId>&t=<token>` on the
22
+ * business's own site, where the customer sees the quote and pays it.
23
+ *
24
+ * The token is `<version>.<signature>`: the quote's link version
25
+ * (`quote.linkVersion`, absent reading as 1) and the first 32 hex characters of
26
+ * `HMAC(quote-link:hostId:quoteId:version)` under the commerce
27
+ * `TOKEN_SIGNING_SECRET`. A pure function of what the quote already holds, so
28
+ * nothing is stored per link and every message that carried the link carries
29
+ * the same working one. The `quote-link:` prefix keeps it from being replayed
30
+ * as an order-status, download or supplier token, which sign other payloads
31
+ * under the same secret.
32
+ *
33
+ * NO EXPIRY. A quote is paid when the customer is ready, and a link that died
34
+ * first would be a quote they could not pay. The version is what retires a
35
+ * link: replacing it bumps the version on the quote, and a link signed for an
36
+ * older version still verifies, so its page can say the quote was replaced,
37
+ * without showing any of it.
38
+ */ const SIGNATURE_LENGTH = 32;
39
+ const MAX_VERSION = 1000000;
40
+ function signQuoteLink(hostId, quoteId, version) {
41
+ return createHmac('sha256', tokenSigningSecret()).update(`quote-link:${hostId}:${quoteId}:${version}`).digest('hex').slice(0, SIGNATURE_LENGTH);
42
+ }
43
+ /** The token's two halves, or null for a token not shaped like one. */ export function parseQuoteLinkToken(token) {
44
+ const match = /^([1-9]\d{0,6})\.([0-9a-f]{32})$/.exec(String(token != null ? token : ''));
45
+ if (!match) return null;
46
+ const version = Number(match[1]);
47
+ if (!Number.isSafeInteger(version) || version > MAX_VERSION) return null;
48
+ return {
49
+ version,
50
+ signature: match[2]
51
+ };
52
+ }
53
+ /** The token for one version of a quote's link, or null when the signing secret is unset. */ export function mintQuoteLinkToken(hostId, quoteId, version) {
54
+ if (!hostId || !quoteId || !Number.isSafeInteger(version) || version < 1 || version > MAX_VERSION) {
55
+ return null;
56
+ }
57
+ try {
58
+ return `${version}.${signQuoteLink(hostId, quoteId, version)}`;
59
+ } catch (unused) {
60
+ return null;
61
+ }
62
+ }
63
+ /**
64
+ * Checks a presented token in constant time and answers the link version it
65
+ * was signed for, or null for a token that is wrong, malformed or unverifiable
66
+ * (no secret). The caller compares the version with the quote's own.
67
+ */ export function verifyQuoteLinkToken(hostId, quoteId, token) {
68
+ if (!hostId || !quoteId) return null;
69
+ const parsed = parseQuoteLinkToken(token);
70
+ if (!parsed) return null;
71
+ let expected;
72
+ try {
73
+ expected = signQuoteLink(hostId, quoteId, parsed.version);
74
+ } catch (unused) {
75
+ return null;
76
+ }
77
+ const a = Buffer.from(parsed.signature);
78
+ const b = Buffer.from(expected);
79
+ if (a.length !== b.length) return null;
80
+ return timingSafeEqual(new Uint8Array(a), new Uint8Array(b)) ? parsed.version : null;
81
+ }
82
+ /**
83
+ * The absolute pay link for a quote at a link version, or null when either
84
+ * half is missing: a site with no public address, or no signing secret. What
85
+ * the console copies, and what a quote or invoice email puts in front of the
86
+ * customer.
87
+ */ export function quotePayLinkUrl(host, hostId, quoteId, version) {
88
+ const origin = hostPublicOrigin({
89
+ cname: typeof (host == null ? void 0 : host.cname) === 'string' ? host.cname : null,
90
+ subdomain: typeof (host == null ? void 0 : host.subdomain) === 'string' ? host.subdomain : null
91
+ });
92
+ const token = mintQuoteLinkToken(hostId, quoteId, version);
93
+ if (!origin || !token) return null;
94
+ return `${origin}${quotePageHref(quoteId, token)}`;
95
+ }
96
+
97
+ //# sourceMappingURL=quote-link-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/server/quote-link-token.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 { hostPublicOrigin } from '@aglyn/aglyn/server'\nimport { createHmac, timingSafeEqual } from 'crypto'\nimport { quotePageHref } from '../constants/quote-page'\nimport { tokenSigningSecret } from './download'\n\n/**\n * A quote's pay link (AGL-4094): `/pay-quote?q=<quoteId>&t=<token>` on the\n * business's own site, where the customer sees the quote and pays it.\n *\n * The token is `<version>.<signature>`: the quote's link version\n * (`quote.linkVersion`, absent reading as 1) and the first 32 hex characters of\n * `HMAC(quote-link:hostId:quoteId:version)` under the commerce\n * `TOKEN_SIGNING_SECRET`. A pure function of what the quote already holds, so\n * nothing is stored per link and every message that carried the link carries\n * the same working one. The `quote-link:` prefix keeps it from being replayed\n * as an order-status, download or supplier token, which sign other payloads\n * under the same secret.\n *\n * NO EXPIRY. A quote is paid when the customer is ready, and a link that died\n * first would be a quote they could not pay. The version is what retires a\n * link: replacing it bumps the version on the quote, and a link signed for an\n * older version still verifies, so its page can say the quote was replaced,\n * without showing any of it.\n */\nconst SIGNATURE_LENGTH = 32\nconst MAX_VERSION = 1_000_000\n\nfunction signQuoteLink(hostId: string, quoteId: string, version: number): string {\n return createHmac('sha256', tokenSigningSecret())\n .update(`quote-link:${hostId}:${quoteId}:${version}`)\n .digest('hex')\n .slice(0, SIGNATURE_LENGTH)\n}\n\n/** The token's two halves, or null for a token not shaped like one. */\nexport function parseQuoteLinkToken(token: string): { version: number; signature: string } | null {\n const match = /^([1-9]\\d{0,6})\\.([0-9a-f]{32})$/.exec(String(token ?? ''))\n if (!match) return null\n const version = Number(match[1])\n if (!Number.isSafeInteger(version) || version > MAX_VERSION) return null\n return { version, signature: match[2] }\n}\n\n/** The token for one version of a quote's link, or null when the signing secret is unset. */\nexport function mintQuoteLinkToken(hostId: string, quoteId: string, version: number): string | null {\n if (!hostId || !quoteId || !Number.isSafeInteger(version) || version < 1 || version > MAX_VERSION) {\n return null\n }\n try {\n return `${version}.${signQuoteLink(hostId, quoteId, version)}`\n } catch {\n return null\n }\n}\n\n/**\n * Checks a presented token in constant time and answers the link version it\n * was signed for, or null for a token that is wrong, malformed or unverifiable\n * (no secret). The caller compares the version with the quote's own.\n */\nexport function verifyQuoteLinkToken(hostId: string, quoteId: string, token: string): number | null {\n if (!hostId || !quoteId) return null\n const parsed = parseQuoteLinkToken(token)\n if (!parsed) return null\n let expected: string\n try {\n expected = signQuoteLink(hostId, quoteId, parsed.version)\n } catch {\n return null\n }\n const a = Buffer.from(parsed.signature)\n const b = Buffer.from(expected)\n if (a.length !== b.length) return null\n return timingSafeEqual(new Uint8Array(a), new Uint8Array(b)) ? parsed.version : null\n}\n\n/**\n * The absolute pay link for a quote at a link version, or null when either\n * half is missing: a site with no public address, or no signing secret. What\n * the console copies, and what a quote or invoice email puts in front of the\n * customer.\n */\nexport function quotePayLinkUrl(\n host: { cname?: unknown; subdomain?: unknown } | null | undefined,\n hostId: string,\n quoteId: string,\n version: number,\n): string | null {\n const origin = hostPublicOrigin({\n cname: typeof host?.cname === 'string' ? host.cname : null,\n subdomain: typeof host?.subdomain === 'string' ? host.subdomain : null,\n })\n const token = mintQuoteLinkToken(hostId, quoteId, version)\n if (!origin || !token) return null\n return `${origin}${quotePageHref(quoteId, token)}`\n}\n"],"names":["hostPublicOrigin","createHmac","timingSafeEqual","quotePageHref","tokenSigningSecret","SIGNATURE_LENGTH","MAX_VERSION","signQuoteLink","hostId","quoteId","version","update","digest","slice","parseQuoteLinkToken","token","match","exec","String","Number","isSafeInteger","signature","mintQuoteLinkToken","verifyQuoteLinkToken","parsed","expected","a","Buffer","from","b","length","Uint8Array","quotePayLinkUrl","host","origin","cname","subdomain"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,gBAAgB,QAAQ,sBAAqB;AACtD,SAASC,UAAU,EAAEC,eAAe,QAAQ,SAAQ;AACpD,SAASC,aAAa,QAAQ,6BAAyB;AACvD,SAASC,kBAAkB,QAAQ,gBAAY;AAE/C;;;;;;;;;;;;;;;;;;CAkBC,GACD,MAAMC,mBAAmB;AACzB,MAAMC,cAAc;AAEpB,SAASC,cAAcC,MAAc,EAAEC,OAAe,EAAEC,OAAe;IACrE,OAAOT,WAAW,UAAUG,sBACzBO,MAAM,CAAC,CAAC,WAAW,EAAEH,OAAO,CAAC,EAAEC,QAAQ,CAAC,EAAEC,SAAS,EACnDE,MAAM,CAAC,OACPC,KAAK,CAAC,GAAGR;AACd;AAEA,qEAAqE,GACrE,OAAO,SAASS,oBAAoBC,KAAa;IAC/C,MAAMC,QAAQ,mCAAmCC,IAAI,CAACC,OAAOH,gBAAAA,QAAS;IACtE,IAAI,CAACC,OAAO,OAAO;IACnB,MAAMN,UAAUS,OAAOH,KAAK,CAAC,EAAE;IAC/B,IAAI,CAACG,OAAOC,aAAa,CAACV,YAAYA,UAAUJ,aAAa,OAAO;IACpE,OAAO;QAAEI;QAASW,WAAWL,KAAK,CAAC,EAAE;IAAC;AACxC;AAEA,2FAA2F,GAC3F,OAAO,SAASM,mBAAmBd,MAAc,EAAEC,OAAe,EAAEC,OAAe;IACjF,IAAI,CAACF,UAAU,CAACC,WAAW,CAACU,OAAOC,aAAa,CAACV,YAAYA,UAAU,KAAKA,UAAUJ,aAAa;QACjG,OAAO;IACT;IACA,IAAI;QACF,OAAO,GAAGI,QAAQ,CAAC,EAAEH,cAAcC,QAAQC,SAASC,UAAU;IAChE,EAAE,eAAM;QACN,OAAO;IACT;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASa,qBAAqBf,MAAc,EAAEC,OAAe,EAAEM,KAAa;IACjF,IAAI,CAACP,UAAU,CAACC,SAAS,OAAO;IAChC,MAAMe,SAASV,oBAAoBC;IACnC,IAAI,CAACS,QAAQ,OAAO;IACpB,IAAIC;IACJ,IAAI;QACFA,WAAWlB,cAAcC,QAAQC,SAASe,OAAOd,OAAO;IAC1D,EAAE,eAAM;QACN,OAAO;IACT;IACA,MAAMgB,IAAIC,OAAOC,IAAI,CAACJ,OAAOH,SAAS;IACtC,MAAMQ,IAAIF,OAAOC,IAAI,CAACH;IACtB,IAAIC,EAAEI,MAAM,KAAKD,EAAEC,MAAM,EAAE,OAAO;IAClC,OAAO5B,gBAAgB,IAAI6B,WAAWL,IAAI,IAAIK,WAAWF,MAAML,OAAOd,OAAO,GAAG;AAClF;AAEA;;;;;CAKC,GACD,OAAO,SAASsB,gBACdC,IAAiE,EACjEzB,MAAc,EACdC,OAAe,EACfC,OAAe;IAEf,MAAMwB,SAASlC,iBAAiB;QAC9BmC,OAAO,QAAOF,wBAAAA,KAAME,KAAK,MAAK,WAAWF,KAAKE,KAAK,GAAG;QACtDC,WAAW,QAAOH,wBAAAA,KAAMG,SAAS,MAAK,WAAWH,KAAKG,SAAS,GAAG;IACpE;IACA,MAAMrB,QAAQO,mBAAmBd,QAAQC,SAASC;IAClD,IAAI,CAACwB,UAAU,CAACnB,OAAO,OAAO;IAC9B,OAAO,GAAGmB,SAAS/B,cAAcM,SAASM,QAAQ;AACpD"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type PluginApiHandler, type PluginApiRequest } from '@aglyn/aglyn/server';
18
+ import * as CommerceModel from '../model';
19
+ import { type CheckoutSessionExpiry } from './checkout-session-expiry';
20
+ import { resolveManualTaxRateId } from './manual-tax-rate';
21
+ import { type NativeCheckoutMode } from './native-checkout';
22
+ import { ensureCheckoutDomain } from './payment-method-domains';
23
+ /** Lookups and presses one address may make per site, per ten minutes. */
24
+ export declare const QUOTE_VIEW_LOOKUPS_PER_WINDOW = 60;
25
+ export declare const QUOTE_PAY_PRESSES_PER_WINDOW = 20;
26
+ export declare const QUOTE_WINDOW_MS: number;
27
+ export interface QuotePayDeps {
28
+ firestore(): FirebaseFirestore.Firestore;
29
+ consumeRateLimit(key: string, options: {
30
+ limit: number;
31
+ windowMs: number;
32
+ }): Promise<{
33
+ allowed: boolean;
34
+ resetMs: number;
35
+ }>;
36
+ orgForHost(hostId: string): Promise<{
37
+ id?: string;
38
+ org?: any;
39
+ } | null>;
40
+ nativeMode(orgId: string): Promise<NativeCheckoutMode>;
41
+ /** The store's manual tax rate as a Stripe tax rate, or null when one cannot be had. */
42
+ taxRateId(input: Parameters<typeof resolveManualTaxRateId>[0]): Promise<string | null>;
43
+ createSession(params: URLSearchParams, headers: Record<string, string>): Promise<{
44
+ ok: boolean;
45
+ session: {
46
+ id?: string;
47
+ url?: string;
48
+ client_secret?: string;
49
+ error?: unknown;
50
+ };
51
+ }>;
52
+ expireSession(sessionId: string): Promise<CheckoutSessionExpiry>;
53
+ /** Registers the page's domain for Apple Pay; never throws. */
54
+ ensureDomain(input: Parameters<typeof ensureCheckoutDomain>[0]): Promise<unknown>;
55
+ now(): number;
56
+ }
57
+ export declare function defaultQuotePayDeps(): QuotePayDeps;
58
+ type Outcome = {
59
+ status: number;
60
+ body: Record<string, unknown>;
61
+ headers?: Record<string, string>;
62
+ };
63
+ /** `GET /api/commerce/quote-view`: the quote page's data. */
64
+ export declare function handleQuoteView(deps: QuotePayDeps, req: PluginApiRequest): Promise<Outcome>;
65
+ /** The Checkout Session a quote's Pay opens, as form params. Pure over its inputs. */
66
+ export declare function buildQuoteSessionParams(input: {
67
+ hostId: string;
68
+ quoteId: string;
69
+ order: CommerceModel.HostOrder;
70
+ charge: CommerceModel.QuoteCheckoutCharge;
71
+ accountId: string;
72
+ feeCents: number;
73
+ taxRateId: string;
74
+ returnUrl: string;
75
+ paymentMethods: CommerceModel.StorefrontPaymentMethodControls;
76
+ }): URLSearchParams;
77
+ /** `POST /api/commerce/quote-pay`: a fresh Checkout Session for the quote. */
78
+ export declare function handleQuotePay(deps: QuotePayDeps, req: PluginApiRequest): Promise<Outcome>;
79
+ /** `GET /api/commerce/quote-view`. */
80
+ export declare const quoteViewHandler: PluginApiHandler;
81
+ /** `POST /api/commerce/quote-pay`. */
82
+ export declare const quotePayHandler: PluginApiHandler;
83
+ export {};