project-booster-vue 8.121.0 → 8.122.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.
Files changed (28) hide show
  1. package/package.json +1 -1
  2. package/src/components/appointment/PbAppointment.stories.mdx +87 -56
  3. package/src/components/appointment/PbAppointment.vue +35 -2
  4. package/src/components/appointment/appointmentQualification-default-payload.json +9 -1
  5. package/src/components/appointment/appointmentQualification-recovery.json +904 -0
  6. package/src/components/configurations/search/PbConfigurationsSearch.stories.mdx +1 -1
  7. package/src/components/configurations/search/PbConfigurationsSearch.vue +10 -2
  8. package/src/components/question/PbQuestion.vue +11 -3
  9. package/src/components/question/configurations-import/PbConfigurationsImport.stories.mdx +163 -0
  10. package/src/components/question/configurations-import/PbConfigurationsImport.vue +537 -0
  11. package/src/components/question/configurations-import/default-payload.json +34 -0
  12. package/src/components/question/list-select/PbListSelect.vue +5 -2
  13. package/src/components/question/upload-document/PbUploadDocument-Features-ShowMore.stories.mdx +2 -2
  14. package/src/components/question/upload-document/PbUploadDocument-Features-StartOpen.stories.mdx +2 -2
  15. package/src/components/question/upload-document/PbUploadDocument.stories.mdx +4 -3
  16. package/src/components/question/upload-document/PbUploadDocument.vue +3 -0
  17. package/src/components/scenario/PbScenario-Demo-Project.stories.js +7 -1
  18. package/src/components/scenario/PbScenario-Features-Rehydration.stories.mdx +3 -2
  19. package/src/components/scenario/PbScenario-Features-Test.stories.mdx +48 -29
  20. package/src/components/scenario/PbScenario.vue +12 -4
  21. package/src/components/scenario/scenarii/appointment-qualification-kitchen.json +329 -24
  22. package/src/components/scenario/scenarii/scenario-kitchen-context-for-rehydration.json +18 -0
  23. package/src/services/api/configurationsApi.js +12 -4
  24. package/src/stores/modules/configurationsStore.js +18 -1
  25. package/src/stores/modules/documentsStore.js +1 -1
  26. package/src/stores/modules/mediaStore.js +1 -1
  27. package/src/components/appointment/default-payload.json +0 -595
  28. package/src/components/appointment/default-selected-scenarios.json +0 -717
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "8.121.0",
3
+ "version": "8.122.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "test:unit": "vue-cli-service test:unit --forceExit --detectOpenHandles",
@@ -1,15 +1,24 @@
1
1
  import PbAppointment from './PbAppointment';
2
2
  import PbScenario from '../scenario/PbScenario';
3
3
  import { Anchor, Story, Preview, Meta, Props, ArgsTable, Source, Canvas } from '@storybook/addon-docs';
4
- import DEFAULT_PAYLOAD from './default-payload';
5
- import SELECTED_SCENARIOS from './default-selected-scenarios';
4
+ import DEFAULT_PAYLOAD from '../scenario/scenarii/appointment-qualification-kitchen.json';
5
+ import PREVIOUS_CONTEXT from './appointmentQualification-recovery.json';
6
6
  import { nestedAppDecorator } from '../../../.storybook/nested-app-decorator';
7
- import documentsStore from '../../stores/modules/documentsStore';
8
- import appointmentQualificationStore from '../../stores/modules/appointmentQualificationStore';
7
+ import store from '../../stores/store';
9
8
  import PbMediaUpload from '../media/upload/PbMediaUpload';
10
9
  import { rest } from 'msw';
11
- import { acceptedResolver } from '../../services/api/mocks/commonMock';
12
- import { documentThumbnailResolver, uploadDocumentResolver } from '../../services/api/mocks/documentsMock';
10
+ import { useStore } from 'vuex';
11
+ import { acceptedResolver, notContentResolver } from '../../services/api/mocks/commonMock';
12
+ import {
13
+ getDocumentsImageFileResolver,
14
+ getDocumentsPdfThumbnailResolver,
15
+ uploadDocumentResolver,
16
+ } from '../../services/api/mocks/documentsMock';
17
+ import {
18
+ getConfigurationsByProjectIdResolver,
19
+ getEmptyConfigurationsByProjectIdResolver,
20
+ } from '../../services/api/mocks/configurationsMock';
21
+ import { getProjectByIdResolver } from '../../services/api/mocks/projectsMock';
13
22
 
14
23
  <Meta
15
24
  title="Project Booster/Components/Appointment qualification/PbAppointment 🦠"
@@ -18,32 +27,14 @@ import { documentThumbnailResolver, uploadDocumentResolver } from '../../service
18
27
  layout: 'fullscreen',
19
28
  }}
20
29
  decorators={[
21
- nestedAppDecorator(
30
+ nestedAppDecorator(store, [
31
+ { path: '/steps/:stepCode/previous/:answers', component: PbScenario },
22
32
  {
23
- modules: {
24
- appointmentQualification: appointmentQualificationStore,
25
- documents: documentsStore,
26
- },
27
- mutations: {
28
- eventBusSendEvent(state, { code, payload }) {
29
- console.log('event bus data : ', code, payload);
30
- },
31
- },
32
- actions: {
33
- sendEventToBus({ commit }, action) {
34
- commit('eventBusSendEvent', action);
35
- },
36
- },
33
+ name: 'PbMediaUpload',
34
+ path: '/document-upload',
35
+ component: PbMediaUpload,
37
36
  },
38
- [
39
- { path: '/steps/:stepCode/previous/:answers', component: PbScenario },
40
- {
41
- name: 'PbMediaUpload',
42
- path: '/document-upload',
43
- component: PbMediaUpload,
44
- },
45
- ],
46
- ),
37
+ ]),
47
38
  ]}
48
39
  />
49
40
 
@@ -51,64 +42,105 @@ import { documentThumbnailResolver, uploadDocumentResolver } from '../../service
51
42
 
52
43
  The `PbAppointment` component to make an appointment.
53
44
 
45
+ # `PbAppointment` - Component props
46
+
47
+ export const TemplateSandbox = (args, { argTypes }) => {
48
+ return {
49
+ props: Object.keys(argTypes),
50
+ components: { PbAppointment },
51
+ setup() {
52
+ const store = useStore();
53
+ store.dispatch('projects/loadProject', '001');
54
+ store.dispatch('configurations/loadConfigurations', '001');
55
+ store.dispatch('configurations/defineConfiguratorTypes', [DEFAULT_PAYLOAD.__START__.meta.configuratorType]);
56
+ store.dispatch('configurations/searchConfigurations', '001');
57
+ return { args };
58
+ },
59
+ template: ` <div style="flex-direction: column;display: flex;place-content: flex-start;align-items: stretch;height: 100vh;">
60
+ <pb-appointment
61
+ :scenarios="args.scenarios"
62
+ :previous-state="args.previousState"
63
+ :runtime-options="args.runtimeOptions"
64
+ />
65
+ </div>`,
66
+ };
67
+ };
68
+
54
69
  ## Appointment first time
55
70
 
56
71
  <Canvas>
57
72
  <Story
58
73
  name="Feature - Appointment first time"
74
+ inline={false}
75
+ height="758px"
76
+ args={{ scenarios: DEFAULT_PAYLOAD, runtimeOptions: { hasConfigurations: true } }}
59
77
  parameters={{
60
78
  controls: { disable: true },
79
+ storyshots: { disable: true },
61
80
  msw: [
81
+ rest.get('/api/simulations', getConfigurationsByProjectIdResolver),
82
+ rest.get(
83
+ '/api/inhabitant-projects/:inhabitantProjectId/simulations',
84
+ getEmptyConfigurationsByProjectIdResolver,
85
+ ),
86
+ rest.post('/api/inhabitant-projects/:inhabitantProjectId/simulations/:simulationId', notContentResolver),
87
+ rest.get('/api/inhabitant-projects/:projectId/documents/:documentId/file', getDocumentsImageFileResolver),
88
+ rest.post('/api/inhabitant-projects/:projectId/documents', uploadDocumentResolver),
62
89
  rest.post('/api/events/documents', acceptedResolver),
63
90
  rest.post('/api/inhabitant-projects/:inhabitantProjectId/documents', uploadDocumentResolver),
64
91
  rest.get(
65
92
  '/api/inhabitant-projects/:inhabitantProjectId/documents/:documentId/thumbnail',
66
- documentThumbnailResolver,
93
+ getDocumentsPdfThumbnailResolver,
67
94
  ),
68
95
  ],
69
96
  }}
70
- height="100vh"
71
97
  >
72
- {{
73
- components: { PbAppointment },
74
- created() {
75
- this.$store.dispatch('appointmentQualification/loadScenarios', DEFAULT_PAYLOAD);
76
- },
77
- template: ` <div style="flex-direction: column;display: flex;place-content: flex-start;align-items: stretch;height: 100vh;">
78
- <pb-appointment />
79
- </div>`,
80
- }}
98
+ {TemplateSandbox.bind({})}
81
99
  </Story>
82
100
  </Canvas>
83
101
 
84
102
  ## Appointment Recovery
85
103
 
104
+ export const previousState = {
105
+ answers: PREVIOUS_CONTEXT.answers,
106
+ refreshSteps: true,
107
+ history: {
108
+ stepIndex: PREVIOUS_CONTEXT.stepIndex,
109
+ steps: PREVIOUS_CONTEXT.stepHistory,
110
+ },
111
+ currentStep: PREVIOUS_CONTEXT.currentStep,
112
+ displayedStep: PREVIOUS_CONTEXT.currentStep,
113
+ };
114
+
86
115
  <Canvas>
87
116
  <Story
88
117
  name="Feature - Appointment Recovery"
118
+ inline={false}
119
+ height="758px"
120
+ args={{ scenarios: DEFAULT_PAYLOAD, runtimeOptions: { hasConfigurations: true }, previousState }}
89
121
  parameters={{
90
- controls: { disabled: true },
122
+ controls: { disable: true },
123
+ storyshots: { disable: true },
91
124
  msw: [
125
+ rest.get('/api/inhabitant-projects/:inhabitantProjectId', getProjectByIdResolver),
126
+ rest.get('/api/simulations', getConfigurationsByProjectIdResolver),
127
+ rest.get(
128
+ '/api/inhabitant-projects/:inhabitantProjectId/simulations',
129
+ getEmptyConfigurationsByProjectIdResolver,
130
+ ),
131
+ rest.post('/api/inhabitant-projects/:inhabitantProjectId/simulations/:simulationId', notContentResolver),
132
+ rest.get('/api/inhabitant-projects/:projectId/documents/:documentId/file', getDocumentsImageFileResolver),
133
+ rest.post('/api/inhabitant-projects/:projectId/documents', uploadDocumentResolver),
92
134
  rest.post('/api/events/documents', acceptedResolver),
93
135
  rest.post('/api/inhabitant-projects/:inhabitantProjectId/documents', uploadDocumentResolver),
94
136
  rest.get(
95
137
  '/api/inhabitant-projects/:inhabitantProjectId/documents/:documentId/thumbnail',
96
- documentThumbnailResolver,
138
+ getDocumentsPdfThumbnailResolver,
97
139
  ),
98
140
  ],
99
- storyshots: { disable: true },
100
141
  }}
101
- height="100vh"
102
142
  >
103
- {{
104
- components: { PbAppointment },
105
- created() {
106
- this.$store.dispatch('appointmentQualification/loadScenarios', SELECTED_SCENARIOS);
107
- },
108
- template: ` <div style="flex-direction: column;display: flex;place-content: flex-start;align-items: stretch;height: 100vh;">
109
- <pb-appointment />
110
- </div>`,
111
- }}
143
+ {TemplateSandbox.bind({})}
112
144
  </Story>
113
145
  </Canvas>
114
146
 
@@ -120,10 +152,9 @@ The `PbAppointment` component to make an appointment.
120
152
  components: { PbAppointment },
121
153
  created() {
122
154
  this.$store.commit('appointmentQualification/setCreateProjectError', 'Create project error');
123
- this.$store.dispatch('appointmentQualification/loadScenarios', SELECTED_SCENARIOS);
124
155
  },
125
156
  template: ` <div style="flex-direction: column;display: flex;place-content: flex-start;align-items: stretch;height: 100vh;">
126
- <pb-appointment />
157
+ <pb-appointment :scenarios="DEFAULT_PAYLOAD" />
127
158
  </div>`,
128
159
  }}
129
160
  </Story>
@@ -12,7 +12,13 @@
12
12
  @loader-click="$store.dispatch('appointmentQualification/checkAppointmentQualification')"
13
13
  />
14
14
  <m-flex v-else full-width align-items="center" justify-content="center" direction="column">
15
- <pb-scenario :scenarios="scenarios" min-height="100vh" @scenario-event="handleEvent"></pb-scenario>
15
+ <pb-scenario
16
+ :scenarios="scenarios"
17
+ :runtime-options="runtimeOptions"
18
+ :previous-state="previousState"
19
+ min-height="100vh"
20
+ @scenario-event="handleEvent"
21
+ />
16
22
  </m-flex>
17
23
  </m-flex>
18
24
  </template>
@@ -22,17 +28,44 @@ import PbScenario from '../scenario/PbScenario';
22
28
  import PbLoader from '../loader/PbLoader';
23
29
  import MFlex from '../mozaic/flex/MFlex';
24
30
  import { mapGetters } from 'vuex';
31
+
25
32
  export default {
26
33
  name: 'PbAppointment',
34
+
27
35
  components: { MFlex, PbScenario, PbLoader },
36
+
37
+ props: {
38
+ /**
39
+ * Defines the scenario object
40
+ */
41
+ scenarios: {
42
+ type: Object,
43
+ default: () => null,
44
+ },
45
+ /**
46
+ * Contains the scenario previous state for rehydration
47
+ */
48
+ previousState: {
49
+ type: Object,
50
+ default: () => null,
51
+ },
52
+ /**
53
+ * The options provided at runtime to customize component behaviour
54
+ */
55
+ runtimeOptions: {
56
+ type: Object,
57
+ default: () => ({}),
58
+ },
59
+ },
60
+
28
61
  computed: {
29
62
  ...mapGetters('appointmentQualification', {
30
- scenarios: 'getScenarios',
31
63
  isLoadingProject: 'isLoadingProject',
32
64
  createProjectError: 'getCreateProjectError',
33
65
  appointmentLinkedError: 'getAppointmentLinkedError',
34
66
  }),
35
67
  },
68
+
36
69
  methods: {
37
70
  handleEvent(data) {
38
71
  this.$emit('scenario-event', data);
@@ -26,10 +26,18 @@
26
26
  {
27
27
  "code": "ITEM-2",
28
28
  "viewModel": {
29
- "title": "Un plan aux mesures de votre pièce",
29
+ "title": "Un plan aux mesures de votre pièce (dessin, document, plan 3D…)",
30
30
  "image": "https://storage.googleapis.com/project-booster-media/vad/liste-etapes/picto_planner-plan_40.svg",
31
31
  "imageSize": "small"
32
32
  }
33
+ },
34
+ {
35
+ "code": "ITEM-3",
36
+ "viewModel": {
37
+ "title": "Des photos de votre cuisine",
38
+ "image": "https://storage.googleapis.com/project-booster-media/vad/picto_planner-penser_photo-small.svg",
39
+ "imageSize": "small"
40
+ }
33
41
  }
34
42
  ]
35
43
  }