@sprucelabs/heartwood-view-controllers 128.5.2 → 128.6.1

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.
@@ -481,13 +481,16 @@ export interface InputComponent {
481
481
  type: string;
482
482
  }
483
483
  export type RatingsInputComponentIcon = NonNullable<RatingsInputComponent['icon']>;
484
+ export type FieldHint = string | null | {
485
+ markdown?: string;
486
+ };
484
487
  export interface FieldRenderOptions<S extends Schema> {
485
488
  name: SchemaFieldNames<S>;
486
489
  renderAs?: RenderAsInputComponent;
487
490
  renderHintAs?: 'subtitle' | 'tooltip';
488
491
  placeholder?: string | null;
489
492
  label?: string | null;
490
- hint?: string | null;
493
+ hint?: FieldHint;
491
494
  vc?: FormInputViewController;
492
495
  fieldDefinition?: FieldDefinitions;
493
496
  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',
@@ -481,13 +481,16 @@ export interface InputComponent {
481
481
  type: string;
482
482
  }
483
483
  export type RatingsInputComponentIcon = NonNullable<RatingsInputComponent['icon']>;
484
+ export type FieldHint = string | null | {
485
+ markdown?: string;
486
+ };
484
487
  export interface FieldRenderOptions<S extends Schema> {
485
488
  name: SchemaFieldNames<S>;
486
489
  renderAs?: RenderAsInputComponent;
487
490
  renderHintAs?: 'subtitle' | 'tooltip';
488
491
  placeholder?: string | null;
489
492
  label?: string | null;
490
- hint?: string | null;
493
+ hint?: FieldHint;
491
494
  vc?: FormInputViewController;
492
495
  fieldDefinition?: FieldDefinitions;
493
496
  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',
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.2",
15
+ "version": "128.6.1",
16
16
  "skill": {
17
17
  "namespace": "HeartwoodViewControllers",
18
18
  "commandOverrides": {