ts-glitter 21.9.6 → 21.9.7
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/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-blog.js +2 -0
- package/lowcode/backend-manager/bg-blog.ts +4 -0
- package/lowcode/backend-manager/bg-product.js +3 -3
- package/lowcode/backend-manager/bg-product.ts +3 -3
- package/lowcode/backend-manager/bg-widget.js +15 -11
- package/lowcode/backend-manager/bg-widget.ts +30 -21
- package/lowcode/cms-plugin/menus-setting.js +389 -141
- package/lowcode/cms-plugin/menus-setting.ts +519 -228
- package/lowcode/cms-plugin/shopping-collections.js +5 -38
- package/lowcode/cms-plugin/shopping-collections.ts +5 -47
- package/lowcode/jspage/function-page/setting_editor.js +0 -27
- package/lowcode/jspage/function-page/setting_editor.ts +27 -27
- package/lowcode/public-components/footer/footer-01.js +183 -158
- package/lowcode/public-components/footer/footer-01.ts +275 -256
- package/lowcode/public-components/footer/footer-02.js +83 -63
- package/lowcode/public-components/footer/footer-02.ts +160 -145
- package/lowcode/public-components/footer/footer-03.js +78 -60
- package/lowcode/public-components/footer/footer-03.ts +149 -137
- package/lowcode/public-components/headers/sy-02.js +17 -2
- package/lowcode/public-components/headers/sy-02.ts +18 -6
- package/lowcode/public-components/headers/sy-03.js +18 -4
- package/lowcode/public-components/headers/sy-03.ts +26 -15
- package/lowcode/public-components/headers/sy-04.js +18 -4
- package/lowcode/public-components/headers/sy-04.ts +26 -15
- package/lowcode/public-components/headers/sy-05.js +93 -68
- package/lowcode/public-components/headers/sy-05.ts +174 -151
- package/lowcode/public-components/product/pd-class.js +27 -8
- package/lowcode/public-components/product/pd-class.ts +60 -35
- package/package.json +1 -1
- package/src/api-public/services/shopee.js +17 -7
- package/src/api-public/services/user.js +17 -7
- package/src/index.js +17 -7
- package/src/services/app.js +17 -7
- package/src/services/app.js.map +1 -1
- package/src/services/backend-service.js +17 -7
- package/src/services/backend-service.js.map +1 -1
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
import { GVC } from '../../glitterBundle/GVController.js';
|
|
2
2
|
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
3
|
-
import { AiSearch } from '../ai/ai-search.js';
|
|
4
3
|
import { Language } from '../../glitter-base/global/language.js';
|
|
5
|
-
import {LanguageView} from
|
|
6
|
-
import {Color} from
|
|
4
|
+
import { LanguageView } from '../public/language-view.js';
|
|
5
|
+
import { Color } from '../public/color.js';
|
|
7
6
|
import { HeadInitial } from './head-initial.js';
|
|
8
|
-
import { HeaderClass } from './header-class.js';
|
|
9
|
-
import { getCheckoutCount } from '../../official_event/e-commerce/get-count.js';
|
|
10
|
-
import { GlobalUser } from '../../glitter-base/global/global-user.js';
|
|
11
7
|
import { HeaderMobile } from './header-mobile.js';
|
|
12
8
|
import { PdClass } from '../product/pd-class.js';
|
|
13
9
|
|
|
14
10
|
const html = String.raw;
|
|
15
11
|
|
|
16
12
|
export class Sy05 {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
13
|
+
public static main(gvc: GVC, widget: any, subData: any) {
|
|
14
|
+
return HeadInitial.initial({
|
|
15
|
+
widget: widget,
|
|
16
|
+
browser: () => {
|
|
17
|
+
let changePage = (index: string, type: 'page' | 'home', subData: any) => {};
|
|
18
|
+
gvc.glitter.getModule(new URL('./official_event/page/change-page.js', gvc.glitter.root_path).href, cl => {
|
|
19
|
+
changePage = cl.changePage;
|
|
20
|
+
});
|
|
26
21
|
|
|
27
|
-
|
|
22
|
+
return html`
|
|
23
|
+
<!--Header Sy05-->
|
|
28
24
|
<div style="height: 76px;"></div>
|
|
29
25
|
<nav
|
|
30
26
|
class="navbar navbar-expand-lg vw-100 header header-place shadow position-fixed top-0 left-0 py-0"
|
|
@@ -45,131 +41,138 @@ export class Sy05 {
|
|
|
45
41
|
bind: id,
|
|
46
42
|
view: () => {
|
|
47
43
|
return html` <div
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
44
|
+
class="div d-flex align-items-center flex-column w-100 p-3"
|
|
45
|
+
style="border-bottom:1px solid ${widget.formData.theme_color['title']};"
|
|
46
|
+
>
|
|
47
|
+
<div class="d-flex align-items-center ">
|
|
48
|
+
<div>
|
|
49
|
+
<div
|
|
50
|
+
class="h-100"
|
|
51
|
+
onclick="${gvc.event(() => {
|
|
52
|
+
changePage('index', 'home', {});
|
|
53
|
+
})}"
|
|
54
|
+
>
|
|
55
|
+
${widget.formData.logo.type === 'text'
|
|
56
|
+
? html`
|
|
57
|
+
<div
|
|
58
|
+
class=" fw-bold d-flex align-items-center justify-content-center"
|
|
59
|
+
style="width: 150px; margin-bottom: 20px;font-size: 36px;color: ${widget
|
|
60
|
+
.formData.theme_color['title'] ?? '#000'};"
|
|
61
|
+
>
|
|
62
|
+
${widget.formData.logo.value}
|
|
63
|
+
</div>
|
|
64
|
+
`
|
|
65
|
+
: html`<img
|
|
66
|
+
style="width: 150px;
|
|
71
67
|
background-position: center;
|
|
72
68
|
background-size: cover;
|
|
73
69
|
background-repeat: no-repeat;
|
|
74
70
|
border-radius: 10px;
|
|
75
71
|
margin-bottom: 20px;"
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
src="${widget.formData.logo.value}"
|
|
73
|
+
/> `}
|
|
74
|
+
</div>
|
|
78
75
|
</div>
|
|
79
76
|
</div>
|
|
80
77
|
</div>
|
|
81
|
-
</div>
|
|
82
78
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
79
|
+
<div class="offcanvas-body p-0 ">
|
|
80
|
+
${gvc.bindView(() => {
|
|
81
|
+
const id = gvc.glitter.getUUID();
|
|
82
|
+
const vm = {
|
|
83
|
+
data: [],
|
|
84
|
+
};
|
|
85
|
+
ApiUser.getPublicConfig(
|
|
86
|
+
widget.formData.menu_refer || 'menu-setting',
|
|
87
|
+
'manager',
|
|
88
|
+
(window as any).appName
|
|
89
|
+
).then(res => {
|
|
90
|
+
vm.data = res.response.value[Language.getLanguage()];
|
|
91
|
+
gvc.notifyDataChange(id);
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
bind: id,
|
|
95
|
+
view: () => {
|
|
96
|
+
function resetToggle() {
|
|
97
|
+
function loop(data: any) {
|
|
98
|
+
data.map((dd: any) => {
|
|
99
|
+
(dd as any).open = false;
|
|
100
|
+
loop((dd as any).items ?? []);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
loop(vm.data);
|
|
105
|
+
}
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
: ``}"
|
|
116
|
-
>
|
|
117
|
-
<div
|
|
118
|
-
class="nav-link d-flex justify-content-between"
|
|
119
|
-
style="padding: 16px;"
|
|
120
|
-
onclick="${gvc.event(() => {
|
|
121
|
-
if (((dd as any).items ?? []).length === 0) {
|
|
122
|
-
if (dd.link) {
|
|
123
|
-
gvc.glitter.href = dd.link;
|
|
124
|
-
gvc.glitter.closeDrawer();
|
|
125
|
-
}
|
|
126
|
-
} else {
|
|
127
|
-
let og = dd.open;
|
|
128
|
-
resetToggle();
|
|
129
|
-
if (!og) {
|
|
130
|
-
dd.open = true;
|
|
131
|
-
}
|
|
132
|
-
gvc.notifyDataChange(id);
|
|
133
|
-
}
|
|
134
|
-
})}"
|
|
107
|
+
function loopItems(data: any, show_border: boolean) {
|
|
108
|
+
return data
|
|
109
|
+
.map((dd: any) => {
|
|
110
|
+
return html`
|
|
111
|
+
<li
|
|
112
|
+
style="${show_border
|
|
113
|
+
? `border-bottom: 1px solid ${widget.formData.theme_color['title'] ?? '#000'} !important;`
|
|
114
|
+
: ``}"
|
|
135
115
|
>
|
|
136
116
|
<div
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
117
|
+
class="nav-link d-flex justify-content-between"
|
|
118
|
+
style="padding: 16px;"
|
|
119
|
+
onclick="${gvc.event(() => {
|
|
120
|
+
if (((dd as any).items ?? []).length === 0) {
|
|
121
|
+
if (dd.link) {
|
|
122
|
+
gvc.glitter.href = dd.link;
|
|
123
|
+
gvc.glitter.closeDrawer();
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
let og = dd.open;
|
|
127
|
+
resetToggle();
|
|
128
|
+
if (!og) {
|
|
129
|
+
dd.open = true;
|
|
130
|
+
}
|
|
131
|
+
gvc.notifyDataChange(id);
|
|
142
132
|
}
|
|
143
|
-
event.stopPropagation();
|
|
144
|
-
event.preventDefault();
|
|
145
133
|
})}"
|
|
146
134
|
>
|
|
147
|
-
|
|
135
|
+
<div
|
|
136
|
+
style="color: ${widget.formData.theme_color['title'] ??
|
|
137
|
+
'#000'} !important;"
|
|
138
|
+
onclick="${gvc.event((e, event) => {
|
|
139
|
+
if (dd.link) {
|
|
140
|
+
gvc.glitter.href = dd.link;
|
|
141
|
+
gvc.glitter.closeDrawer();
|
|
142
|
+
}
|
|
143
|
+
event.stopPropagation();
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
})}"
|
|
146
|
+
>
|
|
147
|
+
${dd.title}
|
|
148
|
+
</div>
|
|
149
|
+
${(dd.items ?? []).length
|
|
150
|
+
? html`<i
|
|
151
|
+
class="fa-solid ${dd.open ? `fa-angle-up` : `fa-angle-down`}"
|
|
152
|
+
style="color: ${widget.formData.theme_color['title'] ??
|
|
153
|
+
'#000'} !important;"
|
|
154
|
+
></i>`
|
|
155
|
+
: ``}
|
|
148
156
|
</div>
|
|
149
|
-
${
|
|
150
|
-
?
|
|
151
|
-
class="fa-solid ${dd.open ? `fa-angle-up` : `fa-angle-down`}"
|
|
152
|
-
style="color: ${widget.formData.theme_color['title'] ?? '#000'} !important;"
|
|
153
|
-
></i>`
|
|
157
|
+
${dd.open
|
|
158
|
+
? `<ul class="ps-3 pb-2">${loopItems(dd.items ?? [], false)}</ul>`
|
|
154
159
|
: ``}
|
|
155
|
-
</
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
.join('');
|
|
161
|
-
}
|
|
160
|
+
</li>
|
|
161
|
+
`;
|
|
162
|
+
})
|
|
163
|
+
.join('');
|
|
164
|
+
}
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
return loopItems(vm.data, true);
|
|
167
|
+
},
|
|
168
|
+
divCreate: {
|
|
169
|
+
class: `navbar-nav me-auto mb-2 mb-lg-0`,
|
|
170
|
+
style: ``,
|
|
171
|
+
elem: `ul`,
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
})}
|
|
175
|
+
</div>`;
|
|
173
176
|
},
|
|
174
177
|
divCreate: {
|
|
175
178
|
class: `w-100 h-100`,
|
|
@@ -194,14 +197,23 @@ background: ${widget.formData.theme_color['background'] ?? '#000'};overflow-x: h
|
|
|
194
197
|
onclick="${gvc.event(() => {
|
|
195
198
|
changePage('index', 'home', {});
|
|
196
199
|
})}"> ${
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
widget.formData.logo.type === 'text'
|
|
201
|
+
? html`
|
|
202
|
+
<div
|
|
203
|
+
class=" fw-bold d-flex align-items-center h-100 mb-1 mb-sm-auto"
|
|
204
|
+
style="font-size: 28px;line-height: 28px;color: ${widget.formData.theme_color[
|
|
205
|
+
'title'
|
|
206
|
+
] ?? '#000'};"
|
|
207
|
+
>
|
|
208
|
+
${widget.formData.logo.value}
|
|
209
|
+
</div>
|
|
210
|
+
`
|
|
211
|
+
: html`
|
|
212
|
+
<div class="d-flex align-items-center justify-content-center h-100 py-2">
|
|
213
|
+
<img src="${widget.formData.logo.value}" style="height: 100%;" />
|
|
214
|
+
</div>
|
|
215
|
+
`
|
|
216
|
+
}
|
|
205
217
|
</div>
|
|
206
218
|
<!--選單列表顯示區塊-->
|
|
207
219
|
<ul class="navbar-nav d-none d-md-block flex-fill ps-2" >
|
|
@@ -210,35 +222,47 @@ background: ${widget.formData.theme_color['background'] ?? '#000'};overflow-x: h
|
|
|
210
222
|
const vm = {
|
|
211
223
|
data: [],
|
|
212
224
|
};
|
|
213
|
-
ApiUser.getPublicConfig(
|
|
225
|
+
ApiUser.getPublicConfig(
|
|
226
|
+
widget.formData.menu_refer || 'menu-setting',
|
|
227
|
+
'manager',
|
|
228
|
+
(window as any).appName
|
|
229
|
+
).then(res => {
|
|
214
230
|
vm.data = res.response.value[Language.getLanguage()];
|
|
215
231
|
gvc.notifyDataChange(id);
|
|
216
232
|
});
|
|
217
233
|
return {
|
|
218
234
|
bind: id,
|
|
219
|
-
view: () => {
|
|
235
|
+
view: async () => {
|
|
236
|
+
const userData = await ApiUser.getUserData(gvc.glitter.share.GlobalUser.token, 'me');
|
|
237
|
+
|
|
220
238
|
function loopItems(data: any) {
|
|
221
|
-
|
|
222
239
|
return data
|
|
223
240
|
.map((dd: any) => {
|
|
241
|
+
if (!PdClass.menuVisibleVerify(userData, dd)) {
|
|
242
|
+
return '';
|
|
243
|
+
}
|
|
244
|
+
|
|
224
245
|
return html` <li class="nav-item dropdown">
|
|
225
246
|
<a
|
|
226
247
|
class="nav-link header-link "
|
|
227
|
-
style="color: ${widget.formData.theme_color['title'] ??
|
|
248
|
+
style="color: ${widget.formData.theme_color['title'] ??
|
|
249
|
+
'#000'} !important;cursor: pointer;"
|
|
228
250
|
onclick="${gvc.event(() => {
|
|
229
251
|
if (dd.link) {
|
|
230
252
|
gvc.glitter.href = dd.link;
|
|
231
253
|
}
|
|
232
254
|
})}"
|
|
233
|
-
|
|
255
|
+
>${dd.title}
|
|
256
|
+
${dd.items.length > 0 ? `<i class="fa-solid fa-angle-down ms-2"></i>` : ``}</a
|
|
234
257
|
>
|
|
235
258
|
${dd.items.length > 0
|
|
236
259
|
? html`<ul
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
260
|
+
class="dropdown-menu"
|
|
261
|
+
style="background:${widget.formData.theme_color['background'] ??
|
|
262
|
+
'#000'} !important; cursor: pointer; z-index: 99999;"
|
|
263
|
+
>
|
|
264
|
+
${loopItems(dd.items)}
|
|
265
|
+
</ul>`
|
|
242
266
|
: ``}
|
|
243
267
|
</li>`;
|
|
244
268
|
})
|
|
@@ -264,17 +288,16 @@ background: ${widget.formData.theme_color['background'] ?? '#000'};overflow-x: h
|
|
|
264
288
|
</div>
|
|
265
289
|
</div>
|
|
266
290
|
</nav>`;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
291
|
+
},
|
|
292
|
+
mobile: () => {
|
|
293
|
+
return HeaderMobile.mian({
|
|
294
|
+
gvc: gvc,
|
|
295
|
+
widget: widget,
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
gvc: gvc,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
278
301
|
}
|
|
279
302
|
|
|
280
303
|
(window as any).glitter.setModule(import.meta.url, Sy05);
|
|
@@ -412,8 +412,9 @@ export class PdClass {
|
|
|
412
412
|
}
|
|
413
413
|
static isShoppingPage() {
|
|
414
414
|
const glitter = window.glitter;
|
|
415
|
-
return ['hidden/', 'shop/'].find(
|
|
416
|
-
return (glitter.getUrlParameter('page') || '').startsWith(dd) ||
|
|
415
|
+
return ['hidden/', 'shop/'].find(dd => {
|
|
416
|
+
return ((glitter.getUrlParameter('page') || '').startsWith(dd) ||
|
|
417
|
+
(glitter.getUrlParameter('page_refer') || '').startsWith(dd));
|
|
417
418
|
});
|
|
418
419
|
}
|
|
419
420
|
static changePage(prod, gvc) {
|
|
@@ -1006,9 +1007,9 @@ export class PdClass {
|
|
|
1006
1007
|
</button>`);
|
|
1007
1008
|
if (!PdClass.isShoppingPage()) {
|
|
1008
1009
|
viewMap.push(html `<button
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1010
|
+
class="add-cart-imd-btn fw-bold fs-sm"
|
|
1011
|
+
style="cursor: pointer; flex: 1;height:44px;"
|
|
1012
|
+
onclick="${gvc.event(() => {
|
|
1012
1013
|
if (document.body.clientWidth < 800) {
|
|
1013
1014
|
this.addProductPopUp(obj, 'buyNow', () => {
|
|
1014
1015
|
refreshAll();
|
|
@@ -1031,9 +1032,9 @@ export class PdClass {
|
|
|
1031
1032
|
},
|
|
1032
1033
|
});
|
|
1033
1034
|
})}"
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1035
|
+
>
|
|
1036
|
+
${Language.text('buy_it_now')}
|
|
1037
|
+
</button>`);
|
|
1037
1038
|
}
|
|
1038
1039
|
return viewMap.join('');
|
|
1039
1040
|
},
|
|
@@ -1496,4 +1497,22 @@ export class PdClass {
|
|
|
1496
1497
|
static isPad() {
|
|
1497
1498
|
return document.body.clientWidth >= 768 && document.body.clientWidth <= 960;
|
|
1498
1499
|
}
|
|
1500
|
+
static menuVisibleVerify(userData, linkData) {
|
|
1501
|
+
var _a;
|
|
1502
|
+
const { visible_type, visible_data_array = [] } = linkData;
|
|
1503
|
+
if (!visible_type || visible_type === 'all')
|
|
1504
|
+
return true;
|
|
1505
|
+
if (!userData.result)
|
|
1506
|
+
return false;
|
|
1507
|
+
const user = userData.response;
|
|
1508
|
+
if (linkData.visible_type === 'user') {
|
|
1509
|
+
const user_id = user.userID;
|
|
1510
|
+
return visible_data_array.includes(user_id);
|
|
1511
|
+
}
|
|
1512
|
+
if (linkData.visible_type === 'level') {
|
|
1513
|
+
const user_level = (_a = user.member.find((d) => d.trigger)) === null || _a === void 0 ? void 0 : _a.id;
|
|
1514
|
+
return visible_data_array.includes(user_level || 'default');
|
|
1515
|
+
}
|
|
1516
|
+
return true;
|
|
1517
|
+
}
|
|
1499
1518
|
}
|
|
@@ -575,13 +575,16 @@ export class PdClass {
|
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
static isShoppingPage(){
|
|
578
|
+
static isShoppingPage() {
|
|
579
579
|
const glitter = (window as any).glitter;
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
580
|
+
return ['hidden/', 'shop/'].find(dd => {
|
|
581
|
+
return (
|
|
582
|
+
(glitter.getUrlParameter('page') || '').startsWith(dd) ||
|
|
583
|
+
(glitter.getUrlParameter('page_refer') || '').startsWith(dd)
|
|
584
|
+
);
|
|
585
|
+
});
|
|
583
586
|
}
|
|
584
|
-
|
|
587
|
+
|
|
585
588
|
static changePage(prod: any, gvc: GVC) {
|
|
586
589
|
const glitter = gvc.glitter;
|
|
587
590
|
let path = '';
|
|
@@ -1185,7 +1188,7 @@ export class PdClass {
|
|
|
1185
1188
|
}
|
|
1186
1189
|
viewMap.push(
|
|
1187
1190
|
html`<button
|
|
1188
|
-
class="${PdClass.isShoppingPage() ? `add-cart-imd-btn
|
|
1191
|
+
class="${PdClass.isShoppingPage() ? `add-cart-imd-btn` : `add-cart-btn`} fw-bold fs-sm"
|
|
1189
1192
|
style="flex: 1;height:44px;"
|
|
1190
1193
|
onclick="${gvc.event(() => {
|
|
1191
1194
|
if (document.body.clientWidth < 800) {
|
|
@@ -1222,40 +1225,40 @@ export class PdClass {
|
|
|
1222
1225
|
${isOutOfStock ? Language.text('preorder_item') : Language.text('add_to_cart')}
|
|
1223
1226
|
</button>`
|
|
1224
1227
|
);
|
|
1225
|
-
if(!PdClass.isShoppingPage()){
|
|
1228
|
+
if (!PdClass.isShoppingPage()) {
|
|
1226
1229
|
viewMap.push(
|
|
1227
1230
|
html`<button
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1231
|
+
class="add-cart-imd-btn fw-bold fs-sm"
|
|
1232
|
+
style="cursor: pointer; flex: 1;height:44px;"
|
|
1233
|
+
onclick="${gvc.event(() => {
|
|
1234
|
+
if (document.body.clientWidth < 800) {
|
|
1235
|
+
this.addProductPopUp(obj, 'buyNow', () => {
|
|
1236
|
+
refreshAll();
|
|
1237
|
+
});
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
const buy_it = new ApiCart(ApiCart.buyItNow);
|
|
1241
|
+
buy_it.clearCart();
|
|
1242
|
+
buy_it.addToCart(`${prod.id}`, vm.specs, vm.quantity);
|
|
1243
|
+
ApiCart.toCheckOutPage(ApiCart.buyItNow);
|
|
1244
|
+
gvc.closeDialog();
|
|
1245
|
+
ApiTrack.track({
|
|
1246
|
+
event_name: 'AddToCart',
|
|
1247
|
+
custom_data: {
|
|
1248
|
+
currency: 'TWD',
|
|
1249
|
+
value: variant.sale_price,
|
|
1250
|
+
content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
|
|
1251
|
+
content_name: prod.title,
|
|
1252
|
+
content_type: 'product',
|
|
1253
|
+
},
|
|
1234
1254
|
});
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
buy_it.addToCart(`${prod.id}`, vm.specs, vm.quantity);
|
|
1240
|
-
ApiCart.toCheckOutPage(ApiCart.buyItNow);
|
|
1241
|
-
gvc.closeDialog();
|
|
1242
|
-
ApiTrack.track({
|
|
1243
|
-
event_name: 'AddToCart',
|
|
1244
|
-
custom_data: {
|
|
1245
|
-
currency: 'TWD',
|
|
1246
|
-
value: variant.sale_price,
|
|
1247
|
-
content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
|
|
1248
|
-
content_name: prod.title,
|
|
1249
|
-
content_type: 'product',
|
|
1250
|
-
},
|
|
1251
|
-
});
|
|
1252
|
-
})}"
|
|
1253
|
-
>
|
|
1254
|
-
${Language.text('buy_it_now')}
|
|
1255
|
-
</button>`
|
|
1255
|
+
})}"
|
|
1256
|
+
>
|
|
1257
|
+
${Language.text('buy_it_now')}
|
|
1258
|
+
</button>`
|
|
1256
1259
|
);
|
|
1257
1260
|
}
|
|
1258
|
-
|
|
1261
|
+
|
|
1259
1262
|
return viewMap.join('');
|
|
1260
1263
|
},
|
|
1261
1264
|
divCreate: {
|
|
@@ -1808,4 +1811,26 @@ export class PdClass {
|
|
|
1808
1811
|
static isPad() {
|
|
1809
1812
|
return document.body.clientWidth >= 768 && document.body.clientWidth <= 960;
|
|
1810
1813
|
}
|
|
1814
|
+
|
|
1815
|
+
static menuVisibleVerify(userData: any, linkData: any): Boolean {
|
|
1816
|
+
const { visible_type, visible_data_array = [] } = linkData;
|
|
1817
|
+
|
|
1818
|
+
if (!visible_type || visible_type === 'all') return true;
|
|
1819
|
+
|
|
1820
|
+
if (!userData.result) return false;
|
|
1821
|
+
|
|
1822
|
+
const user = userData.response;
|
|
1823
|
+
|
|
1824
|
+
if (linkData.visible_type === 'user') {
|
|
1825
|
+
const user_id = user.userID;
|
|
1826
|
+
return visible_data_array.includes(user_id);
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
if (linkData.visible_type === 'level') {
|
|
1830
|
+
const user_level = user.member.find((d: { trigger: boolean }) => d.trigger)?.id;
|
|
1831
|
+
return visible_data_array.includes(user_level || 'default');
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
return true; // type = 'loggedIn'
|
|
1835
|
+
}
|
|
1811
1836
|
}
|
package/package.json
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|