@classytic/loyalty 0.6.0 → 0.10.0

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 (32) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/dist/constants-DfrENxFG.mjs +75 -0
  3. package/dist/domain/earn-base.d.mts +35 -0
  4. package/dist/domain/earn-base.mjs +37 -0
  5. package/dist/domain/enums/index.d.mts +2 -2
  6. package/dist/domain/enums/index.mjs +1 -2
  7. package/dist/domain/rule-schedule.d.mts +24 -0
  8. package/dist/domain/rule-schedule.mjs +12 -0
  9. package/dist/events/index.d.mts +2 -2
  10. package/dist/events/index.mjs +3 -3
  11. package/dist/{events-BLjg3uLA.mjs → events-DhZolW61.mjs} +104 -4
  12. package/dist/{index-CR2k7jQ8.d.mts → index-BvyzKU7R.d.mts} +294 -34
  13. package/dist/{index-D6GvuvmF.d.mts → index-CorB0JL6.d.mts} +259 -113
  14. package/dist/index-DRrEhE0r.d.mts +604 -0
  15. package/dist/{index-YUFamhDk.d.mts → index-Db5Gb7x_.d.mts} +187 -39
  16. package/dist/index-tjMMmPzU.d.mts +36 -0
  17. package/dist/index.d.mts +121 -30
  18. package/dist/index.mjs +63 -10
  19. package/dist/{loyalty-events-DXirolM_.mjs → loyalty-events-j29B66YW.mjs} +20 -13
  20. package/dist/models/index.d.mts +2 -2
  21. package/dist/models/index.mjs +1 -2
  22. package/dist/{models-weWqS5Bc.mjs → models-BEGLduz1.mjs} +276 -7
  23. package/dist/notifications/index.d.mts +3 -4
  24. package/dist/repositories/index.d.mts +2 -2
  25. package/dist/repositories/index.mjs +1 -2
  26. package/dist/{repositories-B676z4bE.mjs → repositories-ER68JmUo.mjs} +1178 -102
  27. package/dist/types/index.d.mts +2 -3
  28. package/package.json +39 -22
  29. package/dist/config-CtkGj3xZ.d.mts +0 -178
  30. package/dist/constants-DOPBh6kt.mjs +0 -48
  31. package/dist/index-Cp_sXNpG.d.mts +0 -349
  32. package/dist/index-D_Oe3aDk.d.mts +0 -19
@@ -1,4 +1,5 @@
1
- import { o as LoyaltyContext } from "./index-Cp_sXNpG.mjs";
1
+ import { t as EarnSource } from "./index-tjMMmPzU.mjs";
2
+ import { o as LoyaltyContext } from "./index-DRrEhE0r.mjs";
2
3
  import { InProcessEventBus, InProcessEventBusOptions } from "@classytic/primitives/event-infra";
3
4
  import { DomainEvent, DomainEvent as DomainEvent$1, EventHandler, EventTransport as EventTransport$1 } from "@classytic/primitives/events";
4
5
  import { z } from "zod";
@@ -61,6 +62,13 @@ declare const PointsEarned: LoyaltyEventDefinition<z.ZodObject<{
61
62
  externalId: z.ZodString;
62
63
  externalType: z.ZodString;
63
64
  points: z.ZodNumber;
65
+ source: z.ZodEnum<{
66
+ action: "action";
67
+ campaign: "campaign";
68
+ order: "order";
69
+ referral: "referral";
70
+ }>;
71
+ pointValueMinor: z.ZodNumber;
64
72
  balanceAfter: z.ZodNumber;
65
73
  transactionId: z.ZodString;
66
74
  earningRuleName: z.ZodOptional<z.ZodString>;
@@ -71,6 +79,7 @@ declare const PointsRedeemed: LoyaltyEventDefinition<z.ZodObject<{
71
79
  memberId: z.ZodString;
72
80
  externalId: z.ZodString;
73
81
  points: z.ZodNumber;
82
+ pointValueMinor: z.ZodNumber;
74
83
  balanceAfter: z.ZodNumber;
75
84
  transactionId: z.ZodString;
76
85
  description: z.ZodString;
@@ -79,15 +88,38 @@ declare const PointsAdjusted: LoyaltyEventDefinition<z.ZodObject<{
79
88
  memberId: z.ZodString;
80
89
  externalId: z.ZodString;
81
90
  points: z.ZodNumber;
91
+ pointValueMinor: z.ZodNumber;
82
92
  balanceAfter: z.ZodNumber;
83
93
  transactionId: z.ZodString;
84
94
  description: z.ZodString;
85
95
  }, z.core.$strip>>;
96
+ declare const PointsReversed: LoyaltyEventDefinition<z.ZodObject<{
97
+ memberId: z.ZodString;
98
+ externalId: z.ZodString;
99
+ referenceType: z.ZodString;
100
+ referenceId: z.ZodString;
101
+ claimed: z.ZodNumber;
102
+ collected: z.ZodNumber;
103
+ shortfall: z.ZodNumber;
104
+ pointValueMinor: z.ZodNumber;
105
+ balanceAfter: z.ZodNumber;
106
+ transactionId: z.ZodString;
107
+ reason: z.ZodString;
108
+ }, z.core.$strip>>;
86
109
  declare const PointsExpired: LoyaltyEventDefinition<z.ZodObject<{
87
110
  membersAffected: z.ZodNumber;
88
111
  pointsExpired: z.ZodNumber;
89
112
  transactionCount: z.ZodNumber;
90
113
  }, z.core.$strip>>;
114
+ declare const PointsLotExpired: LoyaltyEventDefinition<z.ZodObject<{
115
+ memberId: z.ZodString;
116
+ externalId: z.ZodString;
117
+ transactionId: z.ZodString;
118
+ lotTransactionId: z.ZodString;
119
+ points: z.ZodNumber;
120
+ pointValueMinor: z.ZodNumber;
121
+ balanceAfter: z.ZodNumber;
122
+ }, z.core.$strip>>;
91
123
  declare const PointsExpiringSoon: LoyaltyEventDefinition<z.ZodObject<{
92
124
  membersAffected: z.ZodNumber;
93
125
  pointsExpired: z.ZodNumber;
@@ -163,7 +195,8 @@ declare const RedemptionReversed: LoyaltyEventDefinition<z.ZodObject<{
163
195
  originalPoints: z.ZodNumber;
164
196
  proportional: z.ZodBoolean;
165
197
  reason: z.ZodOptional<z.ZodString>;
166
- transactionId: z.ZodString;
198
+ pointValueMinor: z.ZodNumber;
199
+ transactionId: z.ZodOptional<z.ZodString>;
167
200
  }, z.core.$strip>>;
168
201
  declare const CampaignAwarded: LoyaltyEventDefinition<z.ZodObject<{
169
202
  campaignId: z.ZodString;
@@ -218,6 +251,42 @@ declare const MultiTierReferralAwarded: LoyaltyEventDefinition<z.ZodObject<{
218
251
  transactionId: z.ZodString;
219
252
  }, z.core.$strip>>;
220
253
  }, z.core.$strip>>;
254
+ declare const StampEarned: LoyaltyEventDefinition<z.ZodObject<{
255
+ stampProgramId: z.ZodString;
256
+ memberId: z.ZodString;
257
+ externalId: z.ZodString;
258
+ entryId: z.ZodString;
259
+ orderRef: z.ZodString;
260
+ stamps: z.ZodNumber;
261
+ businessDay: z.ZodString;
262
+ expiresAt: z.ZodOptional<z.ZodString>;
263
+ }, z.core.$strip>>;
264
+ declare const StampReversed: LoyaltyEventDefinition<z.ZodObject<{
265
+ stampProgramId: z.ZodString;
266
+ memberId: z.ZodString;
267
+ entryId: z.ZodString;
268
+ orderRef: z.ZodString;
269
+ reversed: z.ZodNumber;
270
+ retainedInAwards: z.ZodNumber;
271
+ }, z.core.$strip>>;
272
+ declare const StampAwardIssued: LoyaltyEventDefinition<z.ZodObject<{
273
+ stampProgramId: z.ZodString;
274
+ memberId: z.ZodString;
275
+ externalId: z.ZodString;
276
+ awardId: z.ZodString;
277
+ sequence: z.ZodNumber;
278
+ stampsConsumed: z.ZodNumber;
279
+ reward: z.ZodDiscriminatedUnion<[z.ZodObject<{
280
+ kind: z.ZodLiteral<"points">;
281
+ points: z.ZodNumber;
282
+ pointTransactionId: z.ZodString;
283
+ }, z.core.$strip>, z.ZodObject<{
284
+ kind: z.ZodLiteral<"voucher">;
285
+ voucherProgramId: z.ZodString;
286
+ voucherId: z.ZodString;
287
+ code: z.ZodString;
288
+ }, z.core.$strip>], "kind">;
289
+ }, z.core.$strip>>;
221
290
  /**
222
291
  * Every loyalty event defined in the package — pass to Arc's
223
292
  * `EventRegistry`. Hosts wire ONE array; the whole `loyalty.*` namespace
@@ -227,42 +296,37 @@ declare const MultiTierReferralAwarded: LoyaltyEventDefinition<z.ZodObject<{
227
296
  declare const loyaltyEventDefinitions: ReadonlyArray<LoyaltyEventDefinition>;
228
297
  //#endregion
229
298
  //#region src/events/loyalty-events.d.ts
230
- /**
231
- * Loyalty event name + payload map.
232
- *
233
- * Minimal surface. Loyalty emits events for its own lifecycle transitions
234
- * only — member, points ledger, tier, redemption, and referral.
235
- *
236
- * For registration with an arc-compatible event registry, see
237
- * `loyalty-event-catalog.ts` in this directory — it exposes each event as
238
- * a `LoyaltyEventDefinition` with a Zod payload schema + JSON Schema
239
- * derived via `z.toJSONSchema()` (PACKAGE_RULES §18.5).
240
- */
241
299
  declare const LoyaltyEvents: {
242
- readonly MEMBER_ENROLLED: "loyalty.member.enrolled";
243
- readonly MEMBER_DEACTIVATED: "loyalty.member.deactivated";
244
- readonly MEMBER_REACTIVATED: "loyalty.member.reactivated";
245
- readonly MEMBER_SUSPENDED: "loyalty.member.suspended";
246
- readonly POINTS_EARNED: "loyalty.points.earned";
247
- readonly POINTS_REDEEMED: "loyalty.points.redeemed";
248
- readonly POINTS_ADJUSTED: "loyalty.points.adjusted";
249
- readonly POINTS_EXPIRED: "loyalty.points.expired";
250
- readonly POINTS_EXPIRING_SOON: "loyalty.points.expiring_soon";
251
- readonly TIER_UPGRADED: "loyalty.tier.upgraded";
252
- readonly TIER_DOWNGRADED: "loyalty.tier.downgraded";
253
- readonly TIER_GRACE_STARTED: "loyalty.tier.grace_started";
254
- readonly TIER_OVERRIDE_CLEARED: "loyalty.tier.override_cleared";
255
- readonly TIER_OVERRIDE_EXPIRED: "loyalty.tier.override_expired";
256
- readonly REDEMPTION_RESERVED: "loyalty.redemption.reserved";
257
- readonly REDEMPTION_CONFIRMED: "loyalty.redemption.confirmed";
258
- readonly REDEMPTION_RELEASED: "loyalty.redemption.released";
259
- readonly REDEMPTION_REVERSED: "loyalty.redemption.reversed";
260
- readonly CAMPAIGN_AWARDED: "loyalty.campaign.awarded";
261
- readonly REFERRAL_RECORDED: "loyalty.referral.recorded";
262
- readonly REFERRAL_APPROVED: "loyalty.referral.approved";
263
- readonly REFERRAL_REJECTED: "loyalty.referral.rejected";
264
- readonly REFERRAL_REWARDED: "loyalty.referral.rewarded";
265
- readonly MULTI_TIER_REFERRAL_AWARDED: "loyalty.referral.multi_tier_awarded";
300
+ readonly MEMBER_ENROLLED: 'loyalty.member.enrolled';
301
+ readonly MEMBER_DEACTIVATED: 'loyalty.member.deactivated';
302
+ readonly MEMBER_REACTIVATED: 'loyalty.member.reactivated';
303
+ readonly MEMBER_SUSPENDED: 'loyalty.member.suspended';
304
+ readonly POINTS_EARNED: 'loyalty.points.earned';
305
+ readonly POINTS_REDEEMED: 'loyalty.points.redeemed';
306
+ readonly POINTS_ADJUSTED: 'loyalty.points.adjusted';
307
+ readonly POINTS_REVERSED: 'loyalty.points.reversed';
308
+ readonly POINTS_EXPIRED: 'loyalty.points.expired';
309
+ /** One expired lot, dispatched atomically with its expiry — the per-fact companion of POINTS_EXPIRED. */
310
+ readonly POINTS_LOT_EXPIRED: 'loyalty.points.lot_expired';
311
+ readonly POINTS_EXPIRING_SOON: 'loyalty.points.expiring_soon';
312
+ readonly TIER_UPGRADED: 'loyalty.tier.upgraded';
313
+ readonly TIER_DOWNGRADED: 'loyalty.tier.downgraded';
314
+ readonly TIER_GRACE_STARTED: 'loyalty.tier.grace_started';
315
+ readonly TIER_OVERRIDE_CLEARED: 'loyalty.tier.override_cleared';
316
+ readonly TIER_OVERRIDE_EXPIRED: 'loyalty.tier.override_expired';
317
+ readonly REDEMPTION_RESERVED: 'loyalty.redemption.reserved';
318
+ readonly REDEMPTION_CONFIRMED: 'loyalty.redemption.confirmed';
319
+ readonly REDEMPTION_RELEASED: 'loyalty.redemption.released';
320
+ readonly REDEMPTION_REVERSED: 'loyalty.redemption.reversed';
321
+ readonly CAMPAIGN_AWARDED: 'loyalty.campaign.awarded';
322
+ readonly REFERRAL_RECORDED: 'loyalty.referral.recorded';
323
+ readonly REFERRAL_APPROVED: 'loyalty.referral.approved';
324
+ readonly REFERRAL_REJECTED: 'loyalty.referral.rejected';
325
+ readonly REFERRAL_REWARDED: 'loyalty.referral.rewarded';
326
+ readonly MULTI_TIER_REFERRAL_AWARDED: 'loyalty.referral.multi_tier_awarded';
327
+ readonly STAMP_EARNED: 'loyalty.stamp.earned';
328
+ readonly STAMP_REVERSED: 'loyalty.stamp.reversed';
329
+ readonly STAMP_AWARD_ISSUED: 'loyalty.stamp.award_issued';
266
330
  };
267
331
  type LoyaltyEventName = (typeof LoyaltyEvents)[keyof typeof LoyaltyEvents];
268
332
  interface MemberLifecyclePayload {
@@ -276,6 +340,10 @@ interface PointsEarnedPayload {
276
340
  externalId: string;
277
341
  externalType: string;
278
342
  points: number;
343
+ /** Why the points were granted — `order` is the only source with a sale behind it. */
344
+ source: EarnSource;
345
+ /** Minor units one point was worth at this earn. */
346
+ pointValueMinor: number;
279
347
  balanceAfter: number;
280
348
  transactionId: string;
281
349
  earningRuleName?: string;
@@ -286,15 +354,47 @@ interface PointsAdjustedPayload {
286
354
  memberId: string;
287
355
  externalId: string;
288
356
  points: number;
357
+ /** Minor units one point was worth at this adjustment. */
358
+ pointValueMinor: number;
289
359
  balanceAfter: number;
290
360
  transactionId: string;
291
361
  description: string;
292
362
  }
363
+ interface PointsReversedPayload {
364
+ memberId: string;
365
+ externalId: string;
366
+ referenceType: string;
367
+ referenceId: string;
368
+ /** Points this reversal claimed back (the earned share now owed). */
369
+ claimed: number;
370
+ /** Points actually debited — `claimed` capped at the balance the member still held. */
371
+ collected: number;
372
+ /** `claimed - collected`: points already spent that could not be taken back. */
373
+ shortfall: number;
374
+ /** Minor units one point was worth at this reversal. */
375
+ pointValueMinor: number;
376
+ balanceAfter: number;
377
+ transactionId: string;
378
+ reason: string;
379
+ }
293
380
  interface PointsExpiredPayload {
294
381
  membersAffected: number;
295
382
  pointsExpired: number;
296
383
  transactionCount: number;
297
384
  }
385
+ interface PointsLotExpiredPayload {
386
+ memberId: string;
387
+ externalId: string;
388
+ /** The `expire` row this lot produced. */
389
+ transactionId: string;
390
+ /** The earn row whose lot expired. */
391
+ lotTransactionId: string;
392
+ /** Points removed from the balance (the lot, clamped to what the member still held). */
393
+ points: number;
394
+ /** Minor units one point was worth at expiry. */
395
+ pointValueMinor: number;
396
+ balanceAfter: number;
397
+ }
298
398
  interface TierChangedPayload {
299
399
  memberId: string;
300
400
  externalId: string;
@@ -339,7 +439,10 @@ interface RedemptionReversedPayload {
339
439
  originalPoints: number;
340
440
  proportional: boolean;
341
441
  reason?: string;
342
- transactionId: string;
442
+ /** Minor units per point the redemption was priced at — the rate the credited points carry back. */
443
+ pointValueMinor: number;
444
+ /** The credit row; absent when nothing was credited. */
445
+ transactionId?: string;
343
446
  }
344
447
  interface CampaignAwardedPayload {
345
448
  campaignId: string;
@@ -359,6 +462,46 @@ interface MultiTierReferralAwardedPayload {
359
462
  transactionId: string;
360
463
  }>;
361
464
  }
465
+ interface StampEarnedPayload {
466
+ stampProgramId: string;
467
+ memberId: string;
468
+ externalId: string;
469
+ entryId: string;
470
+ orderRef: string;
471
+ stamps: number;
472
+ /** `YYYY-MM-DD` in the engine's timezone. */
473
+ businessDay: string;
474
+ /** ISO string; absent when the program's stamps never expire. */
475
+ expiresAt?: string;
476
+ }
477
+ interface StampReversedPayload {
478
+ stampProgramId: string;
479
+ memberId: string;
480
+ entryId: string;
481
+ orderRef: string;
482
+ /** Unconsumed stamps removed. */
483
+ reversed: number;
484
+ /** Stamps already spent on an award — kept, not clawed back. */
485
+ retainedInAwards: number;
486
+ }
487
+ interface StampAwardIssuedPayload {
488
+ stampProgramId: string;
489
+ memberId: string;
490
+ externalId: string;
491
+ awardId: string;
492
+ sequence: number;
493
+ stampsConsumed: number;
494
+ reward: {
495
+ kind: 'points';
496
+ points: number;
497
+ pointTransactionId: string;
498
+ } | {
499
+ kind: 'voucher';
500
+ voucherProgramId: string;
501
+ voucherId: string;
502
+ code: string;
503
+ };
504
+ }
362
505
  interface LoyaltyEventMap {
363
506
  [LoyaltyEvents.MEMBER_ENROLLED]: MemberLifecyclePayload;
364
507
  [LoyaltyEvents.MEMBER_DEACTIVATED]: MemberLifecyclePayload;
@@ -367,7 +510,9 @@ interface LoyaltyEventMap {
367
510
  [LoyaltyEvents.POINTS_EARNED]: PointsEarnedPayload;
368
511
  [LoyaltyEvents.POINTS_REDEEMED]: PointsAdjustedPayload;
369
512
  [LoyaltyEvents.POINTS_ADJUSTED]: PointsAdjustedPayload;
513
+ [LoyaltyEvents.POINTS_REVERSED]: PointsReversedPayload;
370
514
  [LoyaltyEvents.POINTS_EXPIRED]: PointsExpiredPayload;
515
+ [LoyaltyEvents.POINTS_LOT_EXPIRED]: PointsLotExpiredPayload;
371
516
  [LoyaltyEvents.POINTS_EXPIRING_SOON]: PointsExpiredPayload;
372
517
  [LoyaltyEvents.TIER_UPGRADED]: TierChangedPayload;
373
518
  [LoyaltyEvents.TIER_DOWNGRADED]: TierChangedPayload;
@@ -384,7 +529,10 @@ interface LoyaltyEventMap {
384
529
  [LoyaltyEvents.REFERRAL_REJECTED]: ReferralPayload;
385
530
  [LoyaltyEvents.REFERRAL_REWARDED]: ReferralPayload;
386
531
  [LoyaltyEvents.MULTI_TIER_REFERRAL_AWARDED]: MultiTierReferralAwardedPayload;
532
+ [LoyaltyEvents.STAMP_EARNED]: StampEarnedPayload;
533
+ [LoyaltyEvents.STAMP_REVERSED]: StampReversedPayload;
534
+ [LoyaltyEvents.STAMP_AWARD_ISSUED]: StampAwardIssuedPayload;
387
535
  }
388
536
  type LoyaltyEventPayload<E extends LoyaltyEventName> = LoyaltyEventMap[E];
389
537
  //#endregion
390
- export { PointsExpired as A, ReferralRewarded as B, MemberDeactivated as C, MultiTierReferralAwarded as D, MemberSuspended as E, RedemptionReserved as F, TierUpgraded as G, TierGraceStarted as H, RedemptionReversed as I, InProcessLoyaltyBusOptions as J, loyaltyEventDefinitions as K, ReferralApproved as L, PointsRedeemed as M, RedemptionConfirmed as N, PointsAdjusted as O, RedemptionReleased as P, ReferralRecorded as R, LoyaltyEventSchema as S, MemberReactivated as T, TierOverrideCleared as U, TierDowngraded as V, TierOverrideExpired as W, createEvent$1 as Y, TierChangedPayload as _, LoyaltyEventMap as a, LoyaltyEventDefinition as b, LoyaltyEvents as c, PointsAdjustedPayload as d, PointsEarnedPayload as f, ReferralPayload as g, RedemptionReversedPayload as h, CampaignAwardedPayload as i, PointsExpiringSoon as j, PointsEarned as k, MemberLifecyclePayload as l, RedemptionPayload as m, EventHandler as n, LoyaltyEventName as o, PointsExpiredPayload as p, InProcessLoyaltyBus as q, EventTransport$1 as r, LoyaltyEventPayload as s, DomainEvent$1 as t, MultiTierReferralAwardedPayload as u, TierOverrideLifecyclePayload as v, MemberEnrolled as w, LoyaltyEventPayloadOf as x, CampaignAwarded as y, ReferralRejected as z };
538
+ export { TierOverrideCleared as $, MemberReactivated as A, RedemptionConfirmed as B, TierOverrideLifecyclePayload as C, LoyaltyEventSchema as D, LoyaltyEventPayloadOf as E, PointsExpired as F, ReferralRecorded as G, RedemptionReserved as H, PointsExpiringSoon as I, StampAwardIssued as J, ReferralRejected as K, PointsLotExpired as L, MultiTierReferralAwarded as M, PointsAdjusted as N, MemberDeactivated as O, PointsEarned as P, TierGraceStarted as Q, PointsRedeemed as R, TierChangedPayload as S, LoyaltyEventDefinition as T, RedemptionReversed as U, RedemptionReleased as V, ReferralApproved as W, StampReversed as X, StampEarned as Y, TierDowngraded as Z, RedemptionReversedPayload as _, LoyaltyEventMap as a, createEvent$1 as at, StampEarnedPayload as b, LoyaltyEvents as c, PointsAdjustedPayload as d, TierOverrideExpired as et, PointsEarnedPayload as f, RedemptionPayload as g, PointsReversedPayload as h, CampaignAwardedPayload as i, InProcessLoyaltyBusOptions as it, MemberSuspended as j, MemberEnrolled as k, MemberLifecyclePayload as l, PointsLotExpiredPayload as m, EventHandler as n, loyaltyEventDefinitions as nt, LoyaltyEventName as o, PointsExpiredPayload as p, ReferralRewarded as q, EventTransport$1 as r, InProcessLoyaltyBus as rt, LoyaltyEventPayload as s, DomainEvent$1 as t, TierUpgraded as tt, MultiTierReferralAwardedPayload as u, ReferralPayload as v, CampaignAwarded as w, StampReversedPayload as x, StampAwardIssuedPayload as y, PointsReversed as z };
@@ -0,0 +1,36 @@
1
+ //#region src/constants.d.ts
2
+ declare const TRANSACTION_TYPES: readonly ["earn", "redeem", "adjust", "expire", "transfer", "referral_bonus", "reverse"];
3
+ /**
4
+ * Why points were EARNED — a closed set, required on every earn. `order` is points
5
+ * granted with a sale (a consumer defers part of that sale's price); every other source
6
+ * is a grant with no sale behind it.
7
+ */
8
+ declare const EARN_SOURCES: readonly ["order", "action", "referral", "campaign"];
9
+ declare const MEMBER_STATUSES: readonly ["active", "inactive", "suspended"];
10
+ declare const RULE_TYPES: readonly ["order", "action", "category", "tier_bonus"];
11
+ declare const RULE_STATUSES: readonly ["active", "paused", "expired"];
12
+ declare const REFERRAL_STATUSES: readonly ["pending", "approved", "rejected", "expired"];
13
+ declare const REDEMPTION_STATUSES: readonly ["reserved", "confirmed", "released", "expired", "reversed"];
14
+ declare const EARNING_ACTIONS: readonly ["signup", "referral", "birthday", "review", "profile_complete"];
15
+ declare const STAMP_PROGRAM_STATUSES: readonly ["active", "paused", "ended"];
16
+ /** What one stamp counts: a qualifying order, a business day with one, an item, or `perMinor` of spend. */
17
+ declare const STAMP_EARN_UNITS: readonly ["order", "visit", "item", "spend"];
18
+ declare const STAMP_REWARD_KINDS: readonly ["points", "voucher"];
19
+ /** `pending` = claimed (stamps consumed) but the external reward not yet issued; settle resumes it. */
20
+ declare const STAMP_AWARD_STATUSES: readonly ["pending", "issued"];
21
+ //#endregion
22
+ //#region src/domain/enums/index.d.ts
23
+ type StampProgramStatus = (typeof STAMP_PROGRAM_STATUSES)[number];
24
+ type StampEarnUnit = (typeof STAMP_EARN_UNITS)[number];
25
+ type StampRewardKind = (typeof STAMP_REWARD_KINDS)[number];
26
+ type StampAwardStatus = (typeof STAMP_AWARD_STATUSES)[number];
27
+ type TransactionType = (typeof TRANSACTION_TYPES)[number];
28
+ type EarnSource = (typeof EARN_SOURCES)[number];
29
+ type MemberStatus = (typeof MEMBER_STATUSES)[number];
30
+ type RuleType = (typeof RULE_TYPES)[number];
31
+ type RuleStatus = (typeof RULE_STATUSES)[number];
32
+ type ReferralStatus = (typeof REFERRAL_STATUSES)[number];
33
+ type RedemptionStatus = (typeof REDEMPTION_STATUSES)[number];
34
+ type EarningAction = (typeof EARNING_ACTIONS)[number];
35
+ //#endregion
36
+ export { STAMP_REWARD_KINDS as C, STAMP_PROGRAM_STATUSES as S, REFERRAL_STATUSES as _, ReferralStatus as a, STAMP_AWARD_STATUSES as b, StampAwardStatus as c, StampRewardKind as d, TransactionType as f, REDEMPTION_STATUSES as g, MEMBER_STATUSES as h, RedemptionStatus as i, StampEarnUnit as l, EARN_SOURCES as m, EarningAction as n, RuleStatus as o, EARNING_ACTIONS as p, MemberStatus as r, RuleType as s, EarnSource as t, StampProgramStatus as u, RULE_STATUSES as v, TRANSACTION_TYPES as w, STAMP_EARN_UNITS as x, RULE_TYPES as y };
package/dist/index.d.mts CHANGED
@@ -1,11 +1,13 @@
1
- import { S as EarningRule, a as EnrollInput, b as MemberBalance, c as UpdateTierInput, d as EarningResult, g as TierEvaluation, h as RedemptionValidation, i as EarnPointsInput, l as BalanceSummary, n as CreateEarningRuleInput, o as LoyaltyContext, r as CreateTierInput, s as UpdateEarningRuleInput, t as AdjustPointsInput, v as PointTransaction, x as TierDefinition, y as Member } from "./index-Cp_sXNpG.mjs";
1
+ import { EarnBase, EarnBaseInput, EarnBaseItem, EarnBaseLine, earnBase } from "./domain/earn-base.mjs";
2
+ import { ScheduledRuleLike, isRuleInSchedule } from "./domain/rule-schedule.mjs";
3
+ import { D as LoyaltyShape, E as LoyaltyRuntime, F as StampVoucherRequest, I as TierDefinition, L as EarningRule, M as ResolvedTenant, P as StampRewardIssuer, S as MemberBalance, T as LoyaltyModelName, _ as RedemptionValidation, a as EnrollInput, b as PointTransaction, c as UpdateTierInput, f as EarningResult, h as LoyaltyLiabilitySnapshot, i as EarnPointsInput, j as ResolvedConfig, l as BalanceSummary, n as CreateEarningRuleInput, o as LoyaltyContext, r as CreateTierInput, s as UpdateEarningRuleInput, t as AdjustPointsInput, u as EarnReversalResult, v as TierEvaluation, w as LiveProgramSettings, x as Member } from "./index-DRrEhE0r.mjs";
2
4
  import { t as NotificationAdapter } from "./notification.port-wY4IKimz.mjs";
3
- import { c as ResolvedConfig, i as LoyaltyShape, l as ResolvedTenant, n as LoyaltyModelName, r as LoyaltyRuntime } from "./config-CtkGj3xZ.mjs";
4
- import { A as PointsExpired, B as ReferralRewarded, C as MemberDeactivated, E as MemberSuspended, F as RedemptionReserved, G as TierUpgraded, H as TierGraceStarted, J as InProcessLoyaltyBusOptions, K as loyaltyEventDefinitions, L as ReferralApproved, M as PointsRedeemed, N as RedemptionConfirmed, O as PointsAdjusted, P as RedemptionReleased, R as ReferralRecorded, S as LoyaltyEventSchema, T as MemberReactivated, V as TierDowngraded, Y as createEvent, _ as TierChangedPayload, a as LoyaltyEventMap, b as LoyaltyEventDefinition, c as LoyaltyEvents, d as PointsAdjustedPayload, f as PointsEarnedPayload, g as ReferralPayload, j as PointsExpiringSoon, k as PointsEarned, l as MemberLifecyclePayload, m as RedemptionPayload, o as LoyaltyEventName, p as PointsExpiredPayload, q as InProcessLoyaltyBus, s as LoyaltyEventPayload, w as MemberEnrolled, x as LoyaltyEventPayloadOf, z as ReferralRejected } from "./index-YUFamhDk.mjs";
5
- import { n as LoyaltyModels, r as defineLoyaltyModels, t as DefineLoyaltyModelsConfig } from "./index-D6GvuvmF.mjs";
6
- import { a as ReferralRepository, c as Redemption, d as MemberRepository, f as UnitOfWork, i as TierDefinitionRepository, l as EarningRuleRepository, n as LoyaltyRepositories, o as Referral, s as RedemptionRepository, u as PointTransactionRepository } from "./index-CR2k7jQ8.mjs";
5
+ import { A as MemberReactivated, B as RedemptionConfirmed, D as LoyaltyEventSchema, E as LoyaltyEventPayloadOf, F as PointsExpired, G as ReferralRecorded, H as RedemptionReserved, I as PointsExpiringSoon, J as StampAwardIssued, K as ReferralRejected, N as PointsAdjusted, O as MemberDeactivated, P as PointsEarned, Q as TierGraceStarted, R as PointsRedeemed, S as TierChangedPayload, T as LoyaltyEventDefinition, V as RedemptionReleased, W as ReferralApproved, X as StampReversed, Y as StampEarned, Z as TierDowngraded, a as LoyaltyEventMap, at as createEvent, b as StampEarnedPayload, c as LoyaltyEvents, d as PointsAdjustedPayload, f as PointsEarnedPayload, g as RedemptionPayload, h as PointsReversedPayload, it as InProcessLoyaltyBusOptions, j as MemberSuspended, k as MemberEnrolled, l as MemberLifecyclePayload, nt as loyaltyEventDefinitions, o as LoyaltyEventName, p as PointsExpiredPayload, q as ReferralRewarded, rt as InProcessLoyaltyBus, s as LoyaltyEventPayload, tt as TierUpgraded, v as ReferralPayload, x as StampReversedPayload, y as StampAwardIssuedPayload, z as PointsReversed } from "./index-Db5Gb7x_.mjs";
6
+ import { a as StampAwardReward, c as StampOrderInput, d as StampProgress, f as StampRecordResult, i as StampAward, l as StampOrderLine, m as StampReward, n as LoyaltyModels, o as StampEarn, p as StampReversal, r as defineLoyaltyModels, s as StampEntry, t as DefineLoyaltyModelsConfig, u as StampProgram } from "./index-CorB0JL6.mjs";
7
+ import { _ as PointTransactionRepository, a as StampProgramRepository, b as UnitOfWork, c as Referral, d as LoyaltyRedemptionPort, f as LoyaltyReserveInput, g as EarningRuleRepository, h as Redemption, i as StampRepository, l as RedemptionRepository, m as RedemptionOwnerRebind, n as LoyaltyRepositories, o as StampAwardRepository, p as RedemptionOwner, s as ReferralRepository, u as LoyaltyRedemption, v as MemberRepository, y as TierDefinitionRepository } from "./index-BvyzKU7R.mjs";
7
8
  import { Connection } from "mongoose";
8
9
  import { DomainEvent, DomainEvent as DomainEvent$1, EventHandler, EventTransport, EventTransport as EventTransport$1 } from "@classytic/primitives/events";
10
+ import { z } from "zod";
9
11
  import { OutboxStore } from "@classytic/primitives/outbox";
10
12
  import { HttpError } from "@classytic/repo-core/errors";
11
13
  //#region src/domain/errors/base.d.ts
@@ -32,76 +34,76 @@ declare abstract class LoyaltyError extends Error implements HttpError {
32
34
  }
33
35
  //#endregion
34
36
  //#region src/domain/errors/domain-errors.d.ts
35
- declare class InsufficientPointsError extends LoyaltyError {
37
+ export declare class InsufficientPointsError extends LoyaltyError {
36
38
  readonly code = "loyalty.points.insufficient";
37
39
  readonly status = 400;
38
40
  constructor(available: number, requested: number);
39
41
  }
40
- declare class MemberNotFoundError extends LoyaltyError {
42
+ export declare class MemberNotFoundError extends LoyaltyError {
41
43
  readonly code = "loyalty.member.not_found";
42
44
  readonly status = 404;
43
45
  constructor(id: string);
44
46
  }
45
- declare class MemberAlreadyEnrolledError extends LoyaltyError {
47
+ export declare class MemberAlreadyEnrolledError extends LoyaltyError {
46
48
  readonly code = "loyalty.member.already_enrolled";
47
49
  readonly status = 409;
48
50
  constructor(externalId: string);
49
51
  }
50
- declare class MemberInactiveError extends LoyaltyError {
52
+ export declare class MemberInactiveError extends LoyaltyError {
51
53
  readonly code = "loyalty.member.inactive";
52
54
  readonly status = 422;
53
55
  constructor(id: string);
54
56
  }
55
- declare class RuleNotFoundError extends LoyaltyError {
57
+ export declare class RuleNotFoundError extends LoyaltyError {
56
58
  readonly code = "loyalty.earning_rule.not_found";
57
59
  readonly status = 404;
58
60
  constructor(id: string);
59
61
  }
60
- declare class TierNotFoundError extends LoyaltyError {
62
+ export declare class TierNotFoundError extends LoyaltyError {
61
63
  readonly code = "loyalty.tier.not_found";
62
64
  readonly status = 404;
63
65
  constructor(id: string);
64
66
  }
65
- declare class RedemptionNotFoundError extends LoyaltyError {
67
+ export declare class RedemptionNotFoundError extends LoyaltyError {
66
68
  readonly code = "loyalty.redemption.not_found";
67
69
  readonly status = 404;
68
70
  constructor(id: string);
69
71
  }
70
- declare class RedemptionExpiredError extends LoyaltyError {
72
+ export declare class RedemptionExpiredError extends LoyaltyError {
71
73
  readonly code = "loyalty.redemption.expired";
72
74
  readonly status = 410;
73
75
  constructor(id: string);
74
76
  }
75
- declare class ReferralNotFoundError extends LoyaltyError {
77
+ export declare class ReferralNotFoundError extends LoyaltyError {
76
78
  readonly code = "loyalty.referral.not_found";
77
79
  readonly status = 404;
78
80
  constructor(id: string);
79
81
  }
80
- declare class DuplicateReferralError extends LoyaltyError {
82
+ export declare class DuplicateReferralError extends LoyaltyError {
81
83
  readonly code = "loyalty.referral.duplicate";
82
84
  readonly status = 409;
83
85
  constructor(refereeId: string);
84
86
  }
85
- declare class ReferralLimitExceededError extends LoyaltyError {
87
+ export declare class ReferralLimitExceededError extends LoyaltyError {
86
88
  readonly code = "loyalty.referral.limit_exceeded";
87
89
  readonly status = 429;
88
90
  constructor(limit: number, periodDays: number);
89
91
  }
90
- declare class SelfReferralError extends LoyaltyError {
92
+ export declare class SelfReferralError extends LoyaltyError {
91
93
  readonly code = "loyalty.referral.self";
92
94
  readonly status = 422;
93
95
  constructor();
94
96
  }
95
- declare class CircularReferralError extends LoyaltyError {
97
+ export declare class CircularReferralError extends LoyaltyError {
96
98
  readonly code = "loyalty.referral.circular";
97
99
  readonly status = 422;
98
100
  constructor();
99
101
  }
100
- declare class ValidationError extends LoyaltyError {
102
+ export declare class ValidationError extends LoyaltyError {
101
103
  readonly code = "loyalty.validation.invalid";
102
104
  readonly status = 400;
103
105
  }
104
- declare class TenantIsolationError extends LoyaltyError {
106
+ export declare class TenantIsolationError extends LoyaltyError {
105
107
  readonly code = "loyalty.tenant.isolation";
106
108
  readonly status = 403;
107
109
  constructor();
@@ -117,7 +119,7 @@ declare class TenantIsolationError extends LoyaltyError {
117
119
  * `{ ...ctx, [PENDING_EVENTS]: queue }` and call `flushPendingLoyaltyEvents`
118
120
  * after your transaction commits. Both are exported from the package root.
119
121
  */
120
- declare class UnmanagedSessionError extends LoyaltyError {
122
+ export declare class UnmanagedSessionError extends LoyaltyError {
121
123
  readonly code = "loyalty.transaction.unmanaged_session";
122
124
  readonly status = 400;
123
125
  constructor();
@@ -136,7 +138,7 @@ declare class UnmanagedSessionError extends LoyaltyError {
136
138
  * drift from what MongoDB actually thinks. `@classytic/access` refuses
137
139
  * exactly this at `entitlement.repository.ts` — same rule, same reason.
138
140
  */
139
- declare class SessionNotInTransactionError extends LoyaltyError {
141
+ export declare class SessionNotInTransactionError extends LoyaltyError {
140
142
  readonly code = "loyalty.transaction.session_not_in_transaction";
141
143
  readonly status = 409;
142
144
  constructor();
@@ -148,7 +150,7 @@ declare class SessionNotInTransactionError extends LoyaltyError {
148
150
  * or sharded cluster. Thrown at engine creation — fail loud at boot, not with
149
151
  * a cryptic driver error on the first transactional call.
150
152
  */
151
- declare class LoyaltyCapabilityError extends LoyaltyError {
153
+ export declare class LoyaltyCapabilityError extends LoyaltyError {
152
154
  readonly code = "loyalty.engine.missing_capabilities";
153
155
  readonly status = 500;
154
156
  /**
@@ -163,6 +165,95 @@ declare class LoyaltyCapabilityError extends LoyaltyError {
163
165
  });
164
166
  }
165
167
  //#endregion
168
+ //#region src/domain/stamp-program.d.ts
169
+ /** The create body — strict: an unknown key is a 400, never silently dropped. Dates are ISO strings. */
170
+ export declare const stampProgramInputSchema: z.ZodObject<{
171
+ name: z.ZodString;
172
+ description: z.ZodOptional<z.ZodString>;
173
+ status: z.ZodOptional<z.ZodEnum<{
174
+ active: "active";
175
+ ended: "ended";
176
+ paused: "paused";
177
+ }>>;
178
+ earn: z.ZodObject<{
179
+ unit: z.ZodEnum<{
180
+ item: "item";
181
+ order: "order";
182
+ spend: "spend";
183
+ visit: "visit";
184
+ }>;
185
+ categoryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
186
+ productIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
187
+ perMinor: z.ZodOptional<z.ZodNumber>;
188
+ minOrderMinor: z.ZodOptional<z.ZodNumber>;
189
+ }, z.core.$strict>;
190
+ stampsRequired: z.ZodNumber;
191
+ stampValidityDays: z.ZodOptional<z.ZodNumber>;
192
+ startsAt: z.ZodOptional<z.ZodISODateTime>;
193
+ endsAt: z.ZodOptional<z.ZodISODateTime>;
194
+ reward: z.ZodDiscriminatedUnion<[z.ZodObject<{
195
+ kind: z.ZodLiteral<"points">;
196
+ points: z.ZodNumber;
197
+ }, z.core.$strict>, z.ZodObject<{
198
+ kind: z.ZodLiteral<"voucher">;
199
+ voucherProgramId: z.ZodString;
200
+ }, z.core.$strict>], "kind">;
201
+ maxRewardsPerMember: z.ZodOptional<z.ZodNumber>;
202
+ branchIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
203
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
204
+ }, z.core.$strict>;
205
+ /** The patch body — strict, every field optional; nested `earn` / `reward` are replaced whole. */
206
+ export declare const stampProgramPatchSchema: z.ZodObject<{
207
+ name: z.ZodOptional<z.ZodString>;
208
+ description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
209
+ status: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
210
+ active: "active";
211
+ ended: "ended";
212
+ paused: "paused";
213
+ }>>>;
214
+ earn: z.ZodOptional<z.ZodObject<{
215
+ unit: z.ZodEnum<{
216
+ item: "item";
217
+ order: "order";
218
+ spend: "spend";
219
+ visit: "visit";
220
+ }>;
221
+ categoryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
222
+ productIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
223
+ perMinor: z.ZodOptional<z.ZodNumber>;
224
+ minOrderMinor: z.ZodOptional<z.ZodNumber>;
225
+ }, z.core.$strict>>;
226
+ stampsRequired: z.ZodOptional<z.ZodNumber>;
227
+ stampValidityDays: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
228
+ startsAt: z.ZodOptional<z.ZodOptional<z.ZodISODateTime>>;
229
+ endsAt: z.ZodOptional<z.ZodOptional<z.ZodISODateTime>>;
230
+ reward: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
231
+ kind: z.ZodLiteral<"points">;
232
+ points: z.ZodNumber;
233
+ }, z.core.$strict>, z.ZodObject<{
234
+ kind: z.ZodLiteral<"voucher">;
235
+ voucherProgramId: z.ZodString;
236
+ }, z.core.$strict>], "kind">>;
237
+ maxRewardsPerMember: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
238
+ branchIds: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
239
+ metadata: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
240
+ }, z.core.$strict>;
241
+ type StampProgramInput = z.input<typeof stampProgramInputSchema>;
242
+ /**
243
+ * Refuse a program that could never award correctly. Runs on the WHOLE document (a patch merged
244
+ * over what is stored), so a partial update cannot produce an invalid program.
245
+ */
246
+ export declare function assertStampProgram(doc: Record<string, unknown>, opts: {
247
+ rewardIssuerBound: boolean;
248
+ }): void;
249
+ /**
250
+ * Stamps one order earns on a program: `order` / `visit` → 1 when a line qualifies, `item` → the
251
+ * qualifying units (a line sold by measure counts once, see {@link itemStampsOf}), `spend` →
252
+ * floor(qualifying spend / perMinor). With no product/category filter every line qualifies and
253
+ * `spend` counts the order total.
254
+ */
255
+ export declare function stampsForOrder(program: StampProgram, order: StampOrderInput): number;
256
+ //#endregion
166
257
  //#region src/events/dispatch.d.ts
167
258
  /**
168
259
  * Internal key under which the post-commit event-publish queue is threaded
@@ -171,20 +262,20 @@ declare class LoyaltyCapabilityError extends LoyaltyError {
171
262
  * flushes it after commit. A `Symbol.for` so it never collides with
172
263
  * host-supplied context fields and never appears in the public type.
173
264
  */
174
- declare const PENDING_EVENTS: unique symbol;
265
+ export declare const PENDING_EVENTS: unique symbol;
175
266
  /**
176
267
  * Drains a queue of deferred events (the one attached under `[PENDING_EVENTS]`)
177
268
  * through the transport, swallowing per-event errors. Called by transactional
178
269
  * verbs AFTER `withTransaction` commits, and exported so hosts that own the
179
270
  * outer transaction can flush after their own commit.
180
271
  */
181
- declare function flushPendingLoyaltyEvents(events: EventTransport$1 | undefined, queue: DomainEvent$1[], logger?: {
272
+ export declare function flushPendingLoyaltyEvents(events: EventTransport$1 | undefined, queue: DomainEvent$1[], logger?: {
182
273
  error(message: string, ...args: unknown[]): void;
183
274
  } | undefined): Promise<void>;
184
275
  //#endregion
185
276
  //#region src/index.d.ts
186
- declare function resolveConfig(config: LoyaltyShape): ResolvedConfig;
187
- interface LoyaltyEngine {
277
+ export declare function resolveConfig(config: LoyaltyShape): ResolvedConfig;
278
+ export interface LoyaltyEngine {
188
279
  models: LoyaltyModels;
189
280
  repositories: LoyaltyRepositories;
190
281
  events: EventTransport$1;
@@ -197,7 +288,7 @@ interface LoyaltyEngine {
197
288
  */
198
289
  close(): Promise<void>;
199
290
  }
200
- interface LoyaltyBlueprint {
291
+ export interface LoyaltyBlueprint {
201
292
  readonly id: 'loyalty';
202
293
  /** The model names this blueprint registers — known without a connection. */
203
294
  readonly modelNames: readonly string[];
@@ -211,6 +302,6 @@ interface LoyaltyBlueprint {
211
302
  * Describe the loyalty engine. Pure — registers no model, builds no schema,
212
303
  * performs no I/O. Config is resolved and validated here.
213
304
  */
214
- declare function defineLoyalty(shape?: LoyaltyShape): LoyaltyBlueprint;
305
+ export declare function defineLoyalty(shape?: LoyaltyShape): LoyaltyBlueprint;
215
306
  //#endregion
216
- export { type AdjustPointsInput, type BalanceSummary, CircularReferralError, type CreateEarningRuleInput, type CreateTierInput, type DefineLoyaltyModelsConfig, type DomainEvent, DuplicateReferralError, type EarnPointsInput, type EarningResult, type EarningRule, EarningRuleRepository, type EnrollInput, type EventHandler, type EventTransport, InProcessLoyaltyBus, type InProcessLoyaltyBusOptions, InsufficientPointsError, LoyaltyBlueprint, LoyaltyCapabilityError, type LoyaltyContext, LoyaltyEngine, type LoyaltyEventDefinition, type LoyaltyEventMap, type LoyaltyEventName, type LoyaltyEventPayload, type LoyaltyEventPayloadOf, type LoyaltyEventSchema, LoyaltyEvents, type LoyaltyModelName, type LoyaltyModels, type LoyaltyRepositories, type LoyaltyRuntime, type LoyaltyShape, type Member, MemberAlreadyEnrolledError, type MemberBalance, MemberDeactivated, MemberEnrolled, MemberInactiveError, type MemberLifecyclePayload, MemberNotFoundError, MemberReactivated, MemberRepository, MemberSuspended, type NotificationAdapter, PENDING_EVENTS, type PointTransaction, PointTransactionRepository, PointsAdjusted, type PointsAdjustedPayload, PointsEarned, type PointsEarnedPayload, PointsExpired, type PointsExpiredPayload, PointsExpiringSoon, PointsRedeemed, type Redemption, RedemptionConfirmed, RedemptionExpiredError, RedemptionNotFoundError, type RedemptionPayload, RedemptionReleased, RedemptionRepository, RedemptionReserved, type RedemptionValidation, type Referral, ReferralApproved, ReferralLimitExceededError, ReferralNotFoundError, type ReferralPayload, ReferralRecorded, ReferralRejected, ReferralRepository, ReferralRewarded, type ResolvedConfig, type ResolvedTenant, RuleNotFoundError, SelfReferralError, SessionNotInTransactionError, TenantIsolationError, type TierChangedPayload, type TierDefinition, TierDefinitionRepository, TierDowngraded, type TierEvaluation, TierGraceStarted, TierNotFoundError, TierUpgraded, type UnitOfWork, UnmanagedSessionError, type UpdateEarningRuleInput, type UpdateTierInput, ValidationError, createEvent, defineLoyalty, defineLoyaltyModels, flushPendingLoyaltyEvents, loyaltyEventDefinitions, resolveConfig };
307
+ export { type AdjustPointsInput, type BalanceSummary, type CreateEarningRuleInput, type CreateTierInput, type DefineLoyaltyModelsConfig, type DomainEvent, type EarnBase, type EarnBaseInput, type EarnBaseItem, type EarnBaseLine, type EarnPointsInput, type EarnReversalResult, type EarningResult, type EarningRule, EarningRuleRepository, type EnrollInput, type EventHandler, type EventTransport, InProcessLoyaltyBus, type InProcessLoyaltyBusOptions, type LiveProgramSettings, type LoyaltyContext, type LoyaltyEventDefinition, type LoyaltyEventMap, type LoyaltyEventName, type LoyaltyEventPayload, type LoyaltyEventPayloadOf, type LoyaltyEventSchema, LoyaltyEvents, type LoyaltyLiabilitySnapshot, type LoyaltyModelName, type LoyaltyModels, type LoyaltyRedemption, type LoyaltyRedemptionPort, type LoyaltyRepositories, type LoyaltyReserveInput, type LoyaltyRuntime, type LoyaltyShape, type Member, type MemberBalance, MemberDeactivated, MemberEnrolled, type MemberLifecyclePayload, MemberReactivated, MemberRepository, MemberSuspended, type NotificationAdapter, type PointTransaction, PointTransactionRepository, PointsAdjusted, type PointsAdjustedPayload, PointsEarned, type PointsEarnedPayload, PointsExpired, type PointsExpiredPayload, PointsExpiringSoon, PointsRedeemed, PointsReversed, type PointsReversedPayload, type Redemption, RedemptionConfirmed, type RedemptionOwner, type RedemptionOwnerRebind, type RedemptionPayload, RedemptionReleased, RedemptionRepository, RedemptionReserved, type RedemptionValidation, type Referral, ReferralApproved, type ReferralPayload, ReferralRecorded, ReferralRejected, ReferralRepository, ReferralRewarded, type ResolvedConfig, type ResolvedTenant, type ScheduledRuleLike, type StampAward, StampAwardIssued, type StampAwardIssuedPayload, StampAwardRepository, type StampAwardReward, type StampEarn, StampEarned, type StampEarnedPayload, type StampEntry, type StampOrderInput, type StampOrderLine, type StampProgram, type StampProgramInput, StampProgramRepository, type StampProgress, type StampRecordResult, StampRepository, type StampReversal, StampReversed, type StampReversedPayload, type StampReward, type StampRewardIssuer, type StampVoucherRequest, type TierChangedPayload, type TierDefinition, TierDefinitionRepository, TierDowngraded, type TierEvaluation, TierGraceStarted, TierUpgraded, type UnitOfWork, type UpdateEarningRuleInput, type UpdateTierInput, createEvent, defineLoyaltyModels, earnBase, isRuleInSchedule, loyaltyEventDefinitions };