project-booster-vue 9.3.0 → 9.5.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": "9.3.0",
3
+ "version": "9.5.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -81,21 +81,21 @@
81
81
  "@mswjs/interceptors": "0.12.7",
82
82
  "@semantic-release/changelog": "5.0.1",
83
83
  "@semantic-release/git": "9.0.0",
84
- "@storybook/addon-a11y": "6.4.21",
85
- "@storybook/addon-essentials": "6.4.21",
84
+ "@storybook/addon-a11y": "6.4.22",
85
+ "@storybook/addon-essentials": "6.4.22",
86
86
  "@storybook/addon-knobs": "6.3.1",
87
- "@storybook/addon-links": "6.4.21",
87
+ "@storybook/addon-links": "6.4.22",
88
88
  "@storybook/addon-postcss": "2.0.0",
89
- "@storybook/addon-storyshots": "6.4.21",
90
- "@storybook/addon-storyshots-puppeteer": "6.4.21",
91
- "@storybook/addon-storysource": "6.4.21",
92
- "@storybook/addons": "6.4.21",
93
- "@storybook/builder-webpack5": "6.4.21",
94
- "@storybook/manager-webpack5": "6.4.21",
95
- "@storybook/source-loader": "6.4.21",
89
+ "@storybook/addon-storyshots": "6.4.22",
90
+ "@storybook/addon-storyshots-puppeteer": "6.4.22",
91
+ "@storybook/addon-storysource": "6.4.22",
92
+ "@storybook/addons": "6.4.22",
93
+ "@storybook/builder-webpack5": "6.4.22",
94
+ "@storybook/manager-webpack5": "6.4.22",
95
+ "@storybook/source-loader": "6.4.22",
96
96
  "@storybook/storybook-deployer": "2.8.11",
97
- "@storybook/theming": "6.4.21",
98
- "@storybook/vue3": "6.4.21",
97
+ "@storybook/theming": "6.4.22",
98
+ "@storybook/vue3": "6.4.22",
99
99
  "@testing-library/jest-dom": "5.16.2",
100
100
  "@testing-library/vue": "6.5.1",
101
101
  "@types/axios": "0.14.0",
@@ -147,7 +147,7 @@
147
147
  "eslint-plugin-import": "2.25.4",
148
148
  "eslint-plugin-mdx": "1.16.0",
149
149
  "eslint-plugin-prettier": "4.0.0",
150
- "eslint-plugin-storybook": "0.5.8",
150
+ "eslint-plugin-storybook": "0.5.10",
151
151
  "eslint-plugin-vue": "7.11.1",
152
152
  "fluent-json-schema": "3.0.1",
153
153
  "husky": "6.0.0",
@@ -25,9 +25,14 @@
25
25
  "label": "Un plan d’architecte"
26
26
  },
27
27
  {
28
- "type": "PLAN",
29
- "subtype": "KITCHEN_DESIGNER_PLAN",
30
- "label": "Un plan d’un autre cuisiniste"
28
+ "type": "PHOTO",
29
+ "subtype": "ANY",
30
+ "label": "Une photo"
31
+ },
32
+ {
33
+ "type": "OTHER",
34
+ "subtype": "ANY",
35
+ "label": "Autre"
31
36
  }
32
37
  ]
33
38
  }
@@ -83,7 +83,17 @@
83
83
  </m-flex>
84
84
  <m-flex v-if="isDocumentsDisplayed" class="pb-project-hub__section" direction="column" full-width>
85
85
  <div class="pb-project-hub__section-header">
86
- <div class="pb-project-hub__section-title">{{ titleDocument }}</div>
86
+ <div class="pb-project-hub__section-title-container">
87
+ <div class="pb-project-hub__section-title">{{ titleDocument }}</div>
88
+ <pb-media-upload
89
+ v-if="displayedDocuments && displayedDocuments.length > 0"
90
+ storeModuleName="documents"
91
+ :payload="DOCUMENT_UPLOAD_PAYLOAD"
92
+ acceptedFileTypes="image jpeg, image png, image heif, image heic, image/heif-sequence, image/heic-sequence, application
93
+ pdf"
94
+ @media-uploaded="handleDocumentUploaded"
95
+ />
96
+ </div>
87
97
  </div>
88
98
  <div class="pb-project-hub__section-content">
89
99
  <m-flex
@@ -383,7 +393,15 @@
383
393
  </m-flex>
384
394
  <m-flex v-if="isMediaDisplayed" class="pb-project-hub__section" direction="column" full-width>
385
395
  <div class="pb-project-hub__section-header">
386
- <div class="pb-project-hub__section-title">{{ titlePhotoInspiration }}</div>
396
+ <div class="pb-project-hub__section-title-container">
397
+ <div class="pb-project-hub__section-title">{{ titlePhotoInspiration }}</div>
398
+ <pb-media-upload
399
+ v-if="displayedInspirations && displayedInspirations.length > 0"
400
+ storeModuleName="documents"
401
+ :payload="MEDIA_UPLOAD_PAYLOAD"
402
+ @media-uploaded="handleMediaUploaded"
403
+ />
404
+ </div>
387
405
  </div>
388
406
  <div class="pb-project-hub__section-content">
389
407
  <m-flex
@@ -789,6 +807,9 @@ import { Tool } from '@/types/pb/Tool';
789
807
  import { Configuration } from '@/types/pb/Configuration';
790
808
  import { Estimate } from '@/types/pb/Estimate';
791
809
  import { Task } from '@/types/pb/Task';
810
+ import PbMediaUpload from '@/components/media/upload/PbMediaUpload.vue';
811
+ import DOCUMENT_UPLOAD_PAYLOAD from '@/components/media/upload/document-upload-payload.json';
812
+ import MEDIA_UPLOAD_PAYLOAD from '@/components/media/upload/media-upload-payload.json';
792
813
 
793
814
  const BACK_ICON =
794
815
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -830,6 +851,7 @@ export default defineComponent({
830
851
  name: 'PbProjectHub',
831
852
 
832
853
  components: {
854
+ PbMediaUpload,
833
855
  MAccordion,
834
856
  MButton,
835
857
  MContainer,
@@ -917,6 +939,8 @@ export default defineComponent({
917
939
  showMoreButtonAnimationDelay: 0,
918
940
  BACK_ICON,
919
941
  TASK_MODEL,
942
+ DOCUMENT_UPLOAD_PAYLOAD,
943
+ MEDIA_UPLOAD_PAYLOAD,
920
944
  displayCategoriesDialog: false,
921
945
  }),
922
946
 
@@ -1338,6 +1362,14 @@ export default defineComponent({
1338
1362
  behavior: 'smooth',
1339
1363
  });
1340
1364
  },
1365
+
1366
+ handleDocumentUploaded() {
1367
+ this.$store.dispatch('documents/refreshMediaList');
1368
+ },
1369
+
1370
+ handleMediaUploaded() {
1371
+ this.$store.dispatch('media/refreshMediaList');
1372
+ },
1341
1373
  },
1342
1374
  });
1343
1375
  </script>
@@ -1403,6 +1435,11 @@ $appear-duration: 100ms;
1403
1435
 
1404
1436
  &-header {
1405
1437
  padding-bottom: $mu150;
1438
+ width: 100%;
1439
+ }
1440
+
1441
+ &-title-container {
1442
+ display: flex;
1406
1443
  }
1407
1444
 
1408
1445
  &-title {
@@ -1410,6 +1447,7 @@ $appear-duration: 100ms;
1410
1447
  @include set-font-scale('07', 'm');
1411
1448
 
1412
1449
  color: $color-grey-800;
1450
+ flex-grow: 1;
1413
1451
  }
1414
1452
 
1415
1453
  &-subtitle {
@@ -427,19 +427,18 @@ export default defineComponent({
427
427
  this.pageSize = this.payload.viewModel.showMore.itemsPerPage;
428
428
  }
429
429
 
430
+ const answerValues = this.answers?.get(this.stepName ?? '') ?? [];
430
431
  for (const { code: answerCode } of Object.values(Object.fromEntries(this.questionPossibleAnswers))) {
431
- const answerValues = this.answers?.get(this.stepName ?? '') ?? [];
432
432
  const questionPossibleAnswer = this.questionPossibleAnswers.get(answerCode);
433
433
  if (
434
434
  questionPossibleAnswer &&
435
- (questionPossibleAnswer?.selected ||
436
- answerValues.findIndex(
437
- (answer: ScenarioStepAnswer | string) =>
438
- (typeof answer === 'string' && answer === answerCode) ||
439
- (typeof answer === 'object' &&
440
- (<ScenarioStepAnswer>answer)?.code === answerCode &&
441
- (<ScenarioStepAnswer>answer)?.selected),
442
- ) >= 0) &&
435
+ answerValues.findIndex(
436
+ (answer: ScenarioStepAnswer | string) =>
437
+ (typeof answer === 'string' && answer === answerCode) ||
438
+ (typeof answer === 'object' &&
439
+ (<ScenarioStepAnswer>answer)?.code === answerCode &&
440
+ (<ScenarioStepAnswer>answer)?.selected),
441
+ ) >= 0 &&
443
442
  areConditionsValid(questionPossibleAnswer.conditions!, this.answers, this.runtimeOptions)
444
443
  ) {
445
444
  this.selectedAnswers.set(answerCode, true);
@@ -499,10 +498,9 @@ export default defineComponent({
499
498
  if (!this.payload.multiSelect) {
500
499
  this.initAnswersSelectedState(this.payload.answers);
501
500
  }
502
- answer.selected = !answer.selected;
503
501
 
504
502
  if (this.payload.multiSelect) {
505
- this.selectedAnswers.set(answer.code, answer.selected);
503
+ this.selectedAnswers.set(answer.code, !this.selectedAnswers.get(answer.code) ?? true);
506
504
 
507
505
  const selected = Object.fromEntries(Object.entries(this.selectedAnswers).filter(([, value]) => value === true));
508
506
  /**
@@ -514,7 +512,7 @@ export default defineComponent({
514
512
  Object.keys(Object.fromEntries(this.selectedAnswers)).forEach((answerCode) => {
515
513
  this.selectedAnswers.set(answerCode, false);
516
514
  });
517
- this.selectedAnswers.set(answer.code, answer.selected);
515
+ this.selectedAnswers.set(answer.code, !this.selectedAnswers.get(answer.code) ?? true);
518
516
 
519
517
  /**
520
518
  * Emitted when step is completed
@@ -195,6 +195,7 @@ export default defineComponent({
195
195
  remainingSteps: 0,
196
196
  });
197
197
  const reverseAnimation = ref(false);
198
+ const forceRefresh = ref(false);
198
199
  const noPointerEvents = ref(false);
199
200
  const stepAnimationTimeoutId = ref<ReturnType<typeof setTimeout>>();
200
201
  const progressUpdateTimeoutId = ref<ReturnType<typeof setTimeout>>();
@@ -288,7 +289,12 @@ export default defineComponent({
288
289
  let stepIndex = state.value.history.stepIndex - 1;
289
290
 
290
291
  const steps = state.value.history.steps ?? [];
291
- while (stepIndex > 0 && steps[stepIndex - 1].step.type !== 'STEP') {
292
+ while (
293
+ stepIndex > 0 &&
294
+ steps[stepIndex - 1] &&
295
+ steps[stepIndex - 1].step &&
296
+ steps[stepIndex - 1].step.type !== 'STEP'
297
+ ) {
292
298
  stepIndex--;
293
299
  }
294
300
 
@@ -355,7 +361,13 @@ export default defineComponent({
355
361
  }
356
362
  };
357
363
  const goToStep = (stepIndex: number) => {
358
- let requestedStep = state.value.history?.steps?.[stepIndex - 1];
364
+ let requestedStep = state.value.history?.steps ? state.value.history.steps[stepIndex - 1] : undefined;
365
+
366
+ if (!requestedStep) {
367
+ requestedStep = state.value.history?.steps
368
+ ? state.value.history.steps[state.value.history.stepIndex - 1]
369
+ : undefined;
370
+ }
359
371
 
360
372
  if (requestedStep) {
361
373
  if (requestedStep.step.resetAnswersOnBack) {
@@ -593,7 +605,8 @@ export default defineComponent({
593
605
  watch(route, () => {
594
606
  const requestedStepIndex = route.params?.stepCode as string;
595
607
 
596
- if (requestedStepIndex && requestedStepIndex !== `${state.value.history.stepIndex}`) {
608
+ if ((requestedStepIndex && requestedStepIndex !== `${state.value.history.stepIndex}`) || forceRefresh.value) {
609
+ forceRefresh.value = false;
597
610
  goToStep(parseInt(requestedStepIndex));
598
611
  }
599
612
  });
@@ -623,6 +636,7 @@ export default defineComponent({
623
636
  state.value.answers = new Map<string, ScenarioStepAnswer[]>(Object.entries(state.value.answers));
624
637
  }
625
638
  const newRoute = `/steps/${state.value.history.stepIndex}/previous/${uuidv4()}`;
639
+ forceRefresh.value = true;
626
640
  router.replace(newRoute);
627
641
  }
628
642
  },