ts-glitter 21.4.7 → 21.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/lowcode/Entry.js +2 -1
  2. package/lowcode/Entry.ts +2 -2
  3. package/lowcode/api/pageConfig.js +2 -0
  4. package/lowcode/api/pageConfig.ts +4 -2
  5. package/lowcode/cms-plugin/menus-setting.js +4 -9
  6. package/lowcode/cms-plugin/menus-setting.ts +4 -9
  7. package/lowcode/editor/normal-page-editor.js +2 -2
  8. package/lowcode/editor/normal-page-editor.ts +2 -2
  9. package/lowcode/glitter-base/route/api-cart.ts +1 -0
  10. package/lowcode/glitterBundle/html-component/global-widget.js +77 -3
  11. package/lowcode/glitterBundle/html-component/global-widget.ts +85 -16
  12. package/lowcode/jspage/main.js +10 -2
  13. package/lowcode/jspage/main.ts +14 -2
  14. package/lowcode/official_view_component/official/component.js +4 -0
  15. package/lowcode/official_view_component/official/component.ts +4 -1
  16. package/lowcode/public-components/headers/header-class.js +3 -1
  17. package/lowcode/public-components/headers/header-class.ts +4 -1
  18. package/lowcode/public-components/headers/sy-02.js +7 -3
  19. package/lowcode/public-components/headers/sy-02.ts +8 -3
  20. package/lowcode/public-components/headers/sy-03.js +7 -3
  21. package/lowcode/public-components/headers/sy-03.ts +9 -3
  22. package/lowcode/public-components/headers/sy-04.js +7 -3
  23. package/lowcode/public-components/headers/sy-04.ts +9 -3
  24. package/lowcode/public-components/headers/sy-05.js +4 -3
  25. package/lowcode/public-components/headers/sy-05.ts +6 -3
  26. package/lowcode/public-components/product/pd-card-01.js +11 -1
  27. package/lowcode/public-components/product/pd-card-01.ts +10 -1
  28. package/lowcode/public-components/product/pd-card-02.js +13 -1
  29. package/lowcode/public-components/product/pd-card-02.ts +12 -1
  30. package/lowcode/public-components/product/pd-card-03.js +13 -1
  31. package/lowcode/public-components/product/pd-card-03.ts +12 -1
  32. package/lowcode/public-components/product/pd-class.js +32 -24
  33. package/lowcode/public-components/product/pd-class.ts +15 -5
  34. package/package.json +1 -1
  35. package/src/services/template.js +9 -11
  36. package/src/services/template.js.map +1 -1
  37. package/src/services/template.ts +5 -3
@@ -8,6 +8,7 @@ import { LanguageView } from '../public/language-view.js';
8
8
  import { HeaderClass } from './header-class.js';
9
9
  import { HeadInitial } from './head-initial.js';
10
10
  import { HeaderMobile } from './header-mobile.js';
11
+ import { PdClass } from '../product/pd-class.js';
11
12
  const html = String.raw;
12
13
  export class Sy03 {
13
14
  static main(gvc, widget, subData) {
@@ -37,7 +38,7 @@ export class Sy03 {
37
38
  >
38
39
  <!--手機版選單-->
39
40
  <div
40
- class="d-flex align-items-center justify-content-center d-md-none"
41
+ class=" align-items-center justify-content-center ${PdClass.isShoppingPage() ? `d-none` : `d-flex d-lg-none`} "
41
42
  style="width:45px !important;height:40px !important;"
42
43
  onclick="${gvc.event(() => {
43
44
  gvc.glitter.setDrawer(gvc.bindView(() => {
@@ -100,7 +101,7 @@ export class Sy03 {
100
101
  const vm = {
101
102
  data: [],
102
103
  };
103
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then(res => {
104
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then(res => {
104
105
  vm.data = res.response.value[Language.getLanguage()];
105
106
  gvc.notifyDataChange(id);
106
107
  });
@@ -234,7 +235,7 @@ background: ${(_a = colors.bgr) !== null && _a !== void 0 ? _a : '#000'};overflo
234
235
  const vm = {
235
236
  data: [],
236
237
  };
237
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then(res => {
238
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then(res => {
238
239
  vm.data = res.response.value[Language.getLanguage()];
239
240
  gvc.notifyDataChange(id);
240
241
  });
@@ -337,6 +338,9 @@ padding-bottom: 2px;
337
338
  bind: vm.id,
338
339
  view: () => {
339
340
  var _a, _b;
341
+ if (PdClass.isShoppingPage()) {
342
+ return ``;
343
+ }
340
344
  if (!vm.toggle) {
341
345
  return html `<i
342
346
  class="fa-regular fa-magnifying-glass"
@@ -9,6 +9,7 @@ import { LanguageView } from '../public/language-view.js';
9
9
  import { HeaderClass } from './header-class.js';
10
10
  import { HeadInitial } from './head-initial.js';
11
11
  import { HeaderMobile } from './header-mobile.js';
12
+ import { PdClass } from '../product/pd-class.js';
12
13
 
13
14
  const html = String.raw;
14
15
 
@@ -40,7 +41,7 @@ export class Sy03 {
40
41
  >
41
42
  <!--手機版選單-->
42
43
  <div
43
- class="d-flex align-items-center justify-content-center d-md-none"
44
+ class=" align-items-center justify-content-center ${PdClass.isShoppingPage() ? `d-none`:`d-flex d-lg-none`} "
44
45
  style="width:45px !important;height:40px !important;"
45
46
  onclick="${gvc.event(() => {
46
47
  gvc.glitter.setDrawer(
@@ -103,7 +104,7 @@ export class Sy03 {
103
104
  const vm = {
104
105
  data: [],
105
106
  };
106
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then(
107
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then(
107
108
  res => {
108
109
  vm.data = res.response.value[Language.getLanguage()];
109
110
  gvc.notifyDataChange(id);
@@ -124,6 +125,7 @@ export class Sy03 {
124
125
  }
125
126
 
126
127
  function loopItems(data: any, show_border: boolean) {
128
+
127
129
  return data
128
130
  .map((dd: any) => {
129
131
  return html`
@@ -240,7 +242,7 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
240
242
  const vm = {
241
243
  data: [],
242
244
  };
243
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then(res => {
245
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then(res => {
244
246
  vm.data = res.response.value[Language.getLanguage()];
245
247
  gvc.notifyDataChange(id);
246
248
  });
@@ -248,6 +250,7 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
248
250
  bind: id,
249
251
  view: () => {
250
252
  function loopItems(data: any) {
253
+
251
254
  return data
252
255
  .map((dd: any) => {
253
256
  return html` <li class="nav-item dropdown">
@@ -342,6 +345,9 @@ padding-bottom: 2px;
342
345
  return {
343
346
  bind: vm.id,
344
347
  view: () => {
348
+ if(PdClass.isShoppingPage()){
349
+ return ``
350
+ }
345
351
  if (!vm.toggle) {
346
352
  return html`<i
347
353
  class="fa-regular fa-magnifying-glass"
@@ -8,6 +8,7 @@ import { LanguageView } from '../public/language-view.js';
8
8
  import { HeaderClass } from './header-class.js';
9
9
  import { HeadInitial } from './head-initial.js';
10
10
  import { HeaderMobile } from './header-mobile.js';
11
+ import { PdClass } from '../product/pd-class.js';
11
12
  const html = String.raw;
12
13
  export class Sy04 {
13
14
  static main(gvc, widget, subData) {
@@ -30,7 +31,7 @@ export class Sy04 {
30
31
  <div class="d-flex align-items-center justify-content-center h-100 gap-2">
31
32
  <!--手機版選單-->
32
33
  <div
33
- class="d-flex d-lg-none align-items-center justify-content-center"
34
+ class="${PdClass.isShoppingPage() ? `d-none` : `d-flex d-lg-none`} align-items-center justify-content-center"
34
35
  style="width:40px !important;height:40px !important;"
35
36
  onclick="${gvc.event(() => {
36
37
  gvc.glitter.setDrawer(gvc.bindView(() => {
@@ -105,7 +106,7 @@ export class Sy04 {
105
106
  const vm = {
106
107
  data: [],
107
108
  };
108
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then(res => {
109
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then(res => {
109
110
  vm.data = res.response.value[Language.getLanguage()];
110
111
  gvc.notifyDataChange(id);
111
112
  });
@@ -251,7 +252,7 @@ background: ${(_a = colors.bgr) !== null && _a !== void 0 ? _a : '#000'};overflo
251
252
  const vm = {
252
253
  data: [],
253
254
  };
254
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then(res => {
255
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then(res => {
255
256
  vm.data = res.response.value[Language.getLanguage()];
256
257
  gvc.notifyDataChange(id);
257
258
  });
@@ -347,6 +348,9 @@ padding-bottom: 2px;
347
348
  bind: vm.id,
348
349
  view: () => {
349
350
  var _a, _b;
351
+ if (PdClass.isShoppingPage()) {
352
+ return ``;
353
+ }
350
354
  if (!vm.toggle) {
351
355
  return html `<i
352
356
  class="fa-regular fa-magnifying-glass"
@@ -9,6 +9,7 @@ import { LanguageView } from '../public/language-view.js';
9
9
  import { HeaderClass } from './header-class.js';
10
10
  import { HeadInitial } from './head-initial.js';
11
11
  import { HeaderMobile } from './header-mobile.js';
12
+ import { PdClass } from '../product/pd-class.js';
12
13
 
13
14
  const html = String.raw;
14
15
 
@@ -33,7 +34,7 @@ export class Sy04 {
33
34
  <div class="d-flex align-items-center justify-content-center h-100 gap-2">
34
35
  <!--手機版選單-->
35
36
  <div
36
- class="d-flex d-lg-none align-items-center justify-content-center"
37
+ class="${PdClass.isShoppingPage() ? `d-none`:`d-flex d-lg-none`} align-items-center justify-content-center"
37
38
  style="width:40px !important;height:40px !important;"
38
39
  onclick="${gvc.event(() => {
39
40
  gvc.glitter.setDrawer(
@@ -107,7 +108,7 @@ export class Sy04 {
107
108
  const vm = {
108
109
  data: [],
109
110
  };
110
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then(
111
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then(
111
112
  res => {
112
113
  vm.data = res.response.value[Language.getLanguage()];
113
114
 
@@ -129,6 +130,7 @@ export class Sy04 {
129
130
  }
130
131
 
131
132
  function loopItems(data: any, show_border: boolean) {
133
+
132
134
  return data
133
135
  .map((dd: any) => {
134
136
  return html`
@@ -258,7 +260,7 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
258
260
  const vm = {
259
261
  data: [],
260
262
  };
261
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then(res => {
263
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then(res => {
262
264
  vm.data = res.response.value[Language.getLanguage()];
263
265
  gvc.notifyDataChange(id);
264
266
  });
@@ -266,6 +268,7 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
266
268
  bind: id,
267
269
  view: () => {
268
270
  function loopItems(data: any) {
271
+
269
272
  return data
270
273
  .map((dd: any) => {
271
274
  return html` <li class="nav-item dropdown">
@@ -353,6 +356,9 @@ padding-bottom: 2px;
353
356
  return {
354
357
  bind: vm.id,
355
358
  view: () => {
359
+ if(PdClass.isShoppingPage()){
360
+ return ``
361
+ }
356
362
  if (!vm.toggle) {
357
363
  return html`<i
358
364
  class="fa-regular fa-magnifying-glass"
@@ -4,6 +4,7 @@ import { LanguageView } from "../public/language-view.js";
4
4
  import { Color } from "../public/color.js";
5
5
  import { HeadInitial } from './head-initial.js';
6
6
  import { HeaderMobile } from './header-mobile.js';
7
+ import { PdClass } from '../product/pd-class.js';
7
8
  const html = String.raw;
8
9
  export class Sy05 {
9
10
  static main(gvc, widget, subData) {
@@ -27,7 +28,7 @@ export class Sy05 {
27
28
  <div class="d-flex align-items-center justify-content-center h-100 w-100 gap-2">
28
29
  <!--手機版選單-->
29
30
  <div
30
- class="d-flex align-items-center justify-content-center"
31
+ class="${PdClass.isShoppingPage() ? `d-none` : `d-flex d-lg-none`} align-items-center justify-content-center"
31
32
  style="width:40px !important;height:40px !important;"
32
33
  onclick="${gvc.event(() => {
33
34
  gvc.glitter.setDrawer(gvc.bindView(() => {
@@ -78,7 +79,7 @@ export class Sy05 {
78
79
  const vm = {
79
80
  data: [],
80
81
  };
81
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then((res) => {
82
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then((res) => {
82
83
  vm.data = res.response.value[Language.getLanguage()];
83
84
  gvc.notifyDataChange(id);
84
85
  });
@@ -198,7 +199,7 @@ background: ${(_a = widget.formData.theme_color['background']) !== null && _a !=
198
199
  const vm = {
199
200
  data: [],
200
201
  };
201
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then((res) => {
202
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then((res) => {
202
203
  vm.data = res.response.value[Language.getLanguage()];
203
204
  gvc.notifyDataChange(id);
204
205
  });
@@ -9,6 +9,7 @@ import { HeaderClass } from './header-class.js';
9
9
  import { getCheckoutCount } from '../../official_event/e-commerce/get-count.js';
10
10
  import { GlobalUser } from '../../glitter-base/global/global-user.js';
11
11
  import { HeaderMobile } from './header-mobile.js';
12
+ import { PdClass } from '../product/pd-class.js';
12
13
 
13
14
  const html = String.raw;
14
15
 
@@ -34,7 +35,7 @@ export class Sy05 {
34
35
  <div class="d-flex align-items-center justify-content-center h-100 w-100 gap-2">
35
36
  <!--手機版選單-->
36
37
  <div
37
- class="d-flex align-items-center justify-content-center"
38
+ class="${PdClass.isShoppingPage() ? `d-none`:`d-flex d-lg-none`} align-items-center justify-content-center"
38
39
  style="width:40px !important;height:40px !important;"
39
40
  onclick="${gvc.event(() => {
40
41
  gvc.glitter.setDrawer(
@@ -85,7 +86,7 @@ export class Sy05 {
85
86
  const vm = {
86
87
  data: [],
87
88
  };
88
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then((res) => {
89
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then((res) => {
89
90
  vm.data = res.response.value[Language.getLanguage()];
90
91
  gvc.notifyDataChange(id);
91
92
  });
@@ -104,6 +105,7 @@ export class Sy05 {
104
105
  }
105
106
 
106
107
  function loopItems(data: any, show_border: boolean) {
108
+
107
109
  return data
108
110
  .map((dd: any) => {
109
111
  return html`
@@ -208,7 +210,7 @@ background: ${widget.formData.theme_color['background'] ?? '#000'};overflow-x: h
208
210
  const vm = {
209
211
  data: [],
210
212
  };
211
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then((res) => {
213
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then((res) => {
212
214
  vm.data = res.response.value[Language.getLanguage()];
213
215
  gvc.notifyDataChange(id);
214
216
  });
@@ -216,6 +218,7 @@ background: ${widget.formData.theme_color['background'] ?? '#000'};overflow-x: h
216
218
  bind: id,
217
219
  view: () => {
218
220
  function loopItems(data: any) {
221
+
219
222
  return data
220
223
  .map((dd: any) => {
221
224
  return html` <li class="nav-item dropdown">
@@ -154,7 +154,17 @@ export class ProductCard01 {
154
154
  return html ` <div
155
155
  class="card mb-7 card-border"
156
156
  onclick="${gvc.event(() => {
157
- PdClass.changePage(prod, gvc);
157
+ if (PdClass.isShoppingPage()) {
158
+ PdClass.addCartAction({
159
+ gvc: gvc,
160
+ titleFontColor: titleFontColor,
161
+ prod: prod,
162
+ vm: vm,
163
+ });
164
+ }
165
+ else {
166
+ PdClass.changePage(prod, gvc);
167
+ }
158
168
  })}"
159
169
  >
160
170
  <div
@@ -172,7 +172,16 @@ export class ProductCard01 {
172
172
  return html` <div
173
173
  class="card mb-7 card-border"
174
174
  onclick="${gvc.event(() => {
175
- PdClass.changePage(prod, gvc);
175
+ if(PdClass.isShoppingPage()){
176
+ PdClass.addCartAction({
177
+ gvc: gvc,
178
+ titleFontColor: titleFontColor,
179
+ prod: prod,
180
+ vm: vm,
181
+ })
182
+ }else{
183
+ PdClass.changePage(prod, gvc)
184
+ }
176
185
  })}"
177
186
  >
178
187
  <div
@@ -142,7 +142,19 @@ export class ProductCard02 {
142
142
  return html `<div
143
143
  class="card mb-7 card-border"
144
144
  style="cursor: pointer"
145
- onclick="${gvc.event(() => PdClass.changePage(prod, gvc))}"
145
+ onclick="${gvc.event(() => {
146
+ if (PdClass.isShoppingPage()) {
147
+ PdClass.addCartAction({
148
+ gvc: gvc,
149
+ titleFontColor: titleFontColor,
150
+ prod: prod,
151
+ vm: vm,
152
+ });
153
+ }
154
+ else {
155
+ PdClass.changePage(prod, gvc);
156
+ }
157
+ })}"
146
158
  >
147
159
  <div
148
160
  class="card-img-top parent card-image position-relative"
@@ -161,7 +161,18 @@ export class ProductCard02 {
161
161
  return html`<div
162
162
  class="card mb-7 card-border"
163
163
  style="cursor: pointer"
164
- onclick="${gvc.event(() => PdClass.changePage(prod, gvc))}"
164
+ onclick="${gvc.event(() => {
165
+ if(PdClass.isShoppingPage()){
166
+ PdClass.addCartAction({
167
+ gvc: gvc,
168
+ titleFontColor: titleFontColor,
169
+ prod: prod,
170
+ vm: vm,
171
+ })
172
+ }else{
173
+ PdClass.changePage(prod, gvc)
174
+ }
175
+ })}"
165
176
  >
166
177
  <div
167
178
  class="card-img-top parent card-image position-relative"
@@ -148,7 +148,19 @@ export class ProductCard03 {
148
148
  return html ` <div
149
149
  class="card mb-7 card-border"
150
150
  style="cursor: pointer"
151
- onclick="${gvc.event(() => PdClass.changePage(prod, gvc))}"
151
+ onclick="${gvc.event(() => {
152
+ if (PdClass.isShoppingPage()) {
153
+ PdClass.addCartAction({
154
+ gvc: gvc,
155
+ titleFontColor: titleFontColor,
156
+ prod: prod,
157
+ vm: vm,
158
+ });
159
+ }
160
+ else {
161
+ PdClass.changePage(prod, gvc);
162
+ }
163
+ })}"
152
164
  >
153
165
  <div
154
166
  class="card-img-top parent card-image position-relative"
@@ -166,7 +166,18 @@ export class ProductCard03 {
166
166
  return html` <div
167
167
  class="card mb-7 card-border"
168
168
  style="cursor: pointer"
169
- onclick="${gvc.event(() => PdClass.changePage(prod, gvc))}"
169
+ onclick="${gvc.event(() => {
170
+ if(PdClass.isShoppingPage()){
171
+ PdClass.addCartAction({
172
+ gvc: gvc,
173
+ titleFontColor: titleFontColor,
174
+ prod: prod,
175
+ vm: vm,
176
+ })
177
+ }else{
178
+ PdClass.changePage(prod, gvc)
179
+ }
180
+ })}"
170
181
  >
171
182
  <div
172
183
  class="card-img-top parent card-image position-relative"
@@ -410,6 +410,12 @@ export class PdClass {
410
410
  };
411
411
  });
412
412
  }
413
+ static isShoppingPage() {
414
+ const glitter = window.glitter;
415
+ return ['hidden/', 'shop/'].find((dd) => {
416
+ return (glitter.getUrlParameter('page') || '').startsWith(dd) || ((glitter.getUrlParameter('page_refer') || '').startsWith(dd));
417
+ }) || glitter.share.is_shop;
418
+ }
413
419
  static changePage(prod, gvc) {
414
420
  const glitter = gvc.glitter;
415
421
  let path = '';
@@ -961,8 +967,8 @@ export class PdClass {
961
967
  }));
962
968
  }
963
969
  viewMap.push(html `<button
964
- class="add-cart-btn fw-bold fs-sm"
965
- style=" flex: 1;height:44px;"
970
+ class="${PdClass.isShoppingPage() ? `add-cart-imd-btn` : `add-cart-btn`} fw-bold fs-sm"
971
+ style="flex: 1;height:44px;"
966
972
  onclick="${gvc.event(() => {
967
973
  if (document.body.clientWidth < 800) {
968
974
  this.addProductPopUp(obj, 'addCart', () => refreshAll());
@@ -998,35 +1004,37 @@ export class PdClass {
998
1004
  >
999
1005
  ${isOutOfStock ? Language.text('preorder_item') : Language.text('add_to_cart')}
1000
1006
  </button>`);
1001
- viewMap.push(html `<button
1007
+ if (!PdClass.isShoppingPage()) {
1008
+ viewMap.push(html `<button
1002
1009
  class="add-cart-imd-btn fw-bold fs-sm"
1003
1010
  style="cursor: pointer; flex: 1;height:44px;"
1004
1011
  onclick="${gvc.event(() => {
1005
- if (document.body.clientWidth < 800) {
1006
- this.addProductPopUp(obj, 'buyNow', () => {
1007
- refreshAll();
1012
+ if (document.body.clientWidth < 800) {
1013
+ this.addProductPopUp(obj, 'buyNow', () => {
1014
+ refreshAll();
1015
+ });
1016
+ return;
1017
+ }
1018
+ const buy_it = new ApiCart(ApiCart.buyItNow);
1019
+ buy_it.clearCart();
1020
+ buy_it.addToCart(`${prod.id}`, vm.specs, vm.quantity);
1021
+ ApiCart.toCheckOutPage(ApiCart.buyItNow);
1022
+ gvc.closeDialog();
1023
+ ApiTrack.track({
1024
+ event_name: 'AddToCart',
1025
+ custom_data: {
1026
+ currency: 'TWD',
1027
+ value: variant.sale_price,
1028
+ content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
1029
+ content_name: prod.title,
1030
+ content_type: 'product',
1031
+ },
1008
1032
  });
1009
- return;
1010
- }
1011
- const buy_it = new ApiCart(ApiCart.buyItNow);
1012
- buy_it.clearCart();
1013
- buy_it.addToCart(`${prod.id}`, vm.specs, vm.quantity);
1014
- ApiCart.toCheckOutPage(ApiCart.buyItNow);
1015
- gvc.closeDialog();
1016
- ApiTrack.track({
1017
- event_name: 'AddToCart',
1018
- custom_data: {
1019
- currency: 'TWD',
1020
- value: variant.sale_price,
1021
- content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
1022
- content_name: prod.title,
1023
- content_type: 'product',
1024
- },
1025
- });
1026
- })}"
1033
+ })}"
1027
1034
  >
1028
1035
  ${Language.text('buy_it_now')}
1029
1036
  </button>`);
1037
+ }
1030
1038
  return viewMap.join('');
1031
1039
  },
1032
1040
  divCreate: {
@@ -575,6 +575,13 @@ export class PdClass {
575
575
  });
576
576
  }
577
577
 
578
+ static isShoppingPage(){
579
+ const glitter = (window as any).glitter;
580
+ return ['hidden/','shop/'].find((dd)=>{
581
+ return (glitter.getUrlParameter('page') || '').startsWith(dd) || ((glitter.getUrlParameter('page_refer') || '').startsWith(dd))
582
+ }) || glitter.share.is_shop;
583
+ }
584
+ // document.querySelector('.check_out_cart_data').scrollIntoView()
578
585
  static changePage(prod: any, gvc: GVC) {
579
586
  const glitter = gvc.glitter;
580
587
  let path = '';
@@ -1178,8 +1185,8 @@ export class PdClass {
1178
1185
  }
1179
1186
  viewMap.push(
1180
1187
  html`<button
1181
- class="add-cart-btn fw-bold fs-sm"
1182
- style=" flex: 1;height:44px;"
1188
+ class="${PdClass.isShoppingPage() ? `add-cart-imd-btn`:`add-cart-btn`} fw-bold fs-sm"
1189
+ style="flex: 1;height:44px;"
1183
1190
  onclick="${gvc.event(() => {
1184
1191
  if (document.body.clientWidth < 800) {
1185
1192
  this.addProductPopUp(obj, 'addCart', () => refreshAll());
@@ -1215,8 +1222,9 @@ export class PdClass {
1215
1222
  ${isOutOfStock ? Language.text('preorder_item') : Language.text('add_to_cart')}
1216
1223
  </button>`
1217
1224
  );
1218
- viewMap.push(
1219
- html`<button
1225
+ if(!PdClass.isShoppingPage()){
1226
+ viewMap.push(
1227
+ html`<button
1220
1228
  class="add-cart-imd-btn fw-bold fs-sm"
1221
1229
  style="cursor: pointer; flex: 1;height:44px;"
1222
1230
  onclick="${gvc.event(() => {
@@ -1245,7 +1253,9 @@ export class PdClass {
1245
1253
  >
1246
1254
  ${Language.text('buy_it_now')}
1247
1255
  </button>`
1248
- );
1256
+ );
1257
+ }
1258
+
1249
1259
  return viewMap.join('');
1250
1260
  },
1251
1261
  divCreate: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-glitter",
3
- "version": "21.4.7",
3
+ "version": "21.4.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -360,17 +360,15 @@ class Template {
360
360
  resolve(page_data);
361
361
  }
362
362
  });
363
- if (config.req.query.page_refer) {
364
- for (const b of response_) {
365
- if (b.tag === 'c_header') {
366
- const c_config = (await new user_js_1.User(b.appName).getConfigV2({
367
- key: 'c_header_' + config.req.query.page_refer,
368
- user_id: 'manager'
369
- }));
370
- if (c_config && c_config[0]) {
371
- console.log(`c_config[0]==>`, c_config[0]);
372
- b.config = c_config;
373
- }
363
+ for (const b of response_) {
364
+ if (b.tag === 'c_header') {
365
+ console.log(`c_header->==>`, config.req.query.page_refer);
366
+ const c_config = (await new user_js_1.User(b.appName).getConfigV2({
367
+ key: 'c_header_' + config.req.query.page_refer,
368
+ user_id: 'manager'
369
+ }));
370
+ if (c_config && c_config[0]) {
371
+ b.config = c_config;
374
372
  }
375
373
  }
376
374
  }