@drawbridge/components 0.1.16 → 0.1.18

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.
@@ -126,10 +126,10 @@ const FormOtcConfirm = ({
126
126
  values
127
127
  });
128
128
  const onSubmit = (0, import_react.useCallback)(async ({
129
- code
129
+ code: code2
130
130
  }) => {
131
131
  try {
132
- const response = await callback(code);
132
+ const response = await callback(code2);
133
133
  onSuccess(response);
134
134
  } catch (error) {
135
135
  setError(
@@ -141,6 +141,10 @@ const FormOtcConfirm = ({
141
141
  );
142
142
  }
143
143
  }, [callback, onSuccess, setError]);
144
+ const code = (0, import_form.useWatch)({
145
+ control,
146
+ name: "code"
147
+ });
144
148
  const autoSubmitted = (0, import_react.useRef)(false);
145
149
  (0, import_react.useEffect)(() => {
146
150
  if ((values == null ? void 0 : values.code) && !autoSubmitted.current) {
@@ -182,8 +186,6 @@ const FormOtcConfirm = ({
182
186
  ...{
183
187
  autoFocus: true,
184
188
  onChange,
185
- // The sixth digit confirms, as on the missions panel.
186
- onComplete: () => handleSubmit(onSubmit)(),
187
189
  value: value || ""
188
190
  }
189
191
  }
@@ -208,6 +210,7 @@ const FormOtcConfirm = ({
208
210
  import_button.default,
209
211
  {
210
212
  ...{
213
+ disabled: String(code || "").length !== 6,
211
214
  loading: formState == null ? void 0 : formState.isSubmitting,
212
215
  type: "submit"
213
216
  },
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useRef, useState } from "react";
3
3
  import { request } from "@drawbridge/drawbridge-utils/fetch";
4
- import { useForm, Controller } from "../shared/lib/form.mjs";
4
+ import { useForm, useWatch, Controller } from "../shared/lib/form.mjs";
5
5
  import yup, { resolver } from "../shared/lib/yup.mjs";
6
6
  import Form from "../shared/form.mjs";
7
7
  import Fieldset from "../shared/fieldset.mjs";
@@ -93,10 +93,10 @@ const FormOtcConfirm = ({
93
93
  values
94
94
  });
95
95
  const onSubmit = useCallback(async ({
96
- code
96
+ code: code2
97
97
  }) => {
98
98
  try {
99
- const response = await callback(code);
99
+ const response = await callback(code2);
100
100
  onSuccess(response);
101
101
  } catch (error) {
102
102
  setError(
@@ -108,6 +108,10 @@ const FormOtcConfirm = ({
108
108
  );
109
109
  }
110
110
  }, [callback, onSuccess, setError]);
111
+ const code = useWatch({
112
+ control,
113
+ name: "code"
114
+ });
111
115
  const autoSubmitted = useRef(false);
112
116
  useEffect(() => {
113
117
  if ((values == null ? void 0 : values.code) && !autoSubmitted.current) {
@@ -149,8 +153,6 @@ const FormOtcConfirm = ({
149
153
  ...{
150
154
  autoFocus: true,
151
155
  onChange,
152
- // The sixth digit confirms, as on the missions panel.
153
- onComplete: () => handleSubmit(onSubmit)(),
154
156
  value: value || ""
155
157
  }
156
158
  }
@@ -175,6 +177,7 @@ const FormOtcConfirm = ({
175
177
  Button,
176
178
  {
177
179
  ...{
180
+ disabled: String(code || "").length !== 6,
178
181
  loading: formState == null ? void 0 : formState.isSubmitting,
179
182
  type: "submit"
180
183
  },
@@ -31,7 +31,9 @@ __export(input_editor_exports, {
31
31
  EditorView: () => EditorView,
32
32
  Variable: () => Variable,
33
33
  default: () => input_editor_default,
34
- linkText: () => linkText
34
+ linkText: () => linkText,
35
+ plainContent: () => plainContent,
36
+ plainLine: () => plainLine
35
37
  });
36
38
  module.exports = __toCommonJS(input_editor_exports);
37
39
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -41,6 +43,7 @@ var import_menus = require("@tiptap/react/menus");
41
43
  var import_state = require("@tiptap/pm/state");
42
44
  var import_core = require("@tiptap/core");
43
45
  var import_starter_kit = __toESM(require("@tiptap/starter-kit"));
46
+ var import_html = require("@drawbridge/drawbridge-utils/html");
44
47
  var import_dropdown = __toESM(require("./dropdown"));
45
48
  var import_bold = __toESM(require("../icons/bold"));
46
49
  var import_italic = __toESM(require("../icons/italic"));
@@ -92,6 +95,33 @@ const extensions = [
92
95
  Variable
93
96
  ];
94
97
  const contentClass = "focus:outline-hidden [&_a]:underline";
98
+ const plainExtensions = [
99
+ import_starter_kit.default.configure({
100
+ blockquote: false,
101
+ bold: false,
102
+ bulletList: false,
103
+ code: false,
104
+ codeBlock: false,
105
+ heading: false,
106
+ horizontalRule: false,
107
+ italic: false,
108
+ link: false,
109
+ listItem: false,
110
+ orderedList: false,
111
+ strike: false,
112
+ underline: false
113
+ }),
114
+ Variable
115
+ ];
116
+ const plainOptions = {
117
+ blockSeparator: "\n"
118
+ };
119
+ const plainLine = (line, variables) => (0, import_html.escapeHtml)(line).replace(/\{\{(\w+)\}\}/g, (_, key) => {
120
+ var _a;
121
+ const label = ((_a = variables == null ? void 0 : variables.find((item) => item.key === key)) == null ? void 0 : _a.label) || key;
122
+ return '<span data-variable="' + key + '" key="' + key + '" label="' + (0, import_html.escapeHtml)(label) + '"></span>';
123
+ });
124
+ const plainContent = (value, variables) => String(value || "").split("\n").map((line) => "<p>" + plainLine(line, variables) + "</p>").join("");
95
125
  const EditorView = ({ value }) => {
96
126
  const editor = (0, import_react2.useEditor)({
97
127
  content: value || "",
@@ -115,7 +145,9 @@ const EditorView = ({ value }) => {
115
145
  };
116
146
  const InputEditor = ({
117
147
  disabled,
148
+ locked,
118
149
  onChange,
150
+ plain,
119
151
  value,
120
152
  variables
121
153
  }) => {
@@ -124,8 +156,8 @@ const InputEditor = ({
124
156
  const linkInput = (0, import_react.useRef)(null);
125
157
  const [draft, setDraft] = (0, import_react.useState)(null);
126
158
  const editor = (0, import_react2.useEditor)({
127
- extensions,
128
- content: value || "",
159
+ extensions: plain ? plainExtensions : extensions,
160
+ content: plain ? plainContent(value, variables) : value || "",
129
161
  editable: !disabled,
130
162
  editorProps: {
131
163
  attributes: {
@@ -134,7 +166,7 @@ const InputEditor = ({
134
166
  },
135
167
  immediatelyRender: false,
136
168
  onUpdate: ({ editor: editor2 }) => {
137
- onChange == null ? void 0 : onChange({ html: editor2.getHTML(), text: editor2.getText({ textSerializers: { text: linkText } }) });
169
+ onChange == null ? void 0 : onChange({ html: editor2.getHTML(), text: editor2.getText(plain ? plainOptions : { textSerializers: { text: linkText } }) });
138
170
  forceUpdate((n) => n + 1);
139
171
  },
140
172
  onSelectionUpdate: () => {
@@ -192,11 +224,11 @@ const InputEditor = ({
192
224
  (0, import_react.useEffect)(
193
225
  () => {
194
226
  if (!editor) return;
195
- if (value !== editor.getHTML()) {
196
- editor.commands.setContent(value || "", { emitUpdate: false });
227
+ if (plain ? (value || "") !== editor.getText(plainOptions) : value !== editor.getHTML()) {
228
+ editor.commands.setContent(plain ? plainContent(value, variables) : value || "", { emitUpdate: false });
197
229
  }
198
230
  },
199
- [editor, value]
231
+ [editor, plain, value]
200
232
  );
201
233
  const tool = "flex items-center justify-center w-6 h-6 rounded hover:bg-gray";
202
234
  const active = "bg-green-dark hover:bg-green-dark";
@@ -210,14 +242,14 @@ const InputEditor = ({
210
242
  className: ["w-full border border-inherit rounded overflow-hidden", disabled ? "disabled" : ""].join(" ").trim()
211
243
  },
212
244
  children: [
213
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
245
+ (!plain || (variables == null ? void 0 : variables.length) > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
214
246
  "div",
215
247
  {
216
248
  ...{
217
- className: "flex items-center justify-between p-1 bg-gray-light"
249
+ className: ["flex items-center p-1 bg-gray-light", plain ? "justify-end" : "justify-between"].join(" ")
218
250
  },
219
251
  children: [
220
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
252
+ !plain && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
221
253
  "div",
222
254
  {
223
255
  ...{
@@ -388,7 +420,17 @@ const InputEditor = ({
388
420
  }
389
421
  }
390
422
  ),
391
- editor && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
423
+ locked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
424
+ "div",
425
+ {
426
+ ...{
427
+ className: "px-3 pb-2 select-none",
428
+ contentEditable: false
429
+ },
430
+ children: locked
431
+ }
432
+ ),
433
+ editor && !plain && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
392
434
  import_menus.BubbleMenu,
393
435
  {
394
436
  ...{
@@ -472,5 +514,7 @@ var input_editor_default = InputEditor;
472
514
  0 && (module.exports = {
473
515
  EditorView,
474
516
  Variable,
475
- linkText
517
+ linkText,
518
+ plainContent,
519
+ plainLine
476
520
  });
@@ -6,6 +6,7 @@ import { BubbleMenu } from "@tiptap/react/menus";
6
6
  import { TextSelection } from "@tiptap/pm/state";
7
7
  import { Node, mergeAttributes } from "@tiptap/core";
8
8
  import StarterKit from "@tiptap/starter-kit";
9
+ import { escapeHtml } from "@drawbridge/drawbridge-utils/html";
9
10
  const Variable = Node.create({
10
11
  name: "variable",
11
12
  group: "inline",
@@ -57,6 +58,33 @@ const extensions = [
57
58
  Variable
58
59
  ];
59
60
  const contentClass = "focus:outline-hidden [&_a]:underline";
61
+ const plainExtensions = [
62
+ StarterKit.configure({
63
+ blockquote: false,
64
+ bold: false,
65
+ bulletList: false,
66
+ code: false,
67
+ codeBlock: false,
68
+ heading: false,
69
+ horizontalRule: false,
70
+ italic: false,
71
+ link: false,
72
+ listItem: false,
73
+ orderedList: false,
74
+ strike: false,
75
+ underline: false
76
+ }),
77
+ Variable
78
+ ];
79
+ const plainOptions = {
80
+ blockSeparator: "\n"
81
+ };
82
+ const plainLine = (line, variables) => escapeHtml(line).replace(/\{\{(\w+)\}\}/g, (_, key) => {
83
+ var _a;
84
+ const label = ((_a = variables == null ? void 0 : variables.find((item) => item.key === key)) == null ? void 0 : _a.label) || key;
85
+ return '<span data-variable="' + key + '" key="' + key + '" label="' + escapeHtml(label) + '"></span>';
86
+ });
87
+ const plainContent = (value, variables) => String(value || "").split("\n").map((line) => "<p>" + plainLine(line, variables) + "</p>").join("");
60
88
  const EditorView = ({ value }) => {
61
89
  const editor = useEditor({
62
90
  content: value || "",
@@ -80,7 +108,9 @@ const EditorView = ({ value }) => {
80
108
  };
81
109
  const InputEditor = ({
82
110
  disabled,
111
+ locked,
83
112
  onChange,
113
+ plain,
84
114
  value,
85
115
  variables
86
116
  }) => {
@@ -89,8 +119,8 @@ const InputEditor = ({
89
119
  const linkInput = useRef(null);
90
120
  const [draft, setDraft] = useState(null);
91
121
  const editor = useEditor({
92
- extensions,
93
- content: value || "",
122
+ extensions: plain ? plainExtensions : extensions,
123
+ content: plain ? plainContent(value, variables) : value || "",
94
124
  editable: !disabled,
95
125
  editorProps: {
96
126
  attributes: {
@@ -99,7 +129,7 @@ const InputEditor = ({
99
129
  },
100
130
  immediatelyRender: false,
101
131
  onUpdate: ({ editor: editor2 }) => {
102
- onChange == null ? void 0 : onChange({ html: editor2.getHTML(), text: editor2.getText({ textSerializers: { text: linkText } }) });
132
+ onChange == null ? void 0 : onChange({ html: editor2.getHTML(), text: editor2.getText(plain ? plainOptions : { textSerializers: { text: linkText } }) });
103
133
  forceUpdate((n) => n + 1);
104
134
  },
105
135
  onSelectionUpdate: () => {
@@ -157,11 +187,11 @@ const InputEditor = ({
157
187
  useEffect(
158
188
  () => {
159
189
  if (!editor) return;
160
- if (value !== editor.getHTML()) {
161
- editor.commands.setContent(value || "", { emitUpdate: false });
190
+ if (plain ? (value || "") !== editor.getText(plainOptions) : value !== editor.getHTML()) {
191
+ editor.commands.setContent(plain ? plainContent(value, variables) : value || "", { emitUpdate: false });
162
192
  }
163
193
  },
164
- [editor, value]
194
+ [editor, plain, value]
165
195
  );
166
196
  const tool = "flex items-center justify-center w-6 h-6 rounded hover:bg-gray";
167
197
  const active = "bg-green-dark hover:bg-green-dark";
@@ -175,14 +205,14 @@ const InputEditor = ({
175
205
  className: ["w-full border border-inherit rounded overflow-hidden", disabled ? "disabled" : ""].join(" ").trim()
176
206
  },
177
207
  children: [
178
- /* @__PURE__ */ jsxs(
208
+ (!plain || (variables == null ? void 0 : variables.length) > 0) && /* @__PURE__ */ jsxs(
179
209
  "div",
180
210
  {
181
211
  ...{
182
- className: "flex items-center justify-between p-1 bg-gray-light"
212
+ className: ["flex items-center p-1 bg-gray-light", plain ? "justify-end" : "justify-between"].join(" ")
183
213
  },
184
214
  children: [
185
- /* @__PURE__ */ jsxs(
215
+ !plain && /* @__PURE__ */ jsxs(
186
216
  "div",
187
217
  {
188
218
  ...{
@@ -353,7 +383,17 @@ const InputEditor = ({
353
383
  }
354
384
  }
355
385
  ),
356
- editor && /* @__PURE__ */ jsxs(
386
+ locked && /* @__PURE__ */ jsx(
387
+ "div",
388
+ {
389
+ ...{
390
+ className: "px-3 pb-2 select-none",
391
+ contentEditable: false
392
+ },
393
+ children: locked
394
+ }
395
+ ),
396
+ editor && !plain && /* @__PURE__ */ jsxs(
357
397
  BubbleMenu,
358
398
  {
359
399
  ...{
@@ -437,5 +477,7 @@ export {
437
477
  EditorView,
438
478
  Variable,
439
479
  input_editor_default as default,
440
- linkText
480
+ linkText,
481
+ plainContent,
482
+ plainLine
441
483
  };
@@ -62,9 +62,9 @@ const useConfirm = () => {
62
62
  const { onError } = (0, import_hooks.useCallbacks)({
63
63
  queryClient
64
64
  });
65
- return ({ action, body, endpoint, message, method = "PUT", onSuccess, task }) => modal.open({
65
+ return ({ action, body, endpoint, message, method = "PUT", onSuccess, task, warning }) => modal.open({
66
66
  title: action,
67
- message: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
+ message: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
68
68
  import_form_action.default,
69
69
  {
70
70
  ...{
@@ -78,15 +78,26 @@ const useConfirm = () => {
78
78
  onError,
79
79
  onSuccess
80
80
  },
81
- children: task ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
- import_card_task.default,
83
- {
84
- ...{
85
- message: task,
86
- type: "warning"
81
+ children: [
82
+ task ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
+ import_card_task.default,
84
+ {
85
+ ...{
86
+ message: task,
87
+ type: "warning"
88
+ }
89
+ }
90
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: message }),
91
+ !task && warning && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
+ import_card_task.default,
93
+ {
94
+ ...{
95
+ message: warning,
96
+ type: "warning"
97
+ }
87
98
  }
88
- }
89
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: message })
99
+ )
100
+ ]
90
101
  }
91
102
  )
92
103
  });
@@ -110,7 +121,7 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
110
121
  const fulfill = () => confirm({
111
122
  action: "Mark as fulfilled",
112
123
  endpoint: endpoint + "/fulfillment",
113
- message: "The order is marked Fulfilled. The customer is not emailed.",
124
+ message: "Mark this order as fulfilled?",
114
125
  method: "POST",
115
126
  onSuccess
116
127
  });
@@ -120,7 +131,7 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
120
131
  status: "canceled"
121
132
  },
122
133
  endpoint: endpoint + "/fulfillment/" + item.id,
123
- message: "The order goes back to Unfulfilled. The customer is not emailed.",
134
+ message: "Cancel this fulfillment?",
124
135
  onSuccess
125
136
  });
126
137
  const cta = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -28,9 +28,9 @@ const useConfirm = () => {
28
28
  const { onError } = useCallbacks({
29
29
  queryClient
30
30
  });
31
- return ({ action, body, endpoint, message, method = "PUT", onSuccess, task }) => modal.open({
31
+ return ({ action, body, endpoint, message, method = "PUT", onSuccess, task, warning }) => modal.open({
32
32
  title: action,
33
- message: /* @__PURE__ */ jsx(
33
+ message: /* @__PURE__ */ jsxs(
34
34
  FormAction,
35
35
  {
36
36
  ...{
@@ -44,15 +44,26 @@ const useConfirm = () => {
44
44
  onError,
45
45
  onSuccess
46
46
  },
47
- children: task ? /* @__PURE__ */ jsx(
48
- CardTask,
49
- {
50
- ...{
51
- message: task,
52
- type: "warning"
47
+ children: [
48
+ task ? /* @__PURE__ */ jsx(
49
+ CardTask,
50
+ {
51
+ ...{
52
+ message: task,
53
+ type: "warning"
54
+ }
55
+ }
56
+ ) : /* @__PURE__ */ jsx("p", { children: message }),
57
+ !task && warning && /* @__PURE__ */ jsx(
58
+ CardTask,
59
+ {
60
+ ...{
61
+ message: warning,
62
+ type: "warning"
63
+ }
53
64
  }
54
- }
55
- ) : /* @__PURE__ */ jsx("p", { children: message })
65
+ )
66
+ ]
56
67
  }
57
68
  )
58
69
  });
@@ -76,7 +87,7 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
76
87
  const fulfill = () => confirm({
77
88
  action: "Mark as fulfilled",
78
89
  endpoint: endpoint + "/fulfillment",
79
- message: "The order is marked Fulfilled. The customer is not emailed.",
90
+ message: "Mark this order as fulfilled?",
80
91
  method: "POST",
81
92
  onSuccess
82
93
  });
@@ -86,7 +97,7 @@ const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
86
97
  status: "canceled"
87
98
  },
88
99
  endpoint: endpoint + "/fulfillment/" + item.id,
89
- message: "The order goes back to Unfulfilled. The customer is not emailed.",
100
+ message: "Cancel this fulfillment?",
90
101
  onSuccess
91
102
  });
92
103
  const cta = /* @__PURE__ */ jsx(
@@ -54,6 +54,10 @@ const NOTIFY_LABELS = {
54
54
  processing: "Sending",
55
55
  succeeded: "Email sent"
56
56
  };
57
+ const PART_LABELS = {
58
+ email: "the email of Auto response",
59
+ sms: "the text of Auto response"
60
+ };
57
61
  const indicatorType = (status) => {
58
62
  if (status === "succeeded") return "active";
59
63
  if (status === "failed") return "error";
@@ -233,6 +237,7 @@ const groupTitle = ({ count, email, items, kind, pending }, labels = []) => {
233
237
  };
234
238
  const rowLabel = ({ item, kind, labels = [] }) => {
235
239
  var _a;
240
+ if (kind !== "notify" && PART_LABELS[item == null ? void 0 : item.part]) return PART_LABELS[item.part];
236
241
  if (kind !== "notify") return ((_a = labels.find((option) => option.value === (item == null ? void 0 : item.slug))) == null ? void 0 : _a.key) || (item == null ? void 0 : item.slug);
237
242
  return NOTIFY_LABELS[item == null ? void 0 : item.status] || NOTIFY_LABELS.succeeded;
238
243
  };
@@ -18,6 +18,10 @@ const NOTIFY_LABELS = {
18
18
  processing: "Sending",
19
19
  succeeded: "Email sent"
20
20
  };
21
+ const PART_LABELS = {
22
+ email: "the email of Auto response",
23
+ sms: "the text of Auto response"
24
+ };
21
25
  const indicatorType = (status) => {
22
26
  if (status === "succeeded") return "active";
23
27
  if (status === "failed") return "error";
@@ -197,6 +201,7 @@ const groupTitle = ({ count, email, items, kind, pending }, labels = []) => {
197
201
  };
198
202
  const rowLabel = ({ item, kind, labels = [] }) => {
199
203
  var _a;
204
+ if (kind !== "notify" && PART_LABELS[item == null ? void 0 : item.part]) return PART_LABELS[item.part];
200
205
  if (kind !== "notify") return ((_a = labels.find((option) => option.value === (item == null ? void 0 : item.slug))) == null ? void 0 : _a.key) || (item == null ? void 0 : item.slug);
201
206
  return NOTIFY_LABELS[item == null ? void 0 : item.status] || NOTIFY_LABELS.succeeded;
202
207
  };
@@ -320,6 +320,12 @@ const TemplateSocketOrganization = ({
320
320
  queryClient.invalidateQueries({
321
321
  queryKey: ["organization-campaign-missions"]
322
322
  });
323
+ queryClient.invalidateQueries({
324
+ queryKey: ["organization-workflows", params.organization]
325
+ });
326
+ queryClient.invalidateQueries({
327
+ queryKey: ["organization-workflow", params.organization]
328
+ });
323
329
  },
324
330
  "organization.connections": () => {
325
331
  queryClient.invalidateQueries({
@@ -285,6 +285,12 @@ const TemplateSocketOrganization = ({
285
285
  queryClient.invalidateQueries({
286
286
  queryKey: ["organization-campaign-missions"]
287
287
  });
288
+ queryClient.invalidateQueries({
289
+ queryKey: ["organization-workflows", params.organization]
290
+ });
291
+ queryClient.invalidateQueries({
292
+ queryKey: ["organization-workflow", params.organization]
293
+ });
288
294
  },
289
295
  "organization.connections": () => {
290
296
  queryClient.invalidateQueries({
@@ -42,11 +42,9 @@ const InputCode = ({
42
42
  length = 6,
43
43
  name,
44
44
  onChange,
45
- onComplete,
46
45
  style,
47
46
  value
48
47
  }) => {
49
- const digits = codeDigits(value, length);
50
48
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
51
49
  import_input_text.default,
52
50
  {
@@ -63,15 +61,11 @@ const InputCode = ({
63
61
  inputMode: "numeric",
64
62
  maxLength: length,
65
63
  name,
66
- onChange: (text) => {
67
- const next = codeDigits(text, length);
68
- onChange == null ? void 0 : onChange(next);
69
- if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
70
- },
64
+ onChange: (text) => onChange == null ? void 0 : onChange(codeDigits(text, length)),
71
65
  pattern: "[0-9]*",
72
66
  style,
73
67
  type: "text",
74
- value: digits
68
+ value: codeDigits(value, length)
75
69
  }
76
70
  }
77
71
  );
@@ -9,11 +9,9 @@ const InputCode = ({
9
9
  length = 6,
10
10
  name,
11
11
  onChange,
12
- onComplete,
13
12
  style,
14
13
  value
15
14
  }) => {
16
- const digits = codeDigits(value, length);
17
15
  return /* @__PURE__ */ jsx(
18
16
  InputText,
19
17
  {
@@ -30,15 +28,11 @@ const InputCode = ({
30
28
  inputMode: "numeric",
31
29
  maxLength: length,
32
30
  name,
33
- onChange: (text) => {
34
- const next = codeDigits(text, length);
35
- onChange == null ? void 0 : onChange(next);
36
- if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
37
- },
31
+ onChange: (text) => onChange == null ? void 0 : onChange(codeDigits(text, length)),
38
32
  pattern: "[0-9]*",
39
33
  style,
40
34
  type: "text",
41
- value: digits
35
+ value: codeDigits(value, length)
42
36
  }
43
37
  }
44
38
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",
@@ -1663,7 +1663,7 @@
1663
1663
  "peerDependencies": {
1664
1664
  "@analytics/google-tag-manager": ">=0.5.5",
1665
1665
  "@drawbridge/drawbridge-telemetry": ">=0.0.19",
1666
- "@drawbridge/drawbridge-utils": ">=0.0.228",
1666
+ "@drawbridge/drawbridge-utils": ">=0.0.230",
1667
1667
  "@headlessui/react": ">=2.1.2",
1668
1668
  "@hookform/resolvers": ">=3.1.1",
1669
1669
  "@sentry/nextjs": ">=10.58.0",
@@ -1783,7 +1783,7 @@
1783
1783
  "@analytics/google-tag-manager": "0.5.5",
1784
1784
  "@drawbridge/drawbridge-agents": "0.1.102",
1785
1785
  "@drawbridge/drawbridge-telemetry": "0.0.19",
1786
- "@drawbridge/drawbridge-utils": "0.0.227",
1786
+ "@drawbridge/drawbridge-utils": "0.0.230",
1787
1787
  "@headlessui/react": "2.2.9",
1788
1788
  "@hookform/resolvers": "3.1.1",
1789
1789
  "@sentry/nextjs": "10.58.0",
@@ -14,7 +14,7 @@ export interface FormSubdomainMissionsProps {
14
14
  advertisements?: ReactNode;
15
15
  button?: ReactNode;
16
16
  contact?: { email?: string | null; phone?: string | null };
17
- // The mission a lead link's `&mission=` opens at.
17
+ // The mission a lead link's `&open=` opens at.
18
18
  initial?: string | null;
19
19
  message?: ReactNode;
20
20
  missions?: MissionItem[];