@aglyn/plugins-commerce 1.0.0-beta.278 → 1.0.0-beta.282

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 (212) hide show
  1. package/package.json +17 -14
  2. package/src/lib/components/commerce-console-page.js +33 -1
  3. package/src/lib/components/commerce-console-page.js.map +1 -1
  4. package/src/lib/components/console/payments-settings-card.component.js +1 -1
  5. package/src/lib/components/console/payments-settings-card.component.js.map +1 -1
  6. package/src/lib/components/console/pos/pos-hardware-api.d.ts +122 -0
  7. package/src/lib/components/console/pos/pos-hardware-api.js +90 -0
  8. package/src/lib/components/console/pos/pos-hardware-api.js.map +1 -0
  9. package/src/lib/components/console/pos/pos-reader-splash-api.d.ts +58 -0
  10. package/src/lib/components/console/pos/pos-reader-splash-api.js +101 -0
  11. package/src/lib/components/console/pos/pos-reader-splash-api.js.map +1 -0
  12. package/src/lib/components/console/pos-devices-card.component.js +5 -0
  13. package/src/lib/components/console/pos-devices-card.component.js.map +1 -1
  14. package/src/lib/components/console/pos-hardware-card.component.d.ts +26 -0
  15. package/src/lib/components/console/pos-hardware-card.component.js +456 -0
  16. package/src/lib/components/console/pos-hardware-card.component.js.map +1 -0
  17. package/src/lib/components/console/pos-hardware-orders-staff-page.component.d.ts +14 -0
  18. package/src/lib/components/console/pos-hardware-orders-staff-page.component.js +519 -0
  19. package/src/lib/components/console/pos-hardware-orders-staff-page.component.js.map +1 -0
  20. package/src/lib/components/console/pos-ops/pos-check-in-dialog.component.d.ts +27 -0
  21. package/src/lib/components/console/pos-ops/pos-check-in-dialog.component.js +444 -0
  22. package/src/lib/components/console/pos-ops/pos-check-in-dialog.component.js.map +1 -0
  23. package/src/lib/components/console/pos-ops/pos-check-in-zone.component.d.ts +9 -0
  24. package/src/lib/components/console/pos-ops/pos-check-in-zone.component.js +37 -0
  25. package/src/lib/components/console/pos-ops/pos-check-in-zone.component.js.map +1 -0
  26. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.d.ts +24 -0
  27. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js +346 -0
  28. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js.map +1 -0
  29. package/src/lib/components/console/pos-ops/pos-customer-lookup.component.d.ts +5 -1
  30. package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js +83 -4
  31. package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js.map +1 -1
  32. package/src/lib/components/console/pos-ops/pos-day-totals-card.component.d.ts +35 -0
  33. package/src/lib/components/console/pos-ops/pos-day-totals-card.component.js +546 -0
  34. package/src/lib/components/console/pos-ops/pos-day-totals-card.component.js.map +1 -0
  35. package/src/lib/components/console/pos-ops/pos-operations-bar.component.d.ts +2 -1
  36. package/src/lib/components/console/pos-ops/pos-operations-bar.component.js +20 -1
  37. package/src/lib/components/console/pos-ops/pos-operations-bar.component.js.map +1 -1
  38. package/src/lib/components/console/pos-ops/pos-ops-api.d.ts +1 -1
  39. package/src/lib/components/console/pos-ops/pos-ops-api.js.map +1 -1
  40. package/src/lib/components/console/pos-page.component.js +6 -3
  41. package/src/lib/components/console/pos-page.component.js.map +1 -1
  42. package/src/lib/components/console/pos-reader-splash-setting.component.d.ts +22 -0
  43. package/src/lib/components/console/pos-reader-splash-setting.component.js +275 -0
  44. package/src/lib/components/console/pos-reader-splash-setting.component.js.map +1 -0
  45. package/src/lib/components/console/pos-reader-splash-staff-page.component.d.ts +14 -0
  46. package/src/lib/components/console/pos-reader-splash-staff-page.component.js +301 -0
  47. package/src/lib/components/console/pos-reader-splash-staff-page.component.js.map +1 -0
  48. package/src/lib/components/console/pos-zones.d.ts +37 -3
  49. package/src/lib/components/console/pos-zones.js +11 -1
  50. package/src/lib/components/console/pos-zones.js.map +1 -1
  51. package/src/lib/components/console/product-check-in-fields.component.d.ts +20 -0
  52. package/src/lib/components/console/product-check-in-fields.component.js +172 -0
  53. package/src/lib/components/console/product-check-in-fields.component.js.map +1 -0
  54. package/src/lib/components/console/product-editor-dialog.component.js +48 -9
  55. package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
  56. package/src/lib/components/console/product-register-fields.component.d.ts +12 -0
  57. package/src/lib/components/console/product-register-fields.component.js +39 -1
  58. package/src/lib/components/console/product-register-fields.component.js.map +1 -1
  59. package/src/lib/components/console/products-hub-card.component.js +21 -6
  60. package/src/lib/components/console/products-hub-card.component.js.map +1 -1
  61. package/src/lib/components/console/reservations-card.component.js +239 -70
  62. package/src/lib/components/console/reservations-card.component.js.map +1 -1
  63. package/src/lib/components/reservation-widget.js +16 -0
  64. package/src/lib/components/reservation-widget.js.map +1 -1
  65. package/src/lib/constants/operator-alerts.d.ts +6 -0
  66. package/src/lib/constants/operator-alerts.js +20 -1
  67. package/src/lib/constants/operator-alerts.js.map +1 -1
  68. package/src/lib/declarations.console-server.js +7 -0
  69. package/src/lib/declarations.console-server.js.map +1 -1
  70. package/src/lib/declarations.d.ts +26 -0
  71. package/src/lib/declarations.js +34 -0
  72. package/src/lib/declarations.js.map +1 -0
  73. package/src/lib/model/commerce-check-in-product.d.ts +37 -0
  74. package/src/lib/model/commerce-check-in-product.js +49 -0
  75. package/src/lib/model/commerce-check-in-product.js.map +1 -0
  76. package/src/lib/model/commerce-check-in.d.ts +187 -0
  77. package/src/lib/model/commerce-check-in.js +468 -0
  78. package/src/lib/model/commerce-check-in.js.map +1 -0
  79. package/src/lib/model/commerce-pos-day-report.d.ts +209 -0
  80. package/src/lib/model/commerce-pos-day-report.js +572 -0
  81. package/src/lib/model/commerce-pos-day-report.js.map +1 -0
  82. package/src/lib/model/commerce-pos-offline.d.ts +65 -3
  83. package/src/lib/model/commerce-pos-offline.js +104 -7
  84. package/src/lib/model/commerce-pos-offline.js.map +1 -1
  85. package/src/lib/model/commerce-pos-ops.d.ts +3 -0
  86. package/src/lib/model/commerce-pos-ops.js +1 -0
  87. package/src/lib/model/commerce-pos-ops.js.map +1 -1
  88. package/src/lib/model/commerce-pos.d.ts +43 -3
  89. package/src/lib/model/commerce-pos.js +73 -5
  90. package/src/lib/model/commerce-pos.js.map +1 -1
  91. package/src/lib/model/commerce-reservations.d.ts +73 -7
  92. package/src/lib/model/commerce-reservations.js +90 -10
  93. package/src/lib/model/commerce-reservations.js.map +1 -1
  94. package/src/lib/model/commerce.d.ts +40 -0
  95. package/src/lib/model/commerce.js +22 -4
  96. package/src/lib/model/commerce.js.map +1 -1
  97. package/src/lib/model/index.d.ts +1 -0
  98. package/src/lib/model/index.js +1 -0
  99. package/src/lib/model/index.js.map +1 -1
  100. package/src/lib/model/plugin-permissions.d.ts +1 -1
  101. package/src/lib/model/plugin-permissions.js +2 -1
  102. package/src/lib/model/plugin-permissions.js.map +1 -1
  103. package/src/lib/model/pos-hardware.d.ts +288 -0
  104. package/src/lib/model/pos-hardware.js +499 -0
  105. package/src/lib/model/pos-hardware.js.map +1 -0
  106. package/src/lib/model/pos-offline-card-limits.d.ts +20 -0
  107. package/src/lib/model/pos-offline-card-limits.js +28 -0
  108. package/src/lib/model/pos-offline-card-limits.js.map +1 -0
  109. package/src/lib/model/pos-reader-splash.d.ts +114 -0
  110. package/src/lib/model/pos-reader-splash.js +141 -0
  111. package/src/lib/model/pos-reader-splash.js.map +1 -0
  112. package/src/lib/model/product-write.d.ts +6 -0
  113. package/src/lib/plugin-config.d.ts +10 -0
  114. package/src/lib/plugin-config.js +40 -0
  115. package/src/lib/plugin-config.js.map +1 -1
  116. package/src/lib/plugin.js +28 -0
  117. package/src/lib/plugin.js.map +1 -1
  118. package/src/lib/server/cart-checkout.js +3 -1
  119. package/src/lib/server/cart-checkout.js.map +1 -1
  120. package/src/lib/server/cart.js +12 -1
  121. package/src/lib/server/cart.js.map +1 -1
  122. package/src/lib/server/catalog.js +49 -12
  123. package/src/lib/server/catalog.js.map +1 -1
  124. package/src/lib/server/checkout-extras.js +1 -1
  125. package/src/lib/server/checkout-extras.js.map +1 -1
  126. package/src/lib/server/checkout.js +7 -0
  127. package/src/lib/server/checkout.js.map +1 -1
  128. package/src/lib/server/person-eraser.d.ts +8 -1
  129. package/src/lib/server/person-eraser.js +23 -1
  130. package/src/lib/server/person-eraser.js.map +1 -1
  131. package/src/lib/server/pos-check-in.d.ts +49 -0
  132. package/src/lib/server/pos-check-in.js +652 -0
  133. package/src/lib/server/pos-check-in.js.map +1 -0
  134. package/src/lib/server/pos-day-report.d.ts +46 -0
  135. package/src/lib/server/pos-day-report.js +299 -0
  136. package/src/lib/server/pos-day-report.js.map +1 -0
  137. package/src/lib/server/pos-hardware-admin.d.ts +50 -0
  138. package/src/lib/server/pos-hardware-admin.js +366 -0
  139. package/src/lib/server/pos-hardware-admin.js.map +1 -0
  140. package/src/lib/server/pos-hardware-notify.d.ts +27 -0
  141. package/src/lib/server/pos-hardware-notify.js +142 -0
  142. package/src/lib/server/pos-hardware-notify.js.map +1 -0
  143. package/src/lib/server/pos-hardware-user-eraser.d.ts +26 -0
  144. package/src/lib/server/pos-hardware-user-eraser.js +67 -0
  145. package/src/lib/server/pos-hardware-user-eraser.js.map +1 -0
  146. package/src/lib/server/pos-hardware-webhook.d.ts +31 -0
  147. package/src/lib/server/pos-hardware-webhook.js +176 -0
  148. package/src/lib/server/pos-hardware-webhook.js.map +1 -0
  149. package/src/lib/server/pos-hardware.d.ts +58 -0
  150. package/src/lib/server/pos-hardware.js +234 -0
  151. package/src/lib/server/pos-hardware.js.map +1 -0
  152. package/src/lib/server/pos-offline-card-reconcile.d.ts +38 -0
  153. package/src/lib/server/pos-offline-card-reconcile.js +58 -0
  154. package/src/lib/server/pos-offline-card-reconcile.js.map +1 -0
  155. package/src/lib/server/pos-offline-sync.d.ts +32 -0
  156. package/src/lib/server/pos-offline-sync.js +191 -15
  157. package/src/lib/server/pos-offline-sync.js.map +1 -1
  158. package/src/lib/server/pos-ops-routes.d.ts +4 -2
  159. package/src/lib/server/pos-ops-routes.js +14 -2
  160. package/src/lib/server/pos-ops-routes.js.map +1 -1
  161. package/src/lib/server/pos-order.js +39 -51
  162. package/src/lib/server/pos-order.js.map +1 -1
  163. package/src/lib/server/pos-payment.js +8 -4
  164. package/src/lib/server/pos-payment.js.map +1 -1
  165. package/src/lib/server/pos-reader-splash-admin.d.ts +36 -0
  166. package/src/lib/server/pos-reader-splash-admin.js +295 -0
  167. package/src/lib/server/pos-reader-splash-admin.js.map +1 -0
  168. package/src/lib/server/pos-reader-splash-render.d.ts +40 -0
  169. package/src/lib/server/pos-reader-splash-render.js +138 -0
  170. package/src/lib/server/pos-reader-splash-render.js.map +1 -0
  171. package/src/lib/server/pos-reader-splash-server.d.ts +32 -0
  172. package/src/lib/server/pos-reader-splash-server.js +32 -0
  173. package/src/lib/server/pos-reader-splash-server.js.map +1 -0
  174. package/src/lib/server/pos-reader-splash.d.ts +105 -0
  175. package/src/lib/server/pos-reader-splash.js +548 -0
  176. package/src/lib/server/pos-reader-splash.js.map +1 -0
  177. package/src/lib/server/pos-sale.d.ts +2 -1
  178. package/src/lib/server/pos-sale.js +3 -1
  179. package/src/lib/server/pos-sale.js.map +1 -1
  180. package/src/lib/server/pos-terminal.d.ts +67 -4
  181. package/src/lib/server/pos-terminal.js +239 -32
  182. package/src/lib/server/pos-terminal.js.map +1 -1
  183. package/src/lib/server/process-restock.js +4 -0
  184. package/src/lib/server/process-restock.js.map +1 -1
  185. package/src/lib/server/product-card.js +2 -2
  186. package/src/lib/server/product-card.js.map +1 -1
  187. package/src/lib/server/product-catalog.d.ts +2 -0
  188. package/src/lib/server/product-catalog.js +11 -4
  189. package/src/lib/server/product-catalog.js.map +1 -1
  190. package/src/lib/server/product.js +3 -1
  191. package/src/lib/server/product.js.map +1 -1
  192. package/src/lib/server/related.js +8 -1
  193. package/src/lib/server/related.js.map +1 -1
  194. package/src/lib/server/reservation-availability-query.d.ts +35 -0
  195. package/src/lib/server/reservation-availability-query.js +34 -0
  196. package/src/lib/server/reservation-availability-query.js.map +1 -0
  197. package/src/lib/server/reservation-availability.d.ts +21 -0
  198. package/src/lib/server/reservation-availability.js +64 -10
  199. package/src/lib/server/reservation-availability.js.map +1 -1
  200. package/src/lib/server/reservation-walk-in.d.ts +28 -0
  201. package/src/lib/server/reservation-walk-in.js +166 -0
  202. package/src/lib/server/reservation-walk-in.js.map +1 -0
  203. package/src/lib/server/reserve.js +13 -10
  204. package/src/lib/server/reserve.js.map +1 -1
  205. package/src/lib/server/reviews.js +3 -1
  206. package/src/lib/server/reviews.js.map +1 -1
  207. package/src/lib/server/site-page-resolver.js +5 -2
  208. package/src/lib/server/site-page-resolver.js.map +1 -1
  209. package/src/lib/server.js +26 -0
  210. package/src/lib/server.js.map +1 -1
  211. package/src/lib/testing/fake-firestore.js +72 -0
  212. package/src/lib/testing/fake-firestore.js.map +1 -1
@@ -0,0 +1,34 @@
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 { registerPluginPermissions } from "@aglyn/aglyn/plugin-manager/plugin-permissions";
17
+ import { COMMERCE_PERMISSIONS } from "./model/plugin-permissions.js";
18
+ let declared = false;
19
+ /**
20
+ * The plugin's DECLARATIONS (AGL-4047): its permission keys (the point of sale key (`managePos`)), which
21
+ * the one permission catalog lists beside the core keys. Loaded eagerly by
22
+ * the console (client and server) and the tenant's server through the
23
+ * generated declarations manifest, so the role editor offers the keys, a
24
+ * custom role or a per-member override keeps them, and a route resolves
25
+ * them whether or not a request has touched the plugin yet. Light by
26
+ * construction: nothing here reaches a provider, Firestore or React.
27
+ */ export function registerCommerceDeclarations() {
28
+ if (declared) return;
29
+ declared = true;
30
+ registerPluginPermissions(COMMERCE_PERMISSIONS);
31
+ }
32
+ registerCommerceDeclarations();
33
+
34
+ //# sourceMappingURL=declarations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/declarations.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 { registerPluginPermissions } from '@aglyn/aglyn/plugin-manager/plugin-permissions'\nimport { COMMERCE_PERMISSIONS } from './model/plugin-permissions'\n\nlet declared = false\n\n/**\n * The plugin's DECLARATIONS (AGL-4047): its permission keys (the point of sale key (`managePos`)), which\n * the one permission catalog lists beside the core keys. Loaded eagerly by\n * the console (client and server) and the tenant's server through the\n * generated declarations manifest, so the role editor offers the keys, a\n * custom role or a per-member override keeps them, and a route resolves\n * them whether or not a request has touched the plugin yet. Light by\n * construction: nothing here reaches a provider, Firestore or React.\n */\nexport function registerCommerceDeclarations(): void {\n if (declared) return\n declared = true\n registerPluginPermissions(COMMERCE_PERMISSIONS)\n}\n\nregisterCommerceDeclarations()\n"],"names":["registerPluginPermissions","COMMERCE_PERMISSIONS","declared","registerCommerceDeclarations"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,yBAAyB,QAAQ,iDAAgD;AAC1F,SAASC,oBAAoB,QAAQ,gCAA4B;AAEjE,IAAIC,WAAW;AAEf;;;;;;;;CAQC,GACD,OAAO,SAASC;IACd,IAAID,UAAU;IACdA,WAAW;IACXF,0BAA0BC;AAC5B;AAEAE"}
@@ -0,0 +1,37 @@
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
+ /**
18
+ * The product and variant check-in setting (AGL-4043): whether an item needs
19
+ * check-in and how many people one item admits. It has no imports, so the
20
+ * native contracts and the console read the same shape and rules.
21
+ */
22
+ /** The most people one item admits. */
23
+ export declare const CHECK_IN_MAX_HEADCOUNT = 50;
24
+ /**
25
+ * Whether a product (or one variant) needs check-in (AGL-4043), and how
26
+ * many people one item admits. On a product it is the default for every
27
+ * variant; on a variant it overrides the product's.
28
+ */
29
+ export interface ProductCheckIn {
30
+ enabled: boolean;
31
+ /** People one item admits, 1–{@link CHECK_IN_MAX_HEADCOUNT}; absent is 1. */
32
+ headcount?: number;
33
+ }
34
+ /** A stored check-in setting made safe, or `undefined` when it says nothing. */
35
+ export declare function normalizeProductCheckIn(value: unknown): ProductCheckIn | undefined;
36
+ /** Why a check-in setting cannot be saved, or `null`. */
37
+ export declare function productCheckInProblem(value: unknown): string | null;
@@ -0,0 +1,49 @@
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
+ * The product and variant check-in setting (AGL-4043): whether an item needs
18
+ * check-in and how many people one item admits. It has no imports, so the
19
+ * native contracts and the console read the same shape and rules.
20
+ */ /** The most people one item admits. */ export const CHECK_IN_MAX_HEADCOUNT = 50;
21
+ function headcountOf(value) {
22
+ const count = Math.round(Number(value));
23
+ return Number.isFinite(count) && count >= 1 ? Math.min(count, CHECK_IN_MAX_HEADCOUNT) : 1;
24
+ }
25
+ /** A stored check-in setting made safe, or `undefined` when it says nothing. */ export function normalizeProductCheckIn(value) {
26
+ if (!value || typeof value !== 'object') return undefined;
27
+ const raw = value;
28
+ if (typeof raw['enabled'] !== 'boolean') return undefined;
29
+ return raw['enabled'] ? {
30
+ enabled: true,
31
+ headcount: headcountOf(raw['headcount'])
32
+ } : {
33
+ enabled: false
34
+ };
35
+ }
36
+ /** Why a check-in setting cannot be saved, or `null`. */ export function productCheckInProblem(value) {
37
+ if (value === undefined || value === null) return null;
38
+ if (typeof value !== 'object' || typeof value.enabled !== 'boolean') {
39
+ return 'Check-in must be on or off';
40
+ }
41
+ const headcount = value.headcount;
42
+ if (headcount === undefined) return null;
43
+ if (!Number.isInteger(headcount) || headcount < 1 || headcount > CHECK_IN_MAX_HEADCOUNT) {
44
+ return `People per item must be a whole number from 1 to ${CHECK_IN_MAX_HEADCOUNT}`;
45
+ }
46
+ return null;
47
+ }
48
+
49
+ //# sourceMappingURL=commerce-check-in-product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/commerce-check-in-product.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The product and variant check-in setting (AGL-4043): whether an item needs\n * check-in and how many people one item admits. It has no imports, so the\n * native contracts and the console read the same shape and rules.\n */\n\n/** The most people one item admits. */\nexport const CHECK_IN_MAX_HEADCOUNT = 50\n\n/**\n * Whether a product (or one variant) needs check-in (AGL-4043), and how\n * many people one item admits. On a product it is the default for every\n * variant; on a variant it overrides the product's.\n */\nexport interface ProductCheckIn {\n enabled: boolean\n /** People one item admits, 1–{@link CHECK_IN_MAX_HEADCOUNT}; absent is 1. */\n headcount?: number\n}\n\nfunction headcountOf(value: unknown): number {\n const count = Math.round(Number(value))\n return Number.isFinite(count) && count >= 1 ? Math.min(count, CHECK_IN_MAX_HEADCOUNT) : 1\n}\n\n/** A stored check-in setting made safe, or `undefined` when it says nothing. */\nexport function normalizeProductCheckIn(value: unknown): ProductCheckIn | undefined {\n if (!value || typeof value !== 'object') return undefined\n const raw = value as Record<string, unknown>\n if (typeof raw['enabled'] !== 'boolean') return undefined\n return raw['enabled']\n ? { enabled: true, headcount: headcountOf(raw['headcount']) }\n : { enabled: false }\n}\n\n/** Why a check-in setting cannot be saved, or `null`. */\nexport function productCheckInProblem(value: unknown): string | null {\n if (value === undefined || value === null) return null\n if (typeof value !== 'object' || typeof (value as ProductCheckIn).enabled !== 'boolean') {\n return 'Check-in must be on or off'\n }\n const headcount = (value as ProductCheckIn).headcount\n if (headcount === undefined) return null\n if (!Number.isInteger(headcount) || headcount < 1 || headcount > CHECK_IN_MAX_HEADCOUNT) {\n return `People per item must be a whole number from 1 to ${CHECK_IN_MAX_HEADCOUNT}`\n }\n return null\n}\n"],"names":["CHECK_IN_MAX_HEADCOUNT","headcountOf","value","count","Math","round","Number","isFinite","min","normalizeProductCheckIn","undefined","raw","enabled","headcount","productCheckInProblem","isInteger"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;CAIC,GAED,qCAAqC,GACrC,OAAO,MAAMA,yBAAyB,GAAE;AAaxC,SAASC,YAAYC,KAAc;IACjC,MAAMC,QAAQC,KAAKC,KAAK,CAACC,OAAOJ;IAChC,OAAOI,OAAOC,QAAQ,CAACJ,UAAUA,SAAS,IAAIC,KAAKI,GAAG,CAACL,OAAOH,0BAA0B;AAC1F;AAEA,8EAA8E,GAC9E,OAAO,SAASS,wBAAwBP,KAAc;IACpD,IAAI,CAACA,SAAS,OAAOA,UAAU,UAAU,OAAOQ;IAChD,MAAMC,MAAMT;IACZ,IAAI,OAAOS,GAAG,CAAC,UAAU,KAAK,WAAW,OAAOD;IAChD,OAAOC,GAAG,CAAC,UAAU,GACjB;QAAEC,SAAS;QAAMC,WAAWZ,YAAYU,GAAG,CAAC,YAAY;IAAE,IAC1D;QAAEC,SAAS;IAAM;AACvB;AAEA,uDAAuD,GACvD,OAAO,SAASE,sBAAsBZ,KAAc;IAClD,IAAIA,UAAUQ,aAAaR,UAAU,MAAM,OAAO;IAClD,IAAI,OAAOA,UAAU,YAAY,OAAO,AAACA,MAAyBU,OAAO,KAAK,WAAW;QACvF,OAAO;IACT;IACA,MAAMC,YAAY,AAACX,MAAyBW,SAAS;IACrD,IAAIA,cAAcH,WAAW,OAAO;IACpC,IAAI,CAACJ,OAAOS,SAAS,CAACF,cAAcA,YAAY,KAAKA,YAAYb,wBAAwB;QACvF,OAAO,CAAC,iDAAiD,EAAEA,wBAAwB;IACrF;IACA,OAAO;AACT"}
@@ -0,0 +1,187 @@
1
+ import type { ProductVariant } from './commerce';
2
+ import { type HostOrder, type OrderChannel } from './commerce-orders';
3
+ import type { HostReservation } from './commerce-reservations';
4
+ export { CHECK_IN_MAX_HEADCOUNT, normalizeProductCheckIn, productCheckInProblem, type ProductCheckIn, } from './commerce-check-in-product';
5
+ export declare const POS_CHECK_IN_ROUTE = "/api/commerce/pos-check-in";
6
+ /** The most check-ins one order line makes, whatever its quantity. */
7
+ export declare const CHECK_IN_MAX_UNITS_PER_LINE = 200;
8
+ /** The most check-ins, orders or stays one day reads. */
9
+ export declare const CHECK_IN_DAY_CEILING = 3000;
10
+ /** The most check-in rows one search reads. */
11
+ export declare const CHECK_IN_SEARCH_ROWS = 100;
12
+ /** The most customers one search answers. */
13
+ export declare const CHECK_IN_SEARCH_CUSTOMERS = 20;
14
+ /** The most check-ins one tap records. */
15
+ export declare const CHECK_IN_BATCH_MAX = 50;
16
+ /** A wristband's number or color, at most this many characters. */
17
+ export declare const CHECK_IN_WRISTBAND_MAX = 24;
18
+ /** Colors offered as quick picks for a wristband. Any word is accepted. */
19
+ export declare const CHECK_IN_WRISTBAND_COLORS: readonly ["Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Pink", "White", "Black"];
20
+ /** The order statuses whose check-in lines are due. */
21
+ export declare const CHECK_IN_ORDER_STATUSES: readonly ["paid", "partially_fulfilled", "fulfilled", "delivered"];
22
+ /** The stay statuses whose days are due. */
23
+ export declare const CHECK_IN_RESERVATION_STATUSES: readonly ["confirmed", "checked_in"];
24
+ export type CheckInStatus = 'expected' | 'checked_in';
25
+ export interface CheckInWristband {
26
+ number: string | null;
27
+ color: string | null;
28
+ }
29
+ /** `hosts/{hostId}/checkIns/{id}`: one person due on one day. Server-written only. */
30
+ export interface HostCheckIn {
31
+ source: 'order' | 'reservation';
32
+ orderId: string | null;
33
+ /** The order's number as the console shows it (`#1042`), or null for a stay. */
34
+ orderLabel: string | null;
35
+ /** Where the order was sold, or `reservation`. */
36
+ channel: OrderChannel | 'reservation';
37
+ reservationId: string | null;
38
+ lineIndex: number | null;
39
+ /** This person's place among the line's or stay's check-ins, from 0. */
40
+ unitIndex: number;
41
+ /** How many check-ins the line or stay makes that day. */
42
+ unitCount: number;
43
+ productId: string | null;
44
+ variantId: string | null;
45
+ itemName: string;
46
+ variantLabel: string | null;
47
+ /** The day, `YYYY-MM-DD` in the site's time zone. */
48
+ dayKey: string;
49
+ /** Who the check-in is for, as one key: the address, else the contact, else the name, else the order. */
50
+ customerKey: string;
51
+ customerName: string | null;
52
+ customerEmail: string | null;
53
+ customerEmailLower: string | null;
54
+ customerPhone: string | null;
55
+ /** The contact the register attached to the sale, when it was one. */
56
+ contactId: string | null;
57
+ /** The name's, the address's, the phone's and the order number's search prefixes. */
58
+ searchTokens: string[];
59
+ status: CheckInStatus;
60
+ checkedInAtMs: number | null;
61
+ checkedInBy: string | null;
62
+ checkedInByName: string | null;
63
+ wristband: CheckInWristband | null;
64
+ /** The attempt that checked this person in, so a retried tap is not "already checked in". */
65
+ checkInAttempt: string | null;
66
+ /** The last undo, kept so a reversed check-in still says who reversed it. */
67
+ undoneAtMs: number | null;
68
+ undoneBy: string | null;
69
+ createdAtMs: number;
70
+ updatedAtMs: number;
71
+ }
72
+ /** One check-in as the routes answer it. */
73
+ export type CheckInRow = HostCheckIn & {
74
+ id: string;
75
+ };
76
+ /** A customer with something due on a day, as the search lists them. */
77
+ export interface CheckInCustomer {
78
+ customerKey: string;
79
+ name: string | null;
80
+ email: string | null;
81
+ phone: string | null;
82
+ contactId: string | null;
83
+ /** Every check-in the customer has on the day. */
84
+ unitsDue: number;
85
+ unitsCheckedIn: number;
86
+ /** What the check-ins are for, item names once each. */
87
+ items: string[];
88
+ }
89
+ /**
90
+ * Whether one variant of a product needs check-in, and for how many people
91
+ * per item: the variant's own setting, else the product's; `null` when not.
92
+ */
93
+ export declare function productCheckInFor(product: {
94
+ checkIn?: unknown;
95
+ variants?: ReadonlyArray<Pick<ProductVariant, 'id'> & {
96
+ checkIn?: unknown;
97
+ }>;
98
+ } | null | undefined, variantId: string | null | undefined): {
99
+ headcount: number;
100
+ } | null;
101
+ /** Whether any variant of a product needs check-in. */
102
+ export declare function productNeedsCheckIn(product: Parameters<typeof productCheckInFor>[0]): boolean;
103
+ /** The digits of a phone number, without a leading US/Canada 1 when it has eleven. */
104
+ export declare function checkInPhoneDigits(phone: string | null | undefined): string;
105
+ /** The tokens a check-in is found by. */
106
+ export declare function checkInSearchTokens(input: {
107
+ name?: string | null;
108
+ email?: string | null;
109
+ phone?: string | null;
110
+ orderNumber?: number | null;
111
+ orderId?: string | null;
112
+ }): string[];
113
+ /**
114
+ * What a typed search asks the index for: the phone's digits when it is a
115
+ * number, else the first word's prefix (a name, an address, `#1042`).
116
+ */
117
+ export declare function checkInSearchToken(typed: string): string;
118
+ /** One key per customer: the address, else the contact, else the name, else the source. */
119
+ export declare function checkInCustomerKey(input: {
120
+ email?: string | null;
121
+ contactId?: string | null;
122
+ name?: string | null;
123
+ fallback: string;
124
+ }): string;
125
+ /** A check-in's document id, from its unit's identity. */
126
+ export declare function orderCheckInId(orderId: string, lineIndex: number, unitIndex: number): string;
127
+ export declare function reservationCheckInId(reservationId: string, dayKey: string, unitIndex?: number): string;
128
+ /** A due check-in before the server stamps its times and status. */
129
+ export type DueCheckIn = Omit<HostCheckIn, 'status' | 'checkedInAtMs' | 'checkedInBy' | 'checkedInByName' | 'wristband' | 'checkInAttempt' | 'undoneAtMs' | 'undoneBy' | 'createdAtMs' | 'updatedAtMs'>;
130
+ /** The customer fields a due check-in copies from its source, which a later read may refresh. */
131
+ export declare const CHECK_IN_CUSTOMER_FIELDS: readonly ["customerKey", "customerName", "customerEmail", "customerEmailLower", "customerPhone", "contactId", "searchTokens"];
132
+ /** Whether an order's lines are due at all. */
133
+ export declare function orderIsDueForCheckIn(order: Pick<HostOrder, 'status'> | null | undefined): boolean;
134
+ /**
135
+ * The check-ins an order makes on its day, keyed by document id. `products`
136
+ * holds the products its lines name, as stored now: the setting is read at
137
+ * the window, so turning it on covers passes already sold today.
138
+ */
139
+ export declare function dueCheckInsForOrder(input: {
140
+ orderId: string;
141
+ order: Partial<HostOrder>;
142
+ products: ReadonlyMap<string, Parameters<typeof productCheckInFor>[0]>;
143
+ dayKey: string;
144
+ }): Map<string, DueCheckIn>;
145
+ /** UTC midnight of a `YYYY-MM-DD` day, as a stay's days are stored. */
146
+ export declare function checkInDayMs(dayKey: string): number | null;
147
+ /** The check-in a stay makes on a day it covers; empty on any other day. */
148
+ export declare function dueCheckInsForReservation(input: {
149
+ reservationId: string;
150
+ reservation: Partial<HostReservation>;
151
+ resourceName: string | null;
152
+ dayKey: string;
153
+ }): Map<string, DueCheckIn>;
154
+ /** A due check-in as first written. */
155
+ export declare function newCheckInDocument(due: DueCheckIn, nowMs: number): HostCheckIn;
156
+ /** The customer fields of a stored check-in that its source now says otherwise. */
157
+ export declare function changedCheckInCustomerFields(stored: Partial<HostCheckIn>, due: DueCheckIn): Partial<DueCheckIn> | null;
158
+ /**
159
+ * A wristband as typed, made safe: a number (letters, digits, a dash) and a
160
+ * color word, each optional. `null` with neither; an error for junk.
161
+ */
162
+ export declare function normalizeWristband(value: unknown): {
163
+ ok: true;
164
+ wristband: CheckInWristband | null;
165
+ } | {
166
+ ok: false;
167
+ error: string;
168
+ };
169
+ /** A wristband as one line: "Blue #214". */
170
+ export declare function describeWristband(wristband: CheckInWristband | null | undefined): string;
171
+ /** The customers a set of check-ins is for, most due first, then by name. */
172
+ export declare function checkInCustomers(rows: ReadonlyArray<CheckInRow>): CheckInCustomer[];
173
+ /** A day's check-ins in the order the window reads them: by name, then item, then unit. */
174
+ export declare function sortCheckInRows<T extends Pick<CheckInRow, 'customerName' | 'customerEmail' | 'itemName' | 'unitIndex' | 'id'>>(rows: ReadonlyArray<T>): T[];
175
+ export interface CheckInDayTotals {
176
+ expected: number;
177
+ checkedIn: number;
178
+ }
179
+ export declare function checkInDayTotals(rows: ReadonlyArray<Pick<CheckInRow, 'status'>>): CheckInDayTotals;
180
+ /** A time on the site's clock: "9:14 AM". */
181
+ export declare function checkInTimeLabel(ms: number | null | undefined, timeZone: string): string;
182
+ /** "Already checked in at 9:14 AM by Sam". */
183
+ export declare function alreadyCheckedInLabel(row: Pick<CheckInRow, 'checkedInAtMs' | 'checkedInByName'>, timeZone: string): string;
184
+ /** One person's line, as the list and the spreadsheet name it: "Day pass · Adult (2 of 3)". */
185
+ export declare function checkInItemLabel(row: Pick<CheckInRow, 'itemName' | 'variantLabel' | 'unitIndex' | 'unitCount'>): string;
186
+ /** The day's check-ins as a spreadsheet, one row per person. */
187
+ export declare function checkInDayCsv(rows: ReadonlyArray<CheckInRow>, timeZone: string): string;