@rebuy/rebuy 3.51.1 → 3.53.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 (35) hide show
  1. package/dist/index.cjs +47 -31
  2. package/dist/index.mjs +47 -31
  3. package/dist/schema/index.d.ts +1 -1
  4. package/dist/schema/postPurchaseAdmission.d.ts +6 -6
  5. package/dist/schema/postPurchaseFollowups.d.ts +1 -1
  6. package/dist/schema/postPurchaseOfferEligibility.d.ts +24 -1
  7. package/dist/schema/postPurchaseProduct.d.ts +2 -0
  8. package/dist/schema/postPurchaseProductCollectionView.d.ts +1 -0
  9. package/dist/schema/postPurchaseProductDisplay.d.ts +1 -0
  10. package/dist/schema/postPurchaseProductGallery.d.ts +1 -0
  11. package/dist/schema/postPurchaseProductView.d.ts +1 -0
  12. package/dist/schema/postPurchaseRecovery.d.ts +1 -1
  13. package/dist/schema/{postPurchaseUpgrade.d.ts → postPurchaseSts.d.ts} +14 -14
  14. package/dist/schema/postPurchaseSubscriptionProduct.d.ts +2 -0
  15. package/dist/server/__fixtures__/postPurchaseSts.d.ts +98 -0
  16. package/dist/server/classifyPostPurchaseOffer.d.ts +4 -2
  17. package/dist/server/index.cjs +166 -78
  18. package/dist/server/index.mjs +166 -78
  19. package/dist/server/postPurchaseProductDisplay.d.ts +1 -0
  20. package/dist/server/postPurchaseProductGallery.d.ts +5 -1
  21. package/dist/server/postPurchaseSts.d.ts +1293 -0
  22. package/dist/server/preparePostPurchaseAdmissionView.d.ts +1 -0
  23. package/dist/server/preparePostPurchaseCollectionGroup.d.ts +1 -0
  24. package/dist/server/preparePostPurchaseCollectionView.d.ts +5 -1
  25. package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +8 -0
  26. package/dist/server/preparePostPurchaseGroupDefault.d.ts +8 -0
  27. package/dist/server/preparePostPurchaseGroupView.d.ts +8 -0
  28. package/dist/server/preparePostPurchaseMemberView.d.ts +818 -1
  29. package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +12 -1
  30. package/dist/server/preparePostPurchaseQuantityView.d.ts +12 -1
  31. package/dist/server/preparePostPurchaseStsMember.d.ts +824 -0
  32. package/dist/server/preparePostPurchaseSubscription.d.ts +1 -0
  33. package/dist/server/projectPostPurchaseProduct.d.ts +1 -0
  34. package/dist/server/readPostPurchaseQuantity.d.ts +4 -1
  35. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -235,6 +235,8 @@ __export(src_exports, {
235
235
  PostPurchaseShadowSelectionSchema: () => PostPurchaseShadowSelectionSchema,
236
236
  PostPurchaseSkipReasonSchema: () => PostPurchaseSkipReasonSchema,
237
237
  PostPurchaseSkipTraceSchema: () => PostPurchaseSkipTraceSchema,
238
+ PostPurchaseStsContext: () => PostPurchaseStsContext,
239
+ PostPurchaseStsOptions: () => PostPurchaseStsOptions,
238
240
  PostPurchaseSubscriptionDisplay: () => PostPurchaseSubscriptionDisplay,
239
241
  PostPurchaseSubscriptionTerms: () => PostPurchaseSubscriptionTerms,
240
242
  PostPurchaseTimestampSchema: () => PostPurchaseTimestampSchema,
@@ -326,6 +328,11 @@ __export(src_exports, {
326
328
  SmartCartTierExclusion: () => SmartCartTierExclusion,
327
329
  SmartCartTierProduct: () => SmartCartTierProduct,
328
330
  Spacing: () => Spacing,
331
+ StsCompensationProgressSchema: () => StsCompensationProgressSchema,
332
+ StsProgressSchema: () => StsProgressSchema,
333
+ StsRefundProgressSchema: () => StsRefundProgressSchema,
334
+ StsReviewProgressSchema: () => StsReviewProgressSchema,
335
+ StsReviewReasonSchema: () => StsReviewReasonSchema,
329
336
  TextAlignment: () => TextAlignment,
330
337
  TextBlock: () => TextBlock,
331
338
  TextColorName: () => TextColorName,
@@ -336,11 +343,6 @@ __export(src_exports, {
336
343
  TiptapParagraph: () => TiptapParagraph,
337
344
  TiptapText: () => TiptapText,
338
345
  UI_LABELS: () => UI_LABELS,
339
- UpgradeCompensationProgressSchema: () => UpgradeCompensationProgressSchema,
340
- UpgradeProgressSchema: () => UpgradeProgressSchema,
341
- UpgradeRefundProgressSchema: () => UpgradeRefundProgressSchema,
342
- UpgradeReviewProgressSchema: () => UpgradeReviewProgressSchema,
343
- UpgradeReviewReasonSchema: () => UpgradeReviewReasonSchema,
344
346
  UserConfig: () => UserConfig,
345
347
  VariableEffect: () => VariableEffect,
346
348
  VariableType: () => VariableType,
@@ -1783,6 +1785,12 @@ var import_zod18 = require("zod");
1783
1785
  // src/schema/postPurchaseProductGallery.ts
1784
1786
  var import_zod9 = require("zod");
1785
1787
  var PostPurchaseProductGallery = import_zod9.z.object({
1788
+ /**
1789
+ * Show the thumbnail row: the product had more than one image before `images` was capped at the
1790
+ * sub-image limit, and that limit allows at least one thumbnail. It stays true when the cap leaves one
1791
+ * image (legacy checks the count before slicing). Older replies omit it; fall back to `images.length > 1`.
1792
+ */
1793
+ hasMultiple: import_zod9.z.boolean().optional(),
1786
1794
  images: import_zod9.z.array(
1787
1795
  import_zod9.z.object({
1788
1796
  description: import_zod9.z.string(),
@@ -2908,7 +2916,7 @@ var PostPurchaseProductChangeset = import_zod23.z.object({
2908
2916
  });
2909
2917
 
2910
2918
  // src/schema/postPurchaseAdmission.ts
2911
- var PurchaseAdmissionModeSchema = import_zod24.z.enum(["purchase", "upgrade"]);
2919
+ var PurchaseAdmissionModeSchema = import_zod24.z.enum(["purchase", "sts"]);
2912
2920
  var selection = PreparedPostPurchaseProduct.shape.selection;
2913
2921
  var EventCalculationSchema = PostPurchaseProductCosts.pick({ currencyCode: true, totalMinor: true }).strict();
2914
2922
  var PurchaseExpectedSchema = import_zod24.z.object({
@@ -2930,8 +2938,8 @@ var PurchaseExpectedSchema = import_zod24.z.object({
2930
2938
  ({ member, progressRevision }) => !member || progressRevision !== void 0,
2931
2939
  "Captured member requires progress"
2932
2940
  ).refine(
2933
- ({ mode, selection: { sellingPlanId } }) => mode !== "upgrade" || sellingPlanId !== void 0,
2934
- "An upgrade selects a subscription"
2941
+ ({ mode, selection: { sellingPlanId } }) => mode !== "sts" || sellingPlanId !== void 0,
2942
+ "An STS selects a subscription"
2935
2943
  ).refine(({ buyerConsentToSubscriptions: consent, changeset, selection: selection3 }) => {
2936
2944
  const [change, shipping] = changeset.changes;
2937
2945
  if (selection3.sellingPlanId === void 0)
@@ -2947,7 +2955,7 @@ var PurchaseReceiptSchema = import_zod24.z.object({
2947
2955
  changesetToken: import_zod24.z.string().min(1),
2948
2956
  mode: PurchaseAdmissionModeSchema.optional(),
2949
2957
  operationId: import_zod24.z.uuid(),
2950
- /** The server-bound one-time line an upgrade refunds; its quantity is the order's, not the selection's. */
2958
+ /** The server-bound one-time line an STS refunds; its quantity is the order's, not the selection's. */
2951
2959
  originalLine: import_zod24.z.strictObject({ quantity: selection.shape.quantity, variantId: selection.shape.variantId }).optional(),
2952
2960
  requiresSubscriptionConsent: import_zod24.z.boolean(),
2953
2961
  selection
@@ -2955,8 +2963,8 @@ var PurchaseReceiptSchema = import_zod24.z.object({
2955
2963
  ({ requiresSubscriptionConsent, selection: selection3 }) => requiresSubscriptionConsent === (selection3.sellingPlanId !== void 0),
2956
2964
  "Receipt consent must match its selected plan"
2957
2965
  ).refine(
2958
- ({ mode, originalLine, selection: { sellingPlanId, variantId } }) => mode === "upgrade" ? sellingPlanId !== void 0 && originalLine?.variantId === variantId : originalLine === void 0,
2959
- "An upgrade Receipt binds the original line of its subscribed variant, and only an upgrade does"
2966
+ ({ mode, originalLine, selection: { sellingPlanId, variantId } }) => mode === "sts" ? sellingPlanId !== void 0 && originalLine?.variantId === variantId : originalLine === void 0,
2967
+ "An STS Receipt binds the original line of its subscribed variant, and only an STS does"
2960
2968
  );
2961
2969
  var PurchaseResponseSchema = import_zod24.z.object({ data: PurchaseReceiptSchema, successful: import_zod24.z.literal(true) });
2962
2970
 
@@ -3282,24 +3290,24 @@ var PurchaseObservationResponseSchema = import_zod41.z.object({
3282
3290
  successful: import_zod41.z.literal(true)
3283
3291
  });
3284
3292
 
3285
- // src/schema/postPurchaseUpgrade.ts
3293
+ // src/schema/postPurchaseSts.ts
3286
3294
  var import_zod42 = require("zod");
3287
3295
  var AttemptSchema2 = import_zod42.z.strictObject({ attemptedAt: PostPurchaseTimestampSchema, status: import_zod42.z.literal("attempted") });
3288
3296
  var FinishedSchema = AttemptSchema2.extend({ finishedAt: PostPurchaseTimestampSchema });
3289
- var UpgradeRefundProgressSchema = import_zod42.z.union([
3297
+ var StsRefundProgressSchema = import_zod42.z.union([
3290
3298
  AttemptSchema2,
3291
3299
  FinishedSchema.extend({ refundId: import_zod42.z.string().min(1), status: import_zod42.z.literal("refunded") }),
3292
3300
  FinishedSchema.extend({ status: import_zod42.z.enum(["failed", "unknown"]) })
3293
3301
  ]);
3294
- var UpgradeCompensationProgressSchema = import_zod42.z.union([
3302
+ var StsCompensationProgressSchema = import_zod42.z.union([
3295
3303
  AttemptSchema2,
3296
3304
  FinishedSchema.extend({ status: import_zod42.z.enum(["removed", "failed", "unknown"]) })
3297
3305
  ]);
3298
- var UpgradeReviewReasonSchema = import_zod42.z.enum(["refund-unknown", "compensation-failed", "compensation-unknown"]);
3299
- var UpgradeReviewProgressSchema = import_zod42.z.strictObject({
3306
+ var StsReviewReasonSchema = import_zod42.z.enum(["refund-unknown", "compensation-failed", "compensation-unknown"]);
3307
+ var StsReviewProgressSchema = import_zod42.z.strictObject({
3300
3308
  markedAt: PostPurchaseTimestampSchema,
3301
3309
  marker: AcceptedMetafieldResultSchema.shape.status,
3302
- reason: UpgradeReviewReasonSchema
3310
+ reason: StsReviewReasonSchema
3303
3311
  });
3304
3312
  var reviewReason = (refund, compensation) => {
3305
3313
  if (refund?.status === "unknown") return "refund-unknown";
@@ -3307,11 +3315,11 @@ var reviewReason = (refund, compensation) => {
3307
3315
  return `compensation-${compensation.status}`;
3308
3316
  return null;
3309
3317
  };
3310
- var UpgradeProgressSchema = import_zod42.z.strictObject({
3311
- compensation: UpgradeCompensationProgressSchema.nullable(),
3318
+ var StsProgressSchema = import_zod42.z.strictObject({
3319
+ compensation: StsCompensationProgressSchema.nullable(),
3312
3320
  operationId: PurchaseReceiptSchema.shape.operationId,
3313
- refund: UpgradeRefundProgressSchema.nullable(),
3314
- review: UpgradeReviewProgressSchema.nullable()
3321
+ refund: StsRefundProgressSchema.nullable(),
3322
+ review: StsReviewProgressSchema.nullable()
3315
3323
  }).refine(
3316
3324
  ({ compensation, refund }) => compensation === null || refund?.status === "failed",
3317
3325
  "Compensation follows a known refund failure only"
@@ -3334,11 +3342,11 @@ var AcceptedFollowupsResponseSchema = import_zod43.z.object({
3334
3342
  acceptedMetafield: AcceptedMetafieldResultSchema,
3335
3343
  health: RequiredHealthSchema,
3336
3344
  purchase: PurchaseObservationResponseSchema.shape.data,
3337
- /** Present only for an upgrade admission, and always for the same operation as `purchase`. */
3338
- upgrade: UpgradeProgressSchema.optional()
3339
- }).refine(({ purchase, upgrade }) => !upgrade || upgrade.operationId === purchase.operationId, {
3340
- message: "Upgrade progress belongs to its operation",
3341
- path: ["upgrade", "operationId"]
3345
+ /** Present only for an STS admission, and always for the same operation as `purchase`. */
3346
+ sts: StsProgressSchema.optional()
3347
+ }).refine(({ purchase, sts }) => !sts || sts.operationId === purchase.operationId, {
3348
+ message: "STS progress belongs to its operation",
3349
+ path: ["sts", "operationId"]
3342
3350
  }),
3343
3351
  successful: import_zod43.z.literal(true)
3344
3352
  });
@@ -4749,15 +4757,23 @@ var PostPurchaseOfferEligibilityContext = import_zod77.z.object({
4749
4757
  excludedProductIds: PostPurchaseExcludedProductIds,
4750
4758
  originalLineItems: import_zod77.z.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
4751
4759
  });
4760
+ var PostPurchaseStsOptions = import_zod77.z.object({ sts: import_zod77.z.boolean().optional() }).strict();
4761
+ var PostPurchaseStsContext = import_zod77.z.object({
4762
+ originalLineItems: import_zod77.z.array(
4763
+ selection2.pick({ productId: true, quantity: true, sellingPlanId: true, variantId: true })
4764
+ )
4765
+ });
4752
4766
  var PostPurchaseOfferEligibility = import_zod77.z.discriminatedUnion("status", [
4753
4767
  import_zod77.z.object({
4754
4768
  members: import_zod77.z.array(
4755
4769
  import_zod77.z.object({ productId: selection2.shape.productId, productIndex: import_zod77.z.number().int().nonnegative() })
4756
4770
  ),
4771
+ /** Present only with STS on: each member switches one original one-time line to subscription. */
4772
+ mode: import_zod77.z.literal("sts").optional(),
4757
4773
  status: import_zod77.z.literal("retain")
4758
4774
  }),
4759
4775
  import_zod77.z.object({ reason: PostPurchaseOfferSkipReason, status: import_zod77.z.literal("skip") }),
4760
- import_zod77.z.object({ reason: import_zod77.z.literal("eligible-upgrade").optional(), status: import_zod77.z.literal("unavailable") })
4776
+ import_zod77.z.object({ reason: import_zod77.z.literal("eligible-sts").optional(), status: import_zod77.z.literal("unavailable") })
4761
4777
  ]);
4762
4778
 
4763
4779
  // src/schema/postPurchaseOfferPresentation.ts
@@ -4865,10 +4881,10 @@ var PurchaseRecoveryResponseSchema = import_zod83.z.object({
4865
4881
  operationId: PurchaseReceiptSchema.shape.operationId,
4866
4882
  /** The total the buyer affirmed at admission; absent for an operation admitted without one. */
4867
4883
  reportedCalculation: EventCalculationSchema.optional(),
4868
- upgrade: UpgradeProgressSchema.optional()
4869
- }).strict().refine(({ operationId, upgrade }) => !upgrade || upgrade.operationId === operationId, {
4870
- message: "Upgrade progress belongs to its operation",
4871
- path: ["upgrade", "operationId"]
4884
+ sts: StsProgressSchema.optional()
4885
+ }).strict().refine(({ operationId, sts }) => !sts || sts.operationId === operationId, {
4886
+ message: "STS progress belongs to its operation",
4887
+ path: ["sts", "operationId"]
4872
4888
  }).refine(
4873
4889
  ({ followups, operationId }) => !followups?.acceptedEvent || followups.acceptedEvent.operationId === operationId,
4874
4890
  { message: "Follow-up progress belongs to its operation", path: ["followups", "acceptedEvent"] }
package/dist/index.mjs CHANGED
@@ -1311,6 +1311,12 @@ import { z as z18 } from "zod";
1311
1311
  // src/schema/postPurchaseProductGallery.ts
1312
1312
  import { z as z9 } from "zod";
1313
1313
  var PostPurchaseProductGallery = z9.object({
1314
+ /**
1315
+ * Show the thumbnail row: the product had more than one image before `images` was capped at the
1316
+ * sub-image limit, and that limit allows at least one thumbnail. It stays true when the cap leaves one
1317
+ * image (legacy checks the count before slicing). Older replies omit it; fall back to `images.length > 1`.
1318
+ */
1319
+ hasMultiple: z9.boolean().optional(),
1314
1320
  images: z9.array(
1315
1321
  z9.object({
1316
1322
  description: z9.string(),
@@ -2436,7 +2442,7 @@ var PostPurchaseProductChangeset = z23.object({
2436
2442
  });
2437
2443
 
2438
2444
  // src/schema/postPurchaseAdmission.ts
2439
- var PurchaseAdmissionModeSchema = z24.enum(["purchase", "upgrade"]);
2445
+ var PurchaseAdmissionModeSchema = z24.enum(["purchase", "sts"]);
2440
2446
  var selection = PreparedPostPurchaseProduct.shape.selection;
2441
2447
  var EventCalculationSchema = PostPurchaseProductCosts.pick({ currencyCode: true, totalMinor: true }).strict();
2442
2448
  var PurchaseExpectedSchema = z24.object({
@@ -2458,8 +2464,8 @@ var PurchaseExpectedSchema = z24.object({
2458
2464
  ({ member, progressRevision }) => !member || progressRevision !== void 0,
2459
2465
  "Captured member requires progress"
2460
2466
  ).refine(
2461
- ({ mode, selection: { sellingPlanId } }) => mode !== "upgrade" || sellingPlanId !== void 0,
2462
- "An upgrade selects a subscription"
2467
+ ({ mode, selection: { sellingPlanId } }) => mode !== "sts" || sellingPlanId !== void 0,
2468
+ "An STS selects a subscription"
2463
2469
  ).refine(({ buyerConsentToSubscriptions: consent, changeset, selection: selection3 }) => {
2464
2470
  const [change, shipping] = changeset.changes;
2465
2471
  if (selection3.sellingPlanId === void 0)
@@ -2475,7 +2481,7 @@ var PurchaseReceiptSchema = z24.object({
2475
2481
  changesetToken: z24.string().min(1),
2476
2482
  mode: PurchaseAdmissionModeSchema.optional(),
2477
2483
  operationId: z24.uuid(),
2478
- /** The server-bound one-time line an upgrade refunds; its quantity is the order's, not the selection's. */
2484
+ /** The server-bound one-time line an STS refunds; its quantity is the order's, not the selection's. */
2479
2485
  originalLine: z24.strictObject({ quantity: selection.shape.quantity, variantId: selection.shape.variantId }).optional(),
2480
2486
  requiresSubscriptionConsent: z24.boolean(),
2481
2487
  selection
@@ -2483,8 +2489,8 @@ var PurchaseReceiptSchema = z24.object({
2483
2489
  ({ requiresSubscriptionConsent, selection: selection3 }) => requiresSubscriptionConsent === (selection3.sellingPlanId !== void 0),
2484
2490
  "Receipt consent must match its selected plan"
2485
2491
  ).refine(
2486
- ({ mode, originalLine, selection: { sellingPlanId, variantId } }) => mode === "upgrade" ? sellingPlanId !== void 0 && originalLine?.variantId === variantId : originalLine === void 0,
2487
- "An upgrade Receipt binds the original line of its subscribed variant, and only an upgrade does"
2492
+ ({ mode, originalLine, selection: { sellingPlanId, variantId } }) => mode === "sts" ? sellingPlanId !== void 0 && originalLine?.variantId === variantId : originalLine === void 0,
2493
+ "An STS Receipt binds the original line of its subscribed variant, and only an STS does"
2488
2494
  );
2489
2495
  var PurchaseResponseSchema = z24.object({ data: PurchaseReceiptSchema, successful: z24.literal(true) });
2490
2496
 
@@ -2810,24 +2816,24 @@ var PurchaseObservationResponseSchema = z41.object({
2810
2816
  successful: z41.literal(true)
2811
2817
  });
2812
2818
 
2813
- // src/schema/postPurchaseUpgrade.ts
2819
+ // src/schema/postPurchaseSts.ts
2814
2820
  import { z as z42 } from "zod";
2815
2821
  var AttemptSchema2 = z42.strictObject({ attemptedAt: PostPurchaseTimestampSchema, status: z42.literal("attempted") });
2816
2822
  var FinishedSchema = AttemptSchema2.extend({ finishedAt: PostPurchaseTimestampSchema });
2817
- var UpgradeRefundProgressSchema = z42.union([
2823
+ var StsRefundProgressSchema = z42.union([
2818
2824
  AttemptSchema2,
2819
2825
  FinishedSchema.extend({ refundId: z42.string().min(1), status: z42.literal("refunded") }),
2820
2826
  FinishedSchema.extend({ status: z42.enum(["failed", "unknown"]) })
2821
2827
  ]);
2822
- var UpgradeCompensationProgressSchema = z42.union([
2828
+ var StsCompensationProgressSchema = z42.union([
2823
2829
  AttemptSchema2,
2824
2830
  FinishedSchema.extend({ status: z42.enum(["removed", "failed", "unknown"]) })
2825
2831
  ]);
2826
- var UpgradeReviewReasonSchema = z42.enum(["refund-unknown", "compensation-failed", "compensation-unknown"]);
2827
- var UpgradeReviewProgressSchema = z42.strictObject({
2832
+ var StsReviewReasonSchema = z42.enum(["refund-unknown", "compensation-failed", "compensation-unknown"]);
2833
+ var StsReviewProgressSchema = z42.strictObject({
2828
2834
  markedAt: PostPurchaseTimestampSchema,
2829
2835
  marker: AcceptedMetafieldResultSchema.shape.status,
2830
- reason: UpgradeReviewReasonSchema
2836
+ reason: StsReviewReasonSchema
2831
2837
  });
2832
2838
  var reviewReason = (refund, compensation) => {
2833
2839
  if (refund?.status === "unknown") return "refund-unknown";
@@ -2835,11 +2841,11 @@ var reviewReason = (refund, compensation) => {
2835
2841
  return `compensation-${compensation.status}`;
2836
2842
  return null;
2837
2843
  };
2838
- var UpgradeProgressSchema = z42.strictObject({
2839
- compensation: UpgradeCompensationProgressSchema.nullable(),
2844
+ var StsProgressSchema = z42.strictObject({
2845
+ compensation: StsCompensationProgressSchema.nullable(),
2840
2846
  operationId: PurchaseReceiptSchema.shape.operationId,
2841
- refund: UpgradeRefundProgressSchema.nullable(),
2842
- review: UpgradeReviewProgressSchema.nullable()
2847
+ refund: StsRefundProgressSchema.nullable(),
2848
+ review: StsReviewProgressSchema.nullable()
2843
2849
  }).refine(
2844
2850
  ({ compensation, refund }) => compensation === null || refund?.status === "failed",
2845
2851
  "Compensation follows a known refund failure only"
@@ -2862,11 +2868,11 @@ var AcceptedFollowupsResponseSchema = z43.object({
2862
2868
  acceptedMetafield: AcceptedMetafieldResultSchema,
2863
2869
  health: RequiredHealthSchema,
2864
2870
  purchase: PurchaseObservationResponseSchema.shape.data,
2865
- /** Present only for an upgrade admission, and always for the same operation as `purchase`. */
2866
- upgrade: UpgradeProgressSchema.optional()
2867
- }).refine(({ purchase, upgrade }) => !upgrade || upgrade.operationId === purchase.operationId, {
2868
- message: "Upgrade progress belongs to its operation",
2869
- path: ["upgrade", "operationId"]
2871
+ /** Present only for an STS admission, and always for the same operation as `purchase`. */
2872
+ sts: StsProgressSchema.optional()
2873
+ }).refine(({ purchase, sts }) => !sts || sts.operationId === purchase.operationId, {
2874
+ message: "STS progress belongs to its operation",
2875
+ path: ["sts", "operationId"]
2870
2876
  }),
2871
2877
  successful: z43.literal(true)
2872
2878
  });
@@ -4277,15 +4283,23 @@ var PostPurchaseOfferEligibilityContext = z77.object({
4277
4283
  excludedProductIds: PostPurchaseExcludedProductIds,
4278
4284
  originalLineItems: z77.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
4279
4285
  });
4286
+ var PostPurchaseStsOptions = z77.object({ sts: z77.boolean().optional() }).strict();
4287
+ var PostPurchaseStsContext = z77.object({
4288
+ originalLineItems: z77.array(
4289
+ selection2.pick({ productId: true, quantity: true, sellingPlanId: true, variantId: true })
4290
+ )
4291
+ });
4280
4292
  var PostPurchaseOfferEligibility = z77.discriminatedUnion("status", [
4281
4293
  z77.object({
4282
4294
  members: z77.array(
4283
4295
  z77.object({ productId: selection2.shape.productId, productIndex: z77.number().int().nonnegative() })
4284
4296
  ),
4297
+ /** Present only with STS on: each member switches one original one-time line to subscription. */
4298
+ mode: z77.literal("sts").optional(),
4285
4299
  status: z77.literal("retain")
4286
4300
  }),
4287
4301
  z77.object({ reason: PostPurchaseOfferSkipReason, status: z77.literal("skip") }),
4288
- z77.object({ reason: z77.literal("eligible-upgrade").optional(), status: z77.literal("unavailable") })
4302
+ z77.object({ reason: z77.literal("eligible-sts").optional(), status: z77.literal("unavailable") })
4289
4303
  ]);
4290
4304
 
4291
4305
  // src/schema/postPurchaseOfferPresentation.ts
@@ -4393,10 +4407,10 @@ var PurchaseRecoveryResponseSchema = z83.object({
4393
4407
  operationId: PurchaseReceiptSchema.shape.operationId,
4394
4408
  /** The total the buyer affirmed at admission; absent for an operation admitted without one. */
4395
4409
  reportedCalculation: EventCalculationSchema.optional(),
4396
- upgrade: UpgradeProgressSchema.optional()
4397
- }).strict().refine(({ operationId, upgrade }) => !upgrade || upgrade.operationId === operationId, {
4398
- message: "Upgrade progress belongs to its operation",
4399
- path: ["upgrade", "operationId"]
4410
+ sts: StsProgressSchema.optional()
4411
+ }).strict().refine(({ operationId, sts }) => !sts || sts.operationId === operationId, {
4412
+ message: "STS progress belongs to its operation",
4413
+ path: ["sts", "operationId"]
4400
4414
  }).refine(
4401
4415
  ({ followups, operationId }) => !followups?.acceptedEvent || followups.acceptedEvent.operationId === operationId,
4402
4416
  { message: "Follow-up progress belongs to its operation", path: ["followups", "acceptedEvent"] }
@@ -6746,6 +6760,8 @@ export {
6746
6760
  PostPurchaseShadowSelectionSchema,
6747
6761
  PostPurchaseSkipReasonSchema,
6748
6762
  PostPurchaseSkipTraceSchema,
6763
+ PostPurchaseStsContext,
6764
+ PostPurchaseStsOptions,
6749
6765
  PostPurchaseSubscriptionDisplay,
6750
6766
  PostPurchaseSubscriptionTerms,
6751
6767
  PostPurchaseTimestampSchema,
@@ -6837,6 +6853,11 @@ export {
6837
6853
  SmartCartTierExclusion,
6838
6854
  SmartCartTierProduct,
6839
6855
  Spacing,
6856
+ StsCompensationProgressSchema,
6857
+ StsProgressSchema,
6858
+ StsRefundProgressSchema,
6859
+ StsReviewProgressSchema,
6860
+ StsReviewReasonSchema,
6840
6861
  TextAlignment,
6841
6862
  TextBlock,
6842
6863
  TextColorName,
@@ -6847,11 +6868,6 @@ export {
6847
6868
  TiptapParagraph,
6848
6869
  TiptapText,
6849
6870
  UI_LABELS,
6850
- UpgradeCompensationProgressSchema,
6851
- UpgradeProgressSchema,
6852
- UpgradeRefundProgressSchema,
6853
- UpgradeReviewProgressSchema,
6854
- UpgradeReviewReasonSchema,
6855
6871
  UserConfig,
6856
6872
  VariableEffect,
6857
6873
  VariableType,
@@ -56,7 +56,7 @@ export * from './postPurchaseSubscription';
56
56
  export * from './postPurchaseSubscriptionDisplay';
57
57
  export { PreparedPostPurchaseSubscription } from './postPurchaseSubscriptionProduct';
58
58
  export * from './postPurchaseTransition';
59
- export * from './postPurchaseUpgrade';
59
+ export * from './postPurchaseSts';
60
60
  export * from './postPurchaseVariantCatalog';
61
61
  export * from './postPurchaseVariantDefault';
62
62
  export * from './postPurchaseVariantDefaultContext';
@@ -1,11 +1,11 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * Absent means `purchase`, so every pre-upgrade wire is unchanged. `upgrade` adds the selected subscription and
3
+ * Absent means `purchase`, so every pre-STS wire is unchanged. `sts` adds the selected subscription and
4
4
  * refunds the buyer's original one-time line of the same variant; the server binds that line, never the client.
5
5
  */
6
6
  export declare const PurchaseAdmissionModeSchema: z.ZodEnum<{
7
7
  purchase: "purchase";
8
- upgrade: "upgrade";
8
+ sts: "sts";
9
9
  }>;
10
10
  /** The buyer's SDK-calculated total for the affirmed terms (`calculateChangeset`), never proof of payment. */
11
11
  export declare const EventCalculationSchema: z.ZodObject<{
@@ -67,7 +67,7 @@ export declare const PurchaseExpectedSchema: z.ZodObject<{
67
67
  }, z.core.$strict>>;
68
68
  mode: z.ZodOptional<z.ZodEnum<{
69
69
  purchase: "purchase";
70
- upgrade: "upgrade";
70
+ sts: "sts";
71
71
  }>>;
72
72
  progressRevision: z.ZodOptional<z.ZodNumber>;
73
73
  reportedCalculation: z.ZodOptional<z.ZodObject<{
@@ -139,7 +139,7 @@ export declare const PurchaseRequestSchema: z.ZodObject<{
139
139
  }, z.core.$strict>>;
140
140
  mode: z.ZodOptional<z.ZodEnum<{
141
141
  purchase: "purchase";
142
- upgrade: "upgrade";
142
+ sts: "sts";
143
143
  }>>;
144
144
  progressRevision: z.ZodOptional<z.ZodNumber>;
145
145
  reportedCalculation: z.ZodOptional<z.ZodObject<{
@@ -160,7 +160,7 @@ export declare const PurchaseReceiptSchema: z.ZodObject<{
160
160
  changesetToken: z.ZodString;
161
161
  mode: z.ZodOptional<z.ZodEnum<{
162
162
  purchase: "purchase";
163
- upgrade: "upgrade";
163
+ sts: "sts";
164
164
  }>>;
165
165
  operationId: z.ZodUUID;
166
166
  originalLine: z.ZodOptional<z.ZodObject<{
@@ -181,7 +181,7 @@ export declare const PurchaseResponseSchema: z.ZodObject<{
181
181
  changesetToken: z.ZodString;
182
182
  mode: z.ZodOptional<z.ZodEnum<{
183
183
  purchase: "purchase";
184
- upgrade: "upgrade";
184
+ sts: "sts";
185
185
  }>>;
186
186
  operationId: z.ZodUUID;
187
187
  originalLine: z.ZodOptional<z.ZodObject<{
@@ -125,7 +125,7 @@ export declare const AcceptedFollowupsResponseSchema: z.ZodObject<{
125
125
  recordedAt: z.ZodNumber;
126
126
  operationId: z.ZodUUID;
127
127
  }, z.core.$strict>;
128
- upgrade: z.ZodOptional<z.ZodObject<{
128
+ sts: z.ZodOptional<z.ZodObject<{
129
129
  compensation: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
130
130
  attemptedAt: z.ZodNumber;
131
131
  status: z.ZodLiteral<"attempted">;
@@ -12,12 +12,35 @@ export declare const PostPurchaseOfferEligibilityContext: z.ZodObject<{
12
12
  }, z.core.$strip>>;
13
13
  }, z.core.$strip>;
14
14
  export type PostPurchaseOfferEligibilityContext = z.infer<typeof PostPurchaseOfferEligibilityContext>;
15
+ /**
16
+ * The switch-to-subscription (STS; merchant setting `upgradeToSubscription`) opt-in. Absent or `false`, an
17
+ * STS-enabled Offer is still `eligible-sts`/`unavailable` and every other output is unchanged, so a release can
18
+ * ship with STS off.
19
+ */
20
+ export declare const PostPurchaseStsOptions: z.ZodObject<{
21
+ sts: z.ZodOptional<z.ZodBoolean>;
22
+ }, z.core.$strict>;
23
+ export type PostPurchaseStsOptions = z.infer<typeof PostPurchaseStsOptions>;
24
+ /**
25
+ * The buyer's original lines with their quantities. Passing it opts a preparation into STS; it changes only an
26
+ * STS-enabled Offer, whose members each switch one original one-time line to subscription.
27
+ */
28
+ export declare const PostPurchaseStsContext: z.ZodObject<{
29
+ originalLineItems: z.ZodArray<z.ZodObject<{
30
+ productId: z.ZodNumber;
31
+ sellingPlanId: z.ZodOptional<z.ZodNumber>;
32
+ quantity: z.ZodNumber;
33
+ variantId: z.ZodNumber;
34
+ }, z.core.$strip>>;
35
+ }, z.core.$strip>;
36
+ export type PostPurchaseStsContext = z.infer<typeof PostPurchaseStsContext>;
15
37
  /** Retained catalog membership does not certify presentation or purchase preparation. */
16
38
  export declare const PostPurchaseOfferEligibility: z.ZodDiscriminatedUnion<[z.ZodObject<{
17
39
  members: z.ZodArray<z.ZodObject<{
18
40
  productId: z.ZodNumber;
19
41
  productIndex: z.ZodNumber;
20
42
  }, z.core.$strip>>;
43
+ mode: z.ZodOptional<z.ZodLiteral<"sts">>;
21
44
  status: z.ZodLiteral<"retain">;
22
45
  }, z.core.$strip>, z.ZodObject<{
23
46
  reason: z.ZodEnum<{
@@ -26,7 +49,7 @@ export declare const PostPurchaseOfferEligibility: z.ZodDiscriminatedUnion<[z.Zo
26
49
  }>;
27
50
  status: z.ZodLiteral<"skip">;
28
51
  }, z.core.$strip>, z.ZodObject<{
29
- reason: z.ZodOptional<z.ZodLiteral<"eligible-upgrade">>;
52
+ reason: z.ZodOptional<z.ZodLiteral<"eligible-sts">>;
30
53
  status: z.ZodLiteral<"unavailable">;
31
54
  }, z.core.$strip>], "status">;
32
55
  export type PostPurchaseOfferEligibility = z.infer<typeof PostPurchaseOfferEligibility>;
@@ -51,6 +51,7 @@ export declare const PreparedPostPurchaseProduct: z.ZodObject<{
51
51
  compare_at_price: "compare_at_price";
52
52
  }>>>;
53
53
  gallery: z.ZodOptional<z.ZodObject<{
54
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
54
55
  images: z.ZodArray<z.ZodObject<{
55
56
  description: z.ZodString;
56
57
  id: z.ZodNumber;
@@ -215,6 +216,7 @@ export declare const PostPurchasePreparation: z.ZodDiscriminatedUnion<[z.ZodObje
215
216
  compare_at_price: "compare_at_price";
216
217
  }>>>;
217
218
  gallery: z.ZodOptional<z.ZodObject<{
219
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
218
220
  images: z.ZodArray<z.ZodObject<{
219
221
  description: z.ZodString;
220
222
  id: z.ZodNumber;
@@ -230,6 +230,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
230
230
  compare_at_price: "compare_at_price";
231
231
  }>>>;
232
232
  gallery: z.ZodOptional<z.ZodObject<{
233
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
233
234
  images: z.ZodArray<z.ZodObject<{
234
235
  description: z.ZodString;
235
236
  id: z.ZodNumber;
@@ -51,6 +51,7 @@ export declare const PostPurchaseProductDisplay: z.ZodObject<{
51
51
  compare_at_price: "compare_at_price";
52
52
  }>>>;
53
53
  gallery: z.ZodOptional<z.ZodObject<{
54
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
54
55
  images: z.ZodArray<z.ZodObject<{
55
56
  description: z.ZodString;
56
57
  id: z.ZodNumber;
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const PostPurchaseProductGallery: z.ZodObject<{
3
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
3
4
  images: z.ZodArray<z.ZodObject<{
4
5
  description: z.ZodString;
5
6
  id: z.ZodNumber;
@@ -233,6 +233,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
233
233
  compare_at_price: "compare_at_price";
234
234
  }>>>;
235
235
  gallery: z.ZodOptional<z.ZodObject<{
236
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
236
237
  images: z.ZodArray<z.ZodObject<{
237
238
  description: z.ZodString;
238
239
  id: z.ZodNumber;
@@ -108,7 +108,7 @@ export declare const PurchaseRecoveryResponseSchema: z.ZodObject<{
108
108
  currencyCode: z.ZodString;
109
109
  totalMinor: z.ZodNumber;
110
110
  }, z.core.$strict>>;
111
- upgrade: z.ZodOptional<z.ZodObject<{
111
+ sts: z.ZodOptional<z.ZodObject<{
112
112
  compensation: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
113
113
  attemptedAt: z.ZodNumber;
114
114
  status: z.ZodLiteral<"attempted">;
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * apiv2 `refund-product` for the upgrade's original one-time line. `failed` is a known refusal (nothing was
3
+ * apiv2 `refund-product` for the STS's original one-time line. `failed` is a known refusal (nothing was
4
4
  * refunded); `unknown` is a lost or ambiguous answer, which is never retried and never compensated blindly.
5
5
  */
6
- export declare const UpgradeRefundProgressSchema: z.ZodUnion<readonly [z.ZodObject<{
6
+ export declare const StsRefundProgressSchema: z.ZodUnion<readonly [z.ZodObject<{
7
7
  attemptedAt: z.ZodNumber;
8
8
  status: z.ZodLiteral<"attempted">;
9
9
  }, z.core.$strict>, z.ZodObject<{
@@ -20,7 +20,7 @@ export declare const UpgradeRefundProgressSchema: z.ZodUnion<readonly [z.ZodObje
20
20
  }>;
21
21
  }, z.core.$strict>]>;
22
22
  /** apiv2 `remove-subscription-product`: the rollback that runs only after a known refund failure. */
23
- export declare const UpgradeCompensationProgressSchema: z.ZodUnion<readonly [z.ZodObject<{
23
+ export declare const StsCompensationProgressSchema: z.ZodUnion<readonly [z.ZodObject<{
24
24
  attemptedAt: z.ZodNumber;
25
25
  status: z.ZodLiteral<"attempted">;
26
26
  }, z.core.$strict>, z.ZodObject<{
@@ -33,16 +33,16 @@ export declare const UpgradeCompensationProgressSchema: z.ZodUnion<readonly [z.Z
33
33
  }>;
34
34
  }, z.core.$strict>]>;
35
35
  /**
36
- * Why the upgrade is left for a person; `marker` is the `subscription_rollback_failed` metafield write. A
36
+ * Why the STS is left for a person; `marker` is the `subscription_rollback_failed` metafield write. A
37
37
  * `marker` of `unavailable` means the marker could not be written, NOT that no review is needed: the review
38
38
  * stands whatever the marker status.
39
39
  */
40
- export declare const UpgradeReviewReasonSchema: z.ZodEnum<{
40
+ export declare const StsReviewReasonSchema: z.ZodEnum<{
41
41
  "refund-unknown": "refund-unknown";
42
42
  "compensation-failed": "compensation-failed";
43
43
  "compensation-unknown": "compensation-unknown";
44
44
  }>;
45
- export declare const UpgradeReviewProgressSchema: z.ZodObject<{
45
+ export declare const StsReviewProgressSchema: z.ZodObject<{
46
46
  markedAt: z.ZodNumber;
47
47
  marker: z.ZodUnion<readonly [z.ZodEnum<{
48
48
  unknown: "unknown";
@@ -59,11 +59,11 @@ export declare const UpgradeReviewProgressSchema: z.ZodObject<{
59
59
  }>;
60
60
  }, z.core.$strict>;
61
61
  /**
62
- * The refund-compensation saga of one admitted upgrade, `null` steps not yet started. Compensation follows a
62
+ * The refund-compensation saga of one admitted STS, `null` steps not yet started. Compensation follows a
63
63
  * known refund failure only, and a review is recorded exactly when the outcome is unresolved (an unknown
64
- * refund, or a failed or unknown rollback), so a compensated or unresolved upgrade never reads as upgraded.
64
+ * refund, or a failed or unknown rollback), so a compensated or unresolved STS never reads as switched.
65
65
  */
66
- export declare const UpgradeProgressSchema: z.ZodObject<{
66
+ export declare const StsProgressSchema: z.ZodObject<{
67
67
  compensation: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
68
68
  attemptedAt: z.ZodNumber;
69
69
  status: z.ZodLiteral<"attempted">;
@@ -110,8 +110,8 @@ export declare const UpgradeProgressSchema: z.ZodObject<{
110
110
  }>;
111
111
  }, z.core.$strict>>;
112
112
  }, z.core.$strict>;
113
- export type UpgradeCompensationProgress = z.infer<typeof UpgradeCompensationProgressSchema>;
114
- export type UpgradeProgress = z.infer<typeof UpgradeProgressSchema>;
115
- export type UpgradeRefundProgress = z.infer<typeof UpgradeRefundProgressSchema>;
116
- export type UpgradeReviewProgress = z.infer<typeof UpgradeReviewProgressSchema>;
117
- export type UpgradeReviewReason = z.infer<typeof UpgradeReviewReasonSchema>;
113
+ export type StsCompensationProgress = z.infer<typeof StsCompensationProgressSchema>;
114
+ export type StsProgress = z.infer<typeof StsProgressSchema>;
115
+ export type StsRefundProgress = z.infer<typeof StsRefundProgressSchema>;
116
+ export type StsReviewProgress = z.infer<typeof StsReviewProgressSchema>;
117
+ export type StsReviewReason = z.infer<typeof StsReviewReasonSchema>;
@@ -44,6 +44,7 @@ export declare const PreparedPostPurchaseSubscription: z.ZodObject<{
44
44
  compare_at_price: "compare_at_price";
45
45
  }>>>;
46
46
  gallery: z.ZodOptional<z.ZodObject<{
47
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
47
48
  images: z.ZodArray<z.ZodObject<{
48
49
  description: z.ZodString;
49
50
  id: z.ZodNumber;
@@ -240,6 +241,7 @@ export declare const readPostPurchaseSubscription: (prepared: z.infer<typeof Pre
240
241
  source: string;
241
242
  thumbnail: string;
242
243
  }[];
244
+ hasMultiple?: boolean | undefined;
243
245
  selectedImageId?: number | undefined;
244
246
  } | undefined;
245
247
  };