ts-glitter 19.2.2 → 19.2.3

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.2';
135
+ glitter.share.editerVersion = 'V_19.2.3';
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.2';
135
+ glitter.share.editerVersion = 'V_19.2.3';
136
136
  glitter.share.start = new Date();
137
137
  const vm = { appConfig: [] };
138
138
  (window as any).saasConfig = {
@@ -2765,11 +2765,19 @@ export class CheckoutIndex {
2765
2765
  }
2766
2766
  return html `
2767
2767
  <div style="height:100px;"></div>
2768
+
2768
2769
  <div
2769
2770
  class="w-100 d-flex align-items-center justify-content-center position-fixed bottom-0 start-0 p-2 shadow bg-white"
2770
- style="height:76px;z-index:10;"
2771
+ style="min-height:76px;z-index:10;"
2771
2772
  >
2772
- <div
2773
+ ${(() => {
2774
+ if (verify.length > 0) {
2775
+ return verify.map((dd) => {
2776
+ return `<div class="text-danger" style="font-size: 13px;">${dd}</div>`;
2777
+ }).join('');
2778
+ }
2779
+ else {
2780
+ return ` <div
2773
2781
  class="d-flex align-items-center justify-content-end"
2774
2782
  style="width:1180px;max-width: 100%;gap:24px;"
2775
2783
  >
@@ -2788,132 +2796,132 @@ export class CheckoutIndex {
2788
2796
  <button
2789
2797
  class="${gClass(verify.length > 0 ? 'button-bgr-disable' : 'button-bgr')}"
2790
2798
  style="${document.body.clientWidth < 800
2791
- ? `min-width:100px;`
2792
- : `min-width:380px;`}"
2799
+ ? `min-width:100px;`
2800
+ : `min-width:380px;`}"
2793
2801
  onclick="${gvc.event(() => {
2794
- var _a, _b, _c;
2795
- if (window.login_config.login_in_to_order &&
2796
- !GlobalUser.token) {
2797
- GlobalUser.loginRedirect = location.href;
2798
- gvc.glitter.href = '/login';
2799
- return;
2800
- }
2801
- if (vm.cartData.user_info_same) {
2802
- vm.cartData.user_info.name = vm.cartData.customer_info.name;
2803
- vm.cartData.user_info.phone = vm.cartData.customer_info.phone;
2804
- vm.cartData.user_info.email = vm.cartData.customer_info.email;
2805
- }
2806
- if (verify.length > 0) {
2807
- return;
2808
- }
2809
- if (shipmentList.length === 0) {
2810
- vm.cartData.user_info.shipment = 'none';
2811
- }
2812
- const dialog = new ShareDialog(gvc.glitter);
2813
- if (!this.checkFormData(gvc, vm.cartData, widget)) {
2814
- return;
2815
- }
2816
- for (const item of vm.cartData.lineItems) {
2817
- const title = (item.language_data &&
2818
- item.language_data[Language.getLanguage()].title) ||
2819
- item.title;
2820
- let min = (item.min_qty && parseInt(item.min_qty, 10)) || 1;
2821
- let max_qty = (item.max_qty && parseInt(item.max_qty, 10)) || Infinity;
2822
- let count = 0;
2823
- for (const b of vm.cartData.lineItems) {
2824
- if (b.id === item.id) {
2825
- count += b.count;
2802
+ var _a, _b, _c;
2803
+ if (window.login_config.login_in_to_order &&
2804
+ !GlobalUser.token) {
2805
+ GlobalUser.loginRedirect = location.href;
2806
+ gvc.glitter.href = '/login';
2807
+ return;
2826
2808
  }
2827
- }
2828
- if (count < min) {
2829
- dialog.errorMessage({
2830
- text: Language.text('min_p_count_d')
2831
- .replace('_c_', min)
2832
- .replace('_p_', `『${title}』`),
2833
- });
2834
- return;
2835
- }
2836
- if (count > max_qty) {
2837
- dialog.errorMessage({
2838
- text: Language.text('max_p_count_d')
2839
- .replace('_c_', max_qty)
2840
- .replace('_p_', `『${title}』`),
2841
- });
2842
- return;
2843
- }
2844
- if (max_qty > 0 && count + item.buy_history_count > max_qty) {
2845
- dialog.errorMessage({
2846
- text: Language.text('trigger_maximum_item').replace('_p_', `『${title}』`),
2847
- });
2848
- return;
2849
- }
2850
- }
2851
- [
2852
- 'MerchantTradeNo',
2853
- 'LogisticsSubType',
2854
- 'CVSStoreID',
2855
- 'CVSStoreName',
2856
- 'CVSTelephone',
2857
- 'CVSOutSide',
2858
- 'ExtraData',
2859
- 'CVSAddress',
2860
- ].map(dd => {
2861
- if (gvc.glitter.getUrlParameter(dd)) {
2862
- vm.cartData.user_info[dd] = decodeURI(glitter.getUrlParameter(dd));
2863
- }
2864
- });
2865
- dialog.dataLoading({ visible: true });
2866
- vm.cartData.user_info.note =
2867
- ((_a = vm.cartData.user_info.note) !== null && _a !== void 0 ? _a : '') + ((_b = check_out_sub.note) !== null && _b !== void 0 ? _b : '');
2868
- ApiShop.toCheckout({
2869
- line_items: vm.cartData.lineItems.map((dd) => {
2870
- return {
2871
- id: dd.id,
2872
- spec: dd.spec,
2873
- count: dd.count,
2874
- };
2875
- }),
2876
- customer_info: vm.cartData.customer_info,
2877
- return_url: (() => {
2878
- const originalUrl = glitter.root_path + 'order_detail' + location.search;
2879
- const urlObject = new URL(originalUrl);
2880
- urlObject.searchParams.set('EndCheckout', '1');
2881
- const newUrl = urlObject.toString();
2882
- return newUrl;
2883
- })(),
2884
- user_info: vm.cartData.user_info,
2885
- code: apiCart.cart.code,
2886
- use_rebate: apiCart.cart.use_rebate,
2887
- custom_form_format: vm.cartData.custom_form_format,
2888
- custom_form_data: vm.cartData.custom_form_data,
2889
- custom_receipt_form: vm.cartData.receipt_form,
2890
- distribution_code: (_c = localStorage.getItem('distributionCode')) !== null && _c !== void 0 ? _c : '',
2891
- give_away: apiCart.cart.give_away,
2892
- }).then(res => {
2893
- var _a, _b, _c;
2894
- dialog.dataLoading({ visible: false });
2895
- if (vm.cartData.customer_info.payment_select == 'paynow') {
2896
- if (!((_c = (_b = (_a = res.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.secret)) {
2897
- return 'paynow API失敗';
2809
+ if (vm.cartData.user_info_same) {
2810
+ vm.cartData.user_info.name = vm.cartData.customer_info.name;
2811
+ vm.cartData.user_info.phone = vm.cartData.customer_info.phone;
2812
+ vm.cartData.user_info.email = vm.cartData.customer_info.email;
2813
+ }
2814
+ if (verify.length > 0) {
2815
+ return;
2816
+ }
2817
+ if (shipmentList.length === 0) {
2818
+ vm.cartData.user_info.shipment = 'none';
2819
+ }
2820
+ const dialog = new ShareDialog(gvc.glitter);
2821
+ if (!this.checkFormData(gvc, vm.cartData, widget)) {
2822
+ return;
2898
2823
  }
2899
- glitter.innerDialog((gvc) => {
2900
- document.body.style.setProperty('overflow-y', 'hidden', 'important');
2901
- return gvc.bindView({
2902
- bind: `paynow`,
2903
- view: () => {
2904
- return html ` <div
2824
+ for (const item of vm.cartData.lineItems) {
2825
+ const title = (item.language_data &&
2826
+ item.language_data[Language.getLanguage()].title) ||
2827
+ item.title;
2828
+ let min = (item.min_qty && parseInt(item.min_qty, 10)) || 1;
2829
+ let max_qty = (item.max_qty && parseInt(item.max_qty, 10)) || Infinity;
2830
+ let count = 0;
2831
+ for (const b of vm.cartData.lineItems) {
2832
+ if (b.id === item.id) {
2833
+ count += b.count;
2834
+ }
2835
+ }
2836
+ if (count < min) {
2837
+ dialog.errorMessage({
2838
+ text: Language.text('min_p_count_d')
2839
+ .replace('_c_', min)
2840
+ .replace('_p_', `『${title}』`),
2841
+ });
2842
+ return;
2843
+ }
2844
+ if (count > max_qty) {
2845
+ dialog.errorMessage({
2846
+ text: Language.text('max_p_count_d')
2847
+ .replace('_c_', max_qty)
2848
+ .replace('_p_', `『${title}』`),
2849
+ });
2850
+ return;
2851
+ }
2852
+ if (max_qty > 0 && count + item.buy_history_count > max_qty) {
2853
+ dialog.errorMessage({
2854
+ text: Language.text('trigger_maximum_item').replace('_p_', `『${title}』`),
2855
+ });
2856
+ return;
2857
+ }
2858
+ }
2859
+ [
2860
+ 'MerchantTradeNo',
2861
+ 'LogisticsSubType',
2862
+ 'CVSStoreID',
2863
+ 'CVSStoreName',
2864
+ 'CVSTelephone',
2865
+ 'CVSOutSide',
2866
+ 'ExtraData',
2867
+ 'CVSAddress',
2868
+ ].map(dd => {
2869
+ if (gvc.glitter.getUrlParameter(dd)) {
2870
+ vm.cartData.user_info[dd] = decodeURI(glitter.getUrlParameter(dd));
2871
+ }
2872
+ });
2873
+ dialog.dataLoading({ visible: true });
2874
+ vm.cartData.user_info.note =
2875
+ ((_a = vm.cartData.user_info.note) !== null && _a !== void 0 ? _a : '') + ((_b = check_out_sub.note) !== null && _b !== void 0 ? _b : '');
2876
+ ApiShop.toCheckout({
2877
+ line_items: vm.cartData.lineItems.map((dd) => {
2878
+ return {
2879
+ id: dd.id,
2880
+ spec: dd.spec,
2881
+ count: dd.count,
2882
+ };
2883
+ }),
2884
+ customer_info: vm.cartData.customer_info,
2885
+ return_url: (() => {
2886
+ const originalUrl = glitter.root_path + 'order_detail' + location.search;
2887
+ const urlObject = new URL(originalUrl);
2888
+ urlObject.searchParams.set('EndCheckout', '1');
2889
+ const newUrl = urlObject.toString();
2890
+ return newUrl;
2891
+ })(),
2892
+ user_info: vm.cartData.user_info,
2893
+ code: apiCart.cart.code,
2894
+ use_rebate: apiCart.cart.use_rebate,
2895
+ custom_form_format: vm.cartData.custom_form_format,
2896
+ custom_form_data: vm.cartData.custom_form_data,
2897
+ custom_receipt_form: vm.cartData.receipt_form,
2898
+ distribution_code: (_c = localStorage.getItem('distributionCode')) !== null && _c !== void 0 ? _c : '',
2899
+ give_away: apiCart.cart.give_away,
2900
+ }).then(res => {
2901
+ var _a, _b, _c;
2902
+ dialog.dataLoading({ visible: false });
2903
+ if (vm.cartData.customer_info.payment_select == 'paynow') {
2904
+ if (!((_c = (_b = (_a = res.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.secret)) {
2905
+ return 'paynow API失敗';
2906
+ }
2907
+ glitter.innerDialog((gvc) => {
2908
+ document.body.style.setProperty('overflow-y', 'hidden', 'important');
2909
+ return gvc.bindView({
2910
+ bind: `paynow`,
2911
+ view: () => {
2912
+ return html ` <div
2905
2913
  class="w-100 h-100 d-flex align-items-center justify-content-center"
2906
2914
  >
2907
2915
  ${document.body.clientWidth < 800
2908
- ? `
2916
+ ? `
2909
2917
  <div class="pt-5 bg-white position-relative vw-100" style="height: ${window.innerHeight}px;overflow-y: auto;">
2910
2918
  `
2911
- : `<div class="p-3 bg-white position-relative" style="max-height: calc(100vh - 90px);overflow-y:auto;">`}
2919
+ : `<div class="p-3 bg-white position-relative" style="max-height: calc(100vh - 90px);overflow-y:auto;">`}
2912
2920
  <div
2913
2921
  style="position: absolute; right: 15px;top:15px;z-index:1;"
2914
2922
  onclick="${gvc.event(() => {
2915
- gvc.closeDialog();
2916
- })}"
2923
+ gvc.closeDialog();
2924
+ })}"
2917
2925
  >
2918
2926
  <i
2919
2927
  class="fa-regular fa-circle-xmark fs-5 text-dark cursor_pointer"
@@ -2925,100 +2933,105 @@ export class CheckoutIndex {
2925
2933
  <div class="px-3 px-sm-0 w-100">
2926
2934
  <button
2927
2935
  class="${gClass(verify.length > 0
2928
- ? 'button-bgr-disable'
2929
- : 'button-bgr')} "
2936
+ ? 'button-bgr-disable'
2937
+ : 'button-bgr')} "
2930
2938
  id="checkoutButton"
2931
2939
  onclick="${gvc.event(() => {
2932
- const PayNow = window.PayNow;
2933
- const dialog = new ShareDialog(gvc.glitter);
2934
- dialog.dataLoading({ visible: true });
2935
- PayNow.checkout().then((response) => {
2936
- dialog.dataLoading({ visible: false });
2937
- console.log('response -- ', response);
2938
- if (response.error) {
2939
- dialog.errorMessage({
2940
- text: response.error.message,
2940
+ const PayNow = window.PayNow;
2941
+ const dialog = new ShareDialog(gvc.glitter);
2942
+ dialog.dataLoading({ visible: true });
2943
+ PayNow.checkout().then((response) => {
2944
+ dialog.dataLoading({ visible: false });
2945
+ console.log('response -- ', response);
2946
+ if (response.error) {
2947
+ dialog.errorMessage({
2948
+ text: response.error.message,
2949
+ });
2950
+ }
2941
2951
  });
2942
- }
2943
- });
2944
- })}"
2952
+ })}"
2945
2953
  >
2946
2954
  <span class="${gClass('button-text')}">確認結帳</span>
2947
2955
  </button>
2948
2956
  </div>
2949
2957
  </div>`;
2950
- },
2951
- divCreate: {
2952
- class: ` h-100 d-flex align-items-center justify-content-center`,
2953
- style: `max-width:100vw;${document.body.clientWidth < 800 ? 'width:100%;' : 'width:400px;'};`,
2954
- },
2955
- onCreate: () => {
2956
- const publicKey = res.response.publicKey;
2957
- const secret = res.response.data.result.secret;
2958
- const env = res.response.BETA == 'true' ? 'sandbox' : 'production';
2959
- const PayNow = window.PayNow;
2960
- PayNow.createPayment({
2961
- publicKey: publicKey,
2962
- secret: secret,
2963
- env: env,
2964
- });
2965
- PayNow.mount('#paynow-container', {
2966
- locale: 'zh_tw',
2967
- appearance: {
2968
- variables: {
2969
- fontFamily: 'monospace',
2970
- colorPrimary: '#0078ab',
2971
- colorDefault: '#0a0a0a',
2972
- colorBorder: '#cccccc',
2973
- colorPlaceholder: '#eeeeee',
2974
- borderRadius: '.3rem',
2975
- colorDanger: '#ff3d3d',
2976
- },
2958
+ },
2959
+ divCreate: {
2960
+ class: ` h-100 d-flex align-items-center justify-content-center`,
2961
+ style: `max-width:100vw;${document.body.clientWidth < 800 ? 'width:100%;' : 'width:400px;'};`,
2962
+ },
2963
+ onCreate: () => {
2964
+ const publicKey = res.response.publicKey;
2965
+ const secret = res.response.data.result.secret;
2966
+ const env = res.response.BETA == 'true' ? 'sandbox' : 'production';
2967
+ const PayNow = window.PayNow;
2968
+ PayNow.createPayment({
2969
+ publicKey: publicKey,
2970
+ secret: secret,
2971
+ env: env,
2972
+ });
2973
+ PayNow.mount('#paynow-container', {
2974
+ locale: 'zh_tw',
2975
+ appearance: {
2976
+ variables: {
2977
+ fontFamily: 'monospace',
2978
+ colorPrimary: '#0078ab',
2979
+ colorDefault: '#0a0a0a',
2980
+ colorBorder: '#cccccc',
2981
+ colorPlaceholder: '#eeeeee',
2982
+ borderRadius: '.3rem',
2983
+ colorDanger: '#ff3d3d',
2984
+ },
2985
+ },
2986
+ });
2977
2987
  },
2978
2988
  });
2979
- },
2980
- });
2981
- }, `paynow`, {
2982
- animation: document.body.clientWidth > 800
2983
- ? Animation.fade
2984
- : Animation.popup,
2985
- dismiss: () => {
2986
- document.body.style.setProperty('overflow-y', 'auto');
2987
- },
2988
- });
2989
- }
2990
- localStorage.setItem('clear_cart_items', JSON.stringify(vm.cartData.lineItems.map((item) => item.id)));
2991
- if (res.response.off_line || res.response.is_free) {
2992
- location.href = res.response.return_url;
2993
- }
2994
- else {
2995
- if (res.response.returnCode == '0000' &&
2996
- vm.cartData.customer_info.payment_select == 'line_pay') {
2997
- console.log('res.response.form.info.paymentUrl.web -- ', res.response.info.paymentUrl.web);
2998
- location.href = res.response.info.paymentUrl.web;
2999
- }
3000
- else if (res.response.approveLink) {
3001
- location.href = res.response.approveLink;
3002
- }
3003
- else {
3004
- const id = gvc.glitter.getUUID();
3005
- $('body').append(html ` <div id="${id}" style="display: none;">
2989
+ }, `paynow`, {
2990
+ animation: document.body.clientWidth > 800
2991
+ ? Animation.fade
2992
+ : Animation.popup,
2993
+ dismiss: () => {
2994
+ document.body.style.setProperty('overflow-y', 'auto');
2995
+ },
2996
+ });
2997
+ }
2998
+ localStorage.setItem('clear_cart_items', JSON.stringify(vm.cartData.lineItems.map((item) => item.id)));
2999
+ if (res.response.off_line || res.response.is_free) {
3000
+ location.href = res.response.return_url;
3001
+ }
3002
+ else {
3003
+ if (res.response.returnCode == '0000' &&
3004
+ vm.cartData.customer_info.payment_select == 'line_pay') {
3005
+ console.log('res.response.form.info.paymentUrl.web -- ', res.response.info.paymentUrl.web);
3006
+ location.href = res.response.info.paymentUrl.web;
3007
+ }
3008
+ else if (res.response.approveLink) {
3009
+ location.href = res.response.approveLink;
3010
+ }
3011
+ else {
3012
+ const id = gvc.glitter.getUUID();
3013
+ $('body').append(html ` <div id="${id}" style="display: none;">
3006
3014
  ${res.response.form}
3007
3015
  </div>`);
3008
- document.querySelector(`#${id} #submit`).click();
3009
- }
3010
- }
3011
- });
3012
- })}"
3016
+ document.querySelector(`#${id} #submit`).click();
3017
+ }
3018
+ }
3019
+ });
3020
+ })}"
3013
3021
  >
3014
- <span class="${gClass('button-text')}"
3015
- >${window.login_config.login_in_to_order && !GlobalUser.token
3016
- ? Language.text('login_in_to_checkout')
3017
- : Language.text('next')}</span
3018
- >
3022
+ <span class="${gClass('button-text')} "
3023
+ style="${(verify.length > 0) ? `font-size:13px;` : ``}"
3024
+ >
3025
+ ${verify.length > 0 ? verify.join('<br/>') : (window.login_config.login_in_to_order && !GlobalUser.token
3026
+ ? Language.text('login_in_to_checkout')
3027
+ : Language.text('next'))}
3028
+ </span >
3019
3029
  </button>
3020
3030
  </div>
3021
- </div>
3031
+ </div>`;
3032
+ }
3033
+ })()}
3034
+
3022
3035
  </div>
3023
3036
  `;
3024
3037
  })()}