ts-glitter 21.5.2 → 21.5.4

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 (89) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/cms-plugin/account-info.js +79 -67
  4. package/lowcode/cms-plugin/account-info.ts +327 -311
  5. package/lowcode/cms-plugin/information/information-module.ts +3 -1
  6. package/lowcode/cms-plugin/list-header-option.js +1 -0
  7. package/lowcode/cms-plugin/list-header-option.ts +1 -0
  8. package/lowcode/cms-plugin/shopping-information.js +468 -0
  9. package/lowcode/cms-plugin/shopping-information.ts +557 -0
  10. package/lowcode/cms-plugin/shopping-market-shopee.js +283 -231
  11. package/lowcode/cms-plugin/shopping-market-shopee.ts +401 -361
  12. package/lowcode/cms-plugin/shopping-order-manager.js +16 -4
  13. package/lowcode/cms-plugin/shopping-order-manager.ts +18 -3
  14. package/lowcode/glitter-base/global/language.js +4 -1
  15. package/lowcode/glitter-base/global/language.ts +4 -2
  16. package/lowcode/glitter-base/route/shopee.js +48 -11
  17. package/lowcode/glitter-base/route/shopee.ts +119 -80
  18. package/lowcode/glitterBundle/plugins/html-render.js +121 -90
  19. package/lowcode/glitterBundle/plugins/html-render.ts +367 -318
  20. package/lowcode/modules/image-library.js +2 -3
  21. package/lowcode/modules/image-library.ts +21 -7
  22. package/lowcode/public-components/checkout/index.js +90 -41
  23. package/lowcode/public-components/checkout/index.ts +101 -49
  24. package/lowcode/public-components/footer/footer-initial.js +11 -2
  25. package/lowcode/public-components/footer/footer-initial.ts +29 -18
  26. package/lowcode/public-components/headers/header-class.js +47 -35
  27. package/lowcode/public-components/headers/header-class.ts +54 -38
  28. package/lowcode/public-components/headers/sy-02.js +1 -1
  29. package/lowcode/public-components/headers/sy-02.ts +1 -1
  30. package/lowcode/public-components/headers/sy-03.js +1 -1
  31. package/lowcode/public-components/headers/sy-03.ts +1 -1
  32. package/lowcode/public-components/headers/sy-04.js +1 -1
  33. package/lowcode/public-components/headers/sy-04.ts +1 -1
  34. package/lowcode/public-components/headers/sy-05.js +1 -2
  35. package/lowcode/public-components/headers/sy-05.ts +1 -1
  36. package/lowcode/public-components/layout-plugin/social-links-01.js +122 -3
  37. package/lowcode/public-components/layout-plugin/social-links-01.ts +135 -10
  38. package/lowcode/public-components/product/pd-card-01.js +23 -14
  39. package/lowcode/public-components/product/pd-card-01.ts +25 -14
  40. package/lowcode/public-components/product/pd-card-02.js +23 -16
  41. package/lowcode/public-components/product/pd-card-02.ts +25 -16
  42. package/lowcode/public-components/product/pd-card-03.js +25 -16
  43. package/lowcode/public-components/product/pd-card-03.ts +27 -16
  44. package/lowcode/public-components/product/pd-class.js +1 -1
  45. package/lowcode/public-components/product/pd-class.ts +1 -1
  46. package/lowcode/public-components/terms-related/index.js +13 -2
  47. package/lowcode/public-components/terms-related/index.ts +15 -2
  48. package/lowcode/public-components/user-manager/um-class.js +490 -501
  49. package/lowcode/public-components/user-manager/um-class.ts +872 -882
  50. package/lowcode/public-components/user-manager/um-info.js +41 -40
  51. package/lowcode/public-components/user-manager/um-info.ts +54 -56
  52. package/lowcode/public-components/user-manager/um-login.js +10 -13
  53. package/lowcode/public-components/user-manager/um-login.ts +15 -23
  54. package/lowcode/public-components/user-manager/um-orderlist.js +60 -51
  55. package/lowcode/public-components/user-manager/um-orderlist.ts +289 -275
  56. package/lowcode/public-components/user-manager/um-rebate.js +104 -82
  57. package/lowcode/public-components/user-manager/um-rebate.ts +294 -267
  58. package/lowcode/public-components/user-manager/um-receive.js +582 -0
  59. package/lowcode/public-components/user-manager/um-receive.ts +599 -0
  60. package/lowcode/public-components/user-manager/um-wishlist.js +72 -68
  61. package/lowcode/public-components/user-manager/um-wishlist.ts +240 -230
  62. package/package.json +1 -1
  63. package/src/api-public/controllers/shopee.js +17 -0
  64. package/src/api-public/controllers/shopee.js.map +1 -1
  65. package/src/api-public/controllers/shopee.ts +32 -0
  66. package/src/api-public/services/monitor.d.ts +1 -0
  67. package/src/api-public/services/post.js +17 -7
  68. package/src/api-public/services/post.js.map +1 -1
  69. package/src/api-public/services/rebate.js +2 -11
  70. package/src/api-public/services/rebate.js.map +1 -1
  71. package/src/api-public/services/rebate.ts +5 -12
  72. package/src/api-public/services/shopee.d.ts +23 -2
  73. package/src/api-public/services/shopee.js +230 -111
  74. package/src/api-public/services/shopee.js.map +1 -1
  75. package/src/api-public/services/shopee.ts +1012 -838
  76. package/src/api-public/services/user.js +2 -2
  77. package/src/api-public/services/user.js.map +1 -1
  78. package/src/api-public/services/user.ts +3 -3
  79. package/src/index.js +17 -7
  80. package/src/index.js.map +1 -1
  81. package/src/modules/tool.d.ts +4 -4
  82. package/src/modules/tool.js +2 -1
  83. package/src/modules/tool.js.map +1 -1
  84. package/src/services/backend-service.js +17 -7
  85. package/src/services/backend-service.js.map +1 -1
  86. package/src/services/template.d.ts +1 -1
  87. package/src/services/template.js +24 -18
  88. package/src/services/template.js.map +1 -1
  89. package/src/services/template.ts +34 -37
@@ -216,20 +216,29 @@ export class ProductCard01 {
216
216
  })}"
217
217
  />
218
218
  <div class="child add-cart-child">
219
- <div
220
- class="w-100 h-100 p-3 add-cart-text"
221
- onclick="${gvc.event((e, event) => {
222
- event.stopPropagation();
223
- PdClass.addCartAction({
224
- gvc: gvc,
225
- titleFontColor: titleFontColor,
226
- prod: prod,
227
- vm: vm,
228
- });
229
- })}"
230
- >
231
- <i class="fa-regular fa-cart-shopping me-2"></i>${Language.text('add_to_cart')}
232
- </div>
219
+ ${(() => {
220
+ const isAllUnderstocking = prod.variants.every((item) => item.show_understocking === 'true');
221
+ const stockTotal = prod.variants.reduce((sum, item) => sum + item.stock, 0);
222
+ const isSoldOut = isAllUnderstocking && stockTotal === 0;
223
+ return html `<div
224
+ class="w-100 h-100 p-3 add-cart-text"
225
+ onclick="${gvc.event((_, event) => {
226
+ event.stopPropagation();
227
+ if (!isSoldOut) {
228
+ PdClass.addCartAction({
229
+ gvc: gvc,
230
+ titleFontColor: titleFontColor,
231
+ prod: prod,
232
+ vm: vm,
233
+ });
234
+ }
235
+ })}"
236
+ >
237
+ ${isSoldOut
238
+ ? html `<i class="fa-solid fa-ban me-2"></i>${Language.text('sold_out')}`
239
+ : html `<i class="fa-regular fa-cart-shopping me-2"></i>${Language.text('add_to_cart')}`}
240
+ </div>`;
241
+ })()}
233
242
  </div>
234
243
  </div>
235
244
  <div class="card-collapse-parent cursor_pointer">
@@ -233,20 +233,31 @@ export class ProductCard01 {
233
233
  })}"
234
234
  />
235
235
  <div class="child add-cart-child">
236
- <div
237
- class="w-100 h-100 p-3 add-cart-text"
238
- onclick="${gvc.event((e, event) => {
239
- event.stopPropagation();
240
- PdClass.addCartAction({
241
- gvc: gvc,
242
- titleFontColor: titleFontColor,
243
- prod: prod,
244
- vm: vm,
245
- });
246
- })}"
247
- >
248
- <i class="fa-regular fa-cart-shopping me-2"></i>${Language.text('add_to_cart')}
249
- </div>
236
+ ${(() => {
237
+ const isAllUnderstocking = prod.variants.every((item: any) => item.show_understocking === 'true');
238
+ const stockTotal = prod.variants.reduce((sum: number, item: any) => sum + item.stock, 0);
239
+ const isSoldOut = isAllUnderstocking && stockTotal === 0;
240
+
241
+ return html`<div
242
+ class="w-100 h-100 p-3 add-cart-text"
243
+ onclick="${gvc.event((_, event) => {
244
+ event.stopPropagation();
245
+
246
+ if (!isSoldOut) {
247
+ PdClass.addCartAction({
248
+ gvc: gvc,
249
+ titleFontColor: titleFontColor,
250
+ prod: prod,
251
+ vm: vm,
252
+ });
253
+ }
254
+ })}"
255
+ >
256
+ ${isSoldOut
257
+ ? html`<i class="fa-solid fa-ban me-2"></i>${Language.text('sold_out')}`
258
+ : html`<i class="fa-regular fa-cart-shopping me-2"></i>${Language.text('add_to_cart')}`}
259
+ </div>`;
260
+ })()}
250
261
  </div>
251
262
  </div>
252
263
  <div class="card-collapse-parent cursor_pointer">
@@ -205,7 +205,7 @@ export class ProductCard02 {
205
205
  })}"
206
206
  />
207
207
  </div>
208
-
208
+
209
209
  <div class="card-collapse-parent">
210
210
  <div class="d-flex card-title-container justify-content-between align-items-center">
211
211
  <div class="row gx-0 mb-1" style="max-width:calc(100% - 50px);">
@@ -229,21 +229,28 @@ export class ProductCard02 {
229
229
  </div>
230
230
  </div>
231
231
  <div class="add-cart-child">
232
- <div
233
- class="w-100 h-100 p-3 add-cart-text"
234
- style="border-radius: 50%; color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};"
235
- onclick="${gvc.event((e, event) => {
236
- event.stopPropagation();
237
- PdClass.addCartAction({
238
- gvc: gvc,
239
- titleFontColor: titleFontColor,
240
- prod: prod,
241
- vm: vm,
242
- });
243
- })}"
244
- >
245
- <i class="fa-solid fa-cart-plus"></i>
246
- </div>
232
+ ${(() => {
233
+ const isAllUnderstocking = prod.variants.every((item) => item.show_understocking === 'true');
234
+ const stockTotal = prod.variants.reduce((sum, item) => sum + item.stock, 0);
235
+ const isSoldOut = isAllUnderstocking && stockTotal === 0;
236
+ return html `<div
237
+ class="w-100 h-100 p-3 add-cart-text"
238
+ style="border-radius: 50%; color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};"
239
+ onclick="${gvc.event((_, event) => {
240
+ event.stopPropagation();
241
+ if (!isSoldOut) {
242
+ PdClass.addCartAction({
243
+ gvc: gvc,
244
+ titleFontColor: titleFontColor,
245
+ prod: prod,
246
+ vm: vm,
247
+ });
248
+ }
249
+ })}"
250
+ >
251
+ ${isSoldOut ? html `<i class="fa-solid fa-ban"></i>` : html `<i class="fa-solid fa-cart-plus"></i>`}
252
+ </div>`;
253
+ })()}
247
254
  </div>
248
255
  </div>
249
256
  </div>
@@ -223,7 +223,7 @@ export class ProductCard02 {
223
223
  })}"
224
224
  />
225
225
  </div>
226
-
226
+
227
227
  <div class="card-collapse-parent">
228
228
  <div class="d-flex card-title-container justify-content-between align-items-center">
229
229
  <div class="row gx-0 mb-1" style="max-width:calc(100% - 50px);">
@@ -249,21 +249,30 @@ export class ProductCard02 {
249
249
  </div>
250
250
  </div>
251
251
  <div class="add-cart-child">
252
- <div
253
- class="w-100 h-100 p-3 add-cart-text"
254
- style="border-radius: 50%; color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};"
255
- onclick="${gvc.event((e, event) => {
256
- event.stopPropagation();
257
- PdClass.addCartAction({
258
- gvc: gvc,
259
- titleFontColor: titleFontColor,
260
- prod: prod,
261
- vm: vm,
262
- });
263
- })}"
264
- >
265
- <i class="fa-solid fa-cart-plus"></i>
266
- </div>
252
+ ${(() => {
253
+ const isAllUnderstocking = prod.variants.every((item: any) => item.show_understocking === 'true');
254
+ const stockTotal = prod.variants.reduce((sum: number, item: any) => sum + item.stock, 0);
255
+ const isSoldOut = isAllUnderstocking && stockTotal === 0;
256
+
257
+ return html`<div
258
+ class="w-100 h-100 p-3 add-cart-text"
259
+ style="border-radius: 50%; color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};"
260
+ onclick="${gvc.event((_, event) => {
261
+ event.stopPropagation();
262
+
263
+ if (!isSoldOut) {
264
+ PdClass.addCartAction({
265
+ gvc: gvc,
266
+ titleFontColor: titleFontColor,
267
+ prod: prod,
268
+ vm: vm,
269
+ });
270
+ }
271
+ })}"
272
+ >
273
+ ${isSoldOut ? html`<i class="fa-solid fa-ban"></i>` : html`<i class="fa-solid fa-cart-plus"></i>`}
274
+ </div>`;
275
+ })()}
267
276
  </div>
268
277
  </div>
269
278
  </div>
@@ -211,7 +211,7 @@ export class ProductCard03 {
211
211
  })}"
212
212
  />
213
213
  </div>
214
-
214
+
215
215
  <div class="card-collapse-parent">
216
216
  <div class="card-title-container" style="min-height:auto;">
217
217
  <div class="row gx-0 mb-2">
@@ -235,21 +235,30 @@ export class ProductCard03 {
235
235
  </div>
236
236
  </div>
237
237
  <div class="add-cart-child">
238
- <div
239
- class="w-100 h-100 p-3 add-cart-text"
240
- style="color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};"
241
- onclick="${gvc.event((_, event) => {
242
- event.stopPropagation();
243
- PdClass.addCartAction({
244
- gvc: gvc,
245
- titleFontColor: titleFontColor,
246
- prod: prod,
247
- vm: vm,
248
- });
249
- })}"
250
- >
251
- <i class="fa-solid fa-cart-plus me-2"></i>${Language.text('add_to_cart')}
252
- </div>
238
+ ${(() => {
239
+ const isAllUnderstocking = prod.variants.every((item) => item.show_understocking === 'true');
240
+ const stockTotal = prod.variants.reduce((sum, item) => sum + item.stock, 0);
241
+ const isSoldOut = isAllUnderstocking && stockTotal === 0;
242
+ return html `<div
243
+ class="w-100 h-100 p-3 add-cart-text"
244
+ style="color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};"
245
+ onclick="${gvc.event((_, event) => {
246
+ event.stopPropagation();
247
+ if (!isSoldOut) {
248
+ PdClass.addCartAction({
249
+ gvc: gvc,
250
+ titleFontColor: titleFontColor,
251
+ prod: prod,
252
+ vm: vm,
253
+ });
254
+ }
255
+ })}"
256
+ >
257
+ ${isSoldOut
258
+ ? html `<i class="fa-solid fa-ban me-2"></i>${Language.text('sold_out')}`
259
+ : html `<i class="fa-solid fa-cart-plus me-2"></i>${Language.text('add_to_cart')}`}
260
+ </div>`;
261
+ })()}
253
262
  </div>
254
263
  </div>
255
264
  </div>
@@ -229,7 +229,7 @@ export class ProductCard03 {
229
229
  })}"
230
230
  />
231
231
  </div>
232
-
232
+
233
233
  <div class="card-collapse-parent">
234
234
  <div class="card-title-container" style="min-height:auto;">
235
235
  <div class="row gx-0 mb-2">
@@ -255,21 +255,32 @@ export class ProductCard03 {
255
255
  </div>
256
256
  </div>
257
257
  <div class="add-cart-child">
258
- <div
259
- class="w-100 h-100 p-3 add-cart-text"
260
- style="color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};"
261
- onclick="${gvc.event((_, event) => {
262
- event.stopPropagation();
263
- PdClass.addCartAction({
264
- gvc: gvc,
265
- titleFontColor: titleFontColor,
266
- prod: prod,
267
- vm: vm,
268
- });
269
- })}"
270
- >
271
- <i class="fa-solid fa-cart-plus me-2"></i>${Language.text('add_to_cart')}
272
- </div>
258
+ ${(() => {
259
+ const isAllUnderstocking = prod.variants.every((item: any) => item.show_understocking === 'true');
260
+ const stockTotal = prod.variants.reduce((sum: number, item: any) => sum + item.stock, 0);
261
+ const isSoldOut = isAllUnderstocking && stockTotal === 0;
262
+
263
+ return html`<div
264
+ class="w-100 h-100 p-3 add-cart-text"
265
+ style="color: ${borderButtonText}; border: 1px solid ${borderButtonBgr};"
266
+ onclick="${gvc.event((_, event) => {
267
+ event.stopPropagation();
268
+
269
+ if (!isSoldOut) {
270
+ PdClass.addCartAction({
271
+ gvc: gvc,
272
+ titleFontColor: titleFontColor,
273
+ prod: prod,
274
+ vm: vm,
275
+ });
276
+ }
277
+ })}"
278
+ >
279
+ ${isSoldOut
280
+ ? html`<i class="fa-solid fa-ban me-2"></i>${Language.text('sold_out')}`
281
+ : html`<i class="fa-solid fa-cart-plus me-2"></i>${Language.text('add_to_cart')}`}
282
+ </div>`;
283
+ })()}
273
284
  </div>
274
285
  </div>
275
286
  </div>
@@ -414,7 +414,7 @@ export class PdClass {
414
414
  const glitter = window.glitter;
415
415
  return ['hidden/', 'shop/'].find((dd) => {
416
416
  return (glitter.getUrlParameter('page') || '').startsWith(dd) || ((glitter.getUrlParameter('page_refer') || '').startsWith(dd));
417
- }) || glitter.share.is_shop;
417
+ });
418
418
  }
419
419
  static changePage(prod, gvc) {
420
420
  const glitter = gvc.glitter;
@@ -579,7 +579,7 @@ export class PdClass {
579
579
  const glitter = (window as any).glitter;
580
580
  return ['hidden/','shop/'].find((dd)=>{
581
581
  return (glitter.getUrlParameter('page') || '').startsWith(dd) || ((glitter.getUrlParameter('page_refer') || '').startsWith(dd))
582
- }) || glitter.share.is_shop;
582
+ });
583
583
  }
584
584
  // document.querySelector('.check_out_cart_data').scrollIntoView()
585
585
  static changePage(prod: any, gvc: GVC) {
@@ -63,7 +63,10 @@ export class TermsRelated {
63
63
  'shipment_list_archive',
64
64
  'reconciliation_area',
65
65
  'app-design',
66
- 'auto_fcm_push', 'auto_fcm_advertise', 'auto_fcm_history', 'pos_setting'
66
+ 'auto_fcm_push',
67
+ 'auto_fcm_advertise',
68
+ 'auto_fcm_history',
69
+ 'pos_setting',
67
70
  ].includes(glitter.getUrlParameter('page'))) {
68
71
  return yield new Promise((resolve, reject) => {
69
72
  glitter.getModule(new URL('./cms-plugin/cms-router.js', gvc.glitter.root_path).href, res => {
@@ -85,7 +88,15 @@ export class TermsRelated {
85
88
  });
86
89
  });
87
90
  }
88
- else if (['account_userinfo', 'voucher-list', 'rebate', 'order_list', 'wishlist', 'account_edit'].includes(page)) {
91
+ else if ([
92
+ 'account_userinfo',
93
+ 'voucher-list',
94
+ 'rebate',
95
+ 'order_list',
96
+ 'wishlist',
97
+ 'recipient_info',
98
+ 'account_edit',
99
+ ].includes(page)) {
89
100
  return yield new Promise((resolve, reject) => {
90
101
  glitter.getModule(new URL('./cms-plugin/account-info.js', gvc.glitter.root_path).href, res => {
91
102
  document.querySelector(`.${id}`).outerHTML = res.main(gvc);
@@ -66,7 +66,10 @@ export class TermsRelated {
66
66
  'shipment_list_archive',
67
67
  'reconciliation_area',
68
68
  'app-design',
69
- 'auto_fcm_push','auto_fcm_advertise','auto_fcm_history','pos_setting'
69
+ 'auto_fcm_push',
70
+ 'auto_fcm_advertise',
71
+ 'auto_fcm_history',
72
+ 'pos_setting',
70
73
  ].includes(glitter.getUrlParameter('page'))
71
74
  ) {
72
75
  return await new Promise((resolve, reject) => {
@@ -86,7 +89,17 @@ export class TermsRelated {
86
89
  (document.querySelector(`.${id}`) as any).outerHTML = res.inputVerificationCode(gvc);
87
90
  });
88
91
  });
89
- } else if (['account_userinfo', 'voucher-list', 'rebate', 'order_list', 'wishlist','account_edit'].includes(page)) {
92
+ } else if (
93
+ [
94
+ 'account_userinfo',
95
+ 'voucher-list',
96
+ 'rebate',
97
+ 'order_list',
98
+ 'wishlist',
99
+ 'recipient_info',
100
+ 'account_edit',
101
+ ].includes(page)
102
+ ) {
90
103
  //個人檔案相關頁面
91
104
  return await new Promise((resolve, reject) => {
92
105
  glitter.getModule(new URL('./cms-plugin/account-info.js', gvc.glitter.root_path).href, res => {