project-booster-vue 9.44.12 → 9.45.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.
package/package.json
CHANGED
|
@@ -116,6 +116,7 @@ import MLink from '../mozaic/link/MLink.vue';
|
|
|
116
116
|
import MTextInput from '../mozaic/text-input/MTextInput.vue';
|
|
117
117
|
import { ScenarioStepAnswer } from '@/types/pb/Scenario';
|
|
118
118
|
import { object, string, boolean, number } from 'yup';
|
|
119
|
+
import { TrezorInterface } from './PbTrezorInterface';
|
|
119
120
|
import objectPath from 'object-path';
|
|
120
121
|
const BACK_ICON =
|
|
121
122
|
'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
|
|
@@ -187,6 +188,32 @@ export default defineComponent({
|
|
|
187
188
|
props.payload.viewModel.defaultValue?.zipcode?.path,
|
|
188
189
|
) || null;
|
|
189
190
|
|
|
191
|
+
const convertToTypeOf = (typedVar: string, input: any): string | number | null => {
|
|
192
|
+
if (!input) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
switch (typedVar) {
|
|
197
|
+
case 'string':
|
|
198
|
+
return input.toString();
|
|
199
|
+
case 'float':
|
|
200
|
+
return parseFloat(input);
|
|
201
|
+
case 'integer':
|
|
202
|
+
return parseInt(input);
|
|
203
|
+
default:
|
|
204
|
+
return input;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const metadata = props.payload.viewModel.metadata;
|
|
209
|
+
let sendingMetadata: any = {};
|
|
210
|
+
|
|
211
|
+
if (metadata) {
|
|
212
|
+
metadata.forEach((meta: TrezorInterface) => {
|
|
213
|
+
sendingMetadata[meta.attribut] = convertToTypeOf(meta.type, getAnswerValue(meta.answerCode, meta.path)) || null;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
190
217
|
let formData = ref<any>({
|
|
191
218
|
values: {
|
|
192
219
|
lastname: '',
|
|
@@ -239,6 +266,7 @@ export default defineComponent({
|
|
|
239
266
|
},
|
|
240
267
|
optin: formData.value.values.optin,
|
|
241
268
|
optinPartners: formData.value.values.optinPartners,
|
|
269
|
+
metadata: sendingMetadata,
|
|
242
270
|
},
|
|
243
271
|
typeLead: props.payload.viewModel.typeLead,
|
|
244
272
|
});
|
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
"path": "value"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
+
"metadata": [
|
|
13
|
+
{
|
|
14
|
+
"attribut": "surface",
|
|
15
|
+
"type": "float",
|
|
16
|
+
"answerCode": "LMFR_HEAT_PUMP_AIR_WATER_QUESTION_SURFACE_AREA",
|
|
17
|
+
"path": "space"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
12
20
|
"translationErrors": {
|
|
13
21
|
"lastname": "Le nom est requis",
|
|
14
22
|
"firstname": "Le prénom est requis",
|