@40rty/ams-cli 0.5.8 → 0.5.9
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.
|
@@ -18,7 +18,7 @@ describe('theme normalizer', () => {
|
|
|
18
18
|
const template = {
|
|
19
19
|
order: ['main', 'off', 'tiles', 'faq'],
|
|
20
20
|
sections: {
|
|
21
|
-
main: { type: 'main-product', block_order: ['b1', 'b2', 'b3', 'b4'], blocks: {
|
|
21
|
+
main: { type: 'main-product', settings: { show_sticky_add_to_cart: true }, block_order: ['b1', 'b2', 'b3', 'b4'], blocks: {
|
|
22
22
|
b1: { type: 'image', settings: { image: 'shopify://shop_images/a b.png', image_width: 500 } },
|
|
23
23
|
b2: { type: 'liquid', settings: { liquid: '<style>.x{}</style><div class="registry">x</div>' } },
|
|
24
24
|
b3: { type: 'text', disabled: true, settings: { text: '<p>hidden</p>' } },
|
|
@@ -35,6 +35,7 @@ describe('theme normalizer', () => {
|
|
|
35
35
|
const { enabled, sections } = templateSections(template, () => ctx());
|
|
36
36
|
expect(enabled).toEqual(['main', 'tiles', 'faq']);
|
|
37
37
|
expect(sections.map((s) => s.key)).toEqual(['main', 'tiles', 'tiles#1', 'faq']);
|
|
38
|
+
expect(sections[0].stickyBar).toBe(true);
|
|
38
39
|
expect(sections[0].blocks).toEqual([
|
|
39
40
|
{ kind: 'image', src: 'https://www.store.test/cdn/shop/files/a%20b.png', width: 500 },
|
|
40
41
|
{ kind: 'registry', label: 'Add to Registry', links: [] },
|
|
@@ -77,9 +77,11 @@ function liquidBlock(liquid, designs, h) {
|
|
|
77
77
|
return design.build(visible, h);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function mainProduct(blocks, ctx) {
|
|
80
|
+
function mainProduct(set, blocks, ctx) {
|
|
81
81
|
return {
|
|
82
82
|
kind: 'main',
|
|
83
|
+
// The theme's sticky add-to-cart bar, shown once the buy buttons scroll away.
|
|
84
|
+
stickyBar: set.show_sticky_add_to_cart === true,
|
|
83
85
|
blocks: blocks.flatMap((b) => {
|
|
84
86
|
const bs = settingsOf(b);
|
|
85
87
|
if (b.type === 'image') return [{ kind: 'image', src: ctx.h.image(bs.image), width: bs.image_width }];
|
|
@@ -137,7 +139,7 @@ export function section(s, ctx) {
|
|
|
137
139
|
const blocks = visibleBlocks(s);
|
|
138
140
|
switch (s.type) {
|
|
139
141
|
case 'main-product':
|
|
140
|
-
return mainProduct(blocks, ctx);
|
|
142
|
+
return mainProduct(set, blocks, ctx);
|
|
141
143
|
case 'product-content':
|
|
142
144
|
// `description` is the product's own description, under the theme's label;
|
|
143
145
|
// `complementary_products` is a carousel the spacefront's agent answers instead.
|