@lancom/shared 0.0.278 → 0.0.279

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.
Files changed (38) hide show
  1. package/assets/js/api/admin.js +3 -0
  2. package/components/common/progress_steps/progress-steps.scss +3 -1
  3. package/components/common/progress_steps/progress-steps.vue +9 -1
  4. package/components/editor/editor.vue +18 -1
  5. package/components/editor/editor_wizard/editor-wizard.scss +22 -0
  6. package/components/editor/editor_wizard/editor-wizard.vue +66 -0
  7. package/components/editor/editor_workspace/editor_workspace_side/editor-workspace-side.vue +1 -1
  8. package/components/product/wizard/wizard.scss +222 -0
  9. package/components/product/wizard/wizard.vue +274 -0
  10. package/components/product/wizard/wizard_print/wizard-print.scss +94 -0
  11. package/components/product/wizard/wizard_print/wizard-print.vue +130 -0
  12. package/components/product/wizard/wizard_print_area/wizard-print-area.scss +101 -0
  13. package/components/product/wizard/wizard_print_area/wizard-print-area.vue +86 -0
  14. package/components/product/wizard/wizard_print_layers/wizard-print-layers.scss +60 -0
  15. package/components/product/wizard/wizard_print_layers/wizard-print-layers.vue +67 -0
  16. package/components/product/wizard/wizard_print_layers/wizard_print_layer/wizard-print-layer.scss +47 -0
  17. package/components/product/wizard/wizard_print_layers/wizard_print_layer/wizard-print-layer.vue +210 -0
  18. package/components/product/wizard/wizard_print_review/wizard-print-review.scss +0 -0
  19. package/components/product/wizard/wizard_print_review/wizard-print-review.vue +71 -0
  20. package/components/product/wizard/wizard_print_size/wizard-print-size.scss +68 -0
  21. package/components/product/wizard/wizard_print_size/wizard-print-size.vue +49 -0
  22. package/components/product/wizard/wizard_print_size/wizard_print_area_print_size/wizard-print-area-print-size.scss +65 -0
  23. package/components/product/wizard/wizard_print_size/wizard_print_area_print_size/wizard-print-area-print-size.vue +106 -0
  24. package/components/product/wizard/wizard_print_text_or_logo/wizard-print-text-or-logo.scss +65 -0
  25. package/components/product/wizard/wizard_print_text_or_logo/wizard-print-text-or-logo.vue +116 -0
  26. package/components/product/wizard/wizard_print_text_or_logo/wizard_text_or_logo_form/wizard-text-or-logo-form.scss +138 -0
  27. package/components/product/wizard/wizard_print_text_or_logo/wizard_text_or_logo_form/wizard-text-or-logo-form.vue +157 -0
  28. package/components/product/wizard/wizard_print_type/wizard-print-type.scss +65 -0
  29. package/components/product/wizard/wizard_print_type/wizard-print-type.vue +49 -0
  30. package/components/product/wizard/wizard_print_type/wizard_print_area_print_type/wizard-print-area-print-type.scss +87 -0
  31. package/components/product/wizard/wizard_print_type/wizard_print_area_print_type/wizard-print-area-print-type.vue +114 -0
  32. package/components/product/wizard/wizard_print_underbase/wizard-print-underbase.scss +65 -0
  33. package/components/product/wizard/wizard_print_underbase/wizard-print-underbase.vue +49 -0
  34. package/components/product/wizard/wizard_print_underbase/wizard_print_area_print_underbase/wizard-print-area-print-underbase.scss +87 -0
  35. package/components/product/wizard/wizard_print_underbase/wizard_print_area_print_underbase/wizard-print-area-print-underbase.vue +90 -0
  36. package/package.json +1 -1
  37. package/store/layers.js +6 -1
  38. package/store/product.js +42 -0
@@ -167,6 +167,9 @@ export default {
167
167
  createOrderRefund(order, refund, shop) {
168
168
  return _post(`shop/${shop}/order/${order}/refund`, refund);
169
169
  },
170
+ createOrderReturn(order, refund, shop) {
171
+ return _post(`shop/${shop}/order/${order}/return`, refund);
172
+ },
170
173
  sendOrderRefundRequest(order, refund, shop) {
171
174
  return _post(`shop/${shop}/order/${order}/refund/${refund}/send`);
172
175
  },
@@ -2,7 +2,9 @@
2
2
 
3
3
  .ProgressSteps {
4
4
  &__wrapper {
5
- border: 2px solid $gray;
5
+ &--border {
6
+ border: 2px solid $gray;
7
+ }
6
8
  }
7
9
  &__steps-wrapper {
8
10
  position: relative;
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <div class="ProgressSteps__wrapper">
2
+ <div
3
+ class="ProgressSteps__wrapper"
4
+ :class="{
5
+ 'ProgressSteps__wrapper--border': hasBorder
6
+ }">
3
7
  <div class="ProgressSteps__steps-wrapper">
4
8
  <div
5
9
  class="ProgressSteps__progress"
@@ -89,6 +93,10 @@ export default {
89
93
  type: Boolean,
90
94
  default: true
91
95
  },
96
+ hasBorder: {
97
+ type: Boolean,
98
+ default: true
99
+ },
92
100
  visibleStepName: {
93
101
  type: Boolean,
94
102
  default: false
@@ -13,7 +13,7 @@
13
13
  @select="selectTab">
14
14
  <template v-slot:default="{ currentTab }">
15
15
  <component
16
- :is="`editor-${currentTab === 'product' ? 'product-details' : 'layers'}`"
16
+ :is="editorCurrentTabComponent(currentTab)"
17
17
  v-if="currentTab">
18
18
  </component>
19
19
  </template>
@@ -83,6 +83,7 @@ import EditorWorkspace from './editor_workspace/editor-workspace';
83
83
  import EditorProductDetails from './editor_product_details/editor-product-details';
84
84
  import MobileEditorProductDetails from './mobile_editor_product_details/mobile-editor-product-details';
85
85
  import EditorLayers from './editor_layers/editor-layers';
86
+ import EditorWizard from './editor_wizard/editor-wizard';
86
87
 
87
88
  const MIN_SCREEN_AMOUNT = 125;
88
89
 
@@ -92,6 +93,7 @@ export default {
92
93
  EditorWorkspace,
93
94
  EditorProductDetails,
94
95
  EditorLayers,
96
+ EditorWizard,
95
97
  MobileEditorProductDetails,
96
98
  ProductsListDropdown,
97
99
  Tabs
@@ -112,6 +114,11 @@ export default {
112
114
  icon: 'icon-edit',
113
115
  value: 'design',
114
116
  description: 'Add text and upload images'
117
+ }, {
118
+ label: 'Easy Design Wizard',
119
+ icon: 'icon-edit',
120
+ value: 'wizard',
121
+ description: 'Create Custom Designs'
115
122
  }],
116
123
  offerScreenPrintingAmount: 0
117
124
  };
@@ -168,6 +175,16 @@ export default {
168
175
  'setSelectedTab'
169
176
  ]),
170
177
  ...mapMutations('layers', ['resetLayers']),
178
+ editorCurrentTabComponent(currentTab) {
179
+ switch(currentTab) {
180
+ case 'product':
181
+ return 'editor-product-details';
182
+ case 'wizard':
183
+ return 'editor-wizard';
184
+ default:
185
+ return 'editor-layers';
186
+ }
187
+ },
171
188
  selectTab(tab) {
172
189
  this.setSelectedTab(tab);
173
190
  this.setEditModeSelectedLayer(false);
@@ -0,0 +1,22 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .EditorWizard {
4
+ &__wrapper {
5
+ padding: 20px 0;
6
+ }
7
+ &__list-header {
8
+ padding: 12px 0;
9
+ margin-top: 24px;
10
+ border-top: 1px solid #E5E5E5;
11
+ }
12
+ &__close-editable {
13
+ color: $grey_1;
14
+ cursor: pointer;
15
+ &-icon {
16
+ color: $grey_5;
17
+ }
18
+ }
19
+ &__pricing {
20
+ margin-top: 30px;
21
+ }
22
+ }
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div class="EditorWizard__wrapper">
3
+ <wizard
4
+ :hidden-done-step-number="false"
5
+ :has-border="false" />
6
+ <div
7
+ v-if="hasLayers && isPrintPricing"
8
+ class="EditorWizard__add-btn">
9
+ <btn
10
+ btn-class="green"
11
+ btn-label="Add Another Print"
12
+ @onclick="addAnotherPrint()">
13
+ <i
14
+ slot="icon-before"
15
+ class="icon-plus"></i>
16
+ </btn>
17
+ </div>
18
+ <editor-pricing
19
+ v-if="hasPricing"
20
+ class="EditorWizard__pricing" />
21
+ </div>
22
+ </template>
23
+
24
+ <script>
25
+ import { mapGetters, mapMutations } from 'vuex';
26
+ import EditorPricing from '@lancom/shared/components/editor/editor_pricing/editor-pricing';
27
+ import Wizard from '@lancom/shared/components/product/wizard/wizard';
28
+
29
+ export default {
30
+ name: 'EditorWizard',
31
+ components: {
32
+ EditorPricing,
33
+ Wizard
34
+ },
35
+ props: {
36
+ hasPricing: {
37
+ type: Boolean,
38
+ default: true
39
+ }
40
+ },
41
+ computed: {
42
+ ...mapGetters('product', ['hasLayers', 'isPrintPricing'])
43
+ },
44
+ methods: {
45
+ ...mapMutations('product', [
46
+ 'setVisibleSteps',
47
+ 'clearWizardData'
48
+ ]),
49
+ ...mapMutations('layers', [
50
+ 'setEditableLayers'
51
+ ]),
52
+ addAnotherPrint() {
53
+ this.setVisibleSteps(false);
54
+ this.$nextTick(() => {
55
+ this.setEditableLayers();
56
+ this.clearWizardData();
57
+ this.setVisibleSteps(true);
58
+ });
59
+ },
60
+ }
61
+ };
62
+ </script>
63
+
64
+ <style lang="scss" scoped>
65
+ @import 'editor-wizard.scss';
66
+ </style>
@@ -151,7 +151,7 @@ export default {
151
151
  );
152
152
  },
153
153
  printAreaIsSmall() {
154
- return this.printAreaSize.alias === 'rect10';
154
+ return this.printAreaSize?.alias === 'rect10';
155
155
  },
156
156
  backgroundColor() {
157
157
  return this.backgroundImageLoaded && this.editableColor?.rgb;
@@ -0,0 +1,222 @@
1
+ @import '@/assets/scss/variables';
2
+
3
+ .Wizard {
4
+ &__header {
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: space-between;
8
+ padding: 22px;
9
+ background-color: $wizard_primary;
10
+ font-weight: 800;
11
+ font-size: 16px;
12
+ line-height: 22px;
13
+ text-transform: uppercase;
14
+ color: $wizard_primary_text;
15
+ cursor: pointer;
16
+ @media (max-width: $bp-extra-small-max) {
17
+ padding: 14px;
18
+ font-size: 13px;
19
+ flex-direction: column;
20
+ align-items: baseline;
21
+ }
22
+ &:hover,
23
+ &--active {
24
+ background-color: $green;
25
+ background-color: $wizard_primary_active;
26
+ }
27
+ &-state {
28
+ text-decoration: underline;
29
+ }
30
+ }
31
+ &__print-types {
32
+ display: flex;
33
+ margin: 31px 0 36px -5px;
34
+ width: calc(100% + 5px);
35
+ }
36
+ &__print-type {
37
+ margin: 5px 0 0 5px;
38
+ cursor: pointer;
39
+ &-name {
40
+ display: flex;
41
+ text-transform: uppercase;
42
+ align-items: center;
43
+ justify-content: center;
44
+ height: 60px;
45
+ background-color: $gray;
46
+ color: $black;
47
+ &--selected {
48
+ background-color: $green;
49
+ }
50
+ }
51
+ &-description {
52
+ padding: 12px 16px;
53
+ border: 1px solid $gray;
54
+ color: $gray_main;
55
+ &--selected {
56
+ border: 1px solid $green;
57
+ color: $black;
58
+ }
59
+ ul {
60
+ list-style: circle;
61
+ margin-left: 13px;
62
+ li {
63
+ margin-bottom: 8px;
64
+ }
65
+ }
66
+ }
67
+ &-icon {
68
+ width: 22px;
69
+ height: 22px;
70
+ background-position: center;
71
+ background-size: cover;
72
+ margin-right: 10px;
73
+ &--blank {
74
+ background-image: url(~/static/images/blank_tee.svg);
75
+ }
76
+ &--printed {
77
+ background-image: url(~/static/images/printed_tee.svg);
78
+ }
79
+ }
80
+ }
81
+ &__add-btn {
82
+ margin-top: 15px;
83
+ width: 100%;
84
+ display: flex;
85
+ .Btn__wrapper {
86
+ flex-grow: 1;
87
+ }
88
+ }
89
+ &__layers {
90
+ border: 2px solid $gray;
91
+ background-color: #FCFCFC;
92
+ padding: 30px;
93
+ margin-bottom: 20px;
94
+ &-info {
95
+ margin-top: 20px;
96
+ padding-top: 20px;
97
+ border-top: 2px solid $gray;
98
+ font-size: 14px;
99
+ line-height: 19px;
100
+ color: $gray_main;
101
+ p {
102
+ margin-bottom: 10px;
103
+ }
104
+ }
105
+ }
106
+ &__info {
107
+ display: flex;
108
+ margin-top: 11px;
109
+ flex-direction: column;
110
+ &-item {
111
+ margin-right: 0;
112
+ margin: 7px 0;
113
+ }
114
+ }
115
+ &__step {
116
+ height: 68px;
117
+ padding: 0 20px;
118
+ display: flex;
119
+ justify-content: center;
120
+ flex-direction: column;
121
+ width: 100%;
122
+ position: relative;
123
+ @media (max-width: $bp-large-max) {
124
+ padding: 0 10px;
125
+ }
126
+ &::after {
127
+ content: '';
128
+ position: absolute;
129
+ top: -3px;
130
+ right: 0px;
131
+ bottom: -3px;
132
+ width: 16px;
133
+ background-image: url(~/static/images/step-arrow.svg);
134
+ background-position: top right;
135
+ background-repeat: no-repeat;
136
+ background-size: cover;
137
+ z-index: 3;
138
+ }
139
+ &::before {
140
+ content: '';
141
+ position: absolute;
142
+ left: -14px;
143
+ top: 0px;
144
+ right: 15px;
145
+ bottom: 0px;
146
+ background-color: #f4f4f4;
147
+ z-index: 1;
148
+ }
149
+ &--last {
150
+ &::before {
151
+ right: 0;
152
+ }
153
+ &::after {
154
+ display: none;
155
+ }
156
+ }
157
+ &-progress {
158
+ position: relative;
159
+ z-index: 2;
160
+ }
161
+ &-number {
162
+ font-weight: 800;
163
+ font-size: 16px;
164
+ color: $black;
165
+ }
166
+ &--active {
167
+ .Wizard__step-number {
168
+ color: $wizard_primary_text;
169
+ }
170
+ &::before {
171
+ background-color: $wizard_primary_secondary;
172
+ }
173
+ &::after {
174
+ background-image: url(~/static/images/step-arrow--success.svg);
175
+ }
176
+ }
177
+ &-name {
178
+ font-weight: bold;
179
+ font-size: 14px;
180
+ color: $gray_main;
181
+ margin-top: 4px;
182
+ @media (max-width: $bp-large-max) {
183
+ font-size: 11px;
184
+ }
185
+ }
186
+ &-success {
187
+ font-size: 19px;
188
+ width: 40px;
189
+ height: 40px;
190
+ background-color: $green;
191
+ border-radius: 20px;
192
+ display: flex;
193
+ align-items: center;
194
+ justify-content: center;
195
+ }
196
+ }
197
+ &__content {
198
+ display: none;
199
+ &--visible {
200
+ display: block;
201
+ }
202
+ .ProgressSteps {
203
+ &__wrapper {
204
+ margin-top: 12px;
205
+ }
206
+ &__steps-wrapper {
207
+ padding: 0 !important;
208
+ border-bottom: none;
209
+ @media (max-width: $bp-extra-small-max) {
210
+ display: none;
211
+ }
212
+ }
213
+ &__steps {
214
+ overflow: hidden;
215
+ padding-left: 15px;
216
+ }
217
+ &__step {
218
+ height: auto;
219
+ }
220
+ }
221
+ }
222
+ }
@@ -0,0 +1,274 @@
1
+ <template>
2
+ <div class="Wizard__wrapper">
3
+ <div
4
+ v-if="preSetPrint"
5
+ class="Wizard__header Wizard__header--active">
6
+ <div class="Wizard__header-name">
7
+ PRINT OPTIONS
8
+ </div>
9
+ <div
10
+ class="Wizard__header-state"
11
+ @click="removePreSetPrint()">
12
+ remove
13
+ </div>
14
+ </div>
15
+ <div
16
+ v-else
17
+ class="Wizard__header"
18
+ :class="{
19
+ 'Wizard__header--active': isVisible
20
+ }"
21
+ @click="toggleVisible()">
22
+ <div class="Wizard__header-name">
23
+ {{ product.prePrint ? 'CLICK TO ADD ADDITIONAL PRINT OR LOGO' : 'CLICK TO ADD LOGO OR PRINT TO ORDER' }}
24
+ </div>
25
+ <div
26
+ v-if="!product.printOnly"
27
+ class="Wizard__header-state">
28
+ {{ isVisible ? 'CANCEL PRINT' : 'ADD PRINT' }}
29
+ </div>
30
+ </div>
31
+ <div
32
+ v-if="isVisible"
33
+ class="Wizard__content"
34
+ :class="{
35
+ 'Wizard__content--visible': isVisible
36
+ }">
37
+ <div
38
+ v-if="hasLayers"
39
+ class="Wizard__layers">
40
+ <wizard-print-layers
41
+ :layers="layers"
42
+ :editable="true"
43
+ @edit="editLayer($event)"
44
+ @delete="removeTemplateLayer($event)" />
45
+ <div
46
+ v-if="!preSetPrint"
47
+ class="Wizard__layers-info">
48
+ <p>1. Note final print price will be calculated once garment quantity is finalised</p>
49
+ <p>2. PDF mockup will be provided for approval prior to printing</p>
50
+ </div>
51
+ </div>
52
+ <progress-steps
53
+ v-if="(visibleSteps || !hasLayers)"
54
+ ref="progressSteps"
55
+ :steps="steps"
56
+ :has-border="hasBorder"
57
+ :visible-current-step="false"
58
+ :hidden-done-step-number="hiddenDoneStepNumber"
59
+ :step-offset="1"
60
+ :hidden-steps="hiddenSteps"
61
+ step-label="Step"
62
+ @finish="setVisibleSteps(false)">
63
+ <div
64
+ slot="step-progress"
65
+ slot-scope="{ currentStepIndex, stepOffset, index, step }"
66
+ class="Wizard__step"
67
+ :class="{
68
+ 'Wizard__step--last': (steps.length - stepOffset) === (index + 1),
69
+ 'Wizard__step--active': index <= (currentStepIndex - stepOffset)
70
+ }">
71
+ <div class="Wizard__step-progress">
72
+ <div class="Wizard__step-number">
73
+ <i
74
+ v-if="index <= (currentStepIndex - stepOffset)"
75
+ class="icon-ok"></i>
76
+ Step {{ index + 1 }}
77
+ </div>
78
+ <div class="Wizard__step-name">
79
+ {{ step }}
80
+ </div>
81
+ </div>
82
+ </div>
83
+ <div slot-scope="{ currentStep }">
84
+ <transition>
85
+ <component
86
+ :is="stepComponents[currentStep]"
87
+ ref="steps"
88
+ @next="goToNextStep"
89
+ @prev="goToPrevStep"></component>
90
+ </transition>
91
+ <div class="Wizard__info">
92
+ <info
93
+ v-if="product.prePrint"
94
+ class="Wizard__info-item">
95
+ <template slot="text">
96
+ You can add your own logo to this product as well if you order 12 or more.
97
+ </template>
98
+ </info>
99
+ <info class="Wizard__info-item">
100
+ <template slot="text">
101
+ {{ product.prePrint ? 'Once we review your order and check the logo, we will send a you PDF mockup for approval' : 'Free PDF mockup for approval' }}
102
+ </template>
103
+ </info>
104
+ <info class="Wizard__info-item">
105
+ <template slot="text">
106
+ Express* prints in 3 days
107
+ </template>
108
+ </info>
109
+ </div>
110
+ </div>
111
+ </progress-steps>
112
+ </div>
113
+ </div>
114
+ </template>
115
+
116
+ <script>
117
+ import { mapGetters, mapMutations, mapActions } from 'vuex';
118
+ import gtm from '@lancom/shared/assets/js/utils/gtm';
119
+ import Info from '@lancom/shared/components/common/info-popover';
120
+ import { getPrintAreaSizes } from '@lancom/shared/assets/js/utils/prints';
121
+ import ProgressSteps from '@lancom/shared/components/common/progress_steps/progress-steps';
122
+ import WizardPrintArea from './wizard_print_area/wizard-print-area';
123
+ import WizardPrintSize from './wizard_print_size/wizard-print-size';
124
+ import WizardPrintType from './wizard_print_type/wizard-print-type';
125
+ import WizardPrintUnderbase from './wizard_print_underbase/wizard-print-underbase';
126
+ import WizardPrintTextOrLogo from './wizard_print_text_or_logo/wizard-print-text-or-logo';
127
+ import WizardPrintReview from './wizard_print_review/wizard-print-review';
128
+ import WizardPrintLayers from './wizard_print_layers/wizard-print-layers';
129
+ import WizardPrint from './wizard_print/wizard-print';
130
+
131
+ const WIZARD_STEPS = {
132
+ PRINT: 'Print',
133
+ PRINT_AREA: 'Printable area',
134
+ PRINT_SIZE: 'Print size',
135
+ PRINT_UNDERBASE: 'Print underbase',
136
+ PRINT_TYPE: 'Print type',
137
+ TEXT_OR_LOGO: 'Text or logo',
138
+ REVIEW: 'Print review'
139
+ };
140
+ const WIZARD_STEPS_LIST = Object.keys(WIZARD_STEPS).map(k => WIZARD_STEPS[k]);
141
+
142
+ export default {
143
+ name: 'Editor',
144
+ components: {
145
+ ProgressSteps,
146
+ WizardPrintArea,
147
+ WizardPrintSize,
148
+ WizardPrintType,
149
+ WizardPrintUnderbase,
150
+ WizardPrintTextOrLogo,
151
+ WizardPrintReview,
152
+ WizardPrintLayers,
153
+ WizardPrint,
154
+ Info
155
+ },
156
+ data() {
157
+ return {
158
+ isVisible: false,
159
+ hiddenSteps: [WIZARD_STEPS.PRINT],
160
+ stepComponents: {
161
+ [WIZARD_STEPS.PRINT]: 'wizard-print',
162
+ [WIZARD_STEPS.PRINT_AREA]: 'wizard-print-area',
163
+ [WIZARD_STEPS.PRINT_SIZE]: 'wizard-print-size',
164
+ [WIZARD_STEPS.PRINT_TYPE]: 'wizard-print-type',
165
+ [WIZARD_STEPS.PRINT_UNDERBASE]: 'wizard-print-underbase',
166
+ [WIZARD_STEPS.TEXT_OR_LOGO]: 'wizard-print-text-or-logo',
167
+ [WIZARD_STEPS.REVIEW]: 'wizard-print-review'
168
+ }
169
+ };
170
+ },
171
+ props: {
172
+ hiddenDoneStepNumber: {
173
+ type: Boolean,
174
+ default: false
175
+ },
176
+ hasBorder: {
177
+ type: Boolean,
178
+ default: true
179
+ }
180
+ },
181
+ computed: {
182
+ ...mapGetters(['shop']),
183
+ ...mapGetters('product', ['product', 'layers', 'visibleSteps', 'hasLayers', 'isPrintPricing', 'availablePrintTypes', 'preSetPrint']),
184
+ steps() {
185
+ const isScreenPrint = (this.availablePrintTypes || []).includes('screen print');
186
+ return isScreenPrint ? WIZARD_STEPS_LIST.filter(s => s !== WIZARD_STEPS.PRINT_SIZE) : WIZARD_STEPS_LIST.filter(s => s !== WIZARD_STEPS.PRINT_UNDERBASE);
187
+ },
188
+ printTypes() {
189
+ return this.product.printTypes || [];
190
+ },
191
+ productPrintAreas() {
192
+ return this.product.printAreas || [];
193
+ }
194
+ },
195
+ mounted() {
196
+ if (this.product.printOnly || this.preSetPrint || this.layers.length > 0) {
197
+ this.isVisible = true;
198
+ this.setIsPrintPricing(this.isVisible);
199
+ }
200
+
201
+ this.loadHelpMessages({
202
+ shop: this.shop._id,
203
+ group: 'wizard-steps'
204
+ });
205
+ },
206
+ methods: {
207
+ ...mapActions(['loadHelpMessages']),
208
+ ...mapMutations('product', [
209
+ 'removeTemplateLayer',
210
+ 'clearWizardData',
211
+ 'addEditablePrintArea',
212
+ 'setSelectedPrintArea',
213
+ 'setSelectedPrintType',
214
+ 'setVisibleSteps',
215
+ 'setIsPrintPricing',
216
+ 'clearTemplateLayers',
217
+ 'setPreSetPrint'
218
+ ]),
219
+ ...mapMutations('layers', ['setEditableLayers']),
220
+ goToNextStep() {
221
+ if (this.$refs.progressSteps) {
222
+ this.$refs.progressSteps.goToNextStep();
223
+ }
224
+ },
225
+ goToPrevStep() {
226
+ if (this.$refs.progressSteps) {
227
+ this.$refs.progressSteps.goToPrevStep();
228
+ }
229
+ },
230
+ editLayer(layer) {
231
+ this.clearWizardData();
232
+
233
+ this.setEditableLayers([layer]);
234
+ const printArea = this.productPrintAreas.find(pa => pa._id === layer.printArea);
235
+ this.addEditablePrintArea(printArea);
236
+ const sizes = getPrintAreaSizes(printArea);
237
+ const size = sizes.find(s => s._id === layer.printSize);
238
+ this.setSelectedPrintArea({ printArea: printArea._id, size });
239
+ const type = this.product.printTypes.find(pt => pt._id === layer.printType);
240
+ this.setSelectedPrintType({ printArea: printArea._id, type });
241
+ this.setVisibleSteps(true);
242
+ },
243
+ toggleVisible() {
244
+ if (!this.product.printOnly) {
245
+ if (this.isVisible && this.visibleSteps) {
246
+ this.setVisibleSteps(false);
247
+ this.$nextTick(() => {
248
+ this.setEditableLayers([]);
249
+ this.clearWizardData();
250
+ });
251
+ } else {
252
+ this.isVisible = !this.isVisible;
253
+ this.setIsPrintPricing(this.isVisible);
254
+ this.clearTemplateLayers();
255
+ gtm.push({
256
+ event: this.isVisible ? 'start_printing_wizard' : 'cancel_printing_wizard',
257
+ item_id: this.product.SKU,
258
+ item_name: this.product.name,
259
+ item_brand: this.product.brand.name
260
+ });
261
+ }
262
+ }
263
+ },
264
+ removePreSetPrint() {
265
+ this.setPreSetPrint(null);
266
+ this.clearTemplateLayers();
267
+ }
268
+ }
269
+ };
270
+ </script>
271
+
272
+ <style lang="scss">
273
+ @import 'wizard';
274
+ </style>