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
@@ -27,7 +27,7 @@ type ScheduleItem = {
27
27
  export class Schedule {
28
28
  static app: string[] = [];
29
29
 
30
- async perload(app: string) {
30
+ async preload(app: string) {
31
31
  const brand_type = await App.checkBrandAndMemberType(app);
32
32
  if (brand_type.brand === 'shopnex' && brand_type.domain) {
33
33
  if (!(await this.isDatabasePass(app))) return false;
@@ -59,7 +59,7 @@ export class Schedule {
59
59
  async example(sec: number) {
60
60
  try {
61
61
  for (const app of Schedule.app) {
62
- if (await this.perload(app)) {
62
+ if (await this.preload(app)) {
63
63
  // 排程範例
64
64
  // await
65
65
  }
@@ -75,7 +75,7 @@ export class Schedule {
75
75
  console.log(`autoCancelOrder`);
76
76
  for (const app of Schedule.app) {
77
77
  try {
78
- if (await this.perload(app)) {
78
+ if (await this.preload(app)) {
79
79
  const config = await new User(app).getConfigV2({ key: 'login_config', user_id: 'manager' });
80
80
  if (config?.auto_cancel_order_timer && config.auto_cancel_order_timer > 0) {
81
81
  const orders = await db.query(
@@ -117,7 +117,7 @@ export class Schedule {
117
117
  try {
118
118
  for (const app of Schedule.app) {
119
119
  try {
120
- if (await this.perload(app)) {
120
+ if (await this.preload(app)) {
121
121
  const users = await db.query(
122
122
  `select *
123
123
  from \`${app}\`.t_user `,
@@ -153,7 +153,7 @@ export class Schedule {
153
153
  console.log(`resetVoucherHistory`);
154
154
  for (const app of Schedule.app) {
155
155
  try {
156
- if (await this.perload(app)) {
156
+ if (await this.preload(app)) {
157
157
  const rebateClass = new Rebate(app);
158
158
  const userClass = new User(app);
159
159
 
@@ -224,7 +224,7 @@ export class Schedule {
224
224
  console.log(`resetVoucherHistory`);
225
225
  for (const app of Schedule.app) {
226
226
  try {
227
- if (await this.perload(app)) {
227
+ if (await this.preload(app)) {
228
228
  const mailType = 'auto-email-birthday';
229
229
  const customerMail = await AutoSendEmail.getDefCompare(app, mailType, 'zh-TW');
230
230
  if (customerMail.toggle) {
@@ -289,7 +289,7 @@ export class Schedule {
289
289
  console.log(`resetVoucherHistory`);
290
290
  for (const app of Schedule.app) {
291
291
  try {
292
- if (await this.perload(app)) {
292
+ if (await this.preload(app)) {
293
293
  await new Shopping(app).resetVoucherHistory();
294
294
  }
295
295
  } catch (e) {
@@ -305,7 +305,7 @@ export class Schedule {
305
305
  console.log(`autoTriggerInvoice`);
306
306
  for (const app of Schedule.app) {
307
307
  try {
308
- if (await this.perload(app)) {
308
+ if (await this.preload(app)) {
309
309
  const orders = await db.query(
310
310
  `SELECT *
311
311
  FROM \`${app}\`.t_triggers
@@ -333,7 +333,7 @@ export class Schedule {
333
333
  console.log(`autoSendLine`);
334
334
  for (const app of Schedule.app) {
335
335
  try {
336
- if (await this.perload(app)) {
336
+ if (await this.preload(app)) {
337
337
  const emails = await db.query(
338
338
  `SELECT *
339
339
  FROM \`${app}\`.t_triggers
@@ -362,7 +362,7 @@ export class Schedule {
362
362
  console.log(`autoSendLine`);
363
363
  for (const app of Schedule.app) {
364
364
  try {
365
- if (await this.perload(app)) {
365
+ if (await this.preload(app)) {
366
366
  const emails = await db.query(
367
367
  `SELECT *
368
368
  FROM \`${app}\`.t_triggers
@@ -390,7 +390,7 @@ export class Schedule {
390
390
  console.log(`autoSendLine`);
391
391
  for (const app of Schedule.app) {
392
392
  try {
393
- if (await this.perload(app)) {
393
+ if (await this.preload(app)) {
394
394
  const emails = await db.query(
395
395
  `SELECT *
396
396
  FROM \`${app}\`.t_triggers
@@ -478,7 +478,7 @@ export class Schedule {
478
478
  console.log(`visitLogs`);
479
479
  for (const app of Schedule.app) {
480
480
  try {
481
- if (await this.perload(app)) {
481
+ if (await this.preload(app)) {
482
482
  const count = await db.query(
483
483
  ` SELECT COUNT(DISTINCT mac_address) as count , CONVERT_TZ(NOW(), '+00:00', '+08:00') as now
484
484
  FROM ${process.env.GLITTER_DB}.t_monitor
@@ -489,7 +489,11 @@ export class Schedule {
489
489
  AND ${convertTimeZone('NOW()')}`,
490
490
  []
491
491
  );
492
- await db.query(`replace into \`${app}\`.visit_logs (date, count,tag_name) values (?, ? , ?)`,[count[0]['now'], count[0]['count'],(`${count[0]['now'].toISOString()}`).substring(0,10)]);
492
+ await db.query(`replace into \`${app}\`.visit_logs (date, count,tag_name) values (?, ? , ?)`, [
493
+ count[0]['now'],
494
+ count[0]['count'],
495
+ `${count[0]['now'].toISOString()}`.substring(0, 10),
496
+ ]);
493
497
  }
494
498
  } catch (e) {
495
499
  console.error('BAD_REQUEST', 'visitLogs Error: ' + e, null);
@@ -502,7 +506,7 @@ export class Schedule {
502
506
  main() {
503
507
  const scheduleList: ScheduleItem[] = ConfigSetting.is_local
504
508
  ? //線下測試環境
505
- [ { second: 60 * 5, status: true, func: 'visitLogs', desc: '更新每天造訪人數' },]
509
+ [{ second: 60 * 5, status: true, func: 'visitLogs', desc: '更新每天造訪人數' }]
506
510
  : //線上環境
507
511
  [
508
512
  // { second: 10, status: false, func: 'example', desc: '排程啟用範例' },
@@ -1,4 +1,5 @@
1
1
  import { IToken } from '../models/Auth.js';
2
+ import express from 'express';
2
3
  interface UserQuery {
3
4
  page?: number;
4
5
  limit?: number;
@@ -78,14 +79,14 @@ export declare class User {
78
79
  out_limit?: undefined;
79
80
  }>;
80
81
  createUser(account: string, pwd: string, userData: any, req: any, pass_verify?: boolean): Promise<any>;
81
- createUserHook(userID: string): Promise<void>;
82
+ createUserHook(userID: string, req: express.Request): Promise<void>;
82
83
  updateAccount(account: string, userID: string): Promise<any>;
83
84
  login(account: string, pwd: string): Promise<any>;
84
- loginWithFb(token: string): Promise<any>;
85
- loginWithLine(code: string, redirect: string): Promise<any>;
86
- loginWithGoogle(code: string, redirect: string): Promise<any>;
85
+ loginWithFb(token: string, req: express.Request): Promise<any>;
86
+ loginWithLine(code: string, redirect: string, req: express.Request): Promise<any>;
87
+ loginWithGoogle(code: string, redirect: string, req: express.Request): Promise<any>;
87
88
  loginWithPin(user_id: string, pin: string): Promise<any>;
88
- loginWithApple(token: string): Promise<any>;
89
+ loginWithApple(token: string, req: express.Request): Promise<any>;
89
90
  getUserData(query: string, type?: 'userID' | 'account' | 'email_or_phone'): Promise<any>;
90
91
  checkMember(userData: any, trigger: boolean): Promise<{
91
92
  id: string;
@@ -60,6 +60,7 @@ const ut_timer_1 = require("../utils/ut-timer");
60
60
  const auto_fcm_js_1 = require("../../public-config-initial/auto-fcm.js");
61
61
  const phone_verify_js_1 = require("./phone-verify.js");
62
62
  const update_progress_track_js_1 = require("../../update-progress-track.js");
63
+ const fb_api_js_1 = require("./fb-api.js");
63
64
  class User {
64
65
  constructor(app, token) {
65
66
  this.normalMember = {
@@ -215,7 +216,7 @@ class User {
215
216
  Object.assign(Object.assign({}, (userData !== null && userData !== void 0 ? userData : {})), { status: undefined }),
216
217
  userData.status === 0 ? 0 : 1,
217
218
  ]);
218
- await this.createUserHook(userID);
219
+ await this.createUserHook(userID, req);
219
220
  const usData = await this.getUserData(userID, 'userID');
220
221
  usData.pwd = undefined;
221
222
  usData.token = await UserUtil_1.default.generateToken({
@@ -234,7 +235,7 @@ class User {
234
235
  throw exception_1.default.BadRequestError('BAD_REQUEST', 'Register Error:' + e, e.data);
235
236
  }
236
237
  }
237
- async createUserHook(userID) {
238
+ async createUserHook(userID, req) {
238
239
  const usData = await this.getUserData(userID, 'userID');
239
240
  usData.userData.repeatPwd = undefined;
240
241
  await database_1.default.query(`update \`${this.app}\`.t_user
@@ -261,6 +262,7 @@ class User {
261
262
  }
262
263
  new notify_js_1.ManagerNotify(this.app).userRegister({ user_id: userID });
263
264
  await user_update_js_1.UserUpdate.update(this.app, userID);
265
+ await new fb_api_js_1.FbApi(this.app).register(usData, req);
264
266
  }
265
267
  async updateAccount(account, userID) {
266
268
  try {
@@ -313,7 +315,7 @@ class User {
313
315
  throw exception_1.default.BadRequestError('BAD_REQUEST', 'Login Error:' + e, null);
314
316
  }
315
317
  }
316
- async loginWithFb(token) {
318
+ async loginWithFb(token, req) {
317
319
  let config = {
318
320
  method: 'get',
319
321
  maxBodyLength: Infinity,
@@ -349,7 +351,7 @@ class User {
349
351
  },
350
352
  1,
351
353
  ]);
352
- await this.createUserHook(userID);
354
+ await this.createUserHook(userID, req);
353
355
  }
354
356
  const data = (await database_1.default.execute(`select *
355
357
  from \`${this.app}\`.t_user
@@ -369,7 +371,7 @@ class User {
369
371
  });
370
372
  return usData;
371
373
  }
372
- async loginWithLine(code, redirect) {
374
+ async loginWithLine(code, redirect, req) {
373
375
  try {
374
376
  const lineData = await this.getConfigV2({
375
377
  key: 'login_line_setting',
@@ -463,7 +465,7 @@ class User {
463
465
  },
464
466
  1,
465
467
  ]);
466
- await this.createUserHook(userID);
468
+ await this.createUserHook(userID, req);
467
469
  findList = await getUsData();
468
470
  }
469
471
  const data = findList[0];
@@ -486,7 +488,7 @@ class User {
486
488
  throw exception_1.default.BadRequestError('BAD_REQUEST', e, null);
487
489
  }
488
490
  }
489
- async loginWithGoogle(code, redirect) {
491
+ async loginWithGoogle(code, redirect, req) {
490
492
  try {
491
493
  const config = await this.getConfigV2({
492
494
  key: 'login_google_setting',
@@ -542,7 +544,7 @@ class User {
542
544
  },
543
545
  1,
544
546
  ]);
545
- await this.createUserHook(userID);
547
+ await this.createUserHook(userID, req);
546
548
  }
547
549
  const data = (await database_1.default.execute(`select *
548
550
  from \`${this.app}\`.t_user
@@ -601,7 +603,7 @@ class User {
601
603
  throw exception_1.default.BadRequestError('BAD_REQUEST', e, null);
602
604
  }
603
605
  }
604
- async loginWithApple(token) {
606
+ async loginWithApple(token, req) {
605
607
  try {
606
608
  const config = await this.getConfigV2({
607
609
  key: 'login_apple_setting',
@@ -650,7 +652,7 @@ class User {
650
652
  },
651
653
  1,
652
654
  ]);
653
- await this.createUserHook(userID);
655
+ await this.createUserHook(userID, req);
654
656
  }
655
657
  const data = (await database_1.default.execute(`select *
656
658
  from \`${this.app}\`.t_user