project-booster-vue 9.2.1 → 9.2.4

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 (25) hide show
  1. package/package.json +1 -1
  2. package/src/components/configurations/list/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-components-configurations-pb-configurations-list-/360/237/247/254-component-showcase-1-snap.png +0 -0
  3. package/src/components/media/upload/PbMediaUpload.vue +3 -0
  4. package/src/components/projects/project-hub/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-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
  5. package/src/components/projects/project-hub/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-components-projects-pb-project-hub-/360/237/246/240-features-project-attributes-showcase-empty-state-1-snap.png +0 -0
  6. package/src/components/question/PbQuestion.vue +8 -3
  7. package/src/components/question/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-question-/360/237/246/240-demo-multiple-multiple-1-snap.png +0 -0
  8. package/src/components/question/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-question-/360/237/246/240-demo-simple-simple-1-snap.png +0 -0
  9. package/src/components/question/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-question-/360/237/246/240-features-answers-multiple-skippable-multiselect-question-1-snap.png +0 -0
  10. package/src/components/question/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-question-/360/237/246/240-features-question-101-101-1-snap.png +0 -0
  11. package/src/components/question/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-question-/360/237/246/240-features-question-custom-back-button-hide-back-button-1-snap.png +0 -0
  12. package/src/components/question/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-question-/360/237/246/240-features-question-decorator-stripes-decorator-stripe-1-snap.png +0 -0
  13. package/src/components/question/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-question-/360/237/246/240-features-question-show-more-show-more-1-snap.png +0 -0
  14. package/src/components/question/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-question-/360/237/246/240-features-question-skippable-mutiple-skippable-1-snap.png +0 -0
  15. package/src/components/question/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-question-/360/237/246/240-features-question-skippable-skippable-1-snap.png +0 -0
  16. package/src/components/question/upload-document/PbUploadDocument-Features-ShowMore.stories.json +8 -3
  17. package/src/components/question/upload-document/PbUploadDocument-Features-StartOpen.stories.json +8 -3
  18. package/src/components/question/upload-document/PbUploadDocument.vue +0 -3
  19. package/src/components/question/upload-document/default-payload.json +8 -3
  20. package/src/components/question/upload-document/pictures-payload.json +6 -3
  21. package/src/components/scenario/PbScenario.vue +8 -17
  22. package/src/components/scenario/scenarii/appointment-qualification-kitchen.json +13 -5
  23. package/src/components/tasks/contentul-preview/ContenfulPlanner.ts +1 -1
  24. package/src/components/tasks/details/PbTaskDetails.vue +2 -2
  25. package/src/types/pb/Scenario.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "9.2.1",
3
+ "version": "9.2.4",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -407,6 +407,9 @@ export default defineComponent({
407
407
 
408
408
  async upload() {
409
409
  if (!this.disabled && !this.isMediaUploaded) {
410
+ if (this.selectedType === null) {
411
+ this.selectedType = this.payload.viewModel.dialog.defaultMediaType;
412
+ }
410
413
  await this.$store.dispatch(this.storePrefix + 'uploadFile', {
411
414
  formData: this.formData,
412
415
  fileName: this.fileName,
@@ -331,7 +331,7 @@ export default defineComponent({
331
331
  */
332
332
  answers: {
333
333
  type: Object as PropType<Map<string, ScenarioStepAnswer[]>>,
334
- default: () => ({}),
334
+ default: () => new Map<string, ScenarioStepAnswer[]>(),
335
335
  },
336
336
  /**
337
337
  * Name for the current step in the scenario
@@ -433,8 +433,13 @@ export default defineComponent({
433
433
  if (
434
434
  questionPossibleAnswer &&
435
435
  (questionPossibleAnswer?.selected ||
436
- answerValues.findIndex((answer: ScenarioStepAnswer) => answer?.code === answerCode && answer?.selected) >=
437
- 0) &&
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) &&
438
443
  areConditionsValid(questionPossibleAnswer.conditions!, this.answers, this.runtimeOptions)
439
444
  ) {
440
445
  this.selectedAnswers.set(answerCode, true);
@@ -9,8 +9,7 @@
9
9
  "startOpened": false,
10
10
  "mediaPayload": {
11
11
  "viewModel": {
12
- "type": "documents",
13
- "subType": "PLAN",
12
+ "type": "documentsPlans",
14
13
  "acceptedFileTypes": "image/jpeg, image/png, image/heif, image/heic, image/heif-sequence, image/heic-sequence, application/pdf",
15
14
  "dialog": {
16
15
  "hideCross": false,
@@ -25,14 +24,20 @@
25
24
  "acceptedMediaTypesErrorLabel": "Seuls les formats JPG et PNG, et PDF sont acceptés",
26
25
  "mediaTypes": [
27
26
  {
27
+ "type": "PLAN",
28
+ "subtype": "HAND_DRAWN_PLAN",
28
29
  "code": "HAND_DRAWN_PLAN",
29
- "label": "Un plan fait moi même"
30
+ "label": "Un plan fait moi-même"
30
31
  },
31
32
  {
33
+ "type": "PLAN",
34
+ "subtype": "ARCHITECT_PLAN",
32
35
  "code": "ARCHITECT_PLAN",
33
36
  "label": "Un plan d’architecte"
34
37
  },
35
38
  {
39
+ "type": "PLAN",
40
+ "subtype": "KITCHEN_DESIGNER_PLAN",
36
41
  "code": "KITCHEN_DESIGNER_PLAN",
37
42
  "label": "Un plan d’un autre cuisiniste"
38
43
  }
@@ -5,8 +5,7 @@
5
5
  "startOpened": true,
6
6
  "mediaPayload": {
7
7
  "viewModel": {
8
- "type": "documents",
9
- "subType": "PLAN",
8
+ "type": "documentsPlans",
10
9
  "acceptedFileTypes": "image/jpeg, image/png, image/heif, image/heic, image/heif-sequence, image/heic-sequence, application/pdf",
11
10
  "dialog": {
12
11
  "hideCross": false,
@@ -22,14 +21,20 @@
22
21
  "acceptedMediaTypesErrorLabel": "Seuls les formats JPG et PNG, et PDF sont acceptés",
23
22
  "mediaTypes": [
24
23
  {
24
+ "type": "PLAN",
25
+ "subtype": "HAND_DRAWN_PLAN",
25
26
  "code": "HAND_DRAWN_PLAN",
26
- "label": "Un plan fait moi même"
27
+ "label": "Un plan fait moi-même"
27
28
  },
28
29
  {
30
+ "type": "PLAN",
31
+ "subtype": "ARCHITECT_PLAN",
29
32
  "code": "ARCHITECT_PLAN",
30
33
  "label": "Un plan d’architecte"
31
34
  },
32
35
  {
36
+ "type": "PLAN",
37
+ "subtype": "KITCHEN_DESIGNER_PLAN",
33
38
  "code": "KITCHEN_DESIGNER_PLAN",
34
39
  "label": "Un plan d’un autre cuisiniste"
35
40
  }
@@ -238,9 +238,6 @@ export default defineComponent({
238
238
  setup(props, { emit }) {
239
239
  const store = useStore();
240
240
  let storeModuleName = ref(props.payload.viewModel.mediaPayload.viewModel.type);
241
- if (props.payload.viewModel.mediaPayload.viewModel.subType) {
242
- storeModuleName.value += props.payload.viewModel.mediaPayload.viewModel.subType === 'PLAN' ? 'Plans' : 'Pictures';
243
- }
244
241
 
245
242
  const pbMediaUpload = ref<ComponentCustomProperties>();
246
243
 
@@ -5,8 +5,7 @@
5
5
  "startOpened": false,
6
6
  "mediaPayload": {
7
7
  "viewModel": {
8
- "type": "documents",
9
- "subType": "PLAN",
8
+ "type": "documentsPlan",
10
9
  "acceptedFileTypes": "image/jpeg, image/png, image/heif, image/heic, image/heif-sequence, image/heic-sequence, application/pdf",
11
10
  "dialog": {
12
11
  "hideCross": false,
@@ -21,14 +20,20 @@
21
20
  "acceptedMediaTypesErrorLabel": "Seuls les formats JPG et PNG, et PDF sont acceptés",
22
21
  "mediaTypes": [
23
22
  {
23
+ "type": "PLAN",
24
+ "subtype": "HAND_DRAWN_PLAN",
24
25
  "code": "HAND_DRAWN_PLAN",
25
- "label": "Un plan fait moi même"
26
+ "label": "Un plan fait moi-même"
26
27
  },
27
28
  {
29
+ "type": "PLAN",
30
+ "subtype": "ARCHITECT_PLAN",
28
31
  "code": "ARCHITECT_PLAN",
29
32
  "label": "Un plan d’architecte"
30
33
  },
31
34
  {
35
+ "type": "PLAN",
36
+ "subtype": "KITCHEN_DESIGNER_PLAN",
32
37
  "code": "KITCHEN_DESIGNER_PLAN",
33
38
  "label": "Un plan d’un autre cuisiniste"
34
39
  }
@@ -6,8 +6,7 @@
6
6
  "addText": " ",
7
7
  "mediaPayload": {
8
8
  "viewModel": {
9
- "type": "documents",
10
- "subType": "PHOTO",
9
+ "type": "documentsPictures",
11
10
  "acceptedFileTypes": "image/jpeg, image/png, image/heif, image/heic, image/heif-sequence, image/heic-sequence",
12
11
  "dialog": {
13
12
  "hideCross": false,
@@ -18,7 +17,11 @@
18
17
  "chooseAnotherMediaLabel": "Choisir une autre photo",
19
18
  "uploadProgressTitle": "Chargement de votre photo",
20
19
  "errorUploadTitle": "Une erreur est survenue lors de l'envoi de votre photo ",
21
- "uploadPreviewTitle": "Nom de la photo"
20
+ "uploadPreviewTitle": "Nom de la photo",
21
+ "defaultMediaType": {
22
+ "type": "PHOTO",
23
+ "subtype": "ROOM_PHOTO"
24
+ }
22
25
  }
23
26
  }
24
27
  }
@@ -373,7 +373,7 @@ export default defineComponent({
373
373
  animateDisplayedStep(stepIndex < state.value.history.stepIndex);
374
374
  state.value.history.stepIndex = stepIndex;
375
375
 
376
- if (state.value.currentStep.code === '__END__') {
376
+ if (state.value?.currentStep?.code && state.value.currentStep.code === '__END__') {
377
377
  /**
378
378
  * Emitted when the scenario is completed
379
379
  * @event scenario-completed
@@ -381,7 +381,7 @@ export default defineComponent({
381
381
  emit('scenario-completed', state.value.answers);
382
382
  emitEventToPipeline('SCENARIO-COMPLETED', state.value.currentStep);
383
383
  } else {
384
- emitEventToPipeline('STEP-STARTED', state.value.currentStep);
384
+ emitEventToPipeline('STEP-STARTED', state.value?.currentStep);
385
385
  }
386
386
  } else {
387
387
  console.warn(`Scenario step ${stepIndex} was requested but is not in the history`);
@@ -429,7 +429,7 @@ export default defineComponent({
429
429
  };
430
430
  const trackProgress = (originIndex: number, steps: ScenarioHistoryItem[]) => {
431
431
  let currentPosition = 1;
432
- for (let index = originIndex; index--; index >= 0) {
432
+ for (let index = Math.max(originIndex, 0); index >= 0; index--) {
433
433
  if (steps[index]?.step?.type === 'SCENARIO') {
434
434
  break;
435
435
  }
@@ -593,8 +593,8 @@ export default defineComponent({
593
593
  state.value.history.steps = [];
594
594
 
595
595
  state.value.stepsToResume = [];
596
- state.value.currentStep = null;
597
- state.value.displayedStep = null;
596
+ state.value.currentStep = undefined;
597
+ state.value.displayedStep = undefined;
598
598
  reverseAnimation.value = false;
599
599
 
600
600
  initScenario('__START__');
@@ -620,20 +620,11 @@ export default defineComponent({
620
620
  },
621
621
  );
622
622
 
623
+ if (!props.previousState) {
624
+ initScenario('__START__');
625
+ }
623
626
  onMounted(() => {
624
627
  document.getElementsByTagName('body')[0].style.setProperty('overflow-x', 'hidden');
625
- if (scenarios && !props.previousState) {
626
- initScenario('__START__');
627
- } else {
628
- if (props.previousState.refreshSteps) {
629
- state.value.answers = props.previousState.answers;
630
- initScenario('__START__');
631
- } else {
632
- state.value = props.previousState;
633
- const steps = props.previousState?.history?.steps ?? [];
634
- state.value.stepsToResume = steps[props.previousState.history.stepIndex - 1]?.stepsToResume ?? [];
635
- }
636
- }
637
628
  });
638
629
 
639
630
  return {
@@ -558,8 +558,7 @@
558
558
  },
559
559
  "mediaPayload": {
560
560
  "viewModel": {
561
- "type": "documents",
562
- "subType": "PLAN",
561
+ "type": "documentsPictures",
563
562
  "acceptedFileTypes": "image/jpeg, image/png, image/heif, image/heic, application/pdf",
564
563
  "dialog": {
565
564
  "hideCross": false,
@@ -573,14 +572,20 @@
573
572
  "mediaTypeTitle": "De quel type de plan s’agit il ?",
574
573
  "mediaTypes": [
575
574
  {
575
+ "type": "PLAN",
576
+ "subtype": "HAND_DRAWN_PLAN",
576
577
  "code": "HAND_DRAWN_PLAN",
577
578
  "label": "Un plan fait moi-même"
578
579
  },
579
580
  {
581
+ "type": "PLAN",
582
+ "subtype": "ARCHITECT_PLAN",
580
583
  "code": "ARCHITECT_PLAN",
581
584
  "label": "Un plan d’architecte"
582
585
  },
583
586
  {
587
+ "type": "PLAN",
588
+ "subtype": "KITCHEN_DESIGNER_PLAN",
584
589
  "code": "KITCHEN_DESIGNER_PLAN",
585
590
  "label": "Un plan d’un autre cuisiniste"
586
591
  }
@@ -707,8 +712,7 @@
707
712
  },
708
713
  "mediaPayload": {
709
714
  "viewModel": {
710
- "type": "documents",
711
- "subType": "PHOTO",
715
+ "type": "documentsPictures",
712
716
  "acceptedFileTypes": "image/jpeg, image/png, image/heif, image/heic",
713
717
  "dialog": {
714
718
  "hideCross": false,
@@ -718,7 +722,11 @@
718
722
  "chooseAnotherMediaLabel": "Choisir une autre photo",
719
723
  "uploadProgressTitle": "Chargement de votre photo",
720
724
  "errorUploadTitle": "Une erreur est survenue lors de l'envoi de votre photo",
721
- "uploadPreviewTitle": "Nom de la photo "
725
+ "uploadPreviewTitle": "Nom de la photo",
726
+ "defaultMediaType": {
727
+ "type": "PHOTO",
728
+ "subtype": "ROOM_PHOTO"
729
+ }
722
730
  }
723
731
  }
724
732
  }
@@ -237,7 +237,7 @@ export const contentfulPlanner = (
237
237
  throw new Error(`No sections found for ${PROJECT_PLANNER_SKELETON_CONTENT_TYPE}`);
238
238
  }
239
239
 
240
- for (const [index, section] of plannerSections?.entries()) {
240
+ for (const [index, section] of plannerSections.entries()) {
241
241
  sections[section.sys.id] = {
242
242
  title: section.fields.title!,
243
243
  position: index,
@@ -318,7 +318,7 @@ export default defineComponent({
318
318
  if (tempTask.value?.viewModel?.sections) {
319
319
  for (const section of tempTask.value.viewModel.sections) {
320
320
  if (section?.options) {
321
- for (const option of section?.options) {
321
+ for (const option of section.options) {
322
322
  if (
323
323
  !isEqual(tempOptionValues.value[decorateValue(option.id)], decorateValue(option.value!)) ||
324
324
  (tempOptionValues.value[decorateValue(option.id)] && !option.value)
@@ -351,7 +351,7 @@ export default defineComponent({
351
351
  if (tempTask.value?.viewModel?.sections) {
352
352
  for (const section of tempTask.value.viewModel.sections) {
353
353
  if (section?.options) {
354
- for (const option of section?.options) {
354
+ for (const option of section.options) {
355
355
  const newValue = tempOptionValues.value[decorateValue(option.id)];
356
356
  const sanitizedNewValue = newValue !== undefined ? newValue : undefined ?? '';
357
357
  const optionValues = tempTask.value?.optionValues ?? {};
@@ -144,8 +144,8 @@ export interface ScenarioHistory {
144
144
  export interface ScenarioState {
145
145
  answers: Map<string, ScenarioStepAnswer[]>;
146
146
  stepsToResume: ScenarioStep[];
147
- currentStep: ScenarioStep | null;
148
- displayedStep: ScenarioStep | null;
147
+ currentStep: ScenarioStep | undefined;
148
+ displayedStep: ScenarioStep | undefined;
149
149
  history: ScenarioHistory;
150
150
  refreshSteps: boolean;
151
151
  }