project-booster-vue 10.23.4 → 10.23.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "10.23.4",
3
+ "version": "10.23.5",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -18,10 +18,10 @@
18
18
 
19
19
  <m-flex class="pb-products__body" direction="column" align-items="center" v-if="product">
20
20
  <m-flex class="pb-products__body__item" direction="column" align-items="center" justify-content="center">
21
- <div class="pb-products__body__item__thumbnail">
21
+ <div class="pb-products__body__item__thumbnail" v-if="product.photo">
22
22
  <img :src="product.photo" alt="" />
23
23
  </div>
24
- <div class="pb-products__body__item__title">{{ product.designation }}</div>
24
+ <div class="pb-products__body__item__title" v-if="product.designation">{{ product.designation }}</div>
25
25
  </m-flex>
26
26
 
27
27
  <m-flex class="pb-products__container--button" direction="column" align-items="center" justify-content="center">
@@ -12,22 +12,22 @@
12
12
  </m-link>
13
13
  </div>
14
14
 
15
- <div class="pb-products__body row-flex column" v-if="product">
15
+ <div class="pb-products__body row-flex column">
16
16
  <div class="pb-products__title">
17
17
  {{ payload.viewModel.label }}
18
18
  </div>
19
19
 
20
- <div class="pb-products__body__item" v-if="product.designation">
20
+ <div class="pb-products__body__item" v-if="product">
21
21
  <div class="pb-products__body__item__thumbnail" v-if="product.photo">
22
22
  <img :src="product.photo" alt="photo du produit" />
23
23
  </div>
24
- <div class="pb-products__body__item__title">{{ product.designation }}</div>
24
+ <div class="pb-products__body__item__title" v-if="designation">{{ designation }}</div>
25
25
  </div>
26
26
  <div class="pb-products__body__item" v-else>
27
- <div class="pb-products__body__item__thumbnail">
27
+ <div class="pb-products__body__item__thumbnail" v-if="payload.viewModel.defaultProduct.photo">
28
28
  <img :src="payload.viewModel.defaultProduct.photo" alt="photo du produit" />
29
29
  </div>
30
- <div class="pb-products__body__item__title">{{ payload.viewModel.defaultProduct.designation }}</div>
30
+ <div class="pb-products__body__item__title">{{ designation }}</div>
31
31
  </div>
32
32
 
33
33
  <div class="pb-products__container--button">
@@ -61,24 +61,11 @@ const emit = defineEmits(['go-back', 'step-completed']);
61
61
 
62
62
  const store = useStore();
63
63
  const metadata = store.getters['metaData/metaData'];
64
- const refProduct: string = store.getters['products/getRefProduct'];
65
- const product = ref<Product>(store.getters['products/getCurrentProduct']);
66
-
67
- if (!product.value) {
68
- product.value = {
69
- code: 'Code du produit',
70
- designation: 'Désignation du produit',
71
- photo: '',
72
- price: {
73
- unitAmount: 0,
74
- initialUnitAmount: 0,
75
- unitAmountNoTax: 0,
76
- initialUnitAmountNoTax: 0,
77
- currency: 'EURO',
78
- discount: null,
79
- },
80
- };
81
- }
64
+
65
+ const refProduct = ref<string>();
66
+ const product = ref<Product>();
67
+
68
+ const designation = ref<string>();
82
69
 
83
70
  const props = defineProps({
84
71
  /**
@@ -144,6 +131,11 @@ onMounted(() => {
144
131
  storeId: metadata && metadata.storeId ? metadata.storeId : '',
145
132
  });
146
133
  }
134
+
135
+ refProduct.value = store.getters['products/getRefProduct'];
136
+ product.value = store.getters['products/getCurrentProduct'];
137
+
138
+ designation.value = product.value?.designation || props.payload.viewModel.defaultProduct.designation || '';
147
139
  });
148
140
 
149
141
  /**
@@ -155,20 +147,21 @@ const callAction = (action: PayloadAction) => {
155
147
  if (action.code === '__BACK__') {
156
148
  emit('go-back');
157
149
  } else {
158
- let productToSend = null;
159
-
160
- if (refProduct) {
161
- productToSend = product.value;
150
+ if (refProduct.value && product.value) {
151
+ emit('step-completed', {
152
+ answers: [
153
+ {
154
+ product: product.value,
155
+ },
156
+ ],
157
+ nextStep: action,
158
+ });
159
+ } else {
160
+ emit('step-completed', {
161
+ answers: [{}],
162
+ nextStep: action,
163
+ });
162
164
  }
163
-
164
- emit('step-completed', {
165
- answers: [
166
- {
167
- product: productToSend,
168
- },
169
- ],
170
- nextStep: action,
171
- });
172
165
  }
173
166
  }
174
167
  };
@@ -32,10 +32,11 @@ export default {
32
32
  updateRefProduct({ commit }: ProductContext, { ref }: { ref: string }) {
33
33
  commit('setRefProduct', ref);
34
34
  },
35
+
35
36
  async loadProduct(
36
37
  { commit, state }: ProductContext,
37
38
  { payload, storeId }: { payload: ProductPayload; storeId: string },
38
- ) {
39
+ ): Promise<void> {
39
40
  if (state.refProduct) {
40
41
  const product: Product | null = await getProductById(state.refProduct, storeId);
41
42