@lancom/shared 0.0.309 → 0.0.311
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/fabric-helper.js +0 -1
- package/assets/js/utils/layers.js +5 -4
- package/assets/scss/ui_kit/_grid.scss +1 -1
- package/components/checkout/order/address-form/address-form.scss +8 -0
- package/components/checkout/order/address-form/address-form.vue +3 -0
- package/components/checkout/order/order-billing-information/order-billing-information.vue +32 -8
- package/components/checkout/order/order.vue +1 -1
- package/components/common/payment/payment_success/payment-success.vue +2 -2
- package/components/common/product_side_with_print/product-side-with-print.vue +1 -1
- package/components/editor/editor_workspace/editor-workspace.scss +11 -0
- package/components/editor/editor_workspace/editor-workspace.vue +29 -5
- package/components/editor/mobile_editor_product_details/mobile-editor-product-details.vue +1 -1
- package/components/modals/order_modal/order-modal.vue +1 -1
- package/components/order/order_product_prints_preview/order-product-prints-preview.vue +5 -0
- package/components/order/order_view/order-view.mixin.js +14 -11
- package/components/product/wizard/wizard.vue +6 -3
- package/mixins/product-view.js +2 -1
- package/package.json +1 -1
- package/store/product.js +3 -1
|
@@ -192,7 +192,6 @@ export default class FabricHelper {
|
|
|
192
192
|
|
|
193
193
|
createObject({ layer, active }) {
|
|
194
194
|
const initial = !layer.modifiedAt;
|
|
195
|
-
console.log('createObject...', layer.type, layer.top, layer.left);
|
|
196
195
|
return new Promise(resolve => {
|
|
197
196
|
const methods = {
|
|
198
197
|
text: 'createTextObject',
|
|
@@ -7,10 +7,11 @@ export function generateLayersTemplate(template, printArea) {
|
|
|
7
7
|
}));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function fitLayerToEditorSize(layer, { size },
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
layer.
|
|
10
|
+
export function fitLayerToEditorSize(layer, { size }, printArea) {
|
|
11
|
+
const { width, height, top, left } = printArea;
|
|
12
|
+
const scaleKoef = width / size.width;
|
|
13
|
+
layer.top = top + layer.top * scaleKoef - 5 + (height - size.height * scaleKoef) / 2;
|
|
14
|
+
layer.left = left + layer.left * scaleKoef - 5 + (width - size.width * scaleKoef) / 2;
|
|
14
15
|
['fontSize', 'scaleX', 'scaleY'].forEach(property => {
|
|
15
16
|
if (property in layer) {
|
|
16
17
|
const originalSize = layer[property];
|
|
@@ -11,17 +11,20 @@
|
|
|
11
11
|
<address-form
|
|
12
12
|
:address="order.shippingAddress"
|
|
13
13
|
:without-additional-info="true" />
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
<div class="mt-20 mb-20">
|
|
15
|
+
<checkbox
|
|
16
|
+
v-model="copyToBillingAddress"
|
|
17
|
+
:dark="true">
|
|
18
|
+
<div class="ml-5">Use same address as the billing address</div>
|
|
19
|
+
</checkbox>
|
|
20
|
+
</div>
|
|
19
21
|
<div
|
|
20
22
|
v-if="!copyToBillingAddress"
|
|
21
|
-
class="mt-
|
|
22
|
-
<h5 class="
|
|
23
|
+
class="mt-15">
|
|
24
|
+
<h5 class="lc_h3 lc_uppercase lc_bold mt-10 mb-15">Billing Address</h5>
|
|
23
25
|
<address-form
|
|
24
26
|
:address="order.billingAddress"
|
|
27
|
+
:copy-from="order.shippingAddress"
|
|
25
28
|
:without-additional-info="true" />
|
|
26
29
|
</div>
|
|
27
30
|
</div>
|
|
@@ -46,6 +49,27 @@ import CartMixin from '@lancom/shared/components/checkout/cart/cart.mixin';
|
|
|
46
49
|
import AddressForm from '@/components/checkout/order/address-form/address-form';
|
|
47
50
|
import ProgressStepsControls from '@lancom/shared/components/common/progress_steps/progress_steps_controls/progress-steps-controls';
|
|
48
51
|
|
|
52
|
+
function isSameAddresses(address, billingAddress) {
|
|
53
|
+
if (!billingAddress) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
const fields = [
|
|
57
|
+
'fullName',
|
|
58
|
+
'additionalInfo',
|
|
59
|
+
'addressLine1',
|
|
60
|
+
'addressLine2',
|
|
61
|
+
'city',
|
|
62
|
+
'company',
|
|
63
|
+
'country',
|
|
64
|
+
'email',
|
|
65
|
+
'phone',
|
|
66
|
+
'postcode',
|
|
67
|
+
'state'
|
|
68
|
+
];
|
|
69
|
+
const getKey = model => fields.reduce((v, field) => `${v}-${model[field] || ''}`, '');
|
|
70
|
+
return address && getKey(address) === getKey(billingAddress);
|
|
71
|
+
}
|
|
72
|
+
|
|
49
73
|
export default {
|
|
50
74
|
name: 'OrderBillingInformation',
|
|
51
75
|
mixins: [CartMixin],
|
|
@@ -62,7 +86,7 @@ export default {
|
|
|
62
86
|
},
|
|
63
87
|
data() {
|
|
64
88
|
return {
|
|
65
|
-
copyToBillingAddress:
|
|
89
|
+
copyToBillingAddress: isSameAddresses(this.order?.shippingAddress, this.order?.billingAddress),
|
|
66
90
|
isSubmit: false
|
|
67
91
|
};
|
|
68
92
|
},
|
|
@@ -106,7 +106,7 @@ export default {
|
|
|
106
106
|
this.order = {
|
|
107
107
|
paymentMethod: 'card',
|
|
108
108
|
billingAddress: {
|
|
109
|
-
...address,
|
|
109
|
+
...JSON.parse(JSON.stringify(address)),
|
|
110
110
|
...(this.user ? {
|
|
111
111
|
fullName: `${this.user.firstName} ${this.user.lastName}`,
|
|
112
112
|
phone: this.user.phone,
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
-
import
|
|
27
|
+
import { MESSAGES } from '@/messages';
|
|
28
28
|
|
|
29
29
|
export default {
|
|
30
30
|
name: 'PaymentSuccess',
|
|
31
31
|
data() {
|
|
32
32
|
return {
|
|
33
|
-
messages
|
|
33
|
+
messages: MESSAGES
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
36
|
props: {
|
|
@@ -81,7 +81,7 @@ export default {
|
|
|
81
81
|
return this.print && this.getImageBackground(this.print);
|
|
82
82
|
},
|
|
83
83
|
image() {
|
|
84
|
-
const color = this.defaultPreview ? null : this.product.color;
|
|
84
|
+
const color = this.defaultPreview ? null : (this.product.color || (this.product.colors || [])[0]);
|
|
85
85
|
const product = this.product?.product || this.product;
|
|
86
86
|
return getColorImage(product, this.size, this.side, color) || getProductCover(product, this.size, this.side, color);
|
|
87
87
|
},
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
@import "@/assets/scss/variables";
|
|
2
2
|
|
|
3
3
|
.EditorWorkspace {
|
|
4
|
+
&__preloading {
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
background-color: white;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
}
|
|
4
15
|
&__sides {
|
|
5
16
|
position: relative;
|
|
6
17
|
width: 100%;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="EditorWorkspace__wrapper">
|
|
3
|
+
<div
|
|
4
|
+
v-if="preloading"
|
|
5
|
+
class="EditorWorkspace__preloading">
|
|
6
|
+
<placeholder />
|
|
7
|
+
</div>
|
|
3
8
|
<breakpoint
|
|
4
9
|
name="md"
|
|
5
10
|
mode="up">
|
|
@@ -17,7 +22,7 @@
|
|
|
17
22
|
class="EditorWorkspace__sides rotate-y-container"
|
|
18
23
|
:class="{rotating: isRotating}">
|
|
19
24
|
<transition
|
|
20
|
-
name="rotate"
|
|
25
|
+
:name="preloading ? 'empty' : 'rotate'"
|
|
21
26
|
mode="in-out"
|
|
22
27
|
@before-enter="isRotating = true"
|
|
23
28
|
@after-leave="isRotating = false">
|
|
@@ -50,7 +55,7 @@
|
|
|
50
55
|
class="EditorWorkspace__sides rotate-y-container"
|
|
51
56
|
:class="{rotating: isRotating}">
|
|
52
57
|
<transition
|
|
53
|
-
name="rotate"
|
|
58
|
+
:name="preloading ? 'empty' : 'rotate'"
|
|
54
59
|
mode="in-out"
|
|
55
60
|
@before-enter="isRotating = true"
|
|
56
61
|
@after-leave="isRotating = false">
|
|
@@ -72,7 +77,7 @@
|
|
|
72
77
|
:class="{
|
|
73
78
|
'EditorWorkspace__sides-toggle--fixed': isZoomIn
|
|
74
79
|
}"
|
|
75
|
-
@click="toggleSide">
|
|
80
|
+
@click="toggleSide()">
|
|
76
81
|
<i class="icon-rotate-tee"></i>
|
|
77
82
|
</div>
|
|
78
83
|
<div
|
|
@@ -108,6 +113,7 @@ import { createNamespacedHelpers } from 'vuex';
|
|
|
108
113
|
import EditorPrintAreaOptions from '@lancom/shared/components/editor/editor_print_area_options/editor-print-area-options';
|
|
109
114
|
import EditorPricing from '@lancom/shared/components/product/editor_pricing/editor-pricing';
|
|
110
115
|
import Tabs from '@lancom/shared/components/common/tabs';
|
|
116
|
+
import Placeholder from '@lancom/shared/components/placeholder/placeholder';
|
|
111
117
|
import EditorWorkspaceSide from './editor_workspace_side/editor-workspace-side';
|
|
112
118
|
|
|
113
119
|
const { mapGetters, mapMutations } = createNamespacedHelpers('product');
|
|
@@ -115,6 +121,7 @@ const { mapGetters, mapMutations } = createNamespacedHelpers('product');
|
|
|
115
121
|
export default {
|
|
116
122
|
name: 'EditorWorkspace',
|
|
117
123
|
components: {
|
|
124
|
+
Placeholder,
|
|
118
125
|
EditorWorkspaceSide,
|
|
119
126
|
EditorPrintAreaOptions,
|
|
120
127
|
EditorPricing,
|
|
@@ -122,6 +129,7 @@ export default {
|
|
|
122
129
|
},
|
|
123
130
|
data() {
|
|
124
131
|
return {
|
|
132
|
+
preloading: true,
|
|
125
133
|
isRotating: false,
|
|
126
134
|
zoomSize: null,
|
|
127
135
|
productSides: [
|
|
@@ -146,22 +154,38 @@ export default {
|
|
|
146
154
|
return !!this.zoomSize;
|
|
147
155
|
}
|
|
148
156
|
},
|
|
157
|
+
mounted() {
|
|
158
|
+
this.preloadingEditor();
|
|
159
|
+
},
|
|
149
160
|
methods: {
|
|
150
161
|
...mapMutations([
|
|
151
162
|
'setEditableSide',
|
|
152
163
|
'setSelectedPrintArea',
|
|
153
164
|
'setEditablePrintArea'
|
|
154
165
|
]),
|
|
166
|
+
async preloadingEditor() {
|
|
167
|
+
this.preloading = true;
|
|
168
|
+
const sides = ['back', 'front'];
|
|
169
|
+
for (const side of sides) {
|
|
170
|
+
await (new Promise((resolve) => {
|
|
171
|
+
setTimeout(() => {
|
|
172
|
+
this.toggleSide(side);
|
|
173
|
+
resolve();
|
|
174
|
+
}, 500);
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
this.preloading = false;
|
|
178
|
+
},
|
|
155
179
|
selectTab(value) {
|
|
156
180
|
if (this.editableSide.id !== value) {
|
|
157
181
|
this.setEditablePrintArea(null);
|
|
158
182
|
this.setEditableSide({ id: value });
|
|
159
183
|
}
|
|
160
184
|
},
|
|
161
|
-
toggleSide() {
|
|
185
|
+
toggleSide(side) {
|
|
162
186
|
this.setEditablePrintArea(null);
|
|
163
187
|
this.setEditableSide({
|
|
164
|
-
id: this.editableSide.id === 'front' ? 'back' : 'front'
|
|
188
|
+
id: side || (this.editableSide.id === 'front' ? 'back' : 'front')
|
|
165
189
|
});
|
|
166
190
|
},
|
|
167
191
|
selectPrintArea({ printArea, size }) {
|
|
@@ -361,7 +361,7 @@ export default {
|
|
|
361
361
|
recaptchaToken,
|
|
362
362
|
currency: this.currency?._id,
|
|
363
363
|
country: this.country?._id,
|
|
364
|
-
billingAddress: this.form,
|
|
364
|
+
billingAddress: JSON.parse(JSON.stringify(this.form)),
|
|
365
365
|
shippingAddress: this.form,
|
|
366
366
|
products: this.entities,
|
|
367
367
|
pricing: this.cartPricing,
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<product-side-with-print
|
|
8
8
|
:product="product"
|
|
9
9
|
:side="side"
|
|
10
|
+
:default-preview="defaultPreview"
|
|
10
11
|
size="medium" />
|
|
11
12
|
</div>
|
|
12
13
|
</div>
|
|
@@ -29,6 +30,10 @@ export default {
|
|
|
29
30
|
product: {
|
|
30
31
|
type: Object,
|
|
31
32
|
required: true
|
|
33
|
+
},
|
|
34
|
+
defaultPreview: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true
|
|
32
37
|
}
|
|
33
38
|
},
|
|
34
39
|
computed: {
|
|
@@ -46,32 +46,35 @@ export default {
|
|
|
46
46
|
depositInfo() {
|
|
47
47
|
return this.settings?.depositInfo || {};
|
|
48
48
|
},
|
|
49
|
+
displayAddress() {
|
|
50
|
+
return this.invoice?.address || this.order.billingAddress || this.order.shippingAddress;
|
|
51
|
+
},
|
|
49
52
|
fullName() {
|
|
50
|
-
return this.
|
|
53
|
+
return this.displayAddress.fullName;
|
|
51
54
|
},
|
|
52
55
|
company() {
|
|
53
|
-
return this.
|
|
56
|
+
return this.displayAddress.company;
|
|
54
57
|
},
|
|
55
58
|
phone() {
|
|
56
|
-
return this.
|
|
59
|
+
return this.displayAddress.phone;
|
|
57
60
|
},
|
|
58
61
|
email() {
|
|
59
|
-
return this.
|
|
62
|
+
return this.displayAddress.email;
|
|
60
63
|
},
|
|
61
64
|
additionalInfo() {
|
|
62
|
-
return this.
|
|
65
|
+
return this.displayAddress.additionalInfo;
|
|
63
66
|
},
|
|
64
67
|
purchaseOrderNumber() {
|
|
65
68
|
return this.invoice?.purchaseOrderNumber || this.order.purchaseOrderNumber;
|
|
66
69
|
},
|
|
67
70
|
orderAddress() {
|
|
68
71
|
return [
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
72
|
+
this.displayAddress.addressLine1,
|
|
73
|
+
this.displayAddress.addressLine2,
|
|
74
|
+
this.displayAddress.city,
|
|
75
|
+
this.displayAddress.postcode,
|
|
76
|
+
this.displayAddress.state,
|
|
77
|
+
this.displayAddress.country
|
|
75
78
|
].filter(i => !!i).join(', ');
|
|
76
79
|
},
|
|
77
80
|
gstTax() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="Wizard__wrapper">
|
|
3
3
|
<div
|
|
4
|
-
v-if="
|
|
4
|
+
v-if="hasPresetPrints"
|
|
5
5
|
class="Wizard__header Wizard__header--active">
|
|
6
6
|
<div class="Wizard__header-name">
|
|
7
7
|
PRINT OPTIONS
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
@edit="editLayer($event)"
|
|
44
44
|
@delete="removeTemplateLayer($event)" />
|
|
45
45
|
<div
|
|
46
|
-
v-if="!
|
|
46
|
+
v-if="!hasPresetPrints"
|
|
47
47
|
class="Wizard__layers-info">
|
|
48
48
|
<p>1. Note final print price will be calculated once garment quantity is finalised</p>
|
|
49
49
|
<p>2. PDF mockup will be provided for approval prior to printing</p>
|
|
@@ -190,10 +190,13 @@ export default {
|
|
|
190
190
|
},
|
|
191
191
|
productPrintAreas() {
|
|
192
192
|
return this.product.printAreas || [];
|
|
193
|
+
},
|
|
194
|
+
hasPresetPrints() {
|
|
195
|
+
return this.preSetPrints?.length > 0
|
|
193
196
|
}
|
|
194
197
|
},
|
|
195
198
|
mounted() {
|
|
196
|
-
if (this.product.printOnly || this.
|
|
199
|
+
if (this.product.printOnly || this.hasPresetPrints || this.layers.length > 0) {
|
|
197
200
|
this.isVisible = true;
|
|
198
201
|
this.setIsPrintPricing(this.isVisible);
|
|
199
202
|
}
|
package/mixins/product-view.js
CHANGED
|
@@ -110,7 +110,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING) => ({
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
|
-
if (this.preSetPrints) {
|
|
113
|
+
if (this.preSetPrints?.length) {
|
|
114
114
|
for (const preSetPrint of this.preSetPrints) {
|
|
115
115
|
const layers = preSetPrint.printTemplate?.layers || [{ type: 'text' }];
|
|
116
116
|
for (const layer of layers) {
|
|
@@ -140,6 +140,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING) => ({
|
|
|
140
140
|
properties
|
|
141
141
|
};
|
|
142
142
|
const model = await getLayerModel(data);
|
|
143
|
+
model.createdAt = Date.now();
|
|
143
144
|
this.addTemplateLayer(model);
|
|
144
145
|
}
|
|
145
146
|
}
|
package/package.json
CHANGED
package/store/product.js
CHANGED
|
@@ -205,7 +205,9 @@ export const actions = {
|
|
|
205
205
|
},
|
|
206
206
|
async calculateProductPrice({ state: { template, product, isPrintPricing }, commit, getters }, { shop, country, currency }) {
|
|
207
207
|
commit('setCalculatingPrice', true);
|
|
208
|
-
const
|
|
208
|
+
const spProducts = getters.usedSimpleProducts?.length > 0 ? getters.usedSimpleProducts : (getters.defaultSimpleProduct ? [{ ...getters.defaultSimpleProduct, amount: 1 }] : []);
|
|
209
|
+
const entities = getProductsForCalculatePricing(product, spProducts, template.layers, isPrintPricing, true);
|
|
210
|
+
|
|
209
211
|
const response = await api.calculateProductPrice({ entities, country: country?._id, currency: currency?._id }, shop._id);
|
|
210
212
|
commit('setProductPricing', response);
|
|
211
213
|
commit('setCalculatingPrice', false);
|