@lancom/shared 0.0.298 → 0.0.300
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/assets/js/utils/gtm.js +16 -30
- package/components/checkout/cart/cart.vue +2 -2
- package/components/checkout/order/order-billing-information/order-billing-information.vue +5 -1
- package/components/checkout/order/order-payment-information/order-payment-information.vue +1 -1
- package/components/editor/editor_product_details/editor-product-details.scss +19 -1
- package/components/editor/editor_product_details/editor-product-details.vue +29 -8
- package/components/modals/payment_modal/payment-modal.vue +1 -1
- package/components/quotes/quote_view/quote-view.mixin.js +1 -1
- package/layouts/products.vue +2 -2
- package/mixins/payment.js +1 -1
- package/mixins/product-view.js +1 -1
- package/package.json +1 -1
- package/store/cart.js +3 -3
package/assets/js/utils/gtm.js
CHANGED
|
@@ -11,11 +11,11 @@ const gtm = {
|
|
|
11
11
|
}
|
|
12
12
|
window.dataLayer.push(data);
|
|
13
13
|
},
|
|
14
|
-
viewItem(product) {
|
|
14
|
+
viewItem(product, currency) {
|
|
15
15
|
this.push({
|
|
16
16
|
event: 'view_item',
|
|
17
17
|
value: product.minPrice,
|
|
18
|
-
currency: 'AUD',
|
|
18
|
+
currency: currency?.isoCode || 'AUD',
|
|
19
19
|
items: [{
|
|
20
20
|
id: product.SKU,
|
|
21
21
|
item_name: product.name,
|
|
@@ -23,11 +23,11 @@ const gtm = {
|
|
|
23
23
|
}]
|
|
24
24
|
});
|
|
25
25
|
},
|
|
26
|
-
addToCart(entities, pricing) {
|
|
26
|
+
addToCart(entities, pricing, currency) {
|
|
27
27
|
this.push({
|
|
28
28
|
event: 'add_to_cart',
|
|
29
29
|
value: pricing.totalPriceWithoutTax,
|
|
30
|
-
currency: 'AUD',
|
|
30
|
+
currency: currency?.isoCode || 'AUD',
|
|
31
31
|
items: entities.reduce((products, { product, simpleProducts }) => {
|
|
32
32
|
return [
|
|
33
33
|
...products,
|
|
@@ -41,10 +41,10 @@ const gtm = {
|
|
|
41
41
|
}, [])
|
|
42
42
|
});
|
|
43
43
|
},
|
|
44
|
-
viewItemList(products) {
|
|
44
|
+
viewItemList(products, currency) {
|
|
45
45
|
this.push({
|
|
46
46
|
event: 'view_item_list',
|
|
47
|
-
currency: 'AUD',
|
|
47
|
+
currency: currency?.isoCode || 'AUD',
|
|
48
48
|
items: (products || []).map(product => {
|
|
49
49
|
return {
|
|
50
50
|
id: product.SKU,
|
|
@@ -55,32 +55,18 @@ const gtm = {
|
|
|
55
55
|
})
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
|
-
viewItemList(products) {
|
|
59
|
-
this.push({
|
|
60
|
-
event: 'view_item_list',
|
|
61
|
-
currency: 'AUD',
|
|
62
|
-
items: products.map(product => {
|
|
63
|
-
return {
|
|
64
|
-
id: product.SKU,
|
|
65
|
-
item_name: product.name,
|
|
66
|
-
google_business_vertical: 'retail',
|
|
67
|
-
price: product.minPrice
|
|
68
|
-
};
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
58
|
viewSearchResult(search_term) {
|
|
73
59
|
this.push({
|
|
74
60
|
event: 'view_search_results',
|
|
75
61
|
search_term
|
|
76
62
|
});
|
|
77
63
|
},
|
|
78
|
-
viewCart(entities, pricing) {
|
|
64
|
+
viewCart(entities, pricing, currency) {
|
|
79
65
|
if (pricing) {
|
|
80
66
|
this.push({
|
|
81
67
|
event: 'view_item_list',
|
|
82
68
|
value: pricing.totalPriceWithoutTax,
|
|
83
|
-
currency: 'AUD',
|
|
69
|
+
currency: currency?.isoCode || 'AUD',
|
|
84
70
|
coupon: pricing.coupon?.code,
|
|
85
71
|
items: entities.reduce((products, { guid: productGuid, product, simpleProducts }) => {
|
|
86
72
|
return [
|
|
@@ -111,12 +97,12 @@ const gtm = {
|
|
|
111
97
|
// }))
|
|
112
98
|
// });
|
|
113
99
|
},
|
|
114
|
-
purchase(order) {
|
|
100
|
+
purchase(order, currency) {
|
|
115
101
|
const event = {
|
|
116
102
|
event: 'purchase',
|
|
117
103
|
transaction_id: order.code,
|
|
118
104
|
value: order.total,
|
|
119
|
-
currency: 'AUD',
|
|
105
|
+
currency: currency?.isoCode || 'AUD',
|
|
120
106
|
coupon: order.couponCode,
|
|
121
107
|
shipping: order.shippingTotal,
|
|
122
108
|
tax: +(order.totalGST - order.total).toFixed(2),
|
|
@@ -141,7 +127,7 @@ const gtm = {
|
|
|
141
127
|
}
|
|
142
128
|
gtm.push(event);
|
|
143
129
|
},
|
|
144
|
-
shippingInfo(order) {
|
|
130
|
+
shippingInfo(order, currency) {
|
|
145
131
|
const shipping = (order.suppliersWithRates || []).reduce((suppliersRates, supplierRates) => {
|
|
146
132
|
const rate = supplierRates.rates.find(({ selected }) => !!selected);
|
|
147
133
|
return rate ? [...suppliersRates, `${supplierRates.name}. ${rate.name}`] : suppliersRates;
|
|
@@ -150,18 +136,18 @@ const gtm = {
|
|
|
150
136
|
event: 'add_shipping_info',
|
|
151
137
|
value: order.shippingTotal,
|
|
152
138
|
coupon: order.couponCode,
|
|
153
|
-
currency: 'AUD',
|
|
139
|
+
currency: currency?.isoCode || 'AUD',
|
|
154
140
|
shipping_tier: shipping,
|
|
155
141
|
items: getOrderItems(order)
|
|
156
142
|
};
|
|
157
143
|
gtm.push(event);
|
|
158
144
|
},
|
|
159
|
-
paymentInfo(order) {
|
|
145
|
+
paymentInfo(order, currency) {
|
|
160
146
|
const event = {
|
|
161
147
|
event: 'add_payment_info',
|
|
162
148
|
value: order.total,
|
|
163
149
|
coupon: order.couponCode,
|
|
164
|
-
currency: 'AUD',
|
|
150
|
+
currency: currency?.isoCode || 'AUD',
|
|
165
151
|
payment_type: order.paymentMethod,
|
|
166
152
|
items: getOrderItems(order)
|
|
167
153
|
};
|
|
@@ -180,7 +166,7 @@ function getOrderItems(order) {
|
|
|
180
166
|
}, [])
|
|
181
167
|
}
|
|
182
168
|
|
|
183
|
-
function getOrderItem(product, simpleProduct) {
|
|
169
|
+
function getOrderItem(product, simpleProduct, currency) {
|
|
184
170
|
const { SKU, productCost, amount, color, size } = simpleProduct;
|
|
185
171
|
return {
|
|
186
172
|
id: product.SKU,
|
|
@@ -189,7 +175,7 @@ function getOrderItem(product, simpleProduct) {
|
|
|
189
175
|
item_name: product.name.trim(),
|
|
190
176
|
item_brand: product.brand.name,
|
|
191
177
|
price: productCost,
|
|
192
|
-
currency: 'AUD',
|
|
178
|
+
currency: currency?.isoCode || 'AUD',
|
|
193
179
|
quantity: amount,
|
|
194
180
|
google_business_vertical: 'retail'
|
|
195
181
|
};
|
|
@@ -92,7 +92,7 @@ export default {
|
|
|
92
92
|
filters: { price },
|
|
93
93
|
mixins: [CartMixin],
|
|
94
94
|
computed: {
|
|
95
|
-
...mapGetters(['MESSAGES', 'SETTINGS']),
|
|
95
|
+
...mapGetters(['MESSAGES', 'SETTINGS', 'currency']),
|
|
96
96
|
...mapGetters('cart', ['isEmpty', 'cartPricingError', 'cartPricing', 'cartPricingCalculating', 'entities']),
|
|
97
97
|
onlyPostcode() {
|
|
98
98
|
return !!this.SETTINGS.CART_ONLY_POSTCODE;
|
|
@@ -118,7 +118,7 @@ export default {
|
|
|
118
118
|
},
|
|
119
119
|
methods: {
|
|
120
120
|
loadedPricing() {
|
|
121
|
-
gtm.viewCart(this.entities, this.cartPricing);
|
|
121
|
+
gtm.viewCart(this.entities, this.cartPricing, this.currency);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
};
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
27
|
<script>
|
|
28
|
+
import { mapGetters } from 'vuex';
|
|
28
29
|
import gtm from '@lancom/shared/assets/js/utils/gtm';
|
|
29
30
|
import { generateOrderData } from '@lancom/shared/assets/js/utils/order';
|
|
30
31
|
import CartQuantityErrors from '@lancom/shared/components/checkout/cart/cart_quantity_errors/cart-quantity-errors';
|
|
@@ -52,6 +53,9 @@ export default {
|
|
|
52
53
|
isSubmit: false
|
|
53
54
|
};
|
|
54
55
|
},
|
|
56
|
+
computed: {
|
|
57
|
+
...mapGetters(['currency'])
|
|
58
|
+
},
|
|
55
59
|
methods: {
|
|
56
60
|
async submit() {
|
|
57
61
|
this.isSubmit = true;
|
|
@@ -62,7 +66,7 @@ export default {
|
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
const orderInfo = generateOrderData(this.order, this.entities, this.cartPricing);
|
|
65
|
-
gtm.shippingInfo(orderInfo);
|
|
69
|
+
gtm.shippingInfo(orderInfo, this.currency);
|
|
66
70
|
|
|
67
71
|
if (this.copyToShippingAddress) {
|
|
68
72
|
this.order.shippingAddress = { ...this.order.shippingAddress };
|
|
@@ -142,7 +142,7 @@ export default {
|
|
|
142
142
|
this.errorMessage = null;
|
|
143
143
|
|
|
144
144
|
const orderInfo = this.orderData || generateOrderData(this.order, this.entities, this.cartPricing);
|
|
145
|
-
gtm.paymentInfo(orderInfo);
|
|
145
|
+
gtm.paymentInfo(orderInfo, this.currency);
|
|
146
146
|
|
|
147
147
|
if (this.isDepositPayment) {
|
|
148
148
|
this.setCard(null);
|
|
@@ -72,13 +72,31 @@
|
|
|
72
72
|
width: 100%;
|
|
73
73
|
text-align: center;
|
|
74
74
|
margin: 15px 0;
|
|
75
|
+
height: 300px;
|
|
76
|
+
position: relative;
|
|
75
77
|
display: none;
|
|
76
78
|
@media (max-width: $bp-extra-small-max) {
|
|
77
|
-
|
|
79
|
+
display: block;
|
|
78
80
|
}
|
|
79
81
|
img {
|
|
80
82
|
width: 100%;
|
|
81
83
|
max-width: 330px;
|
|
82
84
|
}
|
|
83
85
|
}
|
|
86
|
+
&__product-sides-toggle {
|
|
87
|
+
width: 45px;
|
|
88
|
+
height: 45px;
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: 50%;
|
|
91
|
+
right: 25px;
|
|
92
|
+
border-radius: 50%;
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
background-color: $grey_4;
|
|
97
|
+
font-size: 21px;
|
|
98
|
+
color: $black;
|
|
99
|
+
padding: 10px;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
}
|
|
84
102
|
}
|
|
@@ -79,10 +79,17 @@
|
|
|
79
79
|
class="EditorProductDetails__available-warning">
|
|
80
80
|
Product Not Available in {{ country.name }}
|
|
81
81
|
</div>
|
|
82
|
-
<div
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
<div class="EditorProductDetails__product-image">
|
|
83
|
+
<product-side-with-print
|
|
84
|
+
:key="side"
|
|
85
|
+
:product="previewPrintProduct"
|
|
86
|
+
:side="side"
|
|
87
|
+
size="large" />
|
|
88
|
+
<div
|
|
89
|
+
class="EditorProductDetails__product-sides-toggle"
|
|
90
|
+
@click="toggleSide">
|
|
91
|
+
<i class="icon-rotate-tee"></i>
|
|
92
|
+
</div>
|
|
86
93
|
</div>
|
|
87
94
|
<div
|
|
88
95
|
v-if="productDetailsLoaded && productAvailableInCurrentCountry">
|
|
@@ -108,6 +115,7 @@ import { staticLink, priceWithTax } from '@lancom/shared/assets/js/utils/filters
|
|
|
108
115
|
import PricingTable from '@lancom/shared/components/common/pricing_table/pricing-table';
|
|
109
116
|
import { generateProductLink } from '@lancom/shared/assets/js/utils/product';
|
|
110
117
|
import Price from '@lancom/shared/components/common/price';
|
|
118
|
+
import ProductSideWithPrint from '@lancom/shared/components/common/product_side_with_print/product-side-with-print';
|
|
111
119
|
|
|
112
120
|
export default {
|
|
113
121
|
name: 'EditorProductDetails',
|
|
@@ -116,13 +124,19 @@ export default {
|
|
|
116
124
|
PricingDiscountsTable,
|
|
117
125
|
EditorPricing,
|
|
118
126
|
PricingTable,
|
|
119
|
-
Price
|
|
127
|
+
Price,
|
|
128
|
+
ProductSideWithPrint
|
|
120
129
|
},
|
|
121
130
|
filters: {
|
|
122
131
|
priceWithTax,
|
|
123
132
|
staticLink
|
|
124
133
|
},
|
|
125
134
|
mixins: [modals],
|
|
135
|
+
data() {
|
|
136
|
+
return {
|
|
137
|
+
side: 'front'
|
|
138
|
+
}
|
|
139
|
+
},
|
|
126
140
|
computed: {
|
|
127
141
|
...mapGetters(['taxName']),
|
|
128
142
|
...mapGetters('product', [
|
|
@@ -142,6 +156,13 @@ export default {
|
|
|
142
156
|
'pricingSettings',
|
|
143
157
|
'country'
|
|
144
158
|
]),
|
|
159
|
+
previewPrintProduct() {
|
|
160
|
+
return {
|
|
161
|
+
...this.product,
|
|
162
|
+
color: this.editableColor,
|
|
163
|
+
printsThumbnails: this.layerThumbnails
|
|
164
|
+
};
|
|
165
|
+
},
|
|
145
166
|
inclGST: {
|
|
146
167
|
get() {
|
|
147
168
|
return this.priceIncludeGST;
|
|
@@ -173,13 +194,13 @@ export default {
|
|
|
173
194
|
},
|
|
174
195
|
mainProductImage() {
|
|
175
196
|
return this.images.find(i => i.color === this.editableColor?._id) || this.images[0];
|
|
176
|
-
},
|
|
177
|
-
mainProductImageSrc() {
|
|
178
|
-
return this.mainProductImage && this.mainProductImage.large;
|
|
179
197
|
}
|
|
180
198
|
},
|
|
181
199
|
methods: {
|
|
182
200
|
...mapMutations('product', ['setPriceIncludeGST']),
|
|
201
|
+
toggleSide() {
|
|
202
|
+
this.side = this.side === 'front' ? 'back' : 'front';
|
|
203
|
+
}
|
|
183
204
|
}
|
|
184
205
|
};
|
|
185
206
|
</script>
|
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
this.processing = true;
|
|
39
39
|
this.order = await this.createOrder({ ...option });
|
|
40
40
|
this.setOrder(this.order);
|
|
41
|
-
gtm.purchase(this.order);
|
|
41
|
+
gtm.purchase(this.order, this.currency);
|
|
42
42
|
gapis.surveyOptin(this.order, this.shop);
|
|
43
43
|
this.clear();
|
|
44
44
|
} catch (e) {
|
package/layouts/products.vue
CHANGED
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
name: product.name,
|
|
206
206
|
highPrice: product.minPrice,
|
|
207
207
|
lowPrice: product.maxPrice,
|
|
208
|
-
priceCurrency: 'AUD',
|
|
208
|
+
priceCurrency: this.currency?.isoCode || 'AUD',
|
|
209
209
|
availability: 'InStock'
|
|
210
210
|
}
|
|
211
211
|
};
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
if (this.$route.query.text) {
|
|
263
263
|
gtm.viewSearchResult(this.$route.query.text);
|
|
264
264
|
}
|
|
265
|
-
gtm.viewItemList(this.products);
|
|
265
|
+
gtm.viewItemList(this.products, this.currency);
|
|
266
266
|
}
|
|
267
267
|
},
|
|
268
268
|
loadProductsWithDebounce: debounce(function () {
|
package/mixins/payment.js
CHANGED
package/mixins/product-view.js
CHANGED
package/package.json
CHANGED
package/store/cart.js
CHANGED
|
@@ -122,7 +122,7 @@ export const actions = {
|
|
|
122
122
|
commit('setEntities', cart.entities);
|
|
123
123
|
}
|
|
124
124
|
if (pricing) {
|
|
125
|
-
gtm.addToCart(addingEntities, pricing);
|
|
125
|
+
gtm.addToCart(addingEntities, pricing, currency);
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
async removeSimpleProductsFromCart({ commit, state }, { simpleProducts, shop, currency }) {
|
|
@@ -139,7 +139,7 @@ export const actions = {
|
|
|
139
139
|
await api.saveCart(payload, shop._id);
|
|
140
140
|
commit('setEntities', entities);
|
|
141
141
|
if (state.cartPricing) {
|
|
142
|
-
gtm.removeFromCart(simpleProducts, state.cartPricing);
|
|
142
|
+
gtm.removeFromCart(simpleProducts, state.cartPricing, currency);
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
async removeSupplier({ commit, state }, { supplier, shop, currency }) {
|
|
@@ -147,7 +147,7 @@ export const actions = {
|
|
|
147
147
|
const entities = state.entities.filter(entity => !brands.includes(entity.product.brand._id));
|
|
148
148
|
if (state.cartPricing) {
|
|
149
149
|
const simpleProducts = entities.reduce((items, entity) => [...items, ...entity.simpleProducts], []);
|
|
150
|
-
gtm.removeFromCart(simpleProducts, state.cartPricing);
|
|
150
|
+
gtm.removeFromCart(simpleProducts, state.cartPricing, currency);
|
|
151
151
|
}
|
|
152
152
|
const payload = { _id: state.id, entities, currency: currency?._id};
|
|
153
153
|
await api.saveCart(payload, shop._id);
|