@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.
Files changed (138) hide show
  1. package/.eslintignore +1 -0
  2. package/LICENSE +21 -0
  3. package/README.md +200 -0
  4. package/api/fragment-types.json +1 -0
  5. package/api/fragments/active-user.js +108 -0
  6. package/api/mutations/add-external-user-id.js +24 -0
  7. package/api/mutations/create-app-user.js +11 -0
  8. package/api/mutations/delete-app-user-for-current-application.js +7 -0
  9. package/api/mutations/impersonate-app-user.js +12 -0
  10. package/api/mutations/logout-app-user.js +11 -0
  11. package/api/mutations/send-change-email-link.js +7 -0
  12. package/api/mutations/send-login-link.js +7 -0
  13. package/api/mutations/set-custom-attributes.js +15 -0
  14. package/api/queries/check-content-access.js +19 -0
  15. package/api/queries/get-active-context.js +45 -0
  16. package/api/queries/load-user-by-external-id.js +14 -0
  17. package/api/queries/load-user-by-id.js +11 -0
  18. package/api/queries/load-user.js +11 -0
  19. package/browser/.eslintrc.js +11 -0
  20. package/browser/access.vue +377 -0
  21. package/browser/authenticate.vue +278 -0
  22. package/browser/change-email-confirm.vue +120 -0
  23. package/browser/change-email-init.vue +179 -0
  24. package/browser/comments/create.vue +107 -0
  25. package/browser/comments/post.vue +151 -0
  26. package/browser/comments/stream.vue +319 -0
  27. package/browser/custom-column.vue +314 -0
  28. package/browser/dayjs.js +6 -0
  29. package/browser/download-related.vue +120 -0
  30. package/browser/download.vue +380 -0
  31. package/browser/errors/authentication.js +7 -0
  32. package/browser/errors/feature.js +7 -0
  33. package/browser/errors/form.js +7 -0
  34. package/browser/errors/logout.js +7 -0
  35. package/browser/form/address-block.vue +131 -0
  36. package/browser/form/common/checkbox-group.vue +140 -0
  37. package/browser/form/common/form-group.vue +24 -0
  38. package/browser/form/common/form-label.vue +17 -0
  39. package/browser/form/consent.vue +121 -0
  40. package/browser/form/fields/address-extra.vue +68 -0
  41. package/browser/form/fields/city.vue +68 -0
  42. package/browser/form/fields/comment-body.vue +63 -0
  43. package/browser/form/fields/country.vue +94 -0
  44. package/browser/form/fields/custom-boolean.vue +58 -0
  45. package/browser/form/fields/custom-select-group.vue +25 -0
  46. package/browser/form/fields/custom-select-multiple.vue +97 -0
  47. package/browser/form/fields/custom-select-write-in-inline.vue +39 -0
  48. package/browser/form/fields/custom-select-write-in.vue +66 -0
  49. package/browser/form/fields/custom-select.vue +191 -0
  50. package/browser/form/fields/custom-text.vue +62 -0
  51. package/browser/form/fields/display-name.vue +64 -0
  52. package/browser/form/fields/email.vue +62 -0
  53. package/browser/form/fields/family-name.vue +68 -0
  54. package/browser/form/fields/given-name.vue +68 -0
  55. package/browser/form/fields/organization-title.vue +68 -0
  56. package/browser/form/fields/organization.vue +68 -0
  57. package/browser/form/fields/phone-number.vue +68 -0
  58. package/browser/form/fields/postal-code.vue +68 -0
  59. package/browser/form/fields/receive-email.vue +58 -0
  60. package/browser/form/fields/region.vue +106 -0
  61. package/browser/form/fields/regional-policy.vue +59 -0
  62. package/browser/form/fields/street.vue +68 -0
  63. package/browser/graphql/create-client.js +65 -0
  64. package/browser/graphql/parse.js +1 -0
  65. package/browser/graphql/queries/download-related-content.js +38 -0
  66. package/browser/index.js +110 -0
  67. package/browser/login-fields.vue +214 -0
  68. package/browser/login.vue +331 -0
  69. package/browser/logout.vue +68 -0
  70. package/browser/mixins/global-auto-signup-event-emitter.js +18 -0
  71. package/browser/mixins/global-event-emitter.js +28 -0
  72. package/browser/profile.vue +688 -0
  73. package/browser/service.js +32 -0
  74. package/browser/utils/clean-path.js +1 -0
  75. package/browser/utils/cookies-enabled.js +10 -0
  76. package/browser/utils/get-as-array.js +6 -0
  77. package/browser/utils/get-referring-page.js +7 -0
  78. package/browser/utils/get.js +8 -0
  79. package/browser/utils/post.js +10 -0
  80. package/browser/utils/redirect.js +7 -0
  81. package/browser/utils/region-country-codes.js +1 -0
  82. package/components/access.marko +24 -0
  83. package/components/access.marko.js +61 -0
  84. package/components/comment-stream.marko +31 -0
  85. package/components/comment-stream.marko.js +71 -0
  86. package/components/context.marko +15 -0
  87. package/components/context.marko.js +52 -0
  88. package/components/form-access.marko +60 -0
  89. package/components/form-access.marko.js +111 -0
  90. package/components/form-authenticate.marko +32 -0
  91. package/components/form-authenticate.marko.js +73 -0
  92. package/components/form-change-email.marko +27 -0
  93. package/components/form-change-email.marko.js +68 -0
  94. package/components/form-login.marko +32 -0
  95. package/components/form-login.marko.js +72 -0
  96. package/components/form-logout.marko +7 -0
  97. package/components/form-logout.marko.js +36 -0
  98. package/components/form-profile.marko +38 -0
  99. package/components/form-profile.marko.js +78 -0
  100. package/components/form-register.marko +2 -0
  101. package/components/form-register.marko.js +32 -0
  102. package/components/identify.marko +17 -0
  103. package/components/identify.marko.js +59 -0
  104. package/components/marko.json +90 -0
  105. package/components/non-auth-identify.marko +15 -0
  106. package/components/non-auth-identify.marko.js +53 -0
  107. package/config.js +161 -0
  108. package/hooks.js +20 -0
  109. package/index.js +30 -0
  110. package/marko.json +6 -0
  111. package/middleware/content-access-state.js +31 -0
  112. package/middleware/content-download-state.js +27 -0
  113. package/middleware.js +32 -0
  114. package/package.json +40 -0
  115. package/routes/access.js +29 -0
  116. package/routes/authenticate.js +58 -0
  117. package/routes/change-email-confirm.js +60 -0
  118. package/routes/change-email-init.js +16 -0
  119. package/routes/comment-count.js +19 -0
  120. package/routes/comments.js +43 -0
  121. package/routes/countries.js +19 -0
  122. package/routes/create-comment.js +25 -0
  123. package/routes/download.js +29 -0
  124. package/routes/flag-comment.js +21 -0
  125. package/routes/index.js +40 -0
  126. package/routes/login-fields.js +35 -0
  127. package/routes/login.js +95 -0
  128. package/routes/logout.js +19 -0
  129. package/routes/profile.js +183 -0
  130. package/routes/regions.js +22 -0
  131. package/service.js +483 -0
  132. package/utils/call-hooks-for.js +28 -0
  133. package/utils/context-cookie.js +30 -0
  134. package/utils/create-client.js +48 -0
  135. package/utils/create-identity-builder.js +33 -0
  136. package/utils/get-as-array.js +6 -0
  137. package/utils/json-error-handler.js +41 -0
  138. package/utils/token-cookie.js +30 -0
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <fieldset :disabled="disabled" class="csmulti">
3
+ <legend class="csmulti-legend">
4
+ {{ label }}
5
+ <strong v-if="required" class="text-danger">*</strong>
6
+ </legend>
7
+
8
+ <div class="csmulti-wrapper p-2">
9
+ <div class="csmulti-inner">
10
+ <label class="text-muted">
11
+ Select all that apply...
12
+ </label>
13
+
14
+ <template v-for="option in options">
15
+ <custom-select-group
16
+ v-if="option.options && option.options.length"
17
+ :key="option.id"
18
+ :label="option.label"
19
+ >
20
+ <checkbox-group
21
+ :options="option.options"
22
+ :selected="selected"
23
+ :required="required"
24
+ :group-id="groupId"
25
+ :can-write-in="canWriteIn"
26
+ :write-in-label="writeInLabel"
27
+ :write-in-answer="writeInAnswer"
28
+ @change="$emit('change', $event)"
29
+ />
30
+ </custom-select-group>
31
+ <checkbox-group
32
+ v-else
33
+ :key="option.id"
34
+ :options="[option]"
35
+ :selected="selected"
36
+ :required="required"
37
+ :group-id="groupId"
38
+ :can-write-in="canWriteIn"
39
+ :write-in-label="writeInLabel"
40
+ :write-in-answer="writeInAnswer"
41
+ @change="$emit('change', $event)"
42
+ />
43
+ </template>
44
+ </div>
45
+ </div>
46
+ </fieldset>
47
+ </template>
48
+
49
+ <script>
50
+ import CheckboxGroup from '../common/checkbox-group.vue';
51
+ import CustomSelectGroup from './custom-select-group.vue';
52
+
53
+ export default {
54
+ components: {
55
+ CheckboxGroup,
56
+ CustomSelectGroup,
57
+ },
58
+ props: {
59
+ label: {
60
+ type: String,
61
+ required: true,
62
+ },
63
+ groupId: {
64
+ type: String,
65
+ required: true,
66
+ },
67
+ options: {
68
+ type: Array,
69
+ required: true,
70
+ },
71
+ selected: {
72
+ type: Array,
73
+ required: true,
74
+ },
75
+ disabled: {
76
+ type: Boolean,
77
+ default: false,
78
+ },
79
+ required: {
80
+ type: Boolean,
81
+ default: false,
82
+ },
83
+ canWriteIn: {
84
+ type: Boolean,
85
+ default: false,
86
+ },
87
+ writeInLabel: {
88
+ type: String,
89
+ default: 'Other',
90
+ },
91
+ writeInAnswer: {
92
+ type: Object,
93
+ default: () => ({}),
94
+ },
95
+ },
96
+ };
97
+ </script>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <input
3
+ v-model="answer.writeInValue"
4
+ class="form-control form-control-sm"
5
+ type="text"
6
+ :required="required"
7
+ :placeholder="placeholder"
8
+ :autofocus="autofocus"
9
+ autocomplete="off"
10
+ >
11
+ </template>
12
+
13
+ <script>
14
+
15
+ export default {
16
+ props: {
17
+ required: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ answer: {
22
+ type: Object,
23
+ required: true,
24
+ },
25
+ placeholder: {
26
+ type: String,
27
+ default: '',
28
+ },
29
+ },
30
+ computed: {
31
+ id() {
32
+ return `custom-select-write-in-${this.answer.id}`;
33
+ },
34
+ autofocus() {
35
+ return this.answer && !this.answer.writeInValue;
36
+ },
37
+ },
38
+ };
39
+ </script>
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div class="input-group">
3
+ <div class="input-group-prepend w-25">
4
+ <div class="input-group-text d-inline-block text-truncate w-100" :title="label">
5
+ {{ label }}
6
+ </div>
7
+ </div>
8
+
9
+ <input
10
+ :id="id"
11
+ v-model="answer.writeInValue"
12
+ class="form-control"
13
+ type="text"
14
+ :required="required"
15
+ :placeholder="placeholder"
16
+ :autofocus="autofocus"
17
+ autocomplete="off"
18
+ >
19
+
20
+ <div class="input-group-append">
21
+ <button
22
+ type="button"
23
+ class="btn btn-outline-secondary"
24
+ @click="$emit('clear', answer.id)"
25
+ >
26
+ Clear
27
+ </button>
28
+ </div>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+
34
+ export default {
35
+ props: {
36
+ required: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ answer: {
41
+ type: Object,
42
+ required: true,
43
+ },
44
+ placeholder: {
45
+ type: String,
46
+ default: '',
47
+ },
48
+ value: {
49
+ type: String,
50
+ default: '',
51
+ },
52
+ label: {
53
+ type: String,
54
+ default: '',
55
+ },
56
+ },
57
+ computed: {
58
+ id() {
59
+ return `custom-select-write-in-${this.answer.id}`;
60
+ },
61
+ autofocus() {
62
+ return this.answer && !this.answer.writeInValue;
63
+ },
64
+ },
65
+ };
66
+ </script>
@@ -0,0 +1,191 @@
1
+ <template>
2
+ <form-group>
3
+ <form-label v-if="!multiple" :for="fieldId" :required="required">
4
+ {{ label }}
5
+ </form-label>
6
+ <custom-select-multiple
7
+ v-if="multiple"
8
+ :group-id="id"
9
+ :options="options"
10
+ :selected="selectedOptionIds"
11
+ :required="required"
12
+ :label="label"
13
+ :field-id="fieldId"
14
+ :can-write-in="canWriteIn"
15
+ :write-in-label="writeInLabel"
16
+ :write-in-answer="writeInAnswer"
17
+ @change="$emit('change', $event)"
18
+ />
19
+ <select
20
+ v-else-if="!canWriteIn"
21
+ :id="fieldId"
22
+ class="custom-select"
23
+ :required="required"
24
+ @change="$emit('change', [$event.target.value])"
25
+ >
26
+ <option value="">
27
+ Please select...
28
+ </option>
29
+ <template v-for="option in options">
30
+ <optgroup
31
+ v-if="option.options"
32
+ :key="option.id"
33
+ :label="option.label"
34
+ >
35
+ <option
36
+ v-for="child in option.options"
37
+ :key="child.id"
38
+ :value="child.id"
39
+ :selected="child.id === selectedOptionId"
40
+ >
41
+ {{ child.label }}
42
+ </option>
43
+ </optgroup>
44
+ <option
45
+ v-else
46
+ :key="option.id"
47
+ :value="option.id"
48
+ :selected="option.id === selectedOptionId"
49
+ >
50
+ {{ option.label }}
51
+ </option>
52
+ </template>
53
+ </select>
54
+ <custom-select-write-in
55
+ v-else
56
+ :label="writeInLabel"
57
+ :answer="writeInAnswer"
58
+ :required="required"
59
+ @clear="clearWriteIn($event)"
60
+ />
61
+ </form-group>
62
+ </template>
63
+
64
+ <script>
65
+ import CustomSelectMultiple from './custom-select-multiple.vue';
66
+ import CustomSelectWriteIn from './custom-select-write-in.vue';
67
+ import FormGroup from '../common/form-group.vue';
68
+ import FormLabel from '../common/form-label.vue';
69
+
70
+ export default {
71
+ components: {
72
+ CustomSelectMultiple,
73
+ CustomSelectWriteIn,
74
+ FormGroup,
75
+ FormLabel,
76
+ },
77
+
78
+ props: {
79
+ /**
80
+ * The unique field id.
81
+ */
82
+ id: {
83
+ type: String,
84
+ required: true,
85
+ },
86
+
87
+ /**
88
+ * The field display label.
89
+ */
90
+ label: {
91
+ type: String,
92
+ required: true,
93
+ },
94
+
95
+ /**
96
+ * Whether the field is required.
97
+ */
98
+ required: {
99
+ type: Boolean,
100
+ default: false,
101
+ },
102
+
103
+ /**
104
+ * Whether the custom question supports multiple answers.
105
+ */
106
+ multiple: {
107
+ type: Boolean,
108
+ default: false,
109
+ },
110
+
111
+ /**
112
+ * The field options (the possible answers).
113
+ */
114
+ options: {
115
+ type: Array,
116
+ default: () => [],
117
+ },
118
+
119
+ /**
120
+ * Since all custom select answers are arrays mimic this behavior.
121
+ */
122
+ selected: {
123
+ type: Array,
124
+ default: () => [],
125
+ },
126
+ },
127
+
128
+ computed: {
129
+ value: {
130
+ get() {
131
+ return this.multiple ? this.selectedOptionIds : this.selectedOptionId;
132
+ },
133
+ set() {
134
+ // noop, re-render caused by emit/prop update
135
+ },
136
+ },
137
+ fieldId() {
138
+ return `custom-select-${this.id}`;
139
+ },
140
+
141
+ selectedOptionIds() {
142
+ return this.selected.map((item) => item.id);
143
+ },
144
+
145
+ selectedOptionId() {
146
+ const { selectedOptionIds, multiple } = this;
147
+ if (!multiple) return selectedOptionIds[0] || undefined;
148
+ return selectedOptionIds.slice();
149
+ },
150
+
151
+ selectedOptions() {
152
+ const { selectedOptionIds: sids } = this;
153
+ return this.options.reduce((arr, option) => ([
154
+ ...arr,
155
+ ...(sids.includes(option.id) ? [option] : []),
156
+ ...(option.options ? option.options.filter((opt) => sids.includes(opt.id)) : []),
157
+ ]), []);
158
+ },
159
+
160
+ canWriteIn() {
161
+ const { selectedOptions } = this;
162
+ if (selectedOptions.length) {
163
+ const canWriteIn = selectedOptions.find((o) => o.canWriteIn);
164
+ return Boolean(canWriteIn);
165
+ }
166
+ return false;
167
+ },
168
+ writeInAnswer() {
169
+ const { selectedOptions, selected: answers } = this;
170
+ return answers.find((a) => {
171
+ const opt = selectedOptions.find((o) => o.id === a.id);
172
+ return opt && opt.canWriteIn;
173
+ });
174
+ },
175
+ showWriteIn() {
176
+ return this.selected && this.canWriteIn;
177
+ },
178
+ writeInLabel() {
179
+ const selected = this.selectedOptions.find((option) => option.canWriteIn);
180
+ return selected && selected.label;
181
+ },
182
+ },
183
+
184
+ methods: {
185
+ clearWriteIn(optionId) {
186
+ const selected = this.selected.filter((item) => item.id !== optionId);
187
+ this.$emit('change', selected);
188
+ },
189
+ },
190
+ };
191
+ </script>
@@ -0,0 +1,62 @@
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="customText"
9
+ class="form-control"
10
+ type="text"
11
+ :required="required"
12
+ @change="$emit('change', customText)"
13
+ >
14
+ </form-group>
15
+ </template>
16
+
17
+ <script>
18
+ import FormGroup from '../common/form-group.vue';
19
+ import FormLabel from '../common/form-label.vue';
20
+
21
+ export default {
22
+ components: {
23
+ FormGroup,
24
+ FormLabel,
25
+ },
26
+ props: {
27
+ /**
28
+ * The unique field id.
29
+ */
30
+ id: {
31
+ type: String,
32
+ required: true,
33
+ },
34
+ required: {
35
+ type: Boolean,
36
+ default: false,
37
+ },
38
+ label: {
39
+ type: String,
40
+ default: 'Custom Input',
41
+ },
42
+ value: {
43
+ type: String,
44
+ default: '',
45
+ },
46
+ className: {
47
+ type: String,
48
+ default: 'col-md-12',
49
+ },
50
+ },
51
+ computed: {
52
+ customText: {
53
+ get() {
54
+ return this.value || '';
55
+ },
56
+ set(customText) {
57
+ this.$emit('change', customText);
58
+ },
59
+ },
60
+ },
61
+ };
62
+ </script>
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <form-group>
3
+ <form-label :for="id" :required="required">
4
+ {{ label }}
5
+ </form-label>
6
+ <input
7
+ :id="id"
8
+ v-model="displayName"
9
+ class="form-control"
10
+ type="text"
11
+ :required="required"
12
+ :disabled="disabled"
13
+ :placeholder="placeholder"
14
+ autocomplete="nickname"
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: true,
36
+ },
37
+ label: {
38
+ type: String,
39
+ default: 'Display Name',
40
+ },
41
+ placeholder: {
42
+ type: String,
43
+ default: 'Will be displayed when posting comments.',
44
+ },
45
+ value: {
46
+ type: String,
47
+ default: '',
48
+ },
49
+ },
50
+ data: () => ({
51
+ id: 'sign-on-display-name',
52
+ }),
53
+ computed: {
54
+ displayName: {
55
+ get() {
56
+ return this.value || '';
57
+ },
58
+ set(displayName) {
59
+ this.$emit('input', displayName || null);
60
+ },
61
+ },
62
+ },
63
+ };
64
+ </script>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <form-group>
3
+ <form-label :for="id" :required="true">
4
+ {{ label }}
5
+ </form-label>
6
+ <input
7
+ :id="id"
8
+ v-model="email"
9
+ class="form-control"
10
+ type="email"
11
+ :required="true"
12
+ :disabled="disabled"
13
+ :placeholder="placeholder"
14
+ autocomplete="email"
15
+ @focus="$emit('focus')"
16
+ >
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: {
26
+ FormGroup,
27
+ FormLabel,
28
+ },
29
+ props: {
30
+ id: {
31
+ type: String,
32
+ default: 'sign-on-email',
33
+ },
34
+ disabled: {
35
+ type: Boolean,
36
+ default: false,
37
+ },
38
+ label: {
39
+ type: String,
40
+ default: 'Email Address',
41
+ },
42
+ placeholder: {
43
+ type: String,
44
+ default: '',
45
+ },
46
+ value: {
47
+ type: String,
48
+ default: '',
49
+ },
50
+ },
51
+ computed: {
52
+ email: {
53
+ get() {
54
+ return this.value || '';
55
+ },
56
+ set(email) {
57
+ this.$emit('input', email || null);
58
+ },
59
+ },
60
+ },
61
+ };
62
+ </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="familyName"
9
+ class="form-control"
10
+ type="text"
11
+ :required="required"
12
+ :disabled="disabled"
13
+ :placeholder="placeholder"
14
+ autocomplete="family-name"
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: 'Last 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-family-name',
56
+ }),
57
+ computed: {
58
+ familyName: {
59
+ get() {
60
+ return this.value || '';
61
+ },
62
+ set(familyName) {
63
+ this.$emit('input', familyName || 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="givenName"
9
+ class="form-control"
10
+ type="text"
11
+ :required="required"
12
+ :disabled="disabled"
13
+ :placeholder="placeholder"
14
+ autocomplete="given-name"
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: 'First 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-given-name',
56
+ }),
57
+ computed: {
58
+ givenName: {
59
+ get() {
60
+ return this.value || '';
61
+ },
62
+ set(givenName) {
63
+ this.$emit('input', givenName || null);
64
+ },
65
+ },
66
+ },
67
+ };
68
+ </script>