project-booster-vue 9.28.2 → 9.30.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 (12) hide show
  1. package/package.json +1 -1
  2. package/src/components/appointment/PbAppointmentForm.stories.mdx +22 -2
  3. package/src/components/appointment/PbAppointmentForm.vue +21 -4
  4. package/src/components/appointment/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-components-appointment-qualification-pb-appointment-form-/360/237/246/240-101-sandbox-1-snap.png +0 -0
  5. package/src/components/appointment/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-components-appointment-qualification-pb-appointment-form-/360/237/246/240-with-custom-calendar-1-snap.png +0 -0
  6. package/src/components/mozaic/buttons/MButton.vue +2 -0
  7. 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
  8. package/src/components/question/city-search/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-city-search-/360/237/246/240-showcase-feature-customize-1-snap.png +0 -0
  9. package/src/components/question/city-search/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-city-search-/360/237/246/240-showcase-feature-previous-value-from-answer-1-snap.png +0 -0
  10. package/src/components/question/city-search/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-scenario-questions-pb-city-search-/360/237/246/240-showcase-feature-previous-value-from-default-1-snap.png +0 -0
  11. package/src/components/question/space-input/PbSpaceInput.vue +14 -2
  12. package/src/services/scenarioConditionals.ts +7 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "9.28.2",
3
+ "version": "9.30.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -71,8 +71,7 @@ export const TemplateSandbox = (args, { argTypes }) => ({
71
71
  store.commit('appointmentQualification/setClicRDVBaseUrl', 'https://sandbox-user.clicrdv.com');
72
72
  return { args };
73
73
  },
74
- template: `<pb-appointment-form />
75
- />`,
74
+ template: `<pb-appointment-form :payload="args.payload" />`,
76
75
  });
77
76
 
78
77
  <Canvas>
@@ -92,3 +91,24 @@ export const TemplateSandbox = (args, { argTypes }) => ({
92
91
  </Canvas>
93
92
 
94
93
  <ArgsTable story="101 Sandbox" />
94
+
95
+ # 🦠 `PbAppointmentForm` - Component with custom calendar
96
+
97
+ The `PbAppointmentForm` component that include in a iframe the clicRDV form with custom calendar.
98
+
99
+ <Canvas>
100
+ <Story
101
+ inline={false}
102
+ height="862px"
103
+ name="With custom calendar"
104
+ args={{ payload: { viewModel: { calendarUrlPath: 'custom-calendar' } } }}
105
+ parameters={{
106
+ msw: [
107
+ rest.get('/api/inhabitant-api/users/:buId/:inhabitantId', getInhabitantByIdResolver),
108
+ rest.post('/api/declarations-without-appointment', declarationsWithAppointmentResolver),
109
+ ],
110
+ }}
111
+ >
112
+ {TemplateSandbox.bind({})}
113
+ </Story>
114
+ </Canvas>
@@ -23,7 +23,18 @@ export default defineComponent({
23
23
  name: 'PbAppointmentForm',
24
24
  components: { MFlex },
25
25
 
26
- setup() {
26
+ props: {
27
+ /**
28
+ * The component view model and business data as an object.
29
+ */
30
+ payload: {
31
+ type: Object,
32
+ default: () => null,
33
+ required: false,
34
+ },
35
+ },
36
+
37
+ setup(props) {
27
38
  const store = useStore();
28
39
 
29
40
  const appointmentFormUrl = computed(() => {
@@ -33,9 +44,15 @@ export default defineComponent({
33
44
  const currentUser = store.getters['inhabitants/getCurrentInhabitant'];
34
45
  const baseUrl = store.getters['appointmentQualification/getClicRDVBaseUrl'];
35
46
 
36
- let url = `${baseUrl}/leroy-merlin-${sessions.storeId}`;
37
- url += `?calendar_id=${sessions.calendarId}`;
38
- url += `&vevent[str5]=${currentAppointmentQualification.inhabitantProjectId}`;
47
+ let url = '';
48
+ if (props.payload?.viewModel?.calendarUrlPath) {
49
+ url = `${baseUrl}/${props.payload.viewModel.calendarUrlPath}?`;
50
+ } else {
51
+ url = `${baseUrl}/leroy-merlin-${sessions.storeId}`;
52
+ url += `?calendar_id=${sessions.calendarId}`;
53
+ url += `&vevent[str5]=${currentAppointmentQualification.inhabitantProjectId}`;
54
+ }
55
+
39
56
  if (currentUser) {
40
57
  url += `&fiche[email]=${currentUser.email}`;
41
58
  url += `&fiche[lastname]=${currentUser.lastName}`;
@@ -547,6 +547,7 @@ $text-neutral: (
547
547
  border-color: $color-success-500;
548
548
  border-radius: 0.25rem 0 0 0.25rem;
549
549
  color: $color-success-500;
550
+ margin: 0 !important;
550
551
  padding: 0.375rem;
551
552
  }
552
553
 
@@ -555,6 +556,7 @@ $text-neutral: (
555
556
  border-color: $color-success-500;
556
557
  border-radius: 0 0.25rem 0.25rem 0;
557
558
  color: $color-success-500;
559
+ margin: 0 !important;
558
560
  padding: 0.375rem;
559
561
  }
560
562
  </style>
@@ -449,12 +449,15 @@ $responsive-breakpoint: 'm';
449
449
 
450
450
  &__dialog {
451
451
  &__title {
452
- padding: $mu250 $mu250 0 $mu250;
452
+ h2 {
453
+ @include set-font-face('semi-bold');
454
+ @include set-font-scale('07', 's');
455
+ padding: $mu250 $mu250 0 $mu250;
456
+ }
453
457
  }
454
458
 
455
459
  &__body {
456
460
  padding: 0 $mu250;
457
- @include set-font-scale('05', 'l');
458
461
  }
459
462
 
460
463
  &__footer {
@@ -472,3 +475,12 @@ $responsive-breakpoint: 'm';
472
475
  }
473
476
  }
474
477
  </style>
478
+
479
+ <style lang="scss">
480
+ @import 'pb-variables';
481
+
482
+ .pb-space-input__dialog__body p {
483
+ @include set-font-scale('05', 'm');
484
+ margin: $mu100 0;
485
+ }
486
+ </style>
@@ -1,4 +1,5 @@
1
1
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
2
+ import objectPath from 'object-path';
2
3
 
3
4
  const Condition = (
4
5
  condition: string,
@@ -17,6 +18,10 @@ const Condition = (
17
18
  }) > -1
18
19
  );
19
20
  };
21
+ const isAnswerValue = (questionCode: string, path: string, value: any) => {
22
+ const questionAnswers = answers.get(questionCode)!;
23
+ return questionAnswers ? objectPath.get(questionAnswers[0], path) === value : false;
24
+ };
20
25
  const hasAnswers = (questionCode: string) => {
21
26
  const questionAnswers = answers.get(questionCode)!;
22
27
  return questionAnswers.length > 0;
@@ -24,11 +29,12 @@ const Condition = (
24
29
  const isValid: boolean = new Function(
25
30
  'isAnswerMatching',
26
31
  'isAnswerContaining',
32
+ 'isAnswerValue',
27
33
  'hasAnswers',
28
34
  'answers',
29
35
  'runtimeOptions',
30
36
  `return ${condition}`,
31
- ).call(this, isAnswerMatching, isAnswerContaining, hasAnswers, answers, runtimeOptions);
37
+ ).call(this, isAnswerMatching, isAnswerContaining, isAnswerValue, hasAnswers, answers, runtimeOptions);
32
38
  return { isValid };
33
39
  };
34
40