@mindful-web/marko-web-identity-x 1.30.0 → 1.32.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/browser/access.vue +17 -2
- package/browser/comments/stream.vue +17 -3
- package/browser/custom-column.vue +64 -17
- package/browser/download.vue +17 -2
- package/browser/login.vue +33 -10
- package/browser/profile.vue +18 -2
- package/components/access.marko.js +2 -2
- package/components/comment-stream.marko +7 -1
- package/components/comment-stream.marko.js +11 -3
- package/components/context.marko.js +2 -2
- package/components/form-access.marko +8 -1
- package/components/form-access.marko.js +12 -2
- package/components/form-authenticate.marko.js +2 -2
- package/components/form-change-email.marko.js +2 -2
- package/components/form-login.marko +8 -13
- package/components/form-login.marko.js +9 -17
- package/components/form-logout.marko.js +2 -2
- package/components/form-profile.marko +7 -1
- package/components/form-profile.marko.js +11 -3
- package/components/form-register.marko.js +2 -2
- package/components/identify.marko.js +2 -2
- package/components/non-auth-identify.marko.js +2 -2
- package/components/subscribe.marko.js +2 -2
- package/package.json +2 -2
- package/utils/generate-required-field-payload.js +46 -18
- package/utils/get-create-user-custom-fields.js +21 -0
package/browser/access.vue
CHANGED
|
@@ -80,13 +80,16 @@
|
|
|
80
80
|
:source="loginSource"
|
|
81
81
|
:redirect="redirect"
|
|
82
82
|
:endpoints="endpoints"
|
|
83
|
+
:custom-select-field-answers="loginCustomSelectFieldAnswers"
|
|
84
|
+
:custom-boolean-field-answers="loginCustomBooleanFieldAnswers"
|
|
85
|
+
:custom-text-field-answers="loginCustomTextFieldAnswers"
|
|
83
86
|
:app-context-id="appContextId"
|
|
84
87
|
:consent-policy="consentPolicy"
|
|
85
88
|
:consent-policy-enabled="consentPolicyEnabled"
|
|
86
89
|
:email-consent-request="emailConsentRequest"
|
|
87
90
|
:email-consent-request-enabled="emailConsentRequestEnabled"
|
|
88
91
|
:regional-consent-policies="regionalConsentPolicies"
|
|
89
|
-
:required-create-
|
|
92
|
+
:required-create-field-rows="requiredCreateFieldRows"
|
|
90
93
|
:default-field-labels="defaultFieldLabels"
|
|
91
94
|
:button-labels="loginButtonLabels"
|
|
92
95
|
:lang="lang"
|
|
@@ -164,7 +167,7 @@ export default {
|
|
|
164
167
|
type: Object,
|
|
165
168
|
default: () => ({}),
|
|
166
169
|
},
|
|
167
|
-
|
|
170
|
+
requiredCreateFieldRows: {
|
|
168
171
|
type: Array,
|
|
169
172
|
default: () => [],
|
|
170
173
|
},
|
|
@@ -220,6 +223,18 @@ export default {
|
|
|
220
223
|
type: Object,
|
|
221
224
|
default: null,
|
|
222
225
|
},
|
|
226
|
+
loginCustomBooleanFieldAnswers: {
|
|
227
|
+
type: Array,
|
|
228
|
+
default: () => [],
|
|
229
|
+
},
|
|
230
|
+
loginCustomSelectFieldAnswers: {
|
|
231
|
+
type: Array,
|
|
232
|
+
default: () => [],
|
|
233
|
+
},
|
|
234
|
+
loginCustomTextFieldAnswers: {
|
|
235
|
+
type: Array,
|
|
236
|
+
default: () => [],
|
|
237
|
+
},
|
|
223
238
|
lang: {
|
|
224
239
|
type: String,
|
|
225
240
|
default: 'en',
|
|
@@ -36,13 +36,15 @@
|
|
|
36
36
|
:class="element('login-form')"
|
|
37
37
|
:additional-event-data="additionalEventData"
|
|
38
38
|
:source="loginSource"
|
|
39
|
-
:active-user="activeUser"
|
|
40
39
|
:endpoints="endpoints"
|
|
40
|
+
:custom-select-field-answers="loginCustomSelectFieldAnswers"
|
|
41
|
+
:custom-boolean-field-answers="loginCustomBooleanFieldAnswers"
|
|
42
|
+
:custom-text-field-answers="loginCustomTextFieldAnswers"
|
|
41
43
|
:consent-policy="consentPolicy"
|
|
42
44
|
:app-context-id="appContextId"
|
|
43
45
|
:regional-consent-policies="regionalConsentPolicies"
|
|
44
46
|
:button-labels="loginButtonLabels"
|
|
45
|
-
:required-create-
|
|
47
|
+
:required-create-field-rows="requiredCreateFieldRows"
|
|
46
48
|
:default-field-labels="defaultFieldLabels"
|
|
47
49
|
:login-email-label="defaultFieldLabels.email"
|
|
48
50
|
@login-link-sent="showLoginMessage = false"
|
|
@@ -215,7 +217,7 @@ export default {
|
|
|
215
217
|
type: Array,
|
|
216
218
|
default: () => [],
|
|
217
219
|
},
|
|
218
|
-
|
|
220
|
+
requiredCreateFieldRows: {
|
|
219
221
|
type: Array,
|
|
220
222
|
default: () => [],
|
|
221
223
|
},
|
|
@@ -223,6 +225,18 @@ export default {
|
|
|
223
225
|
type: Object,
|
|
224
226
|
default: () => ({}),
|
|
225
227
|
},
|
|
228
|
+
loginCustomBooleanFieldAnswers: {
|
|
229
|
+
type: Array,
|
|
230
|
+
default: () => [],
|
|
231
|
+
},
|
|
232
|
+
loginCustomSelectFieldAnswers: {
|
|
233
|
+
type: Array,
|
|
234
|
+
default: () => [],
|
|
235
|
+
},
|
|
236
|
+
loginCustomTextFieldAnswers: {
|
|
237
|
+
type: Array,
|
|
238
|
+
default: () => [],
|
|
239
|
+
},
|
|
226
240
|
lang: {
|
|
227
241
|
type: String,
|
|
228
242
|
default: 'en',
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
<custom-select
|
|
122
122
|
v-else-if="type === 'custom-select' && customField"
|
|
123
123
|
:id="fieldId"
|
|
124
|
-
:label="label"
|
|
124
|
+
:label="customField.field.label || label"
|
|
125
125
|
:required="required"
|
|
126
126
|
:multiple="customField.field.multiple"
|
|
127
127
|
:selected="customField.answers"
|
|
@@ -132,11 +132,19 @@
|
|
|
132
132
|
<custom-boolean
|
|
133
133
|
v-else-if="type === 'custom-boolean' && customField"
|
|
134
134
|
:id="fieldId"
|
|
135
|
-
:
|
|
136
|
-
:message="label"
|
|
135
|
+
:message="customField.field.label || label"
|
|
137
136
|
:required="required"
|
|
138
137
|
:value="customField.answer"
|
|
139
|
-
@input="onCustomBooleanChange(customField
|
|
138
|
+
@input="onCustomBooleanChange(customField, $event)"
|
|
139
|
+
/>
|
|
140
|
+
<custom-text
|
|
141
|
+
v-else-if="type === 'custom-text' && customField"
|
|
142
|
+
:id="fieldId"
|
|
143
|
+
:class-name="className"
|
|
144
|
+
:label="customField.field.label || label"
|
|
145
|
+
:required="required"
|
|
146
|
+
:value="customField.value"
|
|
147
|
+
@change="onCustomTextChange(customField, $event)"
|
|
140
148
|
/>
|
|
141
149
|
<pre v-else>
|
|
142
150
|
label: {{ label }}
|
|
@@ -156,6 +164,7 @@ import City from './form/fields/city.vue';
|
|
|
156
164
|
import CountryCode from './form/fields/country.vue';
|
|
157
165
|
import CustomBoolean from './form/fields/custom-boolean.vue';
|
|
158
166
|
import CustomSelect from './form/fields/custom-select.vue';
|
|
167
|
+
import CustomText from './form/fields/custom-text.vue';
|
|
159
168
|
import FamilyName from './form/fields/family-name.vue';
|
|
160
169
|
import FormLabel from './form/common/form-label.vue';
|
|
161
170
|
import GivenName from './form/fields/given-name.vue';
|
|
@@ -177,6 +186,7 @@ export default {
|
|
|
177
186
|
CountryCode,
|
|
178
187
|
CustomSelect,
|
|
179
188
|
CustomBoolean,
|
|
189
|
+
CustomText,
|
|
180
190
|
FamilyName,
|
|
181
191
|
FormLabel,
|
|
182
192
|
GivenName,
|
|
@@ -192,6 +202,18 @@ export default {
|
|
|
192
202
|
*
|
|
193
203
|
*/
|
|
194
204
|
props: {
|
|
205
|
+
customBooleanFieldAnswers: {
|
|
206
|
+
type: Array,
|
|
207
|
+
default: () => [],
|
|
208
|
+
},
|
|
209
|
+
customSelectFieldAnswers: {
|
|
210
|
+
type: Array,
|
|
211
|
+
default: () => [],
|
|
212
|
+
},
|
|
213
|
+
customTextFieldAnswers: {
|
|
214
|
+
type: Array,
|
|
215
|
+
default: () => [],
|
|
216
|
+
},
|
|
195
217
|
label: {
|
|
196
218
|
type: String,
|
|
197
219
|
required: true,
|
|
@@ -208,7 +230,7 @@ export default {
|
|
|
208
230
|
type: String,
|
|
209
231
|
required: true,
|
|
210
232
|
validator(value) {
|
|
211
|
-
return ['built-in', 'custom-select', 'custom-boolean'].includes(value);
|
|
233
|
+
return ['built-in', 'custom-select', 'custom-boolean', 'custom-text'].includes(value);
|
|
212
234
|
},
|
|
213
235
|
},
|
|
214
236
|
required: {
|
|
@@ -265,10 +287,20 @@ export default {
|
|
|
265
287
|
*
|
|
266
288
|
*/
|
|
267
289
|
customField() {
|
|
268
|
-
const { fieldId,
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
290
|
+
const { fieldId, type } = this;
|
|
291
|
+
|
|
292
|
+
const finder = (ans) => ans.id === fieldId;
|
|
293
|
+
|
|
294
|
+
switch (type) {
|
|
295
|
+
case 'custom-boolean':
|
|
296
|
+
return this.customBooleanFieldAnswers.find(finder);
|
|
297
|
+
case 'custom-select':
|
|
298
|
+
return this.customSelectFieldAnswers.find(finder);
|
|
299
|
+
case 'custom-text':
|
|
300
|
+
return this.customTextFieldAnswers.find(finder);
|
|
301
|
+
default:
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
272
304
|
},
|
|
273
305
|
/**
|
|
274
306
|
*
|
|
@@ -321,11 +353,11 @@ export default {
|
|
|
321
353
|
/**
|
|
322
354
|
*
|
|
323
355
|
*/
|
|
324
|
-
onCustomBooleanChange(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
356
|
+
onCustomBooleanChange(field) {
|
|
357
|
+
// eslint-disable-next-line no-param-reassign
|
|
358
|
+
field.value = !field.value;
|
|
359
|
+
// eslint-disable-next-line no-param-reassign
|
|
360
|
+
field.hasAnswered = true;
|
|
329
361
|
this.user.customBooleanFieldAnswers = this.customBooleanFieldAnswers;
|
|
330
362
|
},
|
|
331
363
|
|
|
@@ -334,12 +366,27 @@ export default {
|
|
|
334
366
|
*/
|
|
335
367
|
onCustomSelectChange(field, $event) {
|
|
336
368
|
const ids = Array.isArray($event) ? [...$event] : [...($event ? [$event] : [])];
|
|
337
|
-
field.answers.splice(0);
|
|
369
|
+
field.answers.splice(0); // @todo this will break multi-selects...they don't work anyway
|
|
370
|
+
// eslint-disable-next-line no-param-reassign
|
|
371
|
+
field.hasAnswered = Boolean(ids.length);
|
|
338
372
|
if (ids.length) {
|
|
339
|
-
// eslint-disable-next-line no-param-reassign
|
|
340
|
-
field.hasAnswered = true;
|
|
341
373
|
field.answers.push(...ids.map((id) => ({ id })));
|
|
342
374
|
}
|
|
375
|
+
this.user.customSelectFieldAnswers = this.customSelectFieldAnswers;
|
|
376
|
+
},
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
*
|
|
380
|
+
*/
|
|
381
|
+
onCustomTextChange(field, $event) {
|
|
382
|
+
// hack to prevent on focus out with no value from resetting value
|
|
383
|
+
// @todo find a better solution!!!
|
|
384
|
+
const value = $event === '' && field.value !== '' ? field.value : $event;
|
|
385
|
+
// eslint-disable-next-line no-param-reassign
|
|
386
|
+
field.value = value;
|
|
387
|
+
// eslint-disable-next-line no-param-reassign
|
|
388
|
+
field.hasAnswered = value !== '';
|
|
389
|
+
this.user.customTextFieldAnswers = this.customTextFieldAnswers;
|
|
343
390
|
},
|
|
344
391
|
},
|
|
345
392
|
};
|
package/browser/download.vue
CHANGED
|
@@ -78,6 +78,9 @@
|
|
|
78
78
|
:additional-event-data="additionalEventData"
|
|
79
79
|
:source="loginSource"
|
|
80
80
|
:endpoints="endpoints"
|
|
81
|
+
:custom-select-field-answers="loginCustomSelectFieldAnswers"
|
|
82
|
+
:custom-boolean-field-answers="loginCustomBooleanFieldAnswers"
|
|
83
|
+
:custom-text-field-answers="loginCustomTextFieldAnswers"
|
|
81
84
|
:redirect="redirect"
|
|
82
85
|
:app-context-id="appContextId"
|
|
83
86
|
:consent-policy="consentPolicy"
|
|
@@ -85,7 +88,7 @@
|
|
|
85
88
|
:email-consent-request="emailConsentRequest"
|
|
86
89
|
:email-consent-request-enabled="emailConsentRequestEnabled"
|
|
87
90
|
:regional-consent-policies="regionalConsentPolicies"
|
|
88
|
-
:required-create-
|
|
91
|
+
:required-create-field-rows="requiredCreateFieldRows"
|
|
89
92
|
:default-field-labels="defaultFieldLabels"
|
|
90
93
|
:button-labels="loginButtonLabels"
|
|
91
94
|
:login-email-label="defaultFieldLabels.email"
|
|
@@ -176,7 +179,7 @@ export default {
|
|
|
176
179
|
type: Object,
|
|
177
180
|
default: () => ({}),
|
|
178
181
|
},
|
|
179
|
-
|
|
182
|
+
requiredCreateFieldRows: {
|
|
180
183
|
type: Array,
|
|
181
184
|
default: () => [],
|
|
182
185
|
},
|
|
@@ -232,6 +235,18 @@ export default {
|
|
|
232
235
|
type: Object,
|
|
233
236
|
default: null,
|
|
234
237
|
},
|
|
238
|
+
loginCustomBooleanFieldAnswers: {
|
|
239
|
+
type: Array,
|
|
240
|
+
default: () => [],
|
|
241
|
+
},
|
|
242
|
+
loginCustomSelectFieldAnswers: {
|
|
243
|
+
type: Array,
|
|
244
|
+
default: () => [],
|
|
245
|
+
},
|
|
246
|
+
loginCustomTextFieldAnswers: {
|
|
247
|
+
type: Array,
|
|
248
|
+
default: () => [],
|
|
249
|
+
},
|
|
235
250
|
lang: {
|
|
236
251
|
type: String,
|
|
237
252
|
default: 'en',
|
package/browser/login.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="hasActiveUser">
|
|
3
|
-
<p>{{ youAreCurrentlyLoggedInAs }} {{
|
|
3
|
+
<p>{{ youAreCurrentlyLoggedInAs }} {{ user.email }}.</p>
|
|
4
4
|
<a
|
|
5
5
|
:href="endpoints.profile"
|
|
6
6
|
class="btn btn-secondary mb-2 mr-2"
|
|
@@ -31,20 +31,23 @@
|
|
|
31
31
|
<p v-if="requiresUserInput">
|
|
32
32
|
Thanks! Additional information is required to continue:
|
|
33
33
|
</p>
|
|
34
|
-
<fieldset v-if="requiresUserInput" :disabled="loading" class="
|
|
35
|
-
<div v-for="(row, ridx) in requiredCreateFieldRows" :key="ridx" class="row">
|
|
34
|
+
<fieldset v-if="requiresUserInput" :disabled="loading" class="">
|
|
35
|
+
<div v-for="(row, ridx) in requiredCreateFieldRows" :key="ridx" class="form-group row">
|
|
36
36
|
<custom-column
|
|
37
37
|
v-for="(col, cidx) in row"
|
|
38
38
|
:key="`${ridx}_${cidx}`"
|
|
39
|
-
:
|
|
40
|
-
:field-
|
|
39
|
+
:custom-boolean-field-answers="customBooleanFieldAnswers"
|
|
40
|
+
:custom-select-field-answers="customSelectFieldAnswers"
|
|
41
|
+
:custom-text-field-answers="customTextFieldAnswers"
|
|
42
|
+
:endpoints="endpoints"
|
|
41
43
|
:field-id="col.id"
|
|
42
|
-
:
|
|
44
|
+
:field-key="col.key"
|
|
45
|
+
:label="col.label || defaultFieldLabels[col.key]"
|
|
46
|
+
:lang="lang"
|
|
43
47
|
:required="col.required"
|
|
48
|
+
:type="col.type"
|
|
49
|
+
:user="user"
|
|
44
50
|
:width="col.width || 1"
|
|
45
|
-
:user="activeUser"
|
|
46
|
-
:endpoints="endpoints"
|
|
47
|
-
:lang="lang"
|
|
48
51
|
/>
|
|
49
52
|
</div>
|
|
50
53
|
</fieldset>
|
|
@@ -112,6 +115,18 @@ export default {
|
|
|
112
115
|
type: Object,
|
|
113
116
|
default: () => {},
|
|
114
117
|
},
|
|
118
|
+
customBooleanFieldAnswers: {
|
|
119
|
+
type: Array,
|
|
120
|
+
default: () => [],
|
|
121
|
+
},
|
|
122
|
+
customSelectFieldAnswers: {
|
|
123
|
+
type: Array,
|
|
124
|
+
default: () => [],
|
|
125
|
+
},
|
|
126
|
+
customTextFieldAnswers: {
|
|
127
|
+
type: Array,
|
|
128
|
+
default: () => [],
|
|
129
|
+
},
|
|
115
130
|
endpoints: {
|
|
116
131
|
type: Object,
|
|
117
132
|
required: true,
|
|
@@ -202,6 +217,14 @@ export default {
|
|
|
202
217
|
error: null,
|
|
203
218
|
loading: false,
|
|
204
219
|
requiresUserInput: false,
|
|
220
|
+
user: {
|
|
221
|
+
// ...this.activeUser,
|
|
222
|
+
...(this.activeUser && { ...this.activeUser }),
|
|
223
|
+
// ...(this.defaultCountryCode
|
|
224
|
+
// && !this.activeUser.countryCode
|
|
225
|
+
// && { countryCode: this.defaultCountryCode }
|
|
226
|
+
// ),
|
|
227
|
+
},
|
|
205
228
|
}),
|
|
206
229
|
|
|
207
230
|
/**
|
|
@@ -306,7 +329,7 @@ export default {
|
|
|
306
329
|
this.error = null;
|
|
307
330
|
this.loading = true;
|
|
308
331
|
const res = await post('/login', {
|
|
309
|
-
...this.
|
|
332
|
+
...this.user,
|
|
310
333
|
email: this.email,
|
|
311
334
|
source: this.source,
|
|
312
335
|
redirectTo: this.redirectTo,
|
package/browser/profile.vue
CHANGED
|
@@ -237,8 +237,12 @@
|
|
|
237
237
|
:additional-event-data="additionalEventData"
|
|
238
238
|
:source="loginSource"
|
|
239
239
|
:endpoints="endpoints"
|
|
240
|
+
:custom-select-field-answers="loginCustomSelectFieldAnswers"
|
|
241
|
+
:custom-boolean-field-answers="loginCustomBooleanFieldAnswers"
|
|
242
|
+
:custom-text-field-answers="loginCustomTextFieldAnswers"
|
|
240
243
|
:app-context-id="appContextId"
|
|
241
244
|
:consent-policy="consentPolicy"
|
|
245
|
+
:required-create-field-rows="requiredCreateFieldRows"
|
|
242
246
|
:consent-policy-enabled="consentPolicyEnabled"
|
|
243
247
|
:email-consent-request="emailConsentRequest"
|
|
244
248
|
:email-consent-request-enabled="emailConsentRequestEnabled"
|
|
@@ -329,7 +333,7 @@ export default {
|
|
|
329
333
|
type: Array,
|
|
330
334
|
default: () => [],
|
|
331
335
|
},
|
|
332
|
-
|
|
336
|
+
requiredCreateFieldRows: {
|
|
333
337
|
type: Array,
|
|
334
338
|
default: () => [],
|
|
335
339
|
},
|
|
@@ -399,7 +403,19 @@ export default {
|
|
|
399
403
|
},
|
|
400
404
|
loginButtonLabels: {
|
|
401
405
|
type: Object,
|
|
402
|
-
default:
|
|
406
|
+
default: () => ({}),
|
|
407
|
+
},
|
|
408
|
+
loginCustomBooleanFieldAnswers: {
|
|
409
|
+
type: Array,
|
|
410
|
+
default: () => [],
|
|
411
|
+
},
|
|
412
|
+
loginCustomSelectFieldAnswers: {
|
|
413
|
+
type: Array,
|
|
414
|
+
default: () => [],
|
|
415
|
+
},
|
|
416
|
+
loginCustomTextFieldAnswers: {
|
|
417
|
+
type: Array,
|
|
418
|
+
default: () => [],
|
|
403
419
|
},
|
|
404
420
|
lang: {
|
|
405
421
|
type: String,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/access.marko",
|
|
6
6
|
marko_component = require("./access.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_objectPath_module = require("@mindful-web/object-path"),
|
|
@@ -53,7 +53,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
53
53
|
}, marko_component);
|
|
54
54
|
|
|
55
55
|
marko_template.meta = {
|
|
56
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
56
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/access.marko",
|
|
57
57
|
component: "./access.marko",
|
|
58
58
|
tags: [
|
|
59
59
|
"@mindful-web/marko-core/components/resolve.marko"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { get } from "@mindful-web/object-path";
|
|
2
2
|
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
3
3
|
|
|
4
|
+
import getCreateUserCustomFields from '../utils/get-create-user-custom-fields'
|
|
5
|
+
|
|
4
6
|
$ const { req, site } = out.global;
|
|
5
7
|
$ const { identityX } = req;
|
|
6
8
|
$ const additionalEventData = defaultValue(input.additionalEventData, {});
|
|
@@ -8,11 +10,15 @@ $ const lang = input.lang || defaultValue(site.config.lang, "en");
|
|
|
8
10
|
$ const dateFormat = input.dateFormat || defaultValue(site.config.dateFormat, "MMM Do, YYYY h:mma")
|
|
9
11
|
|
|
10
12
|
<if(identityX)>
|
|
11
|
-
<marko-web-identity-x-context|{ user, isEnabled, application }
|
|
13
|
+
<marko-web-identity-x-context|{ user, isEnabled, application, fields }| with-fields=true>
|
|
14
|
+
$ const { customSelectFieldAnswers, customBooleanFieldAnswers, customTextFieldAnswers } = getCreateUserCustomFields({ fields });
|
|
12
15
|
$ const props = {
|
|
13
16
|
additionalEventData: additionalEventData,
|
|
14
17
|
loginSource: input.loginSource,
|
|
15
18
|
activeUser: user,
|
|
19
|
+
loginCustomSelectFieldAnswers: customSelectFieldAnswers,
|
|
20
|
+
loginCustomBooleanFieldAnswers: customBooleanFieldAnswers,
|
|
21
|
+
loginCustomTextFieldAnswers: customTextFieldAnswers,
|
|
16
22
|
identifier: `${input.identifier}`,
|
|
17
23
|
title: input.title,
|
|
18
24
|
description: input.description,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/comment-stream.marko",
|
|
6
6
|
marko_component = require("./comment-stream.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_objectPath_module = require("@mindful-web/object-path"),
|
|
@@ -10,6 +10,8 @@ var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
|
10
10
|
get = module_objectPath_module.get,
|
|
11
11
|
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
12
12
|
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
13
|
+
module_getCreateUserCustomFields = require("../utils/get-create-user-custom-fields"),
|
|
14
|
+
getCreateUserCustomFields = module_getCreateUserCustomFields.default || module_getCreateUserCustomFields,
|
|
13
15
|
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
14
16
|
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
15
17
|
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template),
|
|
@@ -31,11 +33,17 @@ function render(input, out, __component, component, state) {
|
|
|
31
33
|
|
|
32
34
|
if (identityX) {
|
|
33
35
|
marko_web_identity_x_context_tag({
|
|
34
|
-
|
|
36
|
+
withFields: true,
|
|
37
|
+
renderBody: function(out, { user, isEnabled, application, fields }) {
|
|
38
|
+
const { customSelectFieldAnswers, customBooleanFieldAnswers, customTextFieldAnswers } = getCreateUserCustomFields({ fields });
|
|
39
|
+
|
|
35
40
|
const props = {
|
|
36
41
|
additionalEventData: additionalEventData,
|
|
37
42
|
loginSource: input.loginSource,
|
|
38
43
|
activeUser: user,
|
|
44
|
+
loginCustomSelectFieldAnswers: customSelectFieldAnswers,
|
|
45
|
+
loginCustomBooleanFieldAnswers: customBooleanFieldAnswers,
|
|
46
|
+
loginCustomTextFieldAnswers: customTextFieldAnswers,
|
|
39
47
|
identifier: `${input.identifier}`,
|
|
40
48
|
title: input.title,
|
|
41
49
|
description: input.description,
|
|
@@ -77,7 +85,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
77
85
|
}, marko_component);
|
|
78
86
|
|
|
79
87
|
marko_template.meta = {
|
|
80
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
88
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/comment-stream.marko",
|
|
81
89
|
component: "./comment-stream.marko",
|
|
82
90
|
tags: [
|
|
83
91
|
"@mindful-web/marko-web/components/browser-component.marko",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/context.marko",
|
|
6
6
|
marko_component = require("./context.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
@@ -49,7 +49,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
49
49
|
}, marko_component);
|
|
50
50
|
|
|
51
51
|
marko_template.meta = {
|
|
52
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
52
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/context.marko",
|
|
53
53
|
component: "./context.marko",
|
|
54
54
|
tags: [
|
|
55
55
|
"@mindful-web/marko-core/components/resolve.marko"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
3
|
-
import { get, getAsObject } from "@mindful-web/object-path";
|
|
3
|
+
import { get, getAsArray, getAsObject } from "@mindful-web/object-path";
|
|
4
|
+
|
|
5
|
+
import getCreateUserCustomFields from '../utils/get-create-user-custom-fields'
|
|
4
6
|
|
|
5
7
|
$ const { req: { identityX }, site, i18n } = out.global;
|
|
6
8
|
$ const { content, formId, user, application } = input;
|
|
@@ -22,6 +24,8 @@ $ const loginButtonLabels = defaultValue(input.loginButtonLabels, {
|
|
|
22
24
|
profile: i18n("Modify Profile"),
|
|
23
25
|
});
|
|
24
26
|
|
|
27
|
+
$ const fields = getAsArray(input, 'fields');
|
|
28
|
+
$ const { customSelectFieldAnswers, customBooleanFieldAnswers, customTextFieldAnswers } = getCreateUserCustomFields({ fields });
|
|
25
29
|
|
|
26
30
|
<if(identityX && form.fieldRows, displayForm)>
|
|
27
31
|
<div class="content-survey-access-idx__wrapper">
|
|
@@ -40,6 +44,9 @@ $ const loginButtonLabels = defaultValue(input.loginButtonLabels, {
|
|
|
40
44
|
|
|
41
45
|
// Login props
|
|
42
46
|
activeUser: user,
|
|
47
|
+
loginCustomSelectFieldAnswers: customSelectFieldAnswers,
|
|
48
|
+
loginCustomBooleanFieldAnswers: customBooleanFieldAnswers,
|
|
49
|
+
loginCustomTextFieldAnswers: customTextFieldAnswers,
|
|
43
50
|
additionalEventData: additionalEventData,
|
|
44
51
|
appContextId: identityX.config.get("appContextId"),
|
|
45
52
|
buttonLabel: buttonLabel,
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/form-access.marko",
|
|
6
6
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
7
|
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
8
8
|
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
9
9
|
module_objectPath_module = require("@mindful-web/object-path"),
|
|
10
10
|
objectPath_module = module_objectPath_module.default || module_objectPath_module,
|
|
11
11
|
get = module_objectPath_module.get,
|
|
12
|
+
getAsArray = module_objectPath_module.getAsArray,
|
|
12
13
|
getAsObject = module_objectPath_module.getAsObject,
|
|
14
|
+
module_getCreateUserCustomFields = require("../utils/get-create-user-custom-fields"),
|
|
15
|
+
getCreateUserCustomFields = module_getCreateUserCustomFields.default || module_getCreateUserCustomFields,
|
|
13
16
|
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
14
17
|
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
15
18
|
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template),
|
|
@@ -54,6 +57,10 @@ function render(input, out, __component, component, state) {
|
|
|
54
57
|
profile: i18n("Modify Profile"),
|
|
55
58
|
});
|
|
56
59
|
|
|
60
|
+
const fields = getAsArray(input, 'fields');
|
|
61
|
+
|
|
62
|
+
const { customSelectFieldAnswers, customBooleanFieldAnswers, customTextFieldAnswers } = getCreateUserCustomFields({ fields });
|
|
63
|
+
|
|
57
64
|
if (identityX && form.fieldRows, displayForm) {
|
|
58
65
|
out.w("<div class=\"content-survey-access-idx__wrapper\">");
|
|
59
66
|
|
|
@@ -72,6 +79,9 @@ function render(input, out, __component, component, state) {
|
|
|
72
79
|
|
|
73
80
|
// Login props
|
|
74
81
|
activeUser: user,
|
|
82
|
+
loginCustomSelectFieldAnswers: customSelectFieldAnswers,
|
|
83
|
+
loginCustomBooleanFieldAnswers: customBooleanFieldAnswers,
|
|
84
|
+
loginCustomTextFieldAnswers: customTextFieldAnswers,
|
|
75
85
|
additionalEventData: additionalEventData,
|
|
76
86
|
appContextId: identityX.config.get("appContextId"),
|
|
77
87
|
buttonLabel: buttonLabel,
|
|
@@ -114,7 +124,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
114
124
|
});
|
|
115
125
|
|
|
116
126
|
marko_template.meta = {
|
|
117
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
127
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/form-access.marko",
|
|
118
128
|
tags: [
|
|
119
129
|
"@mindful-web/marko-web/components/browser-component.marko"
|
|
120
130
|
]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/form-authenticate.marko",
|
|
6
6
|
marko_component = require("./form-authenticate.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_objectPath_module = require("@mindful-web/object-path"),
|
|
@@ -68,7 +68,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
68
68
|
}, marko_component);
|
|
69
69
|
|
|
70
70
|
marko_template.meta = {
|
|
71
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
71
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/form-authenticate.marko",
|
|
72
72
|
component: "./form-authenticate.marko",
|
|
73
73
|
tags: [
|
|
74
74
|
"@mindful-web/marko-web/components/browser-component.marko",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/form-change-email.marko",
|
|
6
6
|
marko_component = require("./form-change-email.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_objectPath_module = require("@mindful-web/object-path"),
|
|
@@ -59,7 +59,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
59
59
|
}, marko_component);
|
|
60
60
|
|
|
61
61
|
marko_template.meta = {
|
|
62
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
62
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/form-change-email.marko",
|
|
63
63
|
component: "./form-change-email.marko",
|
|
64
64
|
tags: [
|
|
65
65
|
"@mindful-web/marko-web/components/browser-component.marko",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { get } from "@mindful-web/object-path";
|
|
2
2
|
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
3
3
|
|
|
4
|
+
import getCreateUserCustomFields from '../utils/get-create-user-custom-fields'
|
|
5
|
+
|
|
4
6
|
$ const { req, site } = out.global;
|
|
5
7
|
$ const { identityX } = req;
|
|
6
8
|
$ const additionalEventData = defaultValue(input.additionalEventData, {});
|
|
@@ -11,21 +13,11 @@ $ const withFields = defaultValue(input.withFields, false);
|
|
|
11
13
|
|
|
12
14
|
<if(Boolean(identityX))>
|
|
13
15
|
<marko-web-identity-x-context|{ user, isEnabled, application, fields }| with-fields=true>
|
|
14
|
-
$ const
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
$ const customSelectFieldAnswers = fields.filter((f) => f['__typename'] == 'SelectField').map((f) => {
|
|
18
|
-
return { id: f.id, hasAnswered: false, answers: [], field: f };
|
|
19
|
-
});
|
|
20
|
-
$ const customTextFieldAnswers = fields.filter((f) => f['__typename'] == 'TextField').map((f) => {
|
|
21
|
-
return { id: f.id, hasAnswered: false, value: null, field: f };
|
|
22
|
-
});
|
|
16
|
+
$ const { customSelectFieldAnswers, customBooleanFieldAnswers, customTextFieldAnswers } = getCreateUserCustomFields({ fields });
|
|
17
|
+
|
|
23
18
|
$ const activeUser = user ? user : {
|
|
24
19
|
email: null,
|
|
25
|
-
|
|
26
|
-
customBooleanFieldAnswers,
|
|
27
|
-
customTextFieldAnswers,
|
|
28
|
-
}
|
|
20
|
+
}
|
|
29
21
|
$ const props = {
|
|
30
22
|
additionalEventData,
|
|
31
23
|
source: input.source,
|
|
@@ -34,6 +26,9 @@ $ const withFields = defaultValue(input.withFields, false);
|
|
|
34
26
|
endpoints: identityX.config.getEndpoints(),
|
|
35
27
|
buttonLabels: input.buttonLabels,
|
|
36
28
|
redirect: input.redirect,
|
|
29
|
+
customSelectFieldAnswers,
|
|
30
|
+
customBooleanFieldAnswers,
|
|
31
|
+
customTextFieldAnswers,
|
|
37
32
|
loginEmailLabel: input.loginEmailLabel,
|
|
38
33
|
loginEmailPlaceholder: input.loginEmailPlaceholder,
|
|
39
34
|
defaultFieldLabels: identityX.config.get("defaultFieldLabels"),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/form-login.marko",
|
|
6
6
|
marko_component = require("./form-login.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_objectPath_module = require("@mindful-web/object-path"),
|
|
@@ -10,6 +10,8 @@ var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
|
10
10
|
get = module_objectPath_module.get,
|
|
11
11
|
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
12
12
|
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
13
|
+
module_getCreateUserCustomFields = require("../utils/get-create-user-custom-fields"),
|
|
14
|
+
getCreateUserCustomFields = module_getCreateUserCustomFields.default || module_getCreateUserCustomFields,
|
|
13
15
|
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
14
16
|
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
15
17
|
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template),
|
|
@@ -33,24 +35,11 @@ function render(input, out, __component, component, state) {
|
|
|
33
35
|
marko_web_identity_x_context_tag({
|
|
34
36
|
withFields: true,
|
|
35
37
|
renderBody: function(out, { user, isEnabled, application, fields }) {
|
|
36
|
-
const
|
|
37
|
-
return { id: f.id, hasAnswered: false, answer: null, value: null, field: f };
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const customSelectFieldAnswers = fields.filter((f) => f['__typename'] == 'SelectField').map((f) => {
|
|
41
|
-
return { id: f.id, hasAnswered: false, answers: [], field: f };
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const customTextFieldAnswers = fields.filter((f) => f['__typename'] == 'TextField').map((f) => {
|
|
45
|
-
return { id: f.id, hasAnswered: false, value: null, field: f };
|
|
46
|
-
});
|
|
38
|
+
const { customSelectFieldAnswers, customBooleanFieldAnswers, customTextFieldAnswers } = getCreateUserCustomFields({ fields });
|
|
47
39
|
|
|
48
40
|
const activeUser = user ? user : {
|
|
49
41
|
email: null,
|
|
50
|
-
|
|
51
|
-
customBooleanFieldAnswers,
|
|
52
|
-
customTextFieldAnswers,
|
|
53
|
-
}
|
|
42
|
+
}
|
|
54
43
|
|
|
55
44
|
const props = {
|
|
56
45
|
additionalEventData,
|
|
@@ -60,6 +49,9 @@ function render(input, out, __component, component, state) {
|
|
|
60
49
|
endpoints: identityX.config.getEndpoints(),
|
|
61
50
|
buttonLabels: input.buttonLabels,
|
|
62
51
|
redirect: input.redirect,
|
|
52
|
+
customSelectFieldAnswers,
|
|
53
|
+
customBooleanFieldAnswers,
|
|
54
|
+
customTextFieldAnswers,
|
|
63
55
|
loginEmailLabel: input.loginEmailLabel,
|
|
64
56
|
loginEmailPlaceholder: input.loginEmailPlaceholder,
|
|
65
57
|
defaultFieldLabels: identityX.config.get("defaultFieldLabels"),
|
|
@@ -87,7 +79,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
87
79
|
}, marko_component);
|
|
88
80
|
|
|
89
81
|
marko_template.meta = {
|
|
90
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
82
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/form-login.marko",
|
|
91
83
|
component: "./form-login.marko",
|
|
92
84
|
tags: [
|
|
93
85
|
"@mindful-web/marko-web/components/browser-component.marko",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/form-logout.marko",
|
|
6
6
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
7
|
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
8
8
|
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
@@ -29,7 +29,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
marko_template.meta = {
|
|
32
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
32
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/form-logout.marko",
|
|
33
33
|
tags: [
|
|
34
34
|
"@mindful-web/marko-web/components/browser-component.marko"
|
|
35
35
|
]
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { get } from "@mindful-web/object-path";
|
|
2
2
|
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
3
3
|
|
|
4
|
+
import getCreateUserCustomFields from '../utils/get-create-user-custom-fields'
|
|
5
|
+
|
|
4
6
|
$ const { req, site } = out.global;
|
|
5
7
|
$ const { identityX, query } = req;
|
|
6
8
|
$ const additionalEventData = defaultValue(input.additionalEventData, {});
|
|
7
9
|
$ const lang = input.lang || defaultValue(site.config.lang, "en");
|
|
8
10
|
|
|
9
11
|
<if(Boolean(identityX))>
|
|
10
|
-
<marko-web-identity-x-context|{ user, isEnabled, application }
|
|
12
|
+
<marko-web-identity-x-context|{ user, isEnabled, application, fields }| with-fields=true>
|
|
13
|
+
$ const { customSelectFieldAnswers, customBooleanFieldAnswers, customTextFieldAnswers } = getCreateUserCustomFields({ fields });
|
|
11
14
|
$ const props = {
|
|
12
15
|
additionalEventData: additionalEventData,
|
|
13
16
|
loginSource: input.loginSource,
|
|
14
17
|
activeUser: user,
|
|
18
|
+
loginCustomSelectFieldAnswers: customSelectFieldAnswers,
|
|
19
|
+
loginCustomBooleanFieldAnswers: customBooleanFieldAnswers,
|
|
20
|
+
loginCustomTextFieldAnswers: customTextFieldAnswers,
|
|
15
21
|
requiredServerFields: identityX.config.getRequiredServerFields(),
|
|
16
22
|
requiredClientFields: identityX.config.getRequiredClientFields(),
|
|
17
23
|
requiredCreateFieldRows: identityX.config.getRequiredCreateFieldRows(),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/form-profile.marko",
|
|
6
6
|
marko_component = require("./form-profile.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_objectPath_module = require("@mindful-web/object-path"),
|
|
@@ -10,6 +10,8 @@ var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
|
10
10
|
get = module_objectPath_module.get,
|
|
11
11
|
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
12
12
|
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
13
|
+
module_getCreateUserCustomFields = require("../utils/get-create-user-custom-fields"),
|
|
14
|
+
getCreateUserCustomFields = module_getCreateUserCustomFields.default || module_getCreateUserCustomFields,
|
|
13
15
|
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
14
16
|
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
15
17
|
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template),
|
|
@@ -29,11 +31,17 @@ function render(input, out, __component, component, state) {
|
|
|
29
31
|
|
|
30
32
|
if (Boolean(identityX)) {
|
|
31
33
|
marko_web_identity_x_context_tag({
|
|
32
|
-
|
|
34
|
+
withFields: true,
|
|
35
|
+
renderBody: function(out, { user, isEnabled, application, fields }) {
|
|
36
|
+
const { customSelectFieldAnswers, customBooleanFieldAnswers, customTextFieldAnswers } = getCreateUserCustomFields({ fields });
|
|
37
|
+
|
|
33
38
|
const props = {
|
|
34
39
|
additionalEventData: additionalEventData,
|
|
35
40
|
loginSource: input.loginSource,
|
|
36
41
|
activeUser: user,
|
|
42
|
+
loginCustomSelectFieldAnswers: customSelectFieldAnswers,
|
|
43
|
+
loginCustomBooleanFieldAnswers: customBooleanFieldAnswers,
|
|
44
|
+
loginCustomTextFieldAnswers: customTextFieldAnswers,
|
|
37
45
|
requiredServerFields: identityX.config.getRequiredServerFields(),
|
|
38
46
|
requiredClientFields: identityX.config.getRequiredClientFields(),
|
|
39
47
|
requiredCreateFieldRows: identityX.config.getRequiredCreateFieldRows(),
|
|
@@ -73,7 +81,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
73
81
|
}, marko_component);
|
|
74
82
|
|
|
75
83
|
marko_template.meta = {
|
|
76
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
84
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/form-profile.marko",
|
|
77
85
|
component: "./form-profile.marko",
|
|
78
86
|
tags: [
|
|
79
87
|
"@mindful-web/marko-web/components/browser-component.marko",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/form-register.marko",
|
|
6
6
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
7
|
marko_assign = require("marko/dist/runtime/helpers/assign"),
|
|
8
8
|
marko_web_identity_x_form_login_template = require("./form-login.marko"),
|
|
@@ -25,7 +25,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
marko_template.meta = {
|
|
28
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
28
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/form-register.marko",
|
|
29
29
|
tags: [
|
|
30
30
|
"./form-login.marko"
|
|
31
31
|
]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/identify.marko",
|
|
6
6
|
marko_component = require("./identify.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_objectPath_module = require("@mindful-web/object-path"),
|
|
@@ -50,7 +50,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
50
50
|
}, marko_component);
|
|
51
51
|
|
|
52
52
|
marko_template.meta = {
|
|
53
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
53
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/identify.marko",
|
|
54
54
|
component: "./identify.marko",
|
|
55
55
|
tags: [
|
|
56
56
|
"@mindful-web/marko-web-gtm/components/push.marko",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/non-auth-identify.marko",
|
|
6
6
|
marko_component = require("./non-auth-identify.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
@@ -45,7 +45,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
45
45
|
}, marko_component);
|
|
46
46
|
|
|
47
47
|
marko_template.meta = {
|
|
48
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
48
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/non-auth-identify.marko",
|
|
49
49
|
component: "./non-auth-identify.marko",
|
|
50
50
|
tags: [
|
|
51
51
|
"@mindful-web/marko-core/components/resolve.marko"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-identity-x$1.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.32.0/components/subscribe.marko",
|
|
6
6
|
marko_component = require("./subscribe.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_objectPath_module = require("@mindful-web/object-path"),
|
|
@@ -73,7 +73,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
73
73
|
}, marko_component);
|
|
74
74
|
|
|
75
75
|
marko_template.meta = {
|
|
76
|
-
id: "/@mindful-web/marko-web-identity-x$1.
|
|
76
|
+
id: "/@mindful-web/marko-web-identity-x$1.32.0/components/subscribe.marko",
|
|
77
77
|
component: "./subscribe.marko",
|
|
78
78
|
tags: [
|
|
79
79
|
"@mindful-web/marko-web/components/browser-component.marko",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindful-web/marko-web-identity-x",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "Marko Wrapper for IdentityX",
|
|
5
5
|
"repository": "https://github.com/parameter1/mindful-web/tree/main/packages/marko-web-identity-x",
|
|
6
6
|
"author": "Josh Worden <josh@parameter1.com>",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "aa3ef6e2c50376b37b11a932c3dc46cafd02cf6a"
|
|
41
41
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { get } = require('@mindful-web/object-path');
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// eslint-disable-next-line max-len
|
|
4
|
+
const hasAnswered = (ans) => ans && ans.hasAnswered && (ans.value || (ans.answers && ans.answers.length));
|
|
4
5
|
|
|
5
6
|
const hasMappedAnswers = (map) => (id) => {
|
|
6
7
|
const ans = map.get(id);
|
|
@@ -15,30 +16,49 @@ const hasMappedAnswers = (map) => (id) => {
|
|
|
15
16
|
*/
|
|
16
17
|
module.exports = ({ appUser, body, definitions }) => {
|
|
17
18
|
// Check for required creation fields
|
|
18
|
-
const
|
|
19
|
-
if (def.type === 'built-in') set.add(def.key);
|
|
19
|
+
const requiredFieldKeySet = definitions.reduce((set, def) => {
|
|
20
|
+
if (def.type === 'built-in' && def.required) set.add(def.key);
|
|
20
21
|
return set;
|
|
21
|
-
}, new Set())
|
|
22
|
+
}, new Set());
|
|
23
|
+
|
|
24
|
+
// Modify required field keys for non-na support
|
|
25
|
+
const depKeys = [
|
|
26
|
+
'regionCode',
|
|
27
|
+
'postalCode',
|
|
28
|
+
];
|
|
29
|
+
depKeys.forEach((key) => {
|
|
30
|
+
// Don't make the dependent address fields required if the parent isn't
|
|
31
|
+
if (requiredFieldKeySet.has(key) && !requiredFieldKeySet.has('countryCode')) {
|
|
32
|
+
requiredFieldKeySet.delete(key);
|
|
33
|
+
}
|
|
34
|
+
// Don't make dependent address fields required for non-NA countries
|
|
35
|
+
const countryCode = get(appUser, 'countryCode') || get(body, 'countryCode') || null;
|
|
36
|
+
if (!['US', 'CA', 'MX'].includes(countryCode)) {
|
|
37
|
+
requiredFieldKeySet.delete(key);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const requiredFieldKeys = [...requiredFieldKeySet];
|
|
22
42
|
|
|
23
43
|
// const requiredCustomBooleans = [...definitions.reduce((set, def) => {
|
|
24
|
-
// if (def.type === 'custom-boolean') set.add(def.id);
|
|
44
|
+
// if (def.type === 'custom-boolean' && def.required) set.add(def.id);
|
|
25
45
|
// return set;
|
|
26
46
|
// }, new Set())];
|
|
27
47
|
|
|
28
48
|
const requiredCustomSelects = [...definitions.reduce((set, def) => {
|
|
29
|
-
if (def.type === 'custom-select') set.add(def.id);
|
|
49
|
+
if (def.type === 'custom-select' && def.required) set.add(def.id);
|
|
30
50
|
return set;
|
|
31
51
|
}, new Set())];
|
|
32
52
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
const requiredCustomTexts = [...definitions.reduce((set, def) => {
|
|
54
|
+
if (def.type === 'custom-text' && def.required) set.add(def.id);
|
|
55
|
+
return set;
|
|
56
|
+
}, new Set())];
|
|
37
57
|
|
|
38
58
|
const userCustomFieldAnswers = new Map([
|
|
39
59
|
// ...(get(appUser, 'customBooleanFieldAnswers') || []).map((a) => [a.field.id, a]),
|
|
40
60
|
...(get(appUser, 'customSelectFieldAnswers') || []).map((a) => [a.field.id, a]),
|
|
41
|
-
|
|
61
|
+
...(get(appUser, 'customTextFieldAnswers') || []).map((a) => [a.field.id, a]),
|
|
42
62
|
]);
|
|
43
63
|
|
|
44
64
|
const customFieldAnswers = new Map([
|
|
@@ -46,8 +66,8 @@ module.exports = ({ appUser, body, definitions }) => {
|
|
|
46
66
|
// ...(get(body, 'customBooleanFieldAnswers') || [])
|
|
47
67
|
// .filter(hasAnswered).map((a) => [a.field.id, a]),
|
|
48
68
|
...(get(body, 'customSelectFieldAnswers') || []).filter(hasAnswered).map((a) => [a.field.id, a]),
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
...(get(body, 'customTextFieldAnswers') || [])
|
|
70
|
+
.filter(hasAnswered).map((a) => [a.field.id, a]),
|
|
51
71
|
]);
|
|
52
72
|
|
|
53
73
|
const appUserHasAllRequiredFields = [
|
|
@@ -58,9 +78,9 @@ module.exports = ({ appUser, body, definitions }) => {
|
|
|
58
78
|
// (id) => userCustomFieldAnswers.has(id) && userCustomFieldAnswers.get(id).hasAnswered,
|
|
59
79
|
// ),
|
|
60
80
|
requiredCustomSelects.every(hasMappedAnswers(userCustomFieldAnswers)),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
requiredCustomTexts.every(
|
|
82
|
+
(id) => userCustomFieldAnswers.has(id) && userCustomFieldAnswers.get(id).hasAnswered,
|
|
83
|
+
),
|
|
64
84
|
].every((v) => v);
|
|
65
85
|
|
|
66
86
|
const hasAllRequiredFields = [
|
|
@@ -69,7 +89,7 @@ module.exports = ({ appUser, body, definitions }) => {
|
|
|
69
89
|
),
|
|
70
90
|
// requiredCustomBooleans.every(hasMappedAnswers(customFieldAnswers)),
|
|
71
91
|
requiredCustomSelects.every(hasMappedAnswers(customFieldAnswers)),
|
|
72
|
-
|
|
92
|
+
requiredCustomTexts.every(hasMappedAnswers(customFieldAnswers)),
|
|
73
93
|
].every((v) => v);
|
|
74
94
|
|
|
75
95
|
const payload = {
|
|
@@ -89,7 +109,15 @@ module.exports = ({ appUser, body, definitions }) => {
|
|
|
89
109
|
...(writeInValues && { writeInValues }),
|
|
90
110
|
};
|
|
91
111
|
}),
|
|
92
|
-
|
|
112
|
+
customTextFieldAnswers: requiredCustomTexts
|
|
113
|
+
.filter(hasMappedAnswers(customFieldAnswers))
|
|
114
|
+
.map((id) => {
|
|
115
|
+
const answer = customFieldAnswers.get(id);
|
|
116
|
+
return {
|
|
117
|
+
fieldId: answer.field.id,
|
|
118
|
+
value: answer.value,
|
|
119
|
+
};
|
|
120
|
+
}), // @todo
|
|
93
121
|
};
|
|
94
122
|
|
|
95
123
|
return {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = ({
|
|
2
|
+
fields,
|
|
3
|
+
} = {}) => {
|
|
4
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
5
|
+
const customBooleanFieldAnswers = fields.filter((f) => f.__typename === 'BooleanField').map((f) => ({
|
|
6
|
+
id: f.id, hasAnswered: false, answer: null, value: null, field: f,
|
|
7
|
+
}));
|
|
8
|
+
// eslint-disable-next-line no-underscore-dangle, eqeqeq
|
|
9
|
+
const customSelectFieldAnswers = fields.filter((f) => f.__typename == 'SelectField').map((f) => ({
|
|
10
|
+
id: f.id, hasAnswered: false, answers: [], field: f,
|
|
11
|
+
}));
|
|
12
|
+
// eslint-disable-next-line no-underscore-dangle, eqeqeq
|
|
13
|
+
const customTextFieldAnswers = fields.filter((f) => f.__typename == 'TextField').map((f) => ({
|
|
14
|
+
id: f.id, hasAnswered: false, value: null, field: f,
|
|
15
|
+
}));
|
|
16
|
+
return {
|
|
17
|
+
customBooleanFieldAnswers,
|
|
18
|
+
customSelectFieldAnswers,
|
|
19
|
+
customTextFieldAnswers,
|
|
20
|
+
};
|
|
21
|
+
};
|