@gem-sdk/core 1.4.4 → 1.5.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/cjs/components/ComponentWrapper.js +2 -27
- package/dist/cjs/components/ComponentWrapperPreview.js +2 -2
- package/dist/cjs/components/Render.liquid.js +64 -0
- package/dist/cjs/components/constant.js +29 -0
- package/dist/cjs/helpers/render.js +62 -0
- package/dist/cjs/index.js +7 -0
- package/dist/esm/components/ComponentWrapper.js +2 -26
- package/dist/esm/components/ComponentWrapperPreview.js +1 -1
- package/dist/esm/components/Render.liquid.js +60 -0
- package/dist/esm/components/constant.js +27 -0
- package/dist/esm/helpers/render.js +57 -0
- package/dist/esm/index.js +2 -0
- package/dist/types/index.d.ts +19 -5
- package/package.json +1 -1
|
@@ -5,41 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
8
|
+
var constant = require('./constant.js');
|
|
8
9
|
|
|
9
|
-
const disableWrap = [
|
|
10
|
-
'Col',
|
|
11
|
-
'Row',
|
|
12
|
-
'Section',
|
|
13
|
-
'Image',
|
|
14
|
-
'Text',
|
|
15
|
-
'Button',
|
|
16
|
-
'ProductButton',
|
|
17
|
-
'Cart',
|
|
18
|
-
'Tabs',
|
|
19
|
-
'TabItem',
|
|
20
|
-
'Carousel',
|
|
21
|
-
'CarouselItem',
|
|
22
|
-
'ShopPayButton',
|
|
23
|
-
'AccordionItem',
|
|
24
|
-
'Video',
|
|
25
|
-
'Header',
|
|
26
|
-
'HeroBanner',
|
|
27
|
-
'Icon',
|
|
28
|
-
'IconList',
|
|
29
|
-
'HTMLCode',
|
|
30
|
-
'IconListHoz',
|
|
31
|
-
'IconListItem',
|
|
32
|
-
'CSSCode',
|
|
33
|
-
];
|
|
34
10
|
const ComponentWrapper = ({ children, ...props }) => {
|
|
35
11
|
if (props.type === 'section')
|
|
36
12
|
return null;
|
|
37
13
|
const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag);
|
|
38
|
-
if (disableWrap.includes(props.tag) && react.isValidElement(children)) {
|
|
14
|
+
if (constant.disableWrap.includes(props.tag) && react.isValidElement(children)) {
|
|
39
15
|
return jsxRuntime.jsx(children.type, { ...children.props, ...{ style } });
|
|
40
16
|
}
|
|
41
17
|
return (jsxRuntime.jsx("div", { style: style, className: `${props.uid}`, children: children }));
|
|
42
18
|
};
|
|
43
19
|
|
|
44
20
|
exports.default = ComponentWrapper;
|
|
45
|
-
exports.disableWrap = disableWrap;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
8
|
-
var
|
|
8
|
+
var constant = require('./constant.js');
|
|
9
9
|
|
|
10
10
|
const ComponentWrapperPreview = ({ children, ...props }) => {
|
|
11
11
|
if (props.type === 'section') {
|
|
@@ -48,7 +48,7 @@ const ComponentWrapperPreview = ({ children, ...props }) => {
|
|
|
48
48
|
'data-component-tag': props.tag,
|
|
49
49
|
'data-component-label': props.label,
|
|
50
50
|
};
|
|
51
|
-
if (
|
|
51
|
+
if (constant.disableWrap.includes(props.tag) && react.isValidElement(children)) {
|
|
52
52
|
return jsxRuntime.jsx(children.type, { ...children.props, ...{ style, builderAttrs } });
|
|
53
53
|
}
|
|
54
54
|
// Render
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('react');
|
|
6
|
+
require('swr');
|
|
7
|
+
var render = require('../helpers/render.js');
|
|
8
|
+
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
9
|
+
var constant = require('./constant.js');
|
|
10
|
+
|
|
11
|
+
const Render = ({ uid, builder, components, ...passProps }) => {
|
|
12
|
+
const item = builder[uid];
|
|
13
|
+
const Component = components[item?.tag];
|
|
14
|
+
if (!Component) {
|
|
15
|
+
console.log('Miss component: ', item);
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
if (!item)
|
|
19
|
+
return null;
|
|
20
|
+
if (item?.type === 'section') {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const style = composeAdvanceStyle.composeAdvanceStyle(item.advanced, item.tag);
|
|
25
|
+
if (constant.disableWrap.includes(item.tag)) {
|
|
26
|
+
return render.RenderIf(item?.childrens?.length, () => {
|
|
27
|
+
return Component({
|
|
28
|
+
builderProps: { uid, builderData: item },
|
|
29
|
+
styles: item.styles,
|
|
30
|
+
setting: item.settings,
|
|
31
|
+
style,
|
|
32
|
+
...passProps,
|
|
33
|
+
children: item.childrens
|
|
34
|
+
.map((id) => Render({ uid: id, builder, components }))
|
|
35
|
+
.join(''),
|
|
36
|
+
});
|
|
37
|
+
}, () => Component({
|
|
38
|
+
builderProps: { uid, builderData: item },
|
|
39
|
+
styles: item.styles,
|
|
40
|
+
setting: item.settings,
|
|
41
|
+
style,
|
|
42
|
+
...passProps,
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
return render.template `<div style="${style}" class="${item.uid}">
|
|
46
|
+
${render.RenderIf(item?.childrens?.length, () => Component({
|
|
47
|
+
builderProps: { uid, builderData: item },
|
|
48
|
+
styles: item.styles,
|
|
49
|
+
setting: item.settings,
|
|
50
|
+
...passProps,
|
|
51
|
+
children: item.childrens
|
|
52
|
+
.map((id) => Render({ uid: id, builder, components }))
|
|
53
|
+
.join(''),
|
|
54
|
+
}), () => Component({
|
|
55
|
+
builderProps: { uid, builderData: item },
|
|
56
|
+
styles: item.styles,
|
|
57
|
+
setting: item.settings,
|
|
58
|
+
...passProps,
|
|
59
|
+
}))}
|
|
60
|
+
</div>`;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
exports.default = Render;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const disableWrap = [
|
|
4
|
+
'Col',
|
|
5
|
+
'Row',
|
|
6
|
+
'Section',
|
|
7
|
+
'Image',
|
|
8
|
+
'Text',
|
|
9
|
+
'Button',
|
|
10
|
+
'ProductButton',
|
|
11
|
+
'Cart',
|
|
12
|
+
'Tabs',
|
|
13
|
+
'TabItem',
|
|
14
|
+
'Carousel',
|
|
15
|
+
'CarouselItem',
|
|
16
|
+
'ShopPayButton',
|
|
17
|
+
'AccordionItem',
|
|
18
|
+
'Video',
|
|
19
|
+
'Header',
|
|
20
|
+
'HeroBanner',
|
|
21
|
+
'Icon',
|
|
22
|
+
'IconList',
|
|
23
|
+
'HTMLCode',
|
|
24
|
+
'IconListHoz',
|
|
25
|
+
'IconListItem',
|
|
26
|
+
'CSSCode',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
exports.disableWrap = disableWrap;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const RenderIf = (c, t, f) => (c ? (typeof t === 'string' ? t : t()) : (typeof f === 'string' ? f : f?.()) ?? '');
|
|
4
|
+
const isObject = (obj) => {
|
|
5
|
+
if (typeof obj === 'object' && !Array.isArray(obj) && obj !== null) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
|
+
};
|
|
10
|
+
const props = (strings, ...keys) => {
|
|
11
|
+
const props = keys[0];
|
|
12
|
+
const propsArr = [];
|
|
13
|
+
for (const attr in props) {
|
|
14
|
+
if (Object.hasOwnProperty.call(props, attr)) {
|
|
15
|
+
const val = props[attr];
|
|
16
|
+
if (val) {
|
|
17
|
+
propsArr.push(`${attr}="${val}"`);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
propsArr.push(`${attr}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return propsArr.join(' ');
|
|
25
|
+
};
|
|
26
|
+
const styles = (strings, ...keys) => {
|
|
27
|
+
const styles = keys[0];
|
|
28
|
+
const styleArr = [];
|
|
29
|
+
for (const attr in styles) {
|
|
30
|
+
if (Object.hasOwnProperty.call(styles, attr)) {
|
|
31
|
+
const val = styles[attr];
|
|
32
|
+
if (val !== undefined)
|
|
33
|
+
styleArr.push(`${attr}:${val}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return styleArr.join(';');
|
|
37
|
+
};
|
|
38
|
+
const template = (strings, ...keys) => {
|
|
39
|
+
let str = '';
|
|
40
|
+
strings.forEach((item, index) => {
|
|
41
|
+
str += item;
|
|
42
|
+
if (keys[index] !== undefined) {
|
|
43
|
+
if (isObject(keys[index])) {
|
|
44
|
+
if (/style=["|']/.test(item)) {
|
|
45
|
+
str += styles `${keys[index]}`;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
str += props `${keys[index]}`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
str += keys[index];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return str;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.RenderIf = RenderIf;
|
|
60
|
+
exports.props = props;
|
|
61
|
+
exports.styles = styles;
|
|
62
|
+
exports.template = template;
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var AddOn = require('./components/AddOn.js');
|
|
4
4
|
var Render = require('./components/Render.js');
|
|
5
5
|
var RenderPreview = require('./components/RenderPreview.js');
|
|
6
|
+
var Render_liquid = require('./components/Render.liquid.js');
|
|
6
7
|
var AddonContext = require('./contexts/AddonContext.js');
|
|
7
8
|
var BuilderComponent = require('./contexts/BuilderComponent.js');
|
|
8
9
|
var BuilderContext = require('./contexts/BuilderContext.js');
|
|
@@ -47,6 +48,7 @@ var product = require('./helpers/product.js');
|
|
|
47
48
|
var fpixel = require('./helpers/tracking/fpixel.js');
|
|
48
49
|
var gtag = require('./helpers/tracking/gtag.js');
|
|
49
50
|
var tiktokpixel = require('./helpers/tracking/tiktokpixel.js');
|
|
51
|
+
var render = require('./helpers/render.js');
|
|
50
52
|
var useAddToCart = require('./hooks/cart/use-add-to-cart.js');
|
|
51
53
|
var useCartData = require('./hooks/cart/use-cart-data.js');
|
|
52
54
|
var useCartDiscountCodesUpdate = require('./hooks/cart/use-cart-discount-codes-update.js');
|
|
@@ -85,6 +87,7 @@ var getProductBySlug = require('./helpers/queries/get-product-by-slug.js');
|
|
|
85
87
|
exports.AddOn = AddOn.default;
|
|
86
88
|
exports.Render = Render.default;
|
|
87
89
|
exports.RenderPreview = RenderPreview.default;
|
|
90
|
+
exports.RenderLiquid = Render_liquid.default;
|
|
88
91
|
exports.AddonProvider = AddonContext.AddonProvider;
|
|
89
92
|
exports.useAddon = AddonContext.useAddon;
|
|
90
93
|
exports.useAddons = AddonContext.useAddons;
|
|
@@ -168,6 +171,10 @@ exports.parseSelectedOption = product.parseSelectedOption;
|
|
|
168
171
|
exports.fpixel = fpixel;
|
|
169
172
|
exports.gtag = gtag;
|
|
170
173
|
exports.tiktokpixel = tiktokpixel;
|
|
174
|
+
exports.RenderIf = render.RenderIf;
|
|
175
|
+
exports.props = render.props;
|
|
176
|
+
exports.styles = render.styles;
|
|
177
|
+
exports.template = render.template;
|
|
171
178
|
exports.useAddToCart = useAddToCart.useAddToCart;
|
|
172
179
|
exports.useCartData = useCartData.useCartData;
|
|
173
180
|
exports.useCartDiscountCodesUpdate = useCartDiscountCodesUpdate.useCartDiscountCodesUpdate;
|
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { isValidElement } from 'react';
|
|
3
3
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
4
|
+
import { disableWrap } from './constant.js';
|
|
4
5
|
|
|
5
|
-
const disableWrap = [
|
|
6
|
-
'Col',
|
|
7
|
-
'Row',
|
|
8
|
-
'Section',
|
|
9
|
-
'Image',
|
|
10
|
-
'Text',
|
|
11
|
-
'Button',
|
|
12
|
-
'ProductButton',
|
|
13
|
-
'Cart',
|
|
14
|
-
'Tabs',
|
|
15
|
-
'TabItem',
|
|
16
|
-
'Carousel',
|
|
17
|
-
'CarouselItem',
|
|
18
|
-
'ShopPayButton',
|
|
19
|
-
'AccordionItem',
|
|
20
|
-
'Video',
|
|
21
|
-
'Header',
|
|
22
|
-
'HeroBanner',
|
|
23
|
-
'Icon',
|
|
24
|
-
'IconList',
|
|
25
|
-
'HTMLCode',
|
|
26
|
-
'IconListHoz',
|
|
27
|
-
'IconListItem',
|
|
28
|
-
'CSSCode',
|
|
29
|
-
];
|
|
30
6
|
const ComponentWrapper = ({ children, ...props }) => {
|
|
31
7
|
if (props.type === 'section')
|
|
32
8
|
return null;
|
|
@@ -37,4 +13,4 @@ const ComponentWrapper = ({ children, ...props }) => {
|
|
|
37
13
|
return (jsx("div", { style: style, className: `${props.uid}`, children: children }));
|
|
38
14
|
};
|
|
39
15
|
|
|
40
|
-
export { ComponentWrapper as default
|
|
16
|
+
export { ComponentWrapper as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { isValidElement } from 'react';
|
|
3
3
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
4
|
-
import { disableWrap } from './
|
|
4
|
+
import { disableWrap } from './constant.js';
|
|
5
5
|
|
|
6
6
|
const ComponentWrapperPreview = ({ children, ...props }) => {
|
|
7
7
|
if (props.type === 'section') {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import 'swr';
|
|
3
|
+
import { RenderIf, template } from '../helpers/render.js';
|
|
4
|
+
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
5
|
+
import { disableWrap } from './constant.js';
|
|
6
|
+
|
|
7
|
+
const Render = ({ uid, builder, components, ...passProps }) => {
|
|
8
|
+
const item = builder[uid];
|
|
9
|
+
const Component = components[item?.tag];
|
|
10
|
+
if (!Component) {
|
|
11
|
+
console.log('Miss component: ', item);
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
if (!item)
|
|
15
|
+
return null;
|
|
16
|
+
if (item?.type === 'section') {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const style = composeAdvanceStyle(item.advanced, item.tag);
|
|
21
|
+
if (disableWrap.includes(item.tag)) {
|
|
22
|
+
return RenderIf(item?.childrens?.length, () => {
|
|
23
|
+
return Component({
|
|
24
|
+
builderProps: { uid, builderData: item },
|
|
25
|
+
styles: item.styles,
|
|
26
|
+
setting: item.settings,
|
|
27
|
+
style,
|
|
28
|
+
...passProps,
|
|
29
|
+
children: item.childrens
|
|
30
|
+
.map((id) => Render({ uid: id, builder, components }))
|
|
31
|
+
.join(''),
|
|
32
|
+
});
|
|
33
|
+
}, () => Component({
|
|
34
|
+
builderProps: { uid, builderData: item },
|
|
35
|
+
styles: item.styles,
|
|
36
|
+
setting: item.settings,
|
|
37
|
+
style,
|
|
38
|
+
...passProps,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
return template `<div style="${style}" class="${item.uid}">
|
|
42
|
+
${RenderIf(item?.childrens?.length, () => Component({
|
|
43
|
+
builderProps: { uid, builderData: item },
|
|
44
|
+
styles: item.styles,
|
|
45
|
+
setting: item.settings,
|
|
46
|
+
...passProps,
|
|
47
|
+
children: item.childrens
|
|
48
|
+
.map((id) => Render({ uid: id, builder, components }))
|
|
49
|
+
.join(''),
|
|
50
|
+
}), () => Component({
|
|
51
|
+
builderProps: { uid, builderData: item },
|
|
52
|
+
styles: item.styles,
|
|
53
|
+
setting: item.settings,
|
|
54
|
+
...passProps,
|
|
55
|
+
}))}
|
|
56
|
+
</div>`;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { Render as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const disableWrap = [
|
|
2
|
+
'Col',
|
|
3
|
+
'Row',
|
|
4
|
+
'Section',
|
|
5
|
+
'Image',
|
|
6
|
+
'Text',
|
|
7
|
+
'Button',
|
|
8
|
+
'ProductButton',
|
|
9
|
+
'Cart',
|
|
10
|
+
'Tabs',
|
|
11
|
+
'TabItem',
|
|
12
|
+
'Carousel',
|
|
13
|
+
'CarouselItem',
|
|
14
|
+
'ShopPayButton',
|
|
15
|
+
'AccordionItem',
|
|
16
|
+
'Video',
|
|
17
|
+
'Header',
|
|
18
|
+
'HeroBanner',
|
|
19
|
+
'Icon',
|
|
20
|
+
'IconList',
|
|
21
|
+
'HTMLCode',
|
|
22
|
+
'IconListHoz',
|
|
23
|
+
'IconListItem',
|
|
24
|
+
'CSSCode',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export { disableWrap };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const RenderIf = (c, t, f) => (c ? (typeof t === 'string' ? t : t()) : (typeof f === 'string' ? f : f?.()) ?? '');
|
|
2
|
+
const isObject = (obj) => {
|
|
3
|
+
if (typeof obj === 'object' && !Array.isArray(obj) && obj !== null) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
return false;
|
|
7
|
+
};
|
|
8
|
+
const props = (strings, ...keys) => {
|
|
9
|
+
const props = keys[0];
|
|
10
|
+
const propsArr = [];
|
|
11
|
+
for (const attr in props) {
|
|
12
|
+
if (Object.hasOwnProperty.call(props, attr)) {
|
|
13
|
+
const val = props[attr];
|
|
14
|
+
if (val) {
|
|
15
|
+
propsArr.push(`${attr}="${val}"`);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
propsArr.push(`${attr}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return propsArr.join(' ');
|
|
23
|
+
};
|
|
24
|
+
const styles = (strings, ...keys) => {
|
|
25
|
+
const styles = keys[0];
|
|
26
|
+
const styleArr = [];
|
|
27
|
+
for (const attr in styles) {
|
|
28
|
+
if (Object.hasOwnProperty.call(styles, attr)) {
|
|
29
|
+
const val = styles[attr];
|
|
30
|
+
if (val !== undefined)
|
|
31
|
+
styleArr.push(`${attr}:${val}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return styleArr.join(';');
|
|
35
|
+
};
|
|
36
|
+
const template = (strings, ...keys) => {
|
|
37
|
+
let str = '';
|
|
38
|
+
strings.forEach((item, index) => {
|
|
39
|
+
str += item;
|
|
40
|
+
if (keys[index] !== undefined) {
|
|
41
|
+
if (isObject(keys[index])) {
|
|
42
|
+
if (/style=["|']/.test(item)) {
|
|
43
|
+
str += styles `${keys[index]}`;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
str += props `${keys[index]}`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
str += keys[index];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return str;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { RenderIf, props, styles, template };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as AddOn } from './components/AddOn.js';
|
|
2
2
|
export { default as Render } from './components/Render.js';
|
|
3
3
|
export { default as RenderPreview } from './components/RenderPreview.js';
|
|
4
|
+
export { default as RenderLiquid } from './components/Render.liquid.js';
|
|
4
5
|
export { AddonProvider, useAddon, useAddons } from './contexts/AddonContext.js';
|
|
5
6
|
export { BuilderComponentProvider, useBuilderComponent } from './contexts/BuilderComponent.js';
|
|
6
7
|
export { BuilderProvider, useBuilderStore } from './contexts/BuilderContext.js';
|
|
@@ -48,6 +49,7 @@ import * as gtag from './helpers/tracking/gtag.js';
|
|
|
48
49
|
export { gtag };
|
|
49
50
|
import * as tiktokpixel from './helpers/tracking/tiktokpixel.js';
|
|
50
51
|
export { tiktokpixel };
|
|
52
|
+
export { RenderIf, props, styles, template } from './helpers/render.js';
|
|
51
53
|
export { useAddToCart } from './hooks/cart/use-add-to-cart.js';
|
|
52
54
|
export { useCartData } from './hooks/cart/use-cart-data.js';
|
|
53
55
|
export { useCartDiscountCodesUpdate } from './hooks/cart/use-cart-discount-codes-update.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,17 +13,25 @@ declare const AddOn: React.FC<{
|
|
|
13
13
|
name: string;
|
|
14
14
|
}>;
|
|
15
15
|
|
|
16
|
+
type Props$2 = {
|
|
17
|
+
uid: string;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
20
|
+
declare const RenderMemo: React.NamedExoticComponent<Props$2>;
|
|
21
|
+
|
|
16
22
|
type Props$1 = {
|
|
17
23
|
uid: string;
|
|
18
24
|
[key: string]: any;
|
|
19
25
|
};
|
|
20
|
-
declare const
|
|
26
|
+
declare const RenderPreviewMemo: React.NamedExoticComponent<Props$1>;
|
|
21
27
|
|
|
22
28
|
type Props = {
|
|
23
29
|
uid: string;
|
|
30
|
+
builder: Record<string, any>;
|
|
31
|
+
components: Record<string, any>;
|
|
24
32
|
[key: string]: any;
|
|
25
33
|
};
|
|
26
|
-
declare const
|
|
34
|
+
declare const Render: ({ uid, builder, components, ...passProps }: Props) => string | null;
|
|
27
35
|
|
|
28
36
|
type AddonContextProps = {
|
|
29
37
|
components: Record<string, React.ComponentType<any>>;
|
|
@@ -7253,6 +7261,12 @@ declare namespace tiktokpixel {
|
|
|
7253
7261
|
};
|
|
7254
7262
|
}
|
|
7255
7263
|
|
|
7264
|
+
type CallbackCondition = () => string;
|
|
7265
|
+
declare const RenderIf: (c: boolean | null | undefined, t: string | CallbackCondition, f?: string | CallbackCondition) => string;
|
|
7266
|
+
declare const props: (strings: any, ...keys: any[]) => string;
|
|
7267
|
+
declare const styles: (strings: any, ...keys: any[]) => string;
|
|
7268
|
+
declare const template: (strings: any, ...keys: any[]) => string;
|
|
7269
|
+
|
|
7256
7270
|
type Func$6 = ReturnType<typeof addToCartOperation>;
|
|
7257
7271
|
type Response$6 = Awaited<ReturnType<Func$6>>;
|
|
7258
7272
|
type Args$7 = Parameters<Func$6>[0];
|
|
@@ -7388,11 +7402,11 @@ declare const useSelectedOption: () => {
|
|
|
7388
7402
|
[key: string]: any;
|
|
7389
7403
|
} | undefined) => void;
|
|
7390
7404
|
};
|
|
7391
|
-
declare const useVariants: () => Maybe<Pick<ProductVariant, "title" | "width" | "length" | "
|
|
7405
|
+
declare const useVariants: () => Maybe<Pick<ProductVariant, "title" | "width" | "length" | "height" | "weight" | "id" | "barcode" | "baseID" | "costPrice" | "inventoryPolicy" | "inventoryQuantity" | "inventoryStatus" | "isDigital" | "lowInventoryAmount" | "manageInventory" | "mediaId" | "platform" | "price" | "salePrice" | "sku" | "soldIndividually"> & {
|
|
7392
7406
|
selectedOptions: Pick<SelectedOption, "value" | "name" | "optionType">[];
|
|
7393
7407
|
media?: Maybe<Pick<Media, "width" | "height" | "id" | "contentType" | "src" | "alt">>;
|
|
7394
7408
|
}>[];
|
|
7395
|
-
declare const useVariant: (id: string) => Maybe<Pick<ProductVariant, "title" | "width" | "length" | "
|
|
7409
|
+
declare const useVariant: (id: string) => Maybe<Pick<ProductVariant, "title" | "width" | "length" | "height" | "weight" | "id" | "barcode" | "baseID" | "costPrice" | "inventoryPolicy" | "inventoryQuantity" | "inventoryStatus" | "isDigital" | "lowInventoryAmount" | "manageInventory" | "mediaId" | "platform" | "price" | "salePrice" | "sku" | "soldIndividually"> & {
|
|
7396
7410
|
selectedOptions: Pick<SelectedOption, "value" | "name" | "optionType">[];
|
|
7397
7411
|
media?: Maybe<Pick<Media, "width" | "height" | "id" | "contentType" | "src" | "alt">>;
|
|
7398
7412
|
}>;
|
|
@@ -7463,4 +7477,4 @@ declare const fetchMedias: (fetcher: FetchFunc, { id, isSample }: FetchParams) =
|
|
|
7463
7477
|
|
|
7464
7478
|
declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
|
|
7465
7479
|
|
|
7466
|
-
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, Border, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentSetting, ContainerProp, ControlProp, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchFunc, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RoundedSize, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographyType, VariantSelectFragment, calculateFirstProduct, cls, composeRadius, composeSize, composeSpacing, fetchMedias, fetchVariants, flattenConnection, fpixel, genTypoClass, genVariable, getCollection, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, isBrowser, isColor, isDefined, isEmptyChildren, loadScript, makeAspectRatio, makeHeight, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, prefetchQueries, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCollection, useCollectionQuery, useCollectionStore, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useMoney, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
|
|
7480
|
+
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, Border, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentSetting, ContainerProp, ControlProp, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchFunc, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RoundedSize, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographyType, VariantSelectFragment, calculateFirstProduct, cls, composeRadius, composeSize, composeSpacing, fetchMedias, fetchVariants, flattenConnection, fpixel, genTypoClass, genVariable, getCollection, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, isBrowser, isColor, isDefined, isEmptyChildren, loadScript, makeAspectRatio, makeHeight, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, prefetchQueries, props, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCollection, useCollectionQuery, useCollectionStore, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useMoney, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
|