@aglyn/plugins-commerce 1.29.0 → 1.29.2

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 (84) hide show
  1. package/package.json +13 -13
  2. package/src/lib/components/console/checkout-tax-blocked-notice.component.d.ts +18 -0
  3. package/src/lib/components/console/checkout-tax-blocked-notice.component.js +67 -0
  4. package/src/lib/components/console/checkout-tax-blocked-notice.component.js.map +1 -0
  5. package/src/lib/components/console/payments-settings-card.component.d.ts +2 -2
  6. package/src/lib/components/console/payments-settings-card.component.js +99 -5
  7. package/src/lib/components/console/payments-settings-card.component.js.map +1 -1
  8. package/src/lib/components/console/product-editor-dialog.component.js +14 -3
  9. package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
  10. package/src/lib/components/console/stripe-tax-readiness.component.d.ts +45 -0
  11. package/src/lib/components/console/stripe-tax-readiness.component.js +276 -0
  12. package/src/lib/components/console/stripe-tax-readiness.component.js.map +1 -0
  13. package/src/lib/components/console/tax-settings-card.component.js +22 -8
  14. package/src/lib/components/console/tax-settings-card.component.js.map +1 -1
  15. package/src/lib/constants/operator-alerts.d.ts +9 -0
  16. package/src/lib/constants/operator-alerts.js +22 -1
  17. package/src/lib/constants/operator-alerts.js.map +1 -1
  18. package/src/lib/declarations.server.js +11 -0
  19. package/src/lib/declarations.server.js.map +1 -1
  20. package/src/lib/model/commerce-tax-readiness.d.ts +79 -0
  21. package/src/lib/model/commerce-tax-readiness.js +99 -0
  22. package/src/lib/model/commerce-tax-readiness.js.map +1 -0
  23. package/src/lib/model/commerce.d.ts +7 -0
  24. package/src/lib/model/commerce.js +17 -4
  25. package/src/lib/model/commerce.js.map +1 -1
  26. package/src/lib/model/payments-setup-status.d.ts +68 -0
  27. package/src/lib/model/payments-setup-status.js +103 -0
  28. package/src/lib/model/payments-setup-status.js.map +1 -0
  29. package/src/lib/plan-entitlements.d.ts +2 -1
  30. package/src/lib/plan-entitlements.js +2 -1
  31. package/src/lib/plan-entitlements.js.map +1 -1
  32. package/src/lib/server/cart-checkout.js +3 -0
  33. package/src/lib/server/cart-checkout.js.map +1 -1
  34. package/src/lib/server/checkout-tax-refusal.d.ts +51 -0
  35. package/src/lib/server/checkout-tax-refusal.js +133 -0
  36. package/src/lib/server/checkout-tax-refusal.js.map +1 -0
  37. package/src/lib/server/checkout.d.ts +2 -1
  38. package/src/lib/server/checkout.js +7 -2
  39. package/src/lib/server/checkout.js.map +1 -1
  40. package/src/lib/server/connect-prefill.d.ts +65 -0
  41. package/src/lib/server/connect-prefill.js +85 -0
  42. package/src/lib/server/connect-prefill.js.map +1 -0
  43. package/src/lib/server/connect.d.ts +4 -2
  44. package/src/lib/server/connect.js +117 -37
  45. package/src/lib/server/connect.js.map +1 -1
  46. package/src/lib/server/draft-order.js +4 -2
  47. package/src/lib/server/draft-order.js.map +1 -1
  48. package/src/lib/server/pos-order.js +1 -1
  49. package/src/lib/server/pos-order.js.map +1 -1
  50. package/src/lib/server/product-writer.d.ts +27 -0
  51. package/src/lib/server/product-writer.js +174 -4
  52. package/src/lib/server/product-writer.js.map +1 -1
  53. package/src/lib/server/quote-pay.d.ts +6 -0
  54. package/src/lib/server/quote-pay.js +8 -2
  55. package/src/lib/server/quote-pay.js.map +1 -1
  56. package/src/lib/server/seller-stripe-account.d.ts +19 -0
  57. package/src/lib/server/seller-stripe-account.js +40 -4
  58. package/src/lib/server/seller-stripe-account.js.map +1 -1
  59. package/src/lib/server/site-page-resolver.d.ts +1 -6
  60. package/src/lib/server/site-page-resolver.js +4 -12
  61. package/src/lib/server/site-page-resolver.js.map +1 -1
  62. package/src/lib/server/site-search.d.ts +43 -0
  63. package/src/lib/server/site-search.js +124 -0
  64. package/src/lib/server/site-search.js.map +1 -0
  65. package/src/lib/server/tax-readiness.d.ts +56 -0
  66. package/src/lib/server/tax-readiness.js +169 -0
  67. package/src/lib/server/tax-readiness.js.map +1 -0
  68. package/src/lib/server.js +6 -0
  69. package/src/lib/server.js.map +1 -1
  70. package/src/lib/transfer/product-image-copy.server.d.ts +77 -0
  71. package/src/lib/transfer/product-image-copy.server.js +307 -0
  72. package/src/lib/transfer/product-image-copy.server.js.map +1 -0
  73. package/src/lib/transfer/product-images.d.ts +62 -0
  74. package/src/lib/transfer/product-images.js +143 -0
  75. package/src/lib/transfer/product-images.js.map +1 -0
  76. package/src/lib/transfer/product-sources.d.ts +92 -0
  77. package/src/lib/transfer/product-sources.js +519 -0
  78. package/src/lib/transfer/product-sources.js.map +1 -0
  79. package/src/lib/transfer/product-transfer.d.ts +26 -1
  80. package/src/lib/transfer/product-transfer.js +283 -11
  81. package/src/lib/transfer/product-transfer.js.map +1 -1
  82. package/src/lib/transfer/products.server.d.ts +29 -3
  83. package/src/lib/transfer/products.server.js +289 -13
  84. package/src/lib/transfer/products.server.js.map +1 -1
@@ -0,0 +1,45 @@
1
+ import { type StoreTaxReadiness } from '../../model/commerce-tax-readiness';
2
+ export type StoreTaxReadinessState = 'loading' | 'ready' | 'error';
3
+ export interface StoreTaxReadinessRead {
4
+ state: StoreTaxReadinessState;
5
+ /** The route's answer; null until it has answered once. */
6
+ data: StoreTaxReadiness | null;
7
+ /** Asks again, past the route's short cache ("Check again"). */
8
+ recheck(): void;
9
+ /** A recheck is on its way. */
10
+ checking: boolean;
11
+ }
12
+ /**
13
+ * The store's sales tax readiness (AGL-4245), from
14
+ * `GET /api/commerce/tax-readiness`. `key` re-asks when it changes: the
15
+ * Taxes card passes the saved mode, so saving a choice reads the store again
16
+ * (which is also what clears the owner's refusal alert on the server).
17
+ */
18
+ export declare function useStoreTaxReadiness(hostId: string | undefined, key?: unknown): StoreTaxReadinessRead;
19
+ /** The tax options the card offers, by the label its select shows. */
20
+ export type TaxModeChoice = 'manual' | 'stripe' | 'none';
21
+ /** "Turned away on 24 Nov", or null without a date. */
22
+ export declare function refusedOnText(refusedAtMs: number | null | undefined): string | null;
23
+ export interface StripeTaxReadinessPanelProps {
24
+ readiness: StoreTaxReadinessRead;
25
+ /** The mode saved on the store; null when none was ever saved. */
26
+ savedMode: string | null | undefined;
27
+ /** Picks another tax option on the card (the owner still saves it). */
28
+ onChooseMode(mode: TaxModeChoice): void;
29
+ }
30
+ /**
31
+ * What the Taxes card shows under "Stripe Tax (automatic)" (AGL-4245), in
32
+ * place of the old "Activate Stripe Tax in your Stripe dashboard first."
33
+ *
34
+ * Only a store on its own Stripe account has a Stripe Tax of its own to set
35
+ * up. For one that has not finished it, the panel says what checkout does
36
+ * because of it, lists exactly what Stripe says is left, opens the right
37
+ * Stripe Dashboard page, re-reads on "Check again", and offers the options
38
+ * that work today. Shown before Stripe Tax is saved too, so the owner knows
39
+ * before they choose it.
40
+ */
41
+ export declare function StripeTaxReadinessPanel(props: StripeTaxReadinessPanelProps): import("react").JSX.Element;
42
+ export declare namespace StripeTaxReadinessPanel {
43
+ var displayName: string;
44
+ }
45
+ export default StripeTaxReadinessPanel;
@@ -0,0 +1,276 @@
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
+ */ 'use client';
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
19
+ import { useUser } from "@aglyn/tenant-feature-instance";
20
+ import { Alert, AlertTitle, Box, Button, Stack, Typography } from "@mui/material";
21
+ import { useCallback, useEffect, useRef, useState } from "react";
22
+ import { STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL, STRIPE_TAX_SETTINGS_DASHBOARD_URL, STRIPE_TAX_STEP_TEXT } from "../../model/commerce-tax-readiness.js";
23
+ /**
24
+ * The store's sales tax readiness (AGL-4245), from
25
+ * `GET /api/commerce/tax-readiness`. `key` re-asks when it changes: the
26
+ * Taxes card passes the saved mode, so saving a choice reads the store again
27
+ * (which is also what clears the owner's refusal alert on the server).
28
+ */ export function useStoreTaxReadiness(hostId, key) {
29
+ const { data: user } = useUser();
30
+ // Keyed on the uid, not the user object: a refreshed token is a new object.
31
+ const userRef = useRef(user);
32
+ userRef.current = user;
33
+ const uid = user == null ? void 0 : user.uid;
34
+ const [state, setState] = useState('loading');
35
+ const [data, setData] = useState(null);
36
+ const [nonce, setNonce] = useState(0);
37
+ const [checking, setChecking] = useState(false);
38
+ useEffect(()=>{
39
+ const current = userRef.current;
40
+ if (!uid || !current || !hostId) return;
41
+ let cancelled = false;
42
+ const fresh = nonce > 0 ? '&fresh=1' : '';
43
+ void (async ()=>{
44
+ try {
45
+ const response = await authorizedFetch(current, `/api/commerce/tax-readiness?hostId=${encodeURIComponent(hostId)}${fresh}`);
46
+ if (cancelled) return;
47
+ if (!response.ok) {
48
+ setState('error');
49
+ return;
50
+ }
51
+ const payload = await response.json();
52
+ if (cancelled) return;
53
+ setData(payload && typeof payload === 'object' ? payload : null);
54
+ setState('ready');
55
+ } catch (unused) {
56
+ if (!cancelled) setState('error');
57
+ } finally{
58
+ if (!cancelled) setChecking(false);
59
+ }
60
+ })();
61
+ return ()=>{
62
+ cancelled = true;
63
+ };
64
+ }, [
65
+ uid,
66
+ hostId,
67
+ nonce,
68
+ key
69
+ ]);
70
+ const recheck = useCallback(()=>{
71
+ setChecking(true);
72
+ setNonce((value)=>value + 1);
73
+ }, []);
74
+ return {
75
+ state,
76
+ data,
77
+ recheck,
78
+ checking
79
+ };
80
+ }
81
+ /** "Turned away on 24 Nov", or null without a date. */ export function refusedOnText(refusedAtMs) {
82
+ if (!refusedAtMs || !Number.isFinite(refusedAtMs)) return null;
83
+ const day = new Date(refusedAtMs).toLocaleDateString(undefined, {
84
+ month: 'short',
85
+ day: 'numeric'
86
+ });
87
+ return `A shopper was turned away at checkout on ${day}.`;
88
+ }
89
+ const stepsFor = (missing)=>missing.length ? [
90
+ ...missing
91
+ ] : [
92
+ 'head-office'
93
+ ];
94
+ /**
95
+ * What the Taxes card shows under "Stripe Tax (automatic)" (AGL-4245), in
96
+ * place of the old "Activate Stripe Tax in your Stripe dashboard first."
97
+ *
98
+ * Only a store on its own Stripe account has a Stripe Tax of its own to set
99
+ * up. For one that has not finished it, the panel says what checkout does
100
+ * because of it, lists exactly what Stripe says is left, opens the right
101
+ * Stripe Dashboard page, re-reads on "Check again", and offers the options
102
+ * that work today. Shown before Stripe Tax is saved too, so the owner knows
103
+ * before they choose it.
104
+ */ export function StripeTaxReadinessPanel(props) {
105
+ const { readiness, savedMode, onChooseMode } = props;
106
+ const answer = readiness.data;
107
+ const checkAgain = /*#__PURE__*/ _jsx(Button, {
108
+ size: "small",
109
+ variant: "outlined",
110
+ onClick: readiness.recheck,
111
+ disabled: readiness.checking,
112
+ children: readiness.checking ? 'Checking…' : 'Check again'
113
+ });
114
+ if (!answer) {
115
+ if (readiness.state === 'error') {
116
+ return /*#__PURE__*/ _jsxs(Stack, {
117
+ spacing: 1,
118
+ sx: {
119
+ alignItems: 'flex-start'
120
+ },
121
+ children: [
122
+ /*#__PURE__*/ _jsx(Typography, {
123
+ variant: "body2",
124
+ color: "text.secondary",
125
+ children: 'Stripe Tax works out the tax for each buyer’s location at checkout. ' + 'We couldn’t check its setup just now.'
126
+ }),
127
+ checkAgain
128
+ ]
129
+ });
130
+ }
131
+ return /*#__PURE__*/ _jsx(Typography, {
132
+ variant: "body2",
133
+ color: "text.secondary",
134
+ children: 'Stripe Tax works out the tax for each buyer’s location at checkout.'
135
+ });
136
+ }
137
+ if (!answer.direct || !answer.stripeTax) {
138
+ return /*#__PURE__*/ _jsx(Typography, {
139
+ variant: "body2",
140
+ color: "text.secondary",
141
+ children: 'Stripe Tax works out the tax for each buyer’s location at checkout.'
142
+ });
143
+ }
144
+ const stripeTax = answer.stripeTax;
145
+ if (stripeTax.active) {
146
+ return /*#__PURE__*/ _jsxs(Stack, {
147
+ spacing: 1,
148
+ children: [
149
+ /*#__PURE__*/ _jsx(Typography, {
150
+ variant: "body2",
151
+ color: "text.secondary",
152
+ role: "status",
153
+ children: 'Stripe Tax is on in your Stripe account. It works out the tax for each buyer’s location at checkout.'
154
+ }),
155
+ stripeTax.hasRegistration === false ? /*#__PURE__*/ _jsx(Alert, {
156
+ severity: "info",
157
+ action: /*#__PURE__*/ _jsx(Button, {
158
+ color: "inherit",
159
+ size: "small",
160
+ component: "a",
161
+ href: STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL,
162
+ target: "_blank",
163
+ rel: "noopener noreferrer",
164
+ children: 'Add a place'
165
+ }),
166
+ children: 'Stripe Tax adds no tax until you add at least one place you collect tax.'
167
+ }) : null
168
+ ]
169
+ });
170
+ }
171
+ const saved = savedMode === 'stripe';
172
+ const steps = stepsFor(stripeTax.missing);
173
+ const needsSettings = steps.some((step)=>step !== 'registration');
174
+ const refused = saved ? refusedOnText(answer.refusedAtMs) : null;
175
+ return /*#__PURE__*/ _jsxs(Alert, {
176
+ severity: "warning",
177
+ role: "alert",
178
+ children: [
179
+ /*#__PURE__*/ _jsx(AlertTitle, {
180
+ children: saved ? 'Shoppers can’t check out until Stripe Tax is on' : 'Stripe Tax isn’t on in your Stripe account yet'
181
+ }),
182
+ /*#__PURE__*/ _jsxs(Stack, {
183
+ spacing: 1.25,
184
+ children: [
185
+ /*#__PURE__*/ _jsx(Typography, {
186
+ variant: "body2",
187
+ children: !stripeTax.readable ? 'We couldn’t check Stripe Tax in your Stripe account just now. Until it reads as on, checkout stays off.' : saved ? 'Checkout is off while Stripe Tax is unfinished, so no order is sold without tax. What’s left in Stripe:' : 'If you save Stripe Tax now, shoppers can’t check out until it is on. What’s left in Stripe:'
188
+ }),
189
+ stripeTax.readable ? /*#__PURE__*/ _jsx(Box, {
190
+ component: "ol",
191
+ sx: {
192
+ m: 0,
193
+ pl: 3
194
+ },
195
+ children: steps.map((step)=>/*#__PURE__*/ _jsx("li", {
196
+ children: /*#__PURE__*/ _jsx(Typography, {
197
+ variant: "body2",
198
+ children: STRIPE_TAX_STEP_TEXT[step]
199
+ })
200
+ }, step))
201
+ }) : null,
202
+ refused ? /*#__PURE__*/ _jsx(Typography, {
203
+ variant: "body2",
204
+ children: refused
205
+ }) : null,
206
+ /*#__PURE__*/ _jsxs(Stack, {
207
+ direction: {
208
+ xs: 'column',
209
+ sm: 'row'
210
+ },
211
+ spacing: 1,
212
+ sx: {
213
+ alignItems: {
214
+ xs: 'flex-start',
215
+ sm: 'center'
216
+ }
217
+ },
218
+ children: [
219
+ needsSettings || !stripeTax.readable ? /*#__PURE__*/ _jsx(Button, {
220
+ size: "small",
221
+ variant: "contained",
222
+ color: "inherit",
223
+ component: "a",
224
+ href: STRIPE_TAX_SETTINGS_DASHBOARD_URL,
225
+ target: "_blank",
226
+ rel: "noopener noreferrer",
227
+ children: 'Open Stripe Tax settings'
228
+ }) : null,
229
+ steps.includes('registration') ? /*#__PURE__*/ _jsx(Button, {
230
+ size: "small",
231
+ variant: needsSettings ? 'outlined' : 'contained',
232
+ color: "inherit",
233
+ component: "a",
234
+ href: STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL,
235
+ target: "_blank",
236
+ rel: "noopener noreferrer",
237
+ children: 'Open tax registrations'
238
+ }) : null,
239
+ checkAgain
240
+ ]
241
+ }),
242
+ /*#__PURE__*/ _jsx(Typography, {
243
+ variant: "body2",
244
+ children: saved ? 'To take orders now, choose another option and save. You can switch back once Stripe Tax is on.' : 'You can turn it on first and come back, or use another option that works today.'
245
+ }),
246
+ /*#__PURE__*/ _jsxs(Stack, {
247
+ direction: "row",
248
+ spacing: 1,
249
+ sx: {
250
+ flexWrap: 'wrap',
251
+ rowGap: 1
252
+ },
253
+ children: [
254
+ /*#__PURE__*/ _jsx(Button, {
255
+ size: "small",
256
+ color: "inherit",
257
+ onClick: ()=>onChooseMode('manual'),
258
+ children: 'Use manual rates'
259
+ }),
260
+ /*#__PURE__*/ _jsx(Button, {
261
+ size: "small",
262
+ color: "inherit",
263
+ onClick: ()=>onChooseMode('none'),
264
+ children: 'Don’t collect sales tax'
265
+ })
266
+ ]
267
+ })
268
+ ]
269
+ })
270
+ ]
271
+ });
272
+ }
273
+ StripeTaxReadinessPanel.displayName = 'StripeTaxReadinessPanel';
274
+ export default StripeTaxReadinessPanel;
275
+
276
+ //# sourceMappingURL=stripe-tax-readiness.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/stripe-tax-readiness.component.tsx"],"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'use client'\n\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport { Alert, AlertTitle, Box, Button, Stack, Typography } from '@mui/material'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport {\n STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL,\n STRIPE_TAX_SETTINGS_DASHBOARD_URL,\n STRIPE_TAX_STEP_TEXT,\n type StoreTaxReadiness,\n type StripeTaxSetupStep,\n} from '../../model/commerce-tax-readiness'\n\nexport type StoreTaxReadinessState = 'loading' | 'ready' | 'error'\n\nexport interface StoreTaxReadinessRead {\n state: StoreTaxReadinessState\n /** The route's answer; null until it has answered once. */\n data: StoreTaxReadiness | null\n /** Asks again, past the route's short cache (\"Check again\"). */\n recheck(): void\n /** A recheck is on its way. */\n checking: boolean\n}\n\n/**\n * The store's sales tax readiness (AGL-4245), from\n * `GET /api/commerce/tax-readiness`. `key` re-asks when it changes: the\n * Taxes card passes the saved mode, so saving a choice reads the store again\n * (which is also what clears the owner's refusal alert on the server).\n */\nexport function useStoreTaxReadiness(\n hostId: string | undefined,\n key?: unknown,\n): StoreTaxReadinessRead {\n const { data: user } = useUser()\n // Keyed on the uid, not the user object: a refreshed token is a new object.\n const userRef = useRef(user)\n userRef.current = user\n const uid = user?.uid\n const [state, setState] = useState<StoreTaxReadinessState>('loading')\n const [data, setData] = useState<StoreTaxReadiness | null>(null)\n const [nonce, setNonce] = useState(0)\n const [checking, setChecking] = useState(false)\n\n useEffect(() => {\n const current = userRef.current\n if (!uid || !current || !hostId) return\n let cancelled = false\n const fresh = nonce > 0 ? '&fresh=1' : ''\n void (async () => {\n try {\n const response = await authorizedFetch(\n current,\n `/api/commerce/tax-readiness?hostId=${encodeURIComponent(hostId)}${fresh}`,\n )\n if (cancelled) return\n if (!response.ok) {\n setState('error')\n return\n }\n const payload = (await response.json()) as StoreTaxReadiness\n if (cancelled) return\n setData(payload && typeof payload === 'object' ? payload : null)\n setState('ready')\n } catch {\n if (!cancelled) setState('error')\n } finally {\n if (!cancelled) setChecking(false)\n }\n })()\n return () => {\n cancelled = true\n }\n }, [uid, hostId, nonce, key])\n\n const recheck = useCallback(() => {\n setChecking(true)\n setNonce((value) => value + 1)\n }, [])\n\n return { state, data, recheck, checking }\n}\n\n/** The tax options the card offers, by the label its select shows. */\nexport type TaxModeChoice = 'manual' | 'stripe' | 'none'\n\n/** \"Turned away on 24 Nov\", or null without a date. */\nexport function refusedOnText(refusedAtMs: number | null | undefined): string | null {\n if (!refusedAtMs || !Number.isFinite(refusedAtMs)) return null\n const day = new Date(refusedAtMs).toLocaleDateString(undefined, { month: 'short', day: 'numeric' })\n return `A shopper was turned away at checkout on ${day}.`\n}\n\nconst stepsFor = (missing: readonly StripeTaxSetupStep[]): StripeTaxSetupStep[] =>\n missing.length ? [...missing] : ['head-office']\n\nexport interface StripeTaxReadinessPanelProps {\n readiness: StoreTaxReadinessRead\n /** The mode saved on the store; null when none was ever saved. */\n savedMode: string | null | undefined\n /** Picks another tax option on the card (the owner still saves it). */\n onChooseMode(mode: TaxModeChoice): void\n}\n\n/**\n * What the Taxes card shows under \"Stripe Tax (automatic)\" (AGL-4245), in\n * place of the old \"Activate Stripe Tax in your Stripe dashboard first.\"\n *\n * Only a store on its own Stripe account has a Stripe Tax of its own to set\n * up. For one that has not finished it, the panel says what checkout does\n * because of it, lists exactly what Stripe says is left, opens the right\n * Stripe Dashboard page, re-reads on \"Check again\", and offers the options\n * that work today. Shown before Stripe Tax is saved too, so the owner knows\n * before they choose it.\n */\nexport function StripeTaxReadinessPanel(props: StripeTaxReadinessPanelProps) {\n const { readiness, savedMode, onChooseMode } = props\n const answer = readiness.data\n const checkAgain = (\n <Button size=\"small\" variant=\"outlined\" onClick={readiness.recheck} disabled={readiness.checking}>\n {readiness.checking ? 'Checking…' : 'Check again'}\n </Button>\n )\n if (!answer) {\n if (readiness.state === 'error') {\n return (\n <Stack spacing={1} sx={{ alignItems: 'flex-start' }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Stripe Tax works out the tax for each buyer’s location at checkout. ' +\n 'We couldn’t check its setup just now.'}\n </Typography>\n {checkAgain}\n </Stack>\n )\n }\n return (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Stripe Tax works out the tax for each buyer’s location at checkout.'}\n </Typography>\n )\n }\n if (!answer.direct || !answer.stripeTax) {\n return (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Stripe Tax works out the tax for each buyer’s location at checkout.'}\n </Typography>\n )\n }\n const stripeTax = answer.stripeTax\n if (stripeTax.active) {\n return (\n <Stack spacing={1}>\n <Typography variant=\"body2\" color=\"text.secondary\" role=\"status\">\n {'Stripe Tax is on in your Stripe account. It works out the tax for each buyer’s location at checkout.'}\n </Typography>\n {stripeTax.hasRegistration === false ? (\n <Alert\n severity=\"info\"\n action={\n <Button\n color=\"inherit\"\n size=\"small\"\n component=\"a\"\n href={STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {'Add a place'}\n </Button>\n }\n >\n {'Stripe Tax adds no tax until you add at least one place you collect tax.'}\n </Alert>\n ) : null}\n </Stack>\n )\n }\n\n const saved = savedMode === 'stripe'\n const steps = stepsFor(stripeTax.missing)\n const needsSettings = steps.some((step) => step !== 'registration')\n const refused = saved ? refusedOnText(answer.refusedAtMs) : null\n return (\n <Alert severity=\"warning\" role=\"alert\">\n <AlertTitle>\n {saved\n ? 'Shoppers can’t check out until Stripe Tax is on'\n : 'Stripe Tax isn’t on in your Stripe account yet'}\n </AlertTitle>\n <Stack spacing={1.25}>\n <Typography variant=\"body2\">\n {!stripeTax.readable\n ? 'We couldn’t check Stripe Tax in your Stripe account just now. Until it reads as on, checkout stays off.'\n : saved\n ? 'Checkout is off while Stripe Tax is unfinished, so no order is sold without tax. What’s left in Stripe:'\n : 'If you save Stripe Tax now, shoppers can’t check out until it is on. What’s left in Stripe:'}\n </Typography>\n {stripeTax.readable ? (\n <Box component=\"ol\" sx={{ m: 0, pl: 3 }}>\n {steps.map((step) => (\n <li key={step}>\n <Typography variant=\"body2\">{STRIPE_TAX_STEP_TEXT[step]}</Typography>\n </li>\n ))}\n </Box>\n ) : null}\n {refused ? <Typography variant=\"body2\">{refused}</Typography> : null}\n <Stack direction={{ xs: 'column', sm: 'row' }} spacing={1} sx={{ alignItems: { xs: 'flex-start', sm: 'center' } }}>\n {needsSettings || !stripeTax.readable ? (\n <Button\n size=\"small\"\n variant=\"contained\"\n color=\"inherit\"\n component=\"a\"\n href={STRIPE_TAX_SETTINGS_DASHBOARD_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {'Open Stripe Tax settings'}\n </Button>\n ) : null}\n {steps.includes('registration') ? (\n <Button\n size=\"small\"\n variant={needsSettings ? 'outlined' : 'contained'}\n color=\"inherit\"\n component=\"a\"\n href={STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {'Open tax registrations'}\n </Button>\n ) : null}\n {checkAgain}\n </Stack>\n <Typography variant=\"body2\">\n {saved\n ? 'To take orders now, choose another option and save. You can switch back once Stripe Tax is on.'\n : 'You can turn it on first and come back, or use another option that works today.'}\n </Typography>\n <Stack direction=\"row\" spacing={1} sx={{ flexWrap: 'wrap', rowGap: 1 }}>\n <Button size=\"small\" color=\"inherit\" onClick={() => onChooseMode('manual')}>\n {'Use manual rates'}\n </Button>\n <Button size=\"small\" color=\"inherit\" onClick={() => onChooseMode('none')}>\n {'Don’t collect sales tax'}\n </Button>\n </Stack>\n </Stack>\n </Alert>\n )\n}\nStripeTaxReadinessPanel.displayName = 'StripeTaxReadinessPanel'\n\nexport default StripeTaxReadinessPanel\n"],"names":["authorizedFetch","useUser","Alert","AlertTitle","Box","Button","Stack","Typography","useCallback","useEffect","useRef","useState","STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL","STRIPE_TAX_SETTINGS_DASHBOARD_URL","STRIPE_TAX_STEP_TEXT","useStoreTaxReadiness","hostId","key","data","user","userRef","current","uid","state","setState","setData","nonce","setNonce","checking","setChecking","cancelled","fresh","response","encodeURIComponent","ok","payload","json","recheck","value","refusedOnText","refusedAtMs","Number","isFinite","day","Date","toLocaleDateString","undefined","month","stepsFor","missing","length","StripeTaxReadinessPanel","props","readiness","savedMode","onChooseMode","answer","checkAgain","size","variant","onClick","disabled","spacing","sx","alignItems","color","direct","stripeTax","active","role","hasRegistration","severity","action","component","href","target","rel","saved","steps","needsSettings","some","step","refused","readable","m","pl","map","li","direction","xs","sm","includes","flexWrap","rowGap","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SAASA,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,OAAO,QAAQ,iCAAgC;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YAAY;gCAAEyB,IAAI;gCAAcC,IAAI;4BAAS;wBAAE;;4BAC7GX,iBAAiB,CAACZ,UAAUgB,QAAQ,iBACnC,KAAC9E;gCACCqD,MAAK;gCACLC,SAAQ;gCACRM,OAAM;gCACNQ,WAAU;gCACVC,MAAM7D;gCACN8D,QAAO;gCACPC,KAAI;0CAEH;iCAED;4BACHE,MAAMa,QAAQ,CAAC,gCACd,KAACtF;gCACCqD,MAAK;gCACLC,SAASoB,gBAAgB,aAAa;gCACtCd,OAAM;gCACNQ,WAAU;gCACVC,MAAM9D;gCACN+D,QAAO;gCACPC,KAAI;0CAEH;iCAED;4BACHnB;;;kCAEH,KAAClD;wBAAWoD,SAAQ;kCACjBkB,QACG,mGACA;;kCAEN,MAACvE;wBAAMkF,WAAU;wBAAM1B,SAAS;wBAAGC,IAAI;4BAAE6B,UAAU;4BAAQC,QAAQ;wBAAE;;0CACnE,KAACxF;gCAAOqD,MAAK;gCAAQO,OAAM;gCAAUL,SAAS,IAAML,aAAa;0CAC9D;;0CAEH,KAAClD;gCAAOqD,MAAK;gCAAQO,OAAM;gCAAUL,SAAS,IAAML,aAAa;0CAC9D;;;;;;;;AAMb;AACAJ,wBAAwB2C,WAAW,GAAG;AAEtC,eAAe3C,wBAAuB"}
@@ -27,6 +27,7 @@ import { useFirestore } from "@aglyn/tenant-feature-instance";
27
27
  import { useFirestoreDoc, writeGuardedBySeed } from "@aglyn/tenant-feature-instance";
28
28
  import { pluginDocsHelp } from "@aglyn/aglyn";
29
29
  import { heldSaveLabel, isSeedChecking, seedCheckingText, useHeldSave, useSeedEdits } from "@aglyn/tenant-feature-instance/hooks/use-seed-edits";
30
+ import { refusedOnText, StripeTaxReadinessPanel, useStoreTaxReadiness } from "./stripe-tax-readiness.component.js";
30
31
  /**
31
32
  * Tax settings (AGL-285): manual per-region rates (most-specific wins)
32
33
  * or Stripe Tax automatic calculation, stored on
@@ -34,7 +35,7 @@ import { heldSaveLabel, isSeedChecking, seedCheckingText, useHeldSave, useSeedEd
34
35
  * checkout taxes by the store origin; Checkout v2 taxes by destination.
35
36
  */ export function TaxSettingsCard(props) {
36
37
  var _ref, _current_mode, _ref1, _ref2, _current_rates, _flatPctProblem, _ref3, _flatPctProblem1, _ref4;
37
- var _store_tax, _current_origin, _current_origin1, _current_lodging, _current_service;
38
+ var _store_tax, _store_tax1, _readiness_data, _readiness_data1, _current_origin, _current_origin1, _current_lodging, _current_service;
38
39
  const { hostId } = props;
39
40
  const firestore = useFirestore();
40
41
  const { enqueueSnackbar } = useSnackbar();
@@ -70,6 +71,14 @@ import { heldSaveLabel, isSeedChecking, seedCheckingText, useHeldSave, useSeedEd
70
71
  * has to show it rather than paper over it.
71
72
  */ const decided = storeStatus !== 'loading' && typeof (store == null ? void 0 : (_store_tax = store.tax) == null ? void 0 : _store_tax.mode) === 'string';
72
73
  const update = (patch)=>form.edit(patch);
74
+ /**
75
+ * Whether the tax choice lets shoppers check out (AGL-4245): the store's own
76
+ * Stripe Tax, read live, and when a shopper was last turned away. Re-read
77
+ * when the saved mode changes, which also clears the owner's alert once the
78
+ * store is no longer blocked.
79
+ */ const savedMode = decided ? store == null ? void 0 : (_store_tax1 = store.tax) == null ? void 0 : _store_tax1.mode : null;
80
+ const readiness = useStoreTaxReadiness(hostId, savedMode);
81
+ const stripeTaxOff = Boolean(((_readiness_data = readiness.data) == null ? void 0 : _readiness_data.direct) && readiness.data.stripeTax && !readiness.data.stripeTax.active);
73
82
  const updateRate = (index, patch)=>{
74
83
  var _current_rates;
75
84
  const rates = [
@@ -180,9 +189,12 @@ import { heldSaveLabel, isSeedChecking, seedCheckingText, useHeldSave, useSeedEd
180
189
  children: [
181
190
  decided ? null : // The store is not selling. Saying so here is the whole point: the
182
191
  // silent version of this state charged shoppers an untaxed total.
183
- /*#__PURE__*/ _jsx(Alert, {
192
+ /*#__PURE__*/ _jsxs(Alert, {
184
193
  severity: "warning",
185
- children: 'Choose how this store handles sales tax and save. Until you ' + 'do, checkout is turned off — we won’t take an order we can’t ' + 'tax correctly.'
194
+ children: [
195
+ 'Choose how this store handles sales tax and save. Until you ' + 'do, checkout is turned off — we won’t take an order we can’t ' + 'tax correctly.',
196
+ ((_readiness_data1 = readiness.data) == null ? void 0 : _readiness_data1.blocked) === 'tax-undecided' && refusedOnText(readiness.data.refusedAtMs) ? ` ${refusedOnText(readiness.data.refusedAtMs)}` : null
197
+ ]
186
198
  }),
187
199
  /*#__PURE__*/ _jsxs(TextField, {
188
200
  label: "Calculation",
@@ -202,7 +214,7 @@ import { heldSaveLabel, isSeedChecking, seedCheckingText, useHeldSave, useSeedEd
202
214
  }),
203
215
  /*#__PURE__*/ _jsx(MenuItem, {
204
216
  value: "stripe",
205
- children: 'Stripe Tax (automatic)'
217
+ children: stripeTaxOff ? 'Stripe Tax (automatic): not on in Stripe yet' : 'Stripe Tax (automatic)'
206
218
  }),
207
219
  /*#__PURE__*/ _jsx(MenuItem, {
208
220
  value: "none",
@@ -214,10 +226,12 @@ import { heldSaveLabel, isSeedChecking, seedCheckingText, useHeldSave, useSeedEd
214
226
  variant: "body2",
215
227
  color: "text.secondary",
216
228
  children: 'This store adds no sales tax to any order. Orders still go ' + 'through — the decision is recorded, not the tax.'
217
- }) : current.mode === 'stripe' ? /*#__PURE__*/ _jsx(Typography, {
218
- variant: "body2",
219
- color: "text.secondary",
220
- children: 'Stripe Tax calculates per buyer location at checkout. ' + 'Activate Stripe Tax in your Stripe dashboard first.'
229
+ }) : current.mode === 'stripe' ? /*#__PURE__*/ _jsx(StripeTaxReadinessPanel, {
230
+ readiness: readiness,
231
+ savedMode: savedMode,
232
+ onChooseMode: (mode)=>update({
233
+ mode
234
+ })
221
235
  }) : /*#__PURE__*/ _jsxs(_Fragment, {
222
236
  children: [
223
237
  /*#__PURE__*/ _jsx(FormControlLabel, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/tax-settings-card.component.tsx"],"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'use client'\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport * as CommerceModel from '../../model'\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport {\n Alert,\n Button,\n Divider,\n FormControlLabel,\n MenuItem,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport { doc, setDoc } from 'firebase/firestore'\nimport { useCallback } from 'react'\nimport { useFirestore } from '@aglyn/tenant-feature-instance'\nimport {\n useFirestoreDoc,\n writeGuardedBySeed,\n} from '@aglyn/tenant-feature-instance'\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport {\n heldSaveLabel,\n isSeedChecking,\n seedCheckingText,\n useHeldSave,\n useSeedEdits,\n} from '@aglyn/tenant-feature-instance/hooks/use-seed-edits'\n\nexport interface TaxSettingsCardProps {\n hostId: string\n}\n\n/**\n * Tax settings (AGL-285): manual per-region rates (most-specific wins)\n * or Stripe Tax automatic calculation, stored on\n * `hosts/{hostId}/settings/store` under `tax`. The legacy quick-buy\n * checkout taxes by the store origin; Checkout v2 taxes by destination.\n */\nexport function TaxSettingsCard(props: TaxSettingsCardProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const { enqueueSnackbar } = useSnackbar()\n const {\n data: store,\n status: storeStatus,\n /**\n * The settings doc this form is seeded from is unconfirmed by the server\n * (AGL-1358). `current` is `draft ?? store?.tax ?? {mode: 'manual'}` and\n * the save writes `{tax: current}`, so `merge: true` protects the doc's\n * other maps and nothing inside this one. `mode` is the field that costs\n * money: a cached seed flipping `stripe` back to `manual` stops automatic\n * tax calculation — `resolveTaxRate` returns null in stripe mode — and\n * the store under-collects with nothing anywhere reporting it.\n */\n fromCache: storeFromCache,\n listen: storeListen,\n } = useFirestoreDoc<any>(\n () => doc(firestore, 'hosts', hostId, 'settings', 'store'),\n [firestore, hostId],\n )\n // What was typed, kept as edits over the stored settings, and Save held\n // until the server has confirmed them (AGL-4047).\n const form = useSeedEdits<CommerceModel.TaxSettings>(store?.tax ?? { mode: 'manual' })\n const current = form.values\n const checking = isSeedChecking({ fromCache: storeFromCache, unreadable: storeStatus === 'error' })\n /**\n * Whether anyone has ever answered the tax question for this store\n * (AGL-1999). Read from the SAVED document, never from `current` — the\n * `{ mode: 'manual' }` seed above is local state that has never reached\n * Firestore, and it is exactly what made this invisible: the card looked\n * configured while the server saw `mode: undefined`, took no branch, and\n * sold untaxed. Every storefront path now refuses that state, so the card\n * has to show it rather than paper over it.\n */\n const decided =\n storeStatus !== 'loading' && typeof store?.tax?.mode === 'string'\n const update = (patch: Partial<CommerceModel.TaxSettings>) =>\n form.edit(patch)\n const updateRate = (\n index: number,\n patch: Partial<CommerceModel.TaxRate> | null,\n ) => {\n const rates = [...(current.rates ?? [])]\n if (patch === null) rates.splice(index, 1)\n else rates[index] = { country: '', pct: 0, ...rates[index], ...patch }\n update({ rates })\n }\n /**\n * One of the flat, per-regime rates (AGL-1969 lodging, AGL-2028 services).\n *\n * A blank field clears the rate rather than storing `NaN`: clearing is how a\n * merchant turns the regime back off, and `Number('')` is 0 while\n * `Number(' ')` is also 0 — neither of which should ever reach the document\n * as a \"rate\".\n */\n const updateFlat = (\n key: 'lodging' | 'service',\n patch: Partial<CommerceModel.FlatTaxRate>,\n ) => update({ [key]: { ...current[key], ...patch } })\n const flatPctText = (key: 'lodging' | 'service') => {\n const pct = current[key]?.pct\n return pct === undefined || pct === null ? '' : String(pct)\n }\n /**\n * Shown under a typed rate this will NOT apply. Silence here would be the\n * failure: `resolveFlatTaxCents` treats an out-of-range percentage as off,\n * so a decimal-point typo would otherwise save cleanly and collect nothing.\n */\n const flatPctProblem = (key: 'lodging' | 'service'): string | null => {\n const raw = current[key]?.pct\n if (raw === undefined || raw === null || String(raw) === '') return null\n if (Number(raw) === 0) return null\n return CommerceModel.isUsableFlatTaxPct(raw)\n ? null\n : `Enter a percentage between 0 and ${CommerceModel.FLAT_TAX_MAX_PCT}. ` +\n 'This rate is not being applied.'\n }\n\n const handleSave = useCallback(async () => {\n /**\n * Refuse a save whose seed the server never confirmed (AGL-1358).\n *\n * No create path to exempt: this is a FIXED document path, so the\n * `{mode: 'manual'}` default produced when the cache has never seen the\n * map is not the harmless blank a fresh uid would be — writing it turns\n * automatic tax calculation off on a store that had it on.\n *\n * The guard WRAPS the write — an early return is a shape you can keep\n * while losing the protection.\n */\n const written = form.edits\n const verdict = await writeGuardedBySeed(\n {\n subject: 'tax settings',\n unreadable: storeStatus === 'error',\n fromCache: storeFromCache,\n listen: storeListen,\n },\n async () => {\n await setDoc(\n doc(firestore, 'hosts', hostId, 'settings', 'store'),\n { tax: current },\n { merge: true },\n )\n },\n )\n // Before `settle`, so a refusal keeps every typed rate on screen.\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, {\n variant: 'warning',\n persist: false,\n })\n }\n form.settle(written)\n enqueueSnackbar('Tax settings saved', { variant: 'success', persist: false })\n }, [current, form, firestore, hostId, enqueueSnackbar, storeStatus, storeFromCache, storeListen])\n\n // A press while Save is held is kept, and saves once confirmed (AGL-4047).\n const held = useHeldSave(handleSave, {\n checking,\n subject: 'tax settings',\n onRefused: (message) => enqueueSnackbar(message, { variant: 'warning', persist: false }),\n })\n\n return (\n <CardDisplay\n // Another plugin's card scrolls here (the tax service's \"Go to Taxes\",\n // AGL-3693), restating this id rather than importing this package.\n id=\"commerce-store-taxes\"\n header={'Taxes'}\n help={pluginDocsHelp('commerce', { anchor: '#tax-settings' })}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1.5}>\n {decided ? null : (\n // The store is not selling. Saying so here is the whole point: the\n // silent version of this state charged shoppers an untaxed total.\n <Alert severity=\"warning\">\n {'Choose how this store handles sales tax and save. Until you ' +\n 'do, checkout is turned off — we won’t take an order we can’t ' +\n 'tax correctly.'}\n </Alert>\n )}\n <TextField\n label=\"Calculation\"\n value={current.mode ?? 'manual'}\n onChange={(event) =>\n update({\n mode: event.target.value as 'manual' | 'stripe' | 'none',\n })\n }\n size=\"small\"\n select\n sx={{ maxWidth: 280 }}\n >\n <MenuItem value=\"manual\">{'Manual rates (below)'}</MenuItem>\n <MenuItem value=\"stripe\">{'Stripe Tax (automatic)'}</MenuItem>\n {/* An explicit decision, not an omission (AGL-1999) — the option a\n merchant under a nexus threshold, or selling non-taxable goods,\n needs in order to sell at all. */}\n <MenuItem value=\"none\">{'Don’t collect sales tax'}</MenuItem>\n </TextField>\n {current.mode === 'none' ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'This store adds no sales tax to any order. Orders still go ' +\n 'through — the decision is recorded, not the tax.'}\n </Typography>\n ) : current.mode === 'stripe' ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Stripe Tax calculates per buyer location at checkout. ' +\n 'Activate Stripe Tax in your Stripe dashboard first.'}\n </Typography>\n ) : (\n <>\n <FormControlLabel\n control={\n <Switch\n size=\"small\"\n checked={Boolean(current.pricesIncludeTax)}\n onChange={(event) =>\n update({ pricesIncludeTax: event.target.checked })\n }\n />\n }\n label=\"Prices include tax (VAT-style)\"\n />\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Origin country\"\n value={current.origin?.country ?? ''}\n onChange={(event) =>\n update({\n origin: {\n ...current.origin,\n country: event.target.value.toUpperCase().slice(0, 2),\n },\n })\n }\n size=\"small\"\n sx={{ width: 140 }}\n placeholder=\"US\"\n />\n <TextField\n label=\"Origin state\"\n value={current.origin?.state ?? ''}\n onChange={(event) =>\n update({\n origin: {\n ...current.origin,\n state: event.target.value.toUpperCase().slice(0, 3),\n },\n })\n }\n size=\"small\"\n sx={{ width: 140 }}\n placeholder=\"TX\"\n />\n </Stack>\n {/* Which of the product's three addresses this is. A merchant\n who reads an unlabeled origin as \"our address\" may set it\n from the wrong one: the address the workspace pays Aglyn\n from is a different jurisdiction question, and the payout\n identity is a third. Naming the two it is NOT costs a line\n and prevents a mis-taxed order. */}\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Where this store ships or sells FROM — the jurisdiction the ' +\n 'manual rates below are applied from. Not the address your ' +\n 'workspace is billed at by Aglyn, and not where your payouts ' +\n 'are sent.'}\n </Typography>\n {(current.rates ?? []).map((rate, index) => (\n <Stack key={index} direction=\"row\" spacing={1}>\n <TextField\n label=\"Country\"\n value={rate.country}\n onChange={(event) =>\n updateRate(index, {\n country: event.target.value.toUpperCase().slice(0, 2),\n })\n }\n size=\"small\"\n sx={{ width: 90 }}\n />\n <TextField\n label=\"State\"\n value={rate.state ?? ''}\n onChange={(event) =>\n updateRate(index, {\n state:\n event.target.value.toUpperCase().slice(0, 3) ||\n undefined,\n })\n }\n size=\"small\"\n sx={{ width: 80 }}\n />\n <TextField\n label=\"%\"\n value={rate.pct}\n onChange={(event) =>\n updateRate(index, { pct: Number(event.target.value) || 0 })\n }\n size=\"small\"\n sx={{ width: 80 }}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <TextField\n label=\"Label\"\n value={rate.label ?? ''}\n onChange={(event) =>\n updateRate(index, { label: event.target.value })\n }\n size=\"small\"\n sx={{ flex: 1 }}\n placeholder=\"Sales tax\"\n />\n <Button\n size=\"small\"\n color=\"error\"\n onClick={() => updateRate(index, null)}\n >\n {'✕'}\n </Button>\n </Stack>\n ))}\n <Button\n size=\"small\"\n sx={{ alignSelf: 'flex-start' }}\n onClick={() => updateRate(current.rates?.length ?? 0, {})}\n >\n {'Add rate'}\n </Button>\n </>\n )}\n {/*\n LODGING TAX (AGL-1969) — deliberately OUTSIDE the calculation branch\n above, and deliberately not a `rates[]` row.\n\n The setting above is a goods SALES rate resolved against an address.\n Occupancy tax is a different regime with its own rates, registration\n and return, and it applies to reservations, which sell nights rather\n than goods. Nesting it under \"Manual rates\" would have said the two\n are the same machinery; putting it here says a store on Stripe Tax —\n which cannot compute occupancy tax from these sessions at all — can\n still set one.\n\n It is off until the merchant fills it in, so nothing an existing\n store charges moves.\n */}\n <Divider sx={{ my: 0.5 }} />\n <Stack spacing={1}>\n <Typography variant=\"subtitle2\">{'Lodging tax'}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Charged on reservations, on top of the price, using the rate ' +\n 'you enter here. It is separate from the sales tax above ' +\n 'because occupancy tax is its own regime with its own rates ' +\n 'and its own return. Leave it blank to charge none — that is ' +\n 'the default.'}\n </Typography>\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Rate %\"\n value={flatPctText('lodging')}\n onChange={(event) =>\n updateFlat('lodging', {\n pct:\n event.target.value === ''\n ? undefined\n : Number(event.target.value),\n })\n }\n size=\"small\"\n sx={{ width: 110 }}\n placeholder=\"0\"\n error={Boolean(flatPctProblem('lodging'))}\n helperText={flatPctProblem('lodging') ?? ' '}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <TextField\n label=\"Label\"\n value={current.lodging?.label ?? ''}\n onChange={(event) =>\n updateFlat('lodging', { label: event.target.value })\n }\n size=\"small\"\n sx={{ flex: 1 }}\n placeholder=\"Occupancy tax\"\n helperText=\"Shown to the guest on the receipt\"\n />\n </Stack>\n {/*\n MECHANISM ONLY, AND NO REMITTANCE DETERMINATION.\n\n Whether a jurisdiction imposes occupancy tax, who must register for\n it and who must remit it are legal conclusions that attach by\n operation of law (AGL-1904/AGL-1956) and are the merchant's under\n the Terms. This copy says what the software DOES and what it does\n not do, and stops there — including the deposit basis, which is a\n real limitation rather than an answer this product has taken.\n */}\n <Alert severity=\"info\">\n {`${PLATFORM_BRAND_NAME} applies the rate you enter and records ` +\n 'what was charged. It does not determine whether this tax ' +\n 'applies to you, at what rate, or where it should be paid — ' +\n 'that is yours to decide.'}\n </Alert>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'On a reservation that takes a deposit, the rate is applied to ' +\n 'the deposit — the amount actually charged here — not to the ' +\n 'whole stay. If tax is due on the full stay, collect the ' +\n 'difference the same way you collect the rest of the balance.'}\n </Typography>\n </Stack>\n {/*\n SERVICE TAX (AGL-2028) — the bookings sibling of the block above,\n and here for the same reason it is not in the bookings plugin's own\n settings: this is the one card a merchant comes to with a tax\n question, and a second tax surface elsewhere is how one of them ends\n up unanswered.\n\n Its EXISTENCE is also the opt-in AGL-2000 wanted. That issue\n declined to apply the goods rate to an appointment partly because\n nothing said the merchant meant these settings to cover bookings; a\n field labelled for services, blank until they fill it in, is them\n saying so.\n */}\n <Divider sx={{ my: 0.5 }} />\n <Stack spacing={1}>\n <Typography variant=\"subtitle2\">{'Service tax'}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Charged on paid bookings, on top of the price, using the rate ' +\n 'you enter here. It is separate from the sales tax above ' +\n 'because whether a service is taxable is often a different ' +\n 'question from whether goods are. Leave it blank to charge ' +\n 'none — that is the default.'}\n </Typography>\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Rate %\"\n value={flatPctText('service')}\n onChange={(event) =>\n updateFlat('service', {\n pct:\n event.target.value === ''\n ? undefined\n : Number(event.target.value),\n })\n }\n size=\"small\"\n sx={{ width: 110 }}\n placeholder=\"0\"\n error={Boolean(flatPctProblem('service'))}\n helperText={flatPctProblem('service') ?? ' '}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <TextField\n label=\"Label\"\n value={current.service?.label ?? ''}\n onChange={(event) =>\n updateFlat('service', { label: event.target.value })\n }\n size=\"small\"\n sx={{ flex: 1 }}\n placeholder=\"Service tax\"\n helperText=\"Shown to the client on the receipt\"\n />\n </Stack>\n {/* MECHANISM ONLY, AND NO REMITTANCE DETERMINATION — see the\n lodging block above. */}\n <Alert severity=\"info\">\n {`${PLATFORM_BRAND_NAME} applies the rate you enter and records ` +\n 'what was charged. It does not determine whether this tax ' +\n 'applies to you, at what rate, or where it should be paid — ' +\n 'that is yours to decide.'}\n </Alert>\n </Stack>\n <Button\n variant=\"contained\"\n color=\"primary\"\n size=\"small\"\n // An undecided store saves the choice on screen as it stands. The\n // select fires no change for the option already shown, so waiting\n // for an edit left \"Manual rates\" unsaveable and checkout off.\n disabled={storeStatus === 'loading' || (decided && !form.dirty) || held.saving}\n onClick={held.press}\n sx={{ alignSelf: 'flex-start' }}\n >\n {heldSaveLabel(held, 'Save tax settings')}\n </Button>\n {(!decided || form.dirty) && checking ? (\n <Typography variant=\"body2\" color=\"text.secondary\" role=\"status\">\n {seedCheckingText('tax settings')}\n </Typography>\n ) : null}\n </Stack>\n </CardDisplay>\n )\n}\nTaxSettingsCard.displayName = 'TaxSettingsCard'\n\nexport default TaxSettingsCard\n"],"names":["CommerceModel","PLATFORM_BRAND_NAME","CardDisplay","useSnackbar","Alert","Button","Divider","FormControlLabel","MenuItem","Stack","Switch","TextField","Typography","doc","setDoc","useCallback","useFirestore","useFirestoreDoc","writeGuardedBySeed","pluginDocsHelp","heldSaveLabel","isSeedChecking","seedCheckingText","useHeldSave","useSeedEdits","TaxSettingsCard","props","current","flatPctProblem","store","hostId","firestore","enqueueSnackbar","data","status","storeStatus","fromCache","storeFromCache","listen","storeListen","form","tax","mode","values","checking","unreadable","decided","update","patch","edit","updateRate","index","rates","splice","country","pct","updateFlat","key","flatPctText","undefined","String","raw","Number","isUsableFlatTaxPct","FLAT_TAX_MAX_PCT","handleSave","written","edits","verdict","subject","merge","ok","message","variant","persist","settle","held","onRefused","id","header","help","anchor","contentGutterX","contentGutterY","spacing","severity","label","value","onChange","event","target","size","select","sx","maxWidth","color","control","checked","Boolean","pricesIncludeTax","direction","origin","toUpperCase","slice","width","placeholder","state","map","rate","slotProps","htmlInput","inputMode","flex","onClick","alignSelf","length","my","error","helperText","lodging","service","disabled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AGN,KAACI;oBACCoE,SAAQ;oBACRsB,OAAM;oBACNJ,MAAK;oBACL,kEAAkE;oBAClE,kEAAkE;oBAClE,+DAA+D;oBAC/D8B,UAAUtF,gBAAgB,aAAcW,WAAW,CAACN,KAAKkF,KAAK,IAAK9C,KAAK+C,MAAM;oBAC9EV,SAASrC,KAAKgD,KAAK;oBACnB/B,IAAI;wBAAEqB,WAAW;oBAAa;8BAE7B9F,cAAcwD,MAAM;;gBAErB,CAAA,CAAC9B,WAAWN,KAAKkF,KAAK,AAAD,KAAM9E,yBAC3B,KAAChC;oBAAW6D,SAAQ;oBAAQsB,OAAM;oBAAiB8B,MAAK;8BACrDvG,iBAAiB;qBAElB;;;;AAIZ;AACAG,gBAAgBqG,WAAW,GAAG;AAE9B,eAAerG,gBAAe"}
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/tax-settings-card.component.tsx"],"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'use client'\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport * as CommerceModel from '../../model'\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport {\n Alert,\n Button,\n Divider,\n FormControlLabel,\n MenuItem,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport { doc, setDoc } from 'firebase/firestore'\nimport { useCallback } from 'react'\nimport { useFirestore } from '@aglyn/tenant-feature-instance'\nimport {\n useFirestoreDoc,\n writeGuardedBySeed,\n} from '@aglyn/tenant-feature-instance'\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport {\n heldSaveLabel,\n isSeedChecking,\n seedCheckingText,\n useHeldSave,\n useSeedEdits,\n} from '@aglyn/tenant-feature-instance/hooks/use-seed-edits'\nimport {\n refusedOnText,\n StripeTaxReadinessPanel,\n useStoreTaxReadiness,\n} from './stripe-tax-readiness.component'\n\nexport interface TaxSettingsCardProps {\n hostId: string\n}\n\n/**\n * Tax settings (AGL-285): manual per-region rates (most-specific wins)\n * or Stripe Tax automatic calculation, stored on\n * `hosts/{hostId}/settings/store` under `tax`. The legacy quick-buy\n * checkout taxes by the store origin; Checkout v2 taxes by destination.\n */\nexport function TaxSettingsCard(props: TaxSettingsCardProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const { enqueueSnackbar } = useSnackbar()\n const {\n data: store,\n status: storeStatus,\n /**\n * The settings doc this form is seeded from is unconfirmed by the server\n * (AGL-1358). `current` is `draft ?? store?.tax ?? {mode: 'manual'}` and\n * the save writes `{tax: current}`, so `merge: true` protects the doc's\n * other maps and nothing inside this one. `mode` is the field that costs\n * money: a cached seed flipping `stripe` back to `manual` stops automatic\n * tax calculation — `resolveTaxRate` returns null in stripe mode — and\n * the store under-collects with nothing anywhere reporting it.\n */\n fromCache: storeFromCache,\n listen: storeListen,\n } = useFirestoreDoc<any>(\n () => doc(firestore, 'hosts', hostId, 'settings', 'store'),\n [firestore, hostId],\n )\n // What was typed, kept as edits over the stored settings, and Save held\n // until the server has confirmed them (AGL-4047).\n const form = useSeedEdits<CommerceModel.TaxSettings>(store?.tax ?? { mode: 'manual' })\n const current = form.values\n const checking = isSeedChecking({ fromCache: storeFromCache, unreadable: storeStatus === 'error' })\n /**\n * Whether anyone has ever answered the tax question for this store\n * (AGL-1999). Read from the SAVED document, never from `current` — the\n * `{ mode: 'manual' }` seed above is local state that has never reached\n * Firestore, and it is exactly what made this invisible: the card looked\n * configured while the server saw `mode: undefined`, took no branch, and\n * sold untaxed. Every storefront path now refuses that state, so the card\n * has to show it rather than paper over it.\n */\n const decided =\n storeStatus !== 'loading' && typeof store?.tax?.mode === 'string'\n const update = (patch: Partial<CommerceModel.TaxSettings>) =>\n form.edit(patch)\n /**\n * Whether the tax choice lets shoppers check out (AGL-4245): the store's own\n * Stripe Tax, read live, and when a shopper was last turned away. Re-read\n * when the saved mode changes, which also clears the owner's alert once the\n * store is no longer blocked.\n */\n const savedMode = decided ? (store?.tax?.mode as string) : null\n const readiness = useStoreTaxReadiness(hostId, savedMode)\n const stripeTaxOff = Boolean(\n readiness.data?.direct && readiness.data.stripeTax && !readiness.data.stripeTax.active,\n )\n const updateRate = (\n index: number,\n patch: Partial<CommerceModel.TaxRate> | null,\n ) => {\n const rates = [...(current.rates ?? [])]\n if (patch === null) rates.splice(index, 1)\n else rates[index] = { country: '', pct: 0, ...rates[index], ...patch }\n update({ rates })\n }\n /**\n * One of the flat, per-regime rates (AGL-1969 lodging, AGL-2028 services).\n *\n * A blank field clears the rate rather than storing `NaN`: clearing is how a\n * merchant turns the regime back off, and `Number('')` is 0 while\n * `Number(' ')` is also 0 — neither of which should ever reach the document\n * as a \"rate\".\n */\n const updateFlat = (\n key: 'lodging' | 'service',\n patch: Partial<CommerceModel.FlatTaxRate>,\n ) => update({ [key]: { ...current[key], ...patch } })\n const flatPctText = (key: 'lodging' | 'service') => {\n const pct = current[key]?.pct\n return pct === undefined || pct === null ? '' : String(pct)\n }\n /**\n * Shown under a typed rate this will NOT apply. Silence here would be the\n * failure: `resolveFlatTaxCents` treats an out-of-range percentage as off,\n * so a decimal-point typo would otherwise save cleanly and collect nothing.\n */\n const flatPctProblem = (key: 'lodging' | 'service'): string | null => {\n const raw = current[key]?.pct\n if (raw === undefined || raw === null || String(raw) === '') return null\n if (Number(raw) === 0) return null\n return CommerceModel.isUsableFlatTaxPct(raw)\n ? null\n : `Enter a percentage between 0 and ${CommerceModel.FLAT_TAX_MAX_PCT}. ` +\n 'This rate is not being applied.'\n }\n\n const handleSave = useCallback(async () => {\n /**\n * Refuse a save whose seed the server never confirmed (AGL-1358).\n *\n * No create path to exempt: this is a FIXED document path, so the\n * `{mode: 'manual'}` default produced when the cache has never seen the\n * map is not the harmless blank a fresh uid would be — writing it turns\n * automatic tax calculation off on a store that had it on.\n *\n * The guard WRAPS the write — an early return is a shape you can keep\n * while losing the protection.\n */\n const written = form.edits\n const verdict = await writeGuardedBySeed(\n {\n subject: 'tax settings',\n unreadable: storeStatus === 'error',\n fromCache: storeFromCache,\n listen: storeListen,\n },\n async () => {\n await setDoc(\n doc(firestore, 'hosts', hostId, 'settings', 'store'),\n { tax: current },\n { merge: true },\n )\n },\n )\n // Before `settle`, so a refusal keeps every typed rate on screen.\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, {\n variant: 'warning',\n persist: false,\n })\n }\n form.settle(written)\n enqueueSnackbar('Tax settings saved', { variant: 'success', persist: false })\n }, [current, form, firestore, hostId, enqueueSnackbar, storeStatus, storeFromCache, storeListen])\n\n // A press while Save is held is kept, and saves once confirmed (AGL-4047).\n const held = useHeldSave(handleSave, {\n checking,\n subject: 'tax settings',\n onRefused: (message) => enqueueSnackbar(message, { variant: 'warning', persist: false }),\n })\n\n return (\n <CardDisplay\n // Another plugin's card scrolls here (the tax service's \"Go to Taxes\",\n // AGL-3693), restating this id rather than importing this package.\n id=\"commerce-store-taxes\"\n header={'Taxes'}\n help={pluginDocsHelp('commerce', { anchor: '#tax-settings' })}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1.5}>\n {decided ? null : (\n // The store is not selling. Saying so here is the whole point: the\n // silent version of this state charged shoppers an untaxed total.\n <Alert severity=\"warning\">\n {'Choose how this store handles sales tax and save. Until you ' +\n 'do, checkout is turned off — we won’t take an order we can’t ' +\n 'tax correctly.'}\n {readiness.data?.blocked === 'tax-undecided' && refusedOnText(readiness.data.refusedAtMs)\n ? ` ${refusedOnText(readiness.data.refusedAtMs)}`\n : null}\n </Alert>\n )}\n <TextField\n label=\"Calculation\"\n value={current.mode ?? 'manual'}\n onChange={(event) =>\n update({\n mode: event.target.value as 'manual' | 'stripe' | 'none',\n })\n }\n size=\"small\"\n select\n sx={{ maxWidth: 280 }}\n >\n <MenuItem value=\"manual\">{'Manual rates (below)'}</MenuItem>\n <MenuItem value=\"stripe\">\n {stripeTaxOff\n ? 'Stripe Tax (automatic): not on in Stripe yet'\n : 'Stripe Tax (automatic)'}\n </MenuItem>\n {/* An explicit decision, not an omission (AGL-1999) — the option a\n merchant under a nexus threshold, or selling non-taxable goods,\n needs in order to sell at all. */}\n <MenuItem value=\"none\">{'Don’t collect sales tax'}</MenuItem>\n </TextField>\n {current.mode === 'none' ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'This store adds no sales tax to any order. Orders still go ' +\n 'through — the decision is recorded, not the tax.'}\n </Typography>\n ) : current.mode === 'stripe' ? (\n <StripeTaxReadinessPanel\n readiness={readiness}\n savedMode={savedMode}\n onChooseMode={(mode) => update({ mode })}\n />\n ) : (\n <>\n <FormControlLabel\n control={\n <Switch\n size=\"small\"\n checked={Boolean(current.pricesIncludeTax)}\n onChange={(event) =>\n update({ pricesIncludeTax: event.target.checked })\n }\n />\n }\n label=\"Prices include tax (VAT-style)\"\n />\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Origin country\"\n value={current.origin?.country ?? ''}\n onChange={(event) =>\n update({\n origin: {\n ...current.origin,\n country: event.target.value.toUpperCase().slice(0, 2),\n },\n })\n }\n size=\"small\"\n sx={{ width: 140 }}\n placeholder=\"US\"\n />\n <TextField\n label=\"Origin state\"\n value={current.origin?.state ?? ''}\n onChange={(event) =>\n update({\n origin: {\n ...current.origin,\n state: event.target.value.toUpperCase().slice(0, 3),\n },\n })\n }\n size=\"small\"\n sx={{ width: 140 }}\n placeholder=\"TX\"\n />\n </Stack>\n {/* Which of the product's three addresses this is. A merchant\n who reads an unlabeled origin as \"our address\" may set it\n from the wrong one: the address the workspace pays Aglyn\n from is a different jurisdiction question, and the payout\n identity is a third. Naming the two it is NOT costs a line\n and prevents a mis-taxed order. */}\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Where this store ships or sells FROM — the jurisdiction the ' +\n 'manual rates below are applied from. Not the address your ' +\n 'workspace is billed at by Aglyn, and not where your payouts ' +\n 'are sent.'}\n </Typography>\n {(current.rates ?? []).map((rate, index) => (\n <Stack key={index} direction=\"row\" spacing={1}>\n <TextField\n label=\"Country\"\n value={rate.country}\n onChange={(event) =>\n updateRate(index, {\n country: event.target.value.toUpperCase().slice(0, 2),\n })\n }\n size=\"small\"\n sx={{ width: 90 }}\n />\n <TextField\n label=\"State\"\n value={rate.state ?? ''}\n onChange={(event) =>\n updateRate(index, {\n state:\n event.target.value.toUpperCase().slice(0, 3) ||\n undefined,\n })\n }\n size=\"small\"\n sx={{ width: 80 }}\n />\n <TextField\n label=\"%\"\n value={rate.pct}\n onChange={(event) =>\n updateRate(index, { pct: Number(event.target.value) || 0 })\n }\n size=\"small\"\n sx={{ width: 80 }}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <TextField\n label=\"Label\"\n value={rate.label ?? ''}\n onChange={(event) =>\n updateRate(index, { label: event.target.value })\n }\n size=\"small\"\n sx={{ flex: 1 }}\n placeholder=\"Sales tax\"\n />\n <Button\n size=\"small\"\n color=\"error\"\n onClick={() => updateRate(index, null)}\n >\n {'✕'}\n </Button>\n </Stack>\n ))}\n <Button\n size=\"small\"\n sx={{ alignSelf: 'flex-start' }}\n onClick={() => updateRate(current.rates?.length ?? 0, {})}\n >\n {'Add rate'}\n </Button>\n </>\n )}\n {/*\n LODGING TAX (AGL-1969) — deliberately OUTSIDE the calculation branch\n above, and deliberately not a `rates[]` row.\n\n The setting above is a goods SALES rate resolved against an address.\n Occupancy tax is a different regime with its own rates, registration\n and return, and it applies to reservations, which sell nights rather\n than goods. Nesting it under \"Manual rates\" would have said the two\n are the same machinery; putting it here says a store on Stripe Tax —\n which cannot compute occupancy tax from these sessions at all — can\n still set one.\n\n It is off until the merchant fills it in, so nothing an existing\n store charges moves.\n */}\n <Divider sx={{ my: 0.5 }} />\n <Stack spacing={1}>\n <Typography variant=\"subtitle2\">{'Lodging tax'}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Charged on reservations, on top of the price, using the rate ' +\n 'you enter here. It is separate from the sales tax above ' +\n 'because occupancy tax is its own regime with its own rates ' +\n 'and its own return. Leave it blank to charge none — that is ' +\n 'the default.'}\n </Typography>\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Rate %\"\n value={flatPctText('lodging')}\n onChange={(event) =>\n updateFlat('lodging', {\n pct:\n event.target.value === ''\n ? undefined\n : Number(event.target.value),\n })\n }\n size=\"small\"\n sx={{ width: 110 }}\n placeholder=\"0\"\n error={Boolean(flatPctProblem('lodging'))}\n helperText={flatPctProblem('lodging') ?? ' '}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <TextField\n label=\"Label\"\n value={current.lodging?.label ?? ''}\n onChange={(event) =>\n updateFlat('lodging', { label: event.target.value })\n }\n size=\"small\"\n sx={{ flex: 1 }}\n placeholder=\"Occupancy tax\"\n helperText=\"Shown to the guest on the receipt\"\n />\n </Stack>\n {/*\n MECHANISM ONLY, AND NO REMITTANCE DETERMINATION.\n\n Whether a jurisdiction imposes occupancy tax, who must register for\n it and who must remit it are legal conclusions that attach by\n operation of law (AGL-1904/AGL-1956) and are the merchant's under\n the Terms. This copy says what the software DOES and what it does\n not do, and stops there — including the deposit basis, which is a\n real limitation rather than an answer this product has taken.\n */}\n <Alert severity=\"info\">\n {`${PLATFORM_BRAND_NAME} applies the rate you enter and records ` +\n 'what was charged. It does not determine whether this tax ' +\n 'applies to you, at what rate, or where it should be paid — ' +\n 'that is yours to decide.'}\n </Alert>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'On a reservation that takes a deposit, the rate is applied to ' +\n 'the deposit — the amount actually charged here — not to the ' +\n 'whole stay. If tax is due on the full stay, collect the ' +\n 'difference the same way you collect the rest of the balance.'}\n </Typography>\n </Stack>\n {/*\n SERVICE TAX (AGL-2028) — the bookings sibling of the block above,\n and here for the same reason it is not in the bookings plugin's own\n settings: this is the one card a merchant comes to with a tax\n question, and a second tax surface elsewhere is how one of them ends\n up unanswered.\n\n Its EXISTENCE is also the opt-in AGL-2000 wanted. That issue\n declined to apply the goods rate to an appointment partly because\n nothing said the merchant meant these settings to cover bookings; a\n field labelled for services, blank until they fill it in, is them\n saying so.\n */}\n <Divider sx={{ my: 0.5 }} />\n <Stack spacing={1}>\n <Typography variant=\"subtitle2\">{'Service tax'}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Charged on paid bookings, on top of the price, using the rate ' +\n 'you enter here. It is separate from the sales tax above ' +\n 'because whether a service is taxable is often a different ' +\n 'question from whether goods are. Leave it blank to charge ' +\n 'none — that is the default.'}\n </Typography>\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Rate %\"\n value={flatPctText('service')}\n onChange={(event) =>\n updateFlat('service', {\n pct:\n event.target.value === ''\n ? undefined\n : Number(event.target.value),\n })\n }\n size=\"small\"\n sx={{ width: 110 }}\n placeholder=\"0\"\n error={Boolean(flatPctProblem('service'))}\n helperText={flatPctProblem('service') ?? ' '}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <TextField\n label=\"Label\"\n value={current.service?.label ?? ''}\n onChange={(event) =>\n updateFlat('service', { label: event.target.value })\n }\n size=\"small\"\n sx={{ flex: 1 }}\n placeholder=\"Service tax\"\n helperText=\"Shown to the client on the receipt\"\n />\n </Stack>\n {/* MECHANISM ONLY, AND NO REMITTANCE DETERMINATION — see the\n lodging block above. */}\n <Alert severity=\"info\">\n {`${PLATFORM_BRAND_NAME} applies the rate you enter and records ` +\n 'what was charged. It does not determine whether this tax ' +\n 'applies to you, at what rate, or where it should be paid — ' +\n 'that is yours to decide.'}\n </Alert>\n </Stack>\n <Button\n variant=\"contained\"\n color=\"primary\"\n size=\"small\"\n // An undecided store saves the choice on screen as it stands. The\n // select fires no change for the option already shown, so waiting\n // for an edit left \"Manual rates\" unsaveable and checkout off.\n disabled={storeStatus === 'loading' || (decided && !form.dirty) || held.saving}\n onClick={held.press}\n sx={{ alignSelf: 'flex-start' }}\n >\n {heldSaveLabel(held, 'Save tax settings')}\n </Button>\n {(!decided || form.dirty) && checking ? (\n <Typography variant=\"body2\" color=\"text.secondary\" role=\"status\">\n {seedCheckingText('tax settings')}\n </Typography>\n ) : null}\n </Stack>\n </CardDisplay>\n )\n}\nTaxSettingsCard.displayName = 'TaxSettingsCard'\n\nexport default TaxSettingsCard\n"],"names":["CommerceModel","PLATFORM_BRAND_NAME","CardDisplay","useSnackbar","Alert","Button","Divider","FormControlLabel","MenuItem","Stack","Switch","TextField","Typography","doc","setDoc","useCallback","useFirestore","useFirestoreDoc","writeGuardedBySeed","pluginDocsHelp","heldSaveLabel","isSeedChecking","seedCheckingText","useHeldSave","useSeedEdits","refusedOnText","StripeTaxReadinessPanel","useStoreTaxReadiness","TaxSettingsCard","props","current","flatPctProblem","store","readiness","hostId","firestore","enqueueSnackbar","data","status","storeStatus","fromCache","storeFromCache","listen","storeListen","form","tax","mode","values","checking","unreadable","decided","update","patch","edit","savedMode","stripeTaxOff","Boolean","direct","stripeTax","active","updateRate","index","rates","splice","country","pct","updateFlat","key","flatPctText","undefined","String","raw","Number","isUsableFlatTaxPct","FLAT_TAX_MAX_PCT","handleSave","written","edits","verdict","subject","merge","ok","message","variant","persist","settle","held","onRefused","id","header","help","anchor","contentGutterX","contentGutterY","spacing","severity","blocked","refusedAtMs","label","value","onChange","event","target","size","select","sx","maxWidth","color","onChooseMode","control","checked","pricesIncludeTax","direction","origin","toUpperCase","slice","width","placeholder","state","map","rate","slotProps","htmlInput","inputMode","flex","onClick","alignSelf","length","my","error","helperText","lodging","service","disabled","dirty","saving","press","role","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAGA,YAAYA,mBA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CAAI;oCACjBC,aAAY;oCACZY,OAAOzE,QAAQzB,eAAe;oCAC9BmG,UAAU,GAAEnG,mBAAAA,eAAe,sBAAfA,mBAA6B;oCACzC0F,WAAW;wCAAEC,WAAW;4CAAEC,WAAW;wCAAU;oCAAE;;8CAEnD,KAAChH;oCACCuF,OAAM;oCACNC,KAAK,YAAErE,mBAAAA,QAAQsG,OAAO,qBAAftG,iBAAiBoE,KAAK,oBAAI;oCACjCE,UAAU,CAACC,QACTnC,WAAW,WAAW;4CAAEgC,OAAOG,MAAMC,MAAM,CAACH,KAAK;wCAAC;oCAEpDI,MAAK;oCACLE,IAAI;wCAAEmB,MAAM;oCAAE;oCACdP,aAAY;oCACZa,YAAW;;;;sCAKf,KAAC9H;4BAAM2F,UAAS;sCACb,GAAG9F,oBAAoB,wCAAwC,CAAC,GAC/D,8DACA,gEACA;;;;8BAGN,KAACI;oBACC8E,SAAQ;oBACRwB,OAAM;oBACNJ,MAAK;oBACL,kEAAkE;oBAClE,kEAAkE;oBAClE,+DAA+D;oBAC/D8B,UAAU9F,gBAAgB,aAAcW,WAAW,CAACN,KAAK0F,KAAK,IAAKhD,KAAKiD,MAAM;oBAC9EV,SAASvC,KAAKkD,KAAK;oBACnB/B,IAAI;wBAAEqB,WAAW;oBAAa;8BAE7B1G,cAAckE,MAAM;;gBAErB,CAAA,CAACpC,WAAWN,KAAK0F,KAAK,AAAD,KAAMtF,yBAC3B,KAACpC;oBAAWuE,SAAQ;oBAAQwB,OAAM;oBAAiB8B,MAAK;8BACrDnH,iBAAiB;qBAElB;;;;AAIZ;AACAM,gBAAgB8G,WAAW,GAAG;AAE9B,eAAe9G,gBAAe"}
@@ -80,4 +80,13 @@ export declare const COMMERCE_POS_CELLULAR_TURN_OFF_FAILED: OperatorAlertDefinit
80
80
  * back on; the merchant does, once it is paid.
81
81
  */
82
82
  export declare const COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID: OperatorAlertDefinition;
83
+ /**
84
+ * A shopper was refused at checkout because the store's sales tax is not set
85
+ * up (AGL-4245): no tax option was ever chosen, or the store chose Stripe Tax
86
+ * on its own Stripe account and Stripe Tax is not on there. Raised once per
87
+ * store until the store fixes it (`server/checkout-tax-refusal.ts`); the
88
+ * store's managers are told too, which is the notice that matters. This one
89
+ * is for support, so it rides the daily digest.
90
+ */
91
+ export declare const COMMERCE_CHECKOUT_TAX_SETUP_REFUSED: OperatorAlertDefinition;
83
92
  export declare const COMMERCE_OPERATOR_ALERTS: readonly OperatorAlertDefinition[];