@rebuy/rebuy 3.34.0 → 3.35.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 +878 -794
- package/dist/index.mjs +879 -795
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/postPurchaseGroupCatalog.d.ts +56 -0
- package/dist/schema/postPurchaseOfferEligibility.d.ts +32 -0
- package/dist/schema/postPurchaseOfferPresentation.d.ts +386 -0
- package/dist/schema/postPurchaseProductSource.d.ts +10 -5
- package/dist/schema/postPurchaseQuantity.d.ts +13 -0
- package/dist/schema/postPurchaseVariantDefault.d.ts +17 -0
- package/dist/schema/postPurchaseVariantDefaultContext.d.ts +10 -0
- package/dist/server/__fixtures__/postPurchaseGroup.d.ts +75 -0
- package/dist/server/classifyPostPurchaseOffer.d.ts +3 -0
- package/dist/server/createPostPurchaseOrderAttributes.d.ts +9 -0
- package/dist/server/index.cjs +605 -192
- package/dist/server/index.d.ts +8 -1
- package/dist/server/index.mjs +605 -192
- package/dist/server/postPurchaseMemberEligibility.d.ts +7 -0
- package/dist/server/postPurchaseOfferCopy.d.ts +3 -0
- package/dist/server/postPurchaseProductEligibility.d.ts +3 -7
- package/dist/server/postPurchaseSubscriptionEligibility.d.ts +2 -3
- package/dist/server/prepareNormalizedSubscription.d.ts +2 -3
- package/dist/server/preparePostPurchaseGroupDeclineDisplay.d.ts +12 -0
- package/dist/server/preparePostPurchaseOfferPresentation.d.ts +137 -0
- package/dist/server/projectPostPurchaseProduct.d.ts +5 -7
- package/dist/server/readPostPurchaseGroup.d.ts +101 -0
- package/dist/server/readPostPurchaseGroupSelection.d.ts +110 -0
- package/dist/server/readPostPurchaseQuantity.d.ts +27 -0
- package/dist/server/resolvePostPurchaseMemberDefault.d.ts +8 -0
- package/dist/server/selectPostPurchaseChoice.d.ts +2 -3
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PostPurchaseExcludedProductIds } from '../schema/postPurchaseProductCollectionView';
|
|
2
|
+
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
3
|
+
/** The member's catalog is readable, but no variant is in stock. */
|
|
4
|
+
export declare class PostPurchaseInventoryUnavailable extends Error {
|
|
5
|
+
}
|
|
6
|
+
/** Catalog facts only: preparation still owns defaults, quantity, terms, and presentation. */
|
|
7
|
+
export declare const postPurchaseMemberEligibility: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, product: ReturnType<typeof normalizePostPurchaseProduct>["data"][number], excluded?: PostPurchaseExcludedProductIds) => boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PostPurchaseProductSource } from '../schema/postPurchaseProductSource';
|
|
2
|
+
/** Response copy belongs to this conversion and overrides only the first callout's truthy fields. */
|
|
3
|
+
export declare const postPurchaseOfferCopy: (blocks: unknown[] | undefined, metadata: PostPurchaseProductSource["metadata"]) => unknown[] | undefined;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export declare const oneTimeUnavailable: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, allowCollection: boolean, quantity?: {
|
|
7
|
-
quantity: number;
|
|
8
|
-
}) => "Only one fixed product and variant are supported" | "Only fixed one-time configuration is supported" | "An available one-time variant without product groups is required" | undefined;
|
|
2
|
+
import type { PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
|
|
3
|
+
/** The same eligibility rule drives advertised modes and their prepared terms. */
|
|
4
|
+
export declare const oneTimeUnavailable: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, allowCollection: boolean, quantity?: PostPurchaseQuantity) => "Only one fixed product and variant are supported" | "Only fixed one-time configuration is supported" | "An available one-time variant without product groups is required" | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PostPurchasePlanOption } from '../schema/postPurchasePlanCatalog';
|
|
2
2
|
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) => "An eligible subscription plan with supported shipping and discount is required" | undefined;
|
|
3
|
+
import type { PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
|
|
4
|
+
export declare const subscriptionUnavailable: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, plan: PostPurchasePlanOption | undefined, allowCollection: boolean, quantity?: PostPurchaseQuantity) => "An eligible subscription plan with supported shipping and discount is required" | undefined;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { PostPurchasePlanOption } from '../schema/postPurchasePlanCatalog';
|
|
2
2
|
import { type PostPurchasePreparation } from '../schema/postPurchaseProduct';
|
|
3
3
|
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
4
|
+
import type { PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
|
|
4
5
|
import type { Reporter } from '../server/shared';
|
|
5
6
|
/**
|
|
6
7
|
* Preparation for one allocated plan with validated configured shipping and discount. `report` is kept in the
|
|
7
8
|
* frozen position for Slice 26, whose review projection is the only consumer inside `projectPostPurchaseProduct`.
|
|
8
9
|
*/
|
|
9
|
-
export declare const prepareNormalizedSubscription: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, report: Reporter | undefined, plan: PostPurchasePlanOption | undefined, quantity?:
|
|
10
|
-
quantity: number;
|
|
11
|
-
}, allowCollection?: boolean) => PostPurchasePreparation;
|
|
10
|
+
export declare const prepareNormalizedSubscription: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, report: Reporter | undefined, plan: PostPurchasePlanOption | undefined, quantity?: PostPurchaseQuantity, allowCollection?: boolean) => PostPurchasePreparation;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PostPurchaseGroupSelection } from '../schema/postPurchaseGroupCatalog';
|
|
2
|
+
import type { PostPurchaseExcludedProductIds } from '../schema/postPurchaseProductCollectionView';
|
|
3
|
+
import type { PostPurchaseVariantSelector } from '../schema/postPurchaseVariantCatalog';
|
|
4
|
+
/** Decline display validates association without requiring financial or plan eligibility. */
|
|
5
|
+
export declare const preparePostPurchaseGroupDeclineDisplay: (settings: unknown, response: unknown, requested: PostPurchaseGroupSelection & PostPurchaseVariantSelector, excludedProductIds?: PostPurchaseExcludedProductIds) => {
|
|
6
|
+
display: {
|
|
7
|
+
productTitle: string;
|
|
8
|
+
variantId: number;
|
|
9
|
+
variantTitle: string;
|
|
10
|
+
};
|
|
11
|
+
productIndex: number;
|
|
12
|
+
} | null;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type Reporter } from '../server/shared';
|
|
2
|
+
/** An Offer frame consumes effective settings and metadata, never a purchasable product. */
|
|
3
|
+
export declare const preparePostPurchaseOfferPresentation: (widgetId: number, settings: unknown, response: unknown, report?: Reporter) => {
|
|
4
|
+
labels: {
|
|
5
|
+
declineAll: string;
|
|
6
|
+
declineThisOffer: string;
|
|
7
|
+
};
|
|
8
|
+
layout: {
|
|
9
|
+
type: "grid" | "carousel" | "list";
|
|
10
|
+
itemsPerPage?: number | undefined;
|
|
11
|
+
};
|
|
12
|
+
sections: {
|
|
13
|
+
alignment: {
|
|
14
|
+
horizontal: "start" | "center" | "end";
|
|
15
|
+
vertical: "top" | "middle" | "bottom";
|
|
16
|
+
};
|
|
17
|
+
border: {
|
|
18
|
+
radius: "small" | "none" | "base" | "large" | "fullyRounded";
|
|
19
|
+
style: "none" | "base" | "dotted" | "dashed";
|
|
20
|
+
width: "base" | "medium" | "thick";
|
|
21
|
+
};
|
|
22
|
+
direction: "columns" | "rows" | "grid";
|
|
23
|
+
padding: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
|
|
24
|
+
sectionId: string;
|
|
25
|
+
sections: never[] | import("..").CABSection[];
|
|
26
|
+
sectionType: "layout";
|
|
27
|
+
spacing: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
|
|
28
|
+
width: number;
|
|
29
|
+
editorMode: "checkoutExtension" | "postPurchaseOffer" | "thankYouPage" | "orderStatusPage" | "ordersIndexPage" | "customerProfilePage";
|
|
30
|
+
previewMode: boolean;
|
|
31
|
+
storeId: number | null;
|
|
32
|
+
targetArea: {
|
|
33
|
+
icon: string;
|
|
34
|
+
label: string;
|
|
35
|
+
width: string;
|
|
36
|
+
fill?: boolean | undefined;
|
|
37
|
+
flip?: "vertical" | "horizontal" | "both" | undefined;
|
|
38
|
+
} | null;
|
|
39
|
+
tracking: {
|
|
40
|
+
enableAttribution: boolean;
|
|
41
|
+
enableSource: boolean;
|
|
42
|
+
enableWidget: boolean;
|
|
43
|
+
};
|
|
44
|
+
type: "product" | "bundle_builder" | "cart" | "cart_subscription" | "dynamic_bundle" | "gift_with_purchase" | "placeholder" | "pre_purchase" | "product_addon" | "product_upsell" | "recharge_checkout" | "recharge_customer_portal" | "recharge_post_purchase" | "shopify_checkout" | "shopify_checkout_extension" | "shopify_post_purchase" | "shopify_post_purchase_extension" | "switch_to_subscription" | "ui_extension_ad" | "ui_extension_button" | "ui_extension_content_block" | "ui_extension_line_item_editor" | "ui_extension_progress_bar";
|
|
45
|
+
uiLabels: {
|
|
46
|
+
currentPage: Record<string, string>;
|
|
47
|
+
guest: Record<string, string>;
|
|
48
|
+
loadingOptions: Record<string, string>;
|
|
49
|
+
nextPage: Record<string, string>;
|
|
50
|
+
offerCarousel: Record<string, string>;
|
|
51
|
+
offerDialog: Record<string, string>;
|
|
52
|
+
page: Record<string, string>;
|
|
53
|
+
previousPage: Record<string, string>;
|
|
54
|
+
selected: Record<string, string>;
|
|
55
|
+
subscriptionOptions: Record<string, string>;
|
|
56
|
+
updating: Record<string, string>;
|
|
57
|
+
};
|
|
58
|
+
version: 2;
|
|
59
|
+
widgetId: number | null;
|
|
60
|
+
buttonField?: "declineAllOffers" | "declineOffer" | "removeFromOrder" | "undoAddToOrder" | "activePage" | "addedToCart" | "addingToCart" | "addToCart" | "buttonLabel" | "destinationUrl" | "inactivePage" | "overlayContent" | "payNow" | "progressReached" | "progressRemaining" | "redirectToCheckout" | "showVariant" | "showVariants" | "soldOut" | "subscriptionOption" | "switchToOneTimePurchase" | "switchToSubscriptionNoDiscount" | "switchToSubscriptionWithDiscount" | undefined;
|
|
61
|
+
frame?: "callout" | "offer-content" | undefined;
|
|
62
|
+
grid?: {
|
|
63
|
+
columns: (string | number)[];
|
|
64
|
+
rows: (string | number)[];
|
|
65
|
+
} | undefined;
|
|
66
|
+
name?: string | undefined;
|
|
67
|
+
viewUrl?: string | undefined;
|
|
68
|
+
wrapping?: {
|
|
69
|
+
breakAt: number;
|
|
70
|
+
maxPerLine: number;
|
|
71
|
+
} | undefined;
|
|
72
|
+
mutators?: {
|
|
73
|
+
effect: "set_false" | "set_true" | "toggle";
|
|
74
|
+
variable: string;
|
|
75
|
+
when: {
|
|
76
|
+
operator: "is_empty" | "is_not_empty";
|
|
77
|
+
type: "content";
|
|
78
|
+
} | {
|
|
79
|
+
operator: "equals" | "greater_than" | "less_than";
|
|
80
|
+
type: "result_count";
|
|
81
|
+
value: number;
|
|
82
|
+
} | {
|
|
83
|
+
operator: "contains" | "does_not_contain";
|
|
84
|
+
type: "result_tag";
|
|
85
|
+
value: string;
|
|
86
|
+
} | {
|
|
87
|
+
event: "item_added" | "quantity_changed" | "variant_selected";
|
|
88
|
+
type: "event";
|
|
89
|
+
};
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
variables?: ({
|
|
92
|
+
defaultValue: string;
|
|
93
|
+
name: string;
|
|
94
|
+
type: "text";
|
|
95
|
+
seed?: undefined;
|
|
96
|
+
} | {
|
|
97
|
+
defaultValue: number;
|
|
98
|
+
name: string;
|
|
99
|
+
type: "number";
|
|
100
|
+
seed?: undefined;
|
|
101
|
+
} | {
|
|
102
|
+
defaultValue: boolean;
|
|
103
|
+
name: string;
|
|
104
|
+
type: "boolean";
|
|
105
|
+
seed?: {
|
|
106
|
+
dataSourceId: number | null;
|
|
107
|
+
ruleset: {
|
|
108
|
+
exitIfMatched: boolean;
|
|
109
|
+
logic: {
|
|
110
|
+
rules: {
|
|
111
|
+
operator: "equals" | "greater_than" | "less_than" | "contains" | "does_not_contain" | "after" | "anything" | "before" | "contains_any" | "does_not_contain_any" | "does_not_equal";
|
|
112
|
+
products: never[] | unknown[];
|
|
113
|
+
type: "product" | "date" | "cart" | "cart_count" | "cart_item_count" | "cart_line_count" | "cart_subtotal" | "collection" | "customer" | "customer_order_count" | "customer_tag" | "customer_total_spent" | "product_tag" | "product_title" | "product_type" | "product_vendor";
|
|
114
|
+
value: string;
|
|
115
|
+
}[];
|
|
116
|
+
}[];
|
|
117
|
+
output: {
|
|
118
|
+
key: string;
|
|
119
|
+
type: "data_json";
|
|
120
|
+
value: string;
|
|
121
|
+
}[];
|
|
122
|
+
}[];
|
|
123
|
+
} | undefined;
|
|
124
|
+
})[] | undefined;
|
|
125
|
+
visibility?: {
|
|
126
|
+
variable: string;
|
|
127
|
+
visibleWhen: boolean;
|
|
128
|
+
} | undefined;
|
|
129
|
+
experiment?: {
|
|
130
|
+
elementId: number;
|
|
131
|
+
experimentId: number;
|
|
132
|
+
experimentType: string;
|
|
133
|
+
selectedId: number;
|
|
134
|
+
} | undefined;
|
|
135
|
+
} | null;
|
|
136
|
+
showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
|
|
137
|
+
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
2
|
+
import type { PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
|
|
2
3
|
/**
|
|
3
|
-
* Both fixed purchase kinds project the same product and effective display after eligibility.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* the narrower shape is behaviourally identical and adds no forward dependency.
|
|
4
|
+
* Both fixed purchase kinds project the same product and effective display after eligibility. Without a
|
|
5
|
+
* read quantity the selection falls back to `readPostPurchaseQuantity`'s initial quantity (metadata, then the
|
|
6
|
+
* picker default, then 1).
|
|
7
7
|
*/
|
|
8
|
-
export declare const projectPostPurchaseProduct: ({ data, effective, metadata, original }: ReturnType<typeof normalizePostPurchaseProduct>, selectedQuantity?: {
|
|
9
|
-
quantity: number;
|
|
10
|
-
}) => {
|
|
8
|
+
export declare const projectPostPurchaseProduct: ({ data, effective, metadata, original }: ReturnType<typeof normalizePostPurchaseProduct>, selectedQuantity?: PostPurchaseQuantity) => {
|
|
11
9
|
display: {
|
|
12
10
|
discountedFrom: "price" | "compare_at_price";
|
|
13
11
|
language: {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { PostPurchaseExcludedProductIds } from '../schema/postPurchaseProductCollectionView';
|
|
2
|
+
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
3
|
+
/** Validate the flattened ownership boundary before applying merchandise-wide exclusions. */
|
|
4
|
+
export declare const readPostPurchaseGroup: (product: ReturnType<typeof normalizePostPurchaseProduct>["data"][number], settings: ReturnType<typeof normalizePostPurchaseProduct>["effective"], excludedProductIds?: PostPurchaseExcludedProductIds) => {
|
|
5
|
+
catalog: {
|
|
6
|
+
memberProductId: number;
|
|
7
|
+
options: {
|
|
8
|
+
productId: number;
|
|
9
|
+
title: string;
|
|
10
|
+
variantCatalog: {
|
|
11
|
+
displayMode: "single" | "separate";
|
|
12
|
+
options: {
|
|
13
|
+
name: string;
|
|
14
|
+
values: string[];
|
|
15
|
+
id: number;
|
|
16
|
+
position: number;
|
|
17
|
+
}[];
|
|
18
|
+
productId: number;
|
|
19
|
+
showSelectors: boolean;
|
|
20
|
+
variants: {
|
|
21
|
+
available: boolean;
|
|
22
|
+
id: number;
|
|
23
|
+
title: string;
|
|
24
|
+
option1?: string | undefined;
|
|
25
|
+
option2?: string | null | undefined;
|
|
26
|
+
option3?: string | null | undefined;
|
|
27
|
+
imageId?: number | null | undefined;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
entries: {
|
|
33
|
+
product: {
|
|
34
|
+
images: {
|
|
35
|
+
id: number;
|
|
36
|
+
src: string;
|
|
37
|
+
alt?: string | undefined;
|
|
38
|
+
}[] | null | undefined;
|
|
39
|
+
productGroupVariants: never[];
|
|
40
|
+
variants: {
|
|
41
|
+
title: string;
|
|
42
|
+
compareAtPrice: string | null;
|
|
43
|
+
id: number;
|
|
44
|
+
inventoryManagement: string | null;
|
|
45
|
+
inventoryPolicy: string;
|
|
46
|
+
inventoryQuantity: number;
|
|
47
|
+
price: string;
|
|
48
|
+
productId: number;
|
|
49
|
+
imageId?: number | null | undefined;
|
|
50
|
+
option1?: unknown;
|
|
51
|
+
option2?: unknown;
|
|
52
|
+
option3?: unknown;
|
|
53
|
+
sellingPlanAllocations?: unknown;
|
|
54
|
+
}[];
|
|
55
|
+
id: number;
|
|
56
|
+
title: string;
|
|
57
|
+
description: string | null;
|
|
58
|
+
image: {
|
|
59
|
+
src: string;
|
|
60
|
+
} | null;
|
|
61
|
+
options: {
|
|
62
|
+
name: string;
|
|
63
|
+
values: string[];
|
|
64
|
+
id: number;
|
|
65
|
+
position: number;
|
|
66
|
+
}[];
|
|
67
|
+
sellingPlanGroups: {
|
|
68
|
+
requiresSellingPlan: boolean;
|
|
69
|
+
discountAmount?: unknown;
|
|
70
|
+
discountType?: unknown;
|
|
71
|
+
id?: unknown;
|
|
72
|
+
sellingPlans?: unknown;
|
|
73
|
+
}[];
|
|
74
|
+
metadata?: {
|
|
75
|
+
productQuantity?: number | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
metafields?: unknown;
|
|
78
|
+
selectedVariant?: unknown;
|
|
79
|
+
};
|
|
80
|
+
variantCatalog: {
|
|
81
|
+
displayMode: "single" | "separate";
|
|
82
|
+
options: {
|
|
83
|
+
name: string;
|
|
84
|
+
values: string[];
|
|
85
|
+
id: number;
|
|
86
|
+
position: number;
|
|
87
|
+
}[];
|
|
88
|
+
productId: number;
|
|
89
|
+
showSelectors: boolean;
|
|
90
|
+
variants: {
|
|
91
|
+
available: boolean;
|
|
92
|
+
id: number;
|
|
93
|
+
title: string;
|
|
94
|
+
option1?: string | undefined;
|
|
95
|
+
option2?: string | null | undefined;
|
|
96
|
+
option3?: string | null | undefined;
|
|
97
|
+
imageId?: number | null | undefined;
|
|
98
|
+
}[];
|
|
99
|
+
};
|
|
100
|
+
}[];
|
|
101
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { PostPurchaseGroupSelection } from '../schema/postPurchaseGroupCatalog';
|
|
2
|
+
import type { PostPurchaseExcludedProductIds } from '../schema/postPurchaseProductCollectionView';
|
|
3
|
+
/** Validated association and representative facts only; this reader grants no financial permission. */
|
|
4
|
+
export declare const readPostPurchaseGroupSelection: (settings: unknown, response: unknown, requested: PostPurchaseGroupSelection, excludedProductIds?: PostPurchaseExcludedProductIds) => {
|
|
5
|
+
groupCatalog: {
|
|
6
|
+
memberProductId: number;
|
|
7
|
+
options: {
|
|
8
|
+
productId: number;
|
|
9
|
+
title: string;
|
|
10
|
+
variantCatalog: {
|
|
11
|
+
displayMode: "single" | "separate";
|
|
12
|
+
options: {
|
|
13
|
+
name: string;
|
|
14
|
+
values: string[];
|
|
15
|
+
id: number;
|
|
16
|
+
position: number;
|
|
17
|
+
}[];
|
|
18
|
+
productId: number;
|
|
19
|
+
showSelectors: boolean;
|
|
20
|
+
variants: {
|
|
21
|
+
available: boolean;
|
|
22
|
+
id: number;
|
|
23
|
+
title: string;
|
|
24
|
+
option1?: string | undefined;
|
|
25
|
+
option2?: string | null | undefined;
|
|
26
|
+
option3?: string | null | undefined;
|
|
27
|
+
imageId?: number | null | undefined;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
memberProductId: number;
|
|
33
|
+
productIndex: number;
|
|
34
|
+
reportingProduct: {
|
|
35
|
+
id: number;
|
|
36
|
+
title: string;
|
|
37
|
+
};
|
|
38
|
+
response: {
|
|
39
|
+
data: {
|
|
40
|
+
images: {
|
|
41
|
+
id: number;
|
|
42
|
+
src: string;
|
|
43
|
+
alt?: string | undefined;
|
|
44
|
+
}[] | null | undefined;
|
|
45
|
+
productGroupVariants: never[];
|
|
46
|
+
variants: {
|
|
47
|
+
title: string;
|
|
48
|
+
compareAtPrice: string | null;
|
|
49
|
+
id: number;
|
|
50
|
+
inventoryManagement: string | null;
|
|
51
|
+
inventoryPolicy: string;
|
|
52
|
+
inventoryQuantity: number;
|
|
53
|
+
price: string;
|
|
54
|
+
productId: number;
|
|
55
|
+
imageId?: number | null | undefined;
|
|
56
|
+
option1?: unknown;
|
|
57
|
+
option2?: unknown;
|
|
58
|
+
option3?: unknown;
|
|
59
|
+
sellingPlanAllocations?: unknown;
|
|
60
|
+
}[];
|
|
61
|
+
id: number;
|
|
62
|
+
title: string;
|
|
63
|
+
description: string | null;
|
|
64
|
+
image: {
|
|
65
|
+
src: string;
|
|
66
|
+
} | null;
|
|
67
|
+
options: {
|
|
68
|
+
name: string;
|
|
69
|
+
values: string[];
|
|
70
|
+
id: number;
|
|
71
|
+
position: number;
|
|
72
|
+
}[];
|
|
73
|
+
sellingPlanGroups: {
|
|
74
|
+
requiresSellingPlan: boolean;
|
|
75
|
+
discountAmount?: unknown;
|
|
76
|
+
discountType?: unknown;
|
|
77
|
+
id?: unknown;
|
|
78
|
+
sellingPlans?: unknown;
|
|
79
|
+
}[];
|
|
80
|
+
metadata?: {
|
|
81
|
+
productQuantity?: number | undefined;
|
|
82
|
+
} | undefined;
|
|
83
|
+
metafields?: unknown;
|
|
84
|
+
selectedVariant?: unknown;
|
|
85
|
+
}[];
|
|
86
|
+
metadata: {
|
|
87
|
+
widget: Record<string, unknown>;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
variantCatalog: {
|
|
91
|
+
displayMode: "single" | "separate";
|
|
92
|
+
options: {
|
|
93
|
+
name: string;
|
|
94
|
+
values: string[];
|
|
95
|
+
id: number;
|
|
96
|
+
position: number;
|
|
97
|
+
}[];
|
|
98
|
+
productId: number;
|
|
99
|
+
showSelectors: boolean;
|
|
100
|
+
variants: {
|
|
101
|
+
available: boolean;
|
|
102
|
+
id: number;
|
|
103
|
+
title: string;
|
|
104
|
+
option1?: string | undefined;
|
|
105
|
+
option2?: string | null | undefined;
|
|
106
|
+
option3?: string | null | undefined;
|
|
107
|
+
imageId?: number | null | undefined;
|
|
108
|
+
}[];
|
|
109
|
+
};
|
|
110
|
+
} | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
2
|
+
/** The configured policy is valid, but this selection cannot be prepared. */
|
|
3
|
+
export declare class PostPurchaseQuantityUnavailable extends Error {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The initial quantity is the first product's metadata override, else the original picker default (1 when the
|
|
7
|
+
* picker is off; empty data has no override), and is never clamped; an explicit buyer choice must satisfy
|
|
8
|
+
* today's effective bounds. The metadata override is flagged new behaviour (decision 15, L82): legacy's schema
|
|
9
|
+
* stripped it. An admission's
|
|
10
|
+
* `expectedQuantity` equal to the initial quantity is identity, not a new choice. A disabled picker's
|
|
11
|
+
* configured default and bounds are ignored, as legacy ignored them: its policy is fixed at the initial
|
|
12
|
+
* quantity, so leftover junk such as a `null` minimum cannot refuse the Offer.
|
|
13
|
+
*/
|
|
14
|
+
export declare const readPostPurchaseQuantity: ({ data, effective, original, }: Pick<ReturnType<typeof normalizePostPurchaseProduct>, "data" | "effective" | "original">, selection: {
|
|
15
|
+
quantity: number | undefined;
|
|
16
|
+
} | {
|
|
17
|
+
expectedQuantity: number;
|
|
18
|
+
}) => {
|
|
19
|
+
policy: {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
initialQuantity: number;
|
|
22
|
+
maxValue: number;
|
|
23
|
+
minValue: number;
|
|
24
|
+
};
|
|
25
|
+
quantity: number;
|
|
26
|
+
};
|
|
27
|
+
export type PostPurchaseQuantity = ReturnType<typeof readPostPurchaseQuantity>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PostPurchaseVariantDefaultContext } from '../schema/postPurchaseVariantDefaultContext';
|
|
2
|
+
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
3
|
+
/**
|
|
4
|
+
* Matching alone consumes original attributes; recommendation and explicit preselection need no enrichment. Absent
|
|
5
|
+
* enrichment (rebuy-api's line-item read is optional) skips matching and keeps the unmatched default; present but
|
|
6
|
+
* malformed enrichment still throws.
|
|
7
|
+
*/
|
|
8
|
+
export declare const resolvePostPurchaseMemberDefault: (product: ReturnType<typeof normalizePostPurchaseProduct>["data"][number], original: ReturnType<typeof normalizePostPurchaseProduct>["original"], context: PostPurchaseVariantDefaultContext) => number;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { type PostPurchaseChoice } from '../schema/postPurchaseChoice';
|
|
2
2
|
import type { PostPurchasePlanCatalog } from '../schema/postPurchasePlanCatalog';
|
|
3
3
|
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
4
|
+
import type { PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
|
|
4
5
|
/**
|
|
5
6
|
* Catalog inspection is not authority; the chosen mode still passes its complete preparation guards. A catalog
|
|
6
7
|
* projected for another product or variant is treated as absent, so a stale catalog never lends its plans.
|
|
7
8
|
*/
|
|
8
|
-
export declare const selectPostPurchaseChoice: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, projected: PostPurchasePlanCatalog | null, requested: PostPurchaseChoice | undefined, allowCollection: boolean, quantity?: {
|
|
9
|
-
quantity: number;
|
|
10
|
-
}) => {
|
|
9
|
+
export declare const selectPostPurchaseChoice: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, projected: PostPurchasePlanCatalog | null, requested: PostPurchaseChoice | undefined, allowCollection: boolean, quantity?: PostPurchaseQuantity) => {
|
|
11
10
|
choice: undefined;
|
|
12
11
|
options: undefined;
|
|
13
12
|
plan: undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.35.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.",
|