project-booster-vue 9.57.4 → 9.58.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.57.4",
3
+ "version": "9.58.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -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>
@@ -0,0 +1,157 @@
1
+ import { nestedAppDecorator } from '../../../../../.storybook/nested-app-decorator';
2
+ import { Story, Meta, ArgsTable, Canvas } from '@storybook/addon-docs';
3
+ import MPbUploadDocument from './MPbUploadDocument';
4
+ import PbScenario from '../../../../components/scenario/PbScenario';
5
+ import DEFAULT_PAYLOAD from './default-payload.json';
6
+ import PICTURES_PAYLOAD from './pictures-payload.json';
7
+ import documentsStore from '../../../../stores/modules/documentsStore';
8
+ import appointmentQualificationStore from '../../../../stores/modules/appointmentQualificationStore';
9
+ import PbMediaUpload from '../../../media/upload/PbMediaUpload';
10
+ import { rest } from 'msw';
11
+ import { acceptedResolver } from '../../../../services/api/mocks/commonMock';
12
+ import {
13
+ getDocumentsByInhabitantProjectIdResolver,
14
+ uploadDocumentResolver,
15
+ getDocumentsPdfThumbnailResolver,
16
+ getDocumentsImageThumbnailResolver,
17
+ } from '../../../../services/api/mocks/documentsMock';
18
+ import { useStore } from 'vuex';
19
+ import cloneDeep from 'lodash.clonedeep';
20
+
21
+ <Meta
22
+ title="Project Booster/Rework/Questions/MPbUploadDocument 🦠"
23
+ component={MPbUploadDocument}
24
+ argTypes={{
25
+ payload: {
26
+ table: {
27
+ defaultValue: {
28
+ summary: 'object',
29
+ detail: JSON.stringify(DEFAULT_PAYLOAD, null, ' '),
30
+ },
31
+ },
32
+ control: {
33
+ type: 'object',
34
+ },
35
+ },
36
+ onStepCompleted: {
37
+ action: 'Step completed',
38
+ table: { disable: true },
39
+ },
40
+ }}
41
+ decorators={[
42
+ nestedAppDecorator(
43
+ {
44
+ modules: {
45
+ documents: cloneDeep(documentsStore),
46
+ documentsPlans: cloneDeep(documentsStore),
47
+ documentsPictures: cloneDeep(documentsStore),
48
+ appointmentQualification: appointmentQualificationStore,
49
+ },
50
+ mutations: {
51
+ eventBusSendEvent(state, { code, payload }) {
52
+ console.log('event bus data : ', code, payload);
53
+ },
54
+ },
55
+ actions: {
56
+ sendEventToBus({ commit }, action) {
57
+ commit('eventBusSendEvent', action);
58
+ },
59
+ },
60
+ },
61
+ [
62
+ { path: '/steps/:stepCode/previous/:answers', component: PbScenario },
63
+ {
64
+ name: 'PbMediaUpload',
65
+ path: '/document-upload',
66
+ component: PbMediaUpload,
67
+ },
68
+ ],
69
+ ),
70
+ ]}
71
+ parameters={{
72
+ layout: 'fullscreen',
73
+ }}
74
+ />
75
+
76
+ # 🦠 `MPbUploadDocument` - Components
77
+
78
+ [![alt text](https://storage.googleapis.com/project-booster-media/project-booster-vue/project-booster-sources.svg 'Project booster component source code')](https://github.com/adeo/project-booster-vue/tree/master/src/components/question)
79
+
80
+ ---
81
+
82
+ The `MPbUploadDocument` allows to upload files. It
83
+ is customizable through the payload property. It has the same
84
+ behaviour as the `PbQuestion` component and is designed to work in scenario.
85
+
86
+ # `MPbUploadDocument` - Component props
87
+
88
+ export const TemplateSandbox = (args, { argTypes }) => ({
89
+ props: Object.keys(argTypes),
90
+ components: { MPbUploadDocument },
91
+ setup() {
92
+ const store = useStore();
93
+ store.dispatch('documentsPlans/updateContext', { type: 'DOCUMENT', subType: 'PLAN' });
94
+ store.dispatch('documentsPictures/updateContext', { type: 'DOCUMENT', subType: 'PHOTO' });
95
+ store.dispatch('documentsPlans/updateMediaPerPageCount', 3);
96
+ store.dispatch('documentsPlans/updateMediaPerPageCount', 3);
97
+ store.dispatch('documents/updateMediaPerPageCount', 3);
98
+ return { args };
99
+ },
100
+ template: `<m-pb-upload-document
101
+ :payload="args.payload"
102
+ :show-back-button="args.showBackButton"
103
+ :answers="args.answers"
104
+ :runtime-options="args.runtimeOptions"
105
+ :completed-event-name="args.completedEventName"
106
+ :sticky-bottom-offset="args.stickyBottomOffset"
107
+ @step-completed="args.onStepCompleted"
108
+ />`,
109
+ });
110
+
111
+ <Canvas>
112
+ <Story
113
+ inline={false}
114
+ height="862px"
115
+ name="101 Sandbox"
116
+ args={{ payload: DEFAULT_PAYLOAD }}
117
+ parameters={{
118
+ msw: [
119
+ rest.get('/api/inhabitant-projects/:projectId/documents/', getDocumentsByInhabitantProjectIdResolver),
120
+ rest.post('/api/events/documents', acceptedResolver),
121
+ rest.post('/api/inhabitant-projects/:inhabitantProjectId/documents', uploadDocumentResolver),
122
+ rest.get(
123
+ '/api/inhabitant-projects/:inhabitantProjectId/documents/:documentId/thumbnail',
124
+ getDocumentsPdfThumbnailResolver,
125
+ ),
126
+ ],
127
+ }}
128
+ >
129
+ {TemplateSandbox.bind({})}
130
+ </Story>
131
+ </Canvas>
132
+
133
+ <ArgsTable story="101 Sandbox" />
134
+
135
+ ## Pictures variant
136
+
137
+ <Canvas>
138
+ <Story
139
+ name="Pictures"
140
+ inline={false}
141
+ height="862px"
142
+ args={{ payload: PICTURES_PAYLOAD }}
143
+ parameters={{
144
+ msw: [
145
+ rest.get('/api/inhabitant-projects/:projectId/documents/', getDocumentsByInhabitantProjectIdResolver),
146
+ rest.post('/api/events/documents', acceptedResolver),
147
+ rest.post('/api/inhabitant-projects/:inhabitantProjectId/documents', uploadDocumentResolver),
148
+ rest.get(
149
+ '/api/inhabitant-projects/:inhabitantProjectId/documents/:documentId/thumbnail',
150
+ getDocumentsImageThumbnailResolver,
151
+ ),
152
+ ],
153
+ }}
154
+ >
155
+ {TemplateSandbox.bind({})}
156
+ </Story>
157
+ </Canvas>