project-booster-vue 10.23.8 → 10.24.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "10.23.8",
3
+ "version": "10.24.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1010,6 +1010,8 @@ export default defineComponent({
1010
1010
  BATHROOM_IN_STORE: 'en magasin',
1011
1011
  BATHROOM_AT_HOME: 'à domicile',
1012
1012
  BATHROOM_FURNITURES_AND_SHOWER: 'à distance',
1013
+ GARDEN_REMOTE: 'à distance',
1014
+ GARDEN_IN_STORE: 'en magasin',
1013
1015
  })[this.appointment.appointmentType];
1014
1016
  return `${prefix} le ${appointmenDateLabel} ${appointmentTypeLabel}`;
1015
1017
  },
@@ -1011,6 +1011,8 @@ export default defineComponent({
1011
1011
  BATHROOM_IN_STORE: 'en magasin',
1012
1012
  BATHROOM_AT_HOME: 'à domicile',
1013
1013
  BATHROOM_FURNITURES_AND_SHOWER: 'à distance',
1014
+ GARDEN_REMOTE: 'à distance',
1015
+ GARDEN_IN_STORE: 'en magasin',
1014
1016
  })[this.appointment.appointmentType];
1015
1017
  return `${prefix} le ${appointmenDateLabel} ${appointmentTypeLabel}`;
1016
1018
  },
@@ -55,9 +55,24 @@ export interface UploadDocumentViewModel {
55
55
  answerComponent: string;
56
56
  startOpened: boolean;
57
57
  backLink?: string;
58
+ forceOneCardPerLineOnMobile?: boolean;
58
59
  mediaPayload: UploadDocumentMediaPayload;
59
60
  showMore?: boolean;
60
61
  analytics?: any;
62
+ redirectLink?: UploadDocumentRedirectLink;
63
+ upload?: {
64
+ label: string;
65
+ };
66
+ download: {
67
+ label: string;
68
+ href: string;
69
+ fileName?: string;
70
+ };
71
+ }
72
+
73
+ interface UploadDocumentRedirectLink {
74
+ label: string;
75
+ link: string;
61
76
  }
62
77
 
63
78
  export interface UploadDocumentPayload {
@@ -37,11 +37,26 @@
37
37
  width-from-l="1of3"
38
38
  >
39
39
  <div class="pb-upload-document__answer">
40
- <div
41
- class="pb-upload-document__answer-plan mc-button mc-button--bordered-neutral"
42
- @click="displayDocumentDialog"
43
- >
44
- {{ payload.viewModel.addTitle || 'Importer un fichier' }}
40
+ <div v-if="payload.viewModel.upload" class="pb-upload-document__answer__upload">
41
+ <div
42
+ class="pb-upload-document__answer__upload__content mc-button mc-button--bordered-neutral"
43
+ @click="displayDocumentDialog"
44
+ >
45
+ <span>{{ payload.viewModel.upload.label || 'Sélectionner un fichier' }}</span>
46
+ </div>
47
+ </div>
48
+ <div v-if="payload.viewModel.download" class="pb-upload-document__answer__download">
49
+ <a
50
+ class="pb-upload-document__answer__download__content mc-button mc-button--bordered-neutral"
51
+ target="_blank"
52
+ :href="payload.viewModel.download.href"
53
+ :download="payload.viewModel.download.fileName ? '' : ''"
54
+ >
55
+ <img :src="DownloadIcon" alt="download" style="width: 24px" />
56
+ <span class="pb-upload-document__answer__download__content__text">{{
57
+ payload.viewModel.download.label || 'Télécharger un fichier'
58
+ }}</span>
59
+ </a>
45
60
  </div>
46
61
  </div>
47
62
  </m-flexy-col>
@@ -108,6 +123,9 @@
108
123
  </template>
109
124
 
110
125
  <script lang="ts" setup>
126
+ //@ts-ignore
127
+ import DownloadIcon from '@mozaic-ds/icons/svg/Media_Download_Web_24px.svg';
128
+
111
129
  import { computed, onMounted, ref, PropType } from 'vue';
112
130
  import { MButton, MLink } from '@mozaic-ds/vue-3';
113
131
  import MContainer from '../../../mozaic/grid/MContainer.vue';
@@ -438,6 +456,7 @@ $answers-apparition-duration: '0.5s';
438
456
  &__answer {
439
457
  box-sizing: border-box;
440
458
  height: 100%;
459
+
441
460
  padding: $mu050;
442
461
 
443
462
  @include set-from-screen($responsive-breakpoint) {
@@ -452,6 +471,34 @@ $answers-apparition-duration: '0.5s';
452
471
  &-card {
453
472
  height: 100%;
454
473
  }
474
+
475
+ &__upload {
476
+ &__content {
477
+ align-items: center;
478
+ width: 16rem;
479
+
480
+ color: $color-primary-01-500;
481
+ border-color: $color-primary-01-500;
482
+
483
+ &:hover {
484
+ color: white;
485
+ background-color: $color-primary-01-500;
486
+ }
487
+ }
488
+ }
489
+
490
+ &__download {
491
+ margin-top: $mu050;
492
+
493
+ &__content {
494
+ align-items: center;
495
+ width: 21rem;
496
+
497
+ &__text {
498
+ margin-left: $mu100;
499
+ }
500
+ }
501
+ }
455
502
  }
456
503
 
457
504
  &__decorator-stripe {
@@ -1,5 +1,5 @@
1
1
  import { nestedAppDecorator } from '../../../.storybook/nested-app-decorator';
2
- import { Anchor, Story, Preview, Meta, Props, ArgsTable, Source, Canvas } from '@storybook/addon-docs';
2
+ import { Anchor, Story, Meta, Props, Source, Canvas } from '@storybook/addon-docs';
3
3
  import PbScenario from './PbScenario';
4
4
  import estimatesStore from '../../stores/modules/estimatesStore';
5
5
  import DEFAULT_PAYLOAD from './scenarii/appointment-qualification-kitchen.json';
@@ -7,7 +7,7 @@ import { TemplateSandbox } from './PbScenario.stories.mdx';
7
7
  import simpleScenarioSchema from './Simple-scenario.svg';
8
8
 
9
9
  <Meta
10
- title="Project Booster/Scenario/PbScenario 🦠/Test (locally)/Qualification/Kitchen Qualification"
10
+ title="Project Booster/Scenario/PbScenario 🦠/Test (locally)/Appointment qualification/Kitchen"
11
11
  component={PbScenario}
12
12
  argTypes={{
13
13
  scenarios: {
@@ -92,7 +92,7 @@ This simple scenario contains:
92
92
 
93
93
  <Canvas>
94
94
  <Story
95
- name="Kitchen Qualification"
95
+ name="Kitchen"
96
96
  inline={false}
97
97
  height="758px"
98
98
  args={{ scenarios: DEFAULT_PAYLOAD, minHeight: 'auto' }}
@@ -0,0 +1,245 @@
1
+ import { nestedAppDecorator } from '../../../.storybook/nested-app-decorator';
2
+ import { Anchor, Story, Meta, Props, Source, Canvas } from '@storybook/addon-docs';
3
+ import PbScenario from './PbScenario';
4
+ import estimatesStore from '../../stores/modules/estimatesStore';
5
+ import DEFAULT_PAYLOAD from './scenarii/appointment-qualification-garden.json';
6
+ import { TemplateSandbox } from './PbScenario.stories.mdx';
7
+ import simpleScenarioSchema from './Simple-scenario.svg';
8
+
9
+ <Meta
10
+ title="Project Booster/Scenario/PbScenario 🦠/Test (locally)/Appointment qualification/Garden"
11
+ component={PbScenario}
12
+ argTypes={{
13
+ scenarios: {
14
+ table: {
15
+ defaultValue: {
16
+ summary: 'object',
17
+ detail: JSON.stringify(DEFAULT_PAYLOAD, null, ' '),
18
+ },
19
+ },
20
+ control: {
21
+ type: 'object',
22
+ },
23
+ },
24
+ onScenarioCompleted: {
25
+ action: 'Scenario completed',
26
+ table: { disable: true },
27
+ },
28
+ onScenarioEvent: {
29
+ action: 'Scenario event occured',
30
+ table: { disable: true },
31
+ },
32
+ }}
33
+ decorators={[
34
+ nestedAppDecorator(
35
+ {
36
+ modules: {
37
+ estimates: estimatesStore,
38
+ },
39
+ actions: {
40
+ sendEventToBus({}, payload) {
41
+ console.log('Event sent to bus', payload);
42
+ },
43
+ },
44
+ },
45
+ [{ path: '/steps/:stepCode/previous/:answers', component: PbScenario }],
46
+ ),
47
+ ]}
48
+ parameters={{
49
+ layout: 'fullscreen',
50
+ }}
51
+ />
52
+
53
+ <Anchor storyId="project-booster-scenario-pbscenario-features-conditional--101-simple-scenario" />
54
+
55
+ # Features - PbScenario
56
+
57
+ ## Scenarios and steps management
58
+
59
+ The scenario component allows to manage **scenarios** and **steps** :
60
+
61
+ - a **scenario** is a sequence of steps,
62
+ - a **step** is one interaction from the user perspective.
63
+
64
+ ## Simple scenario
65
+
66
+ The scenario component will use the bounded scenarios object containing all the scenarios and steps:
67
+
68
+ <details>
69
+ <summary class="css-1p8ieni">
70
+ Show/Hide <strong>scenario code</strong>:
71
+ </summary>
72
+ <Source language="json" code={JSON.stringify(DEFAULT_PAYLOAD, null, ' ')} />
73
+ </details>
74
+
75
+ A scenario object is composed of a map of steps. A step can be a standard step or a nested scenario.
76
+
77
+ This simple scenario contains:
78
+
79
+ - the `__START__` scenario which is used by the component to know where to find the main scenario, its presence is mandatory,
80
+ - the `MAIN_SCENARIO` (name it as you want) definition, pointing to its first step `MAIN_SCENARIO--STEP_1`,
81
+ - the `MAIN_SCENARIO--STEP_1` (name it as you want) step with the component `PbCard` used for this step and the next
82
+ step `MAIN_SCENARIO--STEP_2` (name it as you want) to reach when completed,
83
+ - the `MAIN_SCENARIO--STEP_2` (name it as you want) step with the component `PbCard` used for this step and the next
84
+ step `__END__` to reach when completed,
85
+ - the `__END__` step with the component `PbCard` used for this step which indicates to the
86
+ component that the main scenario is completed, its presence is mandatory to address properly the nested scenario feature.
87
+
88
+ NB: **`__START__`** and **`__END__`** are mandatory step codes to allow the component to work properly, **DO NOT RENAME THEM**. The `__END__`
89
+ can display a component.
90
+
91
+ <img src={simpleScenarioSchema} />
92
+
93
+ <Canvas>
94
+ <Story
95
+ name="Garden"
96
+ inline={false}
97
+ height="758px"
98
+ args={{ scenarios: DEFAULT_PAYLOAD, minHeight: 'auto' }}
99
+ parameters={{ storyshots: { disable: true } }}
100
+ >
101
+ {TemplateSandbox.bind({})}
102
+ </Story>
103
+ </Canvas>
104
+
105
+ ## Focus on scenario definition
106
+
107
+ Here is the scenario definition:
108
+
109
+ ```json
110
+ {
111
+ "SCENARIO_CODE": {
112
+ "code": "SCENARIO_CODE",
113
+ "type": "SCENARIO",
114
+ "stepCode": "FIRST_STEP_CODE",
115
+ "meta": {
116
+ "your-stuff": "here"
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ where:
123
+
124
+ | | |
125
+ | --------------- | -------------------------------------------------------------------------------------------------- |
126
+ | `SCENARIO_CODE` | the scenario code uniquely identifying it in the scenario map, |
127
+ | `code` | the same as above, the data is duplicated inside the object to simplify steps/scenarios management |
128
+ | `type` | the type of step, (could be `STEP`, `SCENARIO`) |
129
+ | `stepCode` | the first step of the scenario |
130
+ | `meta` | data needed by the scenario host |
131
+
132
+ ## Focus on step definition
133
+
134
+ ### Mandatory properties
135
+
136
+ Here is the smallest step definition (it can be extended with other properties):
137
+
138
+ ```json
139
+ {
140
+ "STEP_CODE": {
141
+ "code": "STEP_CODE",
142
+ "type": "STEP",
143
+ "component": "PbComponentForStepScreen",
144
+ "payload": {}
145
+ }
146
+ }
147
+ ```
148
+
149
+ | | |
150
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------------ |
151
+ | `STEP_CODE` | the step code uniquely identifying it in the scenario map |
152
+ | `type` | the type of step, (could be `STEP` or `SCENARIO`) |
153
+ | `component` | the component that will be used to materialize the step on the screen. See _Step component_ section below for more information |
154
+ | `payload` | the payload containing specific business data for the step |
155
+
156
+ ### Step component
157
+
158
+ The step is associated with a component. This is the component which will be displayed for the step.
159
+ A `payload` property is also available to provide:
160
+
161
+ - the **business data** needed to address the business use case (ex: the answers of a question),
162
+ - the `viewModel` property which contains the component **view model** (ie. the data used to customise the component: label, images, ...).
163
+
164
+ The `payload` property is not mandatory as the component does not always need customisation data.
165
+
166
+ Here is a step definition with the component definition:
167
+
168
+ ```json
169
+ {
170
+ "STEP_CODE": {
171
+ "code": "STEP_CODE",
172
+ "type": "STEP",
173
+ "component": "PbComponentForStepScreen",
174
+ "payload": {}
175
+ }
176
+ }
177
+ ```
178
+
179
+ #### Step components API
180
+
181
+ The components API consists of :
182
+
183
+ - the `payload` provided by the `PbScenario` component which contains business data and view model,
184
+ - the `step-completed` event emitted by the component itself when he has finished its job.
185
+
186
+ ##### Payload bound property
187
+
188
+ The `payload` property bound to the component will contain all the data needed by the component to do its job.
189
+
190
+ This is not mandatory as the component may be self sufficient to execute its tasks.
191
+
192
+ ##### step-completed event
193
+
194
+ The `step-completed` event is raised when the component has finished its job. It contains:
195
+
196
+ - the `answers` property containing the result of the component job,
197
+ - the `nextStep` property containing a step to override the default `nextStep` defined on the current step.
198
+
199
+ ## Going to next step
200
+
201
+ After the user completes the task provided by the component, the component will emit the `step-completed` event.
202
+
203
+ The `step-completed` event payload will contain the `answers` resulting from the user interactions and an optional
204
+ `nextStep`:
205
+
206
+ - If a `nextStep` is provided by the component, the scenario will use this as a next step.
207
+ - If no `nextStep` is provided by the component, the scenario component will look for the `nextStep` property of
208
+ the current step,
209
+ - If no `nextStep` is provided/found, the current scenario will be considered as finished and the scenario component
210
+ will try to resume the parent scenario.
211
+
212
+ The `nextStep` object only contains a `code` property valued with the code of the targeted next step.
213
+ If the code is `null`, it will react as if the `nextStep` is not provided (the current scenario will be considered
214
+ as finished and the scenario component will try to resume the parent scenario, if there is no scenario to resume,
215
+ the scenario will go to the `__END__`).
216
+
217
+ Next step example to navigate to a step or a nested scenario:
218
+
219
+ ```json
220
+ {
221
+ "nextStep": {
222
+ "code": "NEXT_STEP_OR_SCENARIO_CODE"
223
+ }
224
+ }
225
+ ```
226
+
227
+ Next step example to navigate to finish the current (nested) scenario:
228
+
229
+ ```json
230
+ {
231
+ "nextStep": {
232
+ "code": null
233
+ }
234
+ }
235
+ ```
236
+
237
+ Next step example to navigate to end the main scenario:
238
+
239
+ ```json
240
+ {
241
+ "nextStep": {
242
+ "code": "__END__"
243
+ }
244
+ }
245
+ ```
@@ -1,5 +1,5 @@
1
1
  import { nestedAppDecorator } from '../../../.storybook/nested-app-decorator';
2
- import { Anchor, Story, Preview, Meta, Props, ArgsTable, Source, Canvas } from '@storybook/addon-docs';
2
+ import { Anchor, Story, Meta, Props, Source, Canvas } from '@storybook/addon-docs';
3
3
  import PbScenario from './PbScenario';
4
4
  import estimatesStore from '../../stores/modules/estimatesStore';
5
5
  import DEFAULT_PAYLOAD from './scenarii/appointment-qualification-bathroom.json';
@@ -7,7 +7,7 @@ import { TemplateSandbox } from './PbScenario.stories.mdx';
7
7
  import simpleScenarioSchema from './Simple-scenario.svg';
8
8
 
9
9
  <Meta
10
- title="Project Booster/Scenario/PbScenario 🦠/Test (locally)/Qualification/Bathroom Qualification"
10
+ title="Project Booster/Scenario/PbScenario 🦠/Test (locally)/Appointment qualification/Bathroom"
11
11
  component={PbScenario}
12
12
  argTypes={{
13
13
  scenarios: {
@@ -92,7 +92,7 @@ This simple scenario contains:
92
92
 
93
93
  <Canvas>
94
94
  <Story
95
- name="Bathroom Qualification"
95
+ name="Bathroom"
96
96
  inline={false}
97
97
  height="758px"
98
98
  args={{ scenarios: DEFAULT_PAYLOAD, minHeight: 'auto' }}
@@ -7,7 +7,15 @@
7
7
  "webAnalytics": {
8
8
  "category": "Salle de bains",
9
9
  "scenario": "appointment-qualification-bathroom",
10
- "tracking": true
10
+ "funnel_name": "Qualifying course bathroom",
11
+ "tracking": true,
12
+ "cdl": {
13
+ "pageName": "bathroom qualification",
14
+ "pageType": "Configurators & services",
15
+ "pageSubType": "appointment qualification",
16
+ "pageCategory1": "Salle de bains",
17
+ "pageCategory2": ""
18
+ }
11
19
  },
12
20
  "projectName": "Rénover une salle de bains",
13
21
  "projectKindHref": "/project-kinds/34048",
@@ -53,9 +61,6 @@
53
61
  "type": ["numeric", "string"],
54
62
  "order": ["Asc"],
55
63
  "path": ["meta.ranking", "viewModel.title"]
56
- },
57
- "analytics": {
58
- "funnel_name": "SDB_step1"
59
64
  }
60
65
  },
61
66
  "multiSelect": {
@@ -311,10 +316,7 @@
311
316
  "progressBar": true,
312
317
  "forceOneCardPerLineOnMobile": true,
313
318
  "widthFromL": "1of3",
314
- "widthXlSize": true,
315
- "analytics": {
316
- "funnel_name": "SDB_step2"
317
- }
319
+ "widthXlSize": true
318
320
  },
319
321
  "answers": {
320
322
  "STRAIGH_TUB": {
@@ -416,9 +418,6 @@
416
418
  },
417
419
  "payload": {
418
420
  "viewModel": {
419
- "analytics": {
420
- "funnel_name": "SDB_step3"
421
- },
422
421
  "answersComponent": "MPbCard",
423
422
  "progressBar": true,
424
423
  "forceOneCardPerLineOnMobile": true,
@@ -498,9 +497,6 @@
498
497
  },
499
498
  "payload": {
500
499
  "viewModel": {
501
- "analytics": {
502
- "funnel_name": "SDB_step4_1/4"
503
- },
504
500
  "answersComponent": "MPbCard",
505
501
  "progressBar": true,
506
502
  "forceOneCardPerLineOnMobile": true,
@@ -611,9 +607,6 @@
611
607
  },
612
608
  "payload": {
613
609
  "viewModel": {
614
- "analytics": {
615
- "funnel_name": "SDB_step5"
616
- },
617
610
  "answersComponent": "MPbCard",
618
611
  "progressBar": true,
619
612
  "forceOneCardPerLineOnMobile": true,
@@ -664,9 +657,6 @@
664
657
  },
665
658
  "payload": {
666
659
  "viewModel": {
667
- "analytics": {
668
- "funnel_name": "SDB_step3"
669
- },
670
660
  "answersComponent": "MPbCard",
671
661
  "progressBar": true,
672
662
  "forceOneCardPerLineOnMobile": true,
@@ -825,9 +815,6 @@
825
815
  },
826
816
  "payload": {
827
817
  "viewModel": {
828
- "analytics": {
829
- "funnel_name": "SDB_step4_3/4"
830
- },
831
818
  "answersComponent": "MPbCard",
832
819
  "progressBar": true,
833
820
  "forceOneCardPerLineOnMobile": true,
@@ -906,9 +893,6 @@
906
893
  },
907
894
  "payload": {
908
895
  "viewModel": {
909
- "analytics": {
910
- "funnel_name": "SDB_step4_2/4"
911
- },
912
896
  "title": "Transmettre mon plan plus tard",
913
897
  "type": "warning",
914
898
  "exitOptionsTitle": "Réaliser rapidement votre plan :",
@@ -968,12 +952,12 @@
968
952
  },
969
953
  "payload": {
970
954
  "viewModel": {
971
- "analytics": {
972
- "funnel_name": "SDB_step5_1/2"
973
- },
974
955
  "label": "Possédez-vous des photos de votre salle de bain actuelle ?",
975
- "addText": "Plus on en sait, mieux vous serez accompagné",
976
- "addTitle": "Importer des photos",
956
+
957
+ "upload": {
958
+ "label": "Importer des photos"
959
+ },
960
+
977
961
  "answersComponent": "PbCard",
978
962
  "showMore": {
979
963
  "itemsPerPage": 4,
@@ -1057,12 +1041,12 @@
1057
1041
  },
1058
1042
  "payload": {
1059
1043
  "viewModel": {
1060
- "analytics": {
1061
- "funnel_name": "SDB_step4_4/4"
1062
- },
1063
1044
  "label": "Ajouter un plan",
1064
- "addTitle": "Sélectionner un fichier",
1065
- "addText": "",
1045
+
1046
+ "upload": {
1047
+ "label": "Sélectionner un fichier"
1048
+ },
1049
+
1066
1050
  "answersComponent": "PbCard",
1067
1051
  "redirectLink": {
1068
1052
  "label": "Utiliser une simulation 3D à la place",
@@ -1147,9 +1131,6 @@
1147
1131
  },
1148
1132
  "payload": {
1149
1133
  "viewModel": {
1150
- "analytics": {
1151
- "funnel_name": "SDB_step6"
1152
- },
1153
1134
  "answersComponent": "MPbCard",
1154
1135
  "progressBar": true,
1155
1136
  "forceOneCardPerLineOnMobile": true,
@@ -1225,9 +1206,6 @@
1225
1206
  },
1226
1207
  "payload": {
1227
1208
  "viewModel": {
1228
- "analytics": {
1229
- "funnel_name": "SDB_step7"
1230
- },
1231
1209
  "answersComponent": "MPbCard",
1232
1210
  "progressBar": true,
1233
1211
  "forceOneCardPerLineOnMobile": true,
@@ -1308,9 +1286,6 @@
1308
1286
  },
1309
1287
  "payload": {
1310
1288
  "viewModel": {
1311
- "analytics": {
1312
- "funnel_name": "SDB_step8"
1313
- },
1314
1289
  "answersComponent": "MPbCard",
1315
1290
  "progressBar": true,
1316
1291
  "forceOneCardPerLineOnMobile": true,
@@ -1405,9 +1380,6 @@
1405
1380
  },
1406
1381
  "payload": {
1407
1382
  "viewModel": {
1408
- "analytics": {
1409
- "funnel_name": "SDB_step9"
1410
- },
1411
1383
  "title": "Pour que vous soyez pleinement satisfait et que votre projet soit réussi : qu'est-ce qui est le plus important pour vous ?",
1412
1384
  "content": "<p>Cette question est facultative.</p>",
1413
1385
  "typeForm": {
@@ -1444,9 +1416,6 @@
1444
1416
  "component": "PbPedagogy",
1445
1417
  "payload": {
1446
1418
  "viewModel": {
1447
- "analytics": {
1448
- "funnel_name": "SDB_step5_2/2"
1449
- },
1450
1419
  "title": "Nous avons bien pris rendez-vous et enregistré vos informations",
1451
1420
  "icon": "https://storage.googleapis.com/project-booster-media/vad/fin-de-parcours/check_80.svg",
1452
1421
  "description": [