@rebuy/rebuy 3.41.0 → 3.43.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 +971 -787
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +971 -787
- package/dist/pricing/index.cjs +58 -1
- package/dist/pricing/index.d.ts +2 -0
- package/dist/pricing/index.mjs +58 -1
- package/dist/pricing/postPurchaseDisplayFacts.d.ts +36 -0
- package/dist/pricing/postPurchaseDisplayPrice.d.ts +8 -0
- package/dist/pricing/postPurchaseReduction.d.ts +17 -0
- package/dist/schema/checkout-and-beyond/constants.cjs +4 -0
- package/dist/schema/checkout-and-beyond/constants.mjs +4 -0
- package/dist/schema/checkout-and-beyond/index.cjs +388 -374
- package/dist/schema/checkout-and-beyond/index.mjs +388 -374
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/postPurchaseAdmission.d.ts +33 -0
- package/dist/schema/postPurchaseDisplayPrice.d.ts +31 -0
- package/dist/schema/postPurchaseFollowups.d.ts +47 -0
- package/dist/schema/postPurchaseHealth.d.ts +5 -0
- package/dist/schema/postPurchasePlanCatalog.d.ts +2 -0
- package/dist/schema/postPurchaseProduct.d.ts +2 -0
- package/dist/schema/postPurchaseProductCollectionView.d.ts +62 -0
- package/dist/schema/postPurchaseProductView.d.ts +65 -0
- package/dist/schema/postPurchaseRecovery.d.ts +47 -0
- package/dist/schema/postPurchaseSubscriptionProduct.d.ts +2 -0
- package/dist/schema/postPurchaseUpgrade.d.ts +117 -0
- package/dist/schema/widget-data.cjs +452 -441
- package/dist/schema/widget-data.mjs +452 -441
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +14 -0
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +8 -0
- package/dist/schema/widgets/checkout-and-beyond/imageThumbnails.d.ts +13 -0
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts +1 -0
- package/dist/schema/widgets/checkout-and-beyond/variants.d.ts +1 -0
- package/dist/server/index.cjs +1721 -1419
- package/dist/server/index.mjs +1707 -1405
- package/dist/server/postPurchasePlanCatalog.d.ts +4 -1
- package/dist/server/preparePostPurchaseAdmissionView.d.ts +53 -0
- package/dist/server/preparePostPurchaseCollectionGroup.d.ts +57 -0
- package/dist/server/preparePostPurchaseCollectionView.d.ts +53 -0
- package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +53 -0
- package/dist/server/preparePostPurchaseGroupDefault.d.ts +53 -0
- package/dist/server/preparePostPurchaseGroupView.d.ts +53 -0
- package/dist/server/preparePostPurchaseMemberView.d.ts +159 -0
- package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +53 -0
- package/dist/server/preparePostPurchaseQuantityView.d.ts +53 -0
- package/dist/server/preparePostPurchaseSubscription.d.ts +1 -0
- package/dist/server/selectPostPurchaseChoice.d.ts +1 -0
- package/dist/transforms/index.cjs +980 -581
- package/dist/transforms/index.mjs +980 -581
- package/dist/transforms/postPurchase/convertProductInformation.d.ts +6 -2
- package/dist/transforms/postPurchase/productCardControls.d.ts +7 -0
- package/dist/transforms/postPurchase/productCardCosts.d.ts +3 -0
- package/dist/transforms/postPurchase/productCardPricing.d.ts +3 -0
- package/dist/transforms/postPurchase/productCardRows.d.ts +63 -0
- package/dist/transforms/postPurchase/productCardSettings.d.ts +103 -0
- package/dist/transforms/postPurchase/types.d.ts +2 -2
- package/dist/transforms/productCard/earnedText.d.ts +25 -0
- package/dist/transforms/productCard/priceText.d.ts +2 -0
- package/dist/transforms/productCard/quantitySection.d.ts +28 -0
- package/dist/transforms/productCard/subscriptionToggle.d.ts +18 -0
- package/package.json +1 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { CABOffersSection } from '../../schema/widgets/checkout-and-beyond/offers';
|
|
2
2
|
import type { Reporter } from '../../server/shared';
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Structure only: the card provider binds the separately prepared fixed product. The card is built from
|
|
5
|
+
* the section types the checkout offer card uses — price, purchase mode, variants, quantity — plus the
|
|
6
|
+
* post-purchase price breakdown and recurring summary, all driven by the saved widget settings.
|
|
7
|
+
*/
|
|
8
|
+
export declare const convertProductInformation: (raw: unknown, report?: Reporter, widgetSettings?: unknown) => CABOffersSection[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ProductCardSettings } from '../../transforms/postPurchase/productCardSettings';
|
|
2
|
+
/**
|
|
3
|
+
* The card's controls in legacy `ProductOffer` order: purchase mode, product group, variants, quantity.
|
|
4
|
+
* The purchase mode is the checkout card's `switchToSubscription` button as-is (its default labels, and
|
|
5
|
+
* `disableDowngrade` for a subscription-only widget).
|
|
6
|
+
*/
|
|
7
|
+
export declare const productCardControls: (settings: ProductCardSettings) => Record<string, unknown>[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ProductCardSettings } from '../../transforms/postPurchase/productCardSettings';
|
|
2
|
+
/** The breakdown, then the recurring summary (legacy `ProductOffer` order). */
|
|
3
|
+
export declare const productCardCosts: (settings: ProductCardSettings) => Record<string, unknown>[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ProductCardSettings } from '../../transforms/postPurchase/productCardSettings';
|
|
2
|
+
/** The price line — the checkout offer card's own (`{{variantPrice}}` + struck `{{variantCompareAtPrice}}`) — then the saving. */
|
|
3
|
+
export declare const productCardPricing: (settings: ProductCardSettings) => Record<string, unknown>[];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
type Look = {
|
|
2
|
+
color?: 'subdued' | 'success';
|
|
3
|
+
fontSize?: 'small';
|
|
4
|
+
};
|
|
5
|
+
/** One styled run of copy (legacy `TextBlock size="small" subdued`, `Text appearance="success"`). */
|
|
6
|
+
export declare const styledCopy: (text: string, look: Look) => {
|
|
7
|
+
content: {
|
|
8
|
+
content: {
|
|
9
|
+
marks: {
|
|
10
|
+
attrs: Look;
|
|
11
|
+
type: string;
|
|
12
|
+
}[];
|
|
13
|
+
text: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}[];
|
|
16
|
+
type: string;
|
|
17
|
+
}[];
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
/** Merchant copy over its English default: blank falls back, markup is stripped (the `localizedContent` policy). */
|
|
21
|
+
export declare const merchantLabel: (value: string | undefined, fallback: string) => Record<string, string>;
|
|
22
|
+
export type EarnedRow = {
|
|
23
|
+
/** Copy after the value in its own cell (legacy "on every Delivery", "(included)"). */
|
|
24
|
+
after?: unknown;
|
|
25
|
+
columns: string[];
|
|
26
|
+
/** The label cell's localized content map. */
|
|
27
|
+
label: Record<string, unknown>;
|
|
28
|
+
look?: Look;
|
|
29
|
+
spacing?: 'extraTight';
|
|
30
|
+
/** The single `{{token}}` the renderer resolves to '' when there is nothing to show. */
|
|
31
|
+
token: string;
|
|
32
|
+
variable: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* One label/value line that EARNS its visibility from its value: the value cell is a token-only text that
|
|
36
|
+
* hosts the `content` mutators for `variable`, and the other cells bind to the same variable, so the whole
|
|
37
|
+
* line disappears while the renderer resolves the token to '' (before calculation, a one-time choice, a
|
|
38
|
+
* zero amount). The token sits alone in its cell because a content trigger reads the cell's whole copy.
|
|
39
|
+
* The enclosing block declares `variable`.
|
|
40
|
+
*/
|
|
41
|
+
export declare const earnedRow: ({ after, columns, label, look, spacing, token, variable }: EarnedRow) => {
|
|
42
|
+
spacing?: "extraTight" | undefined;
|
|
43
|
+
direction: string;
|
|
44
|
+
grid: {
|
|
45
|
+
columns: string[];
|
|
46
|
+
rows: string[];
|
|
47
|
+
};
|
|
48
|
+
sections: (Record<string, unknown> | {
|
|
49
|
+
content: unknown;
|
|
50
|
+
sectionType: string;
|
|
51
|
+
visibility: {
|
|
52
|
+
variable: string;
|
|
53
|
+
visibleWhen: boolean;
|
|
54
|
+
};
|
|
55
|
+
})[];
|
|
56
|
+
sectionType: string;
|
|
57
|
+
};
|
|
58
|
+
/** The block-level declarations for the rows' earned variables: hidden until the value arrives. */
|
|
59
|
+
export declare const earnedVariables: (names: string[]) => {
|
|
60
|
+
defaultValue: boolean;
|
|
61
|
+
name: string;
|
|
62
|
+
}[];
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The saved widget settings the product card's sections read. Each piece falls back to its schema
|
|
4
|
+
* defaults on its own, so one malformed setting degrades that piece and never drops the card (the preview
|
|
5
|
+
* converter's report-and-continue policy). The admin editor always writes all of them.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ProductCardSettings: z.ZodCatch<z.ZodObject<{
|
|
8
|
+
discount: z.ZodCatch<z.ZodObject<{
|
|
9
|
+
amount: z.ZodDefault<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodPipe<z.ZodUnknown, z.ZodTransform<number, unknown>>]>>;
|
|
10
|
+
shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
11
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
12
|
+
none: "none";
|
|
13
|
+
fixed_amount: "fixed_amount";
|
|
14
|
+
percentage: "percentage";
|
|
15
|
+
}>>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
language: z.ZodCatch<z.ZodObject<{
|
|
18
|
+
global: z.ZodCatch<z.ZodObject<{
|
|
19
|
+
payNow: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
20
|
+
subscriptionOption: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
21
|
+
shipping: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
22
|
+
quantity: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
23
|
+
declineAll: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
24
|
+
declineThisOffer: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
25
|
+
free: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
26
|
+
notAvailable: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
27
|
+
payNowUpgradeToSubscription: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
28
|
+
recurringShipping: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
29
|
+
recurringSubtotal: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
30
|
+
reviewsPlural: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
31
|
+
reviewsSingular: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
32
|
+
save: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
33
|
+
subtotal: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
34
|
+
taxes: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
35
|
+
total: z.ZodCatch<z.ZodDefault<z.ZodString>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodString>>> | z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
productOptions: z.ZodCatch<z.ZodObject<{
|
|
39
|
+
hideOutOfStockVariants: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
|
+
matchVariant: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
|
+
showDeclineAll: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
none: "none";
|
|
43
|
+
both: "both";
|
|
44
|
+
above: "above";
|
|
45
|
+
below: "below";
|
|
46
|
+
}>>;
|
|
47
|
+
showShipping: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
48
|
+
showSubtotal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
49
|
+
showTaxes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
50
|
+
showTotal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
51
|
+
showVariantSelectors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
52
|
+
variantSelectorDisplayMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
single: "single";
|
|
54
|
+
separate: "separate";
|
|
55
|
+
}>>>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
productType: z.ZodCatch<z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
|
|
58
|
+
"one-time": "one-time";
|
|
59
|
+
subscription: "subscription";
|
|
60
|
+
both: "both";
|
|
61
|
+
}>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<string, "">>]>>>;
|
|
62
|
+
quantityInputs: z.ZodCatch<z.ZodObject<{
|
|
63
|
+
defaultQuantity: z.ZodDefault<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodNull, z.ZodTransform<number, null>>]>>;
|
|
64
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
+
maxValue: z.ZodDefault<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodNull, z.ZodTransform<number, null>>]>>;
|
|
66
|
+
minValue: z.ZodDefault<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodUnknown, z.ZodTransform<number, unknown>>]>>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
subImages: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>>;
|
|
69
|
+
subscription: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
70
|
+
discount: z.ZodObject<{
|
|
71
|
+
amount: z.ZodDefault<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodPipe<z.ZodUnknown, z.ZodTransform<number, unknown>>]>>;
|
|
72
|
+
shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
73
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
74
|
+
none: "none";
|
|
75
|
+
fixed_amount: "fixed_amount";
|
|
76
|
+
percentage: "percentage";
|
|
77
|
+
}>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
shipping: z.ZodObject<{
|
|
80
|
+
amount: z.ZodDefault<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodPipe<z.ZodUnknown, z.ZodTransform<number, unknown>>]>>;
|
|
81
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
82
|
+
recurringAmount: z.ZodDefault<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodPipe<z.ZodUnknown, z.ZodTransform<number, unknown>>]>>;
|
|
83
|
+
shippingTitle: z.ZodDefault<z.ZodString>;
|
|
84
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
85
|
+
fixed_amount: "fixed_amount";
|
|
86
|
+
free: "free";
|
|
87
|
+
}>>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
}, z.core.$strip>>>>;
|
|
90
|
+
upgradeToSubscription: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
91
|
+
acceptButtonText: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
92
|
+
allow: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
93
|
+
emailRefundNotice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
94
|
+
errorBannerText: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
95
|
+
}, z.core.$strip>>>>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
export type ProductCardSettings = z.infer<typeof ProductCardSettings>;
|
|
98
|
+
/**
|
|
99
|
+
* Whether the widget can sell a subscription (`both`/`subscription`, or an upgrade-to-subscription
|
|
100
|
+
* widget). Only then do the subscription settings reach the card — `subscription` is always present with
|
|
101
|
+
* its defaults, so reading it on a one-time widget would act on settings the editor never showed.
|
|
102
|
+
*/
|
|
103
|
+
export declare const sellsSubscription: ({ productType, upgradeToSubscription }: ProductCardSettings) => boolean;
|
|
@@ -3,8 +3,8 @@ import { WidgetType } from '../../schema/widgets/checkout-and-beyond/constants';
|
|
|
3
3
|
* A saved post-purchase widget as `/cab/sections` sees it: `type` plus its ordered `blocks`, no `version`
|
|
4
4
|
* discriminator. This is the shape of EVERY `PostPurchaseSettings` (its `blocks` even default to three
|
|
5
5
|
* blocks), so the guard below claims every saved post-purchase widget by design — the section tree is the
|
|
6
|
-
* widget's presentation
|
|
7
|
-
*
|
|
6
|
+
* widget's presentation. The product card also reads the display settings outside `blocks` (REB-24817); the
|
|
7
|
+
* purchase terms (`discount` amounts, `products`, `integrations`, …) are read by the session/Decision contracts.
|
|
8
8
|
*/
|
|
9
9
|
export type V1PostPurchaseSettings = {
|
|
10
10
|
blocks: unknown[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type ContentOperator = 'is_empty' | 'is_not_empty';
|
|
2
|
+
/**
|
|
3
|
+
* The two `content` mutators that let a section EARN a boolean from its own interpolated copy: empty →
|
|
4
|
+
* false, non-empty → true. Both legs are emitted so a re-interpolation corrects the flag either way.
|
|
5
|
+
*/
|
|
6
|
+
export declare const earnedFrom: (variable: string) => {
|
|
7
|
+
effect: "set_false" | "set_true";
|
|
8
|
+
variable: string;
|
|
9
|
+
when: {
|
|
10
|
+
operator: ContentOperator;
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
}[];
|
|
14
|
+
/** A visibility binding that shows the section while `variable` holds. */
|
|
15
|
+
export declare const shownWhile: (variable: string) => {
|
|
16
|
+
variable: string;
|
|
17
|
+
visibleWhen: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A `text` section that hosts the mutators for `variable` and is itself bound to it, so it renders only
|
|
21
|
+
* when its interpolated copy is non-empty — a token the renderer resolves to '' hides the line and every
|
|
22
|
+
* sibling bound to the same variable (the offer card's variant title, the post-purchase cost rows).
|
|
23
|
+
*/
|
|
24
|
+
export declare const earnedText: (variable: string, content: unknown) => Record<string, unknown>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type QuantityBounds = {
|
|
2
|
+
errorMessages?: {
|
|
3
|
+
en: Record<string, string>;
|
|
4
|
+
};
|
|
5
|
+
inputType?: 'number' | 'select';
|
|
6
|
+
maxValue?: number | null;
|
|
7
|
+
minValue?: number | null;
|
|
8
|
+
/** The control's a11y label; omitted ⇒ the schema default. */
|
|
9
|
+
name?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A `quantity` stepper from legacy bounds. Legacy quantity had no upper bound (checkout's
|
|
13
|
+
* `DefaultQuantityRule.MAX = null`) and allowed 0; the CAB schema pins `max` to [1, 100] and `min` to
|
|
14
|
+
* >= 1. Clamp instead of passing through so a legacy `maxValue: 250` (or a 0) degrades to a valid widget
|
|
15
|
+
* rather than throwing at parse. `min` is also capped at `max` — the schema has no cross-field refine, so a
|
|
16
|
+
* legacy `min > max` (e.g. {maxValue: 5, minValue: 8}) would parse but render a degenerate stepper (REB #766).
|
|
17
|
+
* Shared by the checkout offer card and the post-purchase product card.
|
|
18
|
+
*/
|
|
19
|
+
export declare const quantitySection: ({ errorMessages, inputType, maxValue, minValue, name }: QuantityBounds) => {
|
|
20
|
+
sectionType: string;
|
|
21
|
+
name?: string | undefined;
|
|
22
|
+
max: number;
|
|
23
|
+
min: number;
|
|
24
|
+
inputType?: "number" | "select" | undefined;
|
|
25
|
+
errorMessages?: {
|
|
26
|
+
en: Record<string, string>;
|
|
27
|
+
} | undefined;
|
|
28
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type SubscriptionToggleLabels = {
|
|
2
|
+
/** The switch-to-one-time label override. */
|
|
3
|
+
oneTime?: string;
|
|
4
|
+
/** The ONE upsell label legacy had; it fills both upsell slots. */
|
|
5
|
+
upgrade?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The in-card subscribe / one-time toggle: a `switchToSubscription` button with its four label slots
|
|
9
|
+
* (the same `SWITCH_LABELS` slot set as the line-item editor, including the `subscriptionOption`
|
|
10
|
+
* frequency template, so the frequency select localizes). Emitted when the merchant offers
|
|
11
|
+
* subscriptions (`productType` both/subscription); the renderer shows it per product by selling-plan
|
|
12
|
+
* availability. Legacy checkout-offers had ONE upsell label — `upgradeToSubscription`, used whatever
|
|
13
|
+
* the plan's discount (`useSellingPlanData.handleCheckboxLabel`) — so it fills BOTH upsell slots; the
|
|
14
|
+
* renderer's discount>0 slot pick then can't change which merchant text shows. Anything blank/absent
|
|
15
|
+
* falls back to the shared localized defaults. Shared by the checkout offer card and the post-purchase
|
|
16
|
+
* product card.
|
|
17
|
+
*/
|
|
18
|
+
export declare const subscriptionToggle: (productType: string | undefined, labels?: SubscriptionToggleLabels) => Record<string, unknown>[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.43.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.",
|