project-booster-vue 8.123.8 → 8.124.0

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 (42) hide show
  1. package/package.json +6 -6
  2. package/src/components/appointment/PbAppointment.stories.mdx +12 -7
  3. package/src/components/appointment/PbAppointment.vue +2 -3
  4. package/src/components/cards/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-cards-pb-card-/360/237/247/254-features-degradations-1-snap.png +0 -0
  5. package/src/components/empty-state/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-ui-pb-empty-state-/360/237/246/240-showcase-button-icons-1-snap.png +0 -0
  6. package/src/components/media/PbMedia.stories.mdx +15 -4
  7. package/src/components/media/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-documents-media-pb-media-/360/237/246/240-empty-state-1-snap.png +0 -0
  8. package/src/components/media/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-documents-media-pb-media-/360/237/246/240-empty-state-document-1-snap.png +0 -0
  9. package/src/components/media/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-documents-media-pb-media-/360/237/246/240-with-media-1-snap.png +0 -0
  10. package/src/components/media/detail/PbMediaDetail.stories.mdx +9 -4
  11. package/src/components/media/list/PbMediaList.stories.mdx +6 -2
  12. package/src/components/media/upload/PbMediaUpload.stories.mdx +9 -5
  13. package/src/components/progression-price/PbSmartProgressionPrice.vue +12 -3
  14. package/src/components/projects/project-hub/PbProjectHub.stories.mdx +2 -0
  15. package/src/components/projects/project-hub/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-projects-pb-project-hub-/360/237/246/240-features-documents-media-showcase-deletion-fails-1-snap.png +0 -0
  16. package/src/components/projects/project-hub/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-projects-pb-project-hub-/360/237/246/240-features-documents-media-showcase-upload-fails-1-snap.png +0 -0
  17. package/src/components/projects/project-hub/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-projects-pb-project-hub-/360/237/246/240-features-documents-media-showcase-with-media-documents-1-snap.png +0 -0
  18. package/src/components/projects/projects/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-projects-pb-projects-/360/237/246/240-showcase-autoscroll-to-estimates-1-snap.png +0 -0
  19. package/src/components/projects/projects/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-components-projects-pb-projects-/360/237/246/240-showcase-project-creation-loader-1-snap.png +0 -0
  20. package/src/components/question/PbQuestion.vue +6 -1
  21. package/src/components/question/configurations-import/PbConfigurationsImport.vue +32 -14
  22. package/src/components/question/configurations-import/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-scenario-questions-pb-configurations-import-/360/237/246/240-101-sandbox-1-snap.png +0 -0
  23. package/src/components/question/configurations-import/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-scenario-questions-pb-configurations-import-/360/237/246/240-error-while-importing-simulation-1-snap.png +0 -0
  24. package/src/components/question/configurations-import/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-scenario-questions-pb-configurations-import-/360/237/246/240-with-simulations-linked-1-snap.png +0 -0
  25. package/src/components/question/upload-document/PbUploadDocument-Features-ShowMore.stories.json +56 -109
  26. package/src/components/question/upload-document/PbUploadDocument-Features-ShowMore.stories.mdx +14 -28
  27. package/src/components/question/upload-document/PbUploadDocument-Features-StartOpen.stories.json +51 -66
  28. package/src/components/question/upload-document/PbUploadDocument-Features-StartOpen.stories.mdx +15 -29
  29. package/src/components/question/upload-document/PbUploadDocument.stories.mdx +15 -4
  30. package/src/components/question/upload-document/PbUploadDocument.vue +119 -288
  31. package/src/components/question/upload-document/__snapshots__/storyshots-puppeteer-test-puppeteer-js-image-storyshots-project-booster-scenario-questions-pb-upload-document-/360/237/246/240-feature-show-more-documents-1-snap.png +0 -0
  32. package/src/components/question/upload-document/default-payload.json +2 -11
  33. package/src/components/question/upload-document/pictures-payload.json +2 -9
  34. package/src/components/scenario/PbScenario.vue +1 -2
  35. package/src/components/scenario/scenarii/appointment-qualification-kitchen.json +13 -5
  36. package/src/services/api/documentsApi.js +11 -4
  37. package/src/services/api/mocks/configurationsMock.js +1 -1
  38. package/src/stores/modules/appointmentQualificationStore.js +0 -132
  39. package/src/stores/modules/mediaDocumentsStore.js +542 -0
  40. package/src/stores/store.js +6 -4
  41. package/src/stores/modules/documentsStore.js +0 -443
  42. package/src/stores/modules/mediaStore.js +0 -383
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "8.123.8",
3
+ "version": "8.124.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "test:unit": "vue-cli-service test:unit --forceExit --detectOpenHandles",
@@ -29,11 +29,11 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@contentful/rich-text-html-renderer": "15.0.0",
32
- "@mozaic-ds/css-dev-tools": "1.18.0",
33
- "@mozaic-ds/icons": "1.14.0",
34
- "@mozaic-ds/styles": "1.19.0",
35
- "@mozaic-ds/tokens": "1.19.0",
36
- "@mozaic-ds/web-fonts": "1.18.0",
32
+ "@mozaic-ds/css-dev-tools": "1.24.0",
33
+ "@mozaic-ds/icons": "1.20.0",
34
+ "@mozaic-ds/styles": "1.24.1",
35
+ "@mozaic-ds/tokens": "1.22.0",
36
+ "@mozaic-ds/web-fonts": "1.22.0",
37
37
  "@vue/babel-preset-app": "4.5.13",
38
38
  "@vue/compat": "3.2.6",
39
39
  "@xstate/vue": "0.8.1",
@@ -1,6 +1,6 @@
1
1
  import PbAppointment from './PbAppointment';
2
2
  import PbScenario from '../scenario/PbScenario';
3
- import { Anchor, Story, Preview, Meta, Props, ArgsTable, Source, Canvas } from '@storybook/addon-docs';
3
+ import { Story, Meta, Canvas } from '@storybook/addon-docs';
4
4
  import DEFAULT_PAYLOAD from '../scenario/scenarii/appointment-qualification-kitchen.json';
5
5
  import PREVIOUS_CONTEXT from '../../services/api/mocks/jsons/appointmentsRecovery.json';
6
6
  import { nestedAppDecorator } from '../../../.storybook/nested-app-decorator';
@@ -56,6 +56,10 @@ export const TemplateSandbox = (args, { argTypes }) => {
56
56
  components: { PbAppointment },
57
57
  setup() {
58
58
  const store = useStore();
59
+ store.dispatch('documentsPlans/updateContext', { type: 'DOCUMENT', subType: 'PLAN' });
60
+ store.dispatch('documentsPictures/updateContext', { type: 'DOCUMENT', subType: 'PHOTO' });
61
+ store.dispatch('documentsPlans/updateMediaPerPageCount', 3);
62
+ store.dispatch('documentsPictures/updateMediaPerPageCount', 3);
59
63
  store.dispatch('appointmentQualification/initSessions', {
60
64
  appointmentQualificationFormStructure: DEFAULT_PAYLOAD,
61
65
  businessUnit: '001',
@@ -100,6 +104,7 @@ export const TemplateSandbox = (args, { argTypes }) => {
100
104
  '/api/inhabitant-projects/:inhabitantProjectId/simulations',
101
105
  getEmptyConfigurationsByProjectIdResolver,
102
106
  ),
107
+ rest.get('/api/inhabitant-projects/:inhabitantProjectId/simulations', getConfigurationsByProjectIdResolver),
103
108
  rest.post('/api/inhabitant-projects/:inhabitantProjectId/simulations/:simulationId', notContentResolver),
104
109
  rest.get('/api/inhabitant-projects/:projectId/documents/:documentId/file', getDocumentsImageFileResolver),
105
110
  rest.post('/api/inhabitant-projects/:projectId/documents', uploadDocumentResolver),
@@ -119,14 +124,14 @@ export const TemplateSandbox = (args, { argTypes }) => {
119
124
  ## Appointment Recovery
120
125
 
121
126
  export const previousState = {
122
- answers: PREVIOUS_CONTEXT.answers,
127
+ answers: PREVIOUS_CONTEXT.results[0].serializedContext.answers,
123
128
  refreshSteps: true,
124
129
  history: {
125
- stepIndex: PREVIOUS_CONTEXT.stepIndex,
126
- steps: PREVIOUS_CONTEXT.stepHistory,
130
+ stepIndex: PREVIOUS_CONTEXT.results[0].serializedContext.stepIndex,
131
+ steps: PREVIOUS_CONTEXT.results[0].serializedContext.stepHistory,
127
132
  },
128
- currentStep: PREVIOUS_CONTEXT.currentStep,
129
- displayedStep: PREVIOUS_CONTEXT.currentStep,
133
+ currentStep: PREVIOUS_CONTEXT.results[0].serializedContext.currentStep,
134
+ displayedStep: PREVIOUS_CONTEXT.results[0].serializedContext.currentStep,
130
135
  };
131
136
 
132
137
  <Canvas>
@@ -134,7 +139,7 @@ export const previousState = {
134
139
  name="Feature - Appointment Recovery"
135
140
  inline={false}
136
141
  height="758px"
137
- args={{ scenarios: DEFAULT_PAYLOAD }}
142
+ args={{ scenarios: DEFAULT_PAYLOAD, runtimeOptions: { hasConfigurations: true }, previousState }}
138
143
  parameters={{
139
144
  controls: { disable: true },
140
145
  storyshots: { disable: true },
@@ -2,7 +2,7 @@
2
2
  <m-flex full-width align-items="center" justify-content="center" direction="column" class="pb-appointment">
3
3
  <pb-loader
4
4
  class="pb-appointment__loader"
5
- v-if="createProjectError || isLoadingProject"
5
+ v-if="createProjectError || isLoadingProject || !scenarios"
6
6
  title-loading="Chargement"
7
7
  title-error="Nous n’avons pas pu charger la page"
8
8
  subtitle-error="Une erreur est survenue"
@@ -13,7 +13,7 @@
13
13
  />
14
14
  <m-flex v-else full-width align-items="center" justify-content="center" direction="column">
15
15
  <pb-scenario
16
- :scenarios="updatedScenario"
16
+ :scenarios="scenarios"
17
17
  :runtime-options="runtimeOptions"
18
18
  :previous-state="previousState"
19
19
  min-height="100vh"
@@ -60,7 +60,6 @@ export default {
60
60
 
61
61
  computed: {
62
62
  ...mapGetters('appointmentQualification', {
63
- updatedScenario: 'getScenarios',
64
63
  isLoadingProject: 'isLoadingProject',
65
64
  createProjectError: 'getCreateProjectError',
66
65
  appointmentLinkedError: 'getAppointmentLinkedError',
@@ -1,7 +1,6 @@
1
1
  import { Meta, Canvas, Story } from '@storybook/addon-docs';
2
2
  import PbMedia from './PbMedia';
3
- import documentsStore from '../../stores/modules/documentsStore';
4
- import mediaStore from '../../stores/modules/mediaStore';
3
+ import mediaDocumentsStore from '../../stores/modules/mediaDocumentsStore';
5
4
  import {
6
5
  getAllMediaPaginationResolver,
7
6
  getMediaThumbnailResolver,
@@ -20,6 +19,8 @@ import { nestedAppDecorator } from '../../../.storybook/nested-app-decorator';
20
19
  import DOCUMENTS_LIST_PAYLOAD from './list/documents-list-payload.json';
21
20
  import DOCUMENT_DETAIL_PAYLOAD from './detail/document-detail-payload.json';
22
21
  import DOCUMENT_UPLOAD_PAYLOAD from './upload/document-upload-payload.json';
22
+ import cloneDeep from 'lodash.clonedeep';
23
+ import { useStore } from 'vuex';
23
24
 
24
25
  <Meta
25
26
  title="Project Booster/Components/Documents & Media/PbMedia 🦠"
@@ -31,8 +32,8 @@ import DOCUMENT_UPLOAD_PAYLOAD from './upload/document-upload-payload.json';
31
32
  nestedAppDecorator(
32
33
  {
33
34
  modules: {
34
- documents: documentsStore,
35
- media: mediaStore,
35
+ documents: cloneDeep(mediaDocumentsStore),
36
+ media: cloneDeep(mediaDocumentsStore),
36
37
  },
37
38
  getters: {
38
39
  getProject(state) {
@@ -61,6 +62,11 @@ export const TemplateSandbox = (args, { argTypes }) => {
61
62
  return {
62
63
  props: Object.keys(argTypes),
63
64
  components: { PbMedia },
65
+ setup() {
66
+ const store = useStore();
67
+ store.dispatch('documents/updateContext', { type: 'DOCUMENT' });
68
+ store.dispatch('media/updateContext', { type: 'MEDIA' });
69
+ },
64
70
  template: `<div style="flex-direction: column;display: flex;place-content: flex-start;align-items: center;min-height: 100vh;width: 100%;">
65
71
  <pb-media />
66
72
  </div>`,
@@ -88,6 +94,7 @@ export const TemplateSandbox = (args, { argTypes }) => {
88
94
  {{
89
95
  components: { PbMedia },
90
96
  created() {
97
+ this.$store.dispatch('media/updateContext', { type: 'MEDIA' });
91
98
  this.$store.dispatch('media/resetMediaListContext');
92
99
  },
93
100
  template: `<div style="flex-direction: column;display: flex;place-content: flex-start;align-items: center;min-height: 100vh;width: 100%;">
@@ -120,6 +127,7 @@ export const TemplateSandbox = (args, { argTypes }) => {
120
127
  {{
121
128
  components: { PbMedia },
122
129
  created() {
130
+ this.$store.dispatch('documents/updateContext', { type: 'DOCUMENT' });
123
131
  this.$store.dispatch('documents/resetMediaListContext');
124
132
  },
125
133
  data: () => ({
@@ -161,6 +169,7 @@ export const TemplateSandbox = (args, { argTypes }) => {
161
169
  {{
162
170
  components: { PbMedia },
163
171
  created() {
172
+ this.$store.dispatch('media/updateContext', { type: 'MEDIA' });
164
173
  this.$store.dispatch('media/loadMedia');
165
174
  },
166
175
  template: `<div style="flex-direction: column;display: flex;place-content: flex-start;align-items: center;min-height: 100vh;width: 100%;">
@@ -188,6 +197,7 @@ export const TemplateSandbox = (args, { argTypes }) => {
188
197
  {{
189
198
  components: { PbMedia },
190
199
  created() {
200
+ this.$store.dispatch('media/updateContext', { type: 'MEDIA' });
191
201
  this.$store.dispatch('media/resetMediaListContext');
192
202
  },
193
203
  template: `<div style="flex-direction: column;display: flex;place-content: flex-start;align-items: center;min-height: 100vh;width: 100%;">
@@ -218,6 +228,7 @@ export const TemplateSandbox = (args, { argTypes }) => {
218
228
  {{
219
229
  components: { PbMedia },
220
230
  created() {
231
+ this.$store.dispatch('media/updateContext', { type: 'MEDIA' });
221
232
  this.$store.dispatch('media/loadMedia');
222
233
  },
223
234
  template: `<div style="flex-direction: column;display: flex;place-content: flex-start;align-items: center;min-height: 100vh;width: 100%;">
@@ -1,8 +1,7 @@
1
1
  import { Meta, Canvas, Story } from '@storybook/addon-docs';
2
2
  import { nestedAppDecorator } from '../../../../.storybook/nested-app-decorator';
3
3
  import PbMediaDetail from './PbMediaDetail';
4
- import documentsStore from '../../../stores/modules/documentsStore';
5
- import mediaStore from '../../../stores/modules/mediaStore';
4
+ import mediaDocumentsStore from '../../../stores/modules/mediaDocumentsStore';
6
5
  import { rest } from 'msw';
7
6
  import { internalServerErrorResolver, notContentResolver } from '../../../services/api/mocks/commonMock';
8
7
  import {
@@ -18,6 +17,8 @@ import {
18
17
  getDocumentsPdfFileResolver,
19
18
  } from '../../../services/api/mocks/documentsMock';
20
19
  import DOCUMENT_DETAIL_PAYLOAD from './document-detail-payload.json';
20
+ import cloneDeep from 'lodash.clonedeep';
21
+ import { useStore } from 'vuex';
21
22
 
22
23
  <Meta
23
24
  title="Project Booster/Components/Documents & Media/PbMediaDetail 🦠"
@@ -29,8 +30,8 @@ import DOCUMENT_DETAIL_PAYLOAD from './document-detail-payload.json';
29
30
  nestedAppDecorator(
30
31
  {
31
32
  modules: {
32
- media: mediaStore,
33
- documents: documentsStore,
33
+ media: cloneDeep(mediaDocumentsStore),
34
+ documents: cloneDeep(mediaDocumentsStore),
34
35
  },
35
36
  },
36
37
  [],
@@ -45,6 +46,9 @@ export const TemplateSandbox = (args, { argTypes }) => {
45
46
  props: Object.keys(argTypes),
46
47
  components: { PbMediaDetail },
47
48
  setup() {
49
+ const store = useStore();
50
+ store.dispatch('media/updateContext', { type: 'MEDIA' });
51
+ store.dispatch('documents/updateContext', { type: 'DOCUMENT' });
48
52
  return { args };
49
53
  },
50
54
  template: `<div style="flex-direction: column;display: flex;place-content: flex-start;align-items: center;min-height: 100vh;width: 100%;">
@@ -198,6 +202,7 @@ export const imageDocument = {
198
202
  msw: [
199
203
  rest.get('/api/inhabitant-projects/:projectId/documents/', getDocumentsByInhabitantProjectIdResolver),
200
204
  rest.get('/api/inhabitant-projects/:projectId/documents/:documentId/file', getDocumentsImageFileResolver),
205
+ rest.patch('/api/inhabitant-projects/:projectId/documents/:documentId', notContentResolver),
201
206
  ],
202
207
  }}
203
208
  inline={false}
@@ -1,11 +1,13 @@
1
1
  import { Meta, Canvas, Story } from '@storybook/addon-docs';
2
- import mediaStore from '../../../stores/modules/mediaStore';
2
+ import mediaDocumentsStore from '../../../stores/modules/mediaDocumentsStore';
3
3
  import PbMediaList from './PbMediaList';
4
4
  import { rest } from 'msw';
5
5
  import { getAllMediaPaginationResolver, getMediaThumbnailResolver } from '../../../services/api/mocks/mediaMock';
6
6
  import { notContentResolver } from '../../../services/api/mocks/commonMock';
7
7
  import { nestedAppDecorator } from '../../../../.storybook/nested-app-decorator';
8
8
  import DOCUMENTS_LIST_PAYLOAD from './documents-list-payload.json';
9
+ import cloneDeep from 'lodash.clonedeep';
10
+ import { useStore } from 'vuex';
9
11
 
10
12
  <Meta
11
13
  title="Project Booster/Components/Documents & Media/PbMediaList 🧬"
@@ -15,7 +17,7 @@ import DOCUMENTS_LIST_PAYLOAD from './documents-list-payload.json';
15
17
  nestedAppDecorator(
16
18
  {
17
19
  modules: {
18
- media: mediaStore,
20
+ media: cloneDeep(mediaDocumentsStore),
19
21
  },
20
22
  },
21
23
  [],
@@ -30,6 +32,8 @@ export const TemplateSandbox = (args, { argTypes }) => {
30
32
  props: Object.keys(argTypes),
31
33
  components: { PbMediaList },
32
34
  setup() {
35
+ const store = useStore();
36
+ store.dispatch('media/updateContext', { type: 'MEDIA' });
33
37
  return { args };
34
38
  },
35
39
  template: `<div style="flex-direction: column;display: flex;place-content: flex-start;align-items: stretch;min-height: 100vh; width: 800px;">
@@ -1,8 +1,7 @@
1
1
  import PbMediaUpload from './PbMediaUpload';
2
- import { Anchor, Story, Preview, Meta, Props, ArgsTable, Source, Canvas } from '@storybook/addon-docs';
2
+ import { Story, Meta, Canvas } from '@storybook/addon-docs';
3
3
  import { nestedAppDecorator } from '../../../../.storybook/nested-app-decorator';
4
- import documentsStore from '../../../stores/modules/documentsStore';
5
- import mediaStore from '../../../stores/modules/mediaStore';
4
+ import mediaDocumentsStore from '../../../stores/modules/mediaDocumentsStore';
6
5
  import { rest } from 'msw';
7
6
  import {
8
7
  internalServerErrorResolver,
@@ -23,6 +22,8 @@ import {
23
22
  } from '../../../services/api/mocks/documentsMock';
24
23
  import MEDIA_UPLOAD_PAYLOAD from './media-upload-payload.json';
25
24
  import DOCUMENT_UPLOAD_PAYLOAD from './document-upload-payload.json';
25
+ import cloneDeep from 'lodash.clonedeep';
26
+ import { useStore } from 'vuex';
26
27
 
27
28
  <Meta
28
29
  title="Project Booster/Components/Documents & Media/PbMediaUpload 🦠"
@@ -34,8 +35,8 @@ import DOCUMENT_UPLOAD_PAYLOAD from './document-upload-payload.json';
34
35
  nestedAppDecorator(
35
36
  {
36
37
  modules: {
37
- media: mediaStore,
38
- documents: documentsStore,
38
+ media: cloneDeep(mediaDocumentsStore),
39
+ documents: cloneDeep(mediaDocumentsStore),
39
40
  },
40
41
  mutations: {
41
42
  eventBusSendEvent(state, { code, payload }) {
@@ -59,6 +60,9 @@ export const TemplateSandbox = (args, { argTypes }) => ({
59
60
  props: Object.keys(argTypes),
60
61
  components: { PbMediaUpload },
61
62
  setup() {
63
+ const store = useStore();
64
+ store.dispatch('media/updateContext', { type: 'MEDIA' });
65
+ store.dispatch('documents/updateContext', { type: 'DOCUMENT' });
62
66
  return { args };
63
67
  },
64
68
  template: `<pb-media-upload
@@ -2,9 +2,9 @@
2
2
  <pb-progression-price
3
3
  :theme="theme"
4
4
  :max-price="payload.maxPrice"
5
- :lower-price="summary.cost.min"
6
- :higher-price="summary.cost.max"
7
- :currency="summary.cost.currency"
5
+ :lower-price="lowerPrice"
6
+ :higher-price="higherPrice"
7
+ :currency="currency"
8
8
  :title="payload.title"
9
9
  :price-bar-hidden="payload.priceBarHidden"
10
10
  :separator-label="payload.separatorLabel"
@@ -37,6 +37,15 @@ export default {
37
37
  },
38
38
  computed: {
39
39
  ...mapGetters('estimates', { summary: 'getSummary' }),
40
+ lowerPrice() {
41
+ return this.summary?.cost?.min;
42
+ },
43
+ higherPrice() {
44
+ return this.summary?.cost?.max;
45
+ },
46
+ currency() {
47
+ return this.summary?.cost?.currency;
48
+ },
40
49
  },
41
50
  };
42
51
  </script>
@@ -143,6 +143,7 @@ import DOCUMENT_UPLOAD_PAYLOAD from '../../media/upload/document-upload-payload.
143
143
  path: '/projects/:projectId/inspirations',
144
144
  component: PbMedia,
145
145
  beforeEnter: async (to, from, next, store) => {
146
+ store.dispatch('media/updateCurrentMedia', null);
146
147
  const projectId = to.params.projectId;
147
148
  if (store.getters['projects/getCurrentProjectId'] !== projectId) {
148
149
  store.dispatch('projects/loadProject', projectId);
@@ -183,6 +184,7 @@ import DOCUMENT_UPLOAD_PAYLOAD from '../../media/upload/document-upload-payload.
183
184
  uploadPayload: DOCUMENT_UPLOAD_PAYLOAD,
184
185
  },
185
186
  beforeEnter: async (to, from, next, store) => {
187
+ store.dispatch('documents/updateCurrentMedia', null);
186
188
  const projectId = to.params.projectId;
187
189
  if (store.getters['projects/getCurrentProjectId'] !== projectId) {
188
190
  store.dispatch('projects/loadProject', projectId);
@@ -456,7 +456,6 @@ export default {
456
456
  isShowingFooter(viewModel) {
457
457
  return viewModel.footer && areConditionsValid(viewModel.footer.conditions, this.answers, this.runtimeOptions);
458
458
  },
459
-
460
459
  isAnswerDisabled(answer) {
461
460
  return (
462
461
  answer.viewModel.disabled &&
@@ -474,6 +473,7 @@ export default {
474
473
 
475
474
  if (this.payload.multiSelect) {
476
475
  this.selectedAnswers[answer.code] = answer.selected;
476
+
477
477
  const selected = Object.fromEntries(Object.entries(this.selectedAnswers).filter(([, value]) => value === true));
478
478
  /**
479
479
  * Emitted when the component value is updated
@@ -481,6 +481,11 @@ export default {
481
481
  */
482
482
  this.$emit('update-selected', selected);
483
483
  } else {
484
+ Object.keys(this.selectedAnswers).forEach((answerCode) => {
485
+ this.selectedAnswers[answerCode] = false;
486
+ });
487
+ this.selectedAnswers[answer.code] = answer.selected;
488
+
484
489
  /**
485
490
  * Emitted when step is completed
486
491
  * @event dynamic event name according to completedEventName prop
@@ -28,7 +28,7 @@
28
28
  <m-flexy class="pb-configurations-import__answers-container-flexy">
29
29
  <div
30
30
  :class="`pb-configurations-import__answers ${
31
- selectedConfigurations && selectedConfigurations.length < 3
31
+ !selectedConfigurations || selectedConfigurations.length < 3
32
32
  ? 'pb-configurations-import__answers--centered'
33
33
  : ''
34
34
  }`"
@@ -83,7 +83,11 @@
83
83
  </m-flexy>
84
84
  </m-container>
85
85
  </div>
86
- <pb-sticky-footer v-if="payload.skippable || payload.multiSelect" ref="pbStickyFooter">
86
+ <pb-sticky-footer
87
+ v-if="payload.skippable || payload.multiSelect"
88
+ ref="pbStickyFooter"
89
+ :bottom-offset="stickyBottomOffset"
90
+ >
87
91
  <transition-group name="pb-configurations-import__actions--animated" mode="out-in">
88
92
  <div
89
93
  v-if="payload.multiSelect && selectedConfigurations.length > 0"
@@ -101,7 +105,7 @@
101
105
  />
102
106
  </div>
103
107
  <div
104
- v-if="payload.skippable && (payload.viewModel.alwaysDisplaySkippable || selectedConfigurations <= 0)"
108
+ v-if="payload.skippable && (payload.viewModel.alwaysDisplaySkippable || selectedConfigurations.length <= 0)"
105
109
  ref="pbConfigurationsImportActionsButtonsSkip"
106
110
  class="pb-configurations-import__actions-container"
107
111
  key="skip"
@@ -159,8 +163,9 @@ import MFlex from '../../../components/mozaic/flex/MFlex';
159
163
  import MLink from '../../../components/mozaic/link/MLink';
160
164
  import MNotification from '../../../components/mozaic/notifications/MNotification';
161
165
  import PbCard from '../../../components/cards/PbCard';
162
- import { computed, ref, onMounted } from 'vue';
166
+ import { computed, ref } from 'vue';
163
167
  import { format } from 'date-fns';
168
+ import objectPath from 'object-path';
164
169
 
165
170
  const BACK_ICON =
166
171
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -234,19 +239,15 @@ export default {
234
239
 
235
240
  setup(props, { emit }) {
236
241
  const store = useStore();
237
- const projectId = computed(() => store.getters['projects/getCurrentProjectId']);
238
- const selectedConfigurations = ref([]);
242
+ const projectId = computed(() => store.getters['configurations/getCurrentProjectId']);
243
+ const selectedConfigurations = computed(() => store.getters['configurations/getConfigurations']);
239
244
  const showImportConfigurationDialog = ref(false);
240
245
  const configurationImportSuccess = ref(false);
241
246
  const configurationImportError = ref(false);
242
247
 
243
- onMounted(() => {
244
- selectedConfigurations.value = store.getters['configurations/getConfigurations'];
245
- });
246
-
247
248
  const navigateTo = (viewModel) => {
248
249
  if (viewModel.backLink) {
249
- window.location = this.decorate(viewModel.backLink);
250
+ window.location = decorate(viewModel.backLink);
250
251
  } else {
251
252
  /**
252
253
  * Emitted when go back link is clicked
@@ -258,17 +259,35 @@ export default {
258
259
 
259
260
  const decorate = (answers, valueToDecorate, defaultValue = '', runtimeOptions) => {
260
261
  if (valueToDecorate) {
261
- return this.doEval(answers, valueToDecorate, defaultValue, runtimeOptions);
262
+ return doEval(answers, valueToDecorate, defaultValue, runtimeOptions);
262
263
  }
263
264
  return valueToDecorate;
264
265
  };
265
266
 
266
267
  const decorateBoolean = (valueToDecorate, defaultValue = false) => {
267
268
  if (valueToDecorate) {
268
- return this.doEval(valueToDecorate, defaultValue);
269
+ return doEval(valueToDecorate, defaultValue);
269
270
  }
270
271
  return valueToDecorate;
271
272
  };
273
+
274
+ const doEval = (valueToEval, defaultValue) => {
275
+ return new Function('getAnswerValue', 'answers', 'defaultValue', 'runtimeOptions', `return ${valueToEval}`).call(
276
+ this,
277
+ getAnswerValue,
278
+ props.answers,
279
+ defaultValue,
280
+ props.runtimeOptions,
281
+ );
282
+ };
283
+
284
+ const getAnswerValue = (answerCode, path) => {
285
+ if (!props.answers[answerCode] || props.answers[answerCode].length === 0) {
286
+ return null;
287
+ }
288
+ return objectPath.get(props.answers[answerCode][0], path);
289
+ };
290
+
272
291
  const displayConfigurationDialog = () => {
273
292
  showImportConfigurationDialog.value = true;
274
293
  };
@@ -279,7 +298,6 @@ export default {
279
298
  await store.dispatch('configurations/searchConfigurations', projectId.value);
280
299
 
281
300
  if (store.getters['configurations/getConfigurationImportSuccess']) {
282
- selectedConfigurations.value.push(configuration);
283
301
  configurationImportSuccess.value = true;
284
302
  } else if (store.getters['configurations/getConfigurationImportError']) {
285
303
  configurationImportError.value = true;