project-booster-vue 9.42.1 → 9.42.2

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": "9.42.1",
3
+ "version": "9.42.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -143,7 +143,9 @@ export default defineComponent({
143
143
 
144
144
  async handleValidateClicked() {
145
145
  this.$emit('step-completed', {
146
- answers: this.payload.multiSelect.actions.VALIDATE.isAnswer ? [this.payload.multiSelect.actions.VALIDATE] : [],
146
+ answers: this.payload.multiSelect.actions.VALIDATE.isAnswer
147
+ ? [this.payload.multiSelect.actions.VALIDATE]
148
+ : null,
147
149
  nextStep: this.payload.multiSelect.actions.VALIDATE.nextStep,
148
150
  });
149
151
  },
@@ -102,6 +102,7 @@ export default defineComponent({
102
102
  computed: {
103
103
  ...mapGetters('products', {
104
104
  product: 'getCurrentProduct',
105
+ refProduct: 'getRefProduct',
105
106
  }),
106
107
  ...mapGetters('appointmentQualification', {
107
108
  sessions: 'getSessions',
@@ -109,7 +110,6 @@ export default defineComponent({
109
110
  },
110
111
  created() {
111
112
  this.$store.dispatch('products/loadProduct', {
112
- uuid: this.$route.params.refProduct || null,
113
113
  payload: this.payload.viewModel.defaultProduct,
114
114
  sessions: this.sessions,
115
115
  });
@@ -120,10 +120,16 @@ export default defineComponent({
120
120
  if (action.code === '__BACK__') {
121
121
  this.$emit('go-back');
122
122
  } else {
123
+ let product = null;
124
+
125
+ if (this.refProduct) {
126
+ product = this.product;
127
+ }
128
+
123
129
  this.$emit('step-completed', {
124
130
  answers: [
125
131
  {
126
- product: this.product,
132
+ product: product,
127
133
  },
128
134
  ],
129
135
  nextStep: action,
@@ -106,6 +106,7 @@ import PbConfigurationsImport from '../question/configurations-import/PbConfigur
106
106
  import PbCitySearch from '../question/city-search/PbCitySearch.vue';
107
107
  import PbWarningMessage from '../warning-message/PbWarningMessage.vue';
108
108
  import PbProducts from '../products/PbProducts.vue';
109
+ import PbTrezor from '../trezor/PbTrezor.vue';
109
110
  import PbIncrementalAmountInput from '../question/incremental-amount-input/PbIncrementalAmountInput.vue';
110
111
  import { areConditionsValid } from '../../services/scenarioConditionals';
111
112
  import {
@@ -146,6 +147,7 @@ export default defineComponent({
146
147
  PbWarningMessage,
147
148
  PbIncrementalAmountInput,
148
149
  PbProducts,
150
+ PbTrezor,
149
151
  },
150
152
 
151
153
  props: {
@@ -1,5 +1,13 @@
1
1
  <template>
2
2
  <m-flex class="pb-trezor" direction="column">
3
+ <m-link
4
+ v-if="showBackButton"
5
+ :left-icon="BACK_ICON"
6
+ :label="payload.viewModel.backLabel || 'Retour'"
7
+ class="pb-trezor__back-button"
8
+ @click.once="$emit('go-back')"
9
+ />
10
+
3
11
  <div class="pb-trezor__title" v-if="payload?.viewModel?.label">
4
12
  {{ payload.viewModel.label }}
5
13
  </div>
@@ -114,9 +122,12 @@ import { useStore } from 'vuex';
114
122
  import MFlex from './../mozaic/flex/MFlex.vue';
115
123
  import MButton from '../mozaic/buttons/MButton.vue';
116
124
  import MCheckbox from '../mozaic/checkbox/MCheckbox.vue';
125
+ import MLink from '../mozaic/link/MLink.vue';
117
126
  import MTextInput from '../mozaic/text-input/MTextInput.vue';
118
127
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
119
128
  import { object, string, boolean } from 'yup';
129
+ const BACK_ICON =
130
+ 'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
120
131
 
121
132
  export default defineComponent({
122
133
  name: 'PbTrezor',
@@ -125,6 +136,7 @@ export default defineComponent({
125
136
  MButton,
126
137
  MTextInput,
127
138
  MCheckbox,
139
+ MLink,
128
140
  },
129
141
  props: {
130
142
  /**
@@ -167,7 +179,7 @@ export default defineComponent({
167
179
  },
168
180
  setup(props, { emit }) {
169
181
  const store = useStore();
170
- let formData = ref({
182
+ let formData = ref<any>({
171
183
  values: {
172
184
  lastname: '',
173
185
  firstname: '',
@@ -209,33 +221,32 @@ export default defineComponent({
209
221
 
210
222
  const validateAllFields = async (action: any) => {
211
223
  await validationSchema.validate(formData.value.values).then(async () => {
212
- const sending = await store.dispatch(
213
- 'trezor/sendFormData',
214
- {
224
+ const sending = await store.dispatch('trezor/sendFormData', {
225
+ payload: {
215
226
  customer: {
216
227
  lastname: formData.value.values.lastname,
217
228
  firstname: formData.value.values.firstname,
218
- zipcode: formData.value.values.zipcode,
229
+ zip: formData.value.values.zipcode,
219
230
  email: formData.value.values.email,
220
231
  phone: formData.value.values.phone,
221
232
  },
222
233
  optin: formData.value.values.optin,
223
234
  optinPartners: formData.value.values.optinPartners,
224
235
  },
225
- props.payload.viewModel.typeLead,
226
- );
236
+ typeLead: props.payload.viewModel.typeLead,
237
+ });
227
238
 
228
239
  if (sending) {
229
240
  emit('step-completed', {
230
- answers: [],
231
- nextStep: action,
241
+ answers: null,
242
+ nextStep: action.action,
232
243
  });
233
244
  }
234
245
  });
235
246
  };
236
247
 
237
248
  const callAction = async (item: any) => {
238
- if (item.action.type === 'submit') {
249
+ if (item.action.type === 'STEP') {
239
250
  await validateAllFields(item);
240
251
  }
241
252
  };
@@ -244,6 +255,7 @@ export default defineComponent({
244
255
  formData,
245
256
  callAction,
246
257
  validate,
258
+ BACK_ICON,
247
259
  };
248
260
  },
249
261
  });
@@ -260,6 +272,20 @@ $responsive-breakpoint: 'm';
260
272
  .pb-trezor {
261
273
  margin: 0 auto;
262
274
  max-width: 1024px;
275
+
276
+ &__back-button {
277
+ align-self: flex-start;
278
+ opacity: 1;
279
+ padding: $mu100 0 $mu100 $mu100;
280
+ transition: opacity 0.15s 0.5s;
281
+ z-index: 2;
282
+
283
+ &--hidden {
284
+ opacity: 0;
285
+ pointer-events: none;
286
+ }
287
+ }
288
+
263
289
  &__title {
264
290
  @include set-font-face('semi-bold');
265
291
  @include set-font-scale('08', 'm');
@@ -269,7 +295,7 @@ $responsive-breakpoint: 'm';
269
295
 
270
296
  @include set-from-screen($responsive-breakpoint) {
271
297
  margin: auto;
272
- padding: $mu250 0 $mu250 0;
298
+ padding: 0 0 $mu250 0;
273
299
  text-align: center;
274
300
  }
275
301
  }
@@ -9,7 +9,8 @@
9
9
  "type": "button",
10
10
  "label": "Envoyer",
11
11
  "action": {
12
- "type": "submit"
12
+ "type": "STEP",
13
+ "code": "STEP_CODE"
13
14
  },
14
15
  "bordered": false
15
16
  }
@@ -37,10 +37,14 @@ export default {
37
37
  commit('setRefProduct', ref);
38
38
  },
39
39
  async loadProduct({ commit, state }: ProductContext, { payload, sessions }: { payload: object; sessions: any }) {
40
- const product = await getProductById(state.refProduct, (sessions && sessions.storeId) || null);
40
+ if (state.refProduct) {
41
+ const product = await getProductById(state.refProduct, (sessions && sessions.storeId) || null);
41
42
 
42
- if (product) {
43
- commit('setCurrentProduct', { ...payload, ...product });
43
+ if (product) {
44
+ commit('setCurrentProduct', { ...payload, ...product });
45
+ } else {
46
+ commit('setCurrentProduct', payload);
47
+ }
44
48
  } else {
45
49
  commit('setCurrentProduct', payload);
46
50
  }
@@ -30,7 +30,7 @@ export default {
30
30
  { commit, state }: TrezorContext,
31
31
  { payload, typeLead }: { payload: object; typeLead: string },
32
32
  ) => {
33
- if (!typeLead) {
33
+ if (typeLead) {
34
34
  const sendData = await sendTrezorForm(typeLead, payload);
35
35
  commit('setFormData', sendData);
36
36
  }
@@ -8,6 +8,7 @@ import { PlannerState } from '@/stores/modules/plannerStore';
8
8
  import { ProjectsState } from '@/stores/modules/projectsStore';
9
9
  import { ToolsState } from '@/stores/modules/toolsStore';
10
10
  import { ProductState } from './modules/productsStore';
11
+ import { TrezorState } from './modules/trezorStore';
11
12
 
12
13
  export interface State {
13
14
  appointmentQualification: AppointmentQualificationState;
@@ -20,4 +21,5 @@ export interface State {
20
21
  projects: ProjectsState;
21
22
  tools: ToolsState;
22
23
  products: ProductState;
24
+ trezor: TrezorState;
23
25
  }