webcake-storefront-mcp 1.0.1
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/README.md +1166 -0
- package/dist/api.js +346 -0
- package/dist/auth/login.js +87 -0
- package/dist/builder/catalog.js +186 -0
- package/dist/builder/factory.js +1677 -0
- package/dist/builder/guide.js +64 -0
- package/dist/builder/page.js +149 -0
- package/dist/config.js +97 -0
- package/dist/db.js +96 -0
- package/dist/guides.js +93 -0
- package/dist/http.js +120 -0
- package/dist/index.js +73 -0
- package/dist/install.js +140 -0
- package/dist/mongo.js +102 -0
- package/dist/server.js +63 -0
- package/dist/smoke.js +81 -0
- package/dist/tools/apps.js +7 -0
- package/dist/tools/articles.js +53 -0
- package/dist/tools/automation.js +8 -0
- package/dist/tools/builder-extras.js +165 -0
- package/dist/tools/builder.js +124 -0
- package/dist/tools/cms-files.js +255 -0
- package/dist/tools/collections.js +31 -0
- package/dist/tools/combos.js +72 -0
- package/dist/tools/context.js +158 -0
- package/dist/tools/customers.js +13 -0
- package/dist/tools/global-sources.js +662 -0
- package/dist/tools/images.js +875 -0
- package/dist/tools/orders.js +32 -0
- package/dist/tools/pages.js +621 -0
- package/dist/tools/products.js +38 -0
- package/dist/tools/promotions.js +131 -0
- package/dist/tools/site-style.js +157 -0
- package/package.json +38 -0
|
@@ -0,0 +1,1677 @@
|
|
|
1
|
+
// Ported verbatim from builderx_spa/src/common/factory.js — the source of truth for
|
|
2
|
+
// BuilderX page component nodes. Only the two original imports (lodash + ./index.js)
|
|
3
|
+
// are replaced by the local shims below so this runs standalone inside the MCP.
|
|
4
|
+
const cloneDeep = (o) => structuredClone(o);
|
|
5
|
+
const get = (obj, path, dflt) => {
|
|
6
|
+
let cur = obj;
|
|
7
|
+
for (const k of path) {
|
|
8
|
+
if (cur == null)
|
|
9
|
+
return dflt;
|
|
10
|
+
cur = cur[k];
|
|
11
|
+
}
|
|
12
|
+
return cur === undefined ? dflt : cur;
|
|
13
|
+
};
|
|
14
|
+
export const randomString = (length) => [...Array(length)].map(() => (~~(Math.random() * 36)).toString(36)).join('');
|
|
15
|
+
const SKELETON = {
|
|
16
|
+
id: '',
|
|
17
|
+
name: '',
|
|
18
|
+
type: '',
|
|
19
|
+
specials: {},
|
|
20
|
+
runtime: {}
|
|
21
|
+
};
|
|
22
|
+
export const createSection = () => {
|
|
23
|
+
const section = cloneDeep(SKELETON);
|
|
24
|
+
section.id = 'SECTION-' + randomString(8);
|
|
25
|
+
section.type = 'section';
|
|
26
|
+
section.children = [];
|
|
27
|
+
return section;
|
|
28
|
+
};
|
|
29
|
+
export const createText = (opts = {}) => {
|
|
30
|
+
const text = cloneDeep(SKELETON);
|
|
31
|
+
text.id = 'TEXT-' + randomString(8);
|
|
32
|
+
text.type = 'text';
|
|
33
|
+
text.specials.text = opts.text || 'Add a heading';
|
|
34
|
+
text.specials = { ...text.specials, ...opts.specials };
|
|
35
|
+
text.runtime.style = {
|
|
36
|
+
width: 230,
|
|
37
|
+
height: 44,
|
|
38
|
+
color: '#000000',
|
|
39
|
+
...opts.style,
|
|
40
|
+
};
|
|
41
|
+
text.runtime.config = {
|
|
42
|
+
...(opts.config || {}),
|
|
43
|
+
heightUnit: 'auto'
|
|
44
|
+
};
|
|
45
|
+
if (Object.prototype.hasOwnProperty.call(opts, 'top'))
|
|
46
|
+
text.runtime.style.top = opts.top;
|
|
47
|
+
if (Object.prototype.hasOwnProperty.call(opts, 'left'))
|
|
48
|
+
text.runtime.style.left = opts.left;
|
|
49
|
+
if (opts.breakpoint) {
|
|
50
|
+
buildElementWithBreakpoint(text, opts.breakpoint);
|
|
51
|
+
}
|
|
52
|
+
return text;
|
|
53
|
+
};
|
|
54
|
+
export const createLine = (opts = {}) => {
|
|
55
|
+
const line = cloneDeep(SKELETON);
|
|
56
|
+
line.id = `LINE-${randomString(8)}`;
|
|
57
|
+
line.type = 'line';
|
|
58
|
+
line.runtime.style = {
|
|
59
|
+
width: opts.width || 245,
|
|
60
|
+
...(opts.style || {}),
|
|
61
|
+
};
|
|
62
|
+
line.runtime.config = {
|
|
63
|
+
...(opts.config || {})
|
|
64
|
+
};
|
|
65
|
+
line.specials = opts.specials || {};
|
|
66
|
+
if (opts.breakpoint) {
|
|
67
|
+
buildElementWithBreakpoint(line, opts.breakpoint);
|
|
68
|
+
}
|
|
69
|
+
return line;
|
|
70
|
+
};
|
|
71
|
+
export const createRectangle = (opts = {}) => {
|
|
72
|
+
const rect = cloneDeep(SKELETON);
|
|
73
|
+
rect.id = 'RECT-' + randomString(8);
|
|
74
|
+
rect.type = 'rectangle';
|
|
75
|
+
rect.runtime.style = {
|
|
76
|
+
width: opts.width || 100,
|
|
77
|
+
height: opts.height || 100,
|
|
78
|
+
background: opts.background || 'rgba(160, 162, 164, 1)',
|
|
79
|
+
...opts.style,
|
|
80
|
+
};
|
|
81
|
+
if (opts.bindings)
|
|
82
|
+
rect.bindings = opts.bindings || [];
|
|
83
|
+
if (opts.mask)
|
|
84
|
+
rect.runtime.config = { mask: opts.mask, maskId: opts.maskId };
|
|
85
|
+
if (opts.config)
|
|
86
|
+
rect.runtime.config = {
|
|
87
|
+
...rect.runtime.config,
|
|
88
|
+
...opts.config
|
|
89
|
+
};
|
|
90
|
+
if (opts.events)
|
|
91
|
+
rect.events = opts.events || [];
|
|
92
|
+
return rect;
|
|
93
|
+
};
|
|
94
|
+
export const createImage = (opts = {}) => {
|
|
95
|
+
const image = cloneDeep(SKELETON);
|
|
96
|
+
image.id = 'IMAGE-' + randomString(8);
|
|
97
|
+
image.type = 'image';
|
|
98
|
+
image.runtime.style = {
|
|
99
|
+
...(opts.style || {}),
|
|
100
|
+
width: opts.width || 300,
|
|
101
|
+
height: opts.height || 200,
|
|
102
|
+
};
|
|
103
|
+
image.runtime.config = {
|
|
104
|
+
heightUnit: 'auto',
|
|
105
|
+
...(opts.config || {})
|
|
106
|
+
};
|
|
107
|
+
if (opts.top)
|
|
108
|
+
image.runtime.style.top = opts.top;
|
|
109
|
+
if (opts.left)
|
|
110
|
+
image.runtime.style.left = opts.left;
|
|
111
|
+
if (opts.src)
|
|
112
|
+
image.runtime.config.src = opts.src;
|
|
113
|
+
return image;
|
|
114
|
+
};
|
|
115
|
+
export const createVideo = (opts = {}) => {
|
|
116
|
+
const video = cloneDeep(SKELETON);
|
|
117
|
+
video.id = 'VIDEO-' + randomString(8);
|
|
118
|
+
video.type = 'video';
|
|
119
|
+
video.runtime.style = {
|
|
120
|
+
width: 350,
|
|
121
|
+
height: 200
|
|
122
|
+
};
|
|
123
|
+
if (opts.top)
|
|
124
|
+
video.runtime.style.top = opts.top;
|
|
125
|
+
if (opts.left)
|
|
126
|
+
video.runtime.style.left = opts.left;
|
|
127
|
+
video.specials.src = opts.src || 'https://video-public.canva.com/VADbyHzfXOU/videos/061f7ce036.mp4';
|
|
128
|
+
video.specials.thumbnail = opts.thumbnail || 'https://video-public.canva.com/VADbyHzfXOU/v/915b8706ad.jpg';
|
|
129
|
+
video.specials.time = opts.time || '10.0s';
|
|
130
|
+
video.specials.type = 'store';
|
|
131
|
+
return video;
|
|
132
|
+
};
|
|
133
|
+
export const createButton = (opts = {}) => {
|
|
134
|
+
const button = cloneDeep(SKELETON);
|
|
135
|
+
button.id = 'BUTTON-' + randomString(8);
|
|
136
|
+
button.type = 'button';
|
|
137
|
+
button.runtime.style = {
|
|
138
|
+
width: 142,
|
|
139
|
+
height: 46,
|
|
140
|
+
fontSize: '16px',
|
|
141
|
+
...(opts.style || {}),
|
|
142
|
+
};
|
|
143
|
+
button.runtime.config = {
|
|
144
|
+
...(opts.config || {})
|
|
145
|
+
};
|
|
146
|
+
button.specials.text = opts.text || 'Button';
|
|
147
|
+
if (opts.events)
|
|
148
|
+
button.events = opts.events;
|
|
149
|
+
delete button.runtime.style['text'];
|
|
150
|
+
if (opts.breakpoint) {
|
|
151
|
+
buildElementWithBreakpoint(button, opts.breakpoint);
|
|
152
|
+
}
|
|
153
|
+
return button;
|
|
154
|
+
};
|
|
155
|
+
export const createContainer = (opts = {}) => {
|
|
156
|
+
const container = cloneDeep(SKELETON);
|
|
157
|
+
container.id = 'CONTAINER-' + randomString(8);
|
|
158
|
+
container.type = 'container';
|
|
159
|
+
container.children = opts.children || [];
|
|
160
|
+
container.style = { ...(opts.style || {}) };
|
|
161
|
+
if (opts.runtime)
|
|
162
|
+
container.runtime = opts.runtime || {};
|
|
163
|
+
return container;
|
|
164
|
+
};
|
|
165
|
+
export const createCarousel = (opts = {}) => {
|
|
166
|
+
const carousel = cloneDeep(SKELETON);
|
|
167
|
+
carousel.id = 'CAROUSEL-' + randomString(8);
|
|
168
|
+
carousel.type = 'carousel';
|
|
169
|
+
carousel.children = opts.children || [];
|
|
170
|
+
carousel.runtime.style = {
|
|
171
|
+
width: opts.width || 750,
|
|
172
|
+
height: opts.height || 250
|
|
173
|
+
};
|
|
174
|
+
carousel.runtime.config = {
|
|
175
|
+
grid: '3x1',
|
|
176
|
+
columns: [{ unit: 'fr', value: 1 }, { unit: 'fr', value: 1 }, { unit: 'fr', value: 1 }],
|
|
177
|
+
rows: [
|
|
178
|
+
{
|
|
179
|
+
unit: 'min/max',
|
|
180
|
+
min: {
|
|
181
|
+
unit: 'px',
|
|
182
|
+
absValue: 250
|
|
183
|
+
},
|
|
184
|
+
max: {
|
|
185
|
+
unit: 'max-c'
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
slideWidth: opts.slideWidth || 250,
|
|
190
|
+
slideItems: opts.slideItems || 3,
|
|
191
|
+
heightUnit: 'auto',
|
|
192
|
+
...opts.config
|
|
193
|
+
};
|
|
194
|
+
return carousel;
|
|
195
|
+
};
|
|
196
|
+
export const createGallery = (opts = {}) => {
|
|
197
|
+
const gallery = cloneDeep(SKELETON);
|
|
198
|
+
gallery.id = 'GALLERY-' + randomString(8);
|
|
199
|
+
gallery.type = 'gallery';
|
|
200
|
+
gallery.runtime.style = {
|
|
201
|
+
...opts.style,
|
|
202
|
+
width: opts.width || 500,
|
|
203
|
+
height: opts.height || 300,
|
|
204
|
+
};
|
|
205
|
+
// gallery.specials.showThumbnail = opts.showThumbnail
|
|
206
|
+
// gallery.specials.showNavigation = opts.showNavigation
|
|
207
|
+
gallery.specials.media = opts.media || [];
|
|
208
|
+
gallery.runtime.config = {
|
|
209
|
+
heightUnit: 'auto',
|
|
210
|
+
showThumbnail: opts.showThumbnail,
|
|
211
|
+
showNavigation: opts.showNavigation,
|
|
212
|
+
thumbnailPosition: opts.thumbnailPosition || "none",
|
|
213
|
+
};
|
|
214
|
+
// if (opts.thumbnailPosition) gallery.specials.thumbnailPosition = opts.thumbnailPosition
|
|
215
|
+
return gallery;
|
|
216
|
+
};
|
|
217
|
+
export const createSwiper = (opts = {}) => {
|
|
218
|
+
const swiper = cloneDeep(SKELETON);
|
|
219
|
+
swiper.id = 'SWIPER-' + randomString(8);
|
|
220
|
+
swiper.type = 'swiper';
|
|
221
|
+
swiper.runtime.style = {
|
|
222
|
+
...opts.style,
|
|
223
|
+
width: opts.width || 500,
|
|
224
|
+
height: opts.height || 300,
|
|
225
|
+
};
|
|
226
|
+
swiper.runtime.config = {
|
|
227
|
+
...(opts.config || {}),
|
|
228
|
+
heightUnit: 'auto'
|
|
229
|
+
};
|
|
230
|
+
return swiper;
|
|
231
|
+
};
|
|
232
|
+
export const createSlide = (opts = {}) => {
|
|
233
|
+
const slide = cloneDeep(SKELETON);
|
|
234
|
+
slide.id = 'SLIDE-' + randomString(8);
|
|
235
|
+
slide.type = 'slide';
|
|
236
|
+
slide.runtime.style = {
|
|
237
|
+
...opts.style,
|
|
238
|
+
width: opts.width || 500,
|
|
239
|
+
height: opts.height || 300,
|
|
240
|
+
};
|
|
241
|
+
slide.runtime.config = {
|
|
242
|
+
heightUnit: 'auto',
|
|
243
|
+
widthUnit: 'auto',
|
|
244
|
+
grid: '1x1',
|
|
245
|
+
columns: [{ unit: 'fr', value: 1 }],
|
|
246
|
+
rows: [{ unit: 'min/max', min: { unit: 'px', absValue: 300 }, max: { unit: 'max-c' } }],
|
|
247
|
+
};
|
|
248
|
+
slide.children = [
|
|
249
|
+
...opts.children
|
|
250
|
+
];
|
|
251
|
+
if (opts.extra) {
|
|
252
|
+
Object.keys(opts.extra)?.forEach((key) => {
|
|
253
|
+
slide[key] = opts.extra[key];
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return slide;
|
|
257
|
+
};
|
|
258
|
+
export const createGoogleMap = (opts = {}) => {
|
|
259
|
+
const googlemap = cloneDeep(SKELETON);
|
|
260
|
+
googlemap.id = 'GOOGLEMAP-' + randomString(8);
|
|
261
|
+
googlemap.type = 'googlemap';
|
|
262
|
+
googlemap.specials.iframe = opts.iframe;
|
|
263
|
+
googlemap.runtime.style = {
|
|
264
|
+
width: opts.width || 500,
|
|
265
|
+
height: opts.height || 300
|
|
266
|
+
};
|
|
267
|
+
return googlemap;
|
|
268
|
+
};
|
|
269
|
+
export const createMenu = (opts = {}) => {
|
|
270
|
+
const menu = cloneDeep(SKELETON);
|
|
271
|
+
menu.id = 'MENU-' + randomString(8);
|
|
272
|
+
menu.type = 'menu';
|
|
273
|
+
menu.runtime.style = { ...opts.style };
|
|
274
|
+
menu.runtime.config = { ...opts.config };
|
|
275
|
+
menu.specials = opts.specials || {};
|
|
276
|
+
if (opts.children)
|
|
277
|
+
menu.children = opts.children || [];
|
|
278
|
+
return menu;
|
|
279
|
+
};
|
|
280
|
+
export const createCountDown = (opts = {}) => {
|
|
281
|
+
const countdown = cloneDeep(SKELETON);
|
|
282
|
+
countdown.id = 'COUNTDOWN-' + randomString(8);
|
|
283
|
+
countdown.type = 'countdown';
|
|
284
|
+
countdown.runtime.style = { ...opts.style };
|
|
285
|
+
countdown.runtime.config = { ...opts.config };
|
|
286
|
+
countdown.specials = { ...opts.specials };
|
|
287
|
+
return countdown;
|
|
288
|
+
};
|
|
289
|
+
export const createEmbed = (opts = {}) => {
|
|
290
|
+
const embed = cloneDeep(SKELETON);
|
|
291
|
+
embed.id = 'EMBED-' + randomString(8);
|
|
292
|
+
embed.type = 'embed';
|
|
293
|
+
embed.specials = { ...opts.specials };
|
|
294
|
+
embed.runtime.style = { ...opts.style };
|
|
295
|
+
embed.runtime.style = {
|
|
296
|
+
width: opts.width || 470,
|
|
297
|
+
height: opts.height || 270
|
|
298
|
+
};
|
|
299
|
+
return embed;
|
|
300
|
+
};
|
|
301
|
+
export const createNotify = (opts = {}) => {
|
|
302
|
+
const notify = cloneDeep(SKELETON);
|
|
303
|
+
notify.id = 'NOTIFY-' + randomString(8);
|
|
304
|
+
notify.type = 'notify';
|
|
305
|
+
notify.specials = { ...opts.specials };
|
|
306
|
+
notify.runtime.style = { ...opts.style };
|
|
307
|
+
notify.runtime.config = { ...opts.config };
|
|
308
|
+
if (opts.children)
|
|
309
|
+
notify.children = opts.children || [];
|
|
310
|
+
return notify;
|
|
311
|
+
};
|
|
312
|
+
export const createForm = (opts = {}) => {
|
|
313
|
+
const form = cloneDeep(SKELETON);
|
|
314
|
+
form.id = 'FORM-' + randomString(8);
|
|
315
|
+
form.type = 'form';
|
|
316
|
+
form.children = opts.children || [];
|
|
317
|
+
form.runtime.style = { ...opts.style };
|
|
318
|
+
form.runtime.config = { ...opts.config };
|
|
319
|
+
form.specials = { ...opts.specials };
|
|
320
|
+
return form;
|
|
321
|
+
};
|
|
322
|
+
export const createInput = (opts = {}) => {
|
|
323
|
+
const input = cloneDeep(SKELETON);
|
|
324
|
+
input.id = 'INPUT-' + randomString(8);
|
|
325
|
+
input.type = 'input';
|
|
326
|
+
input.runtime.config = { ...opts.config };
|
|
327
|
+
input.runtime.style = { ...opts.style };
|
|
328
|
+
input.specials = { ...opts.specials };
|
|
329
|
+
if (opts.breakpoint) {
|
|
330
|
+
buildElementWithBreakpoint(input, opts.breakpoint);
|
|
331
|
+
}
|
|
332
|
+
return input;
|
|
333
|
+
};
|
|
334
|
+
export const createInputProductNote = (opts = {}) => {
|
|
335
|
+
const input = cloneDeep(SKELETON);
|
|
336
|
+
input.id = 'INPUT-PRODUCT-NOTE' + randomString(8);
|
|
337
|
+
input.type = 'input-product-note';
|
|
338
|
+
input.runtime.config = { ...opts.config };
|
|
339
|
+
input.runtime.style = { ...opts.style };
|
|
340
|
+
input.specials = { ...opts.specials };
|
|
341
|
+
return input;
|
|
342
|
+
};
|
|
343
|
+
export const createTextArea = (opts = {}) => {
|
|
344
|
+
const textArea = cloneDeep(SKELETON);
|
|
345
|
+
textArea.id = 'TEXTAREA-' + randomString(8);
|
|
346
|
+
textArea.type = 'text-area';
|
|
347
|
+
textArea.runtime.config = { ...opts.config };
|
|
348
|
+
textArea.runtime.style = { ...opts.style };
|
|
349
|
+
textArea.specials = { ...opts.specials };
|
|
350
|
+
if (opts.breakpoint) {
|
|
351
|
+
buildElementWithBreakpoint(textArea, opts.breakpoint);
|
|
352
|
+
}
|
|
353
|
+
return textArea;
|
|
354
|
+
};
|
|
355
|
+
export const buildElementWithBreakpoint = (el, breakpoint) => {
|
|
356
|
+
const customStyle = get(el, ['runtime', 'style'], {});
|
|
357
|
+
el[breakpoint] = { style: {}, config: {} };
|
|
358
|
+
el[breakpoint].style = Object.assign({}, el[breakpoint].style, customStyle);
|
|
359
|
+
const customConfig = get(el, ['runtime', 'config'], {});
|
|
360
|
+
el[breakpoint].config = Object.assign({}, el[breakpoint].config, customConfig);
|
|
361
|
+
el[breakpoint].config.loaded = true;
|
|
362
|
+
const customSpecials = get(el, ['runtime', 'specials'], {});
|
|
363
|
+
el.specials = Object.assign({}, el.specials || {}, customSpecials);
|
|
364
|
+
delete el.runtime;
|
|
365
|
+
};
|
|
366
|
+
export const createGridProduct = (opts = {}) => {
|
|
367
|
+
const product = cloneDeep(SKELETON);
|
|
368
|
+
product.id = 'GRID-PRODUCT-' + randomString(8);
|
|
369
|
+
product.type = 'grid-product';
|
|
370
|
+
product.runtime.style = {
|
|
371
|
+
width: opts.width,
|
|
372
|
+
height: 354
|
|
373
|
+
};
|
|
374
|
+
product.runtime.config = { heightUnit: 'auto' };
|
|
375
|
+
return product;
|
|
376
|
+
};
|
|
377
|
+
export const createSliderProduct = (opts = {}) => {
|
|
378
|
+
const product = cloneDeep(SKELETON);
|
|
379
|
+
product.id = 'SLIDER-PRODUCT-' + randomString(8);
|
|
380
|
+
product.type = 'slider-product';
|
|
381
|
+
product.runtime.style = { width: opts.width, height: 353.22 };
|
|
382
|
+
product.runtime.config = { responsive: opts.responsive, heightUnit: 'auto' };
|
|
383
|
+
return product;
|
|
384
|
+
};
|
|
385
|
+
export const createInputSearch = (opts = {}) => {
|
|
386
|
+
const inputSearch = cloneDeep(SKELETON);
|
|
387
|
+
inputSearch.id = 'INPUT-SEARCH-' + randomString(8);
|
|
388
|
+
inputSearch.type = 'input-search';
|
|
389
|
+
inputSearch.runtime.style = { ...opts.style };
|
|
390
|
+
inputSearch.runtime.config = opts.config || {};
|
|
391
|
+
inputSearch.specials = { ...opts.specials };
|
|
392
|
+
return inputSearch;
|
|
393
|
+
};
|
|
394
|
+
export const createMenuItem = (opts = {}) => {
|
|
395
|
+
const menuItem = cloneDeep(SKELETON);
|
|
396
|
+
menuItem.id = 'MENU-ITEM-' + randomString(8);
|
|
397
|
+
menuItem.type = 'menu-item';
|
|
398
|
+
menuItem.specials = opts.specials || {};
|
|
399
|
+
menuItem.children = opts.children || [];
|
|
400
|
+
menuItem.runtime.style = { ...opts.style };
|
|
401
|
+
menuItem.runtime.config = { ...opts.config };
|
|
402
|
+
return menuItem;
|
|
403
|
+
};
|
|
404
|
+
export const createMenuAnchorItem = (opts = {}) => {
|
|
405
|
+
const menuItem = cloneDeep(SKELETON);
|
|
406
|
+
menuItem.id = 'MENU-ANCHOR-ITEM-' + randomString(8);
|
|
407
|
+
menuItem.type = 'menu-anchor-item';
|
|
408
|
+
menuItem.specials = opts.specials || {};
|
|
409
|
+
menuItem.children = opts.children || [];
|
|
410
|
+
menuItem.runtime.style = { ...opts.style };
|
|
411
|
+
menuItem.runtime.config = { ...opts.config };
|
|
412
|
+
return menuItem;
|
|
413
|
+
};
|
|
414
|
+
export const createSubmenu = (opts = {}) => {
|
|
415
|
+
const submenu = cloneDeep(SKELETON);
|
|
416
|
+
submenu.id = 'SUBMENU-' + randomString(8);
|
|
417
|
+
submenu.type = 'submenu';
|
|
418
|
+
submenu.specials = { ...opts };
|
|
419
|
+
submenu.children = opts.children || [];
|
|
420
|
+
return submenu;
|
|
421
|
+
};
|
|
422
|
+
export const createMenuDroppable = (opts = {}) => {
|
|
423
|
+
const menuDroppable = cloneDeep(SKELETON);
|
|
424
|
+
menuDroppable.id = 'MENU-DROPPABLE-' + randomString(8);
|
|
425
|
+
menuDroppable.type = 'menu-droppable';
|
|
426
|
+
menuDroppable.children = opts.children || [];
|
|
427
|
+
return menuDroppable;
|
|
428
|
+
};
|
|
429
|
+
export const createRow = () => {
|
|
430
|
+
const row = cloneDeep(SKELETON);
|
|
431
|
+
row.id = 'ROW-' + randomString(8);
|
|
432
|
+
row.type = 'row';
|
|
433
|
+
return row;
|
|
434
|
+
};
|
|
435
|
+
export const createMemberBar = (opts = {}) => {
|
|
436
|
+
const menuBar = cloneDeep(SKELETON);
|
|
437
|
+
menuBar.id = 'MEMBER-BAR-' + randomString(8);
|
|
438
|
+
menuBar.type = 'member-bar';
|
|
439
|
+
menuBar.runtime.style = { ...opts.style };
|
|
440
|
+
menuBar.runtime.config = { ...opts.config };
|
|
441
|
+
menuBar.specials = { ...opts.specials };
|
|
442
|
+
return menuBar;
|
|
443
|
+
};
|
|
444
|
+
export const createCartIcon = ({ svg, itemCount, config, children } = {}) => {
|
|
445
|
+
const cart = cloneDeep(SKELETON);
|
|
446
|
+
cart.id = 'CART-ICON-' + randomString(8);
|
|
447
|
+
cart.type = 'cart-icon';
|
|
448
|
+
cart.runtime.config = { ...config };
|
|
449
|
+
cart.runtime.style = {
|
|
450
|
+
width: 24,
|
|
451
|
+
height: 24
|
|
452
|
+
};
|
|
453
|
+
cart.specials.svg = svg;
|
|
454
|
+
cart.specials.itemCount = itemCount;
|
|
455
|
+
if (children)
|
|
456
|
+
cart.children = children || [];
|
|
457
|
+
return cart;
|
|
458
|
+
};
|
|
459
|
+
export const createWishlist = ({ svg, itemCount, config, children, style } = {}) => {
|
|
460
|
+
const wistlist = cloneDeep(SKELETON);
|
|
461
|
+
wistlist.id = 'WISHLIST-' + randomString(8);
|
|
462
|
+
wistlist.type = 'wishlist';
|
|
463
|
+
wistlist.runtime.config = { ...config };
|
|
464
|
+
wistlist.runtime.style = {
|
|
465
|
+
width: 24,
|
|
466
|
+
height: 24,
|
|
467
|
+
...style,
|
|
468
|
+
};
|
|
469
|
+
wistlist.specials.svg = svg;
|
|
470
|
+
wistlist.specials.itemCount = itemCount;
|
|
471
|
+
if (children)
|
|
472
|
+
wistlist.children = children || [];
|
|
473
|
+
return wistlist;
|
|
474
|
+
};
|
|
475
|
+
export const createFavoriteIcon = (opts = {}) => {
|
|
476
|
+
const favorite = cloneDeep(SKELETON);
|
|
477
|
+
favorite.id = 'FAVORITE-ICON-' + randomString(8);
|
|
478
|
+
favorite.type = 'favorite-icon';
|
|
479
|
+
favorite.runtime.style = {
|
|
480
|
+
width: opts.width || 25,
|
|
481
|
+
height: opts.height || 25,
|
|
482
|
+
background: '#ffffff00',
|
|
483
|
+
...opts.style,
|
|
484
|
+
};
|
|
485
|
+
if (opts.mask)
|
|
486
|
+
favorite.runtime.config = { mask: opts.mask };
|
|
487
|
+
if (opts.config)
|
|
488
|
+
favorite.runtime.config = {
|
|
489
|
+
...favorite.runtime.config,
|
|
490
|
+
...opts.config
|
|
491
|
+
};
|
|
492
|
+
if (opts.events)
|
|
493
|
+
favorite.events = opts.events || [];
|
|
494
|
+
return favorite;
|
|
495
|
+
};
|
|
496
|
+
export const createCheckbox = (opts = {}) => {
|
|
497
|
+
const checkbox = cloneDeep(SKELETON);
|
|
498
|
+
checkbox.id = 'CHECKBOX-' + randomString(8);
|
|
499
|
+
checkbox.type = 'checkbox';
|
|
500
|
+
checkbox.runtime.config = { ...opts.config };
|
|
501
|
+
checkbox.runtime.style = { ...opts.style };
|
|
502
|
+
checkbox.specials = { ...opts.specials };
|
|
503
|
+
if (opts.breakpoint) {
|
|
504
|
+
buildElementWithBreakpoint(checkbox, opts.breakpoint);
|
|
505
|
+
}
|
|
506
|
+
return checkbox;
|
|
507
|
+
};
|
|
508
|
+
export const createAddress = (opts = {}) => {
|
|
509
|
+
const address = cloneDeep(SKELETON);
|
|
510
|
+
address.id = 'ADDRESS-' + randomString(8);
|
|
511
|
+
address.type = 'address';
|
|
512
|
+
address.runtime.config = { ...opts.config };
|
|
513
|
+
address.runtime.style = { ...opts.style };
|
|
514
|
+
address.specials = { ...opts.specials };
|
|
515
|
+
if (opts.breakpoint) {
|
|
516
|
+
buildElementWithBreakpoint(address, opts.breakpoint);
|
|
517
|
+
}
|
|
518
|
+
return address;
|
|
519
|
+
};
|
|
520
|
+
export const createRadio = (opts = {}) => {
|
|
521
|
+
const radio = cloneDeep(SKELETON);
|
|
522
|
+
radio.id = 'RADIO-' + randomString(8);
|
|
523
|
+
radio.type = 'radio';
|
|
524
|
+
radio.runtime.config = { ...opts.config };
|
|
525
|
+
radio.runtime.style = { ...opts.style };
|
|
526
|
+
radio.specials = { ...opts.specials };
|
|
527
|
+
if (opts.breakpoint) {
|
|
528
|
+
buildElementWithBreakpoint(radio, opts.breakpoint);
|
|
529
|
+
}
|
|
530
|
+
return radio;
|
|
531
|
+
};
|
|
532
|
+
export const createSelect = (opts = {}) => {
|
|
533
|
+
const select = cloneDeep(SKELETON);
|
|
534
|
+
select.id = 'SELECT-' + randomString(8);
|
|
535
|
+
select.type = 'select';
|
|
536
|
+
select.runtime.config = { ...opts.config };
|
|
537
|
+
select.runtime.style = { ...opts.style };
|
|
538
|
+
select.specials = { ...opts.specials };
|
|
539
|
+
if (opts.breakpoint) {
|
|
540
|
+
buildElementWithBreakpoint(select, opts.breakpoint);
|
|
541
|
+
}
|
|
542
|
+
return select;
|
|
543
|
+
};
|
|
544
|
+
export const createGroupSelect = (opts = {}) => {
|
|
545
|
+
const select = cloneDeep(SKELETON);
|
|
546
|
+
select.id = 'GROUP-SELECT-' + randomString(8);
|
|
547
|
+
select.type = 'group-select';
|
|
548
|
+
select.runtime.config = { ...opts.config };
|
|
549
|
+
select.runtime.style = { ...opts.style };
|
|
550
|
+
select.specials = { ...opts.specials };
|
|
551
|
+
if (opts.breakpoint) {
|
|
552
|
+
buildElementWithBreakpoint(select, opts.breakpoint);
|
|
553
|
+
}
|
|
554
|
+
return select;
|
|
555
|
+
};
|
|
556
|
+
export const createProductGallery = (opts = {}) => {
|
|
557
|
+
const gallery = cloneDeep(SKELETON);
|
|
558
|
+
gallery.id = 'PRODUCT-GALLERY-' + randomString(8);
|
|
559
|
+
gallery.type = 'product-gallery';
|
|
560
|
+
gallery.runtime.style = opts.style || {};
|
|
561
|
+
gallery.runtime.config = opts.config || {};
|
|
562
|
+
return gallery;
|
|
563
|
+
};
|
|
564
|
+
export const createProductImagesCarousel = (opts = {}) => {
|
|
565
|
+
const slider = cloneDeep(SKELETON);
|
|
566
|
+
slider.id = 'PD-IMG-CAROUSEL-';
|
|
567
|
+
slider.type = 'product-image-carousel';
|
|
568
|
+
slider.runtime.style = opts.style || {};
|
|
569
|
+
slider.runtime.config = opts.config || {};
|
|
570
|
+
return slider;
|
|
571
|
+
};
|
|
572
|
+
export const createRectangleDataset = (opts = {}) => {
|
|
573
|
+
const rectangle = cloneDeep(SKELETON);
|
|
574
|
+
rectangle.id = 'RECTANGLE-DATASET-' + randomString(8);
|
|
575
|
+
rectangle.type = 'rectangle-dataset';
|
|
576
|
+
rectangle.runtime.style = {
|
|
577
|
+
width: 200,
|
|
578
|
+
height: 200,
|
|
579
|
+
...(opts.style || {})
|
|
580
|
+
};
|
|
581
|
+
rectangle.runtime.config = {
|
|
582
|
+
...(opts.config || {})
|
|
583
|
+
};
|
|
584
|
+
if (opts.bindings)
|
|
585
|
+
rectangle.bindings = opts.bindings || [];
|
|
586
|
+
if (opts.breakpoint) {
|
|
587
|
+
buildElementWithBreakpoint(rectangle, opts.breakpoint);
|
|
588
|
+
}
|
|
589
|
+
return rectangle;
|
|
590
|
+
};
|
|
591
|
+
export const createTextDataset = (opts = {}) => {
|
|
592
|
+
const textDataset = cloneDeep(SKELETON);
|
|
593
|
+
textDataset.id = 'TEXT-DATASET-' + randomString(8);
|
|
594
|
+
textDataset.type = 'text-dataset';
|
|
595
|
+
textDataset.runtime.style = {
|
|
596
|
+
width: 200,
|
|
597
|
+
height: 26.7,
|
|
598
|
+
fontSize: '16px',
|
|
599
|
+
color: 'rgba(0, 0, 0, 1)',
|
|
600
|
+
...(opts.style || {})
|
|
601
|
+
};
|
|
602
|
+
textDataset.runtime.config = {
|
|
603
|
+
heightUnit: 'auto',
|
|
604
|
+
...(opts.config || {})
|
|
605
|
+
};
|
|
606
|
+
if (opts.bindings)
|
|
607
|
+
textDataset.bindings = opts.bindings || [];
|
|
608
|
+
if (opts.breakpoint) {
|
|
609
|
+
buildElementWithBreakpoint(textDataset, opts.breakpoint);
|
|
610
|
+
}
|
|
611
|
+
return textDataset;
|
|
612
|
+
};
|
|
613
|
+
export const createImageDataset = (opts = {}) => {
|
|
614
|
+
const image = cloneDeep(SKELETON);
|
|
615
|
+
image.id = 'IMAGE-DATASET-' + randomString(8);
|
|
616
|
+
image.type = 'image-dataset';
|
|
617
|
+
image.runtime.style = {
|
|
618
|
+
width: 200,
|
|
619
|
+
height: 200,
|
|
620
|
+
...(opts.style || {})
|
|
621
|
+
};
|
|
622
|
+
image.runtime.config = {
|
|
623
|
+
heightUnit: 'auto',
|
|
624
|
+
...(opts.config || {})
|
|
625
|
+
};
|
|
626
|
+
if (opts.bindings)
|
|
627
|
+
image.bindings = opts.bindings || [];
|
|
628
|
+
if (opts.breakpoint) {
|
|
629
|
+
buildElementWithBreakpoint(image, opts.breakpoint);
|
|
630
|
+
}
|
|
631
|
+
return image;
|
|
632
|
+
};
|
|
633
|
+
export const createEmail = (opts) => {
|
|
634
|
+
const email = cloneDeep(SKELETON);
|
|
635
|
+
email.id = 'EMAIL-' + randomString(8);
|
|
636
|
+
email.type = 'email';
|
|
637
|
+
email.runtime.style = opts.style || {};
|
|
638
|
+
email.runtime.config = opts.config || {};
|
|
639
|
+
email.specials = opts.specials || {};
|
|
640
|
+
if (opts.breakpoint) {
|
|
641
|
+
buildElementWithBreakpoint(email, opts.breakpoint);
|
|
642
|
+
}
|
|
643
|
+
return email;
|
|
644
|
+
};
|
|
645
|
+
export const createPhoneNumber = (opts) => {
|
|
646
|
+
const input = cloneDeep(SKELETON);
|
|
647
|
+
input.id = 'PHONE-NUMBER-' + randomString(8);
|
|
648
|
+
input.type = 'phone-number';
|
|
649
|
+
input.runtime.style = opts.style || {};
|
|
650
|
+
input.runtime.config = opts.config || {};
|
|
651
|
+
input.specials = opts.specials || {};
|
|
652
|
+
if (opts.breakpoint) {
|
|
653
|
+
buildElementWithBreakpoint(input, opts.breakpoint);
|
|
654
|
+
}
|
|
655
|
+
return input;
|
|
656
|
+
};
|
|
657
|
+
export const createRetypePhoneNumber = (opts) => {
|
|
658
|
+
const input = cloneDeep(SKELETON);
|
|
659
|
+
input.id = 'RETYPE-PHONE-NUMBER-' + randomString(8);
|
|
660
|
+
input.type = 'retype-phone-number';
|
|
661
|
+
input.runtime.stype = opts.style || {};
|
|
662
|
+
input.runtime.config = opts.config || {};
|
|
663
|
+
input.specials = opts.specials || {};
|
|
664
|
+
if (opts.breakpoint) {
|
|
665
|
+
buildElementWithBreakpoint(input, opts.breakpoint);
|
|
666
|
+
}
|
|
667
|
+
return input;
|
|
668
|
+
};
|
|
669
|
+
export const createPostalCode = (opts) => {
|
|
670
|
+
const postalCode = cloneDeep(SKELETON);
|
|
671
|
+
postalCode.id = 'POSTAL-CODE-' + randomString(8);
|
|
672
|
+
postalCode.type = 'postal-code';
|
|
673
|
+
postalCode.runtime.style = opts.style || {};
|
|
674
|
+
postalCode.runtime.config = opts.config || {};
|
|
675
|
+
postalCode.specials = opts.specials || {};
|
|
676
|
+
if (opts.breakpoint) {
|
|
677
|
+
buildElementWithBreakpoint(postalCode, opts.breakpoint);
|
|
678
|
+
}
|
|
679
|
+
return postalCode;
|
|
680
|
+
};
|
|
681
|
+
export const createSubmitButton = (opts = {}) => {
|
|
682
|
+
const button = cloneDeep(SKELETON);
|
|
683
|
+
button.id = 'SUBMIT-BUTTON-' + randomString(8);
|
|
684
|
+
button.type = 'submit-button';
|
|
685
|
+
button.runtime.style = opts.style || {};
|
|
686
|
+
button.runtime.config = opts.config || {};
|
|
687
|
+
button.specials = {
|
|
688
|
+
text: opts.specials?.text || 'Submit'
|
|
689
|
+
};
|
|
690
|
+
return button;
|
|
691
|
+
};
|
|
692
|
+
export const createCartItems = (opts = {}) => {
|
|
693
|
+
const cart = cloneDeep(SKELETON);
|
|
694
|
+
cart.id = 'CART-ITEMS-' + randomString(8);
|
|
695
|
+
cart.type = 'cart-items';
|
|
696
|
+
cart.runtime.style = opts.style || {};
|
|
697
|
+
cart.runtime.config = opts.config || {};
|
|
698
|
+
cart.children = opts.children || [];
|
|
699
|
+
return cart;
|
|
700
|
+
};
|
|
701
|
+
export const createQuantityInput = (opts = {}) => {
|
|
702
|
+
const input = cloneDeep(SKELETON);
|
|
703
|
+
input.id = 'QUANTITY-INPUT-' + randomString(8);
|
|
704
|
+
input.type = 'quantity-input';
|
|
705
|
+
input.runtime.style = {
|
|
706
|
+
borderColor: "rgba(0, 0, 0, 1)",
|
|
707
|
+
borderStyle: "solid",
|
|
708
|
+
borderWidth: "1px",
|
|
709
|
+
...opts.style
|
|
710
|
+
};
|
|
711
|
+
input.runtime.config = opts.config || {};
|
|
712
|
+
input.specials = opts.specials || {};
|
|
713
|
+
if (opts.breakpoint) {
|
|
714
|
+
buildElementWithBreakpoint(input, opts.breakpoint);
|
|
715
|
+
}
|
|
716
|
+
return input;
|
|
717
|
+
};
|
|
718
|
+
export const createDropdown = (opts = {}) => {
|
|
719
|
+
const dropdown = cloneDeep(SKELETON);
|
|
720
|
+
dropdown.id = 'DROPDOWN-' + randomString(8);
|
|
721
|
+
dropdown.type = 'dropdown';
|
|
722
|
+
dropdown.runtime.style = opts.style || {};
|
|
723
|
+
dropdown.runtime.config = opts.config || {};
|
|
724
|
+
if (opts.children)
|
|
725
|
+
dropdown.children = opts.children || [];
|
|
726
|
+
if (opts.specials)
|
|
727
|
+
dropdown.specials = opts.specials;
|
|
728
|
+
return dropdown;
|
|
729
|
+
};
|
|
730
|
+
export const createDropdownContent = (opts = {}) => {
|
|
731
|
+
const content = cloneDeep(SKELETON);
|
|
732
|
+
content.id = 'DROPDOWN-CONTENT-' + randomString(8);
|
|
733
|
+
content.type = 'dropdown-content';
|
|
734
|
+
content.runtime.style = opts.style || {};
|
|
735
|
+
content.runtime.config = opts.config || {};
|
|
736
|
+
content.children = opts.children || [];
|
|
737
|
+
return content;
|
|
738
|
+
};
|
|
739
|
+
export const createRadioGroup = (opts = {}) => {
|
|
740
|
+
const radio = cloneDeep(SKELETON);
|
|
741
|
+
radio.id = 'RADIO-GROUP-' + randomString(8);
|
|
742
|
+
radio.type = 'radio-group';
|
|
743
|
+
radio.runtime.style = opts.style || {};
|
|
744
|
+
radio.runtime.config = opts.config || {};
|
|
745
|
+
radio.specials = opts.specials || {};
|
|
746
|
+
return radio;
|
|
747
|
+
};
|
|
748
|
+
export const createCheckboxGroup = (opts = {}) => {
|
|
749
|
+
const checkbox = cloneDeep(SKELETON);
|
|
750
|
+
checkbox.id = 'CHECKBOX-GROUP-' + randomString(8);
|
|
751
|
+
checkbox.type = 'checkbox-group';
|
|
752
|
+
checkbox.runtime.style = opts.style || {};
|
|
753
|
+
checkbox.runtime.config = opts.config || {};
|
|
754
|
+
checkbox.specials = opts.specials || {};
|
|
755
|
+
return checkbox;
|
|
756
|
+
};
|
|
757
|
+
export const createTwoPointRange = (opts = {}) => {
|
|
758
|
+
const range = cloneDeep(SKELETON);
|
|
759
|
+
range.id = 'TWO-POINT-RANGE-' + randomString(8);
|
|
760
|
+
range.type = 'two-point-range';
|
|
761
|
+
range.runtime.style = opts.style || {};
|
|
762
|
+
range.runtime.config = opts.config || {};
|
|
763
|
+
range.specials = opts.specials || {};
|
|
764
|
+
return range;
|
|
765
|
+
};
|
|
766
|
+
export const createCartDroppable = (opts = {}) => {
|
|
767
|
+
const cartDroppable = cloneDeep(SKELETON);
|
|
768
|
+
cartDroppable.id = 'CART-DROPPABLE-' + randomString(8);
|
|
769
|
+
cartDroppable.type = 'cart-droppable';
|
|
770
|
+
cartDroppable.specials = opts.specials || {};
|
|
771
|
+
cartDroppable.children = opts.children || [];
|
|
772
|
+
return cartDroppable;
|
|
773
|
+
};
|
|
774
|
+
export const createButtonLoginGG = (opts = {}) => {
|
|
775
|
+
const button = cloneDeep(SKELETON);
|
|
776
|
+
button.id = 'BUTTON-LOGIN-GOOGLE-' + randomString(8);
|
|
777
|
+
button.type = 'button-login-google';
|
|
778
|
+
button.runtime.style = opts.style || {};
|
|
779
|
+
button.runtime.config = opts.config || {};
|
|
780
|
+
button.specials = opts.specials || {};
|
|
781
|
+
button.events = opts.events || [];
|
|
782
|
+
if (opts.breakpoint) {
|
|
783
|
+
buildElementWithBreakpoint(button, opts.breakpoint);
|
|
784
|
+
}
|
|
785
|
+
return button;
|
|
786
|
+
};
|
|
787
|
+
export const createButtonLoginFB = (opts = {}) => {
|
|
788
|
+
const button = cloneDeep(SKELETON);
|
|
789
|
+
button.id = 'BUTTON-LOGIN-FACEBOOK-' + randomString(8);
|
|
790
|
+
button.type = 'button-login-facebook';
|
|
791
|
+
button.runtime.style = opts.style || {};
|
|
792
|
+
button.runtime.config = opts.config || {};
|
|
793
|
+
button.specials = opts.specials || {};
|
|
794
|
+
button.events = opts.events || [];
|
|
795
|
+
if (opts.breakpoint) {
|
|
796
|
+
buildElementWithBreakpoint(button, opts.breakpoint);
|
|
797
|
+
}
|
|
798
|
+
return button;
|
|
799
|
+
};
|
|
800
|
+
export const createPassWord = (opts) => {
|
|
801
|
+
const password = cloneDeep(SKELETON);
|
|
802
|
+
password.id = 'PASSWORD-' + randomString(8);
|
|
803
|
+
password.type = 'password';
|
|
804
|
+
password.runtime.style = opts.style || {};
|
|
805
|
+
password.runtime.config = opts.config || {};
|
|
806
|
+
password.specials = opts.specials || {};
|
|
807
|
+
if (opts.breakpoint) {
|
|
808
|
+
buildElementWithBreakpoint(password, opts.breakpoint);
|
|
809
|
+
}
|
|
810
|
+
return password;
|
|
811
|
+
};
|
|
812
|
+
export const createRetypePassWord = (opts) => {
|
|
813
|
+
const password = cloneDeep(SKELETON);
|
|
814
|
+
password.id = 'RETYPE-PASSWORD-' + randomString(8);
|
|
815
|
+
password.type = 'retype-password';
|
|
816
|
+
password.runtime.style = opts.style || {};
|
|
817
|
+
password.runtime.config = opts.config || {};
|
|
818
|
+
password.specials = opts.specials || {};
|
|
819
|
+
if (opts.breakpoint) {
|
|
820
|
+
buildElementWithBreakpoint(password, opts.breakpoint);
|
|
821
|
+
}
|
|
822
|
+
return password;
|
|
823
|
+
};
|
|
824
|
+
export const createCurrentPassWord = (opts) => {
|
|
825
|
+
const password = cloneDeep(SKELETON);
|
|
826
|
+
password.id = 'CURRENT-PASSWORD-' + randomString(8);
|
|
827
|
+
password.type = 'current-password';
|
|
828
|
+
password.runtime.style = opts.style || {};
|
|
829
|
+
password.runtime.config = opts.config || {};
|
|
830
|
+
password.specials = opts.specials || {};
|
|
831
|
+
if (opts.breakpoint) {
|
|
832
|
+
buildElementWithBreakpoint(password, opts.breakpoint);
|
|
833
|
+
}
|
|
834
|
+
return password;
|
|
835
|
+
};
|
|
836
|
+
export const createMemberDropdown = (opts = {}) => {
|
|
837
|
+
const submenu = cloneDeep(SKELETON);
|
|
838
|
+
submenu.id = 'MEMBER-DROPDOWN-' + randomString(8);
|
|
839
|
+
submenu.type = 'member-dropdown';
|
|
840
|
+
submenu.specials = { ...opts };
|
|
841
|
+
submenu.children = opts.children || [];
|
|
842
|
+
return submenu;
|
|
843
|
+
};
|
|
844
|
+
export const createAttribute = (opts = {}) => {
|
|
845
|
+
const attr = cloneDeep(SKELETON);
|
|
846
|
+
attr.id = 'ATTR-' + randomString(8);
|
|
847
|
+
attr.type = 'attr';
|
|
848
|
+
attr.runtime.style = opts.style || {};
|
|
849
|
+
attr.runtime.config = opts.config || {};
|
|
850
|
+
attr.runtime.specials = opts.specials || {};
|
|
851
|
+
if (opts.breakpoint) {
|
|
852
|
+
buildElementWithBreakpoint(attr, opts.breakpoint);
|
|
853
|
+
}
|
|
854
|
+
return attr;
|
|
855
|
+
};
|
|
856
|
+
export const createDetectAddress = (opts = {}) => {
|
|
857
|
+
const input = cloneDeep(SKELETON);
|
|
858
|
+
input.id = 'DETECT-ADDRESS-' + randomString(8);
|
|
859
|
+
input.type = 'detect-address';
|
|
860
|
+
input.runtime.config = { ...opts.config };
|
|
861
|
+
input.runtime.style = { ...opts.style };
|
|
862
|
+
input.specials = { ...opts.specials };
|
|
863
|
+
if (opts.breakpoint) {
|
|
864
|
+
buildElementWithBreakpoint(input, opts.breakpoint);
|
|
865
|
+
}
|
|
866
|
+
return input;
|
|
867
|
+
};
|
|
868
|
+
export const createPayment = (opts = {}) => {
|
|
869
|
+
const payment = cloneDeep(SKELETON);
|
|
870
|
+
payment.id = 'PAYMENT-' + randomString(8);
|
|
871
|
+
payment.type = 'payment';
|
|
872
|
+
payment.children = opts.children || [];
|
|
873
|
+
payment.runtime.style = { ...opts.style };
|
|
874
|
+
payment.runtime.config = { ...opts.config };
|
|
875
|
+
payment.specials = { ...opts.specials };
|
|
876
|
+
return payment;
|
|
877
|
+
};
|
|
878
|
+
export const createCollapse = (opts = {}) => {
|
|
879
|
+
const collapse = cloneDeep(SKELETON);
|
|
880
|
+
collapse.id = `COLLAPSE-${randomString(8)}`;
|
|
881
|
+
collapse.type = 'collapse';
|
|
882
|
+
collapse.runtime.style = opts.style || {};
|
|
883
|
+
collapse.runtime.config = opts.config || {};
|
|
884
|
+
collapse.specials = opts.specials || {};
|
|
885
|
+
if (opts.children)
|
|
886
|
+
collapse.children = opts.children || [];
|
|
887
|
+
return collapse;
|
|
888
|
+
};
|
|
889
|
+
export const createCollapseItem = (opts = {}) => {
|
|
890
|
+
const collapseItem = cloneDeep(SKELETON);
|
|
891
|
+
collapseItem.id = `COLLAPSE-ITEM-${randomString(8)}`;
|
|
892
|
+
collapseItem.type = 'collapse-item';
|
|
893
|
+
collapseItem.runtime.style = opts.style || {};
|
|
894
|
+
collapseItem.runtime.config = opts.config || {};
|
|
895
|
+
collapseItem.specials = { ...opts.specials };
|
|
896
|
+
if (opts.children)
|
|
897
|
+
collapseItem.children = opts.children || [];
|
|
898
|
+
return collapseItem;
|
|
899
|
+
};
|
|
900
|
+
export const createCollapseContent = (opts = {}) => {
|
|
901
|
+
const collapseContent = cloneDeep(SKELETON);
|
|
902
|
+
collapseContent.id = `COLLAPSE-CONTENT-${randomString(8)}`;
|
|
903
|
+
collapseContent.type = 'collapse-content';
|
|
904
|
+
collapseContent.runtime.style = opts.style || {};
|
|
905
|
+
collapseContent.runtime.config = opts.config || {};
|
|
906
|
+
collapseContent.specials = { ...opts.specials };
|
|
907
|
+
if (opts.children)
|
|
908
|
+
collapseContent.children = opts.children || [];
|
|
909
|
+
return collapseContent;
|
|
910
|
+
};
|
|
911
|
+
export const createDeliveryMethod = (opts = {}) => {
|
|
912
|
+
const payment = cloneDeep(SKELETON);
|
|
913
|
+
payment.id = 'DELIVERY-METHOD-' + randomString(8);
|
|
914
|
+
payment.type = 'delivery-method';
|
|
915
|
+
payment.children = opts.children || [];
|
|
916
|
+
payment.runtime.style = { ...opts.style };
|
|
917
|
+
payment.runtime.config = { ...opts.config };
|
|
918
|
+
payment.specials = { ...opts.specials };
|
|
919
|
+
return payment;
|
|
920
|
+
};
|
|
921
|
+
export const createSearchDroppable = (opts = {}) => {
|
|
922
|
+
const searchDroppable = cloneDeep(SKELETON);
|
|
923
|
+
searchDroppable.id = 'SEARCH-DROPPABLE-' + randomString(8);
|
|
924
|
+
searchDroppable.type = 'search-droppable';
|
|
925
|
+
searchDroppable.children = opts.children || [];
|
|
926
|
+
if (opts.breakpoint) {
|
|
927
|
+
buildElementWithBreakpoint(searchDroppable, opts.breakpoint);
|
|
928
|
+
}
|
|
929
|
+
return searchDroppable;
|
|
930
|
+
};
|
|
931
|
+
export const createProductOverlay = (opts = {}) => {
|
|
932
|
+
const element = cloneDeep(SKELETON);
|
|
933
|
+
element.id = 'PRODUCT-OVERLAY-' + randomString(8);
|
|
934
|
+
element.type = 'product-overlay';
|
|
935
|
+
element.children = opts.children || [];
|
|
936
|
+
element.specials = {
|
|
937
|
+
type: opts.type || 'discount'
|
|
938
|
+
};
|
|
939
|
+
if (opts.breakpoint) {
|
|
940
|
+
buildElementWithBreakpoint(element, opts.breakpoint);
|
|
941
|
+
}
|
|
942
|
+
return element;
|
|
943
|
+
};
|
|
944
|
+
export const createCustomLayout = (opts = {}) => {
|
|
945
|
+
const element = cloneDeep(SKELETON);
|
|
946
|
+
element.id = 'CUSTOM-LAYOUT-' + randomString(8);
|
|
947
|
+
element.type = 'custom-layout';
|
|
948
|
+
element.children = opts.children || [];
|
|
949
|
+
if (opts.breakpoint) {
|
|
950
|
+
buildElementWithBreakpoint(element, opts.breakpoint);
|
|
951
|
+
}
|
|
952
|
+
return element;
|
|
953
|
+
};
|
|
954
|
+
export const createListOrdered = (opts = {}) => {
|
|
955
|
+
const ordered = cloneDeep(SKELETON);
|
|
956
|
+
ordered.id = 'LIST-ORDERED-' + randomString(8);
|
|
957
|
+
ordered.type = 'list-ordered';
|
|
958
|
+
ordered.children = opts.children || [];
|
|
959
|
+
ordered.runtime.style = { ...opts.style };
|
|
960
|
+
ordered.runtime.config = { ...opts.config };
|
|
961
|
+
ordered.specials = {
|
|
962
|
+
tableItems: [
|
|
963
|
+
{ name: '', key: 'id', i18nKey: 'trait.code_order' },
|
|
964
|
+
{ name: '', key: 'full_name', i18nKey: 'send_email.customer_name' },
|
|
965
|
+
{ name: '', key: 'invoice_value', i18nKey: 'trait.total_price' },
|
|
966
|
+
{ name: '', key: 'status', i18nKey: 'common.status' },
|
|
967
|
+
],
|
|
968
|
+
...opts.specials
|
|
969
|
+
};
|
|
970
|
+
return ordered;
|
|
971
|
+
};
|
|
972
|
+
export const createInputFile = (opts = {}) => {
|
|
973
|
+
const input = cloneDeep(SKELETON);
|
|
974
|
+
input.id = 'INPUT-FILE-' + randomString(8);
|
|
975
|
+
input.type = 'input-file';
|
|
976
|
+
input.runtime.config = { ...opts.config };
|
|
977
|
+
input.runtime.style = { ...opts.style };
|
|
978
|
+
input.specials = { ...opts.specials };
|
|
979
|
+
if (opts.breakpoint) {
|
|
980
|
+
buildElementWithBreakpoint(input, opts.breakpoint);
|
|
981
|
+
}
|
|
982
|
+
return input;
|
|
983
|
+
};
|
|
984
|
+
export const createOrderItems = (opts = {}) => {
|
|
985
|
+
const order = cloneDeep(SKELETON);
|
|
986
|
+
order.id = 'ORDER-ITEMS-' + randomString(8);
|
|
987
|
+
order.type = 'order-items';
|
|
988
|
+
order.runtime.style = opts.style || {};
|
|
989
|
+
order.runtime.config = opts.config || {};
|
|
990
|
+
order.children = opts.children || [];
|
|
991
|
+
return order;
|
|
992
|
+
};
|
|
993
|
+
export const createPostList = (opts = {}) => {
|
|
994
|
+
const post = cloneDeep(SKELETON);
|
|
995
|
+
post.id = 'POST-LIST-' + randomString(8);
|
|
996
|
+
post.type = 'post-list';
|
|
997
|
+
post.runtime.config = opts.config || {};
|
|
998
|
+
post.runtime.style = opts.style || {};
|
|
999
|
+
return post;
|
|
1000
|
+
};
|
|
1001
|
+
export const createSliderPost = (opts = {}) => {
|
|
1002
|
+
const post = cloneDeep(SKELETON);
|
|
1003
|
+
post.id = 'SLIDER-POST-' + randomString(8);
|
|
1004
|
+
post.type = 'slider-post';
|
|
1005
|
+
post.runtime.config = opts.config || {};
|
|
1006
|
+
post.runtime.style = opts.style || {};
|
|
1007
|
+
return post;
|
|
1008
|
+
};
|
|
1009
|
+
export const createWarehouseDataset = (opts = {}) => {
|
|
1010
|
+
const warehouseDataset = cloneDeep(SKELETON);
|
|
1011
|
+
warehouseDataset.id = 'WAREHOUSE-DATASET-' + randomString(8);
|
|
1012
|
+
warehouseDataset.type = 'warehouse-dataset';
|
|
1013
|
+
warehouseDataset.runtime.style = {
|
|
1014
|
+
width: 400,
|
|
1015
|
+
height: 200,
|
|
1016
|
+
color: '#000000',
|
|
1017
|
+
...(opts.style || {})
|
|
1018
|
+
};
|
|
1019
|
+
warehouseDataset.runtime.config = {
|
|
1020
|
+
heightUnit: 'auto',
|
|
1021
|
+
...(opts.config || {})
|
|
1022
|
+
};
|
|
1023
|
+
if (opts.bindings)
|
|
1024
|
+
warehouseDataset.bindings = opts.bindings || [];
|
|
1025
|
+
return warehouseDataset;
|
|
1026
|
+
};
|
|
1027
|
+
export const createCoupon = (opts = {}) => {
|
|
1028
|
+
const coupon = cloneDeep(SKELETON);
|
|
1029
|
+
coupon.id = 'COUPON-' + randomString(8);
|
|
1030
|
+
coupon.type = 'coupon';
|
|
1031
|
+
coupon.runtime.style = { ...(opts.style || {}) };
|
|
1032
|
+
coupon.runtime.config = { ...(opts.config || {}) };
|
|
1033
|
+
coupon.runtime.specials = { ...(opts.specials || {}) };
|
|
1034
|
+
if (opts.breakpoint) {
|
|
1035
|
+
buildElementWithBreakpoint(coupon, opts.breakpoint);
|
|
1036
|
+
}
|
|
1037
|
+
return coupon;
|
|
1038
|
+
};
|
|
1039
|
+
export const createPopup = (opts = {}) => {
|
|
1040
|
+
const popup = cloneDeep(SKELETON);
|
|
1041
|
+
popup.id = 'POPUP-' + randomString(8);
|
|
1042
|
+
popup.type = 'popup';
|
|
1043
|
+
popup.specials = opts.specials || {};
|
|
1044
|
+
popup.children = opts.children || [];
|
|
1045
|
+
return popup;
|
|
1046
|
+
};
|
|
1047
|
+
export const createInputDate = (opts = {}) => {
|
|
1048
|
+
const coupon = cloneDeep(SKELETON);
|
|
1049
|
+
coupon.id = 'INPUT-DATE-' + randomString(8);
|
|
1050
|
+
coupon.type = 'input-date';
|
|
1051
|
+
coupon.runtime.style = { ...(opts.style || {}) };
|
|
1052
|
+
coupon.runtime.config = { ...(opts.config || {}) };
|
|
1053
|
+
coupon.runtime.specials = { ...(opts.specials || {}) };
|
|
1054
|
+
if (opts.breakpoint) {
|
|
1055
|
+
buildElementWithBreakpoint(coupon, opts.breakpoint);
|
|
1056
|
+
}
|
|
1057
|
+
return coupon;
|
|
1058
|
+
};
|
|
1059
|
+
export const createTabs = (opts = {}) => {
|
|
1060
|
+
const tabs = cloneDeep(SKELETON);
|
|
1061
|
+
tabs.id = 'TABS-' + randomString(8);
|
|
1062
|
+
tabs.type = 'tabs';
|
|
1063
|
+
tabs.runtime.style = { ...(opts.style || {}) };
|
|
1064
|
+
tabs.runtime.config = { ...(opts.config || {}) };
|
|
1065
|
+
tabs.runtime.specials = {
|
|
1066
|
+
...(opts.specials || {}),
|
|
1067
|
+
activeTab: 0
|
|
1068
|
+
};
|
|
1069
|
+
tabs.children = opts.children || [];
|
|
1070
|
+
if (opts.breakpoint) {
|
|
1071
|
+
buildElementWithBreakpoint(tabs, opts.breakpoint);
|
|
1072
|
+
}
|
|
1073
|
+
return tabs;
|
|
1074
|
+
};
|
|
1075
|
+
export const createOrderHistory = (opts = {}) => {
|
|
1076
|
+
const order = cloneDeep(SKELETON);
|
|
1077
|
+
order.id = 'ORDER-HISTORY-' + randomString(8);
|
|
1078
|
+
order.type = 'order-history';
|
|
1079
|
+
order.runtime.style = {
|
|
1080
|
+
...opts.style
|
|
1081
|
+
};
|
|
1082
|
+
order.runtime.config = {
|
|
1083
|
+
heightUnit: 'auto',
|
|
1084
|
+
grid: '1x1',
|
|
1085
|
+
columns: [{ unit: 'fr', value: 1 }],
|
|
1086
|
+
rows: [{ unit: 'min/max', min: { unit: 'px', absValue: 300 }, max: { unit: 'max-c' } }],
|
|
1087
|
+
...opts.config
|
|
1088
|
+
};
|
|
1089
|
+
order.children = opts.children || [];
|
|
1090
|
+
if (opts.breakpoint) {
|
|
1091
|
+
buildElementWithBreakpoint(order, opts.breakpoint);
|
|
1092
|
+
}
|
|
1093
|
+
return order;
|
|
1094
|
+
};
|
|
1095
|
+
export const createCustomerAddress = (opts = {}) => {
|
|
1096
|
+
const ca = cloneDeep(SKELETON);
|
|
1097
|
+
ca.id = 'CUSTOMER-ADDRESS-' + randomString(8);
|
|
1098
|
+
ca.type = 'customer-address';
|
|
1099
|
+
ca.runtime.style = {
|
|
1100
|
+
...opts.style
|
|
1101
|
+
};
|
|
1102
|
+
ca.runtime.config = {
|
|
1103
|
+
heightUnit: 'auto',
|
|
1104
|
+
grid: '1x1',
|
|
1105
|
+
columns: [{ unit: 'fr', value: 1 }],
|
|
1106
|
+
rows: [{ unit: 'min/max', min: { unit: 'px', absValue: 300 }, max: { unit: 'max-c' } }],
|
|
1107
|
+
...opts.config
|
|
1108
|
+
};
|
|
1109
|
+
ca.children = opts.children || [];
|
|
1110
|
+
if (opts.breakpoint) {
|
|
1111
|
+
buildElementWithBreakpoint(ca, opts.breakpoint);
|
|
1112
|
+
}
|
|
1113
|
+
return ca;
|
|
1114
|
+
};
|
|
1115
|
+
export const createUserPointLog = (opts = {}) => {
|
|
1116
|
+
const upl = cloneDeep(SKELETON);
|
|
1117
|
+
upl.id = 'USER-POINT-LOG-' + randomString(8);
|
|
1118
|
+
upl.type = 'user-point-log';
|
|
1119
|
+
upl.runtime.style = { ...opts.style };
|
|
1120
|
+
upl.runtime.config = { ...opts.config };
|
|
1121
|
+
upl.runtime.specials = { ...opts.specials };
|
|
1122
|
+
if (opts.breakpoint) {
|
|
1123
|
+
buildElementWithBreakpoint(upl, opts.breakpoint);
|
|
1124
|
+
}
|
|
1125
|
+
return upl;
|
|
1126
|
+
};
|
|
1127
|
+
export const createLayoutDataset = (opts = {}) => {
|
|
1128
|
+
const layout = cloneDeep(SKELETON);
|
|
1129
|
+
layout.id = 'LAYOUT-DATASET' + randomString(8);
|
|
1130
|
+
layout.type = 'layout-dataset';
|
|
1131
|
+
layout.runtime.style = opts.style || {};
|
|
1132
|
+
layout.runtime.config = opts.config || {};
|
|
1133
|
+
layout.children = opts.children || [];
|
|
1134
|
+
if (opts.bindings)
|
|
1135
|
+
layout.bindings = opts.bindings || [];
|
|
1136
|
+
if (opts.breakpoint) {
|
|
1137
|
+
buildElementWithBreakpoint(layout, opts.breakpoint);
|
|
1138
|
+
}
|
|
1139
|
+
return layout;
|
|
1140
|
+
};
|
|
1141
|
+
export const createFlashSale = (opts = {}) => {
|
|
1142
|
+
const flash = cloneDeep(SKELETON);
|
|
1143
|
+
flash.id = 'FLASH-SALE-' + randomString(8);
|
|
1144
|
+
flash.type = 'flash-sale';
|
|
1145
|
+
flash.runtime.style = { ...(opts.style || {}) };
|
|
1146
|
+
flash.runtime.config = { ...(opts.config || {}) };
|
|
1147
|
+
flash.runtime.specials = { ...(opts.specials || {}) };
|
|
1148
|
+
flash.children = opts.children || [];
|
|
1149
|
+
return flash;
|
|
1150
|
+
};
|
|
1151
|
+
export const createCalendar = (opts = {}) => {
|
|
1152
|
+
const calendar = cloneDeep(SKELETON);
|
|
1153
|
+
calendar.id = 'CALENDAR-' + randomString(8);
|
|
1154
|
+
calendar.type = 'calendar';
|
|
1155
|
+
calendar.runtime.style = { ...(opts.style || {}) };
|
|
1156
|
+
calendar.runtime.config = { ...(opts.config || {}) };
|
|
1157
|
+
calendar.runtime.specials = { ...(opts.specials || {}) };
|
|
1158
|
+
calendar.children = opts.children || [];
|
|
1159
|
+
if (opts.breakpoint) {
|
|
1160
|
+
buildElementWithBreakpoint(calendar, opts.breakpoint);
|
|
1161
|
+
}
|
|
1162
|
+
return calendar;
|
|
1163
|
+
};
|
|
1164
|
+
export const createCalendarContent = (opts = {}) => {
|
|
1165
|
+
const calendar = cloneDeep(SKELETON);
|
|
1166
|
+
calendar.id = 'CALENDAR-CONTENT-' + randomString(8);
|
|
1167
|
+
calendar.type = 'calendar-content';
|
|
1168
|
+
calendar.runtime.style = { ...(opts.style || {}) };
|
|
1169
|
+
calendar.runtime.config = { ...(opts.config || {}) };
|
|
1170
|
+
calendar.runtime.specials = { ...(opts.specials || {}) };
|
|
1171
|
+
calendar.children = opts.children || [];
|
|
1172
|
+
return calendar;
|
|
1173
|
+
};
|
|
1174
|
+
export const createPromotionsShort = (opts = {}) => {
|
|
1175
|
+
const promotions_short = cloneDeep(SKELETON);
|
|
1176
|
+
promotions_short.id = 'PROMOTIONS-SHORT-' + randomString(8);
|
|
1177
|
+
promotions_short.type = 'promotions-short';
|
|
1178
|
+
promotions_short.runtime.style = { ...(opts.style || {}) };
|
|
1179
|
+
promotions_short.runtime.config = { ...(opts.config || {}) };
|
|
1180
|
+
promotions_short.runtime.specials = { ...(opts.specials || {}) };
|
|
1181
|
+
return promotions_short;
|
|
1182
|
+
};
|
|
1183
|
+
export const createPromotions = (opts = {}) => {
|
|
1184
|
+
const promotions = cloneDeep(SKELETON);
|
|
1185
|
+
promotions.id = 'PROMOTIONS-' + randomString(8);
|
|
1186
|
+
promotions.type = 'promotions';
|
|
1187
|
+
promotions.runtime.style = { ...(opts.style || {}) };
|
|
1188
|
+
promotions.runtime.config = { ...(opts.config || {}) };
|
|
1189
|
+
promotions.runtime.specials = { ...(opts.specials || {}) };
|
|
1190
|
+
promotions.children = opts.children || [];
|
|
1191
|
+
return promotions;
|
|
1192
|
+
};
|
|
1193
|
+
export const createRatingInput = (opts = {}) => {
|
|
1194
|
+
const rating = cloneDeep(SKELETON);
|
|
1195
|
+
rating.id = 'RATING-INPUT-' + randomString(8);
|
|
1196
|
+
rating.type = 'rating-input';
|
|
1197
|
+
rating.runtime.style = { ...(opts.style || {}) };
|
|
1198
|
+
rating.runtime.config = {
|
|
1199
|
+
...(opts.config || {}),
|
|
1200
|
+
heightUnit: 'auto'
|
|
1201
|
+
};
|
|
1202
|
+
rating.runtime.specials = { ...(opts.specials || {}) };
|
|
1203
|
+
rating.children = opts.children || [];
|
|
1204
|
+
return rating;
|
|
1205
|
+
};
|
|
1206
|
+
export const createBreadcrumb = (opts = {}) => {
|
|
1207
|
+
const breadcrumb = cloneDeep(SKELETON);
|
|
1208
|
+
breadcrumb.id = 'BREADCRUMB-' + randomString(8);
|
|
1209
|
+
breadcrumb.type = 'breadcrumb';
|
|
1210
|
+
breadcrumb.runtime.style = { ...(opts.style || {}) };
|
|
1211
|
+
breadcrumb.runtime.config = { ...(opts.config || {}) };
|
|
1212
|
+
breadcrumb.runtime.specials = { ...(opts.specials || {}) };
|
|
1213
|
+
breadcrumb.children = opts.children || [];
|
|
1214
|
+
return breadcrumb;
|
|
1215
|
+
};
|
|
1216
|
+
export const createLanguageMenu = (opts = {}) => {
|
|
1217
|
+
const menu = cloneDeep(SKELETON);
|
|
1218
|
+
menu.id = 'LANGUAGE-MENU-' + randomString(8);
|
|
1219
|
+
menu.type = 'language-menu';
|
|
1220
|
+
menu.runtime.style = opts.style || {};
|
|
1221
|
+
menu.runtime.config = opts.config || {};
|
|
1222
|
+
menu.runtime.specials = opts.specials || {};
|
|
1223
|
+
return menu;
|
|
1224
|
+
};
|
|
1225
|
+
export const createGridCategories = (opts = {}) => {
|
|
1226
|
+
const grid_categories = cloneDeep(SKELETON);
|
|
1227
|
+
grid_categories.id = 'GRID-CATE-' + randomString(8);
|
|
1228
|
+
grid_categories.type = 'grid-category';
|
|
1229
|
+
grid_categories.runtime.style = {
|
|
1230
|
+
width: opts.width,
|
|
1231
|
+
height: 354
|
|
1232
|
+
};
|
|
1233
|
+
grid_categories.runtime.config = { heightUnit: 'auto' };
|
|
1234
|
+
grid_categories.runtime.specials = { ...(opts.specials || {}) };
|
|
1235
|
+
grid_categories.children = opts.children || [];
|
|
1236
|
+
return grid_categories;
|
|
1237
|
+
};
|
|
1238
|
+
export const createSliderCategories = (opts = {}) => {
|
|
1239
|
+
const slider_categories = cloneDeep(SKELETON);
|
|
1240
|
+
slider_categories.id = 'SLIDER-CATE-' + randomString(8);
|
|
1241
|
+
slider_categories.type = 'slider-category';
|
|
1242
|
+
slider_categories.runtime.style = {
|
|
1243
|
+
width: opts.width,
|
|
1244
|
+
height: 354
|
|
1245
|
+
};
|
|
1246
|
+
slider_categories.runtime.config = { heightUnit: 'auto' };
|
|
1247
|
+
slider_categories.runtime.specials = { ...(opts.specials || {}) };
|
|
1248
|
+
slider_categories.children = opts.children || [];
|
|
1249
|
+
return slider_categories;
|
|
1250
|
+
};
|
|
1251
|
+
export const createGridBlog = (opts = {}) => {
|
|
1252
|
+
const grid_blog = cloneDeep(SKELETON);
|
|
1253
|
+
grid_blog.id = 'GRID-BLOG-' + randomString(8);
|
|
1254
|
+
grid_blog.type = 'grid-blog';
|
|
1255
|
+
grid_blog.runtime.style = {
|
|
1256
|
+
width: opts.width,
|
|
1257
|
+
height: 354
|
|
1258
|
+
};
|
|
1259
|
+
grid_blog.runtime.config = { heightUnit: 'auto' };
|
|
1260
|
+
grid_blog.runtime.specials = { ...(opts.specials || {}) };
|
|
1261
|
+
grid_blog.children = opts.children || [];
|
|
1262
|
+
return grid_blog;
|
|
1263
|
+
};
|
|
1264
|
+
export const createSliderBlog = (opts = {}) => {
|
|
1265
|
+
const slider_blog = cloneDeep(SKELETON);
|
|
1266
|
+
slider_blog.id = 'SLIDER-BLOG-' + randomString(8);
|
|
1267
|
+
slider_blog.type = 'slider-blog';
|
|
1268
|
+
slider_blog.runtime.style = {
|
|
1269
|
+
width: opts.width,
|
|
1270
|
+
height: 354
|
|
1271
|
+
};
|
|
1272
|
+
slider_blog.runtime.config = { heightUnit: 'auto' };
|
|
1273
|
+
slider_blog.runtime.specials = { ...(opts.specials || {}) };
|
|
1274
|
+
slider_blog.children = opts.children || [];
|
|
1275
|
+
return slider_blog;
|
|
1276
|
+
};
|
|
1277
|
+
export const createTags = (opts = {}) => {
|
|
1278
|
+
const tags = cloneDeep(SKELETON);
|
|
1279
|
+
tags.id = 'TAGS-' + randomString(8);
|
|
1280
|
+
tags.type = 'tags';
|
|
1281
|
+
tags.runtime.style = {
|
|
1282
|
+
width: opts.width || 200,
|
|
1283
|
+
height: opts.height || 40
|
|
1284
|
+
};
|
|
1285
|
+
tags.runtime.config = {
|
|
1286
|
+
...(opts.config || {}),
|
|
1287
|
+
heightUnit: 'auto'
|
|
1288
|
+
};
|
|
1289
|
+
tags.runtime.specials = {
|
|
1290
|
+
...(opts.specials || {}),
|
|
1291
|
+
options: [
|
|
1292
|
+
{ id: 'TAGS-ITEM-' + randomString(8), name: 'Description' },
|
|
1293
|
+
{ id: 'TAGS-ITEM-' + randomString(8), name: 'Size' },
|
|
1294
|
+
{ id: 'TAGS-ITEM-' + randomString(8), name: 'Rating' },
|
|
1295
|
+
{ id: 'TAGS-ITEM-' + randomString(8), name: 'For you' }
|
|
1296
|
+
]
|
|
1297
|
+
};
|
|
1298
|
+
tags.children = opts.children || [];
|
|
1299
|
+
return tags;
|
|
1300
|
+
};
|
|
1301
|
+
export const createPayPalButton = (opts = {}) => {
|
|
1302
|
+
const paypal = cloneDeep(SKELETON);
|
|
1303
|
+
paypal.id = 'PAYPAL-' + randomString(8);
|
|
1304
|
+
paypal.type = 'paypal-button';
|
|
1305
|
+
paypal.runtime.style = opts.style || {};
|
|
1306
|
+
return paypal;
|
|
1307
|
+
};
|
|
1308
|
+
export const createNumberStep = (opts = {}) => {
|
|
1309
|
+
const number_step = cloneDeep(SKELETON);
|
|
1310
|
+
number_step.id = 'NUMBER-STEP-' + randomString(8);
|
|
1311
|
+
number_step.type = 'number-step';
|
|
1312
|
+
number_step.runtime.style = opts.style || {};
|
|
1313
|
+
number_step.runtime.config = opts.config || {};
|
|
1314
|
+
number_step.runtime.specials = opts.specials || {};
|
|
1315
|
+
return number_step;
|
|
1316
|
+
};
|
|
1317
|
+
export const createWarehouse = (opts = {}) => {
|
|
1318
|
+
const warehouse = cloneDeep(SKELETON);
|
|
1319
|
+
warehouse.id = 'WAREHOUSE-' + randomString(8);
|
|
1320
|
+
warehouse.type = 'warehouse';
|
|
1321
|
+
warehouse.runtime.style = opts.style || {};
|
|
1322
|
+
warehouse.runtime.config = opts.config || {};
|
|
1323
|
+
warehouse.runtime.specials = opts.specials || {};
|
|
1324
|
+
warehouse.children = opts.children || [];
|
|
1325
|
+
return warehouse;
|
|
1326
|
+
};
|
|
1327
|
+
export const createProductReview = (opts = {}) => {
|
|
1328
|
+
const review = cloneDeep(SKELETON);
|
|
1329
|
+
review.id = 'PRODUCT-REVIEW-' + randomString(8);
|
|
1330
|
+
review.type = 'product-review';
|
|
1331
|
+
review.runtime.style = opts.style || {};
|
|
1332
|
+
review.runtime.config = opts.config || {};
|
|
1333
|
+
review.runtime.specials = opts.specials || {};
|
|
1334
|
+
return review;
|
|
1335
|
+
};
|
|
1336
|
+
export const createMasonryReview = (opts = {}) => {
|
|
1337
|
+
const masonry = cloneDeep(SKELETON);
|
|
1338
|
+
masonry.id = 'MASONRY-REVIEW-' + randomString(8);
|
|
1339
|
+
masonry.type = 'masonry-review';
|
|
1340
|
+
masonry.runtime.style = opts.style || {};
|
|
1341
|
+
masonry.runtime.config = opts.config || {};
|
|
1342
|
+
masonry.runtime.specials = opts.specials || {};
|
|
1343
|
+
return masonry;
|
|
1344
|
+
};
|
|
1345
|
+
export const createEmptyProductLayout = (opts = {}) => {
|
|
1346
|
+
const element = cloneDeep(SKELETON);
|
|
1347
|
+
element.id = 'EMPTY-PRODUCT-LAYOUT-' + randomString(8);
|
|
1348
|
+
element.type = 'empty-product-layout';
|
|
1349
|
+
element.runtime.specials = opts.specials || {};
|
|
1350
|
+
element.runtime.style = opts.style || {};
|
|
1351
|
+
element.runtime.config = opts.config || {};
|
|
1352
|
+
element.children = opts.children || [];
|
|
1353
|
+
if (opts.breakpoint) {
|
|
1354
|
+
buildElementWithBreakpoint(element, opts.breakpoint);
|
|
1355
|
+
}
|
|
1356
|
+
return element;
|
|
1357
|
+
};
|
|
1358
|
+
export const createAgency = (opts = {}) => {
|
|
1359
|
+
const agency = cloneDeep(SKELETON);
|
|
1360
|
+
agency.id = 'AGENCY-' + randomString(8);
|
|
1361
|
+
agency.type = 'agency';
|
|
1362
|
+
agency.runtime.style = { ...(opts.style || {}) };
|
|
1363
|
+
agency.runtime.config = { ...(opts.config || {}) };
|
|
1364
|
+
agency.runtime.specials = { ...(opts.specials || {}) };
|
|
1365
|
+
agency.children = opts.children || [];
|
|
1366
|
+
return agency;
|
|
1367
|
+
};
|
|
1368
|
+
export const createSearchFrom = (opts = {}) => {
|
|
1369
|
+
const input = cloneDeep(SKELETON);
|
|
1370
|
+
input.id = 'SEARCH-FORM-' + randomString(8);
|
|
1371
|
+
input.type = 'search-form';
|
|
1372
|
+
input.runtime.config = { ...opts.config };
|
|
1373
|
+
input.runtime.style = { ...opts.style };
|
|
1374
|
+
input.specials = { ...opts.specials };
|
|
1375
|
+
if (opts.breakpoint) {
|
|
1376
|
+
buildElementWithBreakpoint(input, opts.breakpoint);
|
|
1377
|
+
}
|
|
1378
|
+
return input;
|
|
1379
|
+
};
|
|
1380
|
+
export const createOtpInput = (opts = {}) => {
|
|
1381
|
+
const input = cloneDeep(SKELETON);
|
|
1382
|
+
input.id = 'OTP-INPUT-' + randomString(8);
|
|
1383
|
+
input.type = 'otp-input';
|
|
1384
|
+
input.runtime.config = { ...opts.config };
|
|
1385
|
+
input.runtime.style = { ...opts.style };
|
|
1386
|
+
input.specials = { ...opts.specials };
|
|
1387
|
+
if (opts.breakpoint) {
|
|
1388
|
+
buildElementWithBreakpoint(input, opts.breakpoint);
|
|
1389
|
+
}
|
|
1390
|
+
return input;
|
|
1391
|
+
};
|
|
1392
|
+
export const createTable = (opts = {}) => {
|
|
1393
|
+
const table = cloneDeep(SKELETON);
|
|
1394
|
+
table.id = 'TABLE-' + randomString(8);
|
|
1395
|
+
table.type = 'table';
|
|
1396
|
+
table.runtime.config = { ...opts.config };
|
|
1397
|
+
table.runtime.style = { ...opts.style };
|
|
1398
|
+
table.specials = { ...opts.specials };
|
|
1399
|
+
if (opts.breakpoint) {
|
|
1400
|
+
buildElementWithBreakpoint(table, opts.breakpoint);
|
|
1401
|
+
}
|
|
1402
|
+
return table;
|
|
1403
|
+
};
|
|
1404
|
+
export const createAutoNumber = (opts = {}) => {
|
|
1405
|
+
const number = cloneDeep(SKELETON);
|
|
1406
|
+
number.id = 'AUTO-NUMBER-' + randomString(8);
|
|
1407
|
+
number.type = 'auto-number';
|
|
1408
|
+
number.runtime.config = { ...opts.config };
|
|
1409
|
+
number.runtime.style = { ...opts.style };
|
|
1410
|
+
number.specials = { ...opts.specials };
|
|
1411
|
+
return number;
|
|
1412
|
+
};
|
|
1413
|
+
export const createRandomNumber = (opts = {}) => {
|
|
1414
|
+
const number = cloneDeep(SKELETON);
|
|
1415
|
+
number.id = 'RANDOM-NUMBER-' + randomString(8);
|
|
1416
|
+
number.type = 'random-number';
|
|
1417
|
+
number.runtime.config = { ...opts.config };
|
|
1418
|
+
number.runtime.style = { ...opts.style };
|
|
1419
|
+
number.specials = { ...opts.specials };
|
|
1420
|
+
return number;
|
|
1421
|
+
};
|
|
1422
|
+
export const createBonusItems = (opts = {}) => {
|
|
1423
|
+
const item = cloneDeep(SKELETON);
|
|
1424
|
+
item.id = 'BONUS-ITEMS-' + randomString(8);
|
|
1425
|
+
item.type = 'bonus-items';
|
|
1426
|
+
item.runtime.style = opts.style || {};
|
|
1427
|
+
item.runtime.config = opts.config || {};
|
|
1428
|
+
item.children = opts.children || [];
|
|
1429
|
+
item.specials = { ...opts.specials };
|
|
1430
|
+
if (opts.specials?.typeBonus == 'combo_product') {
|
|
1431
|
+
item.name = 'COMBO-ITEMS-' + randomString(8);
|
|
1432
|
+
}
|
|
1433
|
+
return item;
|
|
1434
|
+
};
|
|
1435
|
+
export const createInputNumber = (opts = {}) => {
|
|
1436
|
+
const input = cloneDeep(SKELETON);
|
|
1437
|
+
input.id = 'INPUT-NUMBER' + randomString(8);
|
|
1438
|
+
input.type = 'input-number';
|
|
1439
|
+
input.runtime.config = { ...opts.config };
|
|
1440
|
+
input.runtime.style = { ...opts.style };
|
|
1441
|
+
input.specials = { ...opts.specials };
|
|
1442
|
+
if (opts.breakpoint) {
|
|
1443
|
+
buildElementWithBreakpoint(input, opts.breakpoint);
|
|
1444
|
+
}
|
|
1445
|
+
return input;
|
|
1446
|
+
};
|
|
1447
|
+
export const createCheckboxItem = (opts = {}) => {
|
|
1448
|
+
const item = cloneDeep(SKELETON);
|
|
1449
|
+
item.id = 'CHECKBOX-ITEM-' + randomString(8);
|
|
1450
|
+
item.type = 'checkbox-item';
|
|
1451
|
+
item.runtime.config = { ...opts.config };
|
|
1452
|
+
item.runtime.style = { ...opts.style };
|
|
1453
|
+
item.specials = { ...opts.specials };
|
|
1454
|
+
return item;
|
|
1455
|
+
};
|
|
1456
|
+
export const createCountry = (opts = {}) => {
|
|
1457
|
+
const country = cloneDeep(SKELETON);
|
|
1458
|
+
country.id = 'COUNTRY-' + randomString(8);
|
|
1459
|
+
country.type = 'country';
|
|
1460
|
+
country.runtime.config = { ...opts.config };
|
|
1461
|
+
country.runtime.style = { ...opts.style };
|
|
1462
|
+
country.specials = { ...opts.specials };
|
|
1463
|
+
if (opts.breakpoint) {
|
|
1464
|
+
buildElementWithBreakpoint(country, opts.breakpoint);
|
|
1465
|
+
}
|
|
1466
|
+
return country;
|
|
1467
|
+
};
|
|
1468
|
+
export const createColorGroup = (opts = {}) => {
|
|
1469
|
+
const color_group = cloneDeep(SKELETON);
|
|
1470
|
+
color_group.id = 'COLOR-GROUP-' + randomString(8);
|
|
1471
|
+
color_group.type = 'color-group';
|
|
1472
|
+
color_group.runtime.config = { ...opts.config };
|
|
1473
|
+
color_group.runtime.style = { ...opts.style };
|
|
1474
|
+
color_group.specials = { ...opts.specials };
|
|
1475
|
+
return color_group;
|
|
1476
|
+
};
|
|
1477
|
+
export const createCartItemEmpty = (opts = {}) => {
|
|
1478
|
+
const element = cloneDeep(SKELETON);
|
|
1479
|
+
element.id = 'CART-ITEMS-EMPTY-' + randomString(8);
|
|
1480
|
+
element.type = 'cart-items-empty';
|
|
1481
|
+
element.runtime.style = opts.style || {};
|
|
1482
|
+
element.runtime.config = opts.config || {};
|
|
1483
|
+
element.specials = opts.specials || {};
|
|
1484
|
+
element.children = opts.children || [];
|
|
1485
|
+
if (opts.breakpoint) {
|
|
1486
|
+
buildElementWithBreakpoint(element, opts.breakpoint);
|
|
1487
|
+
}
|
|
1488
|
+
return element;
|
|
1489
|
+
};
|
|
1490
|
+
export const createLuckyWheel = (opts = {}) => {
|
|
1491
|
+
const element = cloneDeep(SKELETON);
|
|
1492
|
+
element.id = 'LUCKY-WHEEL-' + randomString(8);
|
|
1493
|
+
element.type = 'lucky-wheel';
|
|
1494
|
+
element.runtime.style = opts.style || {};
|
|
1495
|
+
element.runtime.config = opts.config || {};
|
|
1496
|
+
element.specials = opts.specials || {};
|
|
1497
|
+
if (opts.breakpoint) {
|
|
1498
|
+
buildElementWithBreakpoint(element, opts.breakpoint);
|
|
1499
|
+
}
|
|
1500
|
+
return element;
|
|
1501
|
+
};
|
|
1502
|
+
export const createTeeForm = (opts = {}) => {
|
|
1503
|
+
const element = cloneDeep(SKELETON);
|
|
1504
|
+
element.id = 'TEE-FORM-' + randomString(8);
|
|
1505
|
+
element.type = 'tee-form';
|
|
1506
|
+
element.runtime.style = opts.style || {};
|
|
1507
|
+
element.runtime.config = opts.config || {};
|
|
1508
|
+
element.specials = opts.specials || {};
|
|
1509
|
+
return element;
|
|
1510
|
+
};
|
|
1511
|
+
export const createRewardPoint = (opts = {}) => {
|
|
1512
|
+
const element = cloneDeep(SKELETON);
|
|
1513
|
+
element.id = 'REWARD-POINT-' + randomString(8);
|
|
1514
|
+
element.type = 'reward-point';
|
|
1515
|
+
element.runtime.style = { ...(opts.style || {}) };
|
|
1516
|
+
element.runtime.config = { ...(opts.config || {}) };
|
|
1517
|
+
element.runtime.specials = { ...(opts.specials || {}) };
|
|
1518
|
+
if (opts.breakpoint) {
|
|
1519
|
+
buildElementWithBreakpoint(element, opts.breakpoint);
|
|
1520
|
+
}
|
|
1521
|
+
return element;
|
|
1522
|
+
};
|
|
1523
|
+
export const createReferralCode = (opts = {}) => {
|
|
1524
|
+
const element = cloneDeep(SKELETON);
|
|
1525
|
+
element.id = 'REFERRAL-CODE-' + randomString(8);
|
|
1526
|
+
element.type = 'referral-code';
|
|
1527
|
+
element.runtime.style = { ...(opts.style || {}) };
|
|
1528
|
+
element.runtime.config = { ...(opts.config || {}) };
|
|
1529
|
+
element.runtime.specials = { ...(opts.specials || {}) };
|
|
1530
|
+
if (opts.breakpoint) {
|
|
1531
|
+
buildElementWithBreakpoint(element, opts.breakpoint);
|
|
1532
|
+
}
|
|
1533
|
+
return element;
|
|
1534
|
+
};
|
|
1535
|
+
export const createLocation = (opts = {}) => {
|
|
1536
|
+
const button = cloneDeep(SKELETON);
|
|
1537
|
+
button.id = 'CURRENT-LOCATION-' + randomString(8);
|
|
1538
|
+
button.type = 'current-location';
|
|
1539
|
+
button.runtime.style = opts.style || {};
|
|
1540
|
+
button.runtime.config = opts.config || {};
|
|
1541
|
+
button.specials = {
|
|
1542
|
+
text: opts.specials?.text || 'Current location',
|
|
1543
|
+
field_type: opts.specials?.field_type || 'current-location',
|
|
1544
|
+
field_name: opts.specials?.field_name || 'current location'
|
|
1545
|
+
};
|
|
1546
|
+
if (opts.breakpoint) {
|
|
1547
|
+
buildElementWithBreakpoint(button, opts.breakpoint);
|
|
1548
|
+
}
|
|
1549
|
+
return button;
|
|
1550
|
+
};
|
|
1551
|
+
export const createPostOverlay = (opts = {}) => {
|
|
1552
|
+
const element = cloneDeep(SKELETON);
|
|
1553
|
+
element.id = 'POST-OVERLAY-' + randomString(8);
|
|
1554
|
+
element.type = 'post-overlay';
|
|
1555
|
+
element.children = opts.children || [];
|
|
1556
|
+
element.specials = {
|
|
1557
|
+
type: opts.type || 'regular'
|
|
1558
|
+
};
|
|
1559
|
+
if (opts.breakpoint) {
|
|
1560
|
+
buildElementWithBreakpoint(element, opts.breakpoint);
|
|
1561
|
+
}
|
|
1562
|
+
return element;
|
|
1563
|
+
};
|
|
1564
|
+
export const createBlogOverlay = (opts = {}) => {
|
|
1565
|
+
const element = cloneDeep(SKELETON);
|
|
1566
|
+
element.id = 'BLOG-OVERLAY-' + randomString(8);
|
|
1567
|
+
element.type = 'blog-overlay';
|
|
1568
|
+
element.children = opts.children || [];
|
|
1569
|
+
element.specials = {
|
|
1570
|
+
type: opts.type || 'regular'
|
|
1571
|
+
};
|
|
1572
|
+
if (opts.breakpoint) {
|
|
1573
|
+
buildElementWithBreakpoint(element, opts.breakpoint);
|
|
1574
|
+
}
|
|
1575
|
+
return element;
|
|
1576
|
+
};
|
|
1577
|
+
export const createVideoDataset = (opts = {}) => {
|
|
1578
|
+
const video = cloneDeep(SKELETON);
|
|
1579
|
+
video.id = 'VIDEO-DATASET-' + randomString(8);
|
|
1580
|
+
video.type = 'video-dataset';
|
|
1581
|
+
video.runtime.style = {
|
|
1582
|
+
width: 200,
|
|
1583
|
+
height: 200,
|
|
1584
|
+
...(opts.style || {})
|
|
1585
|
+
};
|
|
1586
|
+
video.runtime.config = {
|
|
1587
|
+
heightUnit: 'auto',
|
|
1588
|
+
...(opts.config || {})
|
|
1589
|
+
};
|
|
1590
|
+
if (opts.bindings)
|
|
1591
|
+
video.bindings = opts.bindings || [];
|
|
1592
|
+
if (opts.breakpoint) {
|
|
1593
|
+
buildElementWithBreakpoint(video, opts.breakpoint);
|
|
1594
|
+
}
|
|
1595
|
+
return video;
|
|
1596
|
+
};
|
|
1597
|
+
export const createLessonSidebar = (opts = {}) => {
|
|
1598
|
+
const sidebar = cloneDeep(SKELETON);
|
|
1599
|
+
sidebar.id = 'LESSON-SIDEBAR-' + randomString(8);
|
|
1600
|
+
sidebar.type = 'lesson-sidebar';
|
|
1601
|
+
sidebar.runtime.style = {
|
|
1602
|
+
width: 200,
|
|
1603
|
+
height: 400,
|
|
1604
|
+
...(opts.style || {})
|
|
1605
|
+
};
|
|
1606
|
+
sidebar.runtime.config = {
|
|
1607
|
+
heightUnit: 'auto',
|
|
1608
|
+
...(opts.config || {})
|
|
1609
|
+
};
|
|
1610
|
+
if (opts.breakpoint) {
|
|
1611
|
+
buildElementWithBreakpoint(sidebar, opts.breakpoint);
|
|
1612
|
+
}
|
|
1613
|
+
return sidebar;
|
|
1614
|
+
};
|
|
1615
|
+
export const createSwitch = (opts = {}) => {
|
|
1616
|
+
const switchElement = cloneDeep(SKELETON);
|
|
1617
|
+
switchElement.id = 'SWITCH-' + randomString(8);
|
|
1618
|
+
switchElement.type = 'switch';
|
|
1619
|
+
switchElement.runtime.style = {
|
|
1620
|
+
width: 44,
|
|
1621
|
+
height: 22,
|
|
1622
|
+
...(opts.style || {})
|
|
1623
|
+
};
|
|
1624
|
+
switchElement.runtime.config = {
|
|
1625
|
+
...(opts.config || {})
|
|
1626
|
+
};
|
|
1627
|
+
if (opts.breakpoint) {
|
|
1628
|
+
buildElementWithBreakpoint(switchElement, opts.breakpoint);
|
|
1629
|
+
}
|
|
1630
|
+
return switchElement;
|
|
1631
|
+
};
|
|
1632
|
+
export const createEmailOrPhone = (opts) => {
|
|
1633
|
+
const email = cloneDeep(SKELETON);
|
|
1634
|
+
email.id = 'IDENTITY-' + randomString(8);
|
|
1635
|
+
email.type = 'identity';
|
|
1636
|
+
email.runtime.style = opts.style || {};
|
|
1637
|
+
email.runtime.config = opts.config || {};
|
|
1638
|
+
email.specials = opts.specials || {};
|
|
1639
|
+
if (opts.breakpoint) {
|
|
1640
|
+
buildElementWithBreakpoint(email, opts.breakpoint);
|
|
1641
|
+
}
|
|
1642
|
+
return email;
|
|
1643
|
+
};
|
|
1644
|
+
export const createQuestionContainer = (opts = {}) => {
|
|
1645
|
+
const questionContainer = cloneDeep(SKELETON);
|
|
1646
|
+
questionContainer.id = 'QUESTION-CONTAINER-' + randomString(8);
|
|
1647
|
+
questionContainer.type = 'question-container';
|
|
1648
|
+
questionContainer.children = opts.children || [];
|
|
1649
|
+
questionContainer.style = { ...(opts.style || {}) };
|
|
1650
|
+
if (opts.runtime)
|
|
1651
|
+
questionContainer.runtime = { ...(opts.runtime || {}) };
|
|
1652
|
+
return questionContainer;
|
|
1653
|
+
};
|
|
1654
|
+
export const createNextLessonDroppable = (opts = {}) => {
|
|
1655
|
+
const nextlesson = cloneDeep(SKELETON);
|
|
1656
|
+
nextlesson.id = 'NEXT-LESSON-DROPPABLE-' + randomString(8);
|
|
1657
|
+
nextlesson.type = 'next-lesson-droppable';
|
|
1658
|
+
nextlesson.children = opts.children || [];
|
|
1659
|
+
return nextlesson;
|
|
1660
|
+
};
|
|
1661
|
+
export const createListLessonDroppable = (opts = {}) => {
|
|
1662
|
+
const nextlesson = cloneDeep(SKELETON);
|
|
1663
|
+
nextlesson.id = 'LIST-LESSON-DROPPABLE-' + randomString(8);
|
|
1664
|
+
nextlesson.type = 'list-lesson-droppable';
|
|
1665
|
+
nextlesson.children = opts.children || [];
|
|
1666
|
+
return nextlesson;
|
|
1667
|
+
};
|
|
1668
|
+
export const createLessonItems = (opts = {}) => {
|
|
1669
|
+
const nextlesson = cloneDeep(SKELETON);
|
|
1670
|
+
nextlesson.id = 'LESSON-ITEMS-' + randomString(8);
|
|
1671
|
+
nextlesson.type = 'lesson-items';
|
|
1672
|
+
nextlesson.runtime.style = { ...opts.style };
|
|
1673
|
+
nextlesson.runtime.config = { ...opts.config };
|
|
1674
|
+
nextlesson.children = opts.children || [];
|
|
1675
|
+
nextlesson.specials = { ...opts.specials };
|
|
1676
|
+
return nextlesson;
|
|
1677
|
+
};
|