@proveanything/smartlinks 3.0.0-alpha.1 → 3.0.0-alpha.3

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 (272) hide show
  1. package/README.md +741 -741
  2. package/dist/README.md +573 -573
  3. package/dist/adminCardsView.js +55 -55
  4. package/dist/api/analytics.d.ts +5 -4
  5. package/dist/api/analytics.js +5 -4
  6. package/dist/api/appConfiguration.d.ts +23 -18
  7. package/dist/api/appConfiguration.js +24 -18
  8. package/dist/api/appObjects.d.ts +54 -10
  9. package/dist/api/appObjects.js +75 -40
  10. package/dist/api/asset.d.ts +28 -22
  11. package/dist/api/asset.js +45 -56
  12. package/dist/api/attestation.d.ts +11 -3
  13. package/dist/api/attestation.js +12 -3
  14. package/dist/api/attestations.d.ts +12 -8
  15. package/dist/api/attestations.js +18 -21
  16. package/dist/api/authKit.d.ts +15 -10
  17. package/dist/api/authKit.js +17 -11
  18. package/dist/api/batch.d.ts +36 -25
  19. package/dist/api/batch.js +46 -39
  20. package/dist/api/bookings.d.ts +67 -11
  21. package/dist/api/bookings.js +82 -15
  22. package/dist/api/broadcasts.js +3 -17
  23. package/dist/api/claimSet.d.ts +26 -12
  24. package/dist/api/claimSet.js +32 -24
  25. package/dist/api/collection.d.ts +15 -10
  26. package/dist/api/collection.js +17 -11
  27. package/dist/api/comms.d.ts +12 -6
  28. package/dist/api/comms.js +12 -6
  29. package/dist/api/conditions.d.ts +7 -6
  30. package/dist/api/conditions.js +8 -6
  31. package/dist/api/contact.d.ts +6 -2
  32. package/dist/api/contact.js +25 -60
  33. package/dist/api/containers.d.ts +14 -10
  34. package/dist/api/containers.js +19 -14
  35. package/dist/api/crate.js +7 -9
  36. package/dist/api/dpp.d.ts +20 -13
  37. package/dist/api/dpp.js +23 -15
  38. package/dist/api/facets.d.ts +38 -13
  39. package/dist/api/facets.js +40 -15
  40. package/dist/api/files.d.ts +5 -2
  41. package/dist/api/files.js +7 -4
  42. package/dist/api/form.d.ts +8 -5
  43. package/dist/api/form.js +9 -5
  44. package/dist/api/index.d.ts +1 -1
  45. package/dist/api/index.js +1 -1
  46. package/dist/api/integrations.d.ts +29 -17
  47. package/dist/api/integrations.js +32 -25
  48. package/dist/api/interactions.d.ts +11 -6
  49. package/dist/api/interactions.js +14 -23
  50. package/dist/api/jobs.d.ts +16 -6
  51. package/dist/api/jobs.js +30 -20
  52. package/dist/api/journeys.js +2 -14
  53. package/dist/api/journeysAnalytics.d.ts +8 -5
  54. package/dist/api/journeysAnalytics.js +8 -5
  55. package/dist/api/knowledge.d.ts +20 -14
  56. package/dist/api/knowledge.js +22 -15
  57. package/dist/api/location.d.ts +6 -3
  58. package/dist/api/location.js +8 -22
  59. package/dist/api/lots.d.ts +9 -5
  60. package/dist/api/lots.js +22 -26
  61. package/dist/api/loyalty.d.ts +25 -16
  62. package/dist/api/loyalty.js +33 -32
  63. package/dist/api/nfc.d.ts +3 -1
  64. package/dist/api/nfc.js +3 -1
  65. package/dist/api/order.d.ts +45 -39
  66. package/dist/api/order.js +48 -65
  67. package/dist/api/partner.d.ts +17 -14
  68. package/dist/api/partner.js +21 -22
  69. package/dist/api/payments.d.ts +60 -0
  70. package/dist/api/payments.js +94 -0
  71. package/dist/api/products.d.ts +35 -12
  72. package/dist/api/products.js +36 -13
  73. package/dist/api/proof.d.ts +41 -19
  74. package/dist/api/proof.js +44 -23
  75. package/dist/api/realtime.d.ts +3 -0
  76. package/dist/api/realtime.js +10 -2
  77. package/dist/api/segments.js +3 -15
  78. package/dist/api/serviceAccounts.d.ts +8 -5
  79. package/dist/api/serviceAccounts.js +9 -6
  80. package/dist/api/shop.d.ts +7 -5
  81. package/dist/api/shop.js +13 -19
  82. package/dist/api/subscriptions.d.ts +12 -10
  83. package/dist/api/subscriptions.js +17 -25
  84. package/dist/api/tags.d.ts +23 -20
  85. package/dist/api/tags.js +40 -52
  86. package/dist/api/template.d.ts +16 -11
  87. package/dist/api/template.js +19 -13
  88. package/dist/api/translations.js +2 -12
  89. package/dist/api/userGroups.d.ts +26 -16
  90. package/dist/api/userGroups.js +43 -30
  91. package/dist/api/variant.d.ts +10 -7
  92. package/dist/api/variant.js +11 -7
  93. package/dist/api/wallet.d.ts +14 -11
  94. package/dist/api/wallet.js +15 -12
  95. package/dist/baseline.css +194 -194
  96. package/dist/dataChanged.d.ts +74 -0
  97. package/dist/dataChanged.js +162 -0
  98. package/dist/docs/API_SUMMARY.md +1443 -1409
  99. package/dist/docs/admin-cards.md +189 -189
  100. package/dist/docs/agent-tools.md +156 -156
  101. package/dist/docs/ai-tools-and-skills.md +180 -180
  102. package/dist/docs/ai.md +1721 -1721
  103. package/dist/docs/analytics.md +1 -1
  104. package/dist/docs/api-versions.md +85 -85
  105. package/dist/docs/app-data-storage.md +277 -277
  106. package/dist/docs/app-docs.md +73 -73
  107. package/dist/docs/app-manifest.md +852 -852
  108. package/dist/docs/app-objects.md +4 -4
  109. package/dist/docs/app-records-pattern.md +388 -388
  110. package/dist/docs/appConfig.md +550 -550
  111. package/dist/docs/assistant-apps.md +172 -172
  112. package/dist/docs/assistant-context.md +119 -119
  113. package/dist/docs/attestations.md +8 -8
  114. package/dist/docs/bookings.md +105 -8
  115. package/dist/docs/caching.md +32 -3
  116. package/dist/docs/comms.md +689 -689
  117. package/dist/docs/connectors.md +340 -340
  118. package/dist/docs/contact-search.md +2 -3
  119. package/dist/docs/css-baseline.md +133 -133
  120. package/dist/docs/customer-guide.md +70 -70
  121. package/dist/docs/data-changed.md +91 -0
  122. package/dist/docs/deploying-apps.md +340 -340
  123. package/dist/docs/dpp.md +115 -115
  124. package/dist/docs/entitlements.md +90 -90
  125. package/dist/docs/files.md +69 -69
  126. package/dist/docs/host-dependency-contract.md +252 -252
  127. package/dist/docs/iframe-responder.md +11 -0
  128. package/dist/docs/integrations.md +322 -322
  129. package/dist/docs/interactions.md +544 -544
  130. package/dist/docs/item-context.md +181 -181
  131. package/dist/docs/knowledge.md +105 -105
  132. package/dist/docs/lists.md +157 -114
  133. package/dist/docs/lots.md +112 -112
  134. package/dist/docs/loyalty.md +348 -348
  135. package/dist/docs/members.md +183 -183
  136. package/dist/docs/memberships.md +150 -150
  137. package/dist/docs/mobile-admin-container.md +693 -693
  138. package/dist/docs/operations.md +281 -281
  139. package/dist/docs/overview.md +487 -485
  140. package/dist/docs/payments.md +94 -0
  141. package/dist/docs/proof-comms-triggers.md +142 -142
  142. package/dist/docs/proof-ownership-transfer.md +155 -155
  143. package/dist/docs/proof-product-data-scoping.md +462 -462
  144. package/dist/docs/proof-share-grants.md +305 -305
  145. package/dist/docs/realtime.md +149 -139
  146. package/dist/docs/records-admin-pattern.md +304 -304
  147. package/dist/docs/service-accounts.md +64 -64
  148. package/dist/docs/standard-query.md +196 -187
  149. package/dist/docs/tag-codes.md +97 -97
  150. package/dist/docs/tag-ranges.md +106 -106
  151. package/dist/docs/theme-tokens.md +252 -252
  152. package/dist/docs/upgrading-to-3.md +550 -430
  153. package/dist/docs/wallet-passes.md +107 -107
  154. package/dist/docs/websites.md +123 -123
  155. package/dist/http.d.ts +6 -3
  156. package/dist/http.js +48 -19
  157. package/dist/iframeResponder.d.ts +7 -0
  158. package/dist/iframeResponder.js +10 -0
  159. package/dist/index.d.ts +2 -0
  160. package/dist/index.js +2 -0
  161. package/dist/list.d.ts +12 -0
  162. package/dist/list.js +59 -0
  163. package/dist/openapi.yaml +722 -660
  164. package/dist/testing/bookingsMemory.d.ts +29 -1
  165. package/dist/testing/bookingsMemory.js +89 -1
  166. package/dist/testing/index.js +4 -1
  167. package/dist/theme-boot.js +82 -82
  168. package/dist/theme.css +75 -75
  169. package/dist/types/analytics.d.ts +7 -3
  170. package/dist/types/appManifest.d.ts +26 -4
  171. package/dist/types/appObjects.d.ts +27 -12
  172. package/dist/types/appOptions.d.ts +2 -2
  173. package/dist/types/asset.d.ts +5 -6
  174. package/dist/types/attestations.d.ts +7 -9
  175. package/dist/types/batch.d.ts +5 -5
  176. package/dist/types/bookings.d.ts +109 -6
  177. package/dist/types/comms.d.ts +9 -5
  178. package/dist/types/contact.d.ts +7 -4
  179. package/dist/types/containers.d.ts +2 -1
  180. package/dist/types/facets.d.ts +14 -2
  181. package/dist/types/files.d.ts +3 -2
  182. package/dist/types/index.d.ts +1 -0
  183. package/dist/types/index.js +1 -0
  184. package/dist/types/integrations.d.ts +2 -1
  185. package/dist/types/interaction.d.ts +15 -7
  186. package/dist/types/jobs.d.ts +1 -1
  187. package/dist/types/journeysAnalytics.d.ts +3 -2
  188. package/dist/types/knowledge.d.ts +6 -3
  189. package/dist/types/knowledge.js +0 -1
  190. package/dist/types/list.d.ts +30 -2
  191. package/dist/types/location.d.ts +7 -2
  192. package/dist/types/location.js +0 -1
  193. package/dist/types/lots.d.ts +5 -2
  194. package/dist/types/lots.js +0 -6
  195. package/dist/types/order.d.ts +22 -20
  196. package/dist/types/payments.d.ts +101 -0
  197. package/dist/types/payments.js +5 -0
  198. package/dist/types/product.d.ts +28 -11
  199. package/dist/types/proof.d.ts +7 -8
  200. package/dist/types/realtime.d.ts +5 -1
  201. package/dist/types/tags.d.ts +5 -3
  202. package/dist/types/userGroups.d.ts +3 -3
  203. package/dist/types/userGroups.js +0 -4
  204. package/dist/version.d.ts +1 -1
  205. package/dist/version.js +1 -1
  206. package/docs/API_SUMMARY.md +1443 -1409
  207. package/docs/admin-cards.md +189 -189
  208. package/docs/agent-tools.md +156 -156
  209. package/docs/ai-tools-and-skills.md +180 -180
  210. package/docs/ai.md +1721 -1721
  211. package/docs/analytics.md +1 -1
  212. package/docs/api-versions.md +85 -85
  213. package/docs/app-data-storage.md +277 -277
  214. package/docs/app-docs.md +73 -73
  215. package/docs/app-manifest.md +852 -852
  216. package/docs/app-objects.md +4 -4
  217. package/docs/app-records-pattern.md +388 -388
  218. package/docs/appConfig.md +550 -550
  219. package/docs/assistant-apps.md +172 -172
  220. package/docs/assistant-context.md +119 -119
  221. package/docs/attestations.md +8 -8
  222. package/docs/bookings.md +105 -8
  223. package/docs/caching.md +32 -3
  224. package/docs/comms.md +689 -689
  225. package/docs/connectors.md +340 -340
  226. package/docs/contact-search.md +2 -3
  227. package/docs/css-baseline.md +133 -133
  228. package/docs/customer-guide.md +70 -70
  229. package/docs/data-changed.md +91 -0
  230. package/docs/deploying-apps.md +340 -340
  231. package/docs/dpp.md +115 -115
  232. package/docs/entitlements.md +90 -90
  233. package/docs/files.md +69 -69
  234. package/docs/host-dependency-contract.md +252 -252
  235. package/docs/iframe-responder.md +11 -0
  236. package/docs/integrations.md +322 -322
  237. package/docs/interactions.md +544 -544
  238. package/docs/item-context.md +181 -181
  239. package/docs/knowledge.md +105 -105
  240. package/docs/lists.md +157 -114
  241. package/docs/lots.md +112 -112
  242. package/docs/loyalty.md +348 -348
  243. package/docs/members.md +183 -183
  244. package/docs/memberships.md +150 -150
  245. package/docs/mobile-admin-container.md +693 -693
  246. package/docs/operations.md +281 -281
  247. package/docs/overview.md +487 -485
  248. package/docs/payments.md +94 -0
  249. package/docs/proof-comms-triggers.md +142 -142
  250. package/docs/proof-ownership-transfer.md +155 -155
  251. package/docs/proof-product-data-scoping.md +462 -462
  252. package/docs/proof-share-grants.md +305 -305
  253. package/docs/realtime.md +149 -139
  254. package/docs/service-accounts.md +64 -64
  255. package/docs/standard-query.md +196 -187
  256. package/docs/tag-codes.md +97 -97
  257. package/docs/tag-ranges.md +106 -106
  258. package/docs/theme-lookbook.v1.json +120 -120
  259. package/docs/theme-tokens.md +252 -252
  260. package/docs/upgrading-to-3.md +550 -430
  261. package/docs/wallet-passes.md +107 -107
  262. package/docs/websites.md +123 -123
  263. package/openapi.yaml +722 -660
  264. package/package.json +91 -91
  265. package/scripts/headless-check.mjs +87 -87
  266. package/scripts/lib/bare-imports.mjs +57 -57
  267. package/scripts/lib/keyed-app-data.mjs +21 -21
  268. package/scripts/lib/upgrade.mjs +708 -512
  269. package/scripts/publish.mjs +272 -272
  270. package/scripts/register-release.mjs +91 -91
  271. package/scripts/upgrade.mjs +79 -56
  272. package/upgrade/3.json +2731 -2213
@@ -28,9 +28,37 @@ export declare function bookingsMemoryImpl(mem: BookingsMemory, caller?: {
28
28
  };
29
29
  }>;
30
30
  update(bookingId: string, fields?: any): Promise<any>;
31
- confirm(bookingId: string): Promise<any>;
31
+ confirm(bookingId: string, opts?: any): Promise<any>;
32
32
  cancel(bookingId: string, opts?: any): Promise<any>;
33
33
  move(bookingId: string, input?: any): Promise<any>;
34
+ /**
35
+ * Paid bookings, in memory: prices from the slot's `data.prices` (ticket `lines`) or `input.prices`
36
+ * (pass the app's price list for appointments). No Stripe: `checkoutUrl` is pretend; call
37
+ * `payWith(bookingId)` to act as the payment arriving.
38
+ */
39
+ checkout(input?: any): Promise<{
40
+ booking: any;
41
+ replayed: any;
42
+ checkoutUrl: null;
43
+ expiresAt: null;
44
+ total: number;
45
+ currency: null;
46
+ } | {
47
+ request?: boolean | undefined;
48
+ booking: any;
49
+ replayed: any;
50
+ checkoutUrl: string | null;
51
+ expiresAt: string | null;
52
+ total: number;
53
+ currency: string;
54
+ }>;
55
+ /** In memory only: the payment for a booking arrives (as Stripe's webhook would). */
56
+ payWith(bookingId: string): Promise<any>;
57
+ refund(bookingId: string, opts?: any): Promise<{
58
+ booking: any;
59
+ refunded: number;
60
+ pending: boolean;
61
+ }>;
34
62
  extendHold(bookingId: string, holdMinutes: number): Promise<any>;
35
63
  /** Counts who would be messaged (no sends in memory); inject `sl.bookings.message` to assert sends. */
36
64
  message(input?: any): Promise<{
@@ -5,6 +5,17 @@
5
5
  // creates, holds that expire, all-or-nothing writes. Each operation checks and writes without an
6
6
  // `await` in between, so concurrent calls in one test behave like the database: of ten requests for
7
7
  // the last seat, exactly one wins. Errors carry the platform's `code` / `status` / `details`.
8
+ var __rest = (this && this.__rest) || function (s, e) {
9
+ var t = {};
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
11
+ t[p] = s[p];
12
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
13
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
14
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
15
+ t[p[i]] = s[p[i]];
16
+ }
17
+ return t;
18
+ };
8
19
  export function createBookingsMemory() {
9
20
  return { slots: [], bookings: [], allocations: [] };
10
21
  }
@@ -193,12 +204,29 @@ export function bookingsMemoryImpl(mem, caller = {}) {
193
204
  b.updatedAt = iso(now());
194
205
  return copy(withAllocations(b));
195
206
  },
196
- async confirm(bookingId) {
207
+ async confirm(bookingId, opts = {}) {
197
208
  const b = find(bookingId);
198
209
  if (b.status === 'confirmed')
199
210
  return copy(withAllocations(b));
200
211
  if (!['held', 'pending', 'waitlisted'].includes(b.status))
201
212
  fail('INVALID_STATE', `A ${b.status} booking can't be confirmed`, 409, { status: b.status });
213
+ // Paid bookings: confirmed by the payment, or waived. In memory there is no Stripe: a request
214
+ // becomes a hold with a pretend pay link, and `payWith(bookingId)` below stands in for the webhook.
215
+ const pay = b.admin && b.admin.payment;
216
+ if (pay && pay.status === 'awaiting') {
217
+ if (opts.payment === 'waive') {
218
+ pay.status = 'waived';
219
+ }
220
+ else if (b.status === 'pending') {
221
+ b.status = 'held';
222
+ b.holdExpiresAt = iso(now() + 48 * 3600000);
223
+ pay.payBy = b.holdExpiresAt;
224
+ pay.link = `https://pay.test/${b.id}`;
225
+ return copy(withAllocations(b));
226
+ }
227
+ else
228
+ fail('PAYMENT_REQUIRED', 'This booking is confirmed when it is paid for');
229
+ }
202
230
  if (holdLapsed(b))
203
231
  fail('HOLD_EXPIRED', 'The hold on this booking has run out');
204
232
  if (b.status === 'waitlisted') {
@@ -231,6 +259,11 @@ export function bookingsMemoryImpl(mem, caller = {}) {
231
259
  b.cancelReason = opts.reason || 'admin';
232
260
  b.cancelledAt = iso(now());
233
261
  b.holdExpiresAt = null;
262
+ // A paid booking is refunded: 'full' (default) | 'none' | an amount.
263
+ const pay = b.admin && b.admin.payment;
264
+ if (pay && ['paid', 'partially_refunded'].includes(pay.status) && opts.refund !== 'none') {
265
+ await this.refund(bookingId, { amount: opts.refund === 'full' || opts.refund == null ? undefined : Number(opts.refund), reason: 'cancelled' });
266
+ }
234
267
  return copy(withAllocations(b));
235
268
  },
236
269
  async move(bookingId, input = {}) {
@@ -271,6 +304,61 @@ export function bookingsMemoryImpl(mem, caller = {}) {
271
304
  }
272
305
  return copy(withAllocations(b));
273
306
  },
307
+ /**
308
+ * Paid bookings, in memory: prices from the slot's `data.prices` (ticket `lines`) or `input.prices`
309
+ * (pass the app's price list for appointments). No Stripe: `checkoutUrl` is pretend; call
310
+ * `payWith(bookingId)` to act as the payment arriving.
311
+ */
312
+ async checkout(input = {}) {
313
+ const { lines, priceId, email, successUrl, cancelUrl, prices: priceList } = input, create = __rest(input, ["lines", "priceId", "email", "successUrl", "cancelUrl", "prices"]);
314
+ const slot = create.slotId ? mem.slots.find((x) => x.id === create.slotId) : null;
315
+ const prices = (slot ? (slot.data && slot.data.prices) : priceList) || [];
316
+ const wanted = Array.isArray(lines) && lines.length ? lines : priceId ? [{ priceId, quantity: 1 }] : prices.length === 1 ? [{ priceId: prices[0].id, quantity: create.quantity || 1 }] : [];
317
+ const priced = wanted.map((w) => {
318
+ const p = prices.find((x) => x.id === w.priceId);
319
+ if (!p)
320
+ fail('PRICE_NOT_FOUND', `There is no price "${w.priceId}"`, 400);
321
+ return { priceId: p.id, label: p.label, unitAmount: Number(p.amount), quantity: Number(w.quantity || 1) };
322
+ });
323
+ const total = priced.reduce((a, l) => a + l.unitAmount * l.quantity, 0);
324
+ if (!total) {
325
+ const booking = await this.create(create);
326
+ return { booking, replayed: booking.replayed, checkoutUrl: null, expiresAt: null, total: 0, currency: null };
327
+ }
328
+ const status = create.status === 'pending' ? 'pending' : 'held';
329
+ const quantity = slot ? priced.reduce((a, l) => a + l.quantity, 0) : 1;
330
+ const payment = { status: 'awaiting', total, currency: 'GBP', refunded: 0, lines: priced, email: email || null, refunds: [] };
331
+ const booking = await this.create(Object.assign(Object.assign({}, create), { quantity, status, holdMinutes: 40, admin: Object.assign(Object.assign({}, (create.admin || {})), { payment }) }));
332
+ const checkoutUrl = status === 'held' ? `https://checkout.test/${booking.id}` : null;
333
+ return Object.assign({ booking, replayed: booking.replayed, checkoutUrl, expiresAt: checkoutUrl ? iso(now() + 30 * 60000) : null, total, currency: 'GBP' }, (status === 'pending' ? { request: true } : {}));
334
+ },
335
+ /** In memory only: the payment for a booking arrives (as Stripe's webhook would). */
336
+ async payWith(bookingId) {
337
+ const b = find(bookingId);
338
+ const pay = b.admin && b.admin.payment;
339
+ if (!pay)
340
+ fail('NOT_PAID', 'This booking has no payment');
341
+ pay.status = 'paid';
342
+ pay.paidAt = iso(now());
343
+ b.status = 'confirmed';
344
+ b.holdExpiresAt = null;
345
+ b.updatedAt = iso(now());
346
+ return copy(withAllocations(b));
347
+ },
348
+ async refund(bookingId, opts = {}) {
349
+ const b = find(bookingId);
350
+ const pay = b.admin && b.admin.payment;
351
+ if (!pay || !['paid', 'partially_refunded'].includes(pay.status))
352
+ fail('NOT_PAID', 'This booking has no payment to refund');
353
+ const left = pay.total - (pay.refunded || 0);
354
+ const amount = opts.amount == null ? left : Number(opts.amount);
355
+ if (!Number.isInteger(amount) || amount < 1 || amount > left)
356
+ fail('BAD_REQUEST', `amount must be from 1 to ${left}`, 400);
357
+ pay.refunded = (pay.refunded || 0) + amount;
358
+ pay.refunds = [...(pay.refunds || []), { id: id('re'), amount, reason: opts.reason || 'refund' }];
359
+ pay.status = pay.refunded >= pay.total ? 'refunded' : 'partially_refunded';
360
+ return { booking: copy(withAllocations(b)), refunded: amount, pending: false };
361
+ },
274
362
  async extendHold(bookingId, holdMinutes) {
275
363
  const b = find(bookingId);
276
364
  if (b.status !== 'held')
@@ -427,9 +427,12 @@ export function createFunctionTestContext(opts) {
427
427
  const bkFn = (obj, name) => (obj && typeof obj[name] === 'function' ? obj[name].bind(obj) : undefined);
428
428
  const BOOKING_READS = new Set(['get', 'query', 'mine', 'freebusy']);
429
429
  sl.bookings = {};
430
- for (const m of ['create', 'get', 'query', 'mine', 'update', 'confirm', 'cancel', 'move', 'extendHold', 'complete', 'noShow', 'freebusy', 'message']) {
430
+ for (const m of ['create', 'get', 'query', 'mine', 'update', 'confirm', 'cancel', 'move', 'extendHold', 'complete', 'noShow', 'freebusy', 'message', 'checkout', 'refund']) {
431
431
  sl.bookings[m] = gated('bookings', BOOKING_READS.has(m) ? 'read' : 'write', bkFn(bk, m), `bookings.${m}`);
432
432
  }
433
+ // In memory only (no Stripe): the payment for a checkout arrives, as Stripe's webhook would make it.
434
+ if (!impl.bookings)
435
+ sl.bookings.payWith = bkFn(bk, 'payWith');
433
436
  sl.bookings.slots = {};
434
437
  for (const m of ['create', 'createMany', 'get', 'query', 'update', 'delete']) {
435
438
  sl.bookings.slots[m] = gated('bookings', m === 'get' || m === 'query' ? 'read' : 'write', bkFn(bk.slots, m), `bookings.slots.${m}`);
@@ -1,82 +1,82 @@
1
- /* @proveanything/smartlinks/theme-boot.js — iframe theme + viewer-prefs bootstrap (theme tokens v1)
2
- *
3
- * ONLY for iframe / standalone app entries (admin.html, index.html). Container & widget apps do NOT
4
- * need this — they inherit the host's :root tokens through the DOM. See docs/theme-tokens.md.
5
- *
6
- * What it does, and nothing more:
7
- * 1. BOOT (synchronous, before first paint): reads the initial theme + viewer prefs from the URL
8
- * (`#slt=<base64url JSON>` plus convenience params ?theme=&contrast=&lang=&fontScale=) and applies
9
- * them to :root. Put this in <head>, inline, so it runs before the app's stylesheet — no flash.
10
- * 2. LIVE: applies generic root-state updates the host posts (`smartlinks:root-state`) — viewer /
11
- * accessibility prefs (dark, contrast, font-scale, lang) and, if the host chooses, editor
12
- * brand-preview. The app AUTHORS CSS against these root hooks; it never writes a message handler.
13
- *
14
- * Root hooks the app styles against:
15
- * - theme: the `.dark` class (Tailwind/shadcn convention) AND `[data-theme="dark|light"]`
16
- * - contrast: `[data-contrast="high"]` (also honour @media (prefers-contrast: more) natively)
17
- * - font size: `--sl-font-scale` (e.g. 1.25) — scale your rem/base type off it
18
- * - language: `lang` attribute, and `dir` (rtl for Arabic, Hebrew, ...; use start/end CSS so it mirrors)
19
- * - brand: the --sl-* theme tokens (see theme.css)
20
- *
21
- * Brand THEME changes are expected via iframe reload (rare, operator-driven). Viewer / a11y prefs are
22
- * applied LIVE here (a reload on an accessibility toggle is itself an accessibility failure).
23
- */
24
- (function () {
25
- if (typeof document === 'undefined') return;
26
- var root = document.documentElement;
27
-
28
- function setVar(k, val) {
29
- root.style.setProperty(k.charAt(0) === '-' ? k : '--sl-' + k, String(val));
30
- }
31
- function applyTheme(mode) { // 'dark' | 'light'
32
- if (!mode) return;
33
- root.classList.toggle('dark', mode === 'dark');
34
- root.setAttribute('data-theme', mode);
35
- }
36
- function applyState(s) {
37
- if (!s || typeof s !== 'object') return;
38
- var v = s.values || s.vars;
39
- if (v) for (var k in v) if (Object.prototype.hasOwnProperty.call(v, k)) setVar(k, v[k]);
40
- if (s.theme) applyTheme(s.theme);
41
- if (s.contrast != null) {
42
- if (s.contrast === 'normal' || s.contrast === false) root.removeAttribute('data-contrast');
43
- else root.setAttribute('data-contrast', String(s.contrast));
44
- }
45
- if (s.fontScale != null) setVar('font-scale', s.fontScale);
46
- if (s.lang) {
47
- root.setAttribute('lang', String(s.lang));
48
- // Right-to-left languages mirror the page (Arabic, Hebrew, Persian, Urdu, ...); see i18n.textDirection.
49
- root.setAttribute('dir', /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(String(s.lang)) ? 'rtl' : 'ltr');
50
- }
51
- var a = s.attrs;
52
- if (a) for (var name in a) if (Object.prototype.hasOwnProperty.call(a, name)) {
53
- if (a[name] == null || a[name] === false) root.removeAttribute(name);
54
- else root.setAttribute(name, a[name] === true ? '' : String(a[name]));
55
- }
56
- }
57
-
58
- // 1) BOOT from the URL — synchronous, before paint.
59
- try {
60
- var hash = location.hash || '';
61
- var m = hash.match(/[#&]slt=([^&]+)/);
62
- if (m) {
63
- var b64 = m[1].replace(/-/g, '+').replace(/_/g, '/');
64
- applyState(JSON.parse(decodeURIComponent(escape(atob(b64)))));
65
- }
66
- var q = new URLSearchParams(location.search);
67
- var boot = {};
68
- if (q.get('theme')) boot.theme = q.get('theme');
69
- if (q.get('contrast')) boot.contrast = q.get('contrast');
70
- if (q.get('lang')) boot.lang = q.get('lang');
71
- if (q.get('fontScale')) boot.fontScale = q.get('fontScale');
72
- applyState(boot);
73
- } catch (e) { /* never block the app on a malformed theme payload */ }
74
-
75
- // 2) LIVE updates — generic; the app never writes this.
76
- try {
77
- window.addEventListener('message', function (e) {
78
- var d = e && e.data;
79
- if (d && d.type === 'smartlinks:root-state') applyState(d);
80
- });
81
- } catch (e) {}
82
- })();
1
+ /* @proveanything/smartlinks/theme-boot.js — iframe theme + viewer-prefs bootstrap (theme tokens v1)
2
+ *
3
+ * ONLY for iframe / standalone app entries (admin.html, index.html). Container & widget apps do NOT
4
+ * need this — they inherit the host's :root tokens through the DOM. See docs/theme-tokens.md.
5
+ *
6
+ * What it does, and nothing more:
7
+ * 1. BOOT (synchronous, before first paint): reads the initial theme + viewer prefs from the URL
8
+ * (`#slt=<base64url JSON>` plus convenience params ?theme=&contrast=&lang=&fontScale=) and applies
9
+ * them to :root. Put this in <head>, inline, so it runs before the app's stylesheet — no flash.
10
+ * 2. LIVE: applies generic root-state updates the host posts (`smartlinks:root-state`) — viewer /
11
+ * accessibility prefs (dark, contrast, font-scale, lang) and, if the host chooses, editor
12
+ * brand-preview. The app AUTHORS CSS against these root hooks; it never writes a message handler.
13
+ *
14
+ * Root hooks the app styles against:
15
+ * - theme: the `.dark` class (Tailwind/shadcn convention) AND `[data-theme="dark|light"]`
16
+ * - contrast: `[data-contrast="high"]` (also honour @media (prefers-contrast: more) natively)
17
+ * - font size: `--sl-font-scale` (e.g. 1.25) — scale your rem/base type off it
18
+ * - language: `lang` attribute, and `dir` (rtl for Arabic, Hebrew, ...; use start/end CSS so it mirrors)
19
+ * - brand: the --sl-* theme tokens (see theme.css)
20
+ *
21
+ * Brand THEME changes are expected via iframe reload (rare, operator-driven). Viewer / a11y prefs are
22
+ * applied LIVE here (a reload on an accessibility toggle is itself an accessibility failure).
23
+ */
24
+ (function () {
25
+ if (typeof document === 'undefined') return;
26
+ var root = document.documentElement;
27
+
28
+ function setVar(k, val) {
29
+ root.style.setProperty(k.charAt(0) === '-' ? k : '--sl-' + k, String(val));
30
+ }
31
+ function applyTheme(mode) { // 'dark' | 'light'
32
+ if (!mode) return;
33
+ root.classList.toggle('dark', mode === 'dark');
34
+ root.setAttribute('data-theme', mode);
35
+ }
36
+ function applyState(s) {
37
+ if (!s || typeof s !== 'object') return;
38
+ var v = s.values || s.vars;
39
+ if (v) for (var k in v) if (Object.prototype.hasOwnProperty.call(v, k)) setVar(k, v[k]);
40
+ if (s.theme) applyTheme(s.theme);
41
+ if (s.contrast != null) {
42
+ if (s.contrast === 'normal' || s.contrast === false) root.removeAttribute('data-contrast');
43
+ else root.setAttribute('data-contrast', String(s.contrast));
44
+ }
45
+ if (s.fontScale != null) setVar('font-scale', s.fontScale);
46
+ if (s.lang) {
47
+ root.setAttribute('lang', String(s.lang));
48
+ // Right-to-left languages mirror the page (Arabic, Hebrew, Persian, Urdu, ...); see i18n.textDirection.
49
+ root.setAttribute('dir', /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(String(s.lang)) ? 'rtl' : 'ltr');
50
+ }
51
+ var a = s.attrs;
52
+ if (a) for (var name in a) if (Object.prototype.hasOwnProperty.call(a, name)) {
53
+ if (a[name] == null || a[name] === false) root.removeAttribute(name);
54
+ else root.setAttribute(name, a[name] === true ? '' : String(a[name]));
55
+ }
56
+ }
57
+
58
+ // 1) BOOT from the URL — synchronous, before paint.
59
+ try {
60
+ var hash = location.hash || '';
61
+ var m = hash.match(/[#&]slt=([^&]+)/);
62
+ if (m) {
63
+ var b64 = m[1].replace(/-/g, '+').replace(/_/g, '/');
64
+ applyState(JSON.parse(decodeURIComponent(escape(atob(b64)))));
65
+ }
66
+ var q = new URLSearchParams(location.search);
67
+ var boot = {};
68
+ if (q.get('theme')) boot.theme = q.get('theme');
69
+ if (q.get('contrast')) boot.contrast = q.get('contrast');
70
+ if (q.get('lang')) boot.lang = q.get('lang');
71
+ if (q.get('fontScale')) boot.fontScale = q.get('fontScale');
72
+ applyState(boot);
73
+ } catch (e) { /* never block the app on a malformed theme payload */ }
74
+
75
+ // 2) LIVE updates — generic; the app never writes this.
76
+ try {
77
+ window.addEventListener('message', function (e) {
78
+ var d = e && e.data;
79
+ if (d && d.type === 'smartlinks:root-state') applyState(d);
80
+ });
81
+ } catch (e) {}
82
+ })();
package/dist/theme.css CHANGED
@@ -1,75 +1,75 @@
1
- /* @proveanything/smartlinks/theme.css — SmartLinks host theming preset (theme tokens v1)
2
- *
3
- * Maps Tailwind 4's design tokens onto the SmartLinks semantic theme tokens (--sl-color-*,
4
- * --sl-radius-*, --sl-font-*) that the host sets on each app's mount root. After importing this,
5
- * an app's `bg-primary` / `text-foreground` / `border-border` / `rounded-md` / `font-heading`
6
- * resolve to whatever brand the host is running — no per-app mapping, no hardcoded palette.
7
- *
8
- * app styles.css:
9
- * @import "tailwindcss";
10
- * @import "@proveanything/smartlinks/theme.css";
11
- *
12
- * Requires Tailwind 4 (@theme). Every value has a neutral fallback, so the app renders correctly
13
- * even against a host that sets none of the --sl-* tokens. See docs/theme-tokens.md.
14
- */
15
-
16
- @theme {
17
- /* ── Colour (semantic roles) ─────────────────────────────────────────── */
18
- --color-background: var(--sl-color-bg, #ffffff);
19
- --color-surface: var(--sl-color-surface, #f7f7f8);
20
- --color-surface-raised:var(--sl-color-surface-raised, var(--sl-color-surface, #ffffff));
21
- --color-foreground: var(--sl-color-fg, #18181b);
22
- --color-muted: var(--sl-color-muted, #71717a);
23
- --color-border: var(--sl-color-border, #e4e4e7);
24
- --color-primary: var(--sl-color-accent, #4f46e5);
25
- --color-on-primary: var(--sl-color-on-accent, #ffffff);
26
- --color-primary-soft: var(--sl-color-accent-soft, color-mix(in oklab, var(--sl-color-accent, #4f46e5) 12%, transparent));
27
- --color-success: var(--sl-color-success, #16a34a);
28
- --color-danger: var(--sl-color-danger, #dc2626);
29
-
30
- /* ── Shape ───────────────────────────────────────────────────────────── */
31
- --radius-sm: var(--sl-radius-sm, 4px);
32
- --radius-md: var(--sl-radius-md, 8px);
33
- --radius-lg: var(--sl-radius-lg, 16px);
34
-
35
- /* ── Type ────────────────────────────────────────────────────────────── */
36
- --font-heading: var(--sl-font-heading, var(--sl-font-body, ui-sans-serif, system-ui, sans-serif));
37
- --font-body: var(--sl-font-body, ui-sans-serif, system-ui, sans-serif);
38
-
39
- /* ── Elevation (extended; no shadow unless the host sets one) ─────────── */
40
- --shadow-sm: var(--sl-shadow-sm, 0 0 #0000);
41
- --shadow-md: var(--sl-shadow-md, 0 0 #0000);
42
- }
43
-
44
- /* Dark mode without values. A host in dark mode should send a dark value-set (the --sl-* tokens); one
45
- * that only sets the hook (.dark / data-theme="dark") left every colour on its light fallback — white
46
- * cards and near-black text on a dark page. Under the hook the fallbacks are dark too; whatever the host
47
- * does send still wins. (Re-declared on the hook's element, so it works wherever the host puts it.) */
48
- .dark,
49
- [data-theme="dark"] {
50
- --color-background: var(--sl-color-bg, #09090b);
51
- --color-surface: var(--sl-color-surface, #18181b);
52
- --color-surface-raised:var(--sl-color-surface-raised, var(--sl-color-surface, #27272a));
53
- --color-foreground: var(--sl-color-fg, #fafafa);
54
- --color-muted: var(--sl-color-muted, #a1a1aa);
55
- --color-border: var(--sl-color-border, #3f3f46);
56
- --color-primary: var(--sl-color-accent, #6366f1);
57
- --color-on-primary: var(--sl-color-on-accent, #ffffff);
58
- --color-primary-soft: var(--sl-color-accent-soft, color-mix(in oklab, var(--sl-color-accent, #6366f1) 20%, transparent));
59
- --color-success: var(--sl-color-success, #22c55e);
60
- --color-danger: var(--sl-color-danger, #f87171);
61
- color-scheme: dark;
62
- }
63
-
64
- /* shadcn bridge (optional): if the app uses shadcn's --primary/--background/etc. HSL variables,
65
- * uncomment to drive them from the SmartLinks tokens too. Left commented so it never overrides an
66
- * app that has deliberately customised its shadcn palette — opt in per app (see migration step 17).
67
- *
68
- * :where([data-sl-app]) {
69
- * --primary: var(--sl-color-accent);
70
- * --background: var(--sl-color-bg);
71
- * --foreground: var(--sl-color-fg);
72
- * --border: var(--sl-color-border);
73
- * --radius: var(--sl-radius-md);
74
- * }
75
- */
1
+ /* @proveanything/smartlinks/theme.css — SmartLinks host theming preset (theme tokens v1)
2
+ *
3
+ * Maps Tailwind 4's design tokens onto the SmartLinks semantic theme tokens (--sl-color-*,
4
+ * --sl-radius-*, --sl-font-*) that the host sets on each app's mount root. After importing this,
5
+ * an app's `bg-primary` / `text-foreground` / `border-border` / `rounded-md` / `font-heading`
6
+ * resolve to whatever brand the host is running — no per-app mapping, no hardcoded palette.
7
+ *
8
+ * app styles.css:
9
+ * @import "tailwindcss";
10
+ * @import "@proveanything/smartlinks/theme.css";
11
+ *
12
+ * Requires Tailwind 4 (@theme). Every value has a neutral fallback, so the app renders correctly
13
+ * even against a host that sets none of the --sl-* tokens. See docs/theme-tokens.md.
14
+ */
15
+
16
+ @theme {
17
+ /* ── Colour (semantic roles) ─────────────────────────────────────────── */
18
+ --color-background: var(--sl-color-bg, #ffffff);
19
+ --color-surface: var(--sl-color-surface, #f7f7f8);
20
+ --color-surface-raised:var(--sl-color-surface-raised, var(--sl-color-surface, #ffffff));
21
+ --color-foreground: var(--sl-color-fg, #18181b);
22
+ --color-muted: var(--sl-color-muted, #71717a);
23
+ --color-border: var(--sl-color-border, #e4e4e7);
24
+ --color-primary: var(--sl-color-accent, #4f46e5);
25
+ --color-on-primary: var(--sl-color-on-accent, #ffffff);
26
+ --color-primary-soft: var(--sl-color-accent-soft, color-mix(in oklab, var(--sl-color-accent, #4f46e5) 12%, transparent));
27
+ --color-success: var(--sl-color-success, #16a34a);
28
+ --color-danger: var(--sl-color-danger, #dc2626);
29
+
30
+ /* ── Shape ───────────────────────────────────────────────────────────── */
31
+ --radius-sm: var(--sl-radius-sm, 4px);
32
+ --radius-md: var(--sl-radius-md, 8px);
33
+ --radius-lg: var(--sl-radius-lg, 16px);
34
+
35
+ /* ── Type ────────────────────────────────────────────────────────────── */
36
+ --font-heading: var(--sl-font-heading, var(--sl-font-body, ui-sans-serif, system-ui, sans-serif));
37
+ --font-body: var(--sl-font-body, ui-sans-serif, system-ui, sans-serif);
38
+
39
+ /* ── Elevation (extended; no shadow unless the host sets one) ─────────── */
40
+ --shadow-sm: var(--sl-shadow-sm, 0 0 #0000);
41
+ --shadow-md: var(--sl-shadow-md, 0 0 #0000);
42
+ }
43
+
44
+ /* Dark mode without values. A host in dark mode should send a dark value-set (the --sl-* tokens); one
45
+ * that only sets the hook (.dark / data-theme="dark") left every colour on its light fallback — white
46
+ * cards and near-black text on a dark page. Under the hook the fallbacks are dark too; whatever the host
47
+ * does send still wins. (Re-declared on the hook's element, so it works wherever the host puts it.) */
48
+ .dark,
49
+ [data-theme="dark"] {
50
+ --color-background: var(--sl-color-bg, #09090b);
51
+ --color-surface: var(--sl-color-surface, #18181b);
52
+ --color-surface-raised:var(--sl-color-surface-raised, var(--sl-color-surface, #27272a));
53
+ --color-foreground: var(--sl-color-fg, #fafafa);
54
+ --color-muted: var(--sl-color-muted, #a1a1aa);
55
+ --color-border: var(--sl-color-border, #3f3f46);
56
+ --color-primary: var(--sl-color-accent, #6366f1);
57
+ --color-on-primary: var(--sl-color-on-accent, #ffffff);
58
+ --color-primary-soft: var(--sl-color-accent-soft, color-mix(in oklab, var(--sl-color-accent, #6366f1) 20%, transparent));
59
+ --color-success: var(--sl-color-success, #22c55e);
60
+ --color-danger: var(--sl-color-danger, #f87171);
61
+ color-scheme: dark;
62
+ }
63
+
64
+ /* shadcn bridge (optional): if the app uses shadcn's --primary/--background/etc. HSL variables,
65
+ * uncomment to drive them from the SmartLinks tokens too. Left commented so it never overrides an
66
+ * app that has deliberately customised its shadcn palette — opt in per app (see migration step 17).
67
+ *
68
+ * :where([data-sl-app]) {
69
+ * --primary: var(--sl-color-accent);
70
+ * --background: var(--sl-color-bg);
71
+ * --foreground: var(--sl-color-fg);
72
+ * --border: var(--sl-color-border);
73
+ * --radius: var(--sl-radius-md);
74
+ * }
75
+ */
@@ -4,7 +4,7 @@
4
4
  * Separate from the `interactions` namespace. These types cover generic web
5
5
  * analytics, click tracking, and tag scan analytics for collection dashboards.
6
6
  */
7
- import type { ListResult, ListOptions } from './list.js';
7
+ import type { ListResult, ListOptions, OrderBy } from './list.js';
8
8
  export type AnalyticsSource = 'events' | 'tag';
9
9
  /**
10
10
  * Includes `scan_redirect` - logged automatically by the server (not the
@@ -274,10 +274,14 @@ export interface AnalyticsBreakdownResponse {
274
274
  metric: AnalyticsMetric;
275
275
  rows: AnalyticsBreakdownRow[];
276
276
  }
277
- /** Paging is `limit` (default 100) and `cursor`: pass the previous page's `nextCursor`. */
277
+ /**
278
+ * Paging is `limit` (default 100) and `cursor`: pass the previous page's `nextCursor`.
279
+ * The time window is `from` / `to`. Sort with `orderBy: [{ timestamp: 'asc' }]` (newest first without it).
280
+ */
278
281
  export interface AnalyticsEventsRequest extends AnalyticsFilterRequest, ListOptions {
279
282
  source: AnalyticsSource;
280
- sort?: AnalyticsSortOrder;
283
+ /** Sort by the event's time: `[{ timestamp: 'asc' }]` or `[{ timestamp: 'desc' }]` (the default). */
284
+ orderBy?: OrderBy<'timestamp'>;
281
285
  }
282
286
  /** `{ items, nextCursor, source, sort }`: the event rows are in `items`. This list does not report a total. */
283
287
  export interface AnalyticsEventsResponse extends ListResult<Record<string, any>> {
@@ -6,7 +6,7 @@ import type { AppManifestAdminCards } from './adminCards.js';
6
6
  import type { PaginatedResponse } from './appObjects.js';
7
7
  import type { TypedMessage, MessageAbout, EmailAttachmentSpec } from './comms.js';
8
8
  import type { WorkOrdersApi, StockApi, BomsApi, MadeFromApi, OperationsApi } from './operations.js';
9
- import type { Booking, BookingSlot, BookingAllocation, CreateBookingInput, UpdateBookingInput, MoveBookingInput, BookingListQueryParams, CreateSlotInput, UpdateSlotInput, SlotListQueryParams, CreateBlockInput, BlockListQueryParams, FreeBusyQuery, FreeBusyResponse, MessageBookersInput, MessageBookersResult } from './bookings.js';
9
+ import type { Booking, BookingSlot, BookingAllocation, CreateBookingInput, BookingCheckoutInput, BookingCheckoutResult, UpdateBookingInput, MoveBookingInput, BookingListQueryParams, CreateSlotInput, UpdateSlotInput, SlotListQueryParams, CreateBlockInput, BlockListQueryParams, FreeBusyQuery, FreeBusyResponse, MessageBookersInput, MessageBookersResult } from './bookings.js';
10
10
  /**
11
11
  * A bundle (widget or container) as returned by the collection widgets endpoint.
12
12
  *
@@ -464,12 +464,34 @@ export interface ServerFunctionBookings {
464
464
  /** The signed-in caller's own bookings (empty when anonymous). */
465
465
  mine(params?: BookingListQueryParams): Promise<PaginatedResponse<Booking>>;
466
466
  update(bookingId: string, fields: UpdateBookingInput): Promise<Booking>;
467
- /** held / pending / waitlisted → confirmed (idempotent). */
468
- confirm(bookingId: string): Promise<Booking>;
469
- /** Cancel and give the places back (idempotent). */
467
+ /**
468
+ * held / pending / waitlisted → confirmed (idempotent). A booking waiting for its payment: a request
469
+ * becomes a hold with a pay link; `{ payment: 'waive' }` confirms without payment.
470
+ */
471
+ confirm(bookingId: string, opts?: {
472
+ payment?: 'waive';
473
+ }): Promise<Booking>;
474
+ /** Cancel and give the places back (idempotent). A paid booking is refunded: 'full' (default) | 'none' | an amount. */
470
475
  cancel(bookingId: string, opts?: {
471
476
  reason?: string;
477
+ refund?: 'full' | 'none' | number;
472
478
  }): Promise<Booking>;
479
+ /**
480
+ * Book and pay (docs/bookings.md, "Paid bookings"): held while the person pays on Stripe
481
+ * (`status: 'held'`, the default), or a priced request (`status: 'pending'`). → `checkoutUrl` to send them to.
482
+ */
483
+ checkout(input: BookingCheckoutInput): Promise<Omit<BookingCheckoutResult, 'editToken'> & {
484
+ replayed?: boolean;
485
+ }>;
486
+ /** Refund a paid booking without cancelling it: all that's left, or `amount` (minor units). */
487
+ refund(bookingId: string, opts?: {
488
+ amount?: number;
489
+ reason?: string;
490
+ }): Promise<{
491
+ booking: Booking;
492
+ refunded: number;
493
+ pending: boolean;
494
+ }>;
473
495
  /** All-or-nothing move to new claims. */
474
496
  move(bookingId: string, input: MoveBookingInput): Promise<Booking>;
475
497
  extendHold(bookingId: string, holdMinutes: number): Promise<Booking>;