@designcrowd/fe-shared-lib 1.3.4 → 1.3.5-textarea-ssr-fix

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcrowd/fe-shared-lib",
3
- "version": "1.3.4",
3
+ "version": "1.3.5-textarea-ssr-fix",
4
4
  "scripts": {
5
5
  "start": "run-p storybook watch:translation",
6
6
  "build": "npm run build:css --production",
@@ -96,6 +96,11 @@ export default {
96
96
  }
97
97
  },
98
98
  autoFitToContent() {
99
+ // Guard against server-side rendering where document is not available
100
+ if (typeof document === 'undefined' || typeof window === 'undefined') {
101
+ return;
102
+ }
103
+
99
104
  setTimeout(() => {
100
105
  const textarea = document.getElementById(`scl-input-${this.id}`);
101
106
  if (textarea) {
@@ -150,7 +150,7 @@ export default {
150
150
  getRedirectToSignInUrl() {
151
151
  const url = new URL(`https://${window.location.host}${this.signInUrl}`);
152
152
  if (this.aEmail) {
153
- url.searchParams.append('initialUserName', this.aEmail);
153
+ url.searchParams.set('initialUserName', this.aEmail);
154
154
  }
155
155
  return url;
156
156
  },
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <div :class="{ 'tw-mx-2 sm:tw-mx-8': !isModal }">
3
- <div v-if="helloBar" class="tw-text-left tw-mt-8">
3
+ <div v-if="helloBar" class="tw-text-left tw-mt-2 tw-mb-2">
4
4
  <HelloBar :label="helloBar.label" :description="helloBar.description" :variant="helloBar.variant">
5
5
  <template #cta>
6
6
  <Button
7
7
  v-if="recommendedActionLink"
8
8
  variant="secondary"
9
9
  size="small"
10
- label="RESET PASSWORD"
10
+ :label="resetPasswordButtonLabel"
11
11
  class="tw-hidden sm:tw-inline"
12
12
  :url="getRedirectToRecommendedActionUrl"
13
13
  />
@@ -15,7 +15,7 @@
15
15
  v-if="recommendedActionLink"
16
16
  variant="secondary"
17
17
  size="medium"
18
- label="RESET PASSWORD"
18
+ :label="resetPasswordButtonLabel"
19
19
  :full-width="true"
20
20
  class="sm:tw-hidden tw-mt-2"
21
21
  :url="getRedirectToRecommendedActionUrl"
@@ -63,7 +63,7 @@
63
63
  <input
64
64
  v-model="aUserName"
65
65
  name="userName"
66
- type="email"
66
+ type="text"
67
67
  data-test-email-input
68
68
  aria-required="true"
69
69
  :aria-invalid="!!userNameError"
@@ -327,6 +327,7 @@ export default {
327
327
  emailPlaceholderLabel: this.signInContent.emailPlaceholderLabel ?? 'Email Address',
328
328
  passwordPlaceholderLabel: this.signInContent.passwordPlaceholderLabel ?? 'Password',
329
329
  forgotPasswordLabel: this.signInContent.forgotPasswordLabel ?? 'Forgot Password?',
330
+ resetPasswordButtonLabel: this.signInContent.resetPasswordButtonLabel ?? 'RESET PASSWORD',
330
331
  orLabel: this.signInContent.orLabel ?? 'or',
331
332
  signUpLabel: this.signInContent.signUpLabel ?? 'Sign Up',
332
333
  };
@@ -349,7 +350,7 @@ export default {
349
350
  const url = new URL(`https://${window.location.host}${this.forgotPasswordUrl}`);
350
351
 
351
352
  if (this.aUserName) {
352
- url.searchParams.append('email', this.aUserName);
353
+ url.searchParams.set('email', this.aUserName);
353
354
  }
354
355
  return url;
355
356
  },
@@ -360,7 +361,7 @@ export default {
360
361
 
361
362
  const url = new URL(`https://${window.location.host}${this.recommendedActionLink}`);
362
363
  if (this.aUserName) {
363
- url.searchParams.append('email', this.aUserName);
364
+ url.searchParams.set('email', this.aUserName);
364
365
  }
365
366
  return url?.toString();
366
367
  },
@@ -395,8 +396,10 @@ export default {
395
396
  this.clearErrorMessages();
396
397
  },
397
398
  initialUserName(newValue) {
398
- this.aUserName = newValue;
399
- },
399
+ if (newValue && newValue !== this.aUserName) {
400
+ this.aUserName = newValue;
401
+ }
402
+ }
400
403
  },
401
404
  methods: {
402
405
  validate(e) {
@@ -7,7 +7,7 @@
7
7
  v-if="recommendedActionLink"
8
8
  variant="secondary"
9
9
  size="small"
10
- label="RESET PASSWORD"
10
+ :label="resetPasswordButtonLabel"
11
11
  class="tw-hidden sm:tw-inline"
12
12
  :url="getRedirectToRecommendedActionUrl"
13
13
  />
@@ -15,7 +15,7 @@
15
15
  v-if="recommendedActionLink"
16
16
  variant="secondary"
17
17
  size="medium"
18
- label="RESET PASSWORD"
18
+ :label="resetPasswordButtonLabel"
19
19
  :full-width="true"
20
20
  class="sm:tw-hidden tw-mt-2"
21
21
  :url="getRedirectToRecommendedActionUrl"
@@ -39,7 +39,7 @@
39
39
  <input
40
40
  v-model="aUserName"
41
41
  name="userName"
42
- type="email"
42
+ type="text"
43
43
  aria-required="true"
44
44
  :aria-invalid="!!userNameError"
45
45
  autocomplete="”email”"
@@ -117,6 +117,7 @@ import SocialSignIn from './SocialSignIn.vue';
117
117
  import SubmissionButton from './SubmissionButton.vue';
118
118
  import AuthLegal from './AuthLegal.vue';
119
119
  import themeMixin from '../../mixins/themeMixin';
120
+ import isValidEmail from '../../helpers/email-validator';
120
121
  import { getCurrentLocale } from '../../../useSharedLibTranslate';
121
122
 
122
123
  export default {
@@ -217,6 +218,7 @@ export default {
217
218
  alreadyHaveAnAccountLabel: this.signUpContent.alreadyHaveAnAccountLabel ?? 'Already have an account?',
218
219
  orLabel: this.signUpContent.orLabel ?? 'or',
219
220
  loginLabel: this.signUpContent.loginLabel ?? 'Login',
221
+ resetPasswordButtonLabel: this.signUpContent.resetPasswordButtonLabel ?? 'RESET PASSWORD',
220
222
  };
221
223
  },
222
224
  computed: {
@@ -237,25 +239,24 @@ export default {
237
239
  },
238
240
  methods: {
239
241
  validate(e) {
240
- if (this.aUserName && this.password) {
241
- this.isLoading = true;
242
- return true;
243
- }
244
-
245
242
  this.isLoading = false;
246
243
 
247
244
  this.userNameError = undefined;
248
245
  this.passwordError = undefined;
249
246
 
250
- if (!this.aUserName) {
247
+ if (!this.aUserName || !isValidEmail(this.aUserName)) {
251
248
  this.userNameError = this.invalidUsernameErrorLabel;
249
+ e.preventDefault();
250
+ return false;
252
251
  }
253
252
  if (!this.password) {
254
253
  this.passwordError = this.missingPasswordErrorLabel;
254
+ e.preventDefault();
255
+ return false;
255
256
  }
256
257
 
257
- e.preventDefault();
258
- return false;
258
+ this.isLoading = true;
259
+ return true;
259
260
  },
260
261
  },
261
262
  };