@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,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="error">
|
|
3
|
+
<p>{{ error }}</p>
|
|
4
|
+
</div>
|
|
5
|
+
<div v-else>
|
|
6
|
+
<p>Logging out...</p>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import redirect from './utils/redirect';
|
|
12
|
+
import getReferringPage from './utils/get-referring-page';
|
|
13
|
+
import cookiesEnabled from './utils/cookies-enabled';
|
|
14
|
+
import post from './utils/post';
|
|
15
|
+
import LogoutError from './errors/logout';
|
|
16
|
+
import FeatureError from './errors/feature';
|
|
17
|
+
import EventEmitter from './mixins/global-event-emitter';
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
mixins: [EventEmitter],
|
|
24
|
+
|
|
25
|
+
props: {
|
|
26
|
+
redirectTo: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: null,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
data: () => ({
|
|
32
|
+
error: null,
|
|
33
|
+
}),
|
|
34
|
+
mounted() {
|
|
35
|
+
if (cookiesEnabled()) {
|
|
36
|
+
this.emit('logout-mounted');
|
|
37
|
+
this.logout();
|
|
38
|
+
} else {
|
|
39
|
+
const error = new FeatureError('Your browser does not support cookies. Please enable cookies to use this feature.');
|
|
40
|
+
this.error = error.message;
|
|
41
|
+
this.emit('logout-errored', { message: error.message });
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
async logout() {
|
|
49
|
+
this.error = null;
|
|
50
|
+
try {
|
|
51
|
+
const res = await post('/logout');
|
|
52
|
+
const data = await res.json();
|
|
53
|
+
if (!res.ok) throw new LogoutError(data.message, res.status);
|
|
54
|
+
this.emit('logout-submitted', { data });
|
|
55
|
+
this.redirect();
|
|
56
|
+
} catch (e) {
|
|
57
|
+
this.error = `Unable to logout: ${e.message}`;
|
|
58
|
+
this.emit('logout-errored', { message: e.message });
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
redirect() {
|
|
63
|
+
const to = this.redirectTo ? this.redirectTo : getReferringPage();
|
|
64
|
+
redirect(to);
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import getAsArray from '../../utils/get-as-array';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
inject: ['EventBus'],
|
|
5
|
+
methods: {
|
|
6
|
+
emitAutoSignup(data) {
|
|
7
|
+
const { EventBus } = this;
|
|
8
|
+
// See if there are any autoSignups added to the additionalEventData
|
|
9
|
+
// Trigger related autoSignup events for each productId being applied.
|
|
10
|
+
const autoSignups = getAsArray(data, 'additionalEventData.autoSignups');
|
|
11
|
+
if (autoSignups && autoSignups.length) {
|
|
12
|
+
autoSignups.forEach((autoSignup) => {
|
|
13
|
+
EventBus.$emit('identity-x-auto-signup', autoSignup);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
inject: ['EventBus'],
|
|
3
|
+
props: {
|
|
4
|
+
additionalEventData: {
|
|
5
|
+
type: Object,
|
|
6
|
+
default: () => ({}),
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
methods: {
|
|
10
|
+
emit(name, data, entity) {
|
|
11
|
+
const source = this.loginSource || this.source;
|
|
12
|
+
const dataActionSource = data ? data.actionSource : undefined;
|
|
13
|
+
const actionSource = dataActionSource || window.IdentityX.getLoginSource() || source;
|
|
14
|
+
const payload = {
|
|
15
|
+
...data,
|
|
16
|
+
...this.additionalEventData,
|
|
17
|
+
additionalEventData: this.additionalEventData,
|
|
18
|
+
actionSource,
|
|
19
|
+
loginSource: actionSource,
|
|
20
|
+
source: actionSource,
|
|
21
|
+
entity,
|
|
22
|
+
};
|
|
23
|
+
const { EventBus } = this;
|
|
24
|
+
this.$emit(name, payload);
|
|
25
|
+
EventBus.$emit(`identity-x-${name}`, payload);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|