@rebuy/rebuy 3.64.0 → 3.66.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.
package/dist/index.cjs CHANGED
@@ -238,9 +238,11 @@ __export(src_exports, {
238
238
  PostPurchaseReviewStyles: () => PostPurchaseReviewStyles,
239
239
  PostPurchaseSessionIdSchema: () => PostPurchaseSessionIdSchema,
240
240
  PostPurchaseSettings: () => PostPurchaseSettings,
241
+ PostPurchaseShadowFlowOutcomesSchema: () => PostPurchaseShadowFlowOutcomesSchema,
241
242
  PostPurchaseShadowReportFields: () => PostPurchaseShadowReportFields,
242
243
  PostPurchaseShadowReportSchema: () => PostPurchaseShadowReportSchema,
243
244
  PostPurchaseShadowSelectionSchema: () => PostPurchaseShadowSelectionSchema,
245
+ PostPurchaseShadowSkipReasonSchema: () => PostPurchaseShadowSkipReasonSchema,
244
246
  PostPurchaseSkipReasonSchema: () => PostPurchaseSkipReasonSchema,
245
247
  PostPurchaseSkipTraceSchema: () => PostPurchaseSkipTraceSchema,
246
248
  PostPurchaseStsContext: () => PostPurchaseStsContext,
@@ -3490,7 +3492,17 @@ var FinishedPurchaseSchema = import_zod47.z.union([
3490
3492
  ])
3491
3493
  })
3492
3494
  ]);
3493
- var PostPurchaseFinishReasonSchema = import_zod47.z.enum(["decline-all", "timer-expiry", "end", "unknown-result"]);
3495
+ var PostPurchaseFinishReasonSchema = import_zod47.z.enum([
3496
+ "continue",
3497
+ "decline-all",
3498
+ "end",
3499
+ "error",
3500
+ "ineligible",
3501
+ "purchase-complete",
3502
+ "recovery",
3503
+ "timer-expiry",
3504
+ "unknown-result"
3505
+ ]);
3494
3506
  var SessionFinishRequestSchema = DecideRequestSchema.extend({
3495
3507
  endReason: PostPurchaseEndReasonSchema.optional(),
3496
3508
  reason: PostPurchaseFinishReasonSchema.optional()
@@ -5109,6 +5121,20 @@ var PostPurchaseShadowSelectionSchema = import_zod88.z.discriminatedUnion("verdi
5109
5121
  import_zod88.z.object({ entry: DecisionEntrySchema, verdict: import_zod88.z.literal("render") }),
5110
5122
  import_zod88.z.object({ verdict: import_zod88.z.literal("skip") })
5111
5123
  ]);
5124
+ var PostPurchaseShadowSkipReasonSchema = import_zod88.z.enum([
5125
+ "destination-missing",
5126
+ "merchant-destination",
5127
+ "merchant-time",
5128
+ "no-active-flows",
5129
+ "no-eligible-flow",
5130
+ "prelude-timeout"
5131
+ ]);
5132
+ var PostPurchaseShadowFlowOutcomesSchema = import_zod88.z.array(
5133
+ import_zod88.z.object({
5134
+ flowId: import_zod88.z.number().int().positive(),
5135
+ outcome: import_zod88.z.enum(["eligible", "empty", "failed", "unsupported"])
5136
+ })
5137
+ ).max(POST_PURCHASE_SKIP_LIMIT);
5112
5138
  var PostPurchaseShadowReportFields = import_zod88.z.object({
5113
5139
  differences: import_zod88.z.array(import_zod88.z.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
5114
5140
  message: "differences must not contain duplicate entries"
@@ -5116,7 +5142,14 @@ var PostPurchaseShadowReportFields = import_zod88.z.object({
5116
5142
  legacySelection: PostPurchaseShadowSelectionSchema,
5117
5143
  phase: import_zod88.z.literal("shouldRender"),
5118
5144
  sampleId: import_zod88.z.string(),
5145
+ /** Optional so rows and senders from before REB-25425 stay valid; never part of the classification. */
5146
+ serverFlowOutcomes: PostPurchaseShadowFlowOutcomesSchema.optional(),
5119
5147
  serverSelection: PostPurchaseShadowSelectionSchema.optional(),
5148
+ /**
5149
+ * Set by the sender when the Decider skipped, `incomplete` reports included (which carry no
5150
+ * `serverSelection`). Not validated against `serverSelection`, and never part of the classification.
5151
+ */
5152
+ serverSkipReason: PostPurchaseShadowSkipReasonSchema.optional(),
5120
5153
  status: import_zod88.z.enum(["match", "diverged", "incomplete"]),
5121
5154
  targetingFlowIds: import_zod88.z.array(import_zod88.z.number().int().positive()),
5122
5155
  workflowPhase: import_zod88.z.literal("decide")
package/dist/index.mjs CHANGED
@@ -3007,7 +3007,17 @@ var FinishedPurchaseSchema = z47.union([
3007
3007
  ])
3008
3008
  })
3009
3009
  ]);
3010
- var PostPurchaseFinishReasonSchema = z47.enum(["decline-all", "timer-expiry", "end", "unknown-result"]);
3010
+ var PostPurchaseFinishReasonSchema = z47.enum([
3011
+ "continue",
3012
+ "decline-all",
3013
+ "end",
3014
+ "error",
3015
+ "ineligible",
3016
+ "purchase-complete",
3017
+ "recovery",
3018
+ "timer-expiry",
3019
+ "unknown-result"
3020
+ ]);
3011
3021
  var SessionFinishRequestSchema = DecideRequestSchema.extend({
3012
3022
  endReason: PostPurchaseEndReasonSchema.optional(),
3013
3023
  reason: PostPurchaseFinishReasonSchema.optional()
@@ -4626,6 +4636,20 @@ var PostPurchaseShadowSelectionSchema = z88.discriminatedUnion("verdict", [
4626
4636
  z88.object({ entry: DecisionEntrySchema, verdict: z88.literal("render") }),
4627
4637
  z88.object({ verdict: z88.literal("skip") })
4628
4638
  ]);
4639
+ var PostPurchaseShadowSkipReasonSchema = z88.enum([
4640
+ "destination-missing",
4641
+ "merchant-destination",
4642
+ "merchant-time",
4643
+ "no-active-flows",
4644
+ "no-eligible-flow",
4645
+ "prelude-timeout"
4646
+ ]);
4647
+ var PostPurchaseShadowFlowOutcomesSchema = z88.array(
4648
+ z88.object({
4649
+ flowId: z88.number().int().positive(),
4650
+ outcome: z88.enum(["eligible", "empty", "failed", "unsupported"])
4651
+ })
4652
+ ).max(POST_PURCHASE_SKIP_LIMIT);
4629
4653
  var PostPurchaseShadowReportFields = z88.object({
4630
4654
  differences: z88.array(z88.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
4631
4655
  message: "differences must not contain duplicate entries"
@@ -4633,7 +4657,14 @@ var PostPurchaseShadowReportFields = z88.object({
4633
4657
  legacySelection: PostPurchaseShadowSelectionSchema,
4634
4658
  phase: z88.literal("shouldRender"),
4635
4659
  sampleId: z88.string(),
4660
+ /** Optional so rows and senders from before REB-25425 stay valid; never part of the classification. */
4661
+ serverFlowOutcomes: PostPurchaseShadowFlowOutcomesSchema.optional(),
4636
4662
  serverSelection: PostPurchaseShadowSelectionSchema.optional(),
4663
+ /**
4664
+ * Set by the sender when the Decider skipped, `incomplete` reports included (which carry no
4665
+ * `serverSelection`). Not validated against `serverSelection`, and never part of the classification.
4666
+ */
4667
+ serverSkipReason: PostPurchaseShadowSkipReasonSchema.optional(),
4637
4668
  status: z88.enum(["match", "diverged", "incomplete"]),
4638
4669
  targetingFlowIds: z88.array(z88.number().int().positive()),
4639
4670
  workflowPhase: z88.literal("decide")
@@ -6909,9 +6940,11 @@ export {
6909
6940
  PostPurchaseReviewStyles,
6910
6941
  PostPurchaseSessionIdSchema,
6911
6942
  PostPurchaseSettings,
6943
+ PostPurchaseShadowFlowOutcomesSchema,
6912
6944
  PostPurchaseShadowReportFields,
6913
6945
  PostPurchaseShadowReportSchema,
6914
6946
  PostPurchaseShadowSelectionSchema,
6947
+ PostPurchaseShadowSkipReasonSchema,
6915
6948
  PostPurchaseSkipReasonSchema,
6916
6949
  PostPurchaseSkipTraceSchema,
6917
6950
  PostPurchaseStsContext,
@@ -14,13 +14,22 @@ export declare const FinishedPurchaseSchema: z.ZodUnion<readonly [z.ZodObject<{
14
14
  }>)[]]>;
15
15
  }, z.core.$strict>]>;
16
16
  /**
17
- * Why the client finished: the buyer declined every Offer (`decline-all`), the timer ran out (`timer-expiry`),
18
- * a transition Ended or could not read the next Offer (`end`), or a purchase's result stayed unknown
19
- * (`unknown-result`).
17
+ * Why the client finished: the buyer continued (`continue`) or declined every Offer (`decline-all`), a
18
+ * transition Ended or could not read the next Offer (`end`), preparation, admission or a membership command
19
+ * failed (`error`), Render's eligibility recheck refused the order (`ineligible`), a purchase completed the
20
+ * session (`purchase-complete`), recovery found a purchase that permits no fresh presentation (`recovery`),
21
+ * the timer ran out (`timer-expiry`), or a purchase's result stayed unknown (`unknown-result`). One value per
22
+ * client exit, so an `experience.end` row names every exit rather than `null` for the ones Finish had no word
23
+ * for.
20
24
  */
21
25
  export declare const PostPurchaseFinishReasonSchema: z.ZodEnum<{
26
+ error: "error";
22
27
  end: "end";
28
+ continue: "continue";
23
29
  "decline-all": "decline-all";
30
+ ineligible: "ineligible";
31
+ "purchase-complete": "purchase-complete";
32
+ recovery: "recovery";
24
33
  "timer-expiry": "timer-expiry";
25
34
  "unknown-result": "unknown-result";
26
35
  }>;
@@ -37,8 +46,13 @@ export declare const SessionFinishRequestSchema: z.ZodObject<{
37
46
  "accept-cap": "accept-cap";
38
47
  }>>;
39
48
  reason: z.ZodOptional<z.ZodEnum<{
49
+ error: "error";
40
50
  end: "end";
51
+ continue: "continue";
41
52
  "decline-all": "decline-all";
53
+ ineligible: "ineligible";
54
+ "purchase-complete": "purchase-complete";
55
+ recovery: "recovery";
42
56
  "timer-expiry": "timer-expiry";
43
57
  "unknown-result": "unknown-result";
44
58
  }>>;
@@ -15,6 +15,38 @@ export declare const PostPurchaseShadowSelectionSchema: z.ZodDiscriminatedUnion<
15
15
  verdict: z.ZodLiteral<"skip">;
16
16
  }, z.core.$strip>], "verdict">;
17
17
  export type PostPurchaseShadowSelection = z.infer<typeof PostPurchaseShadowSelectionSchema>;
18
+ /**
19
+ * Why the Decider skipped: a merchant/destination exit, no active Flow, no Flow with an eligible entry node,
20
+ * or a prelude that did not settle in budget. Diagnostic only. A hand-kept mirror of rebuy-api's
21
+ * `DecisionSkipReasonSchema`: a reason added there fails this parse, so the sender checks its reason against
22
+ * {@link PostPurchaseShadowSkipReason} at compile time and a new reason ships here first.
23
+ */
24
+ export declare const PostPurchaseShadowSkipReasonSchema: z.ZodEnum<{
25
+ "destination-missing": "destination-missing";
26
+ "merchant-destination": "merchant-destination";
27
+ "merchant-time": "merchant-time";
28
+ "no-active-flows": "no-active-flows";
29
+ "no-eligible-flow": "no-eligible-flow";
30
+ "prelude-timeout": "prelude-timeout";
31
+ }>;
32
+ export type PostPurchaseShadowSkipReason = z.infer<typeof PostPurchaseShadowSkipReasonSchema>;
33
+ /**
34
+ * Each evaluated Flow's outcome from the Decider's completed trace, in evaluation order. Capped at
35
+ * `POST_PURCHASE_SKIP_LIMIT` like the skip trace, since a shop can have more Flows than a ledger row should carry.
36
+ * The cap rejects rather than clips, so a sender slices to the limit before parsing. A shadow sample holds at most
37
+ * rebuy-api's `SHADOW_MAX_FLOWS` (10) Flows, so the list is complete there; carry a truncation marker before
38
+ * anything reports more Flows than the cap.
39
+ */
40
+ export declare const PostPurchaseShadowFlowOutcomesSchema: z.ZodArray<z.ZodObject<{
41
+ flowId: z.ZodNumber;
42
+ outcome: z.ZodEnum<{
43
+ empty: "empty";
44
+ unsupported: "unsupported";
45
+ failed: "failed";
46
+ eligible: "eligible";
47
+ }>;
48
+ }, z.core.$strip>>;
49
+ export type PostPurchaseShadowFlowOutcomes = z.infer<typeof PostPurchaseShadowFlowOutcomesSchema>;
18
50
  /**
19
51
  * The shadow report's fields WITHOUT the status/differences cross-field refinements below — the derivable
20
52
  * base. `PostPurchaseShadowReportSchema` was a plain `ZodObject` before those refinements were added, and
@@ -48,6 +80,15 @@ export declare const PostPurchaseShadowReportFields: z.ZodObject<{
48
80
  }, z.core.$strip>], "verdict">;
49
81
  phase: z.ZodLiteral<"shouldRender">;
50
82
  sampleId: z.ZodString;
83
+ serverFlowOutcomes: z.ZodOptional<z.ZodArray<z.ZodObject<{
84
+ flowId: z.ZodNumber;
85
+ outcome: z.ZodEnum<{
86
+ empty: "empty";
87
+ unsupported: "unsupported";
88
+ failed: "failed";
89
+ eligible: "eligible";
90
+ }>;
91
+ }, z.core.$strip>>>;
51
92
  serverSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
52
93
  entry: z.ZodObject<{
53
94
  blockId: z.ZodNumber;
@@ -62,6 +103,14 @@ export declare const PostPurchaseShadowReportFields: z.ZodObject<{
62
103
  }, z.core.$strip>, z.ZodObject<{
63
104
  verdict: z.ZodLiteral<"skip">;
64
105
  }, z.core.$strip>], "verdict">>;
106
+ serverSkipReason: z.ZodOptional<z.ZodEnum<{
107
+ "destination-missing": "destination-missing";
108
+ "merchant-destination": "merchant-destination";
109
+ "merchant-time": "merchant-time";
110
+ "no-active-flows": "no-active-flows";
111
+ "no-eligible-flow": "no-eligible-flow";
112
+ "prelude-timeout": "prelude-timeout";
113
+ }>>;
65
114
  status: z.ZodEnum<{
66
115
  match: "match";
67
116
  diverged: "diverged";
@@ -99,6 +148,15 @@ export declare const PostPurchaseShadowReportSchema: z.ZodObject<{
99
148
  }, z.core.$strip>], "verdict">;
100
149
  phase: z.ZodLiteral<"shouldRender">;
101
150
  sampleId: z.ZodString;
151
+ serverFlowOutcomes: z.ZodOptional<z.ZodArray<z.ZodObject<{
152
+ flowId: z.ZodNumber;
153
+ outcome: z.ZodEnum<{
154
+ empty: "empty";
155
+ unsupported: "unsupported";
156
+ failed: "failed";
157
+ eligible: "eligible";
158
+ }>;
159
+ }, z.core.$strip>>>;
102
160
  serverSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
103
161
  entry: z.ZodObject<{
104
162
  blockId: z.ZodNumber;
@@ -113,6 +171,14 @@ export declare const PostPurchaseShadowReportSchema: z.ZodObject<{
113
171
  }, z.core.$strip>, z.ZodObject<{
114
172
  verdict: z.ZodLiteral<"skip">;
115
173
  }, z.core.$strip>], "verdict">>;
174
+ serverSkipReason: z.ZodOptional<z.ZodEnum<{
175
+ "destination-missing": "destination-missing";
176
+ "merchant-destination": "merchant-destination";
177
+ "merchant-time": "merchant-time";
178
+ "no-active-flows": "no-active-flows";
179
+ "no-eligible-flow": "no-eligible-flow";
180
+ "prelude-timeout": "prelude-timeout";
181
+ }>>;
116
182
  status: z.ZodEnum<{
117
183
  match: "match";
118
184
  diverged: "diverged";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebuy/rebuy",
3
- "version": "3.64.0",
3
+ "version": "3.66.0",
4
4
  "description": "Shared zod schemas, legacy-to-CAB widget transforms, and server orchestrators for Rebuy's Shopify consumers (rebuy-api, admin-nextjs, rebuy-shopify-extensions)",
5
5
  "license": "MIT",
6
6
  "author": "Rebuy, Inc.",