@mindful-web/marko-web-identity-x 1.0.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/.eslintignore +1 -0
- package/LICENSE +21 -0
- package/README.md +200 -0
- package/api/fragment-types.json +1 -0
- package/api/fragments/active-user.js +108 -0
- package/api/mutations/add-external-user-id.js +24 -0
- package/api/mutations/create-app-user.js +11 -0
- package/api/mutations/delete-app-user-for-current-application.js +7 -0
- package/api/mutations/impersonate-app-user.js +12 -0
- package/api/mutations/logout-app-user.js +11 -0
- package/api/mutations/send-change-email-link.js +7 -0
- package/api/mutations/send-login-link.js +7 -0
- package/api/mutations/set-custom-attributes.js +15 -0
- package/api/queries/check-content-access.js +19 -0
- package/api/queries/get-active-context.js +45 -0
- package/api/queries/load-user-by-external-id.js +14 -0
- package/api/queries/load-user-by-id.js +11 -0
- package/api/queries/load-user.js +11 -0
- package/browser/.eslintrc.js +11 -0
- package/browser/access.vue +377 -0
- package/browser/authenticate.vue +278 -0
- package/browser/change-email-confirm.vue +120 -0
- package/browser/change-email-init.vue +179 -0
- package/browser/comments/create.vue +107 -0
- package/browser/comments/post.vue +151 -0
- package/browser/comments/stream.vue +319 -0
- package/browser/custom-column.vue +314 -0
- package/browser/dayjs.js +6 -0
- package/browser/download-related.vue +120 -0
- package/browser/download.vue +380 -0
- package/browser/errors/authentication.js +7 -0
- package/browser/errors/feature.js +7 -0
- package/browser/errors/form.js +7 -0
- package/browser/errors/logout.js +7 -0
- package/browser/form/address-block.vue +131 -0
- package/browser/form/common/checkbox-group.vue +140 -0
- package/browser/form/common/form-group.vue +24 -0
- package/browser/form/common/form-label.vue +17 -0
- package/browser/form/consent.vue +121 -0
- package/browser/form/fields/address-extra.vue +68 -0
- package/browser/form/fields/city.vue +68 -0
- package/browser/form/fields/comment-body.vue +63 -0
- package/browser/form/fields/country.vue +94 -0
- package/browser/form/fields/custom-boolean.vue +58 -0
- package/browser/form/fields/custom-select-group.vue +25 -0
- package/browser/form/fields/custom-select-multiple.vue +97 -0
- package/browser/form/fields/custom-select-write-in-inline.vue +39 -0
- package/browser/form/fields/custom-select-write-in.vue +66 -0
- package/browser/form/fields/custom-select.vue +191 -0
- package/browser/form/fields/custom-text.vue +62 -0
- package/browser/form/fields/display-name.vue +64 -0
- package/browser/form/fields/email.vue +62 -0
- package/browser/form/fields/family-name.vue +68 -0
- package/browser/form/fields/given-name.vue +68 -0
- package/browser/form/fields/organization-title.vue +68 -0
- package/browser/form/fields/organization.vue +68 -0
- package/browser/form/fields/phone-number.vue +68 -0
- package/browser/form/fields/postal-code.vue +68 -0
- package/browser/form/fields/receive-email.vue +58 -0
- package/browser/form/fields/region.vue +106 -0
- package/browser/form/fields/regional-policy.vue +59 -0
- package/browser/form/fields/street.vue +68 -0
- package/browser/graphql/create-client.js +65 -0
- package/browser/graphql/parse.js +1 -0
- package/browser/graphql/queries/download-related-content.js +38 -0
- package/browser/index.js +110 -0
- package/browser/login-fields.vue +214 -0
- package/browser/login.vue +331 -0
- package/browser/logout.vue +68 -0
- package/browser/mixins/global-auto-signup-event-emitter.js +18 -0
- package/browser/mixins/global-event-emitter.js +28 -0
- package/browser/profile.vue +688 -0
- package/browser/service.js +32 -0
- package/browser/utils/clean-path.js +1 -0
- package/browser/utils/cookies-enabled.js +10 -0
- package/browser/utils/get-as-array.js +6 -0
- package/browser/utils/get-referring-page.js +7 -0
- package/browser/utils/get.js +8 -0
- package/browser/utils/post.js +10 -0
- package/browser/utils/redirect.js +7 -0
- package/browser/utils/region-country-codes.js +1 -0
- package/components/access.marko +24 -0
- package/components/access.marko.js +61 -0
- package/components/comment-stream.marko +31 -0
- package/components/comment-stream.marko.js +71 -0
- package/components/context.marko +15 -0
- package/components/context.marko.js +52 -0
- package/components/form-access.marko +60 -0
- package/components/form-access.marko.js +111 -0
- package/components/form-authenticate.marko +32 -0
- package/components/form-authenticate.marko.js +73 -0
- package/components/form-change-email.marko +27 -0
- package/components/form-change-email.marko.js +68 -0
- package/components/form-login.marko +32 -0
- package/components/form-login.marko.js +72 -0
- package/components/form-logout.marko +7 -0
- package/components/form-logout.marko.js +36 -0
- package/components/form-profile.marko +38 -0
- package/components/form-profile.marko.js +78 -0
- package/components/form-register.marko +2 -0
- package/components/form-register.marko.js +32 -0
- package/components/identify.marko +17 -0
- package/components/identify.marko.js +59 -0
- package/components/marko.json +90 -0
- package/components/non-auth-identify.marko +15 -0
- package/components/non-auth-identify.marko.js +53 -0
- package/config.js +161 -0
- package/hooks.js +20 -0
- package/index.js +30 -0
- package/marko.json +6 -0
- package/middleware/content-access-state.js +31 -0
- package/middleware/content-download-state.js +27 -0
- package/middleware.js +32 -0
- package/package.json +40 -0
- package/routes/access.js +29 -0
- package/routes/authenticate.js +58 -0
- package/routes/change-email-confirm.js +60 -0
- package/routes/change-email-init.js +16 -0
- package/routes/comment-count.js +19 -0
- package/routes/comments.js +43 -0
- package/routes/countries.js +19 -0
- package/routes/create-comment.js +25 -0
- package/routes/download.js +29 -0
- package/routes/flag-comment.js +21 -0
- package/routes/index.js +40 -0
- package/routes/login-fields.js +35 -0
- package/routes/login.js +95 -0
- package/routes/logout.js +19 -0
- package/routes/profile.js +183 -0
- package/routes/regions.js +22 -0
- package/service.js +483 -0
- package/utils/call-hooks-for.js +28 -0
- package/utils/context-cookie.js +30 -0
- package/utils/create-client.js +48 -0
- package/utils/create-identity-builder.js +33 -0
- package/utils/get-as-array.js +6 -0
- package/utils/json-error-handler.js +41 -0
- package/utils/token-cookie.js +30 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default (value) => value.replace(/^\/+/, '');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default () => {
|
|
2
|
+
try {
|
|
3
|
+
document.cookie = 'cookietest=1';
|
|
4
|
+
const created = document.cookie.indexOf('cookietest=') !== -1;
|
|
5
|
+
document.cookie = 'cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT';
|
|
6
|
+
return created;
|
|
7
|
+
} catch (e) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default (path, body) => {
|
|
2
|
+
const endpoint = path.replace(/^\/+/, '');
|
|
3
|
+
const uri = `/__idx/${endpoint}`;
|
|
4
|
+
return fetch(uri, {
|
|
5
|
+
credentials: 'same-origin',
|
|
6
|
+
method: 'post',
|
|
7
|
+
headers: { 'content-type': 'application/json' },
|
|
8
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
9
|
+
});
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default ['US', 'CA', 'MX'];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getAsArray } from "@mindful-web/object-path";
|
|
2
|
+
|
|
3
|
+
$ const { req } = out.global;
|
|
4
|
+
$ const isEnabled = input.enabled || false;
|
|
5
|
+
$ const { identityX } = req;
|
|
6
|
+
|
|
7
|
+
$ const accessObj = {
|
|
8
|
+
canAccess: true,
|
|
9
|
+
isLoggedIn: false,
|
|
10
|
+
hasRequiredAccessLevel: false,
|
|
11
|
+
requiresAccessLevel: false,
|
|
12
|
+
requiredAccessLevels: [],
|
|
13
|
+
requiresUserInput: false,
|
|
14
|
+
messages: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
$ const requiredAccessLevelIds = getAsArray(input.requiredAccessLevelIds);
|
|
18
|
+
$ const params = { isEnabled, requiredAccessLevelIds };
|
|
19
|
+
|
|
20
|
+
$ const checkContentAccess = async () => (isEnabled && Boolean(req.identityX) ? identityX.checkContentAccess(params) : accessObj);
|
|
21
|
+
|
|
22
|
+
<marko-web-resolve|{ resolved }| promise=checkContentAccess()>
|
|
23
|
+
<${input.renderBody} ...resolved />
|
|
24
|
+
</marko-web-resolve>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.0.0/components/access.marko",
|
|
6
|
+
marko_component = require("./access.marko"),
|
|
7
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
|
+
module_objectPath_module = require("@mindful-web/object-path"),
|
|
9
|
+
objectPath_module = module_objectPath_module.default || module_objectPath_module,
|
|
10
|
+
getAsArray = module_objectPath_module.getAsArray,
|
|
11
|
+
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
12
|
+
marko_web_resolve_template = require("@mindful-web/marko-core/components/resolve.marko"),
|
|
13
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
14
|
+
marko_web_resolve_tag = marko_loadTag(marko_web_resolve_template);
|
|
15
|
+
|
|
16
|
+
function render(input, out, __component, component, state) {
|
|
17
|
+
var data = input;
|
|
18
|
+
|
|
19
|
+
const { req } = out.global;
|
|
20
|
+
|
|
21
|
+
const isEnabled = input.enabled || false;
|
|
22
|
+
|
|
23
|
+
const { identityX } = req;
|
|
24
|
+
|
|
25
|
+
const accessObj = {
|
|
26
|
+
canAccess: true,
|
|
27
|
+
isLoggedIn: false,
|
|
28
|
+
hasRequiredAccessLevel: false,
|
|
29
|
+
requiresAccessLevel: false,
|
|
30
|
+
requiredAccessLevels: [],
|
|
31
|
+
requiresUserInput: false,
|
|
32
|
+
messages: {},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const requiredAccessLevelIds = getAsArray(input.requiredAccessLevelIds);
|
|
36
|
+
|
|
37
|
+
const params = { isEnabled, requiredAccessLevelIds };
|
|
38
|
+
|
|
39
|
+
const checkContentAccess = async () => (isEnabled && Boolean(req.identityX) ? identityX.checkContentAccess(params) : accessObj);
|
|
40
|
+
|
|
41
|
+
marko_web_resolve_tag({
|
|
42
|
+
promise: checkContentAccess(),
|
|
43
|
+
renderBody: function(out, { resolved }) {
|
|
44
|
+
marko_dynamicTag(out, input.renderBody, function() {
|
|
45
|
+
return resolved;
|
|
46
|
+
}, null, null, null, __component, "1");
|
|
47
|
+
}
|
|
48
|
+
}, out, __component, "0");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
marko_template._ = marko_renderer(render, {
|
|
52
|
+
e_: marko_componentType
|
|
53
|
+
}, marko_component);
|
|
54
|
+
|
|
55
|
+
marko_template.meta = {
|
|
56
|
+
id: "/@mindful-web/marko-web-identity-x$1.0.0/components/access.marko",
|
|
57
|
+
component: "./access.marko",
|
|
58
|
+
tags: [
|
|
59
|
+
"@mindful-web/marko-core/components/resolve.marko"
|
|
60
|
+
]
|
|
61
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { get } from "@mindful-web/object-path";
|
|
2
|
+
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
3
|
+
|
|
4
|
+
$ const { req } = out.global;
|
|
5
|
+
$ const { identityX } = req;
|
|
6
|
+
$ const additionalEventData = defaultValue(input.additionalEventData, {});
|
|
7
|
+
|
|
8
|
+
<if(identityX)>
|
|
9
|
+
<marko-web-identity-x-context|{ user, isEnabled, application }|>
|
|
10
|
+
$ const props = {
|
|
11
|
+
additionalEventData: additionalEventData,
|
|
12
|
+
loginSource: input.loginSource,
|
|
13
|
+
activeUser: user,
|
|
14
|
+
identifier: `${input.identifier}`,
|
|
15
|
+
title: input.title,
|
|
16
|
+
description: input.description,
|
|
17
|
+
url: input.url,
|
|
18
|
+
loadMoreButtonClass: input.loadMoreButtonClass,
|
|
19
|
+
loginButtonLabels: input.loginButtonLabels,
|
|
20
|
+
endpoints: identityX.config.getEndpoints(),
|
|
21
|
+
consentPolicy: get(application, "organization.consentPolicy"),
|
|
22
|
+
regionalConsentPolicies: get(application, "organization.regionalConsentPolicies"),
|
|
23
|
+
appContextId: identityX.config.get("appContextId"),
|
|
24
|
+
requiredCreateFields: identityX.config.getRequiredCreateFields(),
|
|
25
|
+
defaultFieldLabels: identityX.config.get("defaultFieldLabels"),
|
|
26
|
+
};
|
|
27
|
+
<if(isEnabled && identityX.config.commentsEnabled())>
|
|
28
|
+
<marko-web-browser-component name="IdentityXCommentStream" props=props />
|
|
29
|
+
</if>
|
|
30
|
+
</marko-web-identity-x-context>
|
|
31
|
+
</if>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.0.0/components/comment-stream.marko",
|
|
6
|
+
marko_component = require("./comment-stream.marko"),
|
|
7
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
|
+
module_objectPath_module = require("@mindful-web/object-path"),
|
|
9
|
+
objectPath_module = module_objectPath_module.default || module_objectPath_module,
|
|
10
|
+
get = module_objectPath_module.get,
|
|
11
|
+
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
12
|
+
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
13
|
+
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
14
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
15
|
+
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template),
|
|
16
|
+
marko_web_identity_x_context_template = require("./context.marko"),
|
|
17
|
+
marko_web_identity_x_context_tag = marko_loadTag(marko_web_identity_x_context_template);
|
|
18
|
+
|
|
19
|
+
function render(input, out, __component, component, state) {
|
|
20
|
+
var data = input;
|
|
21
|
+
|
|
22
|
+
const { req } = out.global;
|
|
23
|
+
|
|
24
|
+
const { identityX } = req;
|
|
25
|
+
|
|
26
|
+
const additionalEventData = defaultValue(input.additionalEventData, {});
|
|
27
|
+
|
|
28
|
+
if (identityX) {
|
|
29
|
+
marko_web_identity_x_context_tag({
|
|
30
|
+
renderBody: function(out, { user, isEnabled, application }) {
|
|
31
|
+
const props = {
|
|
32
|
+
additionalEventData: additionalEventData,
|
|
33
|
+
loginSource: input.loginSource,
|
|
34
|
+
activeUser: user,
|
|
35
|
+
identifier: `${input.identifier}`,
|
|
36
|
+
title: input.title,
|
|
37
|
+
description: input.description,
|
|
38
|
+
url: input.url,
|
|
39
|
+
loadMoreButtonClass: input.loadMoreButtonClass,
|
|
40
|
+
loginButtonLabels: input.loginButtonLabels,
|
|
41
|
+
endpoints: identityX.config.getEndpoints(),
|
|
42
|
+
consentPolicy: get(application, "organization.consentPolicy"),
|
|
43
|
+
regionalConsentPolicies: get(application, "organization.regionalConsentPolicies"),
|
|
44
|
+
appContextId: identityX.config.get("appContextId"),
|
|
45
|
+
requiredCreateFields: identityX.config.getRequiredCreateFields(),
|
|
46
|
+
defaultFieldLabels: identityX.config.get("defaultFieldLabels"),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
if (isEnabled && identityX.config.commentsEnabled()) {
|
|
50
|
+
marko_web_browser_component_tag({
|
|
51
|
+
name: "IdentityXCommentStream",
|
|
52
|
+
props: props
|
|
53
|
+
}, out, __component, "1");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, out, __component, "0");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
marko_template._ = marko_renderer(render, {
|
|
61
|
+
e_: marko_componentType
|
|
62
|
+
}, marko_component);
|
|
63
|
+
|
|
64
|
+
marko_template.meta = {
|
|
65
|
+
id: "/@mindful-web/marko-web-identity-x$1.0.0/components/comment-stream.marko",
|
|
66
|
+
component: "./comment-stream.marko",
|
|
67
|
+
tags: [
|
|
68
|
+
"@mindful-web/marko-web/components/browser-component.marko",
|
|
69
|
+
"./context.marko"
|
|
70
|
+
]
|
|
71
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
$ const { req } = out.global;
|
|
2
|
+
$ const { identityX } = req;
|
|
3
|
+
$ const isEnabled = Boolean(req.identityX);
|
|
4
|
+
$ const loadContext = async () => (isEnabled ? identityX.loadActiveContext() : {
|
|
5
|
+
user: null,
|
|
6
|
+
mergedAccessLevels: [],
|
|
7
|
+
mergedTeams: [],
|
|
8
|
+
hasTeams: false,
|
|
9
|
+
hasUser: false,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
<marko-web-resolve|{ resolved }| promise=loadContext()>
|
|
13
|
+
$ const output = { ...resolved, isEnabled };
|
|
14
|
+
<${input.renderBody} ...output />
|
|
15
|
+
</marko-web-resolve>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.0.0/components/context.marko",
|
|
6
|
+
marko_component = require("./context.marko"),
|
|
7
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
|
+
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
9
|
+
marko_web_resolve_template = require("@mindful-web/marko-core/components/resolve.marko"),
|
|
10
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
11
|
+
marko_web_resolve_tag = marko_loadTag(marko_web_resolve_template);
|
|
12
|
+
|
|
13
|
+
function render(input, out, __component, component, state) {
|
|
14
|
+
var data = input;
|
|
15
|
+
|
|
16
|
+
const { req } = out.global;
|
|
17
|
+
|
|
18
|
+
const { identityX } = req;
|
|
19
|
+
|
|
20
|
+
const isEnabled = Boolean(req.identityX);
|
|
21
|
+
|
|
22
|
+
const loadContext = async () => (isEnabled ? identityX.loadActiveContext() : {
|
|
23
|
+
user: null,
|
|
24
|
+
mergedAccessLevels: [],
|
|
25
|
+
mergedTeams: [],
|
|
26
|
+
hasTeams: false,
|
|
27
|
+
hasUser: false,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
marko_web_resolve_tag({
|
|
31
|
+
promise: loadContext(),
|
|
32
|
+
renderBody: function(out, { resolved }) {
|
|
33
|
+
const output = { ...resolved, isEnabled };
|
|
34
|
+
|
|
35
|
+
marko_dynamicTag(out, input.renderBody, function() {
|
|
36
|
+
return output;
|
|
37
|
+
}, null, null, null, __component, "1");
|
|
38
|
+
}
|
|
39
|
+
}, out, __component, "0");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
marko_template._ = marko_renderer(render, {
|
|
43
|
+
e_: marko_componentType
|
|
44
|
+
}, marko_component);
|
|
45
|
+
|
|
46
|
+
marko_template.meta = {
|
|
47
|
+
id: "/@mindful-web/marko-web-identity-x$1.0.0/components/context.marko",
|
|
48
|
+
component: "./context.marko",
|
|
49
|
+
tags: [
|
|
50
|
+
"@mindful-web/marko-core/components/resolve.marko"
|
|
51
|
+
]
|
|
52
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
3
|
+
import { get, getAsObject } from "@mindful-web/object-path";
|
|
4
|
+
|
|
5
|
+
$ const { req: { identityX } } = out.global;
|
|
6
|
+
$ const { content, formId, user, application } = input;
|
|
7
|
+
$ const form = identityX.config.getAsObject(`forms.${formId}`);
|
|
8
|
+
$ const additionalEventData = defaultValue(input.additionalEventData, {});
|
|
9
|
+
$ const ctaPrefix = defaultValue(input.ctaPrefix, `To access "${content.name}"`);
|
|
10
|
+
$ const callToAction = defaultValue(input.callToAction, `${ctaPrefix}, please fill out the form below.`);
|
|
11
|
+
$ const callToActionLoggedOut = defaultValue(input.callToAction, `${ctaPrefix}, please enter your email address below. You will receive an email containing a verification link.`);
|
|
12
|
+
$ const buttonLabel = defaultValue(input.buttonLabel, "Submit & Access");
|
|
13
|
+
$ const title = defaultValue(input.title, "Complete the form to access this content");
|
|
14
|
+
$ const updateProfileOnSubmit = defaultValue(input.updateProfileOnSubmit, true);
|
|
15
|
+
$ const { displayForm, cookie } = getAsObject(out, "global.contentAccessState");
|
|
16
|
+
$ const consentPolicy = defaultValue(form.consentPolicy, get(application, "organization.consentPolicy"));
|
|
17
|
+
$ const emailConsentRequest = defaultValue(form.emailConsentRequest, get(application, "organization.emailConsentRequest"));
|
|
18
|
+
|
|
19
|
+
<if(identityX && form.fieldRows, displayForm)>
|
|
20
|
+
<div class="content-survey-access-idx__wrapper">
|
|
21
|
+
$ const props = {
|
|
22
|
+
// Access form props
|
|
23
|
+
content: content,
|
|
24
|
+
title: form.title,
|
|
25
|
+
fieldRows: form.fieldRows,
|
|
26
|
+
loginSource: "contentAccess",
|
|
27
|
+
title: title,
|
|
28
|
+
cookie,
|
|
29
|
+
displayForm,
|
|
30
|
+
callToAction: callToAction,
|
|
31
|
+
callToActionLoggedOut: callToActionLoggedOut,
|
|
32
|
+
updateProfileOnSubmit,
|
|
33
|
+
|
|
34
|
+
// Login props
|
|
35
|
+
activeUser: user,
|
|
36
|
+
additionalEventData: additionalEventData,
|
|
37
|
+
appContextId: identityX.config.get("appContextId"),
|
|
38
|
+
buttonLabel: buttonLabel,
|
|
39
|
+
defaultCountryCode: identityX.config.get("defaultCountryCode"),
|
|
40
|
+
defaultFieldLabels: identityX.config.get("defaultFieldLabels"),
|
|
41
|
+
enableChangeEmail: identityX.config.get("enableChangeEmail"),
|
|
42
|
+
endpoints: identityX.config.getEndpoints(),
|
|
43
|
+
requiredCreateFields: identityX.config.getRequiredCreateFields(),
|
|
44
|
+
|
|
45
|
+
// Consent
|
|
46
|
+
consentPolicy: consentPolicy,
|
|
47
|
+
consentPolicyEnabled: defaultValue(input.consentPolicyEnabled, true),
|
|
48
|
+
emailConsentRequest: emailConsentRequest,
|
|
49
|
+
emailConsentRequestEnabled: defaultValue(input.emailConsentRequest, true),
|
|
50
|
+
regionalConsentPolicies: get(application, "organization.regionalConsentPolicies"),
|
|
51
|
+
};
|
|
52
|
+
<marko-web-browser-component name="IdentityXAccess" props=props />
|
|
53
|
+
</div>
|
|
54
|
+
</if>
|
|
55
|
+
<else>
|
|
56
|
+
$ const msg = `IdentityX Survey Gating: couldn't load form "${formId}"!`;
|
|
57
|
+
<p class="text-danger" data-marko-error=msg>
|
|
58
|
+
${msg}
|
|
59
|
+
</p>
|
|
60
|
+
</else>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.0.0/components/form-access.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
8
|
+
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
9
|
+
module_objectPath_module = require("@mindful-web/object-path"),
|
|
10
|
+
objectPath_module = module_objectPath_module.default || module_objectPath_module,
|
|
11
|
+
get = module_objectPath_module.get,
|
|
12
|
+
getAsObject = module_objectPath_module.getAsObject,
|
|
13
|
+
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
14
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
15
|
+
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template),
|
|
16
|
+
helpers_escape_xml = require("marko/dist/runtime/html/helpers/escape-xml"),
|
|
17
|
+
marko_escapeXml = helpers_escape_xml.x,
|
|
18
|
+
marko_attr = require("marko/dist/runtime/html/helpers/attr");
|
|
19
|
+
|
|
20
|
+
function render(input, out, __component, component, state) {
|
|
21
|
+
var data = input;
|
|
22
|
+
|
|
23
|
+
const { req: { identityX } } = out.global;
|
|
24
|
+
|
|
25
|
+
const { content, formId, user, application } = input;
|
|
26
|
+
|
|
27
|
+
const form = identityX.config.getAsObject(`forms.${formId}`);
|
|
28
|
+
|
|
29
|
+
const additionalEventData = defaultValue(input.additionalEventData, {});
|
|
30
|
+
|
|
31
|
+
const ctaPrefix = defaultValue(input.ctaPrefix, `To access "${content.name}"`);
|
|
32
|
+
|
|
33
|
+
const callToAction = defaultValue(input.callToAction, `${ctaPrefix}, please fill out the form below.`);
|
|
34
|
+
|
|
35
|
+
const callToActionLoggedOut = defaultValue(input.callToAction, `${ctaPrefix}, please enter your email address below. You will receive an email containing a verification link.`);
|
|
36
|
+
|
|
37
|
+
const buttonLabel = defaultValue(input.buttonLabel, "Submit & Access");
|
|
38
|
+
|
|
39
|
+
const title = defaultValue(input.title, "Complete the form to access this content");
|
|
40
|
+
|
|
41
|
+
const updateProfileOnSubmit = defaultValue(input.updateProfileOnSubmit, true);
|
|
42
|
+
|
|
43
|
+
const { displayForm, cookie } = getAsObject(out, "global.contentAccessState");
|
|
44
|
+
|
|
45
|
+
const consentPolicy = defaultValue(form.consentPolicy, get(application, "organization.consentPolicy"));
|
|
46
|
+
|
|
47
|
+
const emailConsentRequest = defaultValue(form.emailConsentRequest, get(application, "organization.emailConsentRequest"));
|
|
48
|
+
|
|
49
|
+
if (identityX && form.fieldRows, displayForm) {
|
|
50
|
+
out.w("<div class=\"content-survey-access-idx__wrapper\">");
|
|
51
|
+
|
|
52
|
+
const props = {
|
|
53
|
+
// Access form props
|
|
54
|
+
content: content,
|
|
55
|
+
title: form.title,
|
|
56
|
+
fieldRows: form.fieldRows,
|
|
57
|
+
loginSource: "contentAccess",
|
|
58
|
+
title: title,
|
|
59
|
+
cookie,
|
|
60
|
+
displayForm,
|
|
61
|
+
callToAction: callToAction,
|
|
62
|
+
callToActionLoggedOut: callToActionLoggedOut,
|
|
63
|
+
updateProfileOnSubmit,
|
|
64
|
+
|
|
65
|
+
// Login props
|
|
66
|
+
activeUser: user,
|
|
67
|
+
additionalEventData: additionalEventData,
|
|
68
|
+
appContextId: identityX.config.get("appContextId"),
|
|
69
|
+
buttonLabel: buttonLabel,
|
|
70
|
+
defaultCountryCode: identityX.config.get("defaultCountryCode"),
|
|
71
|
+
defaultFieldLabels: identityX.config.get("defaultFieldLabels"),
|
|
72
|
+
enableChangeEmail: identityX.config.get("enableChangeEmail"),
|
|
73
|
+
endpoints: identityX.config.getEndpoints(),
|
|
74
|
+
requiredCreateFields: identityX.config.getRequiredCreateFields(),
|
|
75
|
+
|
|
76
|
+
// Consent
|
|
77
|
+
consentPolicy: consentPolicy,
|
|
78
|
+
consentPolicyEnabled: defaultValue(input.consentPolicyEnabled, true),
|
|
79
|
+
emailConsentRequest: emailConsentRequest,
|
|
80
|
+
emailConsentRequestEnabled: defaultValue(input.emailConsentRequest, true),
|
|
81
|
+
regionalConsentPolicies: get(application, "organization.regionalConsentPolicies"),
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
marko_web_browser_component_tag({
|
|
85
|
+
name: "IdentityXAccess",
|
|
86
|
+
props: props
|
|
87
|
+
}, out, __component, "1");
|
|
88
|
+
|
|
89
|
+
out.w("</div>");
|
|
90
|
+
} else {
|
|
91
|
+
const msg = `IdentityX Survey Gating: couldn't load form "${formId}"!`;
|
|
92
|
+
|
|
93
|
+
out.w("<p class=\"text-danger\"" +
|
|
94
|
+
marko_attr("data-marko-error", msg) +
|
|
95
|
+
">" +
|
|
96
|
+
marko_escapeXml(msg) +
|
|
97
|
+
"</p>");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
marko_template._ = marko_renderer(render, {
|
|
102
|
+
d_: true,
|
|
103
|
+
e_: marko_componentType
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
marko_template.meta = {
|
|
107
|
+
id: "/@mindful-web/marko-web-identity-x$1.0.0/components/form-access.marko",
|
|
108
|
+
tags: [
|
|
109
|
+
"@mindful-web/marko-web/components/browser-component.marko"
|
|
110
|
+
]
|
|
111
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { get } from "@mindful-web/object-path";
|
|
2
|
+
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
3
|
+
|
|
4
|
+
$ const { req } = out.global;
|
|
5
|
+
$ const { identityX, query } = req;
|
|
6
|
+
$ const isEnabled = Boolean(req.identityX);
|
|
7
|
+
$ const additionalEventData = defaultValue(input.additionalEventData, {});
|
|
8
|
+
|
|
9
|
+
<if(isEnabled)>
|
|
10
|
+
<marko-web-identity-x-context|{ application }|>
|
|
11
|
+
$ const props = {
|
|
12
|
+
additionalEventData: additionalEventData,
|
|
13
|
+
token: query.token,
|
|
14
|
+
redirectTo: query.redirectTo,
|
|
15
|
+
requiredServerFields: identityX.config.getRequiredServerFields(),
|
|
16
|
+
requiredClientFields: identityX.config.getRequiredClientFields(),
|
|
17
|
+
activeCustomFieldIds: identityX.config.getActiveCustomFieldIds(),
|
|
18
|
+
defaultCountryCode: identityX.config.get("defaultCountryCode"),
|
|
19
|
+
defaultFieldLabels: identityX.config.get("defaultFieldLabels"),
|
|
20
|
+
booleanQuestionsLabel: identityX.config.get("booleanQuestionsLabel"),
|
|
21
|
+
hiddenFields: identityX.config.getHiddenFields(),
|
|
22
|
+
endpoints: identityX.config.getEndpoints(),
|
|
23
|
+
callToAction: input.callToAction,
|
|
24
|
+
buttonLabel: input.buttonLabel,
|
|
25
|
+
consentPolicy: get(application, "organization.consentPolicy"),
|
|
26
|
+
emailConsentRequest: get(application, "organization.emailConsentRequest"),
|
|
27
|
+
regionalConsentPolicies: get(application, "organization.regionalConsentPolicies"),
|
|
28
|
+
enableChangeEmail: identityX.config.get("enableChangeEmail")
|
|
29
|
+
};
|
|
30
|
+
<marko-web-browser-component name="IdentityXAuthenticate" props=props />
|
|
31
|
+
</marko-web-identity-x-context>
|
|
32
|
+
</if>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-identity-x$1.0.0/components/form-authenticate.marko",
|
|
6
|
+
marko_component = require("./form-authenticate.marko"),
|
|
7
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
|
+
module_objectPath_module = require("@mindful-web/object-path"),
|
|
9
|
+
objectPath_module = module_objectPath_module.default || module_objectPath_module,
|
|
10
|
+
get = module_objectPath_module.get,
|
|
11
|
+
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
12
|
+
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
13
|
+
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
14
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
15
|
+
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template),
|
|
16
|
+
marko_web_identity_x_context_template = require("./context.marko"),
|
|
17
|
+
marko_web_identity_x_context_tag = marko_loadTag(marko_web_identity_x_context_template);
|
|
18
|
+
|
|
19
|
+
function render(input, out, __component, component, state) {
|
|
20
|
+
var data = input;
|
|
21
|
+
|
|
22
|
+
const { req } = out.global;
|
|
23
|
+
|
|
24
|
+
const { identityX, query } = req;
|
|
25
|
+
|
|
26
|
+
const isEnabled = Boolean(req.identityX);
|
|
27
|
+
|
|
28
|
+
const additionalEventData = defaultValue(input.additionalEventData, {});
|
|
29
|
+
|
|
30
|
+
if (isEnabled) {
|
|
31
|
+
marko_web_identity_x_context_tag({
|
|
32
|
+
renderBody: function(out, { application }) {
|
|
33
|
+
const props = {
|
|
34
|
+
additionalEventData: additionalEventData,
|
|
35
|
+
token: query.token,
|
|
36
|
+
redirectTo: query.redirectTo,
|
|
37
|
+
requiredServerFields: identityX.config.getRequiredServerFields(),
|
|
38
|
+
requiredClientFields: identityX.config.getRequiredClientFields(),
|
|
39
|
+
activeCustomFieldIds: identityX.config.getActiveCustomFieldIds(),
|
|
40
|
+
defaultCountryCode: identityX.config.get("defaultCountryCode"),
|
|
41
|
+
defaultFieldLabels: identityX.config.get("defaultFieldLabels"),
|
|
42
|
+
booleanQuestionsLabel: identityX.config.get("booleanQuestionsLabel"),
|
|
43
|
+
hiddenFields: identityX.config.getHiddenFields(),
|
|
44
|
+
endpoints: identityX.config.getEndpoints(),
|
|
45
|
+
callToAction: input.callToAction,
|
|
46
|
+
buttonLabel: input.buttonLabel,
|
|
47
|
+
consentPolicy: get(application, "organization.consentPolicy"),
|
|
48
|
+
emailConsentRequest: get(application, "organization.emailConsentRequest"),
|
|
49
|
+
regionalConsentPolicies: get(application, "organization.regionalConsentPolicies"),
|
|
50
|
+
enableChangeEmail: identityX.config.get("enableChangeEmail")
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
marko_web_browser_component_tag({
|
|
54
|
+
name: "IdentityXAuthenticate",
|
|
55
|
+
props: props
|
|
56
|
+
}, out, __component, "1");
|
|
57
|
+
}
|
|
58
|
+
}, out, __component, "0");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
marko_template._ = marko_renderer(render, {
|
|
63
|
+
e_: marko_componentType
|
|
64
|
+
}, marko_component);
|
|
65
|
+
|
|
66
|
+
marko_template.meta = {
|
|
67
|
+
id: "/@mindful-web/marko-web-identity-x$1.0.0/components/form-authenticate.marko",
|
|
68
|
+
component: "./form-authenticate.marko",
|
|
69
|
+
tags: [
|
|
70
|
+
"@mindful-web/marko-web/components/browser-component.marko",
|
|
71
|
+
"./context.marko"
|
|
72
|
+
]
|
|
73
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { get } from "@mindful-web/object-path";
|
|
2
|
+
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
3
|
+
|
|
4
|
+
$ const { req } = out.global;
|
|
5
|
+
$ const { identityX } = req;
|
|
6
|
+
|
|
7
|
+
<if(Boolean(identityX))>
|
|
8
|
+
<marko-web-identity-x-context|{ user, isEnabled, application }|>
|
|
9
|
+
$ const props = {
|
|
10
|
+
actionText: input.actionText,
|
|
11
|
+
activeUser: user,
|
|
12
|
+
endpoints: identityX.config.getEndpoints(),
|
|
13
|
+
buttonLabels: input.buttonLabels,
|
|
14
|
+
consentPolicy: get(application, "organization.consentPolicy"),
|
|
15
|
+
appContextId: identityX.config.get("appContextId"),
|
|
16
|
+
token: get(req, "query.token"),
|
|
17
|
+
};
|
|
18
|
+
<if(isEnabled)>
|
|
19
|
+
<if(props.token)>
|
|
20
|
+
<marko-web-browser-component name="IdentityXChangeEmailConfirm" props=props />
|
|
21
|
+
</if>
|
|
22
|
+
<else>
|
|
23
|
+
<marko-web-browser-component name="IdentityXChangeEmailInit" props=props />
|
|
24
|
+
</else>
|
|
25
|
+
</if>
|
|
26
|
+
</marko-web-identity-x-context>
|
|
27
|
+
</if>
|