ts-glitter 21.5.3 → 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 (79) 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/layout-plugin/social-links-01.js +122 -3
  29. package/lowcode/public-components/layout-plugin/social-links-01.ts +135 -10
  30. package/lowcode/public-components/product/pd-card-01.js +23 -14
  31. package/lowcode/public-components/product/pd-card-01.ts +25 -14
  32. package/lowcode/public-components/product/pd-card-02.js +23 -16
  33. package/lowcode/public-components/product/pd-card-02.ts +25 -16
  34. package/lowcode/public-components/product/pd-card-03.js +25 -16
  35. package/lowcode/public-components/product/pd-card-03.ts +27 -16
  36. package/lowcode/public-components/terms-related/index.js +13 -2
  37. package/lowcode/public-components/terms-related/index.ts +15 -2
  38. package/lowcode/public-components/user-manager/um-class.js +490 -501
  39. package/lowcode/public-components/user-manager/um-class.ts +872 -882
  40. package/lowcode/public-components/user-manager/um-info.js +41 -40
  41. package/lowcode/public-components/user-manager/um-info.ts +54 -56
  42. package/lowcode/public-components/user-manager/um-login.js +10 -13
  43. package/lowcode/public-components/user-manager/um-login.ts +15 -23
  44. package/lowcode/public-components/user-manager/um-orderlist.js +60 -51
  45. package/lowcode/public-components/user-manager/um-orderlist.ts +289 -275
  46. package/lowcode/public-components/user-manager/um-rebate.js +104 -82
  47. package/lowcode/public-components/user-manager/um-rebate.ts +294 -267
  48. package/lowcode/public-components/user-manager/um-receive.js +582 -0
  49. package/lowcode/public-components/user-manager/um-receive.ts +599 -0
  50. package/lowcode/public-components/user-manager/um-wishlist.js +72 -68
  51. package/lowcode/public-components/user-manager/um-wishlist.ts +240 -230
  52. package/package.json +1 -1
  53. package/src/api-public/controllers/shopee.js +17 -0
  54. package/src/api-public/controllers/shopee.js.map +1 -1
  55. package/src/api-public/controllers/shopee.ts +32 -0
  56. package/src/api-public/services/monitor.d.ts +1 -0
  57. package/src/api-public/services/post.js +17 -7
  58. package/src/api-public/services/post.js.map +1 -1
  59. package/src/api-public/services/rebate.js +2 -11
  60. package/src/api-public/services/rebate.js.map +1 -1
  61. package/src/api-public/services/rebate.ts +5 -12
  62. package/src/api-public/services/shopee.d.ts +23 -2
  63. package/src/api-public/services/shopee.js +230 -111
  64. package/src/api-public/services/shopee.js.map +1 -1
  65. package/src/api-public/services/shopee.ts +1012 -838
  66. package/src/api-public/services/user.js +2 -2
  67. package/src/api-public/services/user.js.map +1 -1
  68. package/src/api-public/services/user.ts +3 -3
  69. package/src/index.js +17 -7
  70. package/src/index.js.map +1 -1
  71. package/src/modules/tool.d.ts +4 -4
  72. package/src/modules/tool.js +2 -1
  73. package/src/modules/tool.js.map +1 -1
  74. package/src/services/backend-service.js +17 -7
  75. package/src/services/backend-service.js.map +1 -1
  76. package/src/services/template.d.ts +1 -1
  77. package/src/services/template.js +24 -18
  78. package/src/services/template.js.map +1 -1
  79. package/src/services/template.ts +34 -37
@@ -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>
@@ -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 => {