project-booster-vue 9.42.4 → 9.42.6
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 +1 -1
- package/src/components/products/PbProducts.vue +1 -1
- package/src/components/restitution/PbRestitutionList.vue +21 -30
- package/src/components/scenario/PbScenario.vue +4 -1
- package/src/stores/modules/productsStore.ts +12 -2
- package/src/types/pb/Product.ts +15 -0
- package/src/types/pb/Restitution.ts +0 -1
package/package.json
CHANGED
|
@@ -111,7 +111,7 @@ export default defineComponent({
|
|
|
111
111
|
created() {
|
|
112
112
|
this.$store.dispatch('products/loadProduct', {
|
|
113
113
|
payload: this.payload.viewModel.defaultProduct,
|
|
114
|
-
|
|
114
|
+
storeId: this.metadata.storeId || '',
|
|
115
115
|
});
|
|
116
116
|
},
|
|
117
117
|
methods: {
|
|
@@ -50,13 +50,7 @@
|
|
|
50
50
|
:label="button.label"
|
|
51
51
|
@click="callAction(button.action)"
|
|
52
52
|
:theme="button.bordered ? 'bordered' : 'solid'"
|
|
53
|
-
v-if="
|
|
54
|
-
/>
|
|
55
|
-
<m-button
|
|
56
|
-
:label="button.label"
|
|
57
|
-
@click="callAction(button.action)"
|
|
58
|
-
:theme="button.bordered ? 'bordered' : 'solid'"
|
|
59
|
-
v-if="checkConditional(button.conditions) && button.conditions"
|
|
53
|
+
v-if="areConditionsValid(button.conditions)"
|
|
60
54
|
/>
|
|
61
55
|
</div>
|
|
62
56
|
<div class="pb-restitution-list__footer__save">
|
|
@@ -145,7 +139,7 @@ import MLink from '../mozaic/link/MLink.vue';
|
|
|
145
139
|
import PbProjectItemSave from '../projects/project-item-save/PbProjectItemSave.vue';
|
|
146
140
|
import MNotification from '../mozaic/notifications/MNotification.vue';
|
|
147
141
|
import { NotificationOptions } from '@/types/pb/Notification';
|
|
148
|
-
import { RestitutionPayload, RestitutionPayloadAction } from '@/types/pb/Restitution';
|
|
142
|
+
import { RestitutionPayload, RestitutionPayloadAction, RestitutionPayloadCallToAction } from '@/types/pb/Restitution';
|
|
149
143
|
import { ScenarioStepAnswer } from '@/types/pb/Scenario';
|
|
150
144
|
import PbRestitutionListBlock from './PbRestitutionListBlock.vue';
|
|
151
145
|
import { Project } from '../../types/pb/Project';
|
|
@@ -169,6 +163,7 @@ export default defineComponent({
|
|
|
169
163
|
dialogContent: null,
|
|
170
164
|
showSaveProjectItem: false,
|
|
171
165
|
notifications: [] as NotificationOptions[],
|
|
166
|
+
displayedCta: [] as RestitutionPayloadCallToAction[],
|
|
172
167
|
};
|
|
173
168
|
},
|
|
174
169
|
// eslint-disable-next-line vue/order-in-components
|
|
@@ -220,22 +215,10 @@ export default defineComponent({
|
|
|
220
215
|
},
|
|
221
216
|
created() {
|
|
222
217
|
if (this.payload?.callToActions) {
|
|
223
|
-
|
|
224
|
-
const saveAction = Object.values(this.payload.callToActions).find((cta) => {
|
|
225
|
-
return (
|
|
226
|
-
areConditionsValid(cta.conditions!, this.answers, this.runtimeOptions) &&
|
|
227
|
-
cta.action?.type === 'MODAL' &&
|
|
228
|
-
cta.action?.component === 'PbProjectItemSave'
|
|
229
|
-
);
|
|
230
|
-
});
|
|
231
|
-
this.showSaveProjectItem = this.showSaveEstimate;
|
|
232
|
-
}
|
|
218
|
+
this.showSaveProjectItem = this.showSaveEstimate;
|
|
233
219
|
}
|
|
234
220
|
},
|
|
235
221
|
methods: {
|
|
236
|
-
checkConditional(cta: any) {
|
|
237
|
-
return areConditionsValid(cta, this.answers, this.runtimeOptions);
|
|
238
|
-
},
|
|
239
222
|
handleShowDialog(content: any) {
|
|
240
223
|
this.dialogContent = content;
|
|
241
224
|
this.showDialog = !this.showDialog;
|
|
@@ -264,30 +247,38 @@ export default defineComponent({
|
|
|
264
247
|
handleDialogClose() {
|
|
265
248
|
this.showSaveProjectItem = false;
|
|
266
249
|
},
|
|
267
|
-
callAction(action:
|
|
250
|
+
callAction(action: any) {
|
|
268
251
|
if (action.type === 'MODAL') {
|
|
269
252
|
if (action.component === 'PbProjectItemSave') {
|
|
270
253
|
if (this.runtimeOptions.isLoggedIn === true) {
|
|
271
254
|
this.showSaveProjectItem = true;
|
|
272
255
|
}
|
|
273
256
|
|
|
257
|
+
this.$store.dispatch('sendEventToBus', {
|
|
258
|
+
code: 'RESTITUTION-ACTION-CLICKED',
|
|
259
|
+
payload: {
|
|
260
|
+
context: {
|
|
261
|
+
answers: this.answers,
|
|
262
|
+
call: action,
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
|
|
274
267
|
this.$emit('click-save-item', {
|
|
275
268
|
answers: [],
|
|
276
269
|
action: action,
|
|
277
270
|
});
|
|
278
|
-
} else
|
|
279
|
-
this.$emit('
|
|
271
|
+
} else {
|
|
272
|
+
this.$emit('step-completed', {
|
|
280
273
|
answers: [],
|
|
281
|
-
|
|
274
|
+
nextStep: action,
|
|
282
275
|
});
|
|
283
276
|
}
|
|
284
|
-
} else {
|
|
285
|
-
this.$emit('step-completed', {
|
|
286
|
-
answers: [],
|
|
287
|
-
nextStep: action,
|
|
288
|
-
});
|
|
289
277
|
}
|
|
290
278
|
},
|
|
279
|
+
areConditionsValid(conditions: string[]) {
|
|
280
|
+
return areConditionsValid(conditions, this.answers, this.runtimeOptions);
|
|
281
|
+
},
|
|
291
282
|
},
|
|
292
283
|
});
|
|
293
284
|
</script>
|
|
@@ -286,7 +286,10 @@ export default defineComponent({
|
|
|
286
286
|
} else {
|
|
287
287
|
emitEventToPipeline('STEP-STARTED', step);
|
|
288
288
|
}
|
|
289
|
-
if (
|
|
289
|
+
if (
|
|
290
|
+
['PbRestitution', 'PbRestitutionList'].includes(state.value.currentStep.component || '') &&
|
|
291
|
+
!props.runtimeOptions.projectMode
|
|
292
|
+
) {
|
|
290
293
|
emitEventToPipeline('RESTITUTION-LANDED', state.value.answers);
|
|
291
294
|
}
|
|
292
295
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ActionContext } from 'vuex';
|
|
2
2
|
import { State } from '@/stores/state';
|
|
3
3
|
import { getProductById } from '../../services/api/productApi';
|
|
4
|
+
import { ProductPayload } from '@/types/pb/Product';
|
|
4
5
|
|
|
5
6
|
export interface ProductState {
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -36,12 +37,21 @@ export default {
|
|
|
36
37
|
updateRefProduct({ commit }: ProductContext, { ref }: { ref: string }) {
|
|
37
38
|
commit('setRefProduct', ref);
|
|
38
39
|
},
|
|
39
|
-
async loadProduct(
|
|
40
|
+
async loadProduct(
|
|
41
|
+
{ commit, state }: ProductContext,
|
|
42
|
+
{ payload, storeId }: { payload: ProductPayload; storeId: string },
|
|
43
|
+
) {
|
|
40
44
|
if (state.refProduct) {
|
|
41
45
|
const product = await getProductById(state.refProduct, storeId);
|
|
42
46
|
|
|
43
47
|
if (product) {
|
|
44
|
-
|
|
48
|
+
const formattedProduct = {
|
|
49
|
+
code: product.code || null,
|
|
50
|
+
photo: product.photo || payload.photo,
|
|
51
|
+
designation: product.designation || payload.designation,
|
|
52
|
+
price: product.price || null,
|
|
53
|
+
};
|
|
54
|
+
commit('setCurrentProduct', formattedProduct);
|
|
45
55
|
} else {
|
|
46
56
|
commit('setCurrentProduct', payload);
|
|
47
57
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ProductPayload {
|
|
2
|
+
code?: string;
|
|
3
|
+
photo?: string;
|
|
4
|
+
designation?: string;
|
|
5
|
+
price?: ProductPricePayload;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ProductPricePayload {
|
|
9
|
+
currency?: string;
|
|
10
|
+
discount?: string;
|
|
11
|
+
initialUnitAmount?: number;
|
|
12
|
+
initialUnitAmountNoTax?: number;
|
|
13
|
+
unitAmount?: number;
|
|
14
|
+
unitAmountNoTax?: number;
|
|
15
|
+
}
|