ts-glitter 19.2.7 → 19.2.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.
package/lowcode/Entry.js CHANGED
@@ -132,7 +132,7 @@ export class Entry {
132
132
  }
133
133
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
134
134
  console.log(`Entry-time:`, window.renderClock.stop());
135
- glitter.share.editerVersion = 'V_19.2.7';
135
+ glitter.share.editerVersion = 'V_19.2.9';
136
136
  glitter.share.start = new Date();
137
137
  const vm = { appConfig: [] };
138
138
  window.saasConfig = {
package/lowcode/Entry.ts CHANGED
@@ -132,7 +132,7 @@ export class Entry {
132
132
  }
133
133
  (window as any).renderClock = (window as any).renderClock ?? createClock();
134
134
  console.log(`Entry-time:`, (window as any).renderClock.stop());
135
- glitter.share.editerVersion = 'V_19.2.7';
135
+ glitter.share.editerVersion = 'V_19.2.9';
136
136
  glitter.share.start = new Date();
137
137
  const vm = { appConfig: [] };
138
138
  (window as any).saasConfig = {
@@ -225,6 +225,9 @@ height: 51px;
225
225
  }, 150);
226
226
  }
227
227
  };
228
+ glitter.share._scanBack = (text) => {
229
+ POSSetting.scannerCallback(gvc, text);
230
+ };
228
231
  function getTimeState(startDate, endDate) {
229
232
  const now = new Date();
230
233
  const start = new Date(`${startDate}T00:00:00`);
@@ -388,6 +391,7 @@ height: 51px;
388
391
  else {
389
392
  dialog.dataLoading({ visible: false });
390
393
  OrderDetail.singleInstance.user_info.email = user.response.userData.email;
394
+ OrderDetail.singleInstance.user_info.phone = user.response.userData.phone;
391
395
  gvc.notifyDataChange(['checkout-page']);
392
396
  }
393
397
  }
@@ -262,6 +262,9 @@ height: 51px;
262
262
  }, 150);
263
263
  }
264
264
  };
265
+ glitter.share._scanBack = (text:string)=>{
266
+ POSSetting.scannerCallback(gvc,text)
267
+ };
265
268
  function getTimeState(startDate: string, endDate: string): 'beforeStart' | 'inRange' | 'afterEnd' {
266
269
  const now = new Date();
267
270
  const start = new Date(`${startDate}T00:00:00`);
@@ -428,6 +431,7 @@ height: 51px;
428
431
  } else {
429
432
  dialog.dataLoading({ visible: false });
430
433
  OrderDetail.singleInstance.user_info.email = user.response.userData.email;
434
+ OrderDetail.singleInstance.user_info.phone = user.response.userData.phone;
431
435
  gvc.notifyDataChange(['checkout-page']);
432
436
  }
433
437
  }
@@ -403,6 +403,7 @@ export class PaymentPage {
403
403
  }
404
404
  else {
405
405
  OrderDetail.singleInstance.user_info.email = user.response.userData.email;
406
+ OrderDetail.singleInstance.user_info.phone = user.response.userData.phone;
406
407
  gvc.notifyDataChange(['checkout-page']);
407
408
  }
408
409
  }));
@@ -1630,6 +1631,7 @@ export class PaymentPage {
1630
1631
  }
1631
1632
  else {
1632
1633
  orderDetail.user_info.email = user.response.account;
1634
+ orderDetail.user_info.phone = user.response.userData.phone;
1633
1635
  reload();
1634
1636
  gvc.closeDialog();
1635
1637
  }
@@ -428,13 +428,16 @@ export class PaymentPage {
428
428
  class=""
429
429
  style="display: flex; width: 44px; height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid #DDD; justify-content: center; align-items: center; gap: 8px; flex-shrink: 0;"
430
430
  onclick="${gvc.event(() => {
431
- gvc.glitter.runJsInterFace('start_scan', {}, async (res) => {
431
+ gvc.glitter.runJsInterFace('start_scan', {
432
+
433
+ }, async (res) => {
432
434
  const dialog = new ShareDialog(gvc.glitter);
433
435
  const user = await ApiUser.getUsersData(res.text.replace('user-', ''));
434
436
  if (!user.response || !user.response.account) {
435
437
  dialog.errorMessage({ text: '查無此會員' });
436
438
  } else {
437
439
  OrderDetail.singleInstance.user_info.email = user.response.userData.email;
440
+ OrderDetail.singleInstance.user_info.phone = user.response.userData.phone;
438
441
  gvc.notifyDataChange(['checkout-page']);
439
442
  }
440
443
  });
@@ -1728,6 +1731,7 @@ export class PaymentPage {
1728
1731
  dialog.errorMessage({ text: '查無此會員' });
1729
1732
  } else {
1730
1733
  orderDetail.user_info.email = user.response.account;
1734
+ orderDetail.user_info.phone = user.response.userData.phone;
1731
1735
  reload();
1732
1736
  gvc.closeDialog();
1733
1737
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-glitter",
3
- "version": "19.2.7",
3
+ "version": "19.2.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -527,6 +527,9 @@ class Shopping {
527
527
  price && priceList.push(price);
528
528
  };
529
529
  const processProduct = async (product) => {
530
+ if (!product || !product.content) {
531
+ return;
532
+ }
530
533
  const createPriceMap = (type) => {
531
534
  return Object.fromEntries(product.content.multi_sale_price
532
535
  .filter((item) => item.type === type)
@@ -644,9 +647,15 @@ class Shopping {
644
647
  }
645
648
  };
646
649
  if (Array.isArray(products.data)) {
650
+ products.data = products.data.filter((dd) => {
651
+ return dd && dd.content;
652
+ });
647
653
  await Promise.all(products.data.map(processProduct));
648
654
  }
649
655
  else {
656
+ if ((products.data) && !products.data.content) {
657
+ products.data = undefined;
658
+ }
650
659
  await processProduct(products.data);
651
660
  }
652
661
  return products;
@@ -693,6 +702,9 @@ class Shopping {
693
702
  return recommendData;
694
703
  }
695
704
  async aboutProductVoucher(json) {
705
+ if (!json.product.content) {
706
+ return [];
707
+ }
696
708
  const id = `${json.product.id}`;
697
709
  const collection = json.product.content.collection || [];
698
710
  const userData = json.userData;
@@ -2048,7 +2060,13 @@ class Shopping {
2048
2060
  await line.sendCustomerLine('auto-line-order-create', carData.orderID, carData.customer_info.lineID);
2049
2061
  console.log('訂單line訊息寄送成功');
2050
2062
  }
2051
- auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, 'auto-email-order-create', carData.orderID, carData.email, carData.language);
2063
+ for (const email of new Set([carData.customer_info, carData.user_info].map((dd) => {
2064
+ return dd && dd.email;
2065
+ }))) {
2066
+ if (email) {
2067
+ auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, 'auto-email-order-create', carData.orderID, email, carData.language);
2068
+ }
2069
+ }
2052
2070
  await this.releaseVoucherHistory(carData.orderID, 1);
2053
2071
  checkPoint('default release checkout');
2054
2072
  return {
@@ -2630,7 +2648,13 @@ class Shopping {
2630
2648
  const prevProgress = origin.orderData.progress;
2631
2649
  if (prevStatus !== '-1' && orderData.orderStatus === '-1') {
2632
2650
  await this.resetStore(origin.orderData.lineItems);
2633
- await auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, 'auto-email-order-cancel-success', orderData.orderID, orderData.email, orderData.language);
2651
+ for (const email of new Set([origin.orderData.customer_info, origin.orderData.user_info].map((dd) => {
2652
+ return dd && dd.email;
2653
+ }))) {
2654
+ if (email) {
2655
+ await auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, 'auto-email-order-cancel-success', orderData.orderID, email, orderData.language);
2656
+ }
2657
+ }
2634
2658
  }
2635
2659
  else if (prevStatus === '-1' && orderData.orderStatus !== '-1') {
2636
2660
  await this.resetStore(origin.orderData.lineItems, 'minus');
@@ -2799,9 +2823,11 @@ class Shopping {
2799
2823
  const line = new line_message_1.LineMessage(this.app);
2800
2824
  messages.push(line.sendCustomerLine(`auto-line-${typeMap[type]}`, orderData.orderID, lineID));
2801
2825
  }
2802
- for (const data of [orderData.customer_info, orderData.user_info]) {
2803
- if (data.email) {
2804
- messages.push(auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, `auto-email-${typeMap[type]}`, orderData.orderID, data.email, orderData.language));
2826
+ for (const email of new Set([orderData.customer_info, orderData.user_info].map((dd) => {
2827
+ return dd && dd.email;
2828
+ }))) {
2829
+ if (email) {
2830
+ messages.push(auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, `auto-email-${typeMap[type]}`, orderData.orderID, email, orderData.language));
2805
2831
  }
2806
2832
  }
2807
2833
  for (const data of [orderData.customer_info, orderData.user_info]) {
@@ -2892,7 +2918,13 @@ class Shopping {
2892
2918
  where cart_token = ?`, [order_id]))[0]['orderData'];
2893
2919
  orderData.proof_purchase = text;
2894
2920
  new notify_js_1.ManagerNotify(this.app).uploadProof({ orderData: orderData });
2895
- await auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, 'proof-purchase', order_id, orderData.email, orderData.language);
2921
+ for (const email of new Set([orderData.customer_info, orderData.user_info].map((dd) => {
2922
+ return dd && dd.email;
2923
+ }))) {
2924
+ if (email) {
2925
+ await auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, 'proof-purchase', order_id, email, orderData.language);
2926
+ }
2927
+ }
2896
2928
  if (orderData.customer_info.phone) {
2897
2929
  let sns = new sms_js_1.SMS(this.app);
2898
2930
  await sns.sendCustomerSns('sns-proof-purchase', order_id, orderData.customer_info.phone);
@@ -3282,7 +3314,13 @@ class Shopping {
3282
3314
  orderData: cartData.orderData,
3283
3315
  status: status,
3284
3316
  });
3285
- await auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, 'auto-email-payment-successful', order_id, cartData.email, cartData.orderData.language);
3317
+ for (const email of new Set([cartData.orderData.customer_info, cartData.orderData.user_info].map((dd) => {
3318
+ return dd && dd.email;
3319
+ }))) {
3320
+ if (email) {
3321
+ await auto_send_email_js_1.AutoSendEmail.customerOrder(this.app, 'auto-email-payment-successful', order_id, email, cartData.orderData.language);
3322
+ }
3323
+ }
3286
3324
  if (cartData.orderData.customer_info.phone) {
3287
3325
  let sns = new sms_js_1.SMS(this.app);
3288
3326
  await sns.sendCustomerSns('auto-sns-payment-successful', order_id, cartData.orderData.customer_info.phone);