project-booster-vue 10.22.0 → 10.22.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": "10.22.0",
3
+ "version": "10.22.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { ref } from 'vue';
3
+ import { useStore } from 'vuex';
3
4
  import MLink from '../mozaic/link/MLink.vue';
4
5
  import MButton from '../mozaic/buttons/MButton.vue';
5
6
 
@@ -7,17 +8,24 @@ const BACK_ICON =
7
8
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
8
9
  const props = defineProps(['payload']);
9
10
  const emit = defineEmits(['go-back']);
10
- const moveDate = ref(null);
11
+ const store = useStore();
11
12
 
12
- function handleChange(event) {
13
- moveDate.value = event.target.value;
14
- }
13
+ const moveDate = ref(store.state.answers.moveDate);
15
14
 
16
- function handleSubmit() {
15
+ function commitStep(moveDateValue) {
16
+ store.commit('setMoveDate', moveDateValue);
17
17
  emit('step-completed', {
18
- answers: [{ moveDate: moveDate.value }],
18
+ answers: [{ moveDate: moveDateValue }],
19
19
  });
20
20
  }
21
+
22
+ function handleSubmit() {
23
+ commitStep(moveDate.value);
24
+ }
25
+
26
+ function skipQuestion() {
27
+ commitStep(null);
28
+ }
21
29
  </script>
22
30
 
23
31
  <template>
@@ -26,14 +34,14 @@ function handleSubmit() {
26
34
  <div class="date-picker">
27
35
  <span class="title">{{ props.payload.viewModel.title }}</span>
28
36
  <span class="subtile">{{ props.payload.viewModel.subtitle }}</span>
29
- <input type="date" @input="handleChange" class="mc-text-input mc-field__input input-text-date" />
37
+ <input type="date" v-model="moveDate" class="mc-text-input mc-field__input input-text-date" />
30
38
  <MButton
31
39
  class="button"
32
40
  :label="props.payload.viewModel.actionLabel"
33
41
  @click="handleSubmit"
34
42
  :disabled="!moveDate"
35
43
  />
36
- <m-link class="skip-link" :label="props.payload.viewModel.skipLabel" @click.once="handleSubmit" />
44
+ <m-link class="skip-link" :label="props.payload.viewModel.skipLabel" @click.once="skipQuestion" />
37
45
  </div>
38
46
  </div>
39
47
  </template>
@@ -153,6 +153,15 @@ const submitAnswers = ({ nextStep }: { nextStep: any }) => {
153
153
  });
154
154
  }
155
155
 
156
+ let selectedNextStep;
157
+ if (props.payload?.multiSelect) {
158
+ selectedNextStep = props.payload.multiSelect.actions.VALIDATE.nextStep;
159
+ } else if (props.payload?.answers[answersToSubmit[0].value]?.nextStep) {
160
+ selectedNextStep = props.payload.answers[answersToSubmit[0].value].nextStep;
161
+ } else {
162
+ selectedNextStep = nextStep;
163
+ }
164
+
156
165
  /**
157
166
  * Emitted when step is completed
158
167
  * @event dynamic event name according to completedEventName prop
@@ -160,7 +169,7 @@ const submitAnswers = ({ nextStep }: { nextStep: any }) => {
160
169
  */
161
170
  emit(props.completedEventName, {
162
171
  answers: answersToSubmit,
163
- nextStep: nextStep,
172
+ nextStep: selectedNextStep,
164
173
  });
165
174
  };
166
175