@rebuy/rebuy 3.65.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,
@@ -5119,6 +5121,20 @@ var PostPurchaseShadowSelectionSchema = import_zod88.z.discriminatedUnion("verdi
5119
5121
  import_zod88.z.object({ entry: DecisionEntrySchema, verdict: import_zod88.z.literal("render") }),
5120
5122
  import_zod88.z.object({ verdict: import_zod88.z.literal("skip") })
5121
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);
5122
5138
  var PostPurchaseShadowReportFields = import_zod88.z.object({
5123
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, {
5124
5140
  message: "differences must not contain duplicate entries"
@@ -5126,7 +5142,14 @@ var PostPurchaseShadowReportFields = import_zod88.z.object({
5126
5142
  legacySelection: PostPurchaseShadowSelectionSchema,
5127
5143
  phase: import_zod88.z.literal("shouldRender"),
5128
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(),
5129
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(),
5130
5153
  status: import_zod88.z.enum(["match", "diverged", "incomplete"]),
5131
5154
  targetingFlowIds: import_zod88.z.array(import_zod88.z.number().int().positive()),
5132
5155
  workflowPhase: import_zod88.z.literal("decide")
package/dist/index.mjs CHANGED
@@ -4636,6 +4636,20 @@ var PostPurchaseShadowSelectionSchema = z88.discriminatedUnion("verdict", [
4636
4636
  z88.object({ entry: DecisionEntrySchema, verdict: z88.literal("render") }),
4637
4637
  z88.object({ verdict: z88.literal("skip") })
4638
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);
4639
4653
  var PostPurchaseShadowReportFields = z88.object({
4640
4654
  differences: z88.array(z88.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
4641
4655
  message: "differences must not contain duplicate entries"
@@ -4643,7 +4657,14 @@ var PostPurchaseShadowReportFields = z88.object({
4643
4657
  legacySelection: PostPurchaseShadowSelectionSchema,
4644
4658
  phase: z88.literal("shouldRender"),
4645
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(),
4646
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(),
4647
4668
  status: z88.enum(["match", "diverged", "incomplete"]),
4648
4669
  targetingFlowIds: z88.array(z88.number().int().positive()),
4649
4670
  workflowPhase: z88.literal("decide")
@@ -6919,9 +6940,11 @@ export {
6919
6940
  PostPurchaseReviewStyles,
6920
6941
  PostPurchaseSessionIdSchema,
6921
6942
  PostPurchaseSettings,
6943
+ PostPurchaseShadowFlowOutcomesSchema,
6922
6944
  PostPurchaseShadowReportFields,
6923
6945
  PostPurchaseShadowReportSchema,
6924
6946
  PostPurchaseShadowSelectionSchema,
6947
+ PostPurchaseShadowSkipReasonSchema,
6925
6948
  PostPurchaseSkipReasonSchema,
6926
6949
  PostPurchaseSkipTraceSchema,
6927
6950
  PostPurchaseStsContext,
@@ -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.65.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.",