@alfalab/core-components-confirmation 12.4.7 → 12.4.8

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.
Files changed (109) hide show
  1. package/component.desktop.js +4 -3
  2. package/component.mobile.js +6 -5
  3. package/component.responsive.js +5 -4
  4. package/components/base-confirmation/component.d.ts +4 -0
  5. package/components/base-confirmation/component.js +87 -13
  6. package/components/base-confirmation/index.css +2 -2
  7. package/components/base-confirmation/index.d.ts +1 -1
  8. package/components/base-confirmation/index.js +3 -2
  9. package/components/countdown-loader/component.js +1 -1
  10. package/components/countdown-loader/index.css +2 -2
  11. package/components/header/component.js +1 -1
  12. package/components/header/index.css +4 -4
  13. package/components/index.js +1 -1
  14. package/components/screens/fatal-error/component.js +1 -1
  15. package/components/screens/fatal-error/index.css +6 -6
  16. package/components/screens/hint/component.js +1 -1
  17. package/components/screens/hint/index.css +12 -12
  18. package/components/screens/index.js +1 -1
  19. package/components/screens/initial/component.js +1 -1
  20. package/components/screens/initial/countdown-section.js +1 -1
  21. package/components/screens/initial/index.css +18 -18
  22. package/components/screens/initial/index.js +1 -1
  23. package/components/screens/temp-block/component.js +1 -1
  24. package/components/screens/temp-block/index.css +7 -7
  25. package/{countdown-section-94a35216.d.ts → countdown-section-bda43975.d.ts} +0 -0
  26. package/{countdown-section-94a35216.js → countdown-section-bda43975.js} +1 -1
  27. package/cssm/component.desktop.js +3 -2
  28. package/cssm/component.mobile.js +4 -3
  29. package/cssm/component.responsive.js +4 -3
  30. package/cssm/components/base-confirmation/component.d.ts +4 -0
  31. package/cssm/components/base-confirmation/component.js +85 -13
  32. package/cssm/components/base-confirmation/index.d.ts +1 -1
  33. package/cssm/components/base-confirmation/index.js +2 -1
  34. package/cssm/desktop.js +2 -1
  35. package/cssm/index.js +2 -1
  36. package/cssm/mobile.js +2 -1
  37. package/cssm/responsive.js +4 -3
  38. package/desktop.js +3 -2
  39. package/esm/component.desktop.js +3 -2
  40. package/esm/component.mobile.js +4 -3
  41. package/esm/component.responsive.js +3 -2
  42. package/esm/components/base-confirmation/component.d.ts +4 -0
  43. package/esm/components/base-confirmation/component.js +85 -12
  44. package/esm/components/base-confirmation/index.css +2 -2
  45. package/esm/components/base-confirmation/index.d.ts +1 -1
  46. package/esm/components/base-confirmation/index.js +3 -2
  47. package/esm/components/countdown-loader/component.js +1 -1
  48. package/esm/components/countdown-loader/index.css +2 -2
  49. package/esm/components/header/component.js +1 -1
  50. package/esm/components/header/index.css +4 -4
  51. package/esm/components/index.js +1 -1
  52. package/esm/components/screens/fatal-error/component.js +1 -1
  53. package/esm/components/screens/fatal-error/index.css +6 -6
  54. package/esm/components/screens/hint/component.js +1 -1
  55. package/esm/components/screens/hint/index.css +12 -12
  56. package/esm/components/screens/index.js +1 -1
  57. package/esm/components/screens/initial/component.js +1 -1
  58. package/esm/components/screens/initial/countdown-section.js +1 -1
  59. package/esm/components/screens/initial/index.css +18 -18
  60. package/esm/components/screens/initial/index.js +1 -1
  61. package/esm/components/screens/temp-block/component.js +1 -1
  62. package/esm/components/screens/temp-block/index.css +7 -7
  63. package/esm/{countdown-section-1560b6e0.d.ts → countdown-section-6eb66678.d.ts} +0 -0
  64. package/esm/{countdown-section-1560b6e0.js → countdown-section-6eb66678.js} +1 -1
  65. package/esm/desktop.js +3 -2
  66. package/esm/index.js +3 -2
  67. package/esm/mobile.css +2 -2
  68. package/esm/mobile.js +3 -2
  69. package/esm/responsive.js +5 -4
  70. package/index.js +3 -2
  71. package/mobile.css +2 -2
  72. package/mobile.js +3 -2
  73. package/modern/component.desktop.js +1 -1
  74. package/modern/component.mobile.js +2 -2
  75. package/modern/component.responsive.js +1 -1
  76. package/modern/components/base-confirmation/component.js +2 -2
  77. package/modern/components/base-confirmation/index.css +2 -2
  78. package/modern/components/base-confirmation/index.js +1 -1
  79. package/modern/components/countdown-loader/component.js +1 -1
  80. package/modern/components/countdown-loader/index.css +2 -2
  81. package/modern/components/header/component.js +1 -1
  82. package/modern/components/header/index.css +4 -4
  83. package/modern/components/index.js +1 -1
  84. package/modern/components/screens/fatal-error/component.js +1 -1
  85. package/modern/components/screens/fatal-error/index.css +6 -6
  86. package/modern/components/screens/hint/component.js +1 -1
  87. package/modern/components/screens/hint/index.css +12 -12
  88. package/modern/components/screens/index.js +1 -1
  89. package/modern/components/screens/initial/component.js +1 -1
  90. package/modern/components/screens/initial/countdown-section.js +1 -1
  91. package/modern/components/screens/initial/index.css +18 -18
  92. package/modern/components/screens/initial/index.js +1 -1
  93. package/modern/components/screens/temp-block/component.js +1 -1
  94. package/modern/components/screens/temp-block/index.css +7 -7
  95. package/modern/{countdown-section-b0b34939.d.ts → countdown-section-f17bf1df.d.ts} +0 -0
  96. package/modern/{countdown-section-b0b34939.js → countdown-section-f17bf1df.js} +1 -1
  97. package/modern/desktop.js +1 -1
  98. package/modern/index.js +1 -1
  99. package/modern/mobile.css +2 -2
  100. package/modern/mobile.js +1 -1
  101. package/modern/responsive.js +1 -1
  102. package/package.json +8 -7
  103. package/responsive.js +5 -4
  104. package/component-adbf9996.d.ts +0 -37
  105. package/component-adbf9996.js +0 -130
  106. package/cssm/component-3c591970.d.ts +0 -37
  107. package/cssm/component-3c591970.js +0 -129
  108. package/esm/component-8d44589b.d.ts +0 -37
  109. package/esm/component-8d44589b.js +0 -122
@@ -1,37 +0,0 @@
1
- import { FC } from 'react';
2
- import { ConfirmationProps } from "./types";
3
- declare function __extends(d: any, b: any): void;
4
- declare function __rest(s: any, e: any): {};
5
- declare function __decorate(decorators: any, target: any, key: any, desc: any, ...args: any[]): any;
6
- declare function __param(paramIndex: any, decorator: any): (target: any, key: any) => void;
7
- declare function __metadata(metadataKey: any, metadataValue: any): any;
8
- declare function __awaiter(thisArg: any, _arguments: any, P: any, generator: any): any;
9
- declare function __generator(thisArg: any, body: any): {
10
- next: (v: any) => any;
11
- throw: (v: any) => any;
12
- return: (v: any) => any;
13
- };
14
- declare function __exportStar(m: any, o: any): void;
15
- declare function __values(o: any): any;
16
- declare function __read(o: any, n: any): any;
17
- declare function __spread(...args: any[]): any[];
18
- declare function __spreadArrays(...args: any[]): any[];
19
- declare function __spreadArray(to: any, from: any, pack: any, ...args: any[]): any;
20
- declare function __await(v: any): __await;
21
- declare class __await {
22
- constructor(v: any);
23
- v: any;
24
- }
25
- declare function __asyncGenerator(thisArg: any, _arguments: any, generator: any): {};
26
- declare function __asyncDelegator(o: any): {};
27
- declare function __asyncValues(o: any): any;
28
- declare function __makeTemplateObject(cooked: any, raw: any): any;
29
- declare function __importStar(mod: any): any;
30
- declare function __importDefault(mod: any): any;
31
- declare function __classPrivateFieldGet(receiver: any, state: any, kind: any, f: any): any;
32
- declare function __classPrivateFieldSet(receiver: any, state: any, value: any, kind: any, f: any): any;
33
- declare function __classPrivateFieldIn(state: any, receiver: any): any;
34
- declare function __assign(...args: any[]): any;
35
- declare function __createBinding(o: any, m: any, k: any, k2: any): void;
36
- declare const BaseConfirmation: FC<ConfirmationProps>;
37
- export { __extends, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __assign, __createBinding, BaseConfirmation };
@@ -1,122 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import cn from 'classnames';
3
- import { usePrevious } from '@alfalab/hooks';
4
- import { ConfirmationContext } from './context.js';
5
- import { defaultTexts } from './types.js';
6
- import { useCountdown, ONE_MINUTE, ONE_DAY } from './utils.js';
7
- import { Initial } from './components/screens/initial/component.js';
8
- import { Hint } from './components/screens/hint/component.js';
9
- import { FatalError } from './components/screens/fatal-error/component.js';
10
- import { TempBlock } from './components/screens/temp-block/component.js';
11
-
12
- /******************************************************************************
13
- Copyright (c) Microsoft Corporation.
14
-
15
- Permission to use, copy, modify, and/or distribute this software for any
16
- purpose with or without fee is hereby granted.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
19
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
21
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
22
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24
- PERFORMANCE OF THIS SOFTWARE.
25
- ***************************************************************************** */
26
- var __assign = function () {
27
- __assign = Object.assign || function __assign(t) {
28
- for (var s, i = 1, n = arguments.length; i < n; i++) {
29
- s = arguments[i];
30
- for (var p in s)
31
- if (Object.prototype.hasOwnProperty.call(s, p))
32
- t[p] = s[p];
33
- }
34
- return t;
35
- };
36
- return __assign.apply(this, arguments);
37
- };
38
- function __rest(s, e) {
39
- var t = {};
40
- for (var p in s)
41
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
42
- t[p] = s[p];
43
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
44
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
45
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
46
- t[p[i]] = s[p[i]];
47
- }
48
- return t;
49
- }
50
-
51
- var styles = {"component":"confirmation__component_4lbek"};
52
- require('./components/base-confirmation/index.css')
53
-
54
- var confirmationScreens = {
55
- INITIAL: Initial,
56
- HINT: Hint,
57
- FATAL_ERROR: FatalError,
58
- TEMP_BLOCK: TempBlock,
59
- };
60
- var BaseConfirmation = function (_a) {
61
- var state = _a.state, screen = _a.screen, _b = _a.alignContent, alignContent = _b === void 0 ? 'left' : _b; _a.children; var _c = _a.requiredCharAmount, requiredCharAmount = _c === void 0 ? 5 : _c, _d = _a.countdownDuration, countdownDuration = _d === void 0 ? ONE_MINUTE : _d, _e = _a.tempBlockDuration, tempBlockDuration = _e === void 0 ? ONE_DAY : _e, phone = _a.phone, blockSmsRetry = _a.blockSmsRetry, dataTestId = _a.dataTestId, className = _a.className, getScreensMap = _a.getScreensMap, onInputFinished = _a.onInputFinished, onChangeState = _a.onChangeState, onSmsRetryClick = _a.onSmsRetryClick, onChangeScreen = _a.onChangeScreen, onFatalErrorOkButtonClick = _a.onFatalErrorOkButtonClick, onTempBlockFinished = _a.onTempBlockFinished, mobile = _a.mobile, _f = _a.clearCodeOnError, clearCodeOnError = _f === void 0 ? true : _f, restProps = __rest(_a, ["state", "screen", "alignContent", "children", "requiredCharAmount", "countdownDuration", "tempBlockDuration", "phone", "blockSmsRetry", "dataTestId", "className", "getScreensMap", "onInputFinished", "onChangeState", "onSmsRetryClick", "onChangeScreen", "onFatalErrorOkButtonClick", "onTempBlockFinished", "mobile", "clearCodeOnError"]);
62
- var _g = useCountdown(countdownDuration), timeLeft = _g[0], startTimer = _g[1], stopTimer = _g[2];
63
- var prevState = usePrevious(state);
64
- useEffect(function () {
65
- startTimer();
66
- }, [startTimer]);
67
- useEffect(function () {
68
- /**
69
- * Перезапускаем таймер после повторного запроса кода
70
- */
71
- if (state === 'INITIAL' && prevState === 'CODE_SENDING') {
72
- startTimer();
73
- }
74
- }, [state, prevState, startTimer]);
75
- useEffect(function () {
76
- /**
77
- * Останавливаем таймер, если новый экран/состояние не содержит таймер
78
- */
79
- if (!['INITIAL', 'HINT', 'TEMP_BLOCK'].includes(screen) || blockSmsRetry) {
80
- stopTimer();
81
- }
82
- }, [state, screen, blockSmsRetry, stopTimer]);
83
- var handleSmsRetry = function () {
84
- onChangeState('CODE_SENDING');
85
- onSmsRetryClick();
86
- };
87
- var handleInputFinished = function (code) {
88
- onChangeState('CODE_CHECKING');
89
- onInputFinished(code);
90
- };
91
- var handleFatalErrorOkButtonClick = function () {
92
- if (onFatalErrorOkButtonClick) {
93
- onFatalErrorOkButtonClick();
94
- }
95
- };
96
- // eslint-disable-next-line react/jsx-no-constructed-context-values
97
- var contextValue = {
98
- alignContent: alignContent,
99
- texts: __assign(__assign({}, defaultTexts), restProps.texts),
100
- state: state,
101
- screen: screen,
102
- requiredCharAmount: requiredCharAmount,
103
- countdownDuration: countdownDuration,
104
- timeLeft: timeLeft,
105
- tempBlockDuration: tempBlockDuration,
106
- phone: phone,
107
- blockSmsRetry: blockSmsRetry,
108
- onTempBlockFinished: onTempBlockFinished,
109
- onChangeState: onChangeState,
110
- onChangeScreen: onChangeScreen,
111
- clearCodeOnError: clearCodeOnError,
112
- onInputFinished: handleInputFinished,
113
- onSmsRetryClick: handleSmsRetry,
114
- onFatalErrorOkButtonClick: handleFatalErrorOkButtonClick,
115
- };
116
- var screensMap = getScreensMap ? getScreensMap(confirmationScreens) : confirmationScreens;
117
- var CurrentScreen = screensMap[screen];
118
- return (React.createElement(ConfirmationContext.Provider, { value: contextValue },
119
- React.createElement("div", { className: cn(styles.component, className), "data-test-id": dataTestId }, CurrentScreen && React.createElement(CurrentScreen, { mobile: mobile }))));
120
- };
121
-
122
- export { BaseConfirmation as B, __assign as _, __rest as a };