@rebuy/rebuy 3.52.0 → 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.
- package/dist/index.cjs +44 -34
- package/dist/index.mjs +44 -34
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/postPurchaseAdmission.d.ts +6 -6
- package/dist/schema/postPurchaseFollowups.d.ts +1 -1
- package/dist/schema/postPurchaseOfferEligibility.d.ts +24 -1
- package/dist/schema/postPurchaseRecovery.d.ts +1 -1
- package/dist/schema/{postPurchaseUpgrade.d.ts → postPurchaseSts.d.ts} +14 -14
- package/dist/server/__fixtures__/postPurchaseSts.d.ts +98 -0
- package/dist/server/classifyPostPurchaseOffer.d.ts +4 -2
- package/dist/server/index.cjs +163 -82
- package/dist/server/index.mjs +163 -82
- package/dist/server/postPurchaseProductGallery.d.ts +3 -2
- package/dist/server/postPurchaseSts.d.ts +1293 -0
- package/dist/server/preparePostPurchaseCollectionView.d.ts +4 -1
- package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +7 -0
- package/dist/server/preparePostPurchaseGroupDefault.d.ts +7 -0
- package/dist/server/preparePostPurchaseGroupView.d.ts +7 -0
- package/dist/server/preparePostPurchaseMemberView.d.ts +815 -1
- package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +11 -1
- package/dist/server/preparePostPurchaseQuantityView.d.ts +11 -1
- package/dist/server/preparePostPurchaseStsMember.d.ts +824 -0
- package/dist/server/readPostPurchaseQuantity.d.ts +4 -1
- 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,
|
|
@@ -1784,9 +1786,9 @@ var import_zod18 = require("zod");
|
|
|
1784
1786
|
var import_zod9 = require("zod");
|
|
1785
1787
|
var PostPurchaseProductGallery = import_zod9.z.object({
|
|
1786
1788
|
/**
|
|
1787
|
-
*
|
|
1788
|
-
*
|
|
1789
|
-
* before slicing). Older replies omit it; fall back to `images.length > 1`.
|
|
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`.
|
|
1790
1792
|
*/
|
|
1791
1793
|
hasMultiple: import_zod9.z.boolean().optional(),
|
|
1792
1794
|
images: import_zod9.z.array(
|
|
@@ -2914,7 +2916,7 @@ var PostPurchaseProductChangeset = import_zod23.z.object({
|
|
|
2914
2916
|
});
|
|
2915
2917
|
|
|
2916
2918
|
// src/schema/postPurchaseAdmission.ts
|
|
2917
|
-
var PurchaseAdmissionModeSchema = import_zod24.z.enum(["purchase", "
|
|
2919
|
+
var PurchaseAdmissionModeSchema = import_zod24.z.enum(["purchase", "sts"]);
|
|
2918
2920
|
var selection = PreparedPostPurchaseProduct.shape.selection;
|
|
2919
2921
|
var EventCalculationSchema = PostPurchaseProductCosts.pick({ currencyCode: true, totalMinor: true }).strict();
|
|
2920
2922
|
var PurchaseExpectedSchema = import_zod24.z.object({
|
|
@@ -2936,8 +2938,8 @@ var PurchaseExpectedSchema = import_zod24.z.object({
|
|
|
2936
2938
|
({ member, progressRevision }) => !member || progressRevision !== void 0,
|
|
2937
2939
|
"Captured member requires progress"
|
|
2938
2940
|
).refine(
|
|
2939
|
-
({ mode, selection: { sellingPlanId } }) => mode !== "
|
|
2940
|
-
"An
|
|
2941
|
+
({ mode, selection: { sellingPlanId } }) => mode !== "sts" || sellingPlanId !== void 0,
|
|
2942
|
+
"An STS selects a subscription"
|
|
2941
2943
|
).refine(({ buyerConsentToSubscriptions: consent, changeset, selection: selection3 }) => {
|
|
2942
2944
|
const [change, shipping] = changeset.changes;
|
|
2943
2945
|
if (selection3.sellingPlanId === void 0)
|
|
@@ -2953,7 +2955,7 @@ var PurchaseReceiptSchema = import_zod24.z.object({
|
|
|
2953
2955
|
changesetToken: import_zod24.z.string().min(1),
|
|
2954
2956
|
mode: PurchaseAdmissionModeSchema.optional(),
|
|
2955
2957
|
operationId: import_zod24.z.uuid(),
|
|
2956
|
-
/** The server-bound one-time line an
|
|
2958
|
+
/** The server-bound one-time line an STS refunds; its quantity is the order's, not the selection's. */
|
|
2957
2959
|
originalLine: import_zod24.z.strictObject({ quantity: selection.shape.quantity, variantId: selection.shape.variantId }).optional(),
|
|
2958
2960
|
requiresSubscriptionConsent: import_zod24.z.boolean(),
|
|
2959
2961
|
selection
|
|
@@ -2961,8 +2963,8 @@ var PurchaseReceiptSchema = import_zod24.z.object({
|
|
|
2961
2963
|
({ requiresSubscriptionConsent, selection: selection3 }) => requiresSubscriptionConsent === (selection3.sellingPlanId !== void 0),
|
|
2962
2964
|
"Receipt consent must match its selected plan"
|
|
2963
2965
|
).refine(
|
|
2964
|
-
({ mode, originalLine, selection: { sellingPlanId, variantId } }) => mode === "
|
|
2965
|
-
"An
|
|
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"
|
|
2966
2968
|
);
|
|
2967
2969
|
var PurchaseResponseSchema = import_zod24.z.object({ data: PurchaseReceiptSchema, successful: import_zod24.z.literal(true) });
|
|
2968
2970
|
|
|
@@ -3288,24 +3290,24 @@ var PurchaseObservationResponseSchema = import_zod41.z.object({
|
|
|
3288
3290
|
successful: import_zod41.z.literal(true)
|
|
3289
3291
|
});
|
|
3290
3292
|
|
|
3291
|
-
// src/schema/
|
|
3293
|
+
// src/schema/postPurchaseSts.ts
|
|
3292
3294
|
var import_zod42 = require("zod");
|
|
3293
3295
|
var AttemptSchema2 = import_zod42.z.strictObject({ attemptedAt: PostPurchaseTimestampSchema, status: import_zod42.z.literal("attempted") });
|
|
3294
3296
|
var FinishedSchema = AttemptSchema2.extend({ finishedAt: PostPurchaseTimestampSchema });
|
|
3295
|
-
var
|
|
3297
|
+
var StsRefundProgressSchema = import_zod42.z.union([
|
|
3296
3298
|
AttemptSchema2,
|
|
3297
3299
|
FinishedSchema.extend({ refundId: import_zod42.z.string().min(1), status: import_zod42.z.literal("refunded") }),
|
|
3298
3300
|
FinishedSchema.extend({ status: import_zod42.z.enum(["failed", "unknown"]) })
|
|
3299
3301
|
]);
|
|
3300
|
-
var
|
|
3302
|
+
var StsCompensationProgressSchema = import_zod42.z.union([
|
|
3301
3303
|
AttemptSchema2,
|
|
3302
3304
|
FinishedSchema.extend({ status: import_zod42.z.enum(["removed", "failed", "unknown"]) })
|
|
3303
3305
|
]);
|
|
3304
|
-
var
|
|
3305
|
-
var
|
|
3306
|
+
var StsReviewReasonSchema = import_zod42.z.enum(["refund-unknown", "compensation-failed", "compensation-unknown"]);
|
|
3307
|
+
var StsReviewProgressSchema = import_zod42.z.strictObject({
|
|
3306
3308
|
markedAt: PostPurchaseTimestampSchema,
|
|
3307
3309
|
marker: AcceptedMetafieldResultSchema.shape.status,
|
|
3308
|
-
reason:
|
|
3310
|
+
reason: StsReviewReasonSchema
|
|
3309
3311
|
});
|
|
3310
3312
|
var reviewReason = (refund, compensation) => {
|
|
3311
3313
|
if (refund?.status === "unknown") return "refund-unknown";
|
|
@@ -3313,11 +3315,11 @@ var reviewReason = (refund, compensation) => {
|
|
|
3313
3315
|
return `compensation-${compensation.status}`;
|
|
3314
3316
|
return null;
|
|
3315
3317
|
};
|
|
3316
|
-
var
|
|
3317
|
-
compensation:
|
|
3318
|
+
var StsProgressSchema = import_zod42.z.strictObject({
|
|
3319
|
+
compensation: StsCompensationProgressSchema.nullable(),
|
|
3318
3320
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
3319
|
-
refund:
|
|
3320
|
-
review:
|
|
3321
|
+
refund: StsRefundProgressSchema.nullable(),
|
|
3322
|
+
review: StsReviewProgressSchema.nullable()
|
|
3321
3323
|
}).refine(
|
|
3322
3324
|
({ compensation, refund }) => compensation === null || refund?.status === "failed",
|
|
3323
3325
|
"Compensation follows a known refund failure only"
|
|
@@ -3340,11 +3342,11 @@ var AcceptedFollowupsResponseSchema = import_zod43.z.object({
|
|
|
3340
3342
|
acceptedMetafield: AcceptedMetafieldResultSchema,
|
|
3341
3343
|
health: RequiredHealthSchema,
|
|
3342
3344
|
purchase: PurchaseObservationResponseSchema.shape.data,
|
|
3343
|
-
/** Present only for an
|
|
3344
|
-
|
|
3345
|
-
}).refine(({ purchase,
|
|
3346
|
-
message: "
|
|
3347
|
-
path: ["
|
|
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"]
|
|
3348
3350
|
}),
|
|
3349
3351
|
successful: import_zod43.z.literal(true)
|
|
3350
3352
|
});
|
|
@@ -4755,15 +4757,23 @@ var PostPurchaseOfferEligibilityContext = import_zod77.z.object({
|
|
|
4755
4757
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
4756
4758
|
originalLineItems: import_zod77.z.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
4757
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
|
+
});
|
|
4758
4766
|
var PostPurchaseOfferEligibility = import_zod77.z.discriminatedUnion("status", [
|
|
4759
4767
|
import_zod77.z.object({
|
|
4760
4768
|
members: import_zod77.z.array(
|
|
4761
4769
|
import_zod77.z.object({ productId: selection2.shape.productId, productIndex: import_zod77.z.number().int().nonnegative() })
|
|
4762
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(),
|
|
4763
4773
|
status: import_zod77.z.literal("retain")
|
|
4764
4774
|
}),
|
|
4765
4775
|
import_zod77.z.object({ reason: PostPurchaseOfferSkipReason, status: import_zod77.z.literal("skip") }),
|
|
4766
|
-
import_zod77.z.object({ reason: import_zod77.z.literal("eligible-
|
|
4776
|
+
import_zod77.z.object({ reason: import_zod77.z.literal("eligible-sts").optional(), status: import_zod77.z.literal("unavailable") })
|
|
4767
4777
|
]);
|
|
4768
4778
|
|
|
4769
4779
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
@@ -4871,10 +4881,10 @@ var PurchaseRecoveryResponseSchema = import_zod83.z.object({
|
|
|
4871
4881
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
4872
4882
|
/** The total the buyer affirmed at admission; absent for an operation admitted without one. */
|
|
4873
4883
|
reportedCalculation: EventCalculationSchema.optional(),
|
|
4874
|
-
|
|
4875
|
-
}).strict().refine(({ operationId,
|
|
4876
|
-
message: "
|
|
4877
|
-
path: ["
|
|
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"]
|
|
4878
4888
|
}).refine(
|
|
4879
4889
|
({ followups, operationId }) => !followups?.acceptedEvent || followups.acceptedEvent.operationId === operationId,
|
|
4880
4890
|
{ message: "Follow-up progress belongs to its operation", path: ["followups", "acceptedEvent"] }
|
package/dist/index.mjs
CHANGED
|
@@ -1312,9 +1312,9 @@ import { z as z18 } from "zod";
|
|
|
1312
1312
|
import { z as z9 } from "zod";
|
|
1313
1313
|
var PostPurchaseProductGallery = z9.object({
|
|
1314
1314
|
/**
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
* before slicing). Older replies omit it; fall back to `images.length > 1`.
|
|
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
1318
|
*/
|
|
1319
1319
|
hasMultiple: z9.boolean().optional(),
|
|
1320
1320
|
images: z9.array(
|
|
@@ -2442,7 +2442,7 @@ var PostPurchaseProductChangeset = z23.object({
|
|
|
2442
2442
|
});
|
|
2443
2443
|
|
|
2444
2444
|
// src/schema/postPurchaseAdmission.ts
|
|
2445
|
-
var PurchaseAdmissionModeSchema = z24.enum(["purchase", "
|
|
2445
|
+
var PurchaseAdmissionModeSchema = z24.enum(["purchase", "sts"]);
|
|
2446
2446
|
var selection = PreparedPostPurchaseProduct.shape.selection;
|
|
2447
2447
|
var EventCalculationSchema = PostPurchaseProductCosts.pick({ currencyCode: true, totalMinor: true }).strict();
|
|
2448
2448
|
var PurchaseExpectedSchema = z24.object({
|
|
@@ -2464,8 +2464,8 @@ var PurchaseExpectedSchema = z24.object({
|
|
|
2464
2464
|
({ member, progressRevision }) => !member || progressRevision !== void 0,
|
|
2465
2465
|
"Captured member requires progress"
|
|
2466
2466
|
).refine(
|
|
2467
|
-
({ mode, selection: { sellingPlanId } }) => mode !== "
|
|
2468
|
-
"An
|
|
2467
|
+
({ mode, selection: { sellingPlanId } }) => mode !== "sts" || sellingPlanId !== void 0,
|
|
2468
|
+
"An STS selects a subscription"
|
|
2469
2469
|
).refine(({ buyerConsentToSubscriptions: consent, changeset, selection: selection3 }) => {
|
|
2470
2470
|
const [change, shipping] = changeset.changes;
|
|
2471
2471
|
if (selection3.sellingPlanId === void 0)
|
|
@@ -2481,7 +2481,7 @@ var PurchaseReceiptSchema = z24.object({
|
|
|
2481
2481
|
changesetToken: z24.string().min(1),
|
|
2482
2482
|
mode: PurchaseAdmissionModeSchema.optional(),
|
|
2483
2483
|
operationId: z24.uuid(),
|
|
2484
|
-
/** The server-bound one-time line an
|
|
2484
|
+
/** The server-bound one-time line an STS refunds; its quantity is the order's, not the selection's. */
|
|
2485
2485
|
originalLine: z24.strictObject({ quantity: selection.shape.quantity, variantId: selection.shape.variantId }).optional(),
|
|
2486
2486
|
requiresSubscriptionConsent: z24.boolean(),
|
|
2487
2487
|
selection
|
|
@@ -2489,8 +2489,8 @@ var PurchaseReceiptSchema = z24.object({
|
|
|
2489
2489
|
({ requiresSubscriptionConsent, selection: selection3 }) => requiresSubscriptionConsent === (selection3.sellingPlanId !== void 0),
|
|
2490
2490
|
"Receipt consent must match its selected plan"
|
|
2491
2491
|
).refine(
|
|
2492
|
-
({ mode, originalLine, selection: { sellingPlanId, variantId } }) => mode === "
|
|
2493
|
-
"An
|
|
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"
|
|
2494
2494
|
);
|
|
2495
2495
|
var PurchaseResponseSchema = z24.object({ data: PurchaseReceiptSchema, successful: z24.literal(true) });
|
|
2496
2496
|
|
|
@@ -2816,24 +2816,24 @@ var PurchaseObservationResponseSchema = z41.object({
|
|
|
2816
2816
|
successful: z41.literal(true)
|
|
2817
2817
|
});
|
|
2818
2818
|
|
|
2819
|
-
// src/schema/
|
|
2819
|
+
// src/schema/postPurchaseSts.ts
|
|
2820
2820
|
import { z as z42 } from "zod";
|
|
2821
2821
|
var AttemptSchema2 = z42.strictObject({ attemptedAt: PostPurchaseTimestampSchema, status: z42.literal("attempted") });
|
|
2822
2822
|
var FinishedSchema = AttemptSchema2.extend({ finishedAt: PostPurchaseTimestampSchema });
|
|
2823
|
-
var
|
|
2823
|
+
var StsRefundProgressSchema = z42.union([
|
|
2824
2824
|
AttemptSchema2,
|
|
2825
2825
|
FinishedSchema.extend({ refundId: z42.string().min(1), status: z42.literal("refunded") }),
|
|
2826
2826
|
FinishedSchema.extend({ status: z42.enum(["failed", "unknown"]) })
|
|
2827
2827
|
]);
|
|
2828
|
-
var
|
|
2828
|
+
var StsCompensationProgressSchema = z42.union([
|
|
2829
2829
|
AttemptSchema2,
|
|
2830
2830
|
FinishedSchema.extend({ status: z42.enum(["removed", "failed", "unknown"]) })
|
|
2831
2831
|
]);
|
|
2832
|
-
var
|
|
2833
|
-
var
|
|
2832
|
+
var StsReviewReasonSchema = z42.enum(["refund-unknown", "compensation-failed", "compensation-unknown"]);
|
|
2833
|
+
var StsReviewProgressSchema = z42.strictObject({
|
|
2834
2834
|
markedAt: PostPurchaseTimestampSchema,
|
|
2835
2835
|
marker: AcceptedMetafieldResultSchema.shape.status,
|
|
2836
|
-
reason:
|
|
2836
|
+
reason: StsReviewReasonSchema
|
|
2837
2837
|
});
|
|
2838
2838
|
var reviewReason = (refund, compensation) => {
|
|
2839
2839
|
if (refund?.status === "unknown") return "refund-unknown";
|
|
@@ -2841,11 +2841,11 @@ var reviewReason = (refund, compensation) => {
|
|
|
2841
2841
|
return `compensation-${compensation.status}`;
|
|
2842
2842
|
return null;
|
|
2843
2843
|
};
|
|
2844
|
-
var
|
|
2845
|
-
compensation:
|
|
2844
|
+
var StsProgressSchema = z42.strictObject({
|
|
2845
|
+
compensation: StsCompensationProgressSchema.nullable(),
|
|
2846
2846
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
2847
|
-
refund:
|
|
2848
|
-
review:
|
|
2847
|
+
refund: StsRefundProgressSchema.nullable(),
|
|
2848
|
+
review: StsReviewProgressSchema.nullable()
|
|
2849
2849
|
}).refine(
|
|
2850
2850
|
({ compensation, refund }) => compensation === null || refund?.status === "failed",
|
|
2851
2851
|
"Compensation follows a known refund failure only"
|
|
@@ -2868,11 +2868,11 @@ var AcceptedFollowupsResponseSchema = z43.object({
|
|
|
2868
2868
|
acceptedMetafield: AcceptedMetafieldResultSchema,
|
|
2869
2869
|
health: RequiredHealthSchema,
|
|
2870
2870
|
purchase: PurchaseObservationResponseSchema.shape.data,
|
|
2871
|
-
/** Present only for an
|
|
2872
|
-
|
|
2873
|
-
}).refine(({ purchase,
|
|
2874
|
-
message: "
|
|
2875
|
-
path: ["
|
|
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"]
|
|
2876
2876
|
}),
|
|
2877
2877
|
successful: z43.literal(true)
|
|
2878
2878
|
});
|
|
@@ -4283,15 +4283,23 @@ var PostPurchaseOfferEligibilityContext = z77.object({
|
|
|
4283
4283
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
4284
4284
|
originalLineItems: z77.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
4285
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
|
+
});
|
|
4286
4292
|
var PostPurchaseOfferEligibility = z77.discriminatedUnion("status", [
|
|
4287
4293
|
z77.object({
|
|
4288
4294
|
members: z77.array(
|
|
4289
4295
|
z77.object({ productId: selection2.shape.productId, productIndex: z77.number().int().nonnegative() })
|
|
4290
4296
|
),
|
|
4297
|
+
/** Present only with STS on: each member switches one original one-time line to subscription. */
|
|
4298
|
+
mode: z77.literal("sts").optional(),
|
|
4291
4299
|
status: z77.literal("retain")
|
|
4292
4300
|
}),
|
|
4293
4301
|
z77.object({ reason: PostPurchaseOfferSkipReason, status: z77.literal("skip") }),
|
|
4294
|
-
z77.object({ reason: z77.literal("eligible-
|
|
4302
|
+
z77.object({ reason: z77.literal("eligible-sts").optional(), status: z77.literal("unavailable") })
|
|
4295
4303
|
]);
|
|
4296
4304
|
|
|
4297
4305
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
@@ -4399,10 +4407,10 @@ var PurchaseRecoveryResponseSchema = z83.object({
|
|
|
4399
4407
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
4400
4408
|
/** The total the buyer affirmed at admission; absent for an operation admitted without one. */
|
|
4401
4409
|
reportedCalculation: EventCalculationSchema.optional(),
|
|
4402
|
-
|
|
4403
|
-
}).strict().refine(({ operationId,
|
|
4404
|
-
message: "
|
|
4405
|
-
path: ["
|
|
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"]
|
|
4406
4414
|
}).refine(
|
|
4407
4415
|
({ followups, operationId }) => !followups?.acceptedEvent || followups.acceptedEvent.operationId === operationId,
|
|
4408
4416
|
{ message: "Follow-up progress belongs to its operation", path: ["followups", "acceptedEvent"] }
|
|
@@ -6752,6 +6760,8 @@ export {
|
|
|
6752
6760
|
PostPurchaseShadowSelectionSchema,
|
|
6753
6761
|
PostPurchaseSkipReasonSchema,
|
|
6754
6762
|
PostPurchaseSkipTraceSchema,
|
|
6763
|
+
PostPurchaseStsContext,
|
|
6764
|
+
PostPurchaseStsOptions,
|
|
6755
6765
|
PostPurchaseSubscriptionDisplay,
|
|
6756
6766
|
PostPurchaseSubscriptionTerms,
|
|
6757
6767
|
PostPurchaseTimestampSchema,
|
|
@@ -6843,6 +6853,11 @@ export {
|
|
|
6843
6853
|
SmartCartTierExclusion,
|
|
6844
6854
|
SmartCartTierProduct,
|
|
6845
6855
|
Spacing,
|
|
6856
|
+
StsCompensationProgressSchema,
|
|
6857
|
+
StsProgressSchema,
|
|
6858
|
+
StsRefundProgressSchema,
|
|
6859
|
+
StsReviewProgressSchema,
|
|
6860
|
+
StsReviewReasonSchema,
|
|
6846
6861
|
TextAlignment,
|
|
6847
6862
|
TextBlock,
|
|
6848
6863
|
TextColorName,
|
|
@@ -6853,11 +6868,6 @@ export {
|
|
|
6853
6868
|
TiptapParagraph,
|
|
6854
6869
|
TiptapText,
|
|
6855
6870
|
UI_LABELS,
|
|
6856
|
-
UpgradeCompensationProgressSchema,
|
|
6857
|
-
UpgradeProgressSchema,
|
|
6858
|
-
UpgradeRefundProgressSchema,
|
|
6859
|
-
UpgradeReviewProgressSchema,
|
|
6860
|
-
UpgradeReviewReasonSchema,
|
|
6861
6871
|
UserConfig,
|
|
6862
6872
|
VariableEffect,
|
|
6863
6873
|
VariableType,
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -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 './
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
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>;
|
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
64
|
+
* refund, or a failed or unknown rollback), so a compensated or unresolved STS never reads as switched.
|
|
65
65
|
*/
|
|
66
|
-
export declare const
|
|
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
|
|
114
|
-
export type
|
|
115
|
-
export type
|
|
116
|
-
export type
|
|
117
|
-
export type
|
|
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>;
|