@salutejs/plasma-new-hope 0.336.0-canary.2208.17465207747.0 → 0.336.0-canary.2210.17488241312.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.
- package/cjs/components/CodeField/CodeField.css +7 -6
- package/cjs/components/CodeField/CodeField.js +60 -24
- package/cjs/components/CodeField/CodeField.js.map +1 -1
- package/cjs/components/CodeField/CodeField.styles.js +7 -1
- package/cjs/components/CodeField/CodeField.styles.js.map +1 -1
- package/cjs/components/CodeField/{CodeField.styles_ebdpd0.css → CodeField.styles_14p25hi.css} +1 -0
- package/cjs/components/CodeField/hooks/useWebOTP.js +107 -0
- package/cjs/components/CodeField/hooks/useWebOTP.js.map +1 -0
- package/cjs/components/CodeField/utils/handleCodeError.js +2 -2
- package/cjs/components/CodeField/utils/handleCodeError.js.map +1 -1
- package/cjs/components/CodeField/utils/handleItemError.js +14 -4
- package/cjs/components/CodeField/utils/handleItemError.js.map +1 -1
- package/cjs/components/CodeField/utils/isWebOTPSupported.js +10 -0
- package/cjs/components/CodeField/utils/isWebOTPSupported.js.map +1 -0
- package/cjs/components/Drawer/hooks/useDrawer.js +0 -12
- package/cjs/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/cjs/index.css +7 -6
- package/emotion/cjs/components/CodeField/CodeField.js +50 -20
- package/emotion/cjs/components/CodeField/CodeField.styles.js +18 -11
- package/emotion/cjs/components/CodeField/hooks/useWebOTP.js +256 -0
- package/emotion/cjs/components/CodeField/utils/handleCodeError.js +2 -2
- package/emotion/cjs/components/CodeField/utils/handleItemError.js +12 -3
- package/emotion/cjs/components/CodeField/utils/index.js +4 -0
- package/emotion/cjs/components/CodeField/utils/isWebOTPSupported.js +13 -0
- package/emotion/cjs/components/Drawer/hooks/useDrawer.js +0 -11
- package/emotion/es/components/CodeField/CodeField.js +52 -22
- package/emotion/es/components/CodeField/CodeField.styles.js +15 -11
- package/emotion/es/components/CodeField/hooks/useWebOTP.js +246 -0
- package/emotion/es/components/CodeField/utils/handleCodeError.js +2 -2
- package/emotion/es/components/CodeField/utils/handleItemError.js +12 -3
- package/emotion/es/components/CodeField/utils/index.js +1 -0
- package/emotion/es/components/CodeField/utils/isWebOTPSupported.js +3 -0
- package/emotion/es/components/Drawer/hooks/useDrawer.js +0 -11
- package/es/components/CodeField/CodeField.css +7 -6
- package/es/components/CodeField/CodeField.js +62 -26
- package/es/components/CodeField/CodeField.js.map +1 -1
- package/es/components/CodeField/CodeField.styles.js +7 -2
- package/es/components/CodeField/CodeField.styles.js.map +1 -1
- package/es/components/CodeField/{CodeField.styles_ebdpd0.css → CodeField.styles_14p25hi.css} +1 -0
- package/es/components/CodeField/hooks/useWebOTP.js +103 -0
- package/es/components/CodeField/hooks/useWebOTP.js.map +1 -0
- package/es/components/CodeField/utils/handleCodeError.js +2 -2
- package/es/components/CodeField/utils/handleCodeError.js.map +1 -1
- package/es/components/CodeField/utils/handleItemError.js +14 -4
- package/es/components/CodeField/utils/handleItemError.js.map +1 -1
- package/es/components/CodeField/utils/isWebOTPSupported.js +6 -0
- package/es/components/CodeField/utils/isWebOTPSupported.js.map +1 -0
- package/es/components/Drawer/hooks/useDrawer.js +0 -12
- package/es/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/es/index.css +7 -6
- package/package.json +2 -2
- package/styled-components/cjs/components/CodeField/CodeField.js +50 -20
- package/styled-components/cjs/components/CodeField/CodeField.styles.js +14 -5
- package/styled-components/cjs/components/CodeField/hooks/useWebOTP.js +256 -0
- package/styled-components/cjs/components/CodeField/utils/handleCodeError.js +2 -2
- package/styled-components/cjs/components/CodeField/utils/handleItemError.js +12 -3
- package/styled-components/cjs/components/CodeField/utils/index.js +4 -0
- package/styled-components/cjs/components/CodeField/utils/isWebOTPSupported.js +13 -0
- package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +0 -11
- package/styled-components/es/components/CodeField/CodeField.js +52 -22
- package/styled-components/es/components/CodeField/CodeField.styles.js +11 -5
- package/styled-components/es/components/CodeField/hooks/useWebOTP.js +246 -0
- package/styled-components/es/components/CodeField/utils/handleCodeError.js +2 -2
- package/styled-components/es/components/CodeField/utils/handleItemError.js +12 -3
- package/styled-components/es/components/CodeField/utils/index.js +1 -0
- package/styled-components/es/components/CodeField/utils/isWebOTPSupported.js +3 -0
- package/styled-components/es/components/Drawer/hooks/useDrawer.js +0 -11
- package/types/components/CodeField/CodeField.d.ts.map +1 -1
- package/types/components/CodeField/CodeField.styles.d.ts +1 -0
- package/types/components/CodeField/CodeField.styles.d.ts.map +1 -1
- package/types/components/CodeField/hooks/useWebOTP.d.ts +24 -0
- package/types/components/CodeField/hooks/useWebOTP.d.ts.map +1 -0
- package/types/components/CodeField/utils/handleCodeError.d.ts +2 -2
- package/types/components/CodeField/utils/handleCodeError.d.ts.map +1 -1
- package/types/components/CodeField/utils/handleItemError.d.ts +3 -2
- package/types/components/CodeField/utils/handleItemError.d.ts.map +1 -1
- package/types/components/CodeField/utils/index.d.ts +1 -0
- package/types/components/CodeField/utils/index.d.ts.map +1 -1
- package/types/components/CodeField/utils/isWebOTPSupported.d.ts +2 -0
- package/types/components/CodeField/utils/isWebOTPSupported.d.ts.map +1 -0
- package/types/components/Drawer/hooks/useDrawer.d.ts.map +1 -1
@@ -117,13 +117,14 @@ import { useDidMountEffect } from "../../hooks";
|
|
117
117
|
import { getSizeValueFromProp } from "../../utils";
|
118
118
|
import { useCodeHook } from "../../hooks";
|
119
119
|
import { BACKSPACE_KEY, FORBIDDEN_KEYS, ONLY_DIGITS_PATTERN } from "./utils/constants";
|
120
|
-
import { getCodeValue, getFieldPattern, getPlaceholderValue, handleCodeError, handleItemError } from "./utils";
|
120
|
+
import { getCodeValue, getFieldPattern, getPlaceholderValue, handleCodeError, handleItemError, isWebOTPSupported } from "./utils";
|
121
121
|
import { classes } from "./CodeField.tokens";
|
122
|
-
import { base, CaptionWrapper, CodeGroup, CodeWrapper, ItemInput, Separator } from "./CodeField.styles";
|
122
|
+
import { base, CaptionWrapper, CodeGroup, CodeWrapper, HiddenInput, ItemInput, Separator } from "./CodeField.styles";
|
123
123
|
import { base as viewCSS } from "./variations/_view/base";
|
124
124
|
import { base as sizeCSS } from "./variations/_size/base";
|
125
125
|
import { base as shapeCSS } from "./variations/_shape/base";
|
126
126
|
import { base as disabledCSS } from "./variations/_disabled/base";
|
127
|
+
import { useWebOTP } from "./hooks/useWebOTP";
|
127
128
|
export var codeFieldRoot = function(Root) {
|
128
129
|
return /*#__PURE__*/ forwardRef(function(_param, ref) {
|
129
130
|
var className = _param.className, outerValue = _param.value, placeholder = _param.placeholder, autoFocus = _param.autoFocus, _param_codeLength = _param.codeLength, codeLength = _param_codeLength === void 0 ? 6 : _param_codeLength, caption = _param.caption, _param_captionAlign = _param.captionAlign, captionAlign = _param_captionAlign === void 0 ? 'left' : _param_captionAlign, width = _param.width, _param_shape = _param.shape, shape = _param_shape === void 0 ? 'default' : _param_shape, view = _param.view, size = _param.size, disabled = _param.disabled, isError = _param.isError, _param_allowedSymbols = _param.allowedSymbols, allowedSymbols = _param_allowedSymbols === void 0 ? ONLY_DIGITS_PATTERN : _param_allowedSymbols, _param_itemErrorBehavior = _param.itemErrorBehavior, itemErrorBehavior = _param_itemErrorBehavior === void 0 ? 'remove-symbol' : _param_itemErrorBehavior, _param_codeErrorBehavior = _param.codeErrorBehavior, codeErrorBehavior = _param_codeErrorBehavior === void 0 ? 'remove-code' : _param_codeErrorBehavior, _param_autoComplete = _param.autoComplete, autoComplete = _param_autoComplete === void 0 ? 'one-time-code' : _param_autoComplete, setIsError = _param.setIsError, onChange = _param.onChange, onFullCodeEnter = _param.onFullCodeEnter, rest = _object_without_properties(_param, [
|
@@ -148,8 +149,10 @@ export var codeFieldRoot = function(Root) {
|
|
148
149
|
"onChange",
|
149
150
|
"onFullCodeEnter"
|
150
151
|
]);
|
151
|
-
var _useState = _sliced_to_array(useState(getCodeValue(codeLength,
|
152
|
+
var _useState = _sliced_to_array(useState(getCodeValue(codeLength, '')), 2), innerValue = _useState[0], setInnerValue = _useState[1];
|
153
|
+
var code = (outerValue === null || outerValue === void 0 ? void 0 : outerValue.length) ? getCodeValue(codeLength, outerValue) : innerValue;
|
152
154
|
var _useState1 = _sliced_to_array(useState(code.join('')), 2), originalValue = _useState1[0], setOriginalValue = _useState1[1];
|
155
|
+
var _useState2 = _sliced_to_array(useState(null), 2), otpVal = _useState2[0], setOtpVal = _useState2[1];
|
153
156
|
var inputRefs = useRef([]);
|
154
157
|
var inputContainerRef = useRef(null);
|
155
158
|
var captionRef = useRef(null);
|
@@ -157,6 +160,7 @@ export var codeFieldRoot = function(Root) {
|
|
157
160
|
var placeholderValue = getPlaceholderValue(codeLength, placeholder);
|
158
161
|
var parts = codeLength === 6 ? 2 : 1;
|
159
162
|
var widthValue = width ? getSizeValueFromProp(width, 'rem') : undefined;
|
163
|
+
var isWebOTPEnabled = autoComplete === 'one-time-code' && !disabled && !isWebOTPSupported();
|
160
164
|
var getLastActiveIndex = function() {
|
161
165
|
if (code.length && code.length < codeLength) {
|
162
166
|
return code.length;
|
@@ -166,6 +170,26 @@ export var codeFieldRoot = function(Root) {
|
|
166
170
|
});
|
167
171
|
return lastEmptyIndex >= 0 ? lastEmptyIndex : codeLength - 1;
|
168
172
|
};
|
173
|
+
var codeSetter = function(newCode) {
|
174
|
+
setInnerValue(newCode);
|
175
|
+
var originalCode = newCode.join('');
|
176
|
+
setOriginalValue(originalCode);
|
177
|
+
if (onChange) {
|
178
|
+
onChange(originalCode);
|
179
|
+
}
|
180
|
+
if (originalCode.length > 0) {
|
181
|
+
stopWebOTPListener();
|
182
|
+
}
|
183
|
+
};
|
184
|
+
var _useWebOTP = useWebOTP({
|
185
|
+
codeString: originalValue,
|
186
|
+
enableSMSAutoRead: autoComplete === 'one-time-code',
|
187
|
+
disabled: Boolean(disabled),
|
188
|
+
codeLength: codeLength,
|
189
|
+
codeSetter: codeSetter,
|
190
|
+
onFullCodeEnter: onFullCodeEnter,
|
191
|
+
setOtpVal: setOtpVal
|
192
|
+
}), startWebOTPListener = _useWebOTP.startWebOTPListener, stopWebOTPListener = _useWebOTP.stopWebOTPListener;
|
169
193
|
var handleClick = function() {
|
170
194
|
if (disabled) {
|
171
195
|
return;
|
@@ -185,19 +209,24 @@ export var codeFieldRoot = function(Root) {
|
|
185
209
|
return;
|
186
210
|
}
|
187
211
|
if (key === BACKSPACE_KEY) {
|
188
|
-
if (index > 0
|
189
|
-
var
|
190
|
-
|
212
|
+
if (index > 0) {
|
213
|
+
var _inputRefs_current_index;
|
214
|
+
var newCode = _to_consumable_array(code);
|
215
|
+
newCode[index] = '';
|
216
|
+
if (index >= codeLength - 1 && code[index]) {
|
217
|
+
codeSetter(newCode);
|
218
|
+
return;
|
219
|
+
}
|
220
|
+
if (!code[index]) {
|
221
|
+
var _inputRefs_current_;
|
222
|
+
newCode[index - 1] = '';
|
223
|
+
(_inputRefs_current_ = inputRefs.current[index - 1]) === null || _inputRefs_current_ === void 0 ? void 0 : _inputRefs_current_.focus();
|
224
|
+
}
|
225
|
+
(_inputRefs_current_index = inputRefs.current[index]) === null || _inputRefs_current_index === void 0 ? void 0 : _inputRefs_current_index.classList.remove(classes.itemError);
|
226
|
+
codeSetter(newCode);
|
191
227
|
}
|
192
228
|
}
|
193
229
|
};
|
194
|
-
var codeSetter = function(newCode) {
|
195
|
-
setCode(newCode);
|
196
|
-
setOriginalValue(newCode.join(''));
|
197
|
-
if (onChange) {
|
198
|
-
onChange(newCode.join(''));
|
199
|
-
}
|
200
|
-
};
|
201
230
|
var handleChange = function(event, index) {
|
202
231
|
var _inputRefs_current_index;
|
203
232
|
if (disabled) {
|
@@ -228,8 +257,6 @@ export var codeFieldRoot = function(Root) {
|
|
228
257
|
return;
|
229
258
|
}
|
230
259
|
if (!symbol) {
|
231
|
-
newCode[index] = '';
|
232
|
-
codeSetter(newCode);
|
233
260
|
return;
|
234
261
|
}
|
235
262
|
if (fieldPattern.test(symbol)) {
|
@@ -247,8 +274,9 @@ export var codeFieldRoot = function(Root) {
|
|
247
274
|
index: index,
|
248
275
|
newCode: newCode,
|
249
276
|
inputRefs: inputRefs,
|
250
|
-
|
251
|
-
codeSetter: codeSetter
|
277
|
+
setInnerValue: setInnerValue,
|
278
|
+
codeSetter: codeSetter,
|
279
|
+
onChange: onChange
|
252
280
|
});
|
253
281
|
}
|
254
282
|
};
|
@@ -275,6 +303,7 @@ export var codeFieldRoot = function(Root) {
|
|
275
303
|
if (onFullCodeEnter) {
|
276
304
|
onFullCodeEnter(fullCode);
|
277
305
|
}
|
306
|
+
startWebOTPListener();
|
278
307
|
}, []);
|
279
308
|
useCodeHook({
|
280
309
|
inputRefs: inputRefs,
|
@@ -294,14 +323,14 @@ export var codeFieldRoot = function(Root) {
|
|
294
323
|
inputRefs: inputRefs,
|
295
324
|
inputContainerRef: inputContainerRef,
|
296
325
|
captionRef: captionRef,
|
297
|
-
|
326
|
+
setInnerValue: setInnerValue,
|
298
327
|
codeSetter: codeSetter
|
299
328
|
});
|
300
329
|
}
|
301
330
|
}, [
|
302
331
|
isError
|
303
332
|
]);
|
304
|
-
return /*#__PURE__*/ React.createElement(Root, _object_spread({
|
333
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Root, _object_spread({
|
305
334
|
ref: ref,
|
306
335
|
view: view,
|
307
336
|
size: size,
|
@@ -309,7 +338,7 @@ export var codeFieldRoot = function(Root) {
|
|
309
338
|
disabled: disabled,
|
310
339
|
onClick: handleClick,
|
311
340
|
className: cls(className, _define_property({}, classes.captionAlignLeft, captionAlign === 'left'))
|
312
|
-
}, rest), /*#__PURE__*/ React.createElement(CodeWrapper, {
|
341
|
+
}, !isWebOTPEnabled && _object_spread({}, rest)), /*#__PURE__*/ React.createElement(CodeWrapper, {
|
313
342
|
ref: inputContainerRef
|
314
343
|
}, _to_consumable_array(Array(parts)).map(function(_, partIndex) {
|
315
344
|
return /*#__PURE__*/ React.createElement(Fragment, {
|
@@ -326,7 +355,6 @@ export var codeFieldRoot = function(Root) {
|
|
326
355
|
},
|
327
356
|
className: cls((_obj = {}, _define_property(_obj, classes.segmented, shape === 'segmented'), _define_property(_obj, classes.hoverEnabled, !disabled && inputCorrectIndex >= originalValue.length), _obj)),
|
328
357
|
value: code[inputCorrectIndex] || '',
|
329
|
-
autoComplete: autoComplete,
|
330
358
|
onChange: function(e) {
|
331
359
|
handleChange(e, inputCorrectIndex);
|
332
360
|
},
|
@@ -343,7 +371,9 @@ export var codeFieldRoot = function(Root) {
|
|
343
371
|
ref: captionRef,
|
344
372
|
captionAlign: captionAlign,
|
345
373
|
widthValue: widthValue
|
346
|
-
}, caption)
|
374
|
+
}, caption), isWebOTPEnabled && /*#__PURE__*/ React.createElement(HiddenInput, _object_spread({
|
375
|
+
tabIndex: -1
|
376
|
+
}, rest))), /*#__PURE__*/ React.createElement("div", null, JSON.stringify(otpVal)));
|
347
377
|
});
|
348
378
|
};
|
349
379
|
export var codeFieldConfig = {
|
@@ -7,32 +7,32 @@ export var base = css([
|
|
7
7
|
], classes.captionAlignLeft);
|
8
8
|
export var CodeWrapper = styled.div.withConfig({
|
9
9
|
displayName: "CodeField.styles__CodeWrapper",
|
10
|
-
componentId: "sc-
|
10
|
+
componentId: "sc-ff3d9c22-0"
|
11
11
|
})([
|
12
12
|
"display:flex;align-items:center;"
|
13
13
|
]);
|
14
14
|
export var CodeGroup = styled.div.withConfig({
|
15
15
|
displayName: "CodeField.styles__CodeGroup",
|
16
|
-
componentId: "sc-
|
16
|
+
componentId: "sc-ff3d9c22-1"
|
17
17
|
})([
|
18
18
|
"display:flex;align-items:center;"
|
19
19
|
]);
|
20
20
|
export var Separator = styled.div.withConfig({
|
21
21
|
displayName: "CodeField.styles__Separator",
|
22
|
-
componentId: "sc-
|
22
|
+
componentId: "sc-ff3d9c22-2"
|
23
23
|
})([
|
24
24
|
"width:var(",
|
25
25
|
");"
|
26
26
|
], tokens.separatorWidth);
|
27
27
|
export var ItemInput = styled.input.withConfig({
|
28
28
|
displayName: "CodeField.styles__ItemInput",
|
29
|
-
componentId: "sc-
|
29
|
+
componentId: "sc-ff3d9c22-3"
|
30
30
|
})([
|
31
31
|
"box-sizing:border-box;appearance:none;border:0;padding:0;outline:none;pointer-events:none;text-align:center;"
|
32
32
|
]);
|
33
33
|
export var CaptionWrapper = styled.div.withConfig({
|
34
34
|
displayName: "CodeField.styles__CaptionWrapper",
|
35
|
-
componentId: "sc-
|
35
|
+
componentId: "sc-ff3d9c22-4"
|
36
36
|
})([
|
37
37
|
"text-align:",
|
38
38
|
";align-self:",
|
@@ -48,3 +48,9 @@ export var CaptionWrapper = styled.div.withConfig({
|
|
48
48
|
var widthValue = param.widthValue;
|
49
49
|
return widthValue || 'auto';
|
50
50
|
});
|
51
|
+
export var HiddenInput = styled.input.withConfig({
|
52
|
+
displayName: "CodeField.styles__HiddenInput",
|
53
|
+
componentId: "sc-ff3d9c22-5"
|
54
|
+
})([
|
55
|
+
"display:none;"
|
56
|
+
]);
|
@@ -0,0 +1,246 @@
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
2
|
+
try {
|
3
|
+
var info = gen[key](arg);
|
4
|
+
var value = info.value;
|
5
|
+
} catch (error) {
|
6
|
+
reject(error);
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
if (info.done) {
|
10
|
+
resolve(value);
|
11
|
+
} else {
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
function _async_to_generator(fn) {
|
16
|
+
return function() {
|
17
|
+
var self = this, args = arguments;
|
18
|
+
return new Promise(function(resolve, reject) {
|
19
|
+
var gen = fn.apply(self, args);
|
20
|
+
function _next(value) {
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
22
|
+
}
|
23
|
+
function _throw(err) {
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
25
|
+
}
|
26
|
+
_next(undefined);
|
27
|
+
});
|
28
|
+
};
|
29
|
+
}
|
30
|
+
function _instanceof(left, right) {
|
31
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
32
|
+
return !!right[Symbol.hasInstance](left);
|
33
|
+
} else {
|
34
|
+
return left instanceof right;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
function _ts_generator(thisArg, body) {
|
38
|
+
var f, y, t, _ = {
|
39
|
+
label: 0,
|
40
|
+
sent: function() {
|
41
|
+
if (t[0] & 1) throw t[1];
|
42
|
+
return t[1];
|
43
|
+
},
|
44
|
+
trys: [],
|
45
|
+
ops: []
|
46
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
47
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
48
|
+
return this;
|
49
|
+
}), g;
|
50
|
+
function verb(n) {
|
51
|
+
return function(v) {
|
52
|
+
return step([
|
53
|
+
n,
|
54
|
+
v
|
55
|
+
]);
|
56
|
+
};
|
57
|
+
}
|
58
|
+
function step(op) {
|
59
|
+
if (f) throw new TypeError("Generator is already executing.");
|
60
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
61
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
62
|
+
if (y = 0, t) op = [
|
63
|
+
op[0] & 2,
|
64
|
+
t.value
|
65
|
+
];
|
66
|
+
switch(op[0]){
|
67
|
+
case 0:
|
68
|
+
case 1:
|
69
|
+
t = op;
|
70
|
+
break;
|
71
|
+
case 4:
|
72
|
+
_.label++;
|
73
|
+
return {
|
74
|
+
value: op[1],
|
75
|
+
done: false
|
76
|
+
};
|
77
|
+
case 5:
|
78
|
+
_.label++;
|
79
|
+
y = op[1];
|
80
|
+
op = [
|
81
|
+
0
|
82
|
+
];
|
83
|
+
continue;
|
84
|
+
case 7:
|
85
|
+
op = _.ops.pop();
|
86
|
+
_.trys.pop();
|
87
|
+
continue;
|
88
|
+
default:
|
89
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
90
|
+
_ = 0;
|
91
|
+
continue;
|
92
|
+
}
|
93
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
94
|
+
_.label = op[1];
|
95
|
+
break;
|
96
|
+
}
|
97
|
+
if (op[0] === 6 && _.label < t[1]) {
|
98
|
+
_.label = t[1];
|
99
|
+
t = op;
|
100
|
+
break;
|
101
|
+
}
|
102
|
+
if (t && _.label < t[2]) {
|
103
|
+
_.label = t[2];
|
104
|
+
_.ops.push(op);
|
105
|
+
break;
|
106
|
+
}
|
107
|
+
if (t[2]) _.ops.pop();
|
108
|
+
_.trys.pop();
|
109
|
+
continue;
|
110
|
+
}
|
111
|
+
op = body.call(thisArg, _);
|
112
|
+
} catch (e) {
|
113
|
+
op = [
|
114
|
+
6,
|
115
|
+
e
|
116
|
+
];
|
117
|
+
y = 0;
|
118
|
+
} finally{
|
119
|
+
f = t = 0;
|
120
|
+
}
|
121
|
+
if (op[0] & 5) throw op[1];
|
122
|
+
return {
|
123
|
+
value: op[0] ? op[1] : void 0,
|
124
|
+
done: true
|
125
|
+
};
|
126
|
+
}
|
127
|
+
}
|
128
|
+
import { useCallback, useEffect, useRef } from "react";
|
129
|
+
import { getCodeValue, isWebOTPSupported } from "../utils";
|
130
|
+
// Type guard function to check if credential is OTPCredential
|
131
|
+
var isOTPCredential = function(credential) {
|
132
|
+
return credential !== null && 'code' in credential;
|
133
|
+
};
|
134
|
+
export var useWebOTP = function(param) {
|
135
|
+
var codeString = param.codeString, enableSMSAutoRead = param.enableSMSAutoRead, disabled = param.disabled, codeLength = param.codeLength, codeSetter = param.codeSetter, onFullCodeEnter = param.onFullCodeEnter, setOtpVal = param.setOtpVal;
|
136
|
+
var abortControllerRef = useRef(null);
|
137
|
+
var startWebOTPListener = useCallback(function() {
|
138
|
+
return _async_to_generator(function() {
|
139
|
+
var otp, otpCode, newCode, err;
|
140
|
+
return _ts_generator(this, function(_state) {
|
141
|
+
switch(_state.label){
|
142
|
+
case 0:
|
143
|
+
if (!enableSMSAutoRead || disabled || !isWebOTPSupported()) {
|
144
|
+
return [
|
145
|
+
2
|
146
|
+
];
|
147
|
+
}
|
148
|
+
if (abortControllerRef.current) {
|
149
|
+
abortControllerRef.current.abort();
|
150
|
+
}
|
151
|
+
abortControllerRef.current = new AbortController();
|
152
|
+
_state.label = 1;
|
153
|
+
case 1:
|
154
|
+
_state.trys.push([
|
155
|
+
1,
|
156
|
+
3,
|
157
|
+
,
|
158
|
+
4
|
159
|
+
]);
|
160
|
+
return [
|
161
|
+
4,
|
162
|
+
navigator.credentials.get({
|
163
|
+
otp: {
|
164
|
+
transport: [
|
165
|
+
'sms'
|
166
|
+
]
|
167
|
+
},
|
168
|
+
signal: abortControllerRef.current.signal
|
169
|
+
})
|
170
|
+
];
|
171
|
+
case 2:
|
172
|
+
otp = _state.sent();
|
173
|
+
console.log('otp received', otp);
|
174
|
+
setOtpVal(otp);
|
175
|
+
// Type guard to check if it's an OTP credential
|
176
|
+
if (otp && isOTPCredential(otp) && otp.code) {
|
177
|
+
otpCode = otp.code;
|
178
|
+
// Validate the OTP code length matches our expected length
|
179
|
+
if (otpCode.length === codeLength) {
|
180
|
+
newCode = getCodeValue(codeLength, otpCode);
|
181
|
+
codeSetter(newCode);
|
182
|
+
// Trigger full code enter callback
|
183
|
+
if (onFullCodeEnter) {
|
184
|
+
onFullCodeEnter(otpCode);
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
return [
|
189
|
+
3,
|
190
|
+
4
|
191
|
+
];
|
192
|
+
case 3:
|
193
|
+
err = _state.sent();
|
194
|
+
if (_instanceof(err, DOMException)) {
|
195
|
+
if (err.name !== 'AbortError' && err.name !== 'NotAllowedError') {
|
196
|
+
console.warn('Web OTP API error:', err);
|
197
|
+
}
|
198
|
+
} else if (_instanceof(err, Error)) {
|
199
|
+
console.warn('Web OTP API error:', err);
|
200
|
+
} else {
|
201
|
+
console.warn('Unknown Web OTP API error:', err);
|
202
|
+
}
|
203
|
+
return [
|
204
|
+
3,
|
205
|
+
4
|
206
|
+
];
|
207
|
+
case 4:
|
208
|
+
return [
|
209
|
+
2
|
210
|
+
];
|
211
|
+
}
|
212
|
+
});
|
213
|
+
})();
|
214
|
+
}, [
|
215
|
+
enableSMSAutoRead,
|
216
|
+
disabled,
|
217
|
+
codeLength,
|
218
|
+
onFullCodeEnter
|
219
|
+
]);
|
220
|
+
var stopWebOTPListener = useCallback(function() {
|
221
|
+
if (abortControllerRef.current) {
|
222
|
+
abortControllerRef.current.abort();
|
223
|
+
abortControllerRef.current = null;
|
224
|
+
}
|
225
|
+
}, []);
|
226
|
+
useEffect(function() {
|
227
|
+
if (isWebOTPSupported() && codeString === '' && enableSMSAutoRead && !disabled) {
|
228
|
+
startWebOTPListener();
|
229
|
+
} else {
|
230
|
+
stopWebOTPListener();
|
231
|
+
}
|
232
|
+
return function() {
|
233
|
+
stopWebOTPListener();
|
234
|
+
};
|
235
|
+
}, [
|
236
|
+
codeString,
|
237
|
+
enableSMSAutoRead,
|
238
|
+
disabled,
|
239
|
+
startWebOTPListener,
|
240
|
+
stopWebOTPListener
|
241
|
+
]);
|
242
|
+
return {
|
243
|
+
startWebOTPListener: startWebOTPListener,
|
244
|
+
stopWebOTPListener: stopWebOTPListener
|
245
|
+
};
|
246
|
+
};
|
@@ -27,7 +27,7 @@ import { classes } from "../CodeField.tokens";
|
|
27
27
|
import { ANIMATION_TIMEOUT } from "./constants";
|
28
28
|
import { getCodeValue } from "./initialValuesHelper";
|
29
29
|
export var handleCodeError = function(param) {
|
30
|
-
var codeLength = param.codeLength, codeErrorBehavior = param.codeErrorBehavior, currentCode = param.currentCode, inputRefs = param.inputRefs, inputContainerRef = param.inputContainerRef, captionRef = param.captionRef,
|
30
|
+
var codeLength = param.codeLength, codeErrorBehavior = param.codeErrorBehavior, currentCode = param.currentCode, inputRefs = param.inputRefs, inputContainerRef = param.inputContainerRef, captionRef = param.captionRef, setInnerValue = param.setInnerValue, codeSetter = param.codeSetter;
|
31
31
|
if (!inputContainerRef.current) {
|
32
32
|
return;
|
33
33
|
}
|
@@ -41,7 +41,7 @@ export var handleCodeError = function(param) {
|
|
41
41
|
var newCode = _to_consumable_array(currentCode);
|
42
42
|
newCode.pop();
|
43
43
|
codeSetter(newCode);
|
44
|
-
|
44
|
+
setInnerValue(currentCode);
|
45
45
|
(_inputContainerRef_current = inputContainerRef.current) === null || _inputContainerRef_current === void 0 ? void 0 : _inputContainerRef_current.classList.remove(classes.codeErrorAnimation);
|
46
46
|
setTimeout(function() {
|
47
47
|
var _inputRefs_current_, _inputRefs_current_1;
|
@@ -26,14 +26,17 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
26
26
|
import { classes } from "../CodeField.tokens";
|
27
27
|
import { ANIMATION_TIMEOUT } from "./constants";
|
28
28
|
export var handleItemError = function(param) {
|
29
|
-
var currentSymbol = param.currentSymbol, itemErrorBehavior = param.itemErrorBehavior, index = param.index, newCode = param.newCode, inputRefs = param.inputRefs,
|
29
|
+
var currentSymbol = param.currentSymbol, itemErrorBehavior = param.itemErrorBehavior, index = param.index, newCode = param.newCode, inputRefs = param.inputRefs, setInnerValue = param.setInnerValue, codeSetter = param.codeSetter, onChange = param.onChange;
|
30
30
|
if (!inputRefs.current[index] || currentSymbol === ' ') {
|
31
31
|
return;
|
32
32
|
}
|
33
33
|
switch(itemErrorBehavior){
|
34
34
|
case 'keep':
|
35
35
|
var _inputRefs_current_index;
|
36
|
-
|
36
|
+
setInnerValue(newCode);
|
37
|
+
if (onChange) {
|
38
|
+
onChange(newCode.join(''));
|
39
|
+
}
|
37
40
|
(_inputRefs_current_index = inputRefs.current[index]) === null || _inputRefs_current_index === void 0 ? void 0 : _inputRefs_current_index.classList.add(classes.itemError, classes.itemErrorAnimation);
|
38
41
|
setTimeout(function() {
|
39
42
|
var _inputRefs_current_index;
|
@@ -47,11 +50,17 @@ export var handleItemError = function(param) {
|
|
47
50
|
case 'forbid-enter':
|
48
51
|
newCode[index] = '';
|
49
52
|
codeSetter(newCode);
|
53
|
+
if (onChange) {
|
54
|
+
onChange(newCode.join(''));
|
55
|
+
}
|
50
56
|
break;
|
51
57
|
case 'remove-symbol':
|
52
58
|
default:
|
53
59
|
var _inputRefs_current_index1;
|
54
|
-
|
60
|
+
setInnerValue(newCode);
|
61
|
+
if (onChange) {
|
62
|
+
onChange(newCode.join(''));
|
63
|
+
}
|
55
64
|
(_inputRefs_current_index1 = inputRefs.current[index]) === null || _inputRefs_current_index1 === void 0 ? void 0 : _inputRefs_current_index1.classList.add(classes.itemError, classes.itemErrorFade, classes.itemErrorAnimation);
|
56
65
|
setTimeout(function() {
|
57
66
|
var _inputRefs_current_index;
|
@@ -87,17 +87,6 @@ export var useDrawer = function(param) {
|
|
87
87
|
isOpen,
|
88
88
|
popupController.items
|
89
89
|
]);
|
90
|
-
// При анмаунте компонента нужно обновлять overflow у body.
|
91
|
-
useEffect(function() {
|
92
|
-
return function() {
|
93
|
-
if (!canUseDOM) {
|
94
|
-
return;
|
95
|
-
}
|
96
|
-
if (!hasDrawers(Array.from(popupController.items.values()))) {
|
97
|
-
document.body.style.overflow = overflow.current;
|
98
|
-
}
|
99
|
-
};
|
100
|
-
}, []);
|
101
90
|
var drawerInfo = _object_spread({
|
102
91
|
id: id,
|
103
92
|
info: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CodeField.d.ts","sourceRoot":"","sources":["../../../src/components/CodeField/CodeField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAGnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"CodeField.d.ts","sourceRoot":"","sources":["../../../src/components/CodeField/CodeField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAGnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAkBxD,eAAO,MAAM,aAAa,SAAU,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;sLAyTxE,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBA3TQ,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoV5E,CAAC"}
|
@@ -7,4 +7,5 @@ export declare const CaptionWrapper: import("@linaria/react").StyledComponent<im
|
|
7
7
|
captionAlign: "left" | "center";
|
8
8
|
widthValue?: string;
|
9
9
|
}>;
|
10
|
+
export declare const HiddenInput: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Record<never, unknown>>;
|
10
11
|
//# sourceMappingURL=CodeField.styles.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CodeField.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CodeField/CodeField.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,0CAUhB,CAAC;AAEF,eAAO,MAAM,WAAW,qKAGvB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAGrB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAErB,CAAC;AAEF,eAAO,MAAM,SAAS,8KAQrB,CAAC;AAEF,eAAO,MAAM,cAAc;kBAA8B,MAAM,GAAG,QAAQ;iBAAe,MAAM;EAK9F,CAAC"}
|
1
|
+
{"version":3,"file":"CodeField.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CodeField/CodeField.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,0CAUhB,CAAC;AAEF,eAAO,MAAM,WAAW,qKAGvB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAGrB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAErB,CAAC;AAEF,eAAO,MAAM,SAAS,8KAQrB,CAAC;AAEF,eAAO,MAAM,cAAc;kBAA8B,MAAM,GAAG,QAAQ;iBAAe,MAAM;EAK9F,CAAC;AAEF,eAAO,MAAM,WAAW,8KAEvB,CAAC"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
type UseWebOTPProps = {
|
2
|
+
codeString: string;
|
3
|
+
enableSMSAutoRead: boolean;
|
4
|
+
disabled: boolean;
|
5
|
+
codeLength: number;
|
6
|
+
codeSetter: (newCode: Array<string>) => void;
|
7
|
+
onFullCodeEnter?: (code: string) => void;
|
8
|
+
setOtpVal: React.Dispatch<React.SetStateAction<Credential | null>>;
|
9
|
+
};
|
10
|
+
type OTPTransport = 'sms';
|
11
|
+
declare global {
|
12
|
+
interface CredentialRequestOptions {
|
13
|
+
otp?: {
|
14
|
+
transport: OTPTransport[];
|
15
|
+
};
|
16
|
+
signal?: AbortSignal;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
export declare const useWebOTP: ({ codeString, enableSMSAutoRead, disabled, codeLength, codeSetter, onFullCodeEnter, setOtpVal, }: UseWebOTPProps) => {
|
20
|
+
startWebOTPListener: () => Promise<void>;
|
21
|
+
stopWebOTPListener: () => void;
|
22
|
+
};
|
23
|
+
export {};
|
24
|
+
//# sourceMappingURL=useWebOTP.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useWebOTP.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/hooks/useWebOTP.ts"],"names":[],"mappings":"AAIA,KAAK,cAAc,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC7C,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;CACtE,CAAC;AAEF,KAAK,YAAY,GAAG,KAAK,CAAC;AAM1B,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,wBAAwB;QAC9B,GAAG,CAAC,EAAE;YACF,SAAS,EAAE,YAAY,EAAE,CAAC;SAC7B,CAAC;QACF,MAAM,CAAC,EAAE,WAAW,CAAC;KACxB;CACJ;AAOD,eAAO,MAAM,SAAS,qGAQnB,cAAc;;;CAwEhB,CAAC"}
|
@@ -7,9 +7,9 @@ type ValidateSymbolsArgs = {
|
|
7
7
|
inputContainerRef: MutableRefObject<HTMLDivElement | null>;
|
8
8
|
inputRefs: MutableRefObject<Array<HTMLInputElement | null>>;
|
9
9
|
captionRef: MutableRefObject<HTMLDivElement | null>;
|
10
|
-
|
10
|
+
setInnerValue: Dispatch<SetStateAction<Array<string>>>;
|
11
11
|
codeSetter: (newCode: Array<string>) => void;
|
12
12
|
};
|
13
|
-
export declare const handleCodeError: ({ codeLength, codeErrorBehavior, currentCode, inputRefs, inputContainerRef, captionRef,
|
13
|
+
export declare const handleCodeError: ({ codeLength, codeErrorBehavior, currentCode, inputRefs, inputContainerRef, captionRef, setInnerValue, codeSetter, }: ValidateSymbolsArgs) => void;
|
14
14
|
export {};
|
15
15
|
//# sourceMappingURL=handleCodeError.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handleCodeError.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/handleCodeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAM5D,KAAK,mBAAmB,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,iBAAiB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3D,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,UAAU,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpD,
|
1
|
+
{"version":3,"file":"handleCodeError.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/handleCodeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAM5D,KAAK,mBAAmB,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,iBAAiB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3D,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,UAAU,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpD,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACvD,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,eAAe,yHASzB,mBAAmB,SA8CrB,CAAC"}
|
@@ -6,9 +6,10 @@ type ValidateSymbolsArgs = {
|
|
6
6
|
index: number;
|
7
7
|
newCode: Array<string>;
|
8
8
|
inputRefs: MutableRefObject<Array<HTMLInputElement | null>>;
|
9
|
-
|
9
|
+
setInnerValue: Dispatch<SetStateAction<Array<string>>>;
|
10
10
|
codeSetter: (newCode: Array<string>) => void;
|
11
|
+
onChange?: (value: string) => void;
|
11
12
|
};
|
12
|
-
export declare const handleItemError: ({ currentSymbol, itemErrorBehavior, index, newCode, inputRefs,
|
13
|
+
export declare const handleItemError: ({ currentSymbol, itemErrorBehavior, index, newCode, inputRefs, setInnerValue, codeSetter, onChange, }: ValidateSymbolsArgs) => void;
|
13
14
|
export {};
|
14
15
|
//# sourceMappingURL=handleItemError.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handleItemError.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/handleItemError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAK5D,KAAK,mBAAmB,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,
|
1
|
+
{"version":3,"file":"handleItemError.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/handleItemError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAK5D,KAAK,mBAAmB,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACvD,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,eAAe,0GASzB,mBAAmB,SAuDrB,CAAC"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
export { getFieldPattern, getPlaceholderValue, getCodeValue } from './initialValuesHelper';
|
2
2
|
export { handleItemError } from './handleItemError';
|
3
3
|
export { handleCodeError } from './handleCodeError';
|
4
|
+
export { isWebOTPSupported } from './isWebOTPSupported';
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|