@rebuy/rebuy 3.46.0 → 3.48.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 +31 -25
- package/dist/index.mjs +31 -25
- package/dist/server/composeOffer.d.ts +1 -1
- package/dist/server/index.cjs +169 -118
- package/dist/server/index.mjs +165 -114
- package/dist/transforms/index.cjs +144 -113
- package/dist/transforms/index.mjs +144 -113
- package/dist/transforms/postPurchase/convertPayButtonBlock.d.ts +6 -2
- package/dist/transforms/postPurchase/convertProductInformation.d.ts +2 -1
- package/dist/transforms/postPurchase/productCardPay.d.ts +24 -0
- package/dist/transforms/postPurchase/productCardSettings.d.ts +1 -0
- package/dist/transforms/productCard/addToOrderButton.d.ts +22 -0
- package/package.json +1 -1
|
@@ -3035,6 +3035,20 @@ var tiptapPlainText = (doc) => listOf(doc?.content).map(
|
|
|
3035
3035
|
(paragraph) => listOf(paragraph.content).map((node) => node.text ?? "").join("")
|
|
3036
3036
|
).join(" ").trim();
|
|
3037
3037
|
|
|
3038
|
+
// src/transforms/productCard/addToOrderButton.ts
|
|
3039
|
+
var labelSlot = (buttonField, defaults, override, knownTokens = [], legacyDefaults = []) => ({
|
|
3040
|
+
buttonField,
|
|
3041
|
+
content: localizedContent(defaults, override, knownTokens, legacyDefaults),
|
|
3042
|
+
sectionType: "text"
|
|
3043
|
+
});
|
|
3044
|
+
var addToOrderButton = (buttonStyle, sections, extra = {}) => ({
|
|
3045
|
+
action: "addToOrder",
|
|
3046
|
+
buttonStyle,
|
|
3047
|
+
sections,
|
|
3048
|
+
sectionType: "button",
|
|
3049
|
+
...extra
|
|
3050
|
+
});
|
|
3051
|
+
|
|
3038
3052
|
// src/transforms/productCard/earnedText.ts
|
|
3039
3053
|
var contentMutator = (effect, variable, operator) => ({
|
|
3040
3054
|
effect,
|
|
@@ -3103,16 +3117,13 @@ var quantitySection = ({ errorMessages, inputType, maxValue, minValue, name }) =
|
|
|
3103
3117
|
var SWITCH_LABEL_TOKENS2 = ["subscriptionDiscount", "frequency", "interval"];
|
|
3104
3118
|
var subscriptionToggle = (productType, labels = {}) => {
|
|
3105
3119
|
if (productType !== "both" && productType !== "subscription") return [];
|
|
3106
|
-
const slot = (buttonField, override) => (
|
|
3120
|
+
const slot = (buttonField, override) => labelSlot(
|
|
3107
3121
|
buttonField,
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
),
|
|
3114
|
-
sectionType: "text"
|
|
3115
|
-
});
|
|
3122
|
+
SWITCH_LABELS[buttonField],
|
|
3123
|
+
override,
|
|
3124
|
+
SWITCH_LABEL_TOKENS2,
|
|
3125
|
+
LEGACY_LABEL_DEFAULTS[buttonField]
|
|
3126
|
+
);
|
|
3116
3127
|
return [
|
|
3117
3128
|
{
|
|
3118
3129
|
action: "switchToSubscription",
|
|
@@ -3311,20 +3322,16 @@ var buildRevealButton = (settings) => revealsVariants(settings) ? [
|
|
|
3311
3322
|
}
|
|
3312
3323
|
] : [];
|
|
3313
3324
|
var buildAddButton = (settings) => {
|
|
3314
|
-
const slot = (buttonField, override) => (
|
|
3325
|
+
const slot = (buttonField, override) => labelSlot(
|
|
3315
3326
|
buttonField,
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
return {
|
|
3325
|
-
action: "addToOrder",
|
|
3326
|
-
buttonStyle: buttonKind(settings),
|
|
3327
|
-
sections: [
|
|
3327
|
+
OFFER_LABELS[buttonField],
|
|
3328
|
+
override,
|
|
3329
|
+
ADD_LABEL_TOKENS,
|
|
3330
|
+
LEGACY_LABEL_DEFAULTS[buttonField]
|
|
3331
|
+
);
|
|
3332
|
+
return addToOrderButton(
|
|
3333
|
+
buttonKind(settings),
|
|
3334
|
+
[
|
|
3328
3335
|
slot("addToCart", settings.language?.addToCart),
|
|
3329
3336
|
slot("addingToCart", settings.language?.addingToCart),
|
|
3330
3337
|
slot("addedToCart", settings.language?.addedToCart),
|
|
@@ -3332,9 +3339,8 @@ var buildAddButton = (settings) => {
|
|
|
3332
3339
|
// Off-checkout Buy Now: the label the button shows once it links to the created checkout.
|
|
3333
3340
|
slot("redirectToCheckout", settings.language?.redirectToCheckout)
|
|
3334
3341
|
],
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
};
|
|
3342
|
+
revealsVariants(settings) ? { visibility: { variable: SHOW_VARIANTS, visibleWhen: true } } : {}
|
|
3343
|
+
);
|
|
3338
3344
|
};
|
|
3339
3345
|
var buildOfferCard = (settings, horizontal) => {
|
|
3340
3346
|
const image = buildImage(settings);
|
|
@@ -4023,95 +4029,28 @@ var convertImageContentBlock = (raw, report) => {
|
|
|
4023
4029
|
return [CABLayoutSection.parse({ frame: "offer-content", sections: [inner], spacing: "none" })];
|
|
4024
4030
|
};
|
|
4025
4031
|
|
|
4026
|
-
// src/transforms/postPurchase/
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
const {
|
|
4035
|
-
|
|
4036
|
-
const text = CABTextSection.safeParse({ content: { en: label } });
|
|
4037
|
-
if (!text.success) return omit();
|
|
4038
|
-
return [
|
|
4039
|
-
CABLayoutSection.parse({
|
|
4040
|
-
alignment: { horizontal: "center" },
|
|
4041
|
-
direction: "grid",
|
|
4042
|
-
grid: { columns: ["100%"] },
|
|
4043
|
-
sections: [
|
|
4044
|
-
CABButtonSection.parse({
|
|
4045
|
-
action: "addToOrder",
|
|
4046
|
-
sections: [text.data]
|
|
4047
|
-
})
|
|
4048
|
-
],
|
|
4049
|
-
width: styles2.buttonWidth
|
|
4050
|
-
})
|
|
4051
|
-
];
|
|
4052
|
-
};
|
|
4053
|
-
|
|
4054
|
-
// src/transforms/postPurchase/productCardControls.ts
|
|
4055
|
-
var SELECT_VARIANT = { en: "Select Variant" };
|
|
4056
|
-
var PRODUCT_GROUP = { en: "Option" };
|
|
4057
|
-
var groupSelector = { label: PRODUCT_GROUP, sectionType: "variants", selector: "menu", variantMode: "productGroup" };
|
|
4058
|
-
var variantSelector = ({ productOptions }) => {
|
|
4059
|
-
if (!productOptions.showVariantSelectors) return [];
|
|
4060
|
-
const single = productOptions.variantSelectorDisplayMode === "single";
|
|
4061
|
-
return [
|
|
4062
|
-
{
|
|
4063
|
-
hideOutOfStockVariants: single || productOptions.hideOutOfStockVariants,
|
|
4064
|
-
...single && { label: SELECT_VARIANT },
|
|
4065
|
-
sectionType: "variants",
|
|
4066
|
-
selector: "menu",
|
|
4067
|
-
variantMode: single ? "single" : "multiple"
|
|
4068
|
-
}
|
|
4069
|
-
];
|
|
4032
|
+
// src/transforms/postPurchase/productCardPay.ts
|
|
4033
|
+
import { mapValues } from "es-toolkit";
|
|
4034
|
+
var PAY_NOW = { en: "Pay Now" };
|
|
4035
|
+
var DECLINE_THIS_OFFER = { en: "Decline this offer" };
|
|
4036
|
+
var NOT_AVAILABLE_DEFAULTS = ["Not available"];
|
|
4037
|
+
var soldOutSlot = ({ language }) => labelSlot("soldOut", OFFER_LABELS.soldOut, language.global.notAvailable, [], NOT_AVAILABLE_DEFAULTS);
|
|
4038
|
+
var productCardPay = (settings) => {
|
|
4039
|
+
const payNow = labelSlot("payNow", PAY_NOW, settings.language.global.payNow);
|
|
4040
|
+
const priced = settings.language.displayCtaPrice ? { ...payNow, content: mapValues(payNow.content, (label) => `${label} \xB7 {{total}}`) } : payNow;
|
|
4041
|
+
return [addToOrderButton("primary", [priced, soldOutSlot(settings)])];
|
|
4070
4042
|
};
|
|
4071
|
-
var
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
var productCardControls = (settings) => [
|
|
4079
|
-
...subscriptionToggle(settings.productType, { frequencyLabel: "planName" }),
|
|
4080
|
-
groupSelector,
|
|
4081
|
-
...variantSelector(settings),
|
|
4082
|
-
...quantity(settings)
|
|
4043
|
+
var productCardDecline = ({ language }) => [
|
|
4044
|
+
{
|
|
4045
|
+
action: "declineOffer",
|
|
4046
|
+
buttonStyle: "secondary",
|
|
4047
|
+
sections: [labelSlot("declineOffer", DECLINE_THIS_OFFER, language.global.declineThisOffer)],
|
|
4048
|
+
sectionType: "button"
|
|
4049
|
+
}
|
|
4083
4050
|
];
|
|
4084
4051
|
|
|
4085
|
-
// src/transforms/postPurchase/productCardRows.ts
|
|
4086
|
-
var styledCopy = (text, look) => ({
|
|
4087
|
-
content: [{ content: [{ marks: [{ attrs: look, type: "textStyle" }], text, type: "text" }], type: "paragraph" }],
|
|
4088
|
-
type: "doc"
|
|
4089
|
-
});
|
|
4090
|
-
var merchantLabel = (value, fallback) => localizedContent({ en: fallback }, value);
|
|
4091
|
-
var boundText = (variable, content) => ({
|
|
4092
|
-
content,
|
|
4093
|
-
sectionType: "text",
|
|
4094
|
-
visibility: shownWhile(variable)
|
|
4095
|
-
});
|
|
4096
|
-
var earnedRow = ({ after, columns, label, look, spacing, token, variable }) => {
|
|
4097
|
-
const styled = (text) => look ? styledCopy(text, look) : text;
|
|
4098
|
-
const value = earnedText(variable, styled(token));
|
|
4099
|
-
return {
|
|
4100
|
-
direction: "grid",
|
|
4101
|
-
grid: { columns, rows: ["auto"] },
|
|
4102
|
-
sections: [
|
|
4103
|
-
boundText(variable, look ? { en: styled(String(label.en)) } : label),
|
|
4104
|
-
value,
|
|
4105
|
-
...after === void 0 ? [] : [boundText(variable, { en: styled(String(after)) })]
|
|
4106
|
-
],
|
|
4107
|
-
sectionType: "layout",
|
|
4108
|
-
...spacing && { spacing }
|
|
4109
|
-
};
|
|
4110
|
-
};
|
|
4111
|
-
var earnedVariables = (names) => names.map((name) => ({ defaultValue: false, name }));
|
|
4112
|
-
|
|
4113
4052
|
// src/transforms/postPurchase/productCardSettings.ts
|
|
4114
|
-
import { mapValues } from "es-toolkit";
|
|
4053
|
+
import { mapValues as mapValues2 } from "es-toolkit";
|
|
4115
4054
|
import { z as z32 } from "zod";
|
|
4116
4055
|
|
|
4117
4056
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
@@ -4303,9 +4242,12 @@ var PostPurchaseSettings = z31.object({
|
|
|
4303
4242
|
// src/transforms/postPurchase/productCardSettings.ts
|
|
4304
4243
|
var { shape } = PostPurchaseSettings;
|
|
4305
4244
|
var Labels = z32.object(
|
|
4306
|
-
|
|
4245
|
+
mapValues2(shape.language.shape.global.unwrap().unwrap().shape, (label) => label.catch(() => label.parse(void 0)))
|
|
4307
4246
|
);
|
|
4308
|
-
var Language = z32.object({
|
|
4247
|
+
var Language = z32.object({
|
|
4248
|
+
displayCtaPrice: shape.language.shape.displayCtaPrice.catch(true),
|
|
4249
|
+
global: Labels.catch(() => Labels.parse({}))
|
|
4250
|
+
});
|
|
4309
4251
|
var Fields = z32.object({
|
|
4310
4252
|
discount: shape.discount.catch(() => shape.discount.parse({})),
|
|
4311
4253
|
language: Language.catch(() => Language.parse({})),
|
|
@@ -4319,6 +4261,93 @@ var Fields = z32.object({
|
|
|
4319
4261
|
var ProductCardSettings = Fields.catch(() => Fields.parse({}));
|
|
4320
4262
|
var sellsSubscription = ({ productType, upgradeToSubscription }) => productType !== "one-time" || upgradeToSubscription.allow;
|
|
4321
4263
|
|
|
4264
|
+
// src/transforms/postPurchase/convertPayButtonBlock.ts
|
|
4265
|
+
var convertPayButtonBlock = (raw, report, widgetSettings) => {
|
|
4266
|
+
const omit = () => {
|
|
4267
|
+
report?.({ detail: "Unreadable post-purchase Pay block", kind: "section" });
|
|
4268
|
+
return [];
|
|
4269
|
+
};
|
|
4270
|
+
const parsed = PayButtonBlock.safeParse(raw);
|
|
4271
|
+
if (!parsed.success) return omit();
|
|
4272
|
+
const { settings, styles: styles2 } = parsed.data;
|
|
4273
|
+
const label = settings.label ? `${settings.label} \xB7 {{total}}` : "{{total}}";
|
|
4274
|
+
const text = CABTextSection.safeParse({ content: { en: label } });
|
|
4275
|
+
if (!text.success) return omit();
|
|
4276
|
+
return [
|
|
4277
|
+
CABLayoutSection.parse({
|
|
4278
|
+
alignment: { horizontal: "center" },
|
|
4279
|
+
direction: "grid",
|
|
4280
|
+
grid: { columns: ["100%"] },
|
|
4281
|
+
sections: [
|
|
4282
|
+
CABButtonSection.parse({
|
|
4283
|
+
action: "addToOrder",
|
|
4284
|
+
sections: [text.data, soldOutSlot(ProductCardSettings.parse(widgetSettings ?? {}))]
|
|
4285
|
+
})
|
|
4286
|
+
],
|
|
4287
|
+
width: styles2.buttonWidth
|
|
4288
|
+
})
|
|
4289
|
+
];
|
|
4290
|
+
};
|
|
4291
|
+
|
|
4292
|
+
// src/transforms/postPurchase/productCardControls.ts
|
|
4293
|
+
var SELECT_VARIANT = { en: "Select Variant" };
|
|
4294
|
+
var PRODUCT_GROUP = { en: "Option" };
|
|
4295
|
+
var groupSelector = { label: PRODUCT_GROUP, sectionType: "variants", selector: "menu", variantMode: "productGroup" };
|
|
4296
|
+
var variantSelector = ({ productOptions }) => {
|
|
4297
|
+
if (!productOptions.showVariantSelectors) return [];
|
|
4298
|
+
const single = productOptions.variantSelectorDisplayMode === "single";
|
|
4299
|
+
return [
|
|
4300
|
+
{
|
|
4301
|
+
hideOutOfStockVariants: single || productOptions.hideOutOfStockVariants,
|
|
4302
|
+
...single && { label: SELECT_VARIANT },
|
|
4303
|
+
sectionType: "variants",
|
|
4304
|
+
selector: "menu",
|
|
4305
|
+
variantMode: single ? "single" : "multiple"
|
|
4306
|
+
}
|
|
4307
|
+
];
|
|
4308
|
+
};
|
|
4309
|
+
var quantity = ({ language, quantityInputs: quantityInputs2 }) => quantityInputs2.enabled ? [
|
|
4310
|
+
quantitySection({
|
|
4311
|
+
maxValue: quantityInputs2.maxValue,
|
|
4312
|
+
minValue: quantityInputs2.minValue,
|
|
4313
|
+
name: language.global.quantity.trim()
|
|
4314
|
+
})
|
|
4315
|
+
] : [];
|
|
4316
|
+
var productCardControls = (settings) => [
|
|
4317
|
+
...subscriptionToggle(settings.productType, { frequencyLabel: "planName" }),
|
|
4318
|
+
groupSelector,
|
|
4319
|
+
...variantSelector(settings),
|
|
4320
|
+
...quantity(settings)
|
|
4321
|
+
];
|
|
4322
|
+
|
|
4323
|
+
// src/transforms/postPurchase/productCardRows.ts
|
|
4324
|
+
var styledCopy = (text, look) => ({
|
|
4325
|
+
content: [{ content: [{ marks: [{ attrs: look, type: "textStyle" }], text, type: "text" }], type: "paragraph" }],
|
|
4326
|
+
type: "doc"
|
|
4327
|
+
});
|
|
4328
|
+
var merchantLabel = (value, fallback) => localizedContent({ en: fallback }, value);
|
|
4329
|
+
var boundText = (variable, content) => ({
|
|
4330
|
+
content,
|
|
4331
|
+
sectionType: "text",
|
|
4332
|
+
visibility: shownWhile(variable)
|
|
4333
|
+
});
|
|
4334
|
+
var earnedRow = ({ after, columns, label, look, spacing, token, variable }) => {
|
|
4335
|
+
const styled = (text) => look ? styledCopy(text, look) : text;
|
|
4336
|
+
const value = earnedText(variable, styled(token));
|
|
4337
|
+
return {
|
|
4338
|
+
direction: "grid",
|
|
4339
|
+
grid: { columns, rows: ["auto"] },
|
|
4340
|
+
sections: [
|
|
4341
|
+
boundText(variable, look ? { en: styled(String(label.en)) } : label),
|
|
4342
|
+
value,
|
|
4343
|
+
...after === void 0 ? [] : [boundText(variable, { en: styled(String(after)) })]
|
|
4344
|
+
],
|
|
4345
|
+
sectionType: "layout",
|
|
4346
|
+
...spacing && { spacing }
|
|
4347
|
+
};
|
|
4348
|
+
};
|
|
4349
|
+
var earnedVariables = (names) => names.map((name) => ({ defaultValue: false, name }));
|
|
4350
|
+
|
|
4322
4351
|
// src/transforms/postPurchase/productCardCosts.ts
|
|
4323
4352
|
var COST_ROWS = [
|
|
4324
4353
|
["showSubtotal", "subtotal", "Subtotal", "hasSubtotal"],
|
|
@@ -4475,7 +4504,9 @@ var convertProductInformation = (raw, report, widgetSettings) => {
|
|
|
4475
4504
|
CABReviewsSection.parse({}),
|
|
4476
4505
|
CABTextSection.parse({ content: { en: "{{productDescription}}" } }),
|
|
4477
4506
|
...productCardControls(settings),
|
|
4478
|
-
...productCardCosts(settings)
|
|
4507
|
+
...productCardCosts(settings),
|
|
4508
|
+
...productCardPay(settings),
|
|
4509
|
+
...productCardDecline(settings)
|
|
4479
4510
|
]
|
|
4480
4511
|
})
|
|
4481
4512
|
],
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { CABLayoutSection } from '../../schema/widgets/checkout-and-beyond/layout';
|
|
2
2
|
import type { Reporter } from '../../server/shared';
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The frame carries an inert action slot; the sole card supplies its captured action and total. The label
|
|
5
|
+
* stays unslotted (`"{label} · {{total}}"`); the `soldOut` slot is the card's, from the widget's
|
|
6
|
+
* `notAvailable` (legacy `PayButton`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const convertPayButtonBlock: (raw: unknown, report?: Reporter, widgetSettings?: unknown) => CABLayoutSection[];
|
|
@@ -3,6 +3,7 @@ import type { Reporter } from '../../server/shared';
|
|
|
3
3
|
/**
|
|
4
4
|
* Structure only: the card provider binds the separately prepared fixed product. The card is built from
|
|
5
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
|
|
6
|
+
* post-purchase price breakdown and recurring summary, then the card's own Pay and decline, all driven by the saved
|
|
7
|
+
* widget settings.
|
|
7
8
|
*/
|
|
8
9
|
export declare const convertProductInformation: (raw: unknown, report?: Reporter, widgetSettings?: unknown) => CABOffersSection[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ProductCardSettings } from '../../transforms/postPurchase/productCardSettings';
|
|
2
|
+
/**
|
|
3
|
+
* The label a choice that cannot be bought shows (legacy `notAvailable`, L188 / `PayButton`): the
|
|
4
|
+
* merchant's `notAvailable`, over the checkout card's localized `soldOut` defaults.
|
|
5
|
+
*/
|
|
6
|
+
export declare const soldOutSlot: ({ language }: ProductCardSettings) => {
|
|
7
|
+
buttonField: "declineAllOffers" | "declineOffer" | "removeFromOrder" | "undoAddToOrder" | "activePage" | "addedToCart" | "addingToCart" | "addToCart" | "buttonLabel" | "destinationUrl" | "inactivePage" | "overlayContent" | "payNow" | "progressReached" | "progressRemaining" | "redirectToCheckout" | "showVariant" | "showVariants" | "soldOut" | "subscriptionOption" | "switchToOneTimePurchase" | "switchToSubscriptionNoDiscount" | "switchToSubscriptionWithDiscount";
|
|
8
|
+
content: Record<string, string> & {
|
|
9
|
+
en: string;
|
|
10
|
+
};
|
|
11
|
+
sectionType: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The card's own Pay (legacy `Buttons`, L190): an `addToOrder` button after the costs, labelled by the
|
|
15
|
+
* merchant's `payNow` followed by `" · {{total}}"` only while `displayCtaPrice` is on, plus the `soldOut`
|
|
16
|
+
* slot. Every card carries one, so a multi-member Offer and a widget without a Pay block can still buy.
|
|
17
|
+
*/
|
|
18
|
+
export declare const productCardPay: (settings: ProductCardSettings) => Record<string, unknown>[];
|
|
19
|
+
/**
|
|
20
|
+
* The card's own decline (legacy `Buttons`' subdued "Decline this offer" beside Pay, L191): a secondary
|
|
21
|
+
* `declineOffer` button, the Monetize card's action and style, labelled by the merchant's
|
|
22
|
+
* `declineThisOffer` in a `declineOffer` slot. Legacy had no setting that hid it.
|
|
23
|
+
*/
|
|
24
|
+
export declare const productCardDecline: ({ language }: ProductCardSettings) => Record<string, unknown>[];
|
|
@@ -15,6 +15,7 @@ export declare const ProductCardSettings: z.ZodCatch<z.ZodObject<{
|
|
|
15
15
|
}>>;
|
|
16
16
|
}, z.core.$strip>>;
|
|
17
17
|
language: z.ZodCatch<z.ZodObject<{
|
|
18
|
+
displayCtaPrice: z.ZodCatch<z.ZodDefault<z.ZodBoolean>>;
|
|
18
19
|
global: z.ZodCatch<z.ZodObject<{
|
|
19
20
|
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
21
|
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>>]>>>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ButtonField } from '../../schema/widgets/checkout-and-beyond/common';
|
|
2
|
+
/**
|
|
3
|
+
* One button label slot: a `text` child tagged with its `buttonField`, its copy the v1 label-override policy
|
|
4
|
+
* (`localizedContent`) applied to the slot's localized defaults — a changed merchant label shows to every
|
|
5
|
+
* buyer language, untouched default copy keeps the localized set (REB-24836). Shared by the checkout offer
|
|
6
|
+
* card, the purchase-mode toggle and the post-purchase card.
|
|
7
|
+
*/
|
|
8
|
+
export declare const labelSlot: (buttonField: ButtonField, defaults: Record<string, string> & {
|
|
9
|
+
en: string;
|
|
10
|
+
}, override: string | undefined, knownTokens?: readonly string[], legacyDefaults?: readonly string[]) => {
|
|
11
|
+
buttonField: "declineAllOffers" | "declineOffer" | "removeFromOrder" | "undoAddToOrder" | "activePage" | "addedToCart" | "addingToCart" | "addToCart" | "buttonLabel" | "destinationUrl" | "inactivePage" | "overlayContent" | "payNow" | "progressReached" | "progressRemaining" | "redirectToCheckout" | "showVariant" | "showVariants" | "soldOut" | "subscriptionOption" | "switchToOneTimePurchase" | "switchToSubscriptionNoDiscount" | "switchToSubscriptionWithDiscount";
|
|
12
|
+
content: Record<string, string> & {
|
|
13
|
+
en: string;
|
|
14
|
+
};
|
|
15
|
+
sectionType: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The card's purchase button: an `addToOrder` button whose label slots the renderer picks by state. The
|
|
19
|
+
* checkout offer card fills add / adding / added / sold-out / redirect; the post-purchase card fills
|
|
20
|
+
* `payNow` / `soldOut`. `extra` carries per-card fields such as a `visibility` binding.
|
|
21
|
+
*/
|
|
22
|
+
export declare const addToOrderButton: (buttonStyle: string | undefined, sections: Record<string, unknown>[], extra?: Record<string, unknown>) => Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.48.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.",
|