@rebuy/rebuy 3.13.0 → 3.14.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 +20 -9
- package/dist/index.mjs +20 -9
- package/dist/server/index.cjs +20 -9
- package/dist/server/index.mjs +20 -9
- package/dist/transforms/contentBlockV1/convertContentBlockTextToV2.d.ts +3 -1
- package/dist/transforms/index.cjs +20 -9
- package/dist/transforms/index.mjs +20 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4008,7 +4008,7 @@ var normalizeTokens = (text, knownTokens = DEFAULT_KNOWN_TOKENS) => {
|
|
|
4008
4008
|
|
|
4009
4009
|
// src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
|
|
4010
4010
|
var literalText = (_field, value) => normalizeTokens(value);
|
|
4011
|
-
var convertContentBlockTextToV2 = (language, text = literalText) => {
|
|
4011
|
+
var convertContentBlockTextToV2 = (language, text = literalText, textAlign = "center") => {
|
|
4012
4012
|
const description = language?.description;
|
|
4013
4013
|
const superTitle = language?.superTitle;
|
|
4014
4014
|
const title = language?.title;
|
|
@@ -4020,20 +4020,20 @@ var convertContentBlockTextToV2 = (language, text = literalText) => {
|
|
|
4020
4020
|
fontSize: "extraLarge",
|
|
4021
4021
|
marks: [{ type: "bold" }],
|
|
4022
4022
|
text: text("superTitle", superTitle),
|
|
4023
|
-
textAlign
|
|
4023
|
+
textAlign
|
|
4024
4024
|
}) : null,
|
|
4025
4025
|
title ? convertTextToTiptapParagraph({
|
|
4026
4026
|
color: "base",
|
|
4027
4027
|
fontSize: "medium",
|
|
4028
4028
|
marks: [{ type: "bold" }],
|
|
4029
4029
|
text: text("title", title),
|
|
4030
|
-
textAlign
|
|
4030
|
+
textAlign
|
|
4031
4031
|
}) : null,
|
|
4032
4032
|
description ? convertTextToTiptapParagraph({
|
|
4033
4033
|
color: "base",
|
|
4034
4034
|
fontSize: "base",
|
|
4035
4035
|
text: text("description", description),
|
|
4036
|
-
textAlign
|
|
4036
|
+
textAlign
|
|
4037
4037
|
}) : null
|
|
4038
4038
|
].filter((p) => p !== null),
|
|
4039
4039
|
type: "doc"
|
|
@@ -4750,6 +4750,19 @@ var headerVariables = (header) => HEADER_FIELDS.flatMap((field) => {
|
|
|
4750
4750
|
const defaultValue = header[field];
|
|
4751
4751
|
return defaultValue === void 0 ? [] : [{ defaultValue, name: field, type: VariableType.text }];
|
|
4752
4752
|
});
|
|
4753
|
+
var headerNode = (header, textAlign) => ({
|
|
4754
|
+
content: { en: convertContentBlockTextToV2(header, headerText, textAlign) },
|
|
4755
|
+
sectionType: "text"
|
|
4756
|
+
});
|
|
4757
|
+
var buildHeaderNavRow = (header) => ({
|
|
4758
|
+
alignment: { horizontal: "start", vertical: "bottom" },
|
|
4759
|
+
direction: "grid",
|
|
4760
|
+
grid: { columns: ["fill", "auto"] },
|
|
4761
|
+
name: "header",
|
|
4762
|
+
sections: [headerNode(header, "start"), buildCarouselNav()],
|
|
4763
|
+
sectionType: "layout",
|
|
4764
|
+
spacing: "base"
|
|
4765
|
+
});
|
|
4753
4766
|
var HAS_PRODUCTS = "hasProducts";
|
|
4754
4767
|
var hasProductsMutators = () => [
|
|
4755
4768
|
{
|
|
@@ -4842,6 +4855,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
4842
4855
|
const pageSize = Math.max(columns, 1);
|
|
4843
4856
|
const limit = settings.limit ?? void 0;
|
|
4844
4857
|
const showsNav = !!layout?.carousel && !paginationOff(layout.showPaginations) && (limit === void 0 || limit > pageSize);
|
|
4858
|
+
const headerInChrome = showsNav && hasHeaderText(header);
|
|
4845
4859
|
const fitsOneRow = limit !== void 0 && limit <= pageSize;
|
|
4846
4860
|
const sideBySide = direction === "grid" || direction === "columns";
|
|
4847
4861
|
const offersDirection = sideBySide && (showsNav || fitsOneRow) ? "horizontal" : "vertical";
|
|
@@ -4899,7 +4913,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
4899
4913
|
itemsAtOnce: Math.max(showsNav ? columns : limit ?? ENGINE_LIMIT_CEILING, 1),
|
|
4900
4914
|
...listLayout,
|
|
4901
4915
|
padding: gridChrome ? paddingFor(containerBorder.style) : "none",
|
|
4902
|
-
sections: showsNav ? [buildCarouselNav(), offers] : [offers],
|
|
4916
|
+
sections: showsNav ? [headerInChrome ? buildHeaderNavRow(header) : buildCarouselNav(), offers] : [offers],
|
|
4903
4917
|
sectionType: "carousel"
|
|
4904
4918
|
};
|
|
4905
4919
|
return CABRootSection.parse({
|
|
@@ -4909,10 +4923,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
4909
4923
|
// The widget name is required by the admin save schema; carry the legacy widget's name through.
|
|
4910
4924
|
...name && { name },
|
|
4911
4925
|
previewMode: settings.previewMode,
|
|
4912
|
-
sections: [
|
|
4913
|
-
...hasHeaderText(header) ? [{ content: { en: convertContentBlockTextToV2(header, headerText) }, sectionType: "text" }] : [],
|
|
4914
|
-
display
|
|
4915
|
-
],
|
|
4926
|
+
sections: [...hasHeaderText(header) && !headerInChrome ? [headerNode(header, "center")] : [], display],
|
|
4916
4927
|
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
4917
4928
|
tracking: settings.tracking,
|
|
4918
4929
|
type: SHOPIFY_CHECKOUT_EXTENSION,
|
package/dist/index.mjs
CHANGED
|
@@ -3722,7 +3722,7 @@ var normalizeTokens = (text, knownTokens = DEFAULT_KNOWN_TOKENS) => {
|
|
|
3722
3722
|
|
|
3723
3723
|
// src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
|
|
3724
3724
|
var literalText = (_field, value) => normalizeTokens(value);
|
|
3725
|
-
var convertContentBlockTextToV2 = (language, text = literalText) => {
|
|
3725
|
+
var convertContentBlockTextToV2 = (language, text = literalText, textAlign = "center") => {
|
|
3726
3726
|
const description = language?.description;
|
|
3727
3727
|
const superTitle = language?.superTitle;
|
|
3728
3728
|
const title = language?.title;
|
|
@@ -3734,20 +3734,20 @@ var convertContentBlockTextToV2 = (language, text = literalText) => {
|
|
|
3734
3734
|
fontSize: "extraLarge",
|
|
3735
3735
|
marks: [{ type: "bold" }],
|
|
3736
3736
|
text: text("superTitle", superTitle),
|
|
3737
|
-
textAlign
|
|
3737
|
+
textAlign
|
|
3738
3738
|
}) : null,
|
|
3739
3739
|
title ? convertTextToTiptapParagraph({
|
|
3740
3740
|
color: "base",
|
|
3741
3741
|
fontSize: "medium",
|
|
3742
3742
|
marks: [{ type: "bold" }],
|
|
3743
3743
|
text: text("title", title),
|
|
3744
|
-
textAlign
|
|
3744
|
+
textAlign
|
|
3745
3745
|
}) : null,
|
|
3746
3746
|
description ? convertTextToTiptapParagraph({
|
|
3747
3747
|
color: "base",
|
|
3748
3748
|
fontSize: "base",
|
|
3749
3749
|
text: text("description", description),
|
|
3750
|
-
textAlign
|
|
3750
|
+
textAlign
|
|
3751
3751
|
}) : null
|
|
3752
3752
|
].filter((p) => p !== null),
|
|
3753
3753
|
type: "doc"
|
|
@@ -4464,6 +4464,19 @@ var headerVariables = (header) => HEADER_FIELDS.flatMap((field) => {
|
|
|
4464
4464
|
const defaultValue = header[field];
|
|
4465
4465
|
return defaultValue === void 0 ? [] : [{ defaultValue, name: field, type: VariableType.text }];
|
|
4466
4466
|
});
|
|
4467
|
+
var headerNode = (header, textAlign) => ({
|
|
4468
|
+
content: { en: convertContentBlockTextToV2(header, headerText, textAlign) },
|
|
4469
|
+
sectionType: "text"
|
|
4470
|
+
});
|
|
4471
|
+
var buildHeaderNavRow = (header) => ({
|
|
4472
|
+
alignment: { horizontal: "start", vertical: "bottom" },
|
|
4473
|
+
direction: "grid",
|
|
4474
|
+
grid: { columns: ["fill", "auto"] },
|
|
4475
|
+
name: "header",
|
|
4476
|
+
sections: [headerNode(header, "start"), buildCarouselNav()],
|
|
4477
|
+
sectionType: "layout",
|
|
4478
|
+
spacing: "base"
|
|
4479
|
+
});
|
|
4467
4480
|
var HAS_PRODUCTS = "hasProducts";
|
|
4468
4481
|
var hasProductsMutators = () => [
|
|
4469
4482
|
{
|
|
@@ -4556,6 +4569,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
4556
4569
|
const pageSize = Math.max(columns, 1);
|
|
4557
4570
|
const limit = settings.limit ?? void 0;
|
|
4558
4571
|
const showsNav = !!layout?.carousel && !paginationOff(layout.showPaginations) && (limit === void 0 || limit > pageSize);
|
|
4572
|
+
const headerInChrome = showsNav && hasHeaderText(header);
|
|
4559
4573
|
const fitsOneRow = limit !== void 0 && limit <= pageSize;
|
|
4560
4574
|
const sideBySide = direction === "grid" || direction === "columns";
|
|
4561
4575
|
const offersDirection = sideBySide && (showsNav || fitsOneRow) ? "horizontal" : "vertical";
|
|
@@ -4613,7 +4627,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
4613
4627
|
itemsAtOnce: Math.max(showsNav ? columns : limit ?? ENGINE_LIMIT_CEILING, 1),
|
|
4614
4628
|
...listLayout,
|
|
4615
4629
|
padding: gridChrome ? paddingFor(containerBorder.style) : "none",
|
|
4616
|
-
sections: showsNav ? [buildCarouselNav(), offers] : [offers],
|
|
4630
|
+
sections: showsNav ? [headerInChrome ? buildHeaderNavRow(header) : buildCarouselNav(), offers] : [offers],
|
|
4617
4631
|
sectionType: "carousel"
|
|
4618
4632
|
};
|
|
4619
4633
|
return CABRootSection.parse({
|
|
@@ -4623,10 +4637,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
4623
4637
|
// The widget name is required by the admin save schema; carry the legacy widget's name through.
|
|
4624
4638
|
...name && { name },
|
|
4625
4639
|
previewMode: settings.previewMode,
|
|
4626
|
-
sections: [
|
|
4627
|
-
...hasHeaderText(header) ? [{ content: { en: convertContentBlockTextToV2(header, headerText) }, sectionType: "text" }] : [],
|
|
4628
|
-
display
|
|
4629
|
-
],
|
|
4640
|
+
sections: [...hasHeaderText(header) && !headerInChrome ? [headerNode(header, "center")] : [], display],
|
|
4630
4641
|
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
4631
4642
|
tracking: settings.tracking,
|
|
4632
4643
|
type: SHOPIFY_CHECKOUT_EXTENSION,
|
package/dist/server/index.cjs
CHANGED
|
@@ -2148,7 +2148,7 @@ var normalizeTokens = (text2, knownTokens = DEFAULT_KNOWN_TOKENS) => {
|
|
|
2148
2148
|
|
|
2149
2149
|
// src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
|
|
2150
2150
|
var literalText = (_field, value) => normalizeTokens(value);
|
|
2151
|
-
var convertContentBlockTextToV2 = (language, text2 = literalText) => {
|
|
2151
|
+
var convertContentBlockTextToV2 = (language, text2 = literalText, textAlign = "center") => {
|
|
2152
2152
|
const description = language?.description;
|
|
2153
2153
|
const superTitle = language?.superTitle;
|
|
2154
2154
|
const title = language?.title;
|
|
@@ -2160,20 +2160,20 @@ var convertContentBlockTextToV2 = (language, text2 = literalText) => {
|
|
|
2160
2160
|
fontSize: "extraLarge",
|
|
2161
2161
|
marks: [{ type: "bold" }],
|
|
2162
2162
|
text: text2("superTitle", superTitle),
|
|
2163
|
-
textAlign
|
|
2163
|
+
textAlign
|
|
2164
2164
|
}) : null,
|
|
2165
2165
|
title ? convertTextToTiptapParagraph({
|
|
2166
2166
|
color: "base",
|
|
2167
2167
|
fontSize: "medium",
|
|
2168
2168
|
marks: [{ type: "bold" }],
|
|
2169
2169
|
text: text2("title", title),
|
|
2170
|
-
textAlign
|
|
2170
|
+
textAlign
|
|
2171
2171
|
}) : null,
|
|
2172
2172
|
description ? convertTextToTiptapParagraph({
|
|
2173
2173
|
color: "base",
|
|
2174
2174
|
fontSize: "base",
|
|
2175
2175
|
text: text2("description", description),
|
|
2176
|
-
textAlign
|
|
2176
|
+
textAlign
|
|
2177
2177
|
}) : null
|
|
2178
2178
|
].filter((p) => p !== null),
|
|
2179
2179
|
type: "doc"
|
|
@@ -3287,6 +3287,19 @@ var headerVariables = (header) => HEADER_FIELDS.flatMap((field) => {
|
|
|
3287
3287
|
const defaultValue = header[field];
|
|
3288
3288
|
return defaultValue === void 0 ? [] : [{ defaultValue, name: field, type: VariableType.text }];
|
|
3289
3289
|
});
|
|
3290
|
+
var headerNode = (header, textAlign) => ({
|
|
3291
|
+
content: { en: convertContentBlockTextToV2(header, headerText, textAlign) },
|
|
3292
|
+
sectionType: "text"
|
|
3293
|
+
});
|
|
3294
|
+
var buildHeaderNavRow = (header) => ({
|
|
3295
|
+
alignment: { horizontal: "start", vertical: "bottom" },
|
|
3296
|
+
direction: "grid",
|
|
3297
|
+
grid: { columns: ["fill", "auto"] },
|
|
3298
|
+
name: "header",
|
|
3299
|
+
sections: [headerNode(header, "start"), buildCarouselNav()],
|
|
3300
|
+
sectionType: "layout",
|
|
3301
|
+
spacing: "base"
|
|
3302
|
+
});
|
|
3290
3303
|
var HAS_PRODUCTS = "hasProducts";
|
|
3291
3304
|
var hasProductsMutators = () => [
|
|
3292
3305
|
{
|
|
@@ -3379,6 +3392,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3379
3392
|
const pageSize = Math.max(columns, 1);
|
|
3380
3393
|
const limit = settings.limit ?? void 0;
|
|
3381
3394
|
const showsNav = !!layout?.carousel && !paginationOff(layout.showPaginations) && (limit === void 0 || limit > pageSize);
|
|
3395
|
+
const headerInChrome = showsNav && hasHeaderText(header);
|
|
3382
3396
|
const fitsOneRow = limit !== void 0 && limit <= pageSize;
|
|
3383
3397
|
const sideBySide = direction === "grid" || direction === "columns";
|
|
3384
3398
|
const offersDirection = sideBySide && (showsNav || fitsOneRow) ? "horizontal" : "vertical";
|
|
@@ -3436,7 +3450,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3436
3450
|
itemsAtOnce: Math.max(showsNav ? columns : limit ?? ENGINE_LIMIT_CEILING, 1),
|
|
3437
3451
|
...listLayout,
|
|
3438
3452
|
padding: gridChrome ? paddingFor(containerBorder.style) : "none",
|
|
3439
|
-
sections: showsNav ? [buildCarouselNav(), offers] : [offers],
|
|
3453
|
+
sections: showsNav ? [headerInChrome ? buildHeaderNavRow(header) : buildCarouselNav(), offers] : [offers],
|
|
3440
3454
|
sectionType: "carousel"
|
|
3441
3455
|
};
|
|
3442
3456
|
return CABRootSection.parse({
|
|
@@ -3446,10 +3460,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3446
3460
|
// The widget name is required by the admin save schema; carry the legacy widget's name through.
|
|
3447
3461
|
...name && { name },
|
|
3448
3462
|
previewMode: settings.previewMode,
|
|
3449
|
-
sections: [
|
|
3450
|
-
...hasHeaderText(header) ? [{ content: { en: convertContentBlockTextToV2(header, headerText) }, sectionType: "text" }] : [],
|
|
3451
|
-
display
|
|
3452
|
-
],
|
|
3463
|
+
sections: [...hasHeaderText(header) && !headerInChrome ? [headerNode(header, "center")] : [], display],
|
|
3453
3464
|
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
3454
3465
|
tracking: settings.tracking,
|
|
3455
3466
|
type: SHOPIFY_CHECKOUT_EXTENSION,
|
package/dist/server/index.mjs
CHANGED
|
@@ -2100,7 +2100,7 @@ var normalizeTokens = (text2, knownTokens = DEFAULT_KNOWN_TOKENS) => {
|
|
|
2100
2100
|
|
|
2101
2101
|
// src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
|
|
2102
2102
|
var literalText = (_field, value) => normalizeTokens(value);
|
|
2103
|
-
var convertContentBlockTextToV2 = (language, text2 = literalText) => {
|
|
2103
|
+
var convertContentBlockTextToV2 = (language, text2 = literalText, textAlign = "center") => {
|
|
2104
2104
|
const description = language?.description;
|
|
2105
2105
|
const superTitle = language?.superTitle;
|
|
2106
2106
|
const title = language?.title;
|
|
@@ -2112,20 +2112,20 @@ var convertContentBlockTextToV2 = (language, text2 = literalText) => {
|
|
|
2112
2112
|
fontSize: "extraLarge",
|
|
2113
2113
|
marks: [{ type: "bold" }],
|
|
2114
2114
|
text: text2("superTitle", superTitle),
|
|
2115
|
-
textAlign
|
|
2115
|
+
textAlign
|
|
2116
2116
|
}) : null,
|
|
2117
2117
|
title ? convertTextToTiptapParagraph({
|
|
2118
2118
|
color: "base",
|
|
2119
2119
|
fontSize: "medium",
|
|
2120
2120
|
marks: [{ type: "bold" }],
|
|
2121
2121
|
text: text2("title", title),
|
|
2122
|
-
textAlign
|
|
2122
|
+
textAlign
|
|
2123
2123
|
}) : null,
|
|
2124
2124
|
description ? convertTextToTiptapParagraph({
|
|
2125
2125
|
color: "base",
|
|
2126
2126
|
fontSize: "base",
|
|
2127
2127
|
text: text2("description", description),
|
|
2128
|
-
textAlign
|
|
2128
|
+
textAlign
|
|
2129
2129
|
}) : null
|
|
2130
2130
|
].filter((p) => p !== null),
|
|
2131
2131
|
type: "doc"
|
|
@@ -3239,6 +3239,19 @@ var headerVariables = (header) => HEADER_FIELDS.flatMap((field) => {
|
|
|
3239
3239
|
const defaultValue = header[field];
|
|
3240
3240
|
return defaultValue === void 0 ? [] : [{ defaultValue, name: field, type: VariableType.text }];
|
|
3241
3241
|
});
|
|
3242
|
+
var headerNode = (header, textAlign) => ({
|
|
3243
|
+
content: { en: convertContentBlockTextToV2(header, headerText, textAlign) },
|
|
3244
|
+
sectionType: "text"
|
|
3245
|
+
});
|
|
3246
|
+
var buildHeaderNavRow = (header) => ({
|
|
3247
|
+
alignment: { horizontal: "start", vertical: "bottom" },
|
|
3248
|
+
direction: "grid",
|
|
3249
|
+
grid: { columns: ["fill", "auto"] },
|
|
3250
|
+
name: "header",
|
|
3251
|
+
sections: [headerNode(header, "start"), buildCarouselNav()],
|
|
3252
|
+
sectionType: "layout",
|
|
3253
|
+
spacing: "base"
|
|
3254
|
+
});
|
|
3242
3255
|
var HAS_PRODUCTS = "hasProducts";
|
|
3243
3256
|
var hasProductsMutators = () => [
|
|
3244
3257
|
{
|
|
@@ -3331,6 +3344,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3331
3344
|
const pageSize = Math.max(columns, 1);
|
|
3332
3345
|
const limit = settings.limit ?? void 0;
|
|
3333
3346
|
const showsNav = !!layout?.carousel && !paginationOff(layout.showPaginations) && (limit === void 0 || limit > pageSize);
|
|
3347
|
+
const headerInChrome = showsNav && hasHeaderText(header);
|
|
3334
3348
|
const fitsOneRow = limit !== void 0 && limit <= pageSize;
|
|
3335
3349
|
const sideBySide = direction === "grid" || direction === "columns";
|
|
3336
3350
|
const offersDirection = sideBySide && (showsNav || fitsOneRow) ? "horizontal" : "vertical";
|
|
@@ -3388,7 +3402,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3388
3402
|
itemsAtOnce: Math.max(showsNav ? columns : limit ?? ENGINE_LIMIT_CEILING, 1),
|
|
3389
3403
|
...listLayout,
|
|
3390
3404
|
padding: gridChrome ? paddingFor(containerBorder.style) : "none",
|
|
3391
|
-
sections: showsNav ? [buildCarouselNav(), offers] : [offers],
|
|
3405
|
+
sections: showsNav ? [headerInChrome ? buildHeaderNavRow(header) : buildCarouselNav(), offers] : [offers],
|
|
3392
3406
|
sectionType: "carousel"
|
|
3393
3407
|
};
|
|
3394
3408
|
return CABRootSection.parse({
|
|
@@ -3398,10 +3412,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3398
3412
|
// The widget name is required by the admin save schema; carry the legacy widget's name through.
|
|
3399
3413
|
...name && { name },
|
|
3400
3414
|
previewMode: settings.previewMode,
|
|
3401
|
-
sections: [
|
|
3402
|
-
...hasHeaderText(header) ? [{ content: { en: convertContentBlockTextToV2(header, headerText) }, sectionType: "text" }] : [],
|
|
3403
|
-
display
|
|
3404
|
-
],
|
|
3415
|
+
sections: [...hasHeaderText(header) && !headerInChrome ? [headerNode(header, "center")] : [], display],
|
|
3405
3416
|
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
3406
3417
|
tracking: settings.tracking,
|
|
3407
3418
|
type: SHOPIFY_CHECKOUT_EXTENSION,
|
|
@@ -7,5 +7,7 @@ export type HeaderTextResolver = (field: HeaderField, value: string) => string;
|
|
|
7
7
|
* A paragraph per truthy field, styled as the legacy header stack. `text` swaps what each paragraph
|
|
8
8
|
* carries — the offers converter hands over `{{token}}` references so data sources can override the
|
|
9
9
|
* copy — while the truthiness gate (which fields exist at all) stays the merchant's authored copy.
|
|
10
|
+
* `textAlign` follows placement: legacy centers the header above a list but left-aligns it inside a
|
|
11
|
+
* carousel's chrome row (`HeaderBlock`'s `inlineAlignment = isCarousel ? 'start' : 'center'`).
|
|
10
12
|
*/
|
|
11
|
-
export declare const convertContentBlockTextToV2: (language: V1Language | undefined, text?: HeaderTextResolver) => TiptapDocument;
|
|
13
|
+
export declare const convertContentBlockTextToV2: (language: V1Language | undefined, text?: HeaderTextResolver, textAlign?: "center" | "start") => TiptapDocument;
|
|
@@ -1571,7 +1571,7 @@ var normalizeTokens = (text, knownTokens = DEFAULT_KNOWN_TOKENS) => {
|
|
|
1571
1571
|
|
|
1572
1572
|
// src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
|
|
1573
1573
|
var literalText = (_field, value) => normalizeTokens(value);
|
|
1574
|
-
var convertContentBlockTextToV2 = (language, text = literalText) => {
|
|
1574
|
+
var convertContentBlockTextToV2 = (language, text = literalText, textAlign = "center") => {
|
|
1575
1575
|
const description = language?.description;
|
|
1576
1576
|
const superTitle = language?.superTitle;
|
|
1577
1577
|
const title = language?.title;
|
|
@@ -1583,20 +1583,20 @@ var convertContentBlockTextToV2 = (language, text = literalText) => {
|
|
|
1583
1583
|
fontSize: "extraLarge",
|
|
1584
1584
|
marks: [{ type: "bold" }],
|
|
1585
1585
|
text: text("superTitle", superTitle),
|
|
1586
|
-
textAlign
|
|
1586
|
+
textAlign
|
|
1587
1587
|
}) : null,
|
|
1588
1588
|
title ? convertTextToTiptapParagraph({
|
|
1589
1589
|
color: "base",
|
|
1590
1590
|
fontSize: "medium",
|
|
1591
1591
|
marks: [{ type: "bold" }],
|
|
1592
1592
|
text: text("title", title),
|
|
1593
|
-
textAlign
|
|
1593
|
+
textAlign
|
|
1594
1594
|
}) : null,
|
|
1595
1595
|
description ? convertTextToTiptapParagraph({
|
|
1596
1596
|
color: "base",
|
|
1597
1597
|
fontSize: "base",
|
|
1598
1598
|
text: text("description", description),
|
|
1599
|
-
textAlign
|
|
1599
|
+
textAlign
|
|
1600
1600
|
}) : null
|
|
1601
1601
|
].filter((p) => p !== null),
|
|
1602
1602
|
type: "doc"
|
|
@@ -3141,6 +3141,19 @@ var headerVariables = (header) => HEADER_FIELDS.flatMap((field) => {
|
|
|
3141
3141
|
const defaultValue = header[field];
|
|
3142
3142
|
return defaultValue === void 0 ? [] : [{ defaultValue, name: field, type: VariableType.text }];
|
|
3143
3143
|
});
|
|
3144
|
+
var headerNode = (header, textAlign) => ({
|
|
3145
|
+
content: { en: convertContentBlockTextToV2(header, headerText, textAlign) },
|
|
3146
|
+
sectionType: "text"
|
|
3147
|
+
});
|
|
3148
|
+
var buildHeaderNavRow = (header) => ({
|
|
3149
|
+
alignment: { horizontal: "start", vertical: "bottom" },
|
|
3150
|
+
direction: "grid",
|
|
3151
|
+
grid: { columns: ["fill", "auto"] },
|
|
3152
|
+
name: "header",
|
|
3153
|
+
sections: [headerNode(header, "start"), buildCarouselNav()],
|
|
3154
|
+
sectionType: "layout",
|
|
3155
|
+
spacing: "base"
|
|
3156
|
+
});
|
|
3144
3157
|
var HAS_PRODUCTS = "hasProducts";
|
|
3145
3158
|
var hasProductsMutators = () => [
|
|
3146
3159
|
{
|
|
@@ -3233,6 +3246,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3233
3246
|
const pageSize = Math.max(columns, 1);
|
|
3234
3247
|
const limit = settings.limit ?? void 0;
|
|
3235
3248
|
const showsNav = !!layout?.carousel && !paginationOff(layout.showPaginations) && (limit === void 0 || limit > pageSize);
|
|
3249
|
+
const headerInChrome = showsNav && hasHeaderText(header);
|
|
3236
3250
|
const fitsOneRow = limit !== void 0 && limit <= pageSize;
|
|
3237
3251
|
const sideBySide = direction === "grid" || direction === "columns";
|
|
3238
3252
|
const offersDirection = sideBySide && (showsNav || fitsOneRow) ? "horizontal" : "vertical";
|
|
@@ -3290,7 +3304,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3290
3304
|
itemsAtOnce: Math.max(showsNav ? columns : limit ?? ENGINE_LIMIT_CEILING, 1),
|
|
3291
3305
|
...listLayout,
|
|
3292
3306
|
padding: gridChrome ? paddingFor(containerBorder.style) : "none",
|
|
3293
|
-
sections: showsNav ? [buildCarouselNav(), offers] : [offers],
|
|
3307
|
+
sections: showsNav ? [headerInChrome ? buildHeaderNavRow(header) : buildCarouselNav(), offers] : [offers],
|
|
3294
3308
|
sectionType: "carousel"
|
|
3295
3309
|
};
|
|
3296
3310
|
return CABRootSection.parse({
|
|
@@ -3300,10 +3314,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3300
3314
|
// The widget name is required by the admin save schema; carry the legacy widget's name through.
|
|
3301
3315
|
...name && { name },
|
|
3302
3316
|
previewMode: settings.previewMode,
|
|
3303
|
-
sections: [
|
|
3304
|
-
...hasHeaderText(header) ? [{ content: { en: convertContentBlockTextToV2(header, headerText) }, sectionType: "text" }] : [],
|
|
3305
|
-
display
|
|
3306
|
-
],
|
|
3317
|
+
sections: [...hasHeaderText(header) && !headerInChrome ? [headerNode(header, "center")] : [], display],
|
|
3307
3318
|
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
3308
3319
|
tracking: settings.tracking,
|
|
3309
3320
|
type: SHOPIFY_CHECKOUT_EXTENSION,
|
|
@@ -1514,7 +1514,7 @@ var normalizeTokens = (text, knownTokens = DEFAULT_KNOWN_TOKENS) => {
|
|
|
1514
1514
|
|
|
1515
1515
|
// src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
|
|
1516
1516
|
var literalText = (_field, value) => normalizeTokens(value);
|
|
1517
|
-
var convertContentBlockTextToV2 = (language, text = literalText) => {
|
|
1517
|
+
var convertContentBlockTextToV2 = (language, text = literalText, textAlign = "center") => {
|
|
1518
1518
|
const description = language?.description;
|
|
1519
1519
|
const superTitle = language?.superTitle;
|
|
1520
1520
|
const title = language?.title;
|
|
@@ -1526,20 +1526,20 @@ var convertContentBlockTextToV2 = (language, text = literalText) => {
|
|
|
1526
1526
|
fontSize: "extraLarge",
|
|
1527
1527
|
marks: [{ type: "bold" }],
|
|
1528
1528
|
text: text("superTitle", superTitle),
|
|
1529
|
-
textAlign
|
|
1529
|
+
textAlign
|
|
1530
1530
|
}) : null,
|
|
1531
1531
|
title ? convertTextToTiptapParagraph({
|
|
1532
1532
|
color: "base",
|
|
1533
1533
|
fontSize: "medium",
|
|
1534
1534
|
marks: [{ type: "bold" }],
|
|
1535
1535
|
text: text("title", title),
|
|
1536
|
-
textAlign
|
|
1536
|
+
textAlign
|
|
1537
1537
|
}) : null,
|
|
1538
1538
|
description ? convertTextToTiptapParagraph({
|
|
1539
1539
|
color: "base",
|
|
1540
1540
|
fontSize: "base",
|
|
1541
1541
|
text: text("description", description),
|
|
1542
|
-
textAlign
|
|
1542
|
+
textAlign
|
|
1543
1543
|
}) : null
|
|
1544
1544
|
].filter((p) => p !== null),
|
|
1545
1545
|
type: "doc"
|
|
@@ -3084,6 +3084,19 @@ var headerVariables = (header) => HEADER_FIELDS.flatMap((field) => {
|
|
|
3084
3084
|
const defaultValue = header[field];
|
|
3085
3085
|
return defaultValue === void 0 ? [] : [{ defaultValue, name: field, type: VariableType.text }];
|
|
3086
3086
|
});
|
|
3087
|
+
var headerNode = (header, textAlign) => ({
|
|
3088
|
+
content: { en: convertContentBlockTextToV2(header, headerText, textAlign) },
|
|
3089
|
+
sectionType: "text"
|
|
3090
|
+
});
|
|
3091
|
+
var buildHeaderNavRow = (header) => ({
|
|
3092
|
+
alignment: { horizontal: "start", vertical: "bottom" },
|
|
3093
|
+
direction: "grid",
|
|
3094
|
+
grid: { columns: ["fill", "auto"] },
|
|
3095
|
+
name: "header",
|
|
3096
|
+
sections: [headerNode(header, "start"), buildCarouselNav()],
|
|
3097
|
+
sectionType: "layout",
|
|
3098
|
+
spacing: "base"
|
|
3099
|
+
});
|
|
3087
3100
|
var HAS_PRODUCTS = "hasProducts";
|
|
3088
3101
|
var hasProductsMutators = () => [
|
|
3089
3102
|
{
|
|
@@ -3176,6 +3189,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3176
3189
|
const pageSize = Math.max(columns, 1);
|
|
3177
3190
|
const limit = settings.limit ?? void 0;
|
|
3178
3191
|
const showsNav = !!layout?.carousel && !paginationOff(layout.showPaginations) && (limit === void 0 || limit > pageSize);
|
|
3192
|
+
const headerInChrome = showsNav && hasHeaderText(header);
|
|
3179
3193
|
const fitsOneRow = limit !== void 0 && limit <= pageSize;
|
|
3180
3194
|
const sideBySide = direction === "grid" || direction === "columns";
|
|
3181
3195
|
const offersDirection = sideBySide && (showsNav || fitsOneRow) ? "horizontal" : "vertical";
|
|
@@ -3233,7 +3247,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3233
3247
|
itemsAtOnce: Math.max(showsNav ? columns : limit ?? ENGINE_LIMIT_CEILING, 1),
|
|
3234
3248
|
...listLayout,
|
|
3235
3249
|
padding: gridChrome ? paddingFor(containerBorder.style) : "none",
|
|
3236
|
-
sections: showsNav ? [buildCarouselNav(), offers] : [offers],
|
|
3250
|
+
sections: showsNav ? [headerInChrome ? buildHeaderNavRow(header) : buildCarouselNav(), offers] : [offers],
|
|
3237
3251
|
sectionType: "carousel"
|
|
3238
3252
|
};
|
|
3239
3253
|
return CABRootSection.parse({
|
|
@@ -3243,10 +3257,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3243
3257
|
// The widget name is required by the admin save schema; carry the legacy widget's name through.
|
|
3244
3258
|
...name && { name },
|
|
3245
3259
|
previewMode: settings.previewMode,
|
|
3246
|
-
sections: [
|
|
3247
|
-
...hasHeaderText(header) ? [{ content: { en: convertContentBlockTextToV2(header, headerText) }, sectionType: "text" }] : [],
|
|
3248
|
-
display
|
|
3249
|
-
],
|
|
3260
|
+
sections: [...hasHeaderText(header) && !headerInChrome ? [headerNode(header, "center")] : [], display],
|
|
3250
3261
|
// CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
|
|
3251
3262
|
tracking: settings.tracking,
|
|
3252
3263
|
type: SHOPIFY_CHECKOUT_EXTENSION,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.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.",
|