project-booster-vue 9.55.4 → 9.56.1

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 (21) hide show
  1. package/package.json +1 -1
  2. package/src/components/pedagogy/PbPedagogy.stories.mdx +9 -0
  3. package/src/components/pedagogy/PbPedagogy.vue +58 -0
  4. package/src/components/pedagogy/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-components-pedagogy-pb-pedagogy-/360/237/246/240-with-mail-lead-1-snap.png +0 -0
  5. package/src/components/pedagogy/with-email-lead.json +27 -0
  6. package/src/components/restitution/PbRestitution.vue +5 -1
  7. package/src/components/rework/question/name-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-name-input-/360/237/246/240-101-sandbox-1-snap.png +0 -0
  8. package/src/components/rework/question/name-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-name-input-/360/237/246/240-showcase-feature-customize-1-snap.png +0 -0
  9. package/src/components/rework/question/name-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-name-input-/360/237/246/240-showcase-feature-optin-1-snap.png +0 -0
  10. package/src/components/rework/question/name-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-name-input-/360/237/246/240-showcase-feature-previous-value-from-answer-1-snap.png +0 -0
  11. package/src/components/rework/question/name-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-name-input-/360/237/246/240-showcase-feature-previous-value-from-answer-with-optin-1-snap.png +0 -0
  12. package/src/components/rework/question/name-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-name-input-/360/237/246/240-showcase-feature-previous-value-from-default-1-snap.png +0 -0
  13. package/src/components/rework/question/name-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-name-input-/360/237/246/240-showcase-feature-previous-value-from-default-with-optin-1-snap.png +0 -0
  14. package/src/components/rework/question/space-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-space-input-/360/237/246/240-101-sandbox-1-snap.png +0 -0
  15. package/src/components/rework/question/space-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-space-input-/360/237/246/240-showcase-feature-custom-footer-1-snap.png +0 -0
  16. package/src/components/rework/question/space-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-space-input-/360/237/246/240-showcase-feature-customize-1-snap.png +0 -0
  17. package/src/components/rework/question/space-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-space-input-/360/237/246/240-showcase-feature-previous-value-from-answer-1-snap.png +0 -0
  18. package/src/components/rework/question/space-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-space-input-/360/237/246/240-showcase-feature-previous-value-from-default-1-snap.png +0 -0
  19. package/src/components/rework/question/space-input/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-rework-questions-m-pb-space-input-/360/237/246/240-showcase-feature-with-modal-1-snap.png +0 -0
  20. package/src/components/scenario/PbScenario-Estimator-Bathroom.stories.mdx +245 -0
  21. package/src/components/scenario/scenarii/bathroom-estimate.json +2392 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "9.55.4",
3
+ "version": "9.56.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,6 +1,7 @@
1
1
  import { Anchor, Story, Preview, Meta, Props, ArgsTable, Source, Canvas } from '@storybook/addon-docs';
2
2
  import DEFAULT_PAYLOAD from './default-payload';
3
3
  import WITH_INSTRUCTIONS from './with-instructions';
4
+ import WITH_MAIL_LEAD from './with-email-lead';
4
5
  import { nestedAppDecorator } from '../../../.storybook/nested-app-decorator';
5
6
  import PbPedagogy from './PbPedagogy';
6
7
  import store from '../../stores/store';
@@ -57,3 +58,11 @@ export const TemplateSandbox = (args, { argTypes }) => ({
57
58
  {TemplateSandbox.bind({})}
58
59
  </Story>
59
60
  </Canvas>
61
+
62
+ ## showCase
63
+
64
+ <Canvas>
65
+ <Story inline={false} height="862px" name="With Mail Lead" args={{ payload: WITH_MAIL_LEAD }}>
66
+ {TemplateSandbox.bind({})}
67
+ </Story>
68
+ </Canvas>
@@ -14,6 +14,21 @@
14
14
  <div class="pb-pedagogy__content-description-line-text" v-html="line.label" />
15
15
  </div>
16
16
  </m-flex>
17
+ <form action="#" class="pb-pedagogy__form-lead" v-if="payload.viewModel.showFormLead">
18
+ <input
19
+ type="email"
20
+ class="pb-pedagogy__form-lead__input"
21
+ v-model="emailToSaved"
22
+ required
23
+ :placeholder="payload.viewModel.showFormLead.inputPlaceholder"
24
+ />
25
+ <div v-if="error && error.message" class="pb-pedagogy__error">{{ error.message }}</div>
26
+ <m-button
27
+ :label="payload.viewModel.showFormLead.buttonLabel"
28
+ class="pb-pedagogy__form-lead__button mc-button--full"
29
+ @click="saveFormLead(payload.viewModel.showFormLead)"
30
+ />
31
+ </form>
17
32
  <m-flex
18
33
  class="pb-pedagogy__content__button-informations"
19
34
  align-items="center"
@@ -89,6 +104,8 @@ export default defineComponent({
89
104
  },
90
105
  data: () => ({
91
106
  value: [],
107
+ emailToSaved: '',
108
+ error: {},
92
109
  }),
93
110
  computed: {
94
111
  ...mapGetters('appointmentQualification', {
@@ -149,6 +166,25 @@ export default defineComponent({
149
166
  nextStep: action.nextStep,
150
167
  });
151
168
  },
169
+ saveFormLead(action: any) {
170
+ const validation = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(this.emailToSaved.trim());
171
+
172
+ if (this.emailToSaved.trim() != '' && validation) {
173
+ this.error = false;
174
+ this.$emit('step-completed', {
175
+ answers: [
176
+ {
177
+ email: this.emailToSaved,
178
+ },
179
+ ],
180
+ nextStep: action.nextStep,
181
+ });
182
+ } else {
183
+ this.error = {
184
+ message: 'Veuillez rentrer un email valide.',
185
+ };
186
+ }
187
+ },
152
188
  },
153
189
  });
154
190
  </script>
@@ -163,6 +199,28 @@ $responsive-breakpoint: 'm';
163
199
  padding-top: $mu500;
164
200
  width: 100%;
165
201
 
202
+ &__form-lead {
203
+ margin-top: $mu250;
204
+ width: 100%;
205
+
206
+ @include set-from-screen($responsive-breakpoint) {
207
+ width: 230px;
208
+ }
209
+
210
+ &__input {
211
+ margin-bottom: $mu100;
212
+ width: calc(100% - 1.2rem);
213
+ padding: $mu050;
214
+ }
215
+ }
216
+
217
+ &__error {
218
+ @include set-font-scale('04', 'm');
219
+
220
+ color: $color-danger-500;
221
+ margin-bottom: $mu050;
222
+ }
223
+
166
224
  &__content {
167
225
  box-sizing: border-box;
168
226
  padding: $mu100;
@@ -0,0 +1,27 @@
1
+ {
2
+ "viewModel": {
3
+ "title": "Merci pour votre choix. Ce service sera prochainement disponible.",
4
+ "icon": "https://storage.googleapis.com/project-booster-media/vad/fin-de-parcours/check_80.svg",
5
+ "description": [
6
+ {
7
+ "label": "Vous voulez être informé lorsque ce service sera disponible ? Laissez nous votre email et nous vous enverrons un message."
8
+ }
9
+ ],
10
+ "showFormLead": {
11
+ "buttonLabel": "Envoyer",
12
+ "inputPlaceholder": "votre email",
13
+ "nextStep": {
14
+ "code": "SUMMARY"
15
+ }
16
+ }
17
+ },
18
+ "callToActions": [
19
+ {
20
+ "isAnswer": false,
21
+ "label": "Retourner à l’estimation",
22
+ "nextStep": {
23
+ "code": "SUMMARY"
24
+ }
25
+ }
26
+ ]
27
+ }
@@ -279,9 +279,13 @@ export default defineComponent({
279
279
  if (action?.type === 'MODAL') {
280
280
  this.dialogViewModel = action.dialogViewModel;
281
281
  this.displayDialog = true;
282
+ } else if (action?.type === 'STEP') {
283
+ this.$emit('step-completed', {
284
+ answers: [],
285
+ nextStep: action,
286
+ });
282
287
  }
283
288
  },
284
-
285
289
  handleDialogClose() {
286
290
  this.showSaveProjectItem = false;
287
291
  },
@@ -0,0 +1,245 @@
1
+ import { nestedAppDecorator } from '../../../.storybook/nested-app-decorator';
2
+ import { Anchor, Story, Preview, Meta, Props, ArgsTable, Source, Canvas } from '@storybook/addon-docs';
3
+ import PbScenario from './PbScenario';
4
+ import estimatesStore from '../../stores/modules/estimatesStore';
5
+ import DEFAULT_PAYLOAD from './scenarii/bathroom-estimate.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)/Bathroom Estimator"
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="Bathroom Estimator"
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
+ ```