project-booster-vue 9.57.5 → 9.59.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 (22) hide show
  1. package/package.json +1 -1
  2. package/src/components/cards/PbCardsList.vue +3 -0
  3. package/src/components/question/amount-input/PbAmountInput.vue +5 -0
  4. package/src/components/question/city-search/PbCitySearch.vue +5 -0
  5. package/src/components/question/dimensions-input/PbDimensionsInput.vue +5 -0
  6. package/src/components/question/incremental-amount-input/PbIncrementalAmountInput.vue +4 -0
  7. package/src/components/question/name-input/PbNameInput.vue +4 -0
  8. package/src/components/rework/alert/MPbAlert.vue +3 -0
  9. package/src/components/rework/exit-options/MPbExitOptions.vue +13 -2
  10. package/src/components/rework/question/city-search/MPbCitySearch.vue +5 -0
  11. package/src/components/rework/question/name-input/MPbNameInput.vue +4 -0
  12. package/src/components/rework/question/upload-document/MPbUploadDocument-Features-ShowMore.stories.json +70 -0
  13. package/src/components/rework/question/upload-document/MPbUploadDocument-Features-ShowMore.stories.mdx +93 -0
  14. package/src/components/rework/question/upload-document/MPbUploadDocument-Features-StartOpen.stories.json +67 -0
  15. package/src/components/rework/question/upload-document/MPbUploadDocument-Features-StartOpen.stories.mdx +93 -0
  16. package/src/components/rework/question/upload-document/MPbUploadDocument.stories.mdx +157 -0
  17. package/src/components/rework/question/upload-document/MPbUploadDocument.vue +577 -0
  18. package/src/components/rework/question/upload-document/UploadDocument.ts +65 -0
  19. package/src/components/rework/question/upload-document/default-payload.json +67 -0
  20. package/src/components/rework/question/upload-document/pictures-payload.json +39 -0
  21. package/src/components/scenario/PbScenario.vue +2 -2
  22. package/src/components/scenario/scenarii/appointment-qualification-bathroom.json +158 -146
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "9.57.5",
3
+ "version": "9.59.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -22,6 +22,7 @@
22
22
  :button-label="card.viewModel.buttonLabel"
23
23
  @button-click="handleAnswerButtonClick"
24
24
  @card-click="handleCardClick(card)"
25
+ :data-cerberus="sanitizeCerberusAttribut('PB-CARD', card.code)"
25
26
  />
26
27
  </div>
27
28
  </m-flexy-col>
@@ -35,6 +36,7 @@ import PbCard from '../cards/PbCard.vue';
35
36
  import MContainer from '../mozaic/grid/MContainer.vue';
36
37
  import MFlexy from '../mozaic/grid/MFlexy.vue';
37
38
  import MFlexyCol from '../mozaic/grid/MFlexyCol.vue';
39
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
38
40
 
39
41
  export default defineComponent({
40
42
  name: 'PbCardsList',
@@ -81,6 +83,7 @@ export default defineComponent({
81
83
  */
82
84
  this.$emit('card-click', card);
83
85
  },
86
+ sanitizeCerberusAttribut,
84
87
  },
85
88
  });
86
89
  </script>
@@ -10,6 +10,7 @@
10
10
  !showBackButton && !decorate(answers, runtimeOptions, payload.viewModel.forceBackButton),
11
11
  }"
12
12
  @click.once="$emit('go-back')"
13
+ :data-cerberus="sanitizeCerberusAttribut('PB-AMOUNT-INPUT', 'LESS')"
13
14
  />
14
15
  </m-flex>
15
16
  <form
@@ -28,6 +29,7 @@
28
29
  ref="pbAmountInputTextInput"
29
30
  class="pb-amount-input__text-input"
30
31
  :placeholder="computedPayload.viewModel.placeholder"
32
+ :data-cerberus="sanitizeCerberusAttribut('PB-AMOUNT-INPUT', 'INPUT')"
31
33
  v-model="amount"
32
34
  />
33
35
  <div class="pb-amount-input__currency">
@@ -41,6 +43,7 @@
41
43
  width="full"
42
44
  size="l"
43
45
  @click="handleFormSubmit"
46
+ :data-cerberus="sanitizeCerberusAttribut('PB-AMOUNT-INPUT', 'MORE')"
44
47
  />
45
48
  </m-flex>
46
49
  </m-flex>
@@ -64,6 +67,7 @@ import DEFAULT_PAYLOAD from './default-payload.json';
64
67
  import { AmountInputPayload } from '@/components/question/amount-input/AmountInput';
65
68
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
66
69
  import { decorate } from '@/services/decorate';
70
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
67
71
 
68
72
  const BACK_ICON =
69
73
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -197,6 +201,7 @@ export default defineComponent({
197
201
  amount,
198
202
  computedPayload,
199
203
  handleFormSubmit,
204
+ sanitizeCerberusAttribut,
200
205
  };
201
206
  },
202
207
  });
@@ -56,6 +56,7 @@
56
56
  :tabindex="index + 2"
57
57
  @click="selectSuggestion(suggestion)"
58
58
  @keyup.enter="selectSuggestion(suggestion)"
59
+ :data-cerberus="sanitizeCerberusAttribut('PB-CITY-SEARCH', 'SUGGESTION_' + suggestion.id)"
59
60
  >
60
61
  {{ formatSuggestion(suggestion) }}
61
62
  </div>
@@ -76,6 +77,7 @@
76
77
  @input="handleSearchKeywordChange"
77
78
  @focus="handleSearchKeywordFocus"
78
79
  @keypress="handleSearchKeywordKeypress($event)"
80
+ :data-cerberus="sanitizeCerberusAttribut('PB-CITY-SEARCH', 'INPUT')"
79
81
  tabindex="1"
80
82
  />
81
83
  </m-flex>
@@ -94,6 +96,7 @@
94
96
  width="full"
95
97
  size="l"
96
98
  @click="handleFormValidation"
99
+ :data-cerberus="sanitizeCerberusAttribut('PB-CITY-SEARCH', 'VALIDATE')"
97
100
  />
98
101
  </m-flex>
99
102
  </div>
@@ -115,6 +118,7 @@ import DEFAULT_PAYLOAD from './default-payload.json';
115
118
  import { DebouncedFunc } from 'lodash-es';
116
119
  import { decorate } from '@/services/decorate';
117
120
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
121
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
118
122
 
119
123
  const BACK_ICON =
120
124
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -405,6 +409,7 @@ export default defineComponent({
405
409
  event.preventDefault();
406
410
  }
407
411
  },
412
+ sanitizeCerberusAttribut,
408
413
  },
409
414
  });
410
415
  </script>
@@ -40,6 +40,7 @@
40
40
  class="pb-dimensions-input__text-input"
41
41
  :placeholder="computedPayload.viewModel.lengthPlaceholder"
42
42
  v-model="length"
43
+ :data-cerberus="sanitizeCerberusAttribut('PB-DIMENSION', 'LENGTH')"
43
44
  />
44
45
  <div class="pb-dimensions-input__unit">
45
46
  <span>m</span>
@@ -56,6 +57,7 @@
56
57
  class="pb-dimensions-input__text-input"
57
58
  :placeholder="computedPayload.viewModel.widthPlaceholder"
58
59
  v-model="width"
60
+ :data-cerberus="sanitizeCerberusAttribut('PB-DIMENSION', 'WIDTH')"
59
61
  />
60
62
  <div class="pb-dimensions-input__unit">
61
63
  <span>m</span>
@@ -69,6 +71,7 @@
69
71
  width="full"
70
72
  size="l"
71
73
  @click="handleFormSubmit"
74
+ :data-cerberus="sanitizeCerberusAttribut('PB-DIMENSION', 'SUBMIT')"
72
75
  />
73
76
  <m-link
74
77
  v-if="payload.skippable"
@@ -102,6 +105,7 @@ import { ref } from 'vue';
102
105
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
103
106
  import { DimensionsInputPayload } from '@/components/question/dimensions-input/DimensionsInput';
104
107
  import { decorate } from '@/services/decorate';
108
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
105
109
 
106
110
  const BACK_ICON =
107
111
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -279,6 +283,7 @@ export default defineComponent({
279
283
  pbDimensionsInputLengthInput,
280
284
  handleFormSubmit,
281
285
  skipQuestion,
286
+ sanitizeCerberusAttribut,
282
287
  };
283
288
  },
284
289
  });
@@ -45,6 +45,7 @@
45
45
  :valuemax="computedPayload.viewModel.maxValue"
46
46
  @input="handleQuantitySelector"
47
47
  :integerOnly="true"
48
+ :data-cerberus="sanitizeCerberusAttribut('PB-INCREMENTAL-AMOUNT', 'SELECTOR')"
48
49
  />
49
50
  </m-flex>
50
51
 
@@ -55,6 +56,7 @@
55
56
  width="full"
56
57
  size="l"
57
58
  type="submit"
59
+ :data-cerberus="sanitizeCerberusAttribut('PB-INCREMENTAL-AMOUNT', 'INPUT')"
58
60
  />
59
61
  </m-flex>
60
62
  </form>
@@ -75,6 +77,7 @@ import { ScenarioStepAnswer } from '@/types/pb/Scenario';
75
77
  import { decorate } from '@/services/decorate';
76
78
  import MQuantitySelector from '../../mozaic/quantityselector/MQuantitySelector.vue';
77
79
  import { IncrementalAmountPayload } from '@/components/question/incremental-amount-input/IncrementalAmount';
80
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
78
81
 
79
82
  const BACK_ICON =
80
83
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -213,6 +216,7 @@ export default defineComponent({
213
216
  quantitySelector,
214
217
  handleQuantitySelector,
215
218
  subtitle,
219
+ sanitizeCerberusAttribut,
216
220
  };
217
221
  },
218
222
  });
@@ -23,6 +23,7 @@
23
23
  ref="pbNameInputTextInput"
24
24
  :placeholder="computedPayload.viewModel.placeholder"
25
25
  v-model="name"
26
+ :data-cerberus="sanitizeCerberusAttribut('PB-NAME-INPUT', 'INPUT')"
26
27
  />
27
28
  <m-flex v-if="runtimeOptions.displayOptin" class="pb-name-input__optin">
28
29
  <m-toggle class="pb-name-input__optin-toggle" size="s" v-model="optin" />
@@ -37,6 +38,7 @@
37
38
  width="full"
38
39
  size="l"
39
40
  @click="handleFormSubmit"
41
+ :data-cerberus="sanitizeCerberusAttribut('PB-NAME-INPUT', 'BUTTON')"
40
42
  />
41
43
  </m-flex>
42
44
  </m-flex>
@@ -61,6 +63,7 @@ import DEFAULT_PAYLOAD from './default-payload.json';
61
63
  import { NameInputPayload } from '@/components/question/name-input/NameInput';
62
64
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
63
65
  import { decorate } from '@/services/decorate';
66
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
64
67
 
65
68
  const BACK_ICON =
66
69
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -230,6 +233,7 @@ export default defineComponent({
230
233
  optin,
231
234
  computedPayload,
232
235
  handleFormSubmit,
236
+ sanitizeCerberusAttribut,
233
237
  };
234
238
  },
235
239
  });
@@ -34,6 +34,7 @@
34
34
  @click="callAction(button.nextStep)"
35
35
  :theme="button.theme"
36
36
  style="margin-left: 1rem"
37
+ :data-cerberus="sanitizeCerberusAttribut('MPB-ALERT', button.label)"
37
38
  />
38
39
  </div>
39
40
  </div>
@@ -43,6 +44,8 @@
43
44
  <script lang="ts" setup>
44
45
  import { MNotification, MButton, MCard } from '@mozaic-ds/vue-3';
45
46
  import { PayloadAction } from '../types/genericPayload';
47
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
48
+
46
49
  const emit = defineEmits(['go-back', 'step-completed']);
47
50
 
48
51
  const props = defineProps({
@@ -37,6 +37,7 @@
37
37
  :label="payload.viewModel.backButton.label"
38
38
  :theme="payload.viewModel.backButton.theme"
39
39
  @click="callAction(payload.viewModel.backButton.nextStep)"
40
+ :data-cerberus="sanitizeCerberusAttribut('MPB-EXIT-OPTIONS', payload.viewModel.backButton.label)"
40
41
  />
41
42
  </div>
42
43
 
@@ -44,7 +45,11 @@
44
45
  v-if="isValidCondition(condition.conditions) && !payload.viewModel.nextStep"
45
46
  class="m-pb-exit-options__buttons__button"
46
47
  >
47
- <m-button :label="condition.viewModel.nextStep.label" :href="condition.viewModel.nextStep.link" />
48
+ <m-button
49
+ :label="condition.viewModel.nextStep.label"
50
+ :href="condition.viewModel.nextStep.link"
51
+ :data-cerberus="sanitizeCerberusAttribut('MPB-EXIT-OPTIONS', condition.viewModel.nextStep.label)"
52
+ />
48
53
  </div>
49
54
  </div>
50
55
 
@@ -55,11 +60,16 @@
55
60
  :label="payload.viewModel.backButton.label"
56
61
  :theme="payload.viewModel.backButton.theme"
57
62
  @click="callAction(payload.viewModel.backButton.nextStep)"
63
+ :data-cerberus="sanitizeCerberusAttribut('MPB-EXIT-OPTIONS', payload.viewModel.backButton.label)"
58
64
  />
59
65
  </div>
60
66
 
61
67
  <div class="m-pb-exit-options__buttons__button">
62
- <m-button :label="payload.viewModel.nextStep.label" @click="callAction(payload.viewModel.nextStep)" />
68
+ <m-button
69
+ :label="payload.viewModel.nextStep.label"
70
+ :data-cerberus="sanitizeCerberusAttribut('MPB-EXIT-OPTIONS', 'NEXT')"
71
+ @click="callAction(payload.viewModel.nextStep)"
72
+ />
63
73
  </div>
64
74
  </div>
65
75
  </div>
@@ -70,6 +80,7 @@ import { MButton } from '@mozaic-ds/vue-3';
70
80
  import { PropType, ref } from 'vue';
71
81
  import { PayloadAction } from '../types/genericPayload';
72
82
  import { areConditionsValid } from '../../../services/scenarioConditionals';
83
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
73
84
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
74
85
 
75
86
  const emit = defineEmits(['go-back', 'step-completed']);
@@ -53,6 +53,7 @@
53
53
  :tabindex="index + 2"
54
54
  @click="selectSuggestion(suggestion)"
55
55
  @keyup.enter="selectSuggestion(suggestion)"
56
+ :data-cerberus="sanitizeCerberusAttribut('MPB-CITY-SEARCH', 'CITY-' + suggestion.id)"
56
57
  >
57
58
  {{ formatSuggestion(suggestion) }}
58
59
  </div>
@@ -73,6 +74,7 @@
73
74
  @input="handleSearchKeywordChange"
74
75
  @focus="handleSearchKeywordFocus"
75
76
  tabindex="1"
77
+ :data-cerberus="sanitizeCerberusAttribut('MPB-CITY-SEARCH', 'INPUT')"
76
78
  />
77
79
  </m-flex>
78
80
  </div>
@@ -89,6 +91,7 @@
89
91
  :label="computedPayload.viewModel.actionLabel"
90
92
  size="l"
91
93
  @click="handleFormValidation"
94
+ :data-cerberus="sanitizeCerberusAttribut('MPB-CITY-SEARCH', 'BUTTON')"
92
95
  />
93
96
  </m-flex>
94
97
  </div>
@@ -106,6 +109,7 @@ import MFlex from '../../../mozaic/flex/MFlex.vue';
106
109
  import MButton from '../../../mozaic/buttons/MButton.vue';
107
110
  import MLink from '../../../mozaic/link/MLink.vue';
108
111
  import MTextInput from '../../../mozaic/text-input/MTextInput.vue';
112
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
109
113
  import DEFAULT_PAYLOAD from './default-payload.json';
110
114
  import { DebouncedFunc } from 'lodash-es';
111
115
  import { decorate } from '@/services/decorate';
@@ -394,6 +398,7 @@ export default defineComponent({
394
398
  selectedCityToKeyword(): string {
395
399
  return this.selectedCity?.postalCode + ' ' + this.selectedCity?.name + ', ' + this.selectedCity?.region;
396
400
  },
401
+ sanitizeCerberusAttribut,
397
402
  },
398
403
  });
399
404
  </script>
@@ -23,6 +23,7 @@
23
23
  ref="pbNameInputTextInput"
24
24
  :placeholder="computedPayload.viewModel.placeholder"
25
25
  v-model="name"
26
+ :data-cerberus="sanitizeCerberusAttribut('MPB-NAME-INPUT', 'INPUT')"
26
27
  />
27
28
  <m-flex v-if="runtimeOptions.displayOptin" class="pb-name-input__optin">
28
29
  <m-toggle class="pb-name-input__optin-toggle" size="s" v-model="optin" />
@@ -37,6 +38,7 @@
37
38
  width="full"
38
39
  size="l"
39
40
  @click="handleFormSubmit"
41
+ :data-cerberus="sanitizeCerberusAttribut('MPB-NAME-INPUT', 'SUBMIT')"
40
42
  />
41
43
  </m-flex>
42
44
  </m-flex>
@@ -61,6 +63,7 @@ import DEFAULT_PAYLOAD from './default-payload.json';
61
63
  import { NameInputPayload } from '@/components/question/name-input/NameInput';
62
64
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
63
65
  import { decorate } from '@/services/decorate';
66
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
64
67
 
65
68
  const BACK_ICON =
66
69
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -230,6 +233,7 @@ export default defineComponent({
230
233
  optin,
231
234
  computedPayload,
232
235
  handleFormSubmit,
236
+ sanitizeCerberusAttribut,
233
237
  };
234
238
  },
235
239
  });
@@ -0,0 +1,70 @@
1
+ {
2
+ "viewModel": {
3
+ "label": "Vos plans de cuisine",
4
+ "answersComponent": "PbCard",
5
+ "showMore": {
6
+ "itemsPerPage": 4,
7
+ "label": "Voir plus"
8
+ },
9
+ "startOpened": false,
10
+ "mediaPayload": {
11
+ "viewModel": {
12
+ "type": "documentsPlans",
13
+ "acceptedFileTypes": "image/jpeg, image/png, image/heif, image/heic, image/heif-sequence, image/heic-sequence, application/pdf",
14
+ "dialog": {
15
+ "hideCross": false,
16
+ "fullscreen": false,
17
+ "title": "Ajouter un plan",
18
+ "successUpload": "Votre plan a bien été ajouté",
19
+ "chooseAnotherMediaLabel": "Choisir un autre plan",
20
+ "uploadProgressTitle": "Chargement de votre plan",
21
+ "errorUploadTitle": "Une erreur est survenue lors de l'envoi de votre plan ",
22
+ "uploadPreviewTitle": "Nom de plan ",
23
+ "documentTypeTitle": "De quel type de plan s’agit il ?",
24
+ "acceptedMediaTypesErrorLabel": "Seuls les formats JPG et PNG, et PDF sont acceptés",
25
+ "mediaTypes": [
26
+ {
27
+ "type": "PLAN",
28
+ "subtype": "HAND_DRAWN_PLAN",
29
+ "code": "HAND_DRAWN_PLAN",
30
+ "label": "Un plan fait moi-même"
31
+ },
32
+ {
33
+ "type": "PLAN",
34
+ "subtype": "ARCHITECT_PLAN",
35
+ "code": "ARCHITECT_PLAN",
36
+ "label": "Un plan d’architecte"
37
+ },
38
+ {
39
+ "type": "PLAN",
40
+ "subtype": "KITCHEN_DESIGNER_PLAN",
41
+ "code": "KITCHEN_DESIGNER_PLAN",
42
+ "label": "Un plan d’un autre cuisiniste"
43
+ }
44
+ ]
45
+ }
46
+ }
47
+ }
48
+ },
49
+ "skippable": [
50
+ {
51
+ "label": "Ajouter un plan plus tard",
52
+ "theme": "text-primary",
53
+ "width": "full",
54
+ "widthFromM": "fit",
55
+ "nextStep": {
56
+ "code": "LMFR_QUESTION_ADD_PLAN_LATER"
57
+ }
58
+ }
59
+ ],
60
+ "multiSelect": {
61
+ "actions": {
62
+ "VALIDATE": {
63
+ "label": "Continuer",
64
+ "nextStep": {
65
+ "code": "__END__"
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,93 @@
1
+ import { nestedAppDecorator } from '../../../../../.storybook/nested-app-decorator';
2
+ import { Anchor, Story, Meta, Source, Canvas } from '@storybook/addon-docs';
3
+ import DEFAULT_PAYLOAD from './MPbUploadDocument-Features-ShowMore.stories.json';
4
+ import { TemplateSandbox } from './MPbUploadDocument.stories.mdx';
5
+ import documentsStore from '../../../../stores/modules/documentsStore';
6
+ import { acceptedResolver } from '../../../../services/api/mocks/commonMock';
7
+ import { rest } from 'msw';
8
+ import {
9
+ getDocumentsByInhabitantProjectIdResolver,
10
+ getDocumentsPdfThumbnailResolver,
11
+ uploadDocumentResolver,
12
+ } from '../../../../services/api/mocks/documentsMock';
13
+ import cloneDeep from 'lodash.clonedeep';
14
+ import MPbUploadDocument from './MPbUploadDocument';
15
+ import PbScenario from '../../../../components/scenario/PbScenario';
16
+
17
+ <Meta
18
+ title="Project Booster/Rework/Questions/MPbUploadDocument 🦠/Feature"
19
+ component={MPbUploadDocument}
20
+ argTypes={{
21
+ payload: {
22
+ table: {
23
+ defaultValue: {
24
+ summary: 'object',
25
+ detail: JSON.stringify(DEFAULT_PAYLOAD, null, ' '),
26
+ },
27
+ },
28
+ control: {
29
+ type: 'object',
30
+ },
31
+ },
32
+ onStepCompleted: {
33
+ action: 'Step completed',
34
+ table: { disable: true },
35
+ },
36
+ }}
37
+ decorators={[
38
+ nestedAppDecorator(
39
+ {
40
+ modules: {
41
+ documents: cloneDeep(documentsStore),
42
+ documentsPlans: cloneDeep(documentsStore),
43
+ documentsPictures: cloneDeep(documentsStore),
44
+ },
45
+ mutations: {
46
+ eventBusSendEvent(state, { code, payload }) {
47
+ console.log('event bus data : ', code, payload);
48
+ },
49
+ },
50
+ getters: {
51
+ summary(state) {
52
+ return state.summary;
53
+ },
54
+ },
55
+ actions: {
56
+ sendEventToBus({}, payload) {
57
+ console.log('Event sent to bus', payload);
58
+ },
59
+ },
60
+ },
61
+ [{ path: '/steps/:stepCode/previous/:answers', component: PbScenario }],
62
+ ),
63
+ ]}
64
+ parameters={{
65
+ layout: 'fullscreen',
66
+ }}
67
+ />
68
+
69
+ <Anchor storyId="project-booster-scenario-pbscenario-features--show-more-documents" />
70
+
71
+ ## Show more documents
72
+
73
+ <Canvas>
74
+ <Story
75
+ name="show more documents"
76
+ inline={false}
77
+ height="758px"
78
+ args={{ payload: DEFAULT_PAYLOAD }}
79
+ parameters={{
80
+ msw: [
81
+ rest.get('/api/inhabitant-projects/:projectId/documents/', getDocumentsByInhabitantProjectIdResolver),
82
+ rest.post('/api/events/documents', acceptedResolver),
83
+ rest.post('/api/inhabitant-projects/:inhabitantProjectId/documents', uploadDocumentResolver),
84
+ rest.get(
85
+ '/api/inhabitant-projects/:inhabitantProjectId/documents/:documentId/thumbnail',
86
+ getDocumentsPdfThumbnailResolver,
87
+ ),
88
+ ],
89
+ }}
90
+ >
91
+ {TemplateSandbox.bind({})}
92
+ </Story>
93
+ </Canvas>
@@ -0,0 +1,67 @@
1
+ {
2
+ "viewModel": {
3
+ "label": "Vos plans de cuisine",
4
+ "answersComponent": "PbCard",
5
+ "startOpened": true,
6
+ "mediaPayload": {
7
+ "viewModel": {
8
+ "type": "documentsPlans",
9
+ "acceptedFileTypes": "image/jpeg, image/png, image/heif, image/heic, image/heif-sequence, image/heic-sequence, application/pdf",
10
+ "dialog": {
11
+ "hideCross": false,
12
+ "fullscreen": false,
13
+ "title": "Ajouter un plan",
14
+ "roomToggle": true,
15
+ "successUpload": "Votre plan a bien été ajouté",
16
+ "chooseAnotherMediaLabel": "Choisir un autre plan",
17
+ "uploadProgressTitle": "Chargement de votre plan",
18
+ "errorUploadTitle": "Une erreur est survenue lors de l'envoi de votre plan ",
19
+ "uploadPreviewTitle": "Nom de plan ",
20
+ "documentTypeTitle": "De quel type de plan s’agit il ?",
21
+ "acceptedMediaTypesErrorLabel": "Seuls les formats JPG et PNG, et PDF sont acceptés",
22
+ "mediaTypes": [
23
+ {
24
+ "type": "PLAN",
25
+ "subtype": "HAND_DRAWN_PLAN",
26
+ "code": "HAND_DRAWN_PLAN",
27
+ "label": "Un plan fait moi-même"
28
+ },
29
+ {
30
+ "type": "PLAN",
31
+ "subtype": "ARCHITECT_PLAN",
32
+ "code": "ARCHITECT_PLAN",
33
+ "label": "Un plan d’architecte"
34
+ },
35
+ {
36
+ "type": "PLAN",
37
+ "subtype": "KITCHEN_DESIGNER_PLAN",
38
+ "code": "KITCHEN_DESIGNER_PLAN",
39
+ "label": "Un plan d’un autre cuisiniste"
40
+ }
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ },
46
+ "skippable": [
47
+ {
48
+ "label": "Ajouter un plan plus tard",
49
+ "theme": "text-primary",
50
+ "width": "full",
51
+ "widthFromM": "fit",
52
+ "nextStep": {
53
+ "code": "LMFR_QUESTION_ADD_PLAN_LATER"
54
+ }
55
+ }
56
+ ],
57
+ "multiSelect": {
58
+ "actions": {
59
+ "VALIDATE": {
60
+ "label": "Continuer",
61
+ "nextStep": {
62
+ "code": "__END__"
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,93 @@
1
+ import { nestedAppDecorator } from '../../../../../.storybook/nested-app-decorator';
2
+ import { Anchor, Story, Meta, Source, Canvas } from '@storybook/addon-docs';
3
+ import MPbUploadDocument from './MPbUploadDocument';
4
+ import PbScenario from '../../../../components/scenario/PbScenario';
5
+ import DEFAULT_PAYLOAD from './MPbUploadDocument-Features-StartOpen.stories.json';
6
+ import { TemplateSandbox } from './MPbUploadDocument.stories.mdx';
7
+ import documentsStore from '../../../../stores/modules/documentsStore';
8
+ import { acceptedResolver } from '../../../../services/api/mocks/commonMock';
9
+ import { rest } from 'msw';
10
+ import {
11
+ getDocumentsByInhabitantProjectIdResolver,
12
+ getDocumentsPdfThumbnailResolver,
13
+ uploadDocumentResolver,
14
+ } from '../../../../services/api/mocks/documentsMock';
15
+ import cloneDeep from 'lodash.clonedeep';
16
+
17
+ <Meta
18
+ title="Project Booster/Rework/Questions/MPbUploadDocument 🦠/Feature"
19
+ component={MPbUploadDocument}
20
+ argTypes={{
21
+ payload: {
22
+ table: {
23
+ defaultValue: {
24
+ summary: 'object',
25
+ detail: JSON.stringify(DEFAULT_PAYLOAD, null, ' '),
26
+ },
27
+ },
28
+ control: {
29
+ type: 'object',
30
+ },
31
+ },
32
+ onStepCompleted: {
33
+ action: 'Step completed',
34
+ table: { disable: true },
35
+ },
36
+ }}
37
+ decorators={[
38
+ nestedAppDecorator(
39
+ {
40
+ modules: {
41
+ documents: cloneDeep(documentsStore),
42
+ documentsPlans: cloneDeep(documentsStore),
43
+ documentsPictures: cloneDeep(documentsStore),
44
+ },
45
+ mutations: {
46
+ eventBusSendEvent(state, { code, payload }) {
47
+ console.log('event bus data : ', code, payload);
48
+ },
49
+ },
50
+ getters: {
51
+ summary(state) {
52
+ return state.summary;
53
+ },
54
+ },
55
+ actions: {
56
+ sendEventToBus({}, payload) {
57
+ console.log('Event sent to bus', payload);
58
+ },
59
+ },
60
+ },
61
+ [{ path: '/steps/:stepCode/previous/:answers', component: MPbUploadDocument }],
62
+ ),
63
+ ]}
64
+ parameters={{
65
+ layout: 'fullscreen',
66
+ }}
67
+ />
68
+
69
+ <Anchor storyId="project-booster-scenario-pbscenario-features--start-open" />
70
+
71
+ ## Start open
72
+
73
+ <Canvas>
74
+ <Story
75
+ name="start open"
76
+ inline={false}
77
+ height="758px"
78
+ args={{ payload: DEFAULT_PAYLOAD }}
79
+ parameters={{
80
+ msw: [
81
+ rest.get('/api/inhabitant-projects/:projectId/documents/', getDocumentsByInhabitantProjectIdResolver),
82
+ rest.post('/api/events/documents', acceptedResolver),
83
+ rest.post('/api/inhabitant-projects/:inhabitantProjectId/documents', uploadDocumentResolver),
84
+ rest.get(
85
+ '/api/inhabitant-projects/:inhabitantProjectId/documents/:documentId/thumbnail',
86
+ getDocumentsPdfThumbnailResolver,
87
+ ),
88
+ ],
89
+ }}
90
+ >
91
+ {TemplateSandbox.bind({})}
92
+ </Story>
93
+ </Canvas>