ts-glitter 21.1.7 → 21.1.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 (111) hide show
  1. package/lowcode/Entry.js +14 -1
  2. package/lowcode/Entry.ts +13 -1
  3. package/lowcode/backend-manager/bg-line.js +18 -10
  4. package/lowcode/backend-manager/bg-line.ts +19 -10
  5. package/lowcode/backend-manager/bg-list-component.js +1 -2
  6. package/lowcode/backend-manager/bg-list-component.ts +1 -1
  7. package/lowcode/backend-manager/bg-notify.js +17 -10
  8. package/lowcode/backend-manager/bg-notify.ts +19 -11
  9. package/lowcode/backend-manager/bg-product.js +39 -18
  10. package/lowcode/backend-manager/bg-product.ts +54 -23
  11. package/lowcode/backend-manager/bg-recommend.js +15 -9
  12. package/lowcode/backend-manager/bg-recommend.ts +16 -9
  13. package/lowcode/backend-manager/bg-sns.js +16 -9
  14. package/lowcode/backend-manager/bg-sns.ts +18 -11
  15. package/lowcode/backend-manager/bg-widget.js +325 -261
  16. package/lowcode/backend-manager/bg-widget.ts +117 -45
  17. package/lowcode/cms-plugin/auto-fcm-history.js +15 -6
  18. package/lowcode/cms-plugin/auto-fcm-history.ts +18 -11
  19. package/lowcode/cms-plugin/auto-reply.js +17 -1
  20. package/lowcode/cms-plugin/auto-reply.ts +16 -1
  21. package/lowcode/cms-plugin/exhibition-list.js +11 -2
  22. package/lowcode/cms-plugin/exhibition-list.ts +12 -2
  23. package/lowcode/cms-plugin/live_capture.js +2 -2
  24. package/lowcode/cms-plugin/live_capture.ts +2 -2
  25. package/lowcode/cms-plugin/model/order.d.ts +1 -0
  26. package/lowcode/cms-plugin/module/order-excel.js +15 -1
  27. package/lowcode/cms-plugin/module/order-excel.ts +22 -2
  28. package/lowcode/cms-plugin/module/table-storage.js +11 -0
  29. package/lowcode/cms-plugin/module/table-storage.ts +12 -0
  30. package/lowcode/cms-plugin/permission-setting.js +16 -9
  31. package/lowcode/cms-plugin/permission-setting.ts +18 -10
  32. package/lowcode/cms-plugin/pos-pages/payment-page.js +37 -29
  33. package/lowcode/cms-plugin/pos-pages/payment-page.ts +61 -49
  34. package/lowcode/cms-plugin/pos-pages/pos-function.js +6 -1
  35. package/lowcode/cms-plugin/pos-pages/pos-function.ts +8 -1
  36. package/lowcode/cms-plugin/reconciliation-area.js +12 -3
  37. package/lowcode/cms-plugin/reconciliation-area.ts +13 -3
  38. package/lowcode/cms-plugin/shopping-allowance-manager.js +12 -3
  39. package/lowcode/cms-plugin/shopping-allowance-manager.ts +13 -3
  40. package/lowcode/cms-plugin/shopping-invoice-manager.js +12 -3
  41. package/lowcode/cms-plugin/shopping-invoice-manager.ts +13 -4
  42. package/lowcode/cms-plugin/shopping-order-manager.js +12 -3
  43. package/lowcode/cms-plugin/shopping-order-manager.ts +13 -4
  44. package/lowcode/cms-plugin/shopping-product-setting.js +16 -10
  45. package/lowcode/cms-plugin/shopping-product-setting.ts +17 -10
  46. package/lowcode/cms-plugin/shopping-product-stock.js +17 -11
  47. package/lowcode/cms-plugin/shopping-product-stock.ts +18 -11
  48. package/lowcode/cms-plugin/shopping-setting-basic.js +129 -38
  49. package/lowcode/cms-plugin/shopping-setting-basic.ts +134 -38
  50. package/lowcode/cms-plugin/stock-history.js +15 -7
  51. package/lowcode/cms-plugin/stock-history.ts +16 -17
  52. package/lowcode/cms-plugin/stock-stores.js +13 -6
  53. package/lowcode/cms-plugin/stock-stores.ts +14 -6
  54. package/lowcode/cms-plugin/stock-vendors.js +13 -6
  55. package/lowcode/cms-plugin/stock-vendors.ts +14 -6
  56. package/lowcode/cms-plugin/user-list.js +24 -7
  57. package/lowcode/cms-plugin/user-list.ts +25 -7
  58. package/lowcode/css/editor.css +11 -6
  59. package/lowcode/form-view/e-commerce/product-select.js +13 -11
  60. package/lowcode/form-view/e-commerce/product-select.ts +14 -12
  61. package/lowcode/modules/tool.js +9 -0
  62. package/lowcode/modules/tool.ts +12 -0
  63. package/lowcode/public-components/checkout/index.js +216 -207
  64. package/lowcode/public-components/checkout/index.ts +1315 -1309
  65. package/lowcode/public-components/product/pd-class.js +11 -2
  66. package/lowcode/public-components/product/pd-class.ts +16 -3
  67. package/lowcode/public-components/public/ad.js +42 -10
  68. package/lowcode/public-components/public/ad.ts +28 -1
  69. package/lowcode/public-models/product.ts +1 -0
  70. package/lowcode/view-model/saas-view-model.js +394 -379
  71. package/lowcode/view-model/saas-view-model.ts +1451 -1405
  72. package/package.json +1 -1
  73. package/src/api-public/controllers/user.js +4 -4
  74. package/src/api-public/controllers/user.js.map +1 -1
  75. package/src/api-public/controllers/user.ts +4 -4
  76. package/src/api-public/models/glitter-finance.js +1 -2
  77. package/src/api-public/models/glitter-finance.js.map +1 -5
  78. package/src/api-public/services/data-analyze.d.ts +1 -1
  79. package/src/api-public/services/fb-api.d.ts +4 -3
  80. package/src/api-public/services/fb-api.js +72 -27
  81. package/src/api-public/services/fb-api.js.map +1 -1
  82. package/src/api-public/services/fb-api.ts +183 -127
  83. package/src/api-public/services/fb-service.js +4 -4
  84. package/src/api-public/services/fb-service.js.map +1 -1
  85. package/src/api-public/services/schedule.d.ts +1 -1
  86. package/src/api-public/services/schedule.js +18 -14
  87. package/src/api-public/services/schedule.js.map +1 -1
  88. package/src/api-public/services/schedule.ts +18 -14
  89. package/src/api-public/services/user.d.ts +6 -5
  90. package/src/api-public/services/user.js +12 -10
  91. package/src/api-public/services/user.js.map +1 -1
  92. package/src/api-public/services/user.ts +14 -10
  93. package/src/config.d.ts +1 -1
  94. package/src/modules/AWSLib.js +2 -3
  95. package/src/modules/AWSLib.js.map +1 -1
  96. package/src/modules/database.d.ts +1 -1
  97. package/src/modules/redis.d.ts +1 -1
  98. package/src/modules/tool.d.ts +4 -4
  99. package/src/modules/tool.js +1 -2
  100. package/src/modules/tool.js.map +1 -1
  101. package/src/seo-config.js +1 -0
  102. package/src/seo-config.js.map +1 -1
  103. package/src/seo-config.ts +1 -0
  104. package/src/services/backend-service.js +17 -7
  105. package/src/services/backend-service.js.map +1 -1
  106. package/src/services/create-instance.js +3 -4
  107. package/src/services/create-instance.js.map +1 -1
  108. package/src/services/saas-table-check.js +2 -2
  109. package/src/services/saas-table-check.js.map +1 -5
  110. package/src/services/tool.js +2 -3
  111. package/src/services/tool.js.map +1 -1
@@ -283,6 +283,7 @@ export class PdClass {
283
283
  });
284
284
  }
285
285
  static showSwiper(obj) {
286
+ var _a;
286
287
  const isPhone = document.body.clientWidth < 768;
287
288
  obj.gvc.glitter.addStyleLink(['https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css']);
288
289
  obj.gvc.glitter.addMtScript([
@@ -300,8 +301,10 @@ export class PdClass {
300
301
  }
301
302
  });
302
303
  PdClass.addSpecStyle(obj.gvc);
303
- if (obj.vm.specs.length === 0) {
304
- obj.vm.specs = obj.vm.specs.map((spec) => spec.option[0].title);
304
+ const invisibleVariants = obj.prod.variants.filter(v => v.invisible);
305
+ const visibleVariants = obj.prod.variants.filter(v => !v.invisible);
306
+ if (obj.vm.specs.length === 0 || invisibleVariants.find(iv => Tool.ObjCompare(iv.spec, obj.vm.specs))) {
307
+ obj.vm.specs = (_a = visibleVariants === null || visibleVariants === void 0 ? void 0 : visibleVariants[0].spec) !== null && _a !== void 0 ? _a : [];
305
308
  }
306
309
  obj.prod.preview_image = obj.prod.preview_image.filter(image => {
307
310
  return image !== 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg';
@@ -648,6 +651,7 @@ export class PdClass {
648
651
  return {
649
652
  bind: ids.ids_spec,
650
653
  view: () => {
654
+ const invisibleVariants = prod.variants.filter(v => v.invisible).map(v => v.spec);
651
655
  return prod.specs
652
656
  .map((spec, index1) => {
653
657
  return html ` <div>
@@ -656,6 +660,11 @@ export class PdClass {
656
660
  </h5>
657
661
  <div class="d-flex gap-2 flex-wrap">
658
662
  ${gvc.map(spec.option.map((opt) => {
663
+ const cloneSpecs = vm.specs.slice();
664
+ cloneSpecs[index1] = opt.title;
665
+ if (invisibleVariants.find(iv => Tool.ObjCompare(iv, cloneSpecs))) {
666
+ return '';
667
+ }
659
668
  return html ` <div
660
669
  gvc-option="spec-option-${index1}"
661
670
  class="spec-option ${vm.specs[index1] === opt.title ? 'selected-option' : ''}"
@@ -437,9 +437,13 @@ export class PdClass {
437
437
  });
438
438
  PdClass.addSpecStyle(obj.gvc);
439
439
 
440
+ // 可顯示與不可顯示產品規格
441
+ const invisibleVariants = obj.prod.variants.filter(v => v.invisible);
442
+ const visibleVariants = obj.prod.variants.filter(v => !v.invisible);
443
+
440
444
  // 更新規格
441
- if (obj.vm.specs.length === 0) {
442
- obj.vm.specs = obj.vm.specs.map((spec: any) => spec.option[0].title);
445
+ if (obj.vm.specs.length === 0 || invisibleVariants.find(iv => Tool.ObjCompare(iv.spec, obj.vm.specs))) {
446
+ obj.vm.specs = visibleVariants?.[0].spec ?? [];
443
447
  }
444
448
 
445
449
  // 過濾預覽圖片
@@ -830,6 +834,8 @@ export class PdClass {
830
834
  return {
831
835
  bind: ids.ids_spec,
832
836
  view: () => {
837
+ const invisibleVariants = prod.variants.filter(v => v.invisible).map(v => v.spec);
838
+
833
839
  return prod.specs
834
840
  .map((spec, index1) => {
835
841
  return html` <div>
@@ -839,6 +845,14 @@ export class PdClass {
839
845
  <div class="d-flex gap-2 flex-wrap">
840
846
  ${gvc.map(
841
847
  spec.option.map((opt: any) => {
848
+ // 排除不可顯示的規格選項
849
+ const cloneSpecs = vm.specs.slice();
850
+ cloneSpecs[index1] = opt.title;
851
+
852
+ if (invisibleVariants.find(iv => Tool.ObjCompare(iv, cloneSpecs))) {
853
+ return '';
854
+ }
855
+
842
856
  return html` <div
843
857
  gvc-option="spec-option-${index1}"
844
858
  class="spec-option ${vm.specs[index1] === opt.title ? 'selected-option' : ''}"
@@ -1052,7 +1066,6 @@ export class PdClass {
1052
1066
  });
1053
1067
  }
1054
1068
  );
1055
- // gvc.glitter.getModule('',(module)=>{
1056
1069
  })}"
1057
1070
  >
1058
1071
  <i class="fa-brands fa-rocketchat"></i>
@@ -1,4 +1,14 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { ApiTrack } from '../../glitter-base/route/api-track.js';
11
+ import { GlobalUser } from '../../glitter-base/global/global-user.js';
2
12
  export class Ad {
3
13
  static gtagEvent(name, obj) {
4
14
  const gtag = window.gtag;
@@ -7,16 +17,38 @@ export class Ad {
7
17
  }
8
18
  }
9
19
  static fbqEvent(name, obj) {
10
- const fbq = window.fbq;
11
- obj.eventID = obj.eventID || window.glitter.getUUID();
12
- if (fbq) {
13
- fbq('track', name, JSON.parse(JSON.stringify(obj)));
14
- }
15
- obj.event_id = obj.eventID;
16
- delete obj.eventID;
17
- ApiTrack.track({
18
- event_name: name,
19
- custom_data: obj,
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const fbq = window.fbq;
22
+ obj.eventID = obj.eventID || window.glitter.getUUID();
23
+ if (fbq) {
24
+ if (GlobalUser.userInfo) {
25
+ function hashSHA256(input) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const encoder = new TextEncoder();
28
+ const data = encoder.encode(input.trim().toLowerCase());
29
+ const hashBuffer = yield crypto.subtle.digest('SHA-256', data);
30
+ return Array.from(new Uint8Array(hashBuffer))
31
+ .map(b => b.toString(16).padStart(2, '0'))
32
+ .join('');
33
+ });
34
+ }
35
+ const obj = {};
36
+ if (GlobalUser.userInfo.email) {
37
+ obj.email = yield hashSHA256(GlobalUser.userInfo.email);
38
+ }
39
+ if (GlobalUser.userInfo.phone) {
40
+ obj.phone = yield hashSHA256(GlobalUser.userInfo.phone);
41
+ }
42
+ fbq('init', window.fb_pixel_id, obj);
43
+ }
44
+ fbq('track', name, JSON.parse(JSON.stringify(obj)));
45
+ }
46
+ obj.event_id = obj.eventID;
47
+ delete obj.eventID;
48
+ ApiTrack.track({
49
+ event_name: name,
50
+ custom_data: obj,
51
+ });
20
52
  });
21
53
  }
22
54
  }
@@ -1,4 +1,5 @@
1
1
  import { ApiTrack } from '../../glitter-base/route/api-track.js';
2
+ import { GlobalUser } from '../../glitter-base/global/global-user.js';
2
3
 
3
4
  export class Ad {
4
5
  static gtagEvent(name: string, obj: any) {
@@ -8,10 +9,36 @@ export class Ad {
8
9
  }
9
10
  }
10
11
 
11
- static fbqEvent(name: string, obj: any) {
12
+ static async fbqEvent(name: string, obj: any) {
12
13
  const fbq = (window as any).fbq;
13
14
  obj.eventID = obj.eventID || (window as any).glitter.getUUID();
14
15
  if (fbq) {
16
+ // console.log(`pixel-user-info`,GlobalUser.userInfo)
17
+ //fbq('init', '你的PIXEL_ID', {
18
+ // em: '雜湊後的email',
19
+ // ph: '雜湊後的phone'
20
+ // });
21
+ // 這通常在登入成功或註冊完成之後
22
+ if (GlobalUser.userInfo) {
23
+ async function hashSHA256(input: any) {
24
+ const encoder = new TextEncoder();
25
+ const data = encoder.encode(input.trim().toLowerCase());
26
+ const hashBuffer = await crypto.subtle.digest('SHA-256', data);
27
+ return Array.from(new Uint8Array(hashBuffer))
28
+ .map(b => b.toString(16).padStart(2, '0'))
29
+ .join('');
30
+ }
31
+
32
+ const obj: any = {};
33
+
34
+ if(GlobalUser.userInfo.email){
35
+ obj.email = await hashSHA256(GlobalUser.userInfo.email);
36
+ }
37
+ if(GlobalUser.userInfo.phone){
38
+ obj.phone = await hashSHA256(GlobalUser.userInfo.phone);
39
+ }
40
+ fbq('init', (window as any).fb_pixel_id, obj);
41
+ }
15
42
  fbq('track', name, JSON.parse(JSON.stringify(obj)));
16
43
  }
17
44
  obj.event_id = obj.eventID;
@@ -21,6 +21,7 @@ export interface Variant {
21
21
  show_understocking: string;
22
22
  type: string;
23
23
  checked?: any;
24
+ invisible?: boolean;
24
25
  }
25
26
 
26
27
  export interface LanguageData {