@incodetech/web 2.0.0-alpha.2 → 2.0.0-alpha.3
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/dist/asset-manifest.json +16 -16
- package/package.json +5 -2
- package/.turbo/turbo-build.log +0 -58
- package/.turbo/turbo-coverage.log +0 -23
- package/.turbo/turbo-format.log +0 -6
- package/.turbo/turbo-lint$colon$fix.log +0 -6
- package/.turbo/turbo-lint.log +0 -6
- package/.turbo/turbo-test.log +0 -1033
- package/.turbo/turbo-typecheck.log +0 -5
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/email/email.tsx.html +0 -850
- package/coverage/email/emailInput.tsx.html +0 -340
- package/coverage/email/index.html +0 -131
- package/coverage/favicon.png +0 -0
- package/coverage/flow/flow.tsx.html +0 -961
- package/coverage/flow/flowCompleted.tsx.html +0 -448
- package/coverage/flow/flowInit.ts.html +0 -367
- package/coverage/flow/flowStart.tsx.html +0 -208
- package/coverage/flow/index.html +0 -221
- package/coverage/flow/preloadFlow.ts.html +0 -598
- package/coverage/flow/unsupportedModule.tsx.html +0 -202
- package/coverage/flow/useFlowInitialization.ts.html +0 -469
- package/coverage/flow/useModuleLoader.ts.html +0 -361
- package/coverage/hooks/index.html +0 -116
- package/coverage/hooks/useManager.ts.html +0 -205
- package/coverage/index.html +0 -401
- package/coverage/permissions/boldWithArrow.tsx.html +0 -208
- package/coverage/permissions/denied.tsx.html +0 -172
- package/coverage/permissions/deniedAndroid.tsx.html +0 -253
- package/coverage/permissions/deniedDesktop.tsx.html +0 -277
- package/coverage/permissions/deniedIOS.tsx.html +0 -304
- package/coverage/permissions/deniedInstructions.tsx.html +0 -142
- package/coverage/permissions/iconWrapper.tsx.html +0 -130
- package/coverage/permissions/index.html +0 -251
- package/coverage/permissions/learnMore.tsx.html +0 -340
- package/coverage/permissions/numberedStep.tsx.html +0 -127
- package/coverage/permissions/permissions.tsx.html +0 -289
- package/coverage/phone/index.html +0 -116
- package/coverage/phone/phoneInput.tsx.html +0 -832
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/selfie/index.html +0 -131
- package/coverage/selfie/selfie.tsx.html +0 -334
- package/coverage/selfie/tutorial.tsx.html +0 -214
- package/coverage/shared/baseTutorial/baseTutorial.tsx.html +0 -250
- package/coverage/shared/baseTutorial/index.html +0 -131
- package/coverage/shared/baseTutorial/replaceBaseTutorial.ts.html +0 -289
- package/coverage/shared/button/button.tsx.html +0 -226
- package/coverage/shared/button/index.html +0 -116
- package/coverage/shared/componentRoot/incodeComponent.tsx.html +0 -121
- package/coverage/shared/componentRoot/index.html +0 -116
- package/coverage/shared/countries/countries.ts.html +0 -502
- package/coverage/shared/countries/index.html +0 -116
- package/coverage/shared/icons/chevronDown.tsx.html +0 -151
- package/coverage/shared/icons/index.html +0 -131
- package/coverage/shared/icons/successIcon.tsx.html +0 -163
- package/coverage/shared/loader/index.html +0 -116
- package/coverage/shared/loader/loadingIcon.tsx.html +0 -286
- package/coverage/shared/otpInput/index.html +0 -116
- package/coverage/shared/otpInput/otpInput.tsx.html +0 -808
- package/coverage/shared/page/index.html +0 -146
- package/coverage/shared/page/page.tsx.html +0 -358
- package/coverage/shared/page/pageUiConfig.ts.html +0 -277
- package/coverage/shared/page/verifiedByIncode.tsx.html +0 -310
- package/coverage/shared/spacer/index.html +0 -116
- package/coverage/shared/spacer/spacer.tsx.html +0 -349
- package/coverage/shared/spinner/index.html +0 -116
- package/coverage/shared/spinner/spinner.tsx.html +0 -280
- package/coverage/shared/title/index.html +0 -116
- package/coverage/shared/title/title.tsx.html +0 -121
- package/coverage/shared/uiConfig/index.html +0 -116
- package/coverage/shared/uiConfig/uiConfig.ts.html +0 -193
- package/coverage/shared/webComponent/incodeModule.ts.html +0 -172
- package/coverage/shared/webComponent/index.html +0 -131
- package/coverage/shared/webComponent/registerIncodeElement.ts.html +0 -130
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/styles/cn.tsx.html +0 -148
- package/coverage/styles/fetchTheme.ts.html +0 -349
- package/coverage/styles/index.html +0 -131
- package/dev/README.md +0 -163
- package/dev/getToken.ts +0 -36
- package/dev/headless.html +0 -875
- package/dev/index.html +0 -366
- package/dev/main-headless.tsx +0 -1332
- package/dev/main-orchestrated-flow.tsx +0 -1158
- package/dev/main-preact.tsx +0 -323
- package/dev/main-simplified.tsx +0 -123
- package/dev/main-web-component.tsx +0 -256
- package/dev/main.tsx +0 -332
- package/dev/manual.html +0 -27
- package/dev/orchestrated-flow.html +0 -64
- package/dev/simplified.html +0 -64
- package/dev/tiktok-logo.svg +0 -7
- package/src/defineCustomElement.tsx +0 -30
- package/src/email/email.test.tsx +0 -368
- package/src/email/email.tsx +0 -255
- package/src/email/emailInput.test.tsx +0 -264
- package/src/email/emailInput.tsx +0 -85
- package/src/email/styles.css +0 -59
- package/src/flow/flow.test.tsx +0 -796
- package/src/flow/flow.tsx +0 -292
- package/src/flow/flowCompleted.css +0 -30
- package/src/flow/flowCompleted.test.tsx +0 -331
- package/src/flow/flowCompleted.tsx +0 -121
- package/src/flow/flowInit.test.ts +0 -264
- package/src/flow/flowInit.ts +0 -94
- package/src/flow/flowStart.css +0 -58
- package/src/flow/flowStart.test.tsx +0 -49
- package/src/flow/flowStart.tsx +0 -41
- package/src/flow/incode-logo.svg +0 -8
- package/src/flow/index.ts +0 -7
- package/src/flow/preloadFlow.test.ts +0 -421
- package/src/flow/preloadFlow.ts +0 -171
- package/src/flow/styles.css +0 -9
- package/src/flow/unsupportedModule.css +0 -21
- package/src/flow/unsupportedModule.tsx +0 -39
- package/src/flow/useFlowInitialization.test.tsx +0 -292
- package/src/flow/useFlowInitialization.ts +0 -128
- package/src/flow/useModuleLoader.test.tsx +0 -212
- package/src/flow/useModuleLoader.ts +0 -92
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useManager.test.ts +0 -91
- package/src/hooks/useManager.ts +0 -40
- package/src/i18n/index.ts +0 -3
- package/src/i18n/instance.ts +0 -16
- package/src/i18n/setup.ts +0 -184
- package/src/i18n/useTranslation.ts +0 -42
- package/src/index.ts +0 -27
- package/src/permissions/assets/android-dots-icon.svg +0 -7
- package/src/permissions/assets/android-settings-icon.svg +0 -16
- package/src/permissions/assets/android-toggle-icon.svg +0 -20
- package/src/permissions/assets/bank-card-icon.svg +0 -14
- package/src/permissions/assets/camera-icon.svg +0 -12
- package/src/permissions/assets/camera-ios.svg +0 -53
- package/src/permissions/assets/check-icon.svg +0 -8
- package/src/permissions/assets/chrome-icon.svg +0 -43
- package/src/permissions/assets/password-icon.svg +0 -11
- package/src/permissions/assets/permissions-img.svg +0 -51
- package/src/permissions/assets/safari-icon.svg +0 -37
- package/src/permissions/assets/settings-icon.svg +0 -33
- package/src/permissions/assets/toggle-icon.svg +0 -19
- package/src/permissions/assets/warning-icon.svg +0 -6
- package/src/permissions/boldWithArrow.css +0 -9
- package/src/permissions/boldWithArrow.tsx +0 -41
- package/src/permissions/denied.css +0 -37
- package/src/permissions/denied.tsx +0 -29
- package/src/permissions/deniedAndroid.tsx +0 -56
- package/src/permissions/deniedDesktop.css +0 -9
- package/src/permissions/deniedDesktop.tsx +0 -64
- package/src/permissions/deniedIOS.tsx +0 -73
- package/src/permissions/deniedInstructions.tsx +0 -19
- package/src/permissions/iconWrapper.css +0 -9
- package/src/permissions/iconWrapper.tsx +0 -15
- package/src/permissions/learnMore.css +0 -37
- package/src/permissions/learnMore.tsx +0 -85
- package/src/permissions/numberedStep.css +0 -13
- package/src/permissions/numberedStep.tsx +0 -14
- package/src/permissions/permissions.css +0 -13
- package/src/permissions/permissions.tsx +0 -68
- package/src/phone/phone.tsx +0 -246
- package/src/phone/phoneInput.test.tsx +0 -275
- package/src/phone/phoneInput.tsx +0 -249
- package/src/phone/styles.css +0 -158
- package/src/selfie/cameraButton.css +0 -13
- package/src/selfie/cameraButton.tsx +0 -35
- package/src/selfie/capture.css +0 -57
- package/src/selfie/capture.tsx +0 -232
- package/src/selfie/errorModal.tsx +0 -218
- package/src/selfie/errorModalContent.css +0 -33
- package/src/selfie/errorModalContent.tsx +0 -44
- package/src/selfie/faceOutline.css +0 -5
- package/src/selfie/faceOutline.tsx +0 -22
- package/src/selfie/loadingBorder.css +0 -12
- package/src/selfie/loadingBorder.tsx +0 -77
- package/src/selfie/manualCaptureButton.css +0 -13
- package/src/selfie/manualCaptureButton.tsx +0 -35
- package/src/selfie/noMoreAttemptsModal.tsx +0 -44
- package/src/selfie/notification.css +0 -9
- package/src/selfie/notification.tsx +0 -36
- package/src/selfie/retryErrorModal.tsx +0 -56
- package/src/selfie/selfie.test.tsx +0 -458
- package/src/selfie/selfie.tsx +0 -83
- package/src/selfie/selfieTutorial.json +0 -2626
- package/src/selfie/styles.css +0 -1
- package/src/selfie/tutorial.test.tsx +0 -200
- package/src/selfie/tutorial.tsx +0 -43
- package/src/setup.ts +0 -33
- package/src/shared/baseTutorial/baseTutorial.css +0 -21
- package/src/shared/baseTutorial/baseTutorial.test.tsx +0 -184
- package/src/shared/baseTutorial/baseTutorial.tsx +0 -55
- package/src/shared/baseTutorial/replaceBaseTutorial.test.ts +0 -267
- package/src/shared/baseTutorial/replaceBaseTutorial.ts +0 -68
- package/src/shared/button/button.css +0 -55
- package/src/shared/button/button.test.tsx +0 -101
- package/src/shared/button/button.tsx +0 -47
- package/src/shared/componentRoot/incodeComponent.tsx +0 -12
- package/src/shared/countries/countries.test.ts +0 -75
- package/src/shared/countries/countries.ts +0 -139
- package/src/shared/countries/index.ts +0 -6
- package/src/shared/icons/chevronDown.tsx +0 -22
- package/src/shared/icons/index.ts +0 -2
- package/src/shared/icons/successIcon.css +0 -5
- package/src/shared/icons/successIcon.test.tsx +0 -40
- package/src/shared/icons/successIcon.tsx +0 -26
- package/src/shared/loader/loadingIcon.css +0 -28
- package/src/shared/loader/loadingIcon.tsx +0 -67
- package/src/shared/lottie/lottie.tsx +0 -108
- package/src/shared/otpInput/otpInput.css +0 -85
- package/src/shared/otpInput/otpInput.test.tsx +0 -356
- package/src/shared/otpInput/otpInput.tsx +0 -241
- package/src/shared/page/incode-logo.svg +0 -3
- package/src/shared/page/page.css +0 -47
- package/src/shared/page/page.test.tsx +0 -97
- package/src/shared/page/page.tsx +0 -91
- package/src/shared/page/pageUiConfig.test.ts +0 -112
- package/src/shared/page/pageUiConfig.ts +0 -64
- package/src/shared/page/verifiedByIncode.css +0 -5
- package/src/shared/page/verifiedByIncode.tsx +0 -75
- package/src/shared/spacer/spacer.css +0 -149
- package/src/shared/spacer/spacer.test.tsx +0 -143
- package/src/shared/spacer/spacer.tsx +0 -88
- package/src/shared/spinner/index.ts +0 -2
- package/src/shared/spinner/spinner.css +0 -28
- package/src/shared/spinner/spinner.test.tsx +0 -82
- package/src/shared/spinner/spinner.tsx +0 -65
- package/src/shared/title/title.css +0 -7
- package/src/shared/title/title.tsx +0 -12
- package/src/shared/uiConfig/uiConfig.ts +0 -36
- package/src/shared/webComponent/incodeModule.ts +0 -29
- package/src/shared/webComponent/registerIncodeElement.ts +0 -15
- package/src/styles/__mocks__/fetchTheme.ts +0 -19
- package/src/styles/applyTheme.ts +0 -37
- package/src/styles/cn.test.tsx +0 -57
- package/src/styles/cn.tsx +0 -21
- package/src/styles/core.css +0 -12
- package/src/styles/fetchTheme.test.ts +0 -390
- package/src/styles/fetchTheme.ts +0 -88
- package/src/styles/generatePalette.ts +0 -111
- package/src/styles/reset.css +0 -65
- package/src/styles/resolveCssVariableToHex.ts +0 -28
- package/src/styles/tailwind.css +0 -291
- package/src/styles/themeTypes.ts +0 -18
- package/src/styles/tokens/colors.css +0 -190
- package/src/styles/tokens/components.css +0 -174
- package/src/styles/tokens/index.css +0 -4
- package/src/styles/tokens/primitives.css +0 -129
- package/src/styles/tokens/semantic.css +0 -51
- package/src/svg.d.ts +0 -4
- package/src/types/assets.d.ts +0 -1
- package/src/types/custom-elements.d.ts +0 -104
- package/tsconfig.json +0 -22
- package/vite.config.ts +0 -260
- package/vitest.config.ts +0 -40
- package/vitest.setup.ts +0 -16
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'preact/compat';
|
|
2
|
-
import { useId } from 'preact/hooks';
|
|
3
|
-
import './loadingBorder.css';
|
|
4
|
-
import { cn } from '@/styles/cn';
|
|
5
|
-
|
|
6
|
-
export type BorderState =
|
|
7
|
-
| 'idle'
|
|
8
|
-
| 'loading'
|
|
9
|
-
| 'capturing'
|
|
10
|
-
| 'success'
|
|
11
|
-
| 'error';
|
|
12
|
-
|
|
13
|
-
type LoadingBorderProps = {
|
|
14
|
-
borderState?: BorderState;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const getColor = (borderState: BorderState): string => {
|
|
18
|
-
switch (borderState) {
|
|
19
|
-
case 'success':
|
|
20
|
-
case 'capturing':
|
|
21
|
-
return 'var(--surface-status-positive-600)';
|
|
22
|
-
case 'loading':
|
|
23
|
-
return 'var(--surface-brand-500)';
|
|
24
|
-
case 'error':
|
|
25
|
-
return 'var(--surface-status-negative-600)';
|
|
26
|
-
case 'idle':
|
|
27
|
-
return 'var(--surface-neutral-100)';
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const LoadingBorder: FC<LoadingBorderProps> = ({
|
|
32
|
-
borderState = 'idle',
|
|
33
|
-
}) => {
|
|
34
|
-
const gradientId = useId();
|
|
35
|
-
const isLoadingOrCapturing =
|
|
36
|
-
borderState === 'loading' || borderState === 'capturing';
|
|
37
|
-
const color = getColor(borderState);
|
|
38
|
-
const fill = isLoadingOrCapturing ? `url(#${gradientId})` : color;
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div
|
|
42
|
-
class={cn('IncodeLoadingBorder', {
|
|
43
|
-
IncodeLoadingBorderSpinning: isLoadingOrCapturing,
|
|
44
|
-
})}
|
|
45
|
-
>
|
|
46
|
-
<svg
|
|
47
|
-
width="100%"
|
|
48
|
-
height="100%"
|
|
49
|
-
viewBox="0 0 335 335"
|
|
50
|
-
fill="none"
|
|
51
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
52
|
-
>
|
|
53
|
-
<title>Loading Border</title>
|
|
54
|
-
<path
|
|
55
|
-
fill-rule="evenodd"
|
|
56
|
-
clip-rule="evenodd"
|
|
57
|
-
d="M335 167.5C335 260.008 260.008 335 167.5 335C74.9923 335 0 260.008 0 167.5C0 74.9923 74.9923 0 167.5 0C260.008 0 335 74.9923 335 167.5ZM167.5 325C254.485 325 325 254.485 325 167.5C325 80.5152 254.485 10 167.5 10C80.5152 10 10 80.5152 10 167.5C10 254.485 80.5152 325 167.5 325Z"
|
|
58
|
-
class="IncodeLoadingBorderPath"
|
|
59
|
-
fill={fill}
|
|
60
|
-
/>
|
|
61
|
-
<defs>
|
|
62
|
-
<radialGradient
|
|
63
|
-
id={gradientId}
|
|
64
|
-
cx="0"
|
|
65
|
-
cy="0"
|
|
66
|
-
r="1"
|
|
67
|
-
gradientUnits="userSpaceOnUse"
|
|
68
|
-
gradientTransform="translate(240.418 17.4369) rotate(115.674) scale(167.087)"
|
|
69
|
-
>
|
|
70
|
-
<stop stop-color={color} />
|
|
71
|
-
<stop offset="1" stop-color={color} stop-opacity="0" />
|
|
72
|
-
</radialGradient>
|
|
73
|
-
</defs>
|
|
74
|
-
</svg>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
@reference "../styles/tailwind.css";
|
|
2
|
-
|
|
3
|
-
.IncodeManualCaptureButton {
|
|
4
|
-
@apply flex flex-col items-center gap-16 max-w-[275px];
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.IncodeManualCaptureButtonText {
|
|
8
|
-
@apply text-center text-base font-medium leading-[1.14] text-text-body-primary;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.IncodeManualCaptureButtonButton {
|
|
12
|
-
@apply p-0;
|
|
13
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'preact/compat';
|
|
2
|
-
import { useTranslation } from '@/i18n';
|
|
3
|
-
import { Button } from '@/shared/button/button';
|
|
4
|
-
import { CameraButton } from './cameraButton';
|
|
5
|
-
import './manualCaptureButton.css';
|
|
6
|
-
|
|
7
|
-
type ManualCaptureButtonProps = {
|
|
8
|
-
onClick: () => void;
|
|
9
|
-
disabled: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const ManualCaptureButton: FC<ManualCaptureButtonProps> = ({
|
|
13
|
-
onClick,
|
|
14
|
-
disabled,
|
|
15
|
-
}) => {
|
|
16
|
-
const { t } = useTranslation();
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div class="IncodeManualCaptureButton" data-testid="manual-capture-button">
|
|
20
|
-
<p class="IncodeManualCaptureButtonText">
|
|
21
|
-
{t('selfiev2.manualCapture.instructions')}
|
|
22
|
-
</p>
|
|
23
|
-
<div>
|
|
24
|
-
<Button
|
|
25
|
-
variant="link"
|
|
26
|
-
onClick={onClick}
|
|
27
|
-
disabled={disabled}
|
|
28
|
-
class="IncodeManualCaptureButtonButton"
|
|
29
|
-
>
|
|
30
|
-
<CameraButton />
|
|
31
|
-
</Button>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'preact/compat';
|
|
2
|
-
import { useTranslation } from '@/i18n';
|
|
3
|
-
import { ErrorModalContent } from './errorModalContent';
|
|
4
|
-
|
|
5
|
-
const ErrorIcon = () => (
|
|
6
|
-
<svg
|
|
7
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
-
width="32"
|
|
9
|
-
height="32"
|
|
10
|
-
viewBox="0 0 32 32"
|
|
11
|
-
fill="none"
|
|
12
|
-
>
|
|
13
|
-
<title>Error</title>
|
|
14
|
-
<path
|
|
15
|
-
d="M16 0C24.8219 0 32 7.17642 32 16C32 24.8219 24.8219 32 16 32C7.17811 32 0 24.8219 0 16C0 7.17642 7.17811 0 16 0ZM13.1553 11.3701C12.6618 10.8767 11.8636 10.8767 11.3701 11.3701C10.8767 11.8636 10.8767 12.6618 11.3701 13.1553L14.4053 16.1924L11.3721 19.2256C10.8803 19.7191 10.8803 20.5173 11.3721 21.0107C11.8656 21.504 12.6658 21.5041 13.1592 21.0107L16.1924 17.9775L19.2334 21.0205C19.481 21.2664 19.8029 21.3916 20.1279 21.3916C20.4513 21.3916 20.7746 21.2664 21.0205 21.0205C21.514 20.527 21.514 19.7269 21.0205 19.2334L17.9775 16.1924L21.0107 13.1572C21.5041 12.6638 21.504 11.8639 21.0107 11.3721C20.5173 10.8786 19.7191 10.8786 19.2256 11.3721L16.1904 14.4053L13.1553 11.3701Z"
|
|
16
|
-
fill="var(--surface-status-negative-600)"
|
|
17
|
-
/>
|
|
18
|
-
</svg>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
type NoMoreAttemptsModalProps = {
|
|
22
|
-
title: string;
|
|
23
|
-
onContinue: () => void;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const NoMoreAttemptsModal: FC<NoMoreAttemptsModalProps> = ({
|
|
27
|
-
title,
|
|
28
|
-
onContinue,
|
|
29
|
-
}) => {
|
|
30
|
-
const { t } = useTranslation();
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<ErrorModalContent
|
|
34
|
-
title={title}
|
|
35
|
-
description={t('notifications.selfieCaptureFailedDescription')}
|
|
36
|
-
attemptsText={
|
|
37
|
-
t('notifications.noAttemptsRemaining') ?? 'No attempts remaining'
|
|
38
|
-
}
|
|
39
|
-
buttonText={t('common.continue') ?? 'Continue'}
|
|
40
|
-
icon={<ErrorIcon />}
|
|
41
|
-
onButtonClick={onContinue}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { DetectionStatus } from '@incodetech/core/selfie';
|
|
2
|
-
import type { FC } from 'preact/compat';
|
|
3
|
-
import { useTranslation } from '@/i18n';
|
|
4
|
-
import './notification.css';
|
|
5
|
-
|
|
6
|
-
type NotificationProps = {
|
|
7
|
-
detectionState: DetectionStatus;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const Notification: FC<NotificationProps> = ({ detectionState }) => {
|
|
11
|
-
const { t } = useTranslation();
|
|
12
|
-
const notificationTexts: Partial<Record<DetectionStatus, string>> = {
|
|
13
|
-
noFace: t('notifications.faceNotFound'),
|
|
14
|
-
tooManyFaces: t('notifications.tooManyFaces'),
|
|
15
|
-
tooClose: t('notifications.moveAway'),
|
|
16
|
-
tooFar: t('notifications.moveCloser'),
|
|
17
|
-
blur: t('notifications.onBlur'),
|
|
18
|
-
dark: t('notifications.onDark'),
|
|
19
|
-
faceAngle: t('notifications.onFaceAngleV2'),
|
|
20
|
-
headWear: t('notifications.removeHeadwear'),
|
|
21
|
-
lenses: t('notifications.removeLenses'),
|
|
22
|
-
eyesClosed: t('notifications.eyesClosed'),
|
|
23
|
-
faceMask: t('notifications.mask'),
|
|
24
|
-
centerFace: t('notifications.centerFaceV2'),
|
|
25
|
-
getReady: t('notifications.getReady'),
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const text = notificationTexts[detectionState];
|
|
29
|
-
if (!text) return null;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div class="IncodeNotification">
|
|
33
|
-
<p class="IncodeNotificationText">{text}</p>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'preact/compat';
|
|
2
|
-
import { useTranslation } from '@/i18n';
|
|
3
|
-
import { ErrorModalContent } from './errorModalContent';
|
|
4
|
-
|
|
5
|
-
const WarningIcon = () => (
|
|
6
|
-
<svg
|
|
7
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
-
width="32"
|
|
9
|
-
height="32"
|
|
10
|
-
viewBox="0 0 32 32"
|
|
11
|
-
fill="none"
|
|
12
|
-
>
|
|
13
|
-
<title>Warning</title>
|
|
14
|
-
<g clipPath="url(#clip0)">
|
|
15
|
-
<path
|
|
16
|
-
d="M16 0C24.848 0 32 7.1696 32 16C32 24.8336 24.848 32 16 32C7.168 32 0 24.8336 0 16C0 7.1696 7.168 0 16 0ZM16 20.6896C15.232 20.6896 14.608 21.3136 14.608 22.0816C14.608 22.8496 15.232 23.4896 16.016 23.4896C16.784 23.4896 17.408 22.8496 17.408 22.0816C17.408 21.3136 16.784 20.6896 16 20.6896ZM16 8.528C15.232 8.528 14.592 9.1696 14.592 9.936V17.008C14.592 17.7776 15.232 18.4 16 18.4C16.768 18.4 17.392 17.7776 17.392 17.008V9.936C17.392 9.1696 16.768 8.528 16 8.528Z"
|
|
17
|
-
fill="var(--surface-status-warning-500)"
|
|
18
|
-
/>
|
|
19
|
-
</g>
|
|
20
|
-
<defs>
|
|
21
|
-
<clipPath id="clip0">
|
|
22
|
-
<rect width="32" height="32" fill="white" />
|
|
23
|
-
</clipPath>
|
|
24
|
-
</defs>
|
|
25
|
-
</svg>
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
type RetryErrorModalProps = {
|
|
29
|
-
title: string;
|
|
30
|
-
description: string;
|
|
31
|
-
attemptsRemaining: number;
|
|
32
|
-
onTryAgain: () => void;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const RetryErrorModal: FC<RetryErrorModalProps> = ({
|
|
36
|
-
title,
|
|
37
|
-
description,
|
|
38
|
-
attemptsRemaining,
|
|
39
|
-
onTryAgain,
|
|
40
|
-
}) => {
|
|
41
|
-
const { t } = useTranslation();
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<ErrorModalContent
|
|
45
|
-
title={title}
|
|
46
|
-
description={t(description)}
|
|
47
|
-
attemptsText={
|
|
48
|
-
t('common.attemptsRemaining', { count: attemptsRemaining }) ??
|
|
49
|
-
`Attempts remaining: ${attemptsRemaining}`
|
|
50
|
-
}
|
|
51
|
-
buttonText={t('common.tryAgain') ?? 'Try Again'}
|
|
52
|
-
icon={<WarningIcon />}
|
|
53
|
-
onButtonClick={onTryAgain}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
};
|