@sprucelabs/heartwood-view-controllers 128.5.1 → 128.6.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.
@@ -487,7 +487,9 @@ export interface FieldRenderOptions<S extends Schema> {
487
487
  renderHintAs?: 'subtitle' | 'tooltip';
488
488
  placeholder?: string | null;
489
489
  label?: string | null;
490
- hint?: string | null;
490
+ hint?: string | null | {
491
+ markdown?: string;
492
+ };
491
493
  vc?: FormInputViewController;
492
494
  fieldDefinition?: FieldDefinitions;
493
495
  rightButtons?: InputButton[];
@@ -13,6 +13,7 @@ import Authenticator from '../auth/Authenticator.js';
13
13
  import buildBigForm from '../builders/buildBigForm.js';
14
14
  import SpruceError from '../errors/SpruceError.js';
15
15
  import AbstractViewController from './Abstract.vc.js';
16
+ const defaultPhoneHint = "I'm gonna send you a pin. By entering your number, you agree to receive mobile messages at the phone number provided. Messages frequency varies. Message and data rates may apply.";
16
17
  class LoginCardViewController extends AbstractViewController {
17
18
  constructor(options) {
18
19
  super(options);
@@ -146,19 +147,26 @@ class LoginCardViewController extends AbstractViewController {
146
147
  : null;
147
148
  }
148
149
  renderPhoneSection() {
149
- var _a;
150
+ const hint = this.smsDisclaimer
151
+ ? {
152
+ markdown: this.smsDisclaimer,
153
+ }
154
+ : defaultPhoneHint;
150
155
  const fields = [
151
156
  {
152
157
  name: 'phone',
153
- hint: (_a = this.smsDisclaimer) !== null && _a !== void 0 ? _a : loginSchema.fields.phone.hint,
154
158
  },
155
159
  ];
156
160
  if (this.shouldRequireCheckboxForSmsOptIn) {
157
161
  fields.push({
158
162
  name: 'smsOptIn',
159
163
  renderAs: 'checkbox',
164
+ hint,
160
165
  });
161
166
  }
167
+ else {
168
+ fields[0].hint = hint;
169
+ }
162
170
  return {
163
171
  title: this.renderPhoneSlideTitle(),
164
172
  fields,
@@ -306,7 +314,7 @@ const loginSchema = buildSchema({
306
314
  type: 'phone',
307
315
  isRequired: true,
308
316
  label: 'Phone',
309
- hint: "I'm gonna send you a pin. By entering your number, you agree to receive mobile messages at the phone number provided. Messages frequency varies. Message and data rates may apply.",
317
+ hint: defaultPhoneHint,
310
318
  },
311
319
  email: {
312
320
  type: 'email',
@@ -35,7 +35,7 @@ export default class FormViewController<S extends Schema, V extends ViewModel<S>
35
35
  private normalizeValues;
36
36
  private validateDirtyFields;
37
37
  setErrors(errors: TypedFieldError<S>[]): void;
38
- protected setErrorsByField(errorsByField: FormErrorsByField<S>): void;
38
+ setErrorsByField(errorsByField: FormErrorsByField<S>): void;
39
39
  validate(): FormErrorsByField<S>;
40
40
  isValid(): boolean;
41
41
  protected _isValidForFields(visibleFields: SchemaFieldNames<S>[]): boolean;
@@ -487,7 +487,9 @@ export interface FieldRenderOptions<S extends Schema> {
487
487
  renderHintAs?: 'subtitle' | 'tooltip';
488
488
  placeholder?: string | null;
489
489
  label?: string | null;
490
- hint?: string | null;
490
+ hint?: string | null | {
491
+ markdown?: string;
492
+ };
491
493
  vc?: FormInputViewController;
492
494
  fieldDefinition?: FieldDefinitions;
493
495
  rightButtons?: InputButton[];
@@ -9,6 +9,7 @@ const Authenticator_1 = __importDefault(require("../auth/Authenticator"));
9
9
  const buildBigForm_1 = __importDefault(require("../builders/buildBigForm"));
10
10
  const SpruceError_1 = __importDefault(require("../errors/SpruceError"));
11
11
  const Abstract_vc_1 = __importDefault(require("./Abstract.vc"));
12
+ const defaultPhoneHint = "I'm gonna send you a pin. By entering your number, you agree to receive mobile messages at the phone number provided. Messages frequency varies. Message and data rates may apply.";
12
13
  class LoginCardViewController extends Abstract_vc_1.default {
13
14
  constructor(options) {
14
15
  super(options);
@@ -138,18 +139,26 @@ class LoginCardViewController extends Abstract_vc_1.default {
138
139
  : null;
139
140
  }
140
141
  renderPhoneSection() {
142
+ const hint = this.smsDisclaimer
143
+ ? {
144
+ markdown: this.smsDisclaimer,
145
+ }
146
+ : defaultPhoneHint;
141
147
  const fields = [
142
148
  {
143
149
  name: 'phone',
144
- hint: this.smsDisclaimer ?? loginSchema.fields.phone.hint,
145
150
  },
146
151
  ];
147
152
  if (this.shouldRequireCheckboxForSmsOptIn) {
148
153
  fields.push({
149
154
  name: 'smsOptIn',
150
155
  renderAs: 'checkbox',
156
+ hint,
151
157
  });
152
158
  }
159
+ else {
160
+ fields[0].hint = hint;
161
+ }
153
162
  return {
154
163
  title: this.renderPhoneSlideTitle(),
155
164
  fields,
@@ -288,7 +297,7 @@ const loginSchema = (0, schema_1.buildSchema)({
288
297
  type: 'phone',
289
298
  isRequired: true,
290
299
  label: 'Phone',
291
- hint: "I'm gonna send you a pin. By entering your number, you agree to receive mobile messages at the phone number provided. Messages frequency varies. Message and data rates may apply.",
300
+ hint: defaultPhoneHint,
292
301
  },
293
302
  email: {
294
303
  type: 'email',
@@ -35,7 +35,7 @@ export default class FormViewController<S extends Schema, V extends ViewModel<S>
35
35
  private normalizeValues;
36
36
  private validateDirtyFields;
37
37
  setErrors(errors: TypedFieldError<S>[]): void;
38
- protected setErrorsByField(errorsByField: FormErrorsByField<S>): void;
38
+ setErrorsByField(errorsByField: FormErrorsByField<S>): void;
39
39
  validate(): FormErrorsByField<S>;
40
40
  isValid(): boolean;
41
41
  protected _isValidForFields(visibleFields: SchemaFieldNames<S>[]): boolean;
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "sideEffects": false,
13
13
  "license": "MIT",
14
14
  "description": "All the power of Heartwood in one, convenient package.",
15
- "version": "128.5.1",
15
+ "version": "128.6.0",
16
16
  "skill": {
17
17
  "namespace": "HeartwoodViewControllers",
18
18
  "commandOverrides": {