@lancom/shared 0.0.420 → 0.0.422

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.
@@ -190,6 +190,7 @@ export default {
190
190
  country: this.country?._id
191
191
  });
192
192
  } catch (e) {
193
+ console.log('initOrderData: ', e);
193
194
  } finally {
194
195
  this.initing = false;
195
196
  }
@@ -10,6 +10,15 @@
10
10
  background-color: #F4F4F4;
11
11
  }
12
12
  }
13
+ &__error {
14
+ font-weight: bold;
15
+ font-size: 14px;
16
+ padding: 18px 10px;
17
+ text-align: center;
18
+ color: $white;
19
+ background: #EA3434;
20
+ margin-top: 20px;
21
+ }
13
22
  &__field-container {
14
23
  width: 100%;
15
24
  }
@@ -50,4 +59,4 @@
50
59
  }
51
60
  }
52
61
  }
53
- }
62
+ }
@@ -1,6 +1,11 @@
1
1
  <template>
2
2
  <div class="Payment__wrapper">
3
- <div v-if="(hasSpinner && processing) || loading">
3
+ <div
4
+ v-if="pinpaymentsError"
5
+ class="Payment__error">
6
+ {{ pinpaymentsError }}
7
+ </div>
8
+ <div v-else-if="(hasSpinner && processing) || loading">
4
9
  <spinner />
5
10
  </div>
6
11
  <div
@@ -86,7 +91,6 @@
86
91
  </template>
87
92
 
88
93
  <script>
89
- let timer = null;
90
94
  let pinpaymentStartLoaded = false;
91
95
 
92
96
  export default {
@@ -108,26 +112,20 @@ export default {
108
112
  return {
109
113
  processing: false,
110
114
  loading: false,
115
+ waitPinpaymentTimer: null,
116
+ pinpaymentsError: null,
111
117
  fields: null
112
118
  };
113
119
  },
114
120
  async mounted() {
115
121
  this.loading = true;
116
-
117
122
  await this.loadPinpayments();
118
-
119
123
  if (window.HostedFields) {
120
124
  await this.initHostedPayment();
121
- } else {
122
- window.addEventListener('load', async () => {
123
- if (!this.fields) {
124
- await this.initHostedPayment();
125
- }
126
- });
127
125
  }
128
126
  },
129
127
  destroyed() {
130
- clearInterval(timer);
128
+ clearInterval(this.waitPinpaymentTimer);
131
129
  },
132
130
  methods: {
133
131
  initHostedPayment() {
@@ -207,30 +205,56 @@ export default {
207
205
  },
208
206
  async loadPinpayments() {
209
207
  if (process.browser) {
210
- await (new Promise((resolve, reject) => {
211
- if (!pinpaymentStartLoaded) {
212
- pinpaymentStartLoaded = true;
213
- let domElement = document.createElement('script');
214
- domElement.type = "text/javascript";
215
- domElement.setAttribute('src', 'https://cdn.pinpayments.com/pin.hosted_fields.v1.js');
216
- domElement.onload = () => {
217
- resolve();
218
- };
219
- domElement.onerror = () => {
220
- setTimeout(() => this.loadPinpayments(), 1000);
221
- };
222
- document.body.appendChild(domElement);
223
- } else {
224
- let repeated = 0;
225
- timer = setInterval(() => {
226
- if (!!window.HostedFields || repeated++ > 40) {
227
- clearInterval(timer);
228
- resolve();
229
- }
230
- }, 500);
208
+ if (pinpaymentStartLoaded) {
209
+ await this.waitUntilLoadedPinpayment();
210
+ }
211
+ if (!window.HostedField) {
212
+ pinpaymentStartLoaded = true;
213
+ for (let index = 0; index < 10; index++) {
214
+ try {
215
+ await this.loadPinpaymentsJs();
216
+ break;
217
+ } catch (e) {
218
+ console.log('loadPinpayments:error ', e);
219
+ await new Promise(resolve => setTimeout(resolve, 500));
220
+ }
231
221
  }
232
- }));
222
+ }
223
+ if (!window.HostedFields) {
224
+ this.pinpaymentsError = '"Credit Card" payment temporarily not available';
225
+ }
233
226
  }
227
+ },
228
+ waitUntilLoadedPinpayment() {
229
+ return new Promise((resolve, reject) => {
230
+ let repeated = 0;
231
+ this.waitPinpaymentTimer = setInterval(() => {
232
+ if (!!window.HostedFields || repeated++ > 10) {
233
+ clearInterval(this.waitPinpaymentTimer);
234
+ resolve();
235
+ }
236
+ }, 500);
237
+ });
238
+ },
239
+ loadPinpaymentsJs() {
240
+ return (new Promise((resolve, reject) => {
241
+ const domElement = document.createElement('script');
242
+ domElement.type = 'text/javascript';
243
+ domElement.setAttribute('src', 'https://cdn.pinpayments.com/pin.hosted_fields.v1.js');
244
+ domElement.onload = () => {
245
+ setTimeout(() => {
246
+ if (window.HostedFields) {
247
+ resolve();
248
+ } else {
249
+ reject(new Error('Failed to Load JS'));
250
+ }
251
+ }, 500);
252
+ };
253
+ domElement.onerror = () => {
254
+ reject(new Error('Failed to Load JS'));
255
+ };
256
+ document.body.appendChild(domElement);
257
+ }));
234
258
  }
235
259
  }
236
260
  };
@@ -20,6 +20,7 @@
20
20
  <btn
21
21
  btn-class="green"
22
22
  btn-label="NEXT"
23
+ :btn-disabled="!hasSelectedPrintUnderbases"
23
24
  @onclick="$emit('next')">
24
25
  <i
25
26
  slot="icon-after"
@@ -39,7 +40,10 @@ export default {
39
40
  WizardPrintAreaPrintUnderbase
40
41
  },
41
42
  computed: {
42
- ...mapGetters('product', ['editablePrintAreas'])
43
+ ...mapGetters('product', ['editablePrintAreas', 'selectedPrintUnderbases']),
44
+ hasSelectedPrintUnderbases() {
45
+ return this.editablePrintAreas.every(e => typeof this.selectedPrintUnderbases[e._id] === 'boolean');
46
+ }
43
47
  }
44
48
  };
45
49
  </script>
@@ -7,10 +7,23 @@
7
7
  padding: 30px;
8
8
  margin-bottom: 50px;
9
9
  }
10
+ &__info {
11
+ display: flex;
12
+ justify-content: space-between;
13
+ margin-bottom: 10px;
14
+ }
10
15
  &__logo {
11
16
  margin-bottom: 20px;
12
17
  }
18
+ &__table {
19
+ margin-top: 20px;
20
+ margin-bottom: 10px;
21
+ td {
22
+ width: 50%;
23
+ padding: 20px;
24
+ }
25
+ }
13
26
  }
14
27
  .uppercase {
15
28
  text-transform: uppercase;
16
- }
29
+ }
@@ -5,46 +5,78 @@
5
5
  class="QuoteView__logo">
6
6
  <img :src="quote.shop.logo.small" />
7
7
  </div>
8
- <div class="d-flex justify-content-between align-items-center">
8
+ <div class="QuoteView__info">
9
9
  <div>
10
- <h2> {{ quote.shop.name }} </h2>
11
- <h4 v-if="shopContacts"> ABN: {{ shopContacts.abn }} </h4>
10
+ <h2 class="lc_h2"> {{ quote.shop.name }} </h2>
11
+ <h4 v-if="shopContacts" class="lc_h4"> ABN: {{ shopContacts.abn }} </h4>
12
12
  </div>
13
- <h1 class="text-secondary">
13
+ <h1 class="text-secondary lc_h1">
14
14
  QUOTE
15
15
  </h1>
16
16
  </div>
17
- <div class="d-flex justify-content-between align-items-center">
17
+ <div class="QuoteView__info">
18
18
  <div v-if="shopContacts">
19
- <div>{{ shopContacts.company }}</div>
20
- <div>{{ shopContacts.address }}</div>
21
- <div>{{ shopContacts.phone }}</div>
19
+ <div class="lc_regular16">
20
+ {{ shopContacts.company }}
21
+ </div>
22
+ <div class="lc_regular16">
23
+ {{ shopContacts.address }}
24
+ </div>
25
+ <div class="lc_regular16">
26
+ {{ shopContacts.phone }}
27
+ </div>
22
28
  </div>
23
29
  <div>
24
- <div>DATE: {{ quote.createdAt | shortDate }}</div>
25
- <div>QUOTE ID: {{ quoteId }}</div>
30
+ <div class="lc_regular16">
31
+ DATE: {{ quote.createdAt | shortDate }}
32
+ </div>
33
+ <div class="lc_regular16">
34
+ QUOTE ID: {{ quoteId }}
35
+ </div>
26
36
  </div>
27
37
  </div>
28
38
 
29
- <table class="mt-4 table table-bordered">
39
+ <table class="QuoteView__table mt-4 lc_table bordered">
30
40
  <tr>
31
41
  <td>
32
42
  <div><b>QUOTE</b></div>
33
43
  <div v-if="quote.address">
34
- <div>{{ quote.address.fullName }}</div>
35
- <div v-if="quote.address.company">{{ quote.address.company }}</div>
36
- <div v-if="quote.address.phone">{{ quote.address.phone }}</div>
37
- <div>{{ quote.address.email }}</div>
38
- <div>{{ quoteAddress }}</div>
39
- <div>{{ quote.address.additionalInfo }}</div>
44
+ <div class="lc_regular16">
45
+ {{ quote.address.fullName }}
46
+ </div>
47
+ <div v-if="quote.address.company" class="lc_regular16">
48
+ {{ quote.address.company }}
49
+ </div>
50
+ <div v-if="quote.address.phone" class="lc_regular16">
51
+ {{ quote.address.phone }}
52
+ </div>
53
+ <div class="lc_regular16">
54
+ {{ quote.address.email }}
55
+ </div>
56
+ <div class="lc_regular16">
57
+ {{ quoteAddress }}
58
+ </div>
59
+ <div class="lc_regular16">
60
+ {{ quote.address.additionalInfo }}
61
+ </div>
40
62
  </div>
41
63
  </td>
42
64
  <td class="w-50">
43
- <div><b>{{ MESSAGES.DIRECT_DEPOSIT_DETAILS || 'DIRECT DEPOSIT DETAILS'}}</b></div>
44
- <div>Bank: {{ depositInfo.bank }}</div>
45
- <div>Account name: {{ depositInfo.accountName }}</div>
46
- <div>{{ bsbLabel }}: {{ depositInfo.BSB }}</div>
47
- <div>Account: {{ depositInfo.account }}</div>
65
+ <div class="lc_regular16">
66
+ <b>{{ MESSAGES.DIRECT_DEPOSIT_DETAILS || 'DIRECT DEPOSIT DETAILS' }}</b>
67
+ </div>
68
+ <div class="lc_regular16">
69
+ Bank: {{ depositInfo.bank }}
70
+ </div>
71
+ <div class="lc_regular16">
72
+ Account name: {{ depositInfo.accountName }}
73
+ </div>
74
+ <div class="lc_regular16">
75
+ {{ bsbLabel }}: {{ depositInfo.BSB }}
76
+ </div>
77
+ <div class="lc_regular16">
78
+ Account: {{ depositInfo.account }}
79
+ </div>
48
80
  </td>
49
81
  </tr>
50
82
  </table>
@@ -58,7 +90,7 @@
58
90
  </div>
59
91
  <h6
60
92
  v-if="quote.expiredAt"
61
- class="mt-3">
93
+ class="mt-3 lc_title mb-5 lc_h3">
62
94
  THIS QUOTE IS VALID UNTIL {{ quote.expiredAt | shortDate }}
63
95
  </h6>
64
96
  </div>
@@ -8,12 +8,24 @@
8
8
  class="QuoteOptionView__product" />
9
9
  </div>
10
10
  <div class="QuoteOptionView__totals">
11
- <div>Products Total: <b>{{ option.productsTotal | price(currency) }}</b></div>
12
- <div>Prints Total: <b>{{ option.printsTotal | price(currency) }}</b></div>
13
- <div>Shipping Total: <b>{{ option.shippingTotal | price(currency) }}</b></div>
14
- <div>Total ex {{ taxName }}: <b>{{ option.total | price(currency) }}</b></div>
15
- <div>{{ taxName }}: <b>{{ optionGst(option) | price(currency) }}</b></div>
16
- <div>Total inc {{ taxName }}: <b>{{ option.total | tax(gstTax) | price(currency) }}</b></div>
11
+ <div class="lc_regular16">
12
+ Products Total: <b>{{ option.productsTotal | price(currency) }}</b>
13
+ </div>
14
+ <div class="lc_regular16">
15
+ Prints Total: <b>{{ option.printsTotal | price(currency) }}</b>
16
+ </div>
17
+ <div class="lc_regular16">
18
+ Shipping Total: <b>{{ option.shippingTotal | price(currency) }}</b>
19
+ </div>
20
+ <div class="lc_regular16">
21
+ Total ex {{ taxName }}: <b>{{ option.total | price(currency) }}</b>
22
+ </div>
23
+ <div class="lc_regular16">
24
+ {{ taxName }}: <b>{{ optionGst(option) | price(currency) }}</b>
25
+ </div>
26
+ <div class="lc_regular16">
27
+ Total inc {{ taxName }}: <b>{{ option.total | tax(gstTax) | price(currency) }}</b>
28
+ </div>
17
29
  </div>
18
30
  </div>
19
31
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.420",
3
+ "version": "0.0.422",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <div class="QuoteViewPage__wrapper">
3
+ <div class="content-inner">
4
+ <lancom-quote-view
5
+ v-if="quote"
6
+ :quote="quote"
7
+ :option="option" />
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import QuoteViewPage from '@lancom/shared/pages/quotes/view/_id';
14
+ import LancomQuoteView from '@lancom/shared/components/quotes/quote_view/quote-view';
15
+
16
+ export default {
17
+ name: 'QuoteOptionView',
18
+ components: {
19
+ LancomQuoteView
20
+ },
21
+ mixins: [QuoteViewPage],
22
+ layout: 'empty'
23
+ };
24
+ </script>
@@ -1,29 +1,57 @@
1
1
  import Vue from 'vue';
2
2
 
3
- let interval = null;
3
+ let recaptchaStartLoaded = false;
4
4
 
5
5
  export default () => {
6
6
  Vue.mixin({
7
+ data() {
8
+ return {
9
+ waitRecaptchaTimer: null,
10
+ recaptchaError: null
11
+ };
12
+ },
7
13
  methods: {
8
14
  async getRecaptcha(name) {
9
15
  await this.preloadReCaptcha();
10
16
  return process.env.IS_LOCAL === 'true' || await this.$recaptcha(name);
11
17
  },
12
18
  async preloadReCaptcha() {
19
+ if (recaptchaStartLoaded) {
20
+ await this.waitUntilLoadedRecaptcha();
21
+ }
22
+
13
23
  if (!this.$recaptcha) {
14
- clearInterval(interval);
15
- await this.loadReCaptcha();
16
- await new Promise((resolve, reject) => {
17
- interval = setInterval(() => {
18
- if (this.$recaptcha) {
19
- clearInterval(interval);
20
- resolve()
21
- }
22
- }, 100);
23
- });
24
+ recaptchaStartLoaded = true;
25
+ for (let index = 0; index < 10; index++) {
26
+ try {
27
+ await this.loadRecaptchaJs();
28
+ break;
29
+ } catch (e) {
30
+ console.log('loadRecaptcha:error ', e);
31
+ await new Promise(resolve => setTimeout(resolve, 500));
32
+ }
33
+ }
24
34
  }
35
+
36
+ await this.$recaptchaLoaded();
37
+
38
+ if (!this.$recaptcha) {
39
+ this.recaptchaError = 'Recaptcha temporarily not available';
40
+ }
41
+ console.log('loadRecaptcha:result ', !!this.$recaptcha);
42
+ },
43
+ waitUntilLoadedRecaptcha() {
44
+ return new Promise((resolve, reject) => {
45
+ let repeated = 0;
46
+ this.waitRecaptchaTimer = setInterval(() => {
47
+ if (!!this.$recaptcha || repeated++ > 10) {
48
+ clearInterval(this.waitRecaptchaTimer);
49
+ resolve();
50
+ }
51
+ }, 500);
52
+ });
25
53
  },
26
- async loadReCaptcha() {
54
+ async loadRecaptchaJs() {
27
55
  const { VueReCaptcha } = await import('vue-recaptcha-v3');
28
56
  Vue.use(VueReCaptcha, {
29
57
  siteKey: process.env.RECAPTCHA_KEY,
package/routes/index.js CHANGED
@@ -102,6 +102,11 @@ module.exports = function(routes, resolve, config) {
102
102
  path: '/order/:token/refund/:refund',
103
103
  component: resolve('@lancom/shared/pages/order/_token/refund/_refund.vue'),
104
104
  chunkName: 'pages/order/view/refund'
105
+ }, {
106
+ name: 'quotes-view-option',
107
+ path: '/quotes/view/:id/option/:option',
108
+ component: resolve('@lancom/shared/pages/quotes/view/_id/option/_option.vue'),
109
+ chunkName: 'pages/quotes/view/option'
105
110
  }, {
106
111
  name: 'customer-signin',
107
112
  path: '/customer/signin',