@compassdigital/sdk.typescript 4.528.0 → 4.528.1-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 (50) hide show
  1. package/lib/index.d.ts +361 -7
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +434 -3
  4. package/lib/index.js.map +1 -1
  5. package/lib/interface/centricos.d.ts +9 -3
  6. package/lib/interface/centricos.d.ts.map +1 -1
  7. package/lib/interface/consumer.d.ts +36 -1
  8. package/lib/interface/consumer.d.ts.map +1 -1
  9. package/lib/interface/location.d.ts +0 -1
  10. package/lib/interface/location.d.ts.map +1 -1
  11. package/lib/interface/loyalty.d.ts +833 -0
  12. package/lib/interface/loyalty.d.ts.map +1 -0
  13. package/lib/interface/loyalty.js +5 -0
  14. package/lib/interface/loyalty.js.map +1 -0
  15. package/lib/interface/menu.d.ts +8 -0
  16. package/lib/interface/menu.d.ts.map +1 -1
  17. package/lib/interface/user.d.ts +20 -0
  18. package/lib/interface/user.d.ts.map +1 -1
  19. package/lib/messages/events/AuditEvent.d.ts +39 -0
  20. package/lib/messages/events/AuditEvent.d.ts.map +1 -0
  21. package/lib/messages/events/AuditEvent.js +4 -0
  22. package/lib/messages/events/AuditEvent.js.map +1 -0
  23. package/lib/messages/events/DiscountCreatedEvent.d.ts +1 -0
  24. package/lib/messages/events/DiscountCreatedEvent.d.ts.map +1 -1
  25. package/lib/messages/events/DiscountPublishedEvent.d.ts +1 -0
  26. package/lib/messages/events/DiscountPublishedEvent.d.ts.map +1 -1
  27. package/lib/messages/events/DiscountUpdatedEvent.d.ts +1 -0
  28. package/lib/messages/events/DiscountUpdatedEvent.d.ts.map +1 -1
  29. package/lib/messages/events/FrictionlessOrderFailureEvent.d.ts +23 -0
  30. package/lib/messages/events/FrictionlessOrderFailureEvent.d.ts.map +1 -0
  31. package/lib/messages/events/FrictionlessOrderFailureEvent.js +4 -0
  32. package/lib/messages/events/FrictionlessOrderFailureEvent.js.map +1 -0
  33. package/lib/messages/events/index.d.ts +2 -0
  34. package/lib/messages/events/index.d.ts.map +1 -1
  35. package/manifest.json +7 -0
  36. package/package.json +1 -1
  37. package/src/index.ts +1051 -7
  38. package/src/interface/centricos.ts +16 -6
  39. package/src/interface/consumer.ts +59 -1
  40. package/src/interface/location.ts +0 -1
  41. package/src/interface/loyalty.ts +1158 -0
  42. package/src/interface/menu.ts +8 -0
  43. package/src/interface/user.ts +27 -0
  44. package/src/messages/events/AuditEvent.ts +52 -0
  45. package/src/messages/events/DiscountCreatedEvent.ts +1 -0
  46. package/src/messages/events/DiscountPublishedEvent.ts +1 -0
  47. package/src/messages/events/DiscountUpdatedEvent.ts +1 -0
  48. package/src/messages/events/FrictionlessOrderFailureEvent.ts +34 -0
  49. package/src/messages/events/index.ts +4 -0
  50. package/test/client.test.ts +23 -0
@@ -0,0 +1,1158 @@
1
+ /* eslint-disable */
2
+ // THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY
3
+
4
+ import { RequestQuery, BaseRequest } from './util';
5
+
6
+ export interface BundleResponseDto {
7
+ id: string;
8
+ createdAt: string;
9
+ updatedAt: string;
10
+ deletedAt?: string | null;
11
+ createdBy: string;
12
+ realm: 'boost' | 'thrive';
13
+ siteId?: string | null;
14
+ name: string;
15
+ description?: string | null;
16
+ }
17
+
18
+ export interface BundlePaginationDto {
19
+ cursor?: string | null;
20
+ hasMore: boolean;
21
+ limit: number;
22
+ }
23
+
24
+ export interface BundleListResponseDto {
25
+ data: BundleResponseDto[];
26
+ pagination: BundlePaginationDto;
27
+ }
28
+
29
+ export interface ErrorDisplayMessage {
30
+ // user message title
31
+ title: string;
32
+ // user message description
33
+ description: string;
34
+ }
35
+
36
+ export interface ErrorData {
37
+ // http status code
38
+ statusCode: number;
39
+ // http status text
40
+ statusText: string;
41
+ timestamp: string;
42
+ // user friendly error message
43
+ displayMessage: ErrorDisplayMessage;
44
+ }
45
+
46
+ export interface Error {
47
+ // business error code
48
+ code: number;
49
+ // business error description
50
+ message: string;
51
+ // additional error data
52
+ data: ErrorData;
53
+ }
54
+
55
+ export interface BundleGroupDto {
56
+ groupName: string;
57
+ minimumQuantity: number;
58
+ itemIds: string[];
59
+ }
60
+
61
+ export interface BundleDetailResponseDto {
62
+ id: string;
63
+ createdAt: string;
64
+ updatedAt: string;
65
+ deletedAt?: string | null;
66
+ createdBy: string;
67
+ realm: 'boost' | 'thrive';
68
+ siteId?: string | null;
69
+ name: string;
70
+ description?: string | null;
71
+ groups: BundleGroupDto[];
72
+ }
73
+
74
+ export interface CreateBundleDto {
75
+ realm: 'boost' | 'thrive';
76
+ siteId?: string;
77
+ name: string;
78
+ description?: string;
79
+ groups: BundleGroupDto[];
80
+ }
81
+
82
+ export interface UpdateBundleDto {
83
+ realm?: 'boost' | 'thrive';
84
+ siteId?: string;
85
+ name?: string;
86
+ description?: string;
87
+ groups?: BundleGroupDto[];
88
+ }
89
+
90
+ export interface CampaignResponseDto {
91
+ id: string;
92
+ createdAt: string;
93
+ updatedAt: string;
94
+ deletedAt?: string | null;
95
+ createdBy: string;
96
+ updatedBy: string;
97
+ realm: 'boost' | 'thrive';
98
+ name: string;
99
+ description?: string | null;
100
+ type: 'promo_code' | 'auto_apply' | 'loyalty_reward';
101
+ status: 'draft' | 'active' | 'paused' | 'expired' | 'archived';
102
+ discountType: 'AMOUNT_OFF' | 'PERCENT_OFF' | 'FREE_ITEM';
103
+ discountScope: 'order' | 'items';
104
+ discountValueCents?: number | null;
105
+ discountPercent?: number | null;
106
+ appliesToCheapest: boolean;
107
+ maxDiscountCents?: number | null;
108
+ codeType: 'open' | 'personal' | 'auto_applied';
109
+ // YYYY-MM-DD
110
+ startDate?: string | null;
111
+ // YYYY-MM-DD
112
+ endDate?: string | null;
113
+ maxRedemptions?: number | null;
114
+ maxRedemptionsPerCustomer?: number | null;
115
+ maxRedemptionsDaily?: number | null;
116
+ maxRedemptionsPerCustomerDaily?: number | null;
117
+ minOrderValueCents?: number | null;
118
+ maxOrderValueCents?: number | null;
119
+ bundleId?: string | null;
120
+ }
121
+
122
+ export interface CampaignPaginationDto {
123
+ cursor?: string | null;
124
+ hasMore: boolean;
125
+ limit: number;
126
+ }
127
+
128
+ export interface CampaignListResponseDto {
129
+ data: CampaignResponseDto[];
130
+ pagination: CampaignPaginationDto;
131
+ }
132
+
133
+ export interface CampaignDailyScheduleResponseDto {
134
+ id: string;
135
+ campaignId: string;
136
+ dayOfWeek: 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
137
+ active: boolean;
138
+ // HH:MM:SS format
139
+ startTime: string;
140
+ // HH:MM:SS format
141
+ endTime: string;
142
+ }
143
+
144
+ export interface CampaignEligibilityResponseDto {
145
+ id: string;
146
+ campaignId: string;
147
+ eligibilityType: 'everyone' | 'meal_plan' | 'badge_pay' | 'sso_group' | 'segment';
148
+ ssoGroupId?: string | null;
149
+ segmentId?: string | null;
150
+ maxRedemptionsPerCustomer?: number | null;
151
+ maxRedemptionsPerCustomerDaily?: number | null;
152
+ }
153
+
154
+ export interface CampaignSiteScopeResponseDto {
155
+ campaignId: string;
156
+ siteId: string;
157
+ excluded: boolean;
158
+ }
159
+
160
+ export interface CampaignStationScopeResponseDto {
161
+ campaignId: string;
162
+ siteId: string;
163
+ stationId: string;
164
+ excluded: boolean;
165
+ }
166
+
167
+ export interface CampaignItemTargetResponseDto {
168
+ id: string;
169
+ campaignId: string;
170
+ siteId?: string | null;
171
+ stationId?: string | null;
172
+ menuId?: string | null;
173
+ categoryId?: string | null;
174
+ itemId?: string | null;
175
+ maxDiscountCents?: number | null;
176
+ }
177
+
178
+ export interface CampaignDetailResponseDto {
179
+ id: string;
180
+ createdAt: string;
181
+ updatedAt: string;
182
+ deletedAt?: string | null;
183
+ createdBy: string;
184
+ updatedBy: string;
185
+ realm: 'boost' | 'thrive';
186
+ name: string;
187
+ description?: string | null;
188
+ type: 'promo_code' | 'auto_apply' | 'loyalty_reward';
189
+ status: 'draft' | 'active' | 'paused' | 'expired' | 'archived';
190
+ discountType: 'AMOUNT_OFF' | 'PERCENT_OFF' | 'FREE_ITEM';
191
+ discountScope: 'order' | 'items';
192
+ discountValueCents?: number | null;
193
+ discountPercent?: number | null;
194
+ appliesToCheapest: boolean;
195
+ maxDiscountCents?: number | null;
196
+ codeType: 'open' | 'personal' | 'auto_applied';
197
+ // YYYY-MM-DD
198
+ startDate?: string | null;
199
+ // YYYY-MM-DD
200
+ endDate?: string | null;
201
+ maxRedemptions?: number | null;
202
+ maxRedemptionsPerCustomer?: number | null;
203
+ maxRedemptionsDaily?: number | null;
204
+ maxRedemptionsPerCustomerDaily?: number | null;
205
+ minOrderValueCents?: number | null;
206
+ maxOrderValueCents?: number | null;
207
+ bundleId?: string | null;
208
+ dailySchedule: CampaignDailyScheduleResponseDto[];
209
+ eligibility: CampaignEligibilityResponseDto[];
210
+ siteScopes: CampaignSiteScopeResponseDto[];
211
+ stationScopes: CampaignStationScopeResponseDto[];
212
+ itemTargets: CampaignItemTargetResponseDto[];
213
+ }
214
+
215
+ export interface DailyScheduleDto {
216
+ dayOfWeek: 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
217
+ active: boolean;
218
+ // HH:MM:SS format
219
+ startTime: string;
220
+ // HH:MM:SS format
221
+ endTime: string;
222
+ }
223
+
224
+ export interface EligibilityDto {
225
+ eligibilityType: 'everyone' | 'meal_plan' | 'badge_pay' | 'sso_group' | 'segment';
226
+ ssoGroupId?: string;
227
+ segmentId?: string;
228
+ maxRedemptionsPerCustomer?: number;
229
+ maxRedemptionsPerCustomerDaily?: number;
230
+ }
231
+
232
+ export interface SiteScopeDto {
233
+ siteId: string;
234
+ excluded?: boolean;
235
+ }
236
+
237
+ export interface StationScopeDto {
238
+ siteId: string;
239
+ stationId: string;
240
+ excluded?: boolean;
241
+ }
242
+
243
+ export interface ItemTargetDto {
244
+ siteId?: string;
245
+ stationId?: string;
246
+ menuId?: string;
247
+ categoryId?: string;
248
+ itemId?: string;
249
+ maxDiscountCents?: number;
250
+ }
251
+
252
+ export interface CreateCampaignDto {
253
+ realm: 'boost' | 'thrive';
254
+ name: string;
255
+ description?: string;
256
+ type: 'promo_code' | 'auto_apply' | 'loyalty_reward';
257
+ discountType: 'AMOUNT_OFF' | 'PERCENT_OFF' | 'FREE_ITEM';
258
+ discountScope: 'order' | 'items';
259
+ discountValueCents?: number;
260
+ discountPercent?: number;
261
+ appliesToCheapest?: boolean;
262
+ maxDiscountCents?: number;
263
+ codeType: 'open' | 'personal' | 'auto_applied';
264
+ // YYYY-MM-DD
265
+ startDate?: string;
266
+ // YYYY-MM-DD
267
+ endDate?: string;
268
+ maxRedemptions?: number;
269
+ maxRedemptionsPerCustomer?: number;
270
+ maxRedemptionsDaily?: number;
271
+ maxRedemptionsPerCustomerDaily?: number;
272
+ minOrderValueCents?: number;
273
+ maxOrderValueCents?: number;
274
+ dailySchedule?: DailyScheduleDto[];
275
+ eligibility?: EligibilityDto[];
276
+ siteScopes?: SiteScopeDto[];
277
+ stationScopes?: StationScopeDto[];
278
+ itemTargets?: ItemTargetDto[];
279
+ // Reference to a reusable bundle for cart-content conditions
280
+ bundleId?: string;
281
+ }
282
+
283
+ export interface UpdateCampaignDto {
284
+ realm?: 'boost' | 'thrive';
285
+ name?: string;
286
+ description?: string;
287
+ type?: 'promo_code' | 'auto_apply' | 'loyalty_reward';
288
+ discountType?: 'AMOUNT_OFF' | 'PERCENT_OFF' | 'FREE_ITEM';
289
+ discountScope?: 'order' | 'items';
290
+ discountValueCents?: number;
291
+ discountPercent?: number;
292
+ appliesToCheapest?: boolean;
293
+ maxDiscountCents?: number;
294
+ codeType?: 'open' | 'personal' | 'auto_applied';
295
+ // YYYY-MM-DD
296
+ startDate?: string;
297
+ // YYYY-MM-DD
298
+ endDate?: string;
299
+ maxRedemptions?: number;
300
+ maxRedemptionsPerCustomer?: number;
301
+ maxRedemptionsDaily?: number;
302
+ maxRedemptionsPerCustomerDaily?: number;
303
+ minOrderValueCents?: number;
304
+ maxOrderValueCents?: number;
305
+ dailySchedule?: DailyScheduleDto[];
306
+ eligibility?: EligibilityDto[];
307
+ siteScopes?: SiteScopeDto[];
308
+ stationScopes?: StationScopeDto[];
309
+ itemTargets?: ItemTargetDto[];
310
+ // Reference to a reusable bundle for cart-content conditions
311
+ bundleId?: string;
312
+ }
313
+
314
+ export interface UpdateCampaignStatusDto {
315
+ status: 'draft' | 'active' | 'paused' | 'expired' | 'archived';
316
+ reason?: string;
317
+ }
318
+
319
+ export interface VoucherResponseDto {
320
+ id: string;
321
+ createdAt: string;
322
+ updatedAt: string;
323
+ deletedAt?: string | null;
324
+ campaignId: string;
325
+ realm: 'boost' | 'thrive';
326
+ code: string;
327
+ codeType: 'open' | 'personal' | 'auto_applied';
328
+ customerId?: string | null;
329
+ status: string;
330
+ expiresAt?: string | null;
331
+ issuedBy?: string | null;
332
+ issueReason?: string | null;
333
+ revokedAt?: string | null;
334
+ revokedBy?: string | null;
335
+ revokeReason?: string | null;
336
+ source?: string;
337
+ campaignName?: string;
338
+ campaignType?: string;
339
+ redemptionCount?: number;
340
+ }
341
+
342
+ export interface VoucherPaginationDto {
343
+ cursor?: string | null;
344
+ hasMore: boolean;
345
+ limit: number;
346
+ }
347
+
348
+ export interface VoucherListResponseDto {
349
+ data: VoucherResponseDto[];
350
+ pagination: VoucherPaginationDto;
351
+ }
352
+
353
+ export interface CreateVoucherDto {
354
+ campaignId: string;
355
+ code: string;
356
+ // Supports legacy alias "binding"
357
+ codeType: 'open' | 'personal' | 'auto_applied';
358
+ // Required when codeType = personal
359
+ customerId?: string;
360
+ expiresAt?: string;
361
+ issueReason?: string;
362
+ }
363
+
364
+ export interface UpdateVoucherDto {
365
+ expiresAt?: string;
366
+ customerId?: string;
367
+ }
368
+
369
+ export interface RevokeVoucherDto {
370
+ // Reason for revoking the voucher
371
+ reason: string;
372
+ }
373
+
374
+ export interface BatchVoucherDto {
375
+ campaignId: string;
376
+ count: number;
377
+ // Supports legacy alias "binding"
378
+ codeType: 'open' | 'personal';
379
+ // Prefix prepended to generated codes
380
+ prefix?: string;
381
+ expiresAt?: string;
382
+ // Required when codeType = personal; length must match count
383
+ customerIds?: string[];
384
+ }
385
+
386
+ export interface BatchVoucherResponseDto {
387
+ codePoolId: string;
388
+ count: number;
389
+ }
390
+
391
+ export interface RedemptionItemResponseDto {
392
+ id: string;
393
+ itemId: string;
394
+ itemName?: string | null;
395
+ originalPriceCents: number;
396
+ discountAmountCents: number;
397
+ }
398
+
399
+ export interface VoucherDiscountResponseDto {
400
+ type: string;
401
+ amount_off: number;
402
+ percent_off: number;
403
+ }
404
+
405
+ export interface VoucherRedemptionVoucherDto {
406
+ id: string;
407
+ code: string;
408
+ discount: VoucherDiscountResponseDto;
409
+ }
410
+
411
+ export interface RedemptionResponseDto {
412
+ id: string;
413
+ createdAt: string;
414
+ voucherId?: string | null;
415
+ customerId?: string | null;
416
+ orderId?: string | null;
417
+ siteId?: string | null;
418
+ stationId?: string | null;
419
+ realm?: string;
420
+ discountAmountCents?: number;
421
+ orderTotalCents?: number;
422
+ status?: string;
423
+ rolledBackAt?: string | null;
424
+ rollbackReason?: string | null;
425
+ externalRedemptionId?: string | null;
426
+ items?: RedemptionItemResponseDto[];
427
+ date?: string;
428
+ result?: string;
429
+ object?: string;
430
+ app?: string;
431
+ voucher?: VoucherRedemptionVoucherDto;
432
+ }
433
+
434
+ export interface RedemptionListResponseDto {
435
+ data: RedemptionResponseDto[];
436
+ pagination: VoucherPaginationDto;
437
+ }
438
+
439
+ export interface VoucherCustomerDto {
440
+ source_id?: string;
441
+ email?: string;
442
+ }
443
+
444
+ export interface VoucherOrderItemProductMetadataDto {
445
+ item_name?: string;
446
+ }
447
+
448
+ export interface VoucherOrderItemProductDto {
449
+ metadata?: VoucherOrderItemProductMetadataDto;
450
+ }
451
+
452
+ export interface VoucherOrderItemDto {
453
+ source_id?: string;
454
+ product_id?: string;
455
+ quantity?: number;
456
+ price?: number;
457
+ product?: VoucherOrderItemProductDto;
458
+ }
459
+
460
+ export interface VoucherOrderMetadataDto {
461
+ order_id?: string;
462
+ brand_id?: string;
463
+ site_id?: string;
464
+ location_group_id?: string;
465
+ }
466
+
467
+ export interface VoucherOrderDto {
468
+ source_id?: string;
469
+ items?: VoucherOrderItemDto[];
470
+ metadata?: VoucherOrderMetadataDto;
471
+ }
472
+
473
+ export interface VoucherOperationDto {
474
+ codes: string[];
475
+ customer?: VoucherCustomerDto;
476
+ order?: VoucherOrderDto;
477
+ }
478
+
479
+ export interface VoucherErrorResponseDto {
480
+ message: string;
481
+ }
482
+
483
+ export interface VoucherOperationOrderResponseDto {
484
+ total_discount_amount: number;
485
+ total_applied_discount_amount: number;
486
+ }
487
+
488
+ export interface VoucherOperationResultResponseDto {
489
+ discount?: VoucherDiscountResponseDto;
490
+ error?: VoucherErrorResponseDto;
491
+ }
492
+
493
+ export interface VoucherRedeemableResponseDto {
494
+ status: string;
495
+ id: string;
496
+ object: string;
497
+ order: VoucherOperationOrderResponseDto;
498
+ result: VoucherOperationResultResponseDto;
499
+ }
500
+
501
+ export interface VoucherOperationResponseDto {
502
+ code?: string;
503
+ valid?: boolean;
504
+ success?: boolean;
505
+ app?: string;
506
+ discount?: VoucherDiscountResponseDto;
507
+ provider_data?: Record<string, any>;
508
+ error?: VoucherErrorResponseDto;
509
+ redeemables?: VoucherRedeemableResponseDto[];
510
+ redemptions?: RedemptionResponseDto[];
511
+ id?: string;
512
+ date?: string;
513
+ result?: string;
514
+ object?: string;
515
+ voucher?: VoucherRedemptionVoucherDto;
516
+ }
517
+
518
+ export interface SegmentResponseDto {
519
+ id: string;
520
+ createdAt: string;
521
+ updatedAt: string;
522
+ deletedAt?: string | null;
523
+ createdBy: string;
524
+ realm: 'boost' | 'thrive';
525
+ siteId: string;
526
+ name: string;
527
+ description?: string | null;
528
+ type: 'static_list' | 'sso_group' | 'attribute_rule';
529
+ ssoGroupId?: string | null;
530
+ ruleJson?: Record<string, any> | null;
531
+ memberCount?: number;
532
+ }
533
+
534
+ export interface SegmentPaginationDto {
535
+ cursor?: string | null;
536
+ hasMore: boolean;
537
+ limit: number;
538
+ }
539
+
540
+ export interface SegmentListResponseDto {
541
+ data: SegmentResponseDto[];
542
+ pagination: SegmentPaginationDto;
543
+ }
544
+
545
+ export interface SegmentAttributeResponseDto {
546
+ key: string;
547
+ label: string;
548
+ }
549
+
550
+ export interface SegmentPreviewCountResponseDto {
551
+ count: number;
552
+ }
553
+
554
+ export interface CreateSegmentDto {
555
+ realm: 'boost' | 'thrive';
556
+ siteId: string;
557
+ name: string;
558
+ description?: string;
559
+ type: 'static_list' | 'sso_group' | 'attribute_rule';
560
+ // Required when type = sso_group
561
+ ssoGroupId?: string;
562
+ // Required when type = attribute_rule
563
+ ruleJson?: Record<string, any>;
564
+ // Initial members for static_list segments
565
+ customerIds?: string[];
566
+ }
567
+
568
+ export interface UpdateSegmentDto {
569
+ name?: string;
570
+ description?: string;
571
+ ssoGroupId?: string;
572
+ ruleJson?: Record<string, any>;
573
+ }
574
+
575
+ export interface SegmentMemberResponseDto {
576
+ customerId: string;
577
+ addedAt: string;
578
+ addedBy: string;
579
+ }
580
+
581
+ export interface SegmentMembersListResponseDto {
582
+ data: SegmentMemberResponseDto[];
583
+ pagination: SegmentPaginationDto;
584
+ }
585
+
586
+ export interface SegmentMembersDto {
587
+ // List of customer IDs
588
+ customerIds: string[];
589
+ }
590
+
591
+ export interface AddSegmentMembersResponseDto {
592
+ added: number;
593
+ }
594
+
595
+ export interface RemoveSegmentMembersResponseDto {
596
+ removed: number;
597
+ }
598
+
599
+ export interface RollbackRedemptionDto {
600
+ // Reason for rolling back the redemption
601
+ reason: string;
602
+ }
603
+
604
+ export interface RewardResponseDto {
605
+ id: string;
606
+ createdAt: string;
607
+ updatedAt: string;
608
+ deletedAt?: string | null;
609
+ createdBy: string;
610
+ realm: 'boost' | 'thrive';
611
+ siteId?: string | null;
612
+ name: string;
613
+ description?: string | null;
614
+ status: 'active' | 'paused' | 'archived';
615
+ }
616
+
617
+ export interface RewardPaginationDto {
618
+ cursor?: string | null;
619
+ hasMore: boolean;
620
+ limit: number;
621
+ }
622
+
623
+ export interface RewardListResponseDto {
624
+ data: RewardResponseDto[];
625
+ pagination: RewardPaginationDto;
626
+ }
627
+
628
+ export interface BrandExclusionDto {
629
+ siteId: string;
630
+ stationId: string;
631
+ }
632
+
633
+ export interface EarningRuleDto {
634
+ eventType: 'order_placed' | 'item_purchased' | 'amount_spent';
635
+ points: number;
636
+ spendThresholdCents?: number;
637
+ siteId?: string;
638
+ itemId?: string;
639
+ // Stations excluded from earning on this rule
640
+ brandExclusions?: BrandExclusionDto[];
641
+ }
642
+
643
+ export interface MilestoneDto {
644
+ pointsRequired: number;
645
+ campaignId: string;
646
+ resetsAfterMilestone: boolean;
647
+ maxRewardCount?: number;
648
+ }
649
+
650
+ export interface RewardDetailResponseDto {
651
+ id: string;
652
+ createdAt: string;
653
+ updatedAt: string;
654
+ deletedAt?: string | null;
655
+ createdBy: string;
656
+ realm: 'boost' | 'thrive';
657
+ name: string;
658
+ description?: string | null;
659
+ status: 'active' | 'paused' | 'archived';
660
+ earningRules: EarningRuleDto[];
661
+ milestones: MilestoneDto[];
662
+ }
663
+
664
+ export interface CreateRewardDto {
665
+ realm: 'boost' | 'thrive';
666
+ siteId?: string;
667
+ name: string;
668
+ description?: string;
669
+ earningRules?: EarningRuleDto[];
670
+ milestones?: MilestoneDto[];
671
+ }
672
+
673
+ export interface UpdateRewardDto {
674
+ realm?: 'boost' | 'thrive';
675
+ siteId?: string;
676
+ name?: string;
677
+ description?: string;
678
+ earningRules?: EarningRuleDto[];
679
+ milestones?: MilestoneDto[];
680
+ }
681
+
682
+ export interface UpdateRewardStatusDto {
683
+ status: 'active' | 'paused' | 'archived';
684
+ }
685
+
686
+ export interface RewardCardResponseDto {
687
+ id: string;
688
+ createdAt: string;
689
+ updatedAt: string;
690
+ rewardId: string;
691
+ customerId: string;
692
+ pointsBalance: number;
693
+ lifetimePoints: number;
694
+ status: string;
695
+ }
696
+
697
+ export interface RewardCardListResponseDto {
698
+ data: RewardCardResponseDto[];
699
+ pagination: RewardPaginationDto;
700
+ }
701
+
702
+ export interface RewardEventResponseDto {
703
+ id: string;
704
+ createdAt: string;
705
+ cardId: string;
706
+ eventType: 'order_placed' | 'item_purchased' | 'amount_spent';
707
+ pointsDelta: number;
708
+ orderId?: string | null;
709
+ description?: string | null;
710
+ adjustedBy?: string | null;
711
+ }
712
+
713
+ export interface RewardCardDetailResponseDto {
714
+ id: string;
715
+ createdAt: string;
716
+ updatedAt: string;
717
+ rewardId: string;
718
+ customerId: string;
719
+ pointsBalance: number;
720
+ lifetimePoints: number;
721
+ status: string;
722
+ events: RewardEventResponseDto[];
723
+ }
724
+
725
+ export interface AdjustPointsDto {
726
+ // Positive to add, negative to deduct
727
+ pointsDelta: number;
728
+ description: string;
729
+ }
730
+
731
+ export interface EarnOrderItemDto {
732
+ id: string;
733
+ quantity: number;
734
+ priceCents?: number;
735
+ }
736
+
737
+ export interface EarnOrderDto {
738
+ orderId: string;
739
+ customerId: string;
740
+ realm: 'boost' | 'thrive';
741
+ siteId: string;
742
+ brandId: string;
743
+ amountCents: number;
744
+ items: EarnOrderItemDto[];
745
+ email?: string;
746
+ metadata?: Record<string, any>;
747
+ }
748
+
749
+ export interface EarnOrderResponseDto {
750
+ rewardId?: string | null;
751
+ alreadyProcessed: boolean;
752
+ pointsAwarded: number;
753
+ issuedVoucherCodes: string[];
754
+ }
755
+
756
+ // GET /loyalty/bundles - List bundles with optional filters
757
+
758
+ export interface GetLoyaltyBundlesQuery {
759
+ // Max items to return
760
+ limit?: number;
761
+ // Opaque cursor from previous response
762
+ cursor?: string;
763
+ realm?: 'boost' | 'thrive';
764
+ siteId?: string;
765
+ siteIds?: string[];
766
+ name?: string;
767
+ }
768
+
769
+ export type GetLoyaltyBundlesResponse = BundleListResponseDto;
770
+
771
+ // POST /loyalty/bundles - Create a new bundle
772
+
773
+ export type PostLoyaltyBundleBody = CreateBundleDto;
774
+
775
+ export type PostLoyaltyBundleResponse = BundleDetailResponseDto;
776
+
777
+ // GET /loyalty/bundles/{id} - Get bundle by ID with groups
778
+
779
+ export interface GetLoyaltyBundlePath {
780
+ id: string;
781
+ }
782
+
783
+ export type GetLoyaltyBundleResponse = BundleDetailResponseDto;
784
+
785
+ // PATCH /loyalty/bundles/{id} - Update a bundle
786
+
787
+ export interface PatchLoyaltyBundlePath {
788
+ id: string;
789
+ }
790
+
791
+ export type PatchLoyaltyBundleBody = UpdateBundleDto;
792
+
793
+ export type PatchLoyaltyBundleResponse = BundleDetailResponseDto;
794
+
795
+ // DELETE /loyalty/bundles/{id} - Soft-delete a bundle
796
+
797
+ export interface DeleteLoyaltyBundlePath {
798
+ id: string;
799
+ }
800
+
801
+ export type DeleteLoyaltyBundleResponse = {};
802
+
803
+ // GET /loyalty/campaigns - List campaigns with filters and pagination
804
+
805
+ export interface GetLoyaltyCampaignsQuery {
806
+ // Max items to return
807
+ limit?: number;
808
+ // Opaque cursor from previous response
809
+ cursor?: string;
810
+ realm?: 'boost' | 'thrive';
811
+ status?: 'draft' | 'active' | 'paused' | 'expired' | 'archived';
812
+ type?: 'promo_code' | 'auto_apply' | 'loyalty_reward';
813
+ // Case-insensitive partial name match
814
+ name?: string;
815
+ // YYYY-MM-DD
816
+ startDateFrom?: string;
817
+ // YYYY-MM-DD
818
+ startDateTo?: string;
819
+ // YYYY-MM-DD
820
+ endDateFrom?: string;
821
+ // YYYY-MM-DD
822
+ endDateTo?: string;
823
+ sortBy?: 'name' | 'createdAt' | 'startDate' | 'status';
824
+ sortOrder?: 'ASC' | 'DESC';
825
+ }
826
+
827
+ export type GetLoyaltyCampaignsResponse = CampaignListResponseDto;
828
+
829
+ // POST /loyalty/campaigns - Create a campaign with nested child entities
830
+
831
+ export type PostLoyaltyCampaignBody = CreateCampaignDto;
832
+
833
+ export type PostLoyaltyCampaignResponse = CampaignDetailResponseDto;
834
+
835
+ // GET /loyalty/campaigns/{id} - Get campaign detail with all child entities
836
+
837
+ export interface GetLoyaltyCampaignPath {
838
+ id: string;
839
+ }
840
+
841
+ export type GetLoyaltyCampaignResponse = CampaignDetailResponseDto;
842
+
843
+ // PUT /loyalty/campaigns/{id} - Update a campaign and its child entities
844
+
845
+ export interface PutLoyaltyCampaignPath {
846
+ id: string;
847
+ }
848
+
849
+ export type PutLoyaltyCampaignBody = UpdateCampaignDto;
850
+
851
+ export type PutLoyaltyCampaignResponse = CampaignDetailResponseDto;
852
+
853
+ // DELETE /loyalty/campaigns/{id} - Soft-delete a campaign
854
+
855
+ export interface DeleteLoyaltyCampaignPath {
856
+ id: string;
857
+ }
858
+
859
+ export type DeleteLoyaltyCampaignResponse = {};
860
+
861
+ // PATCH /loyalty/campaigns/{id}/status - Transition campaign status
862
+
863
+ export interface PatchLoyaltyCampaignStatusPath {
864
+ id: string;
865
+ }
866
+
867
+ export type PatchLoyaltyCampaignStatusBody = UpdateCampaignStatusDto;
868
+
869
+ export type PatchLoyaltyCampaignStatusResponse = CampaignDetailResponseDto;
870
+
871
+ // POST /loyalty/campaigns/{id}/clone - Deep clone a campaign and all child entities
872
+
873
+ export interface PostLoyaltyCampaignClonePath {
874
+ id: string;
875
+ }
876
+
877
+ export type PostLoyaltyCampaignCloneResponse = CampaignDetailResponseDto;
878
+
879
+ // GET /loyalty/vouchers - List vouchers with optional filters
880
+
881
+ export interface GetLoyaltyVouchersQuery {
882
+ // Max items to return
883
+ limit?: number;
884
+ // Opaque cursor from previous response
885
+ cursor?: string;
886
+ campaignId?: string;
887
+ realm?: 'boost' | 'thrive';
888
+ status?: 'active' | 'redeemed' | 'expired' | 'revoked';
889
+ // Exact code match
890
+ code?: string;
891
+ codeType?: 'open' | 'personal' | 'auto_applied';
892
+ customerId?: string;
893
+ }
894
+
895
+ export type GetLoyaltyVouchersResponse = VoucherListResponseDto;
896
+
897
+ // POST /loyalty/vouchers - Create a single voucher
898
+
899
+ export type PostLoyaltyVoucherBody = CreateVoucherDto;
900
+
901
+ export type PostLoyaltyVoucherResponse = VoucherResponseDto;
902
+
903
+ // GET /loyalty/vouchers/{id} - Get voucher by ID with campaign info and redemption count
904
+
905
+ export interface GetLoyaltyVoucherPath {
906
+ id: string;
907
+ }
908
+
909
+ export type GetLoyaltyVoucherResponse = VoucherResponseDto;
910
+
911
+ // PUT /loyalty/vouchers/{id} - Update a voucher
912
+
913
+ export interface PutLoyaltyVoucherPath {
914
+ id: string;
915
+ }
916
+
917
+ export type PutLoyaltyVoucherBody = UpdateVoucherDto;
918
+
919
+ export type PutLoyaltyVoucherResponse = VoucherResponseDto;
920
+
921
+ // DELETE /loyalty/vouchers/{id} - Soft-delete a voucher
922
+
923
+ export interface DeleteLoyaltyVoucherPath {
924
+ id: string;
925
+ }
926
+
927
+ export type DeleteLoyaltyVoucherResponse = {};
928
+
929
+ // POST /loyalty/vouchers/{id}/revoke - Revoke a voucher with a required reason
930
+
931
+ export interface PostLoyaltyVoucherRevokePath {
932
+ id: string;
933
+ }
934
+
935
+ export type PostLoyaltyVoucherRevokeBody = RevokeVoucherDto;
936
+
937
+ export type PostLoyaltyVoucherRevokeResponse = VoucherResponseDto;
938
+
939
+ // POST /loyalty/vouchers/batch - Batch generate voucher codes for a campaign
940
+
941
+ export type PostLoyaltyVouchersBatchBody = BatchVoucherDto;
942
+
943
+ export type PostLoyaltyVouchersBatchResponse = BatchVoucherResponseDto;
944
+
945
+ // GET /loyalty/vouchers/{id}/redemptions - Get redemption history for a voucher
946
+
947
+ export interface GetLoyaltyVoucherRedemptionsPath {
948
+ id: string;
949
+ }
950
+
951
+ export interface GetLoyaltyVoucherRedemptionsQuery {
952
+ // Max items to return
953
+ limit?: number;
954
+ // Opaque cursor from previous response
955
+ cursor?: string;
956
+ }
957
+
958
+ export type GetLoyaltyVoucherRedemptionsResponse = RedemptionListResponseDto;
959
+
960
+ // POST /loyalty/vouchers/validate - Validate one or more voucher codes
961
+
962
+ export type PostLoyaltyVouchersValidateBody = VoucherOperationDto;
963
+
964
+ export type PostLoyaltyVouchersValidateResponse = VoucherOperationResponseDto;
965
+
966
+ // POST /loyalty/vouchers/redeem - Redeem one or more voucher codes
967
+
968
+ export type PostLoyaltyVouchersRedeemBody = VoucherOperationDto;
969
+
970
+ export type PostLoyaltyVouchersRedeemResponse = VoucherOperationResponseDto;
971
+
972
+ // GET /loyalty/segments - List segments with optional filters
973
+
974
+ export interface GetLoyaltySegmentsQuery {
975
+ // Max items to return
976
+ limit?: number;
977
+ // Opaque cursor from previous response
978
+ cursor?: string;
979
+ realm?: 'boost' | 'thrive';
980
+ type?: 'static_list' | 'sso_group' | 'attribute_rule';
981
+ siteId?: string;
982
+ // Case-insensitive partial name match
983
+ name?: string;
984
+ }
985
+
986
+ export type GetLoyaltySegmentsResponse = SegmentListResponseDto;
987
+
988
+ // POST /loyalty/segments - Create a new segment
989
+
990
+ export type PostLoyaltySegmentBody = CreateSegmentDto;
991
+
992
+ export type PostLoyaltySegmentResponse = SegmentResponseDto;
993
+
994
+ // GET /loyalty/segments/attributes - List available attributes for rule-based segments
995
+
996
+ export type GetLoyaltySegmentAttributesResponse = SegmentAttributeResponseDto[];
997
+
998
+ // POST /loyalty/segments/preview-count - Preview how many customers match a segment rule
999
+
1000
+ export type PostLoyaltySegmentPreviewCountResponse = SegmentPreviewCountResponseDto;
1001
+
1002
+ // GET /loyalty/segments/{id} - Get segment by ID
1003
+
1004
+ export interface GetLoyaltySegmentPath {
1005
+ id: string;
1006
+ }
1007
+
1008
+ export type GetLoyaltySegmentResponse = SegmentResponseDto;
1009
+
1010
+ // PATCH /loyalty/segments/{id} - Update a segment
1011
+
1012
+ export interface PatchLoyaltySegmentPath {
1013
+ id: string;
1014
+ }
1015
+
1016
+ export type PatchLoyaltySegmentBody = UpdateSegmentDto;
1017
+
1018
+ export type PatchLoyaltySegmentResponse = SegmentResponseDto;
1019
+
1020
+ // DELETE /loyalty/segments/{id} - Soft-delete a segment
1021
+
1022
+ export interface DeleteLoyaltySegmentPath {
1023
+ id: string;
1024
+ }
1025
+
1026
+ export type DeleteLoyaltySegmentResponse = {};
1027
+
1028
+ // GET /loyalty/segments/{id}/members - List members of a static_list segment
1029
+
1030
+ export interface GetLoyaltySegmentMembersPath {
1031
+ id: string;
1032
+ }
1033
+
1034
+ export interface GetLoyaltySegmentMembersQuery {
1035
+ // Max items to return
1036
+ limit?: number;
1037
+ // Opaque cursor from previous response
1038
+ cursor?: string;
1039
+ }
1040
+
1041
+ export type GetLoyaltySegmentMembersResponse = SegmentMembersListResponseDto;
1042
+
1043
+ // POST /loyalty/segments/{id}/members - Add members to a segment
1044
+
1045
+ export interface PostLoyaltySegmentMembersPath {
1046
+ id: string;
1047
+ }
1048
+
1049
+ export type PostLoyaltySegmentMembersBody = SegmentMembersDto;
1050
+
1051
+ export type PostLoyaltySegmentMembersResponse = AddSegmentMembersResponseDto;
1052
+
1053
+ // DELETE /loyalty/segments/{id}/members - Remove members from a segment
1054
+
1055
+ export interface DeleteLoyaltySegmentMembersPath {
1056
+ id: string;
1057
+ }
1058
+
1059
+ export type DeleteLoyaltySegmentMembersBody = SegmentMembersDto;
1060
+
1061
+ export type DeleteLoyaltySegmentMembersResponse = RemoveSegmentMembersResponseDto;
1062
+
1063
+ // POST /loyalty/redemptions/{id}/rollback - Roll back a redemption and restore the voucher
1064
+
1065
+ export interface PostLoyaltyRedemptionRollbackPath {
1066
+ id: string;
1067
+ }
1068
+
1069
+ export type PostLoyaltyRedemptionRollbackBody = RollbackRedemptionDto;
1070
+
1071
+ export type PostLoyaltyRedemptionRollbackResponse = RedemptionResponseDto;
1072
+
1073
+ // GET /loyalty/rewards - List rewards with filters and pagination
1074
+
1075
+ export interface GetLoyaltyRewardsQuery {
1076
+ // Max items to return
1077
+ limit?: number;
1078
+ // Opaque cursor from previous response
1079
+ cursor?: string;
1080
+ realm?: 'boost' | 'thrive';
1081
+ status?: 'active' | 'paused' | 'archived';
1082
+ }
1083
+
1084
+ export type GetLoyaltyRewardsResponse = RewardListResponseDto;
1085
+
1086
+ // POST /loyalty/rewards - Create a reward with earning rules and milestones
1087
+
1088
+ export type PostLoyaltyRewardBody = CreateRewardDto;
1089
+
1090
+ export type PostLoyaltyRewardResponse = RewardDetailResponseDto;
1091
+
1092
+ // GET /loyalty/rewards/{id} - Get reward detail with earning rules and milestones
1093
+
1094
+ export interface GetLoyaltyRewardPath {
1095
+ id: string;
1096
+ }
1097
+
1098
+ export type GetLoyaltyRewardResponse = RewardDetailResponseDto;
1099
+
1100
+ // PUT /loyalty/rewards/{id} - Update a reward and replace its earning rules and milestones
1101
+
1102
+ export interface PutLoyaltyRewardPath {
1103
+ id: string;
1104
+ }
1105
+
1106
+ export type PutLoyaltyRewardBody = UpdateRewardDto;
1107
+
1108
+ export type PutLoyaltyRewardResponse = RewardDetailResponseDto;
1109
+
1110
+ // PATCH /loyalty/rewards/{id}/status - Transition reward status
1111
+
1112
+ export interface PatchLoyaltyRewardStatusPath {
1113
+ id: string;
1114
+ }
1115
+
1116
+ export type PatchLoyaltyRewardStatusBody = UpdateRewardStatusDto;
1117
+
1118
+ export type PatchLoyaltyRewardStatusResponse = RewardDetailResponseDto;
1119
+
1120
+ // GET /loyalty/rewards/{id}/cards - List enrolled customer cards for a reward
1121
+
1122
+ export interface GetLoyaltyRewardCardsPath {
1123
+ id: string;
1124
+ }
1125
+
1126
+ export interface GetLoyaltyRewardCardsQuery {
1127
+ // Max items to return
1128
+ limit?: number;
1129
+ // Opaque cursor from previous response
1130
+ cursor?: string;
1131
+ }
1132
+
1133
+ export type GetLoyaltyRewardCardsResponse = RewardCardListResponseDto;
1134
+
1135
+ // GET /loyalty/rewards/{id}/cards/{customerId} - Get card detail with transaction event history
1136
+
1137
+ export interface GetLoyaltyRewardCardPath {
1138
+ id: string;
1139
+ customerId: string;
1140
+ }
1141
+
1142
+ export type GetLoyaltyRewardCardResponse = RewardCardDetailResponseDto;
1143
+
1144
+ // POST /loyalty/rewards/cards/{cardId}/adjust - Manual point adjustment on a reward card
1145
+
1146
+ export interface PostLoyaltyRewardCardAdjustPath {
1147
+ cardId: string;
1148
+ }
1149
+
1150
+ export type PostLoyaltyRewardCardAdjustBody = AdjustPointsDto;
1151
+
1152
+ export type PostLoyaltyRewardCardAdjustResponse = RewardCardDetailResponseDto;
1153
+
1154
+ // POST /loyalty/rewards/orders/earn - Evaluate an order against active reward rules and award points idempotently
1155
+
1156
+ export type PostLoyaltyRewardOrderEarnBody = EarnOrderDto;
1157
+
1158
+ export type PostLoyaltyRewardOrderEarnResponse = EarnOrderResponseDto;