@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
|
+
<form-group :class-name="className">
|
|
3
|
+
<form-label :for="id" :required="required">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</form-label>
|
|
6
|
+
<input
|
|
7
|
+
:id="id"
|
|
8
|
+
v-model="organizationTitle"
|
|
9
|
+
class="form-control"
|
|
10
|
+
type="text"
|
|
11
|
+
:required="required"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:placeholder="placeholder"
|
|
14
|
+
autocomplete="organization-title"
|
|
15
|
+
>
|
|
16
|
+
</form-group>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import FormGroup from '../common/form-group.vue';
|
|
21
|
+
import FormLabel from '../common/form-label.vue';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
components: {
|
|
25
|
+
FormGroup,
|
|
26
|
+
FormLabel,
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
required: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
label: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'Job Title',
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '',
|
|
44
|
+
},
|
|
45
|
+
value: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '',
|
|
48
|
+
},
|
|
49
|
+
className: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
data: () => ({
|
|
55
|
+
id: 'sign-on-organization-title',
|
|
56
|
+
}),
|
|
57
|
+
computed: {
|
|
58
|
+
organizationTitle: {
|
|
59
|
+
get() {
|
|
60
|
+
return this.value || '';
|
|
61
|
+
},
|
|
62
|
+
set(organizationTitle) {
|
|
63
|
+
this.$emit('input', organizationTitle || null);
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form-group :class-name="className">
|
|
3
|
+
<form-label :for="id" :required="required">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</form-label>
|
|
6
|
+
<input
|
|
7
|
+
:id="id"
|
|
8
|
+
v-model="organization"
|
|
9
|
+
class="form-control"
|
|
10
|
+
type="text"
|
|
11
|
+
:required="required"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:placeholder="placeholder"
|
|
14
|
+
autocomplete="organization"
|
|
15
|
+
>
|
|
16
|
+
</form-group>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import FormGroup from '../common/form-group.vue';
|
|
21
|
+
import FormLabel from '../common/form-label.vue';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
components: {
|
|
25
|
+
FormGroup,
|
|
26
|
+
FormLabel,
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
required: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
label: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'Company Name',
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '',
|
|
44
|
+
},
|
|
45
|
+
value: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '',
|
|
48
|
+
},
|
|
49
|
+
className: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
data: () => ({
|
|
55
|
+
id: 'sign-on-organization',
|
|
56
|
+
}),
|
|
57
|
+
computed: {
|
|
58
|
+
organization: {
|
|
59
|
+
get() {
|
|
60
|
+
return this.value || '';
|
|
61
|
+
},
|
|
62
|
+
set(organization) {
|
|
63
|
+
this.$emit('input', organization || null);
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form-group :class-name="className">
|
|
3
|
+
<form-label :for="id" :required="required">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</form-label>
|
|
6
|
+
<input
|
|
7
|
+
:id="id"
|
|
8
|
+
v-model="phoneNumber"
|
|
9
|
+
class="form-control"
|
|
10
|
+
type="tel"
|
|
11
|
+
:required="required"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:placeholder="placeholder"
|
|
14
|
+
autocomplete="phone"
|
|
15
|
+
>
|
|
16
|
+
</form-group>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import FormGroup from '../common/form-group.vue';
|
|
21
|
+
import FormLabel from '../common/form-label.vue';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
components: {
|
|
25
|
+
FormGroup,
|
|
26
|
+
FormLabel,
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
required: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
label: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'Phone Number',
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '',
|
|
44
|
+
},
|
|
45
|
+
value: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '',
|
|
48
|
+
},
|
|
49
|
+
className: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
data: () => ({
|
|
55
|
+
id: 'sign-on-phone',
|
|
56
|
+
}),
|
|
57
|
+
computed: {
|
|
58
|
+
phoneNumber: {
|
|
59
|
+
get() {
|
|
60
|
+
return this.value || '';
|
|
61
|
+
},
|
|
62
|
+
set(phoneNumber) {
|
|
63
|
+
this.$emit('input', phoneNumber || null);
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form-group :class-name="className">
|
|
3
|
+
<form-label :for="id" :required="required">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</form-label>
|
|
6
|
+
<input
|
|
7
|
+
:id="id"
|
|
8
|
+
v-model="postalCode"
|
|
9
|
+
class="form-control"
|
|
10
|
+
type="text"
|
|
11
|
+
:required="required"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:placeholder="placeholder"
|
|
14
|
+
autocomplete="postal-code"
|
|
15
|
+
>
|
|
16
|
+
</form-group>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import FormGroup from '../common/form-group.vue';
|
|
21
|
+
import FormLabel from '../common/form-label.vue';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
components: {
|
|
25
|
+
FormGroup,
|
|
26
|
+
FormLabel,
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
required: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
label: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'Postal/ZIP Code',
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '',
|
|
44
|
+
},
|
|
45
|
+
value: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '',
|
|
48
|
+
},
|
|
49
|
+
className: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'col-md-12',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
data: () => ({
|
|
55
|
+
id: 'sign-on-postal-code',
|
|
56
|
+
}),
|
|
57
|
+
computed: {
|
|
58
|
+
postalCode: {
|
|
59
|
+
get() {
|
|
60
|
+
return this.value || '';
|
|
61
|
+
},
|
|
62
|
+
set(postalCode) {
|
|
63
|
+
this.$emit('input', postalCode || null);
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form-group>
|
|
3
|
+
<div class="custom-control custom-checkbox">
|
|
4
|
+
<input
|
|
5
|
+
:id="`custom-boolean-${id}`"
|
|
6
|
+
v-model="receiveEmail"
|
|
7
|
+
:disabled="disabled"
|
|
8
|
+
:required="required"
|
|
9
|
+
type="checkbox"
|
|
10
|
+
class="custom-control-input"
|
|
11
|
+
>
|
|
12
|
+
<form-label class="custom-control-label" :for="`custom-boolean-${id}`" :required="required">
|
|
13
|
+
<!-- eslint-disable-next-line -->
|
|
14
|
+
<span v-html="emailConsentRequest" />
|
|
15
|
+
</form-label>
|
|
16
|
+
</div>
|
|
17
|
+
</form-group>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import FormGroup from '../common/form-group.vue';
|
|
22
|
+
import FormLabel from '../common/form-label.vue';
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
components: { FormGroup, FormLabel },
|
|
26
|
+
props: {
|
|
27
|
+
emailConsentRequest: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
disabled: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
|
+
value: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
required: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
data: () => ({
|
|
45
|
+
id: 'sign-on-receive-email',
|
|
46
|
+
}),
|
|
47
|
+
computed: {
|
|
48
|
+
receiveEmail: {
|
|
49
|
+
get() {
|
|
50
|
+
return this.value;
|
|
51
|
+
},
|
|
52
|
+
set(receiveEmail) {
|
|
53
|
+
this.$emit('input', receiveEmail);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form-group :class-name="className">
|
|
3
|
+
<form-label :for="id" :required="required">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</form-label>
|
|
6
|
+
<select
|
|
7
|
+
:id="id"
|
|
8
|
+
v-model="regionCode"
|
|
9
|
+
:readonly="isLoading"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
:required="required"
|
|
12
|
+
class="custom-select"
|
|
13
|
+
autocomplete="address-level1"
|
|
14
|
+
>
|
|
15
|
+
<option disabled value="">
|
|
16
|
+
Select state/region...
|
|
17
|
+
</option>
|
|
18
|
+
<option v-for="region in countryRegions" :key="region.id" :value="region.code">
|
|
19
|
+
{{ region.name }}
|
|
20
|
+
</option>
|
|
21
|
+
</select>
|
|
22
|
+
<p v-if="error">
|
|
23
|
+
Unable to load regions: {{ error.message }}
|
|
24
|
+
</p>
|
|
25
|
+
</form-group>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import FormGroup from '../common/form-group.vue';
|
|
30
|
+
import FormLabel from '../common/form-label.vue';
|
|
31
|
+
import get from '../../utils/get';
|
|
32
|
+
import regionCountryCodes from '../../utils/region-country-codes';
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
components: {
|
|
36
|
+
FormGroup,
|
|
37
|
+
FormLabel,
|
|
38
|
+
},
|
|
39
|
+
props: {
|
|
40
|
+
disabled: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
required: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
label: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'State / Region',
|
|
51
|
+
},
|
|
52
|
+
value: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: '',
|
|
55
|
+
},
|
|
56
|
+
countryCode: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: '',
|
|
59
|
+
},
|
|
60
|
+
className: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: 'col-md-6',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
data: () => ({
|
|
66
|
+
id: 'sign-on-region',
|
|
67
|
+
isLoading: false,
|
|
68
|
+
error: null,
|
|
69
|
+
regions: [],
|
|
70
|
+
}),
|
|
71
|
+
computed: {
|
|
72
|
+
regionCode: {
|
|
73
|
+
get() {
|
|
74
|
+
return this.value || '';
|
|
75
|
+
},
|
|
76
|
+
set(regionCode) {
|
|
77
|
+
this.$emit('input', regionCode || null);
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
hasValidCountryCode() {
|
|
81
|
+
return regionCountryCodes.includes(this.countryCode);
|
|
82
|
+
},
|
|
83
|
+
countryRegions() {
|
|
84
|
+
if (!this.hasValidCountryCode) return [];
|
|
85
|
+
return this.regions.filter((region) => region.country.id === this.countryCode);
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
created() {
|
|
89
|
+
this.load();
|
|
90
|
+
},
|
|
91
|
+
methods: {
|
|
92
|
+
async load() {
|
|
93
|
+
this.error = null;
|
|
94
|
+
this.isLoading = true;
|
|
95
|
+
try {
|
|
96
|
+
const res = await get('/regions');
|
|
97
|
+
this.regions = await res.json();
|
|
98
|
+
} catch (e) {
|
|
99
|
+
this.error = e;
|
|
100
|
+
} finally {
|
|
101
|
+
this.isLoading = false;
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
</script>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form-group>
|
|
3
|
+
<div class="custom-control custom-checkbox">
|
|
4
|
+
<input
|
|
5
|
+
:id="`policy-${id}`"
|
|
6
|
+
v-model="given"
|
|
7
|
+
:disabled="disabled"
|
|
8
|
+
:required="required"
|
|
9
|
+
type="checkbox"
|
|
10
|
+
class="custom-control-input"
|
|
11
|
+
>
|
|
12
|
+
<form-label class="custom-control-label" :for="`policy-${id}`" :required="required">
|
|
13
|
+
<!-- eslint-disable-next-line -->
|
|
14
|
+
<span v-html="message" />
|
|
15
|
+
</form-label>
|
|
16
|
+
</div>
|
|
17
|
+
</form-group>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import FormGroup from '../common/form-group.vue';
|
|
22
|
+
import FormLabel from '../common/form-label.vue';
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
components: { FormGroup, FormLabel },
|
|
26
|
+
props: {
|
|
27
|
+
id: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
disabled: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
|
+
value: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
required: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
message: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
given: {
|
|
50
|
+
get() {
|
|
51
|
+
return this.value;
|
|
52
|
+
},
|
|
53
|
+
set(given) {
|
|
54
|
+
this.$emit('input', given);
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form-group :class-name="className">
|
|
3
|
+
<form-label :for="id" :required="required">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</form-label>
|
|
6
|
+
<input
|
|
7
|
+
:id="id"
|
|
8
|
+
v-model="street"
|
|
9
|
+
class="form-control"
|
|
10
|
+
type="text"
|
|
11
|
+
:required="required"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:placeholder="placeholder"
|
|
14
|
+
autocomplete="street"
|
|
15
|
+
>
|
|
16
|
+
</form-group>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import FormGroup from '../common/form-group.vue';
|
|
21
|
+
import FormLabel from '../common/form-label.vue';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
components: {
|
|
25
|
+
FormGroup,
|
|
26
|
+
FormLabel,
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
required: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
label: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'Street',
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '',
|
|
44
|
+
},
|
|
45
|
+
value: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '',
|
|
48
|
+
},
|
|
49
|
+
className: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'col-md-12',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
data: () => ({
|
|
55
|
+
id: 'sign-on-street',
|
|
56
|
+
}),
|
|
57
|
+
computed: {
|
|
58
|
+
street: {
|
|
59
|
+
get() {
|
|
60
|
+
return this.value || '';
|
|
61
|
+
},
|
|
62
|
+
set(street) {
|
|
63
|
+
this.$emit('input', street || null);
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const getOperationName = (string) => {
|
|
2
|
+
const matches = /query\s+([a-z0-9]+)[(]?.+{/gi.exec(string);
|
|
3
|
+
if (matches && matches[1]) return matches[1];
|
|
4
|
+
return undefined;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const { warn } = console;
|
|
8
|
+
|
|
9
|
+
const sha1 = async (string) => {
|
|
10
|
+
try {
|
|
11
|
+
const buffer = new TextEncoder('utf-8').encode(string);
|
|
12
|
+
const digest = await crypto.subtle.digest('SHA-1', buffer);
|
|
13
|
+
const hexCodes = [];
|
|
14
|
+
const view = new DataView(digest);
|
|
15
|
+
for (let i = 0; i < view.byteLength; i += 1) {
|
|
16
|
+
const byte = view.getUint8(i).toString(16).padStart(2, '0');
|
|
17
|
+
hexCodes.push(byte);
|
|
18
|
+
}
|
|
19
|
+
return hexCodes.join('');
|
|
20
|
+
} catch (e) {
|
|
21
|
+
warn('Unable to create SHA1 - GraphQL cache will be disabled.', e.message);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default ({ uri, headers: globalHeaders }) => {
|
|
27
|
+
const cache = new Map();
|
|
28
|
+
return Object.create({
|
|
29
|
+
query: async ({ query, variables, headers }) => {
|
|
30
|
+
const body = JSON.stringify({
|
|
31
|
+
operationName: getOperationName(query),
|
|
32
|
+
variables,
|
|
33
|
+
query,
|
|
34
|
+
});
|
|
35
|
+
const hash = await sha1(body);
|
|
36
|
+
if (hash && cache.has(hash)) return cache.get(hash);
|
|
37
|
+
|
|
38
|
+
const res = await fetch(uri, {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: {
|
|
41
|
+
...globalHeaders,
|
|
42
|
+
...headers,
|
|
43
|
+
'content-type': 'application/json',
|
|
44
|
+
},
|
|
45
|
+
body,
|
|
46
|
+
});
|
|
47
|
+
const json = await res.json();
|
|
48
|
+
if (!res.ok || (json && json.errors)) {
|
|
49
|
+
if (!json || !json.errors) {
|
|
50
|
+
const err = new Error(`An unknown, fatal GraphQL error was encountered (${res.status})`);
|
|
51
|
+
err.statusCode = res.status;
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
const [networkError] = json.errors;
|
|
55
|
+
const err = new Error(networkError.message);
|
|
56
|
+
const { extensions } = networkError;
|
|
57
|
+
if (extensions) err.code = extensions.code;
|
|
58
|
+
if (extensions && extensions.exception) err.statusCode = extensions.exception.statusCode;
|
|
59
|
+
throw err;
|
|
60
|
+
}
|
|
61
|
+
if (hash) cache.set(hash, json);
|
|
62
|
+
return json;
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default (strings, ...rest) => [...strings, ...rest].join('\n');
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import gql from '../parse';
|
|
2
|
+
|
|
3
|
+
const fragment = gql`
|
|
4
|
+
fragment DownloadRelatedContentFragment on Content {
|
|
5
|
+
id
|
|
6
|
+
type
|
|
7
|
+
name
|
|
8
|
+
siteContext { path }
|
|
9
|
+
primaryImage {
|
|
10
|
+
id
|
|
11
|
+
src(input: { options: { auto: "format,compress" } })
|
|
12
|
+
alt
|
|
13
|
+
}
|
|
14
|
+
company {
|
|
15
|
+
id
|
|
16
|
+
name
|
|
17
|
+
siteContext { path }
|
|
18
|
+
}
|
|
19
|
+
...on Media {
|
|
20
|
+
fileSrc
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export default gql`
|
|
26
|
+
query DownloadRelatedAllPublishedContent ($input: AllPublishedContentQueryInput!) {
|
|
27
|
+
allPublishedContent(input: $input) {
|
|
28
|
+
totalCount
|
|
29
|
+
edges {
|
|
30
|
+
node {
|
|
31
|
+
...DownloadRelatedContentFragment
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
${fragment}
|
|
38
|
+
`;
|