@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,139 +0,0 @@
|
|
|
1
|
-
import { type CountryCode, getCountryCallingCode } from 'libphonenumber-js';
|
|
2
|
-
|
|
3
|
-
export type CountryData = {
|
|
4
|
-
code: CountryCode;
|
|
5
|
-
emoji: string;
|
|
6
|
-
name: string;
|
|
7
|
-
callingCode: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const countryDefinitions: Partial<
|
|
11
|
-
Record<CountryCode, { emoji: string; name: string }>
|
|
12
|
-
> = {
|
|
13
|
-
MX: { emoji: '🇲🇽', name: 'Mexico' },
|
|
14
|
-
US: { emoji: '🇺🇸', name: 'United States' },
|
|
15
|
-
CA: { emoji: '🇨🇦', name: 'Canada' },
|
|
16
|
-
GB: { emoji: '🇬🇧', name: 'United Kingdom' },
|
|
17
|
-
DE: { emoji: '🇩🇪', name: 'Germany' },
|
|
18
|
-
FR: { emoji: '🇫🇷', name: 'France' },
|
|
19
|
-
ES: { emoji: '🇪🇸', name: 'Spain' },
|
|
20
|
-
IT: { emoji: '🇮🇹', name: 'Italy' },
|
|
21
|
-
BR: { emoji: '🇧🇷', name: 'Brazil' },
|
|
22
|
-
AR: { emoji: '🇦🇷', name: 'Argentina' },
|
|
23
|
-
CO: { emoji: '🇨🇴', name: 'Colombia' },
|
|
24
|
-
CL: { emoji: '🇨🇱', name: 'Chile' },
|
|
25
|
-
PE: { emoji: '🇵🇪', name: 'Peru' },
|
|
26
|
-
AU: { emoji: '🇦🇺', name: 'Australia' },
|
|
27
|
-
NZ: { emoji: '🇳🇿', name: 'New Zealand' },
|
|
28
|
-
JP: { emoji: '🇯🇵', name: 'Japan' },
|
|
29
|
-
KR: { emoji: '🇰🇷', name: 'South Korea' },
|
|
30
|
-
CN: { emoji: '🇨🇳', name: 'China' },
|
|
31
|
-
IN: { emoji: '🇮🇳', name: 'India' },
|
|
32
|
-
RU: { emoji: '🇷🇺', name: 'Russia' },
|
|
33
|
-
ZA: { emoji: '🇿🇦', name: 'South Africa' },
|
|
34
|
-
NG: { emoji: '🇳🇬', name: 'Nigeria' },
|
|
35
|
-
EG: { emoji: '🇪🇬', name: 'Egypt' },
|
|
36
|
-
AE: { emoji: '🇦🇪', name: 'United Arab Emirates' },
|
|
37
|
-
SA: { emoji: '🇸🇦', name: 'Saudi Arabia' },
|
|
38
|
-
IL: { emoji: '🇮🇱', name: 'Israel' },
|
|
39
|
-
TR: { emoji: '🇹🇷', name: 'Turkey' },
|
|
40
|
-
NL: { emoji: '🇳🇱', name: 'Netherlands' },
|
|
41
|
-
BE: { emoji: '🇧🇪', name: 'Belgium' },
|
|
42
|
-
CH: { emoji: '🇨🇭', name: 'Switzerland' },
|
|
43
|
-
AT: { emoji: '🇦🇹', name: 'Austria' },
|
|
44
|
-
SE: { emoji: '🇸🇪', name: 'Sweden' },
|
|
45
|
-
NO: { emoji: '🇳🇴', name: 'Norway' },
|
|
46
|
-
DK: { emoji: '🇩🇰', name: 'Denmark' },
|
|
47
|
-
FI: { emoji: '🇫🇮', name: 'Finland' },
|
|
48
|
-
PL: { emoji: '🇵🇱', name: 'Poland' },
|
|
49
|
-
PT: { emoji: '🇵🇹', name: 'Portugal' },
|
|
50
|
-
IE: { emoji: '🇮🇪', name: 'Ireland' },
|
|
51
|
-
GR: { emoji: '🇬🇷', name: 'Greece' },
|
|
52
|
-
CZ: { emoji: '🇨🇿', name: 'Czechia' },
|
|
53
|
-
HU: { emoji: '🇭🇺', name: 'Hungary' },
|
|
54
|
-
RO: { emoji: '🇷🇴', name: 'Romania' },
|
|
55
|
-
UA: { emoji: '🇺🇦', name: 'Ukraine' },
|
|
56
|
-
PH: { emoji: '🇵🇭', name: 'Philippines' },
|
|
57
|
-
ID: { emoji: '🇮🇩', name: 'Indonesia' },
|
|
58
|
-
MY: { emoji: '🇲🇾', name: 'Malaysia' },
|
|
59
|
-
SG: { emoji: '🇸🇬', name: 'Singapore' },
|
|
60
|
-
TH: { emoji: '🇹🇭', name: 'Thailand' },
|
|
61
|
-
VN: { emoji: '🇻🇳', name: 'Vietnam' },
|
|
62
|
-
PK: { emoji: '🇵🇰', name: 'Pakistan' },
|
|
63
|
-
BD: { emoji: '🇧🇩', name: 'Bangladesh' },
|
|
64
|
-
HK: { emoji: '🇭🇰', name: 'Hong Kong' },
|
|
65
|
-
TW: { emoji: '🇹🇼', name: 'Taiwan' },
|
|
66
|
-
VE: { emoji: '🇻🇪', name: 'Venezuela' },
|
|
67
|
-
EC: { emoji: '🇪🇨', name: 'Ecuador' },
|
|
68
|
-
GT: { emoji: '🇬🇹', name: 'Guatemala' },
|
|
69
|
-
CR: { emoji: '🇨🇷', name: 'Costa Rica' },
|
|
70
|
-
PA: { emoji: '🇵🇦', name: 'Panama' },
|
|
71
|
-
DO: { emoji: '🇩🇴', name: 'Dominican Republic' },
|
|
72
|
-
PR: { emoji: '🇵🇷', name: 'Puerto Rico' },
|
|
73
|
-
CU: { emoji: '🇨🇺', name: 'Cuba' },
|
|
74
|
-
JM: { emoji: '🇯🇲', name: 'Jamaica' },
|
|
75
|
-
HN: { emoji: '🇭🇳', name: 'Honduras' },
|
|
76
|
-
SV: { emoji: '🇸🇻', name: 'El Salvador' },
|
|
77
|
-
NI: { emoji: '🇳🇮', name: 'Nicaragua' },
|
|
78
|
-
BO: { emoji: '🇧🇴', name: 'Bolivia' },
|
|
79
|
-
PY: { emoji: '🇵🇾', name: 'Paraguay' },
|
|
80
|
-
UY: { emoji: '🇺🇾', name: 'Uruguay' },
|
|
81
|
-
KE: { emoji: '🇰🇪', name: 'Kenya' },
|
|
82
|
-
GH: { emoji: '🇬🇭', name: 'Ghana' },
|
|
83
|
-
MA: { emoji: '🇲🇦', name: 'Morocco' },
|
|
84
|
-
TN: { emoji: '🇹🇳', name: 'Tunisia' },
|
|
85
|
-
KW: { emoji: '🇰🇼', name: 'Kuwait' },
|
|
86
|
-
QA: { emoji: '🇶🇦', name: 'Qatar' },
|
|
87
|
-
BH: { emoji: '🇧🇭', name: 'Bahrain' },
|
|
88
|
-
OM: { emoji: '🇴🇲', name: 'Oman' },
|
|
89
|
-
JO: { emoji: '🇯🇴', name: 'Jordan' },
|
|
90
|
-
LB: { emoji: '🇱🇧', name: 'Lebanon' },
|
|
91
|
-
RS: { emoji: '🇷🇸', name: 'Serbia' },
|
|
92
|
-
HR: { emoji: '🇭🇷', name: 'Croatia' },
|
|
93
|
-
SK: { emoji: '🇸🇰', name: 'Slovakia' },
|
|
94
|
-
SI: { emoji: '🇸🇮', name: 'Slovenia' },
|
|
95
|
-
BG: { emoji: '🇧🇬', name: 'Bulgaria' },
|
|
96
|
-
LT: { emoji: '🇱🇹', name: 'Lithuania' },
|
|
97
|
-
LV: { emoji: '🇱🇻', name: 'Latvia' },
|
|
98
|
-
EE: { emoji: '🇪🇪', name: 'Estonia' },
|
|
99
|
-
IS: { emoji: '🇮🇸', name: 'Iceland' },
|
|
100
|
-
LU: { emoji: '🇱🇺', name: 'Luxembourg' },
|
|
101
|
-
MT: { emoji: '🇲🇹', name: 'Malta' },
|
|
102
|
-
CY: { emoji: '🇨🇾', name: 'Cyprus' },
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
function getCallingCode(code: CountryCode): string {
|
|
106
|
-
try {
|
|
107
|
-
return `+${getCountryCallingCode(code)}`;
|
|
108
|
-
} catch {
|
|
109
|
-
return '';
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export const countries: CountryData[] = Object.entries(countryDefinitions)
|
|
114
|
-
.map(([code, data]) => ({
|
|
115
|
-
code: code as CountryCode,
|
|
116
|
-
emoji: data.emoji,
|
|
117
|
-
name: data.name,
|
|
118
|
-
callingCode: getCallingCode(code as CountryCode),
|
|
119
|
-
}))
|
|
120
|
-
.filter((c) => c.callingCode !== '')
|
|
121
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
122
|
-
|
|
123
|
-
export function getCountryByCode(
|
|
124
|
-
code: string | undefined,
|
|
125
|
-
): CountryData | undefined {
|
|
126
|
-
if (!code) return undefined;
|
|
127
|
-
return countries.find(
|
|
128
|
-
(c) => c.code === code || c.code === code.toUpperCase(),
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export function getCountryByCallingCode(
|
|
133
|
-
callingCode: string,
|
|
134
|
-
): CountryData | undefined {
|
|
135
|
-
const normalized = callingCode.startsWith('+')
|
|
136
|
-
? callingCode
|
|
137
|
-
: `+${callingCode}`;
|
|
138
|
-
return countries.find((c) => c.callingCode === normalized);
|
|
139
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'preact/compat';
|
|
2
|
-
|
|
3
|
-
type ChevronDownProps = {
|
|
4
|
-
class?: string;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const ChevronDown: FC<ChevronDownProps> = ({ class: className }) => (
|
|
8
|
-
<svg
|
|
9
|
-
width="24"
|
|
10
|
-
height="24"
|
|
11
|
-
viewBox="0 0 24 24"
|
|
12
|
-
fill="none"
|
|
13
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
-
class={className}
|
|
15
|
-
aria-hidden="true"
|
|
16
|
-
>
|
|
17
|
-
<path
|
|
18
|
-
d="M4.76734 9.18066C4.39163 8.77605 4.41468 8.14342 4.8191 7.76758C5.22371 7.39187 5.85635 7.41491 6.23219 7.81934L11.9998 14.0312L17.7673 7.81934L17.8406 7.74805C18.2212 7.41355 18.8011 7.41532 19.1804 7.76758C19.5849 8.14341 19.6079 8.77605 19.2322 9.18066L12.7322 16.1807C12.543 16.3842 12.2777 16.5 11.9998 16.5C11.7218 16.5 11.4565 16.3842 11.2673 16.1807L4.76734 9.18066Z"
|
|
19
|
-
fill="currentColor"
|
|
20
|
-
/>
|
|
21
|
-
</svg>
|
|
22
|
-
);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/preact';
|
|
2
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
-
import { SuccessIcon } from './successIcon';
|
|
4
|
-
|
|
5
|
-
vi.mock('./successIcon.css', () => ({}));
|
|
6
|
-
|
|
7
|
-
describe('SuccessIcon', () => {
|
|
8
|
-
it('renders with default size', () => {
|
|
9
|
-
const { container } = render(<SuccessIcon />);
|
|
10
|
-
const svg = container.querySelector('svg');
|
|
11
|
-
expect(svg?.getAttribute('width')).toBe('64');
|
|
12
|
-
expect(svg?.getAttribute('height')).toBe('64');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('renders with custom number size', () => {
|
|
16
|
-
const { container } = render(<SuccessIcon size={32} />);
|
|
17
|
-
const svg = container.querySelector('svg');
|
|
18
|
-
expect(svg?.getAttribute('width')).toBe('32');
|
|
19
|
-
expect(svg?.getAttribute('height')).toBe('32');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('renders with custom string size', () => {
|
|
23
|
-
const { container } = render(<SuccessIcon size="48px" />);
|
|
24
|
-
const svg = container.querySelector('svg');
|
|
25
|
-
expect(svg?.getAttribute('width')).toBe('48px');
|
|
26
|
-
expect(svg?.getAttribute('height')).toBe('48px');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('has IncodeSuccessIcon class', () => {
|
|
30
|
-
const { container } = render(<SuccessIcon />);
|
|
31
|
-
const svg = container.querySelector('.IncodeSuccessIcon');
|
|
32
|
-
expect(svg).toBeTruthy();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('has aria-hidden attribute', () => {
|
|
36
|
-
const { container } = render(<SuccessIcon />);
|
|
37
|
-
const svg = container.querySelector('svg');
|
|
38
|
-
expect(svg?.getAttribute('aria-hidden')).toBe('true');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'preact/compat';
|
|
2
|
-
import './successIcon.css';
|
|
3
|
-
|
|
4
|
-
type SuccessIconProps = {
|
|
5
|
-
size?: number | string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const SuccessIcon: FC<SuccessIconProps> = ({ size = 64 }) => {
|
|
9
|
-
return (
|
|
10
|
-
<svg
|
|
11
|
-
width={size}
|
|
12
|
-
height={size}
|
|
13
|
-
viewBox="0 0 16 17"
|
|
14
|
-
fill="none"
|
|
15
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
-
class="IncodeSuccessIcon"
|
|
17
|
-
aria-hidden="true"
|
|
18
|
-
>
|
|
19
|
-
<title>status</title>
|
|
20
|
-
<path
|
|
21
|
-
d="M8 0.5C12.4182 0.500064 16 4.0818 16 8.5C16 12.9182 12.4181 16.4999 8 16.5C3.58181 16.5 3.68521e-05 12.9182 0 8.5C0 4.08176 3.58179 0.5 8 0.5ZM11.1748 6.11621C10.9423 5.88373 10.5747 5.86781 10.3242 6.06934L10.3203 6.07324L10.2764 6.1123L6.85742 9.53125L5.72656 8.40039C5.47758 8.1514 5.0732 8.1514 4.82422 8.40039C4.59169 8.63292 4.57673 9.00038 4.77832 9.25098L4.78125 9.25488L4.82031 9.29883L6.40625 10.8848C6.63867 11.117 7.00542 11.1319 7.25586 10.9307L7.26074 10.9277L7.30371 10.8877L11.1748 7.01758C11.4235 6.76863 11.4234 6.36521 11.1748 6.11621Z"
|
|
22
|
-
fill="var(--icon-status-positive-static)"
|
|
23
|
-
/>
|
|
24
|
-
</svg>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
@reference "../../styles/tailwind.css";
|
|
2
|
-
|
|
3
|
-
.IncodeLoadingIcon {
|
|
4
|
-
@apply relative inline-block animate-spin;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.IncodeLoadingIconPrimary {
|
|
8
|
-
@apply absolute inset-0 flex items-center justify-center;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.IncodeLoadingIconSecondary {
|
|
12
|
-
@apply absolute inset-0 flex items-center justify-center;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.IncodeLoadingIconPrimaryIcon {
|
|
16
|
-
@apply fill-spinner-surface-primary;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.IncodeLoadingIconSecondaryIcon {
|
|
20
|
-
@apply fill-spinner-surface-secondary;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.IncodeCaptureUploadingIconContainer {
|
|
24
|
-
@apply flex items-center justify-center;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* primaryColor={tokens.button.primary.text.default}
|
|
28
|
-
secondaryColor={tokens.color.surface.primary['400']} */
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { cn } from '@/styles/cn';
|
|
2
|
-
import './loadingIcon.css';
|
|
3
|
-
|
|
4
|
-
type LoadingIconProps = {
|
|
5
|
-
size?: number;
|
|
6
|
-
primaryClass?: string;
|
|
7
|
-
secondaryClass?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const SpinnerPrimary = ({
|
|
11
|
-
size,
|
|
12
|
-
className,
|
|
13
|
-
}: {
|
|
14
|
-
size: number;
|
|
15
|
-
className?: string;
|
|
16
|
-
}) => {
|
|
17
|
-
return (
|
|
18
|
-
<svg
|
|
19
|
-
width={size}
|
|
20
|
-
height={size}
|
|
21
|
-
viewBox="0 0 31 31"
|
|
22
|
-
fill="none"
|
|
23
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
-
class={cn('IncodeLoadingIconPrimaryIcon', className)}
|
|
25
|
-
>
|
|
26
|
-
<title>Spinner Inner part</title>
|
|
27
|
-
<path d="M28.1614 15.2837C29.453 15.2837 30.5186 14.2304 30.3181 12.9545C30.1344 11.7862 29.8129 10.6411 29.3582 9.54344C28.6044 7.72356 27.4995 6.06997 26.1066 4.67709C24.7137 3.28421 23.0601 2.17932 21.2403 1.4255C20.1426 0.970841 18.9974 0.649265 17.8292 0.46563C16.5533 0.265073 15.5 1.33073 15.5 2.62232C15.5 3.91391 16.5601 4.93461 17.8187 5.22473C18.3748 5.35291 18.9206 5.52729 19.4503 5.74672C20.7028 6.26548 21.8407 7.02585 22.7993 7.98441C23.7578 8.94296 24.5182 10.0809 25.037 11.3333C25.2564 11.8631 25.4308 12.4089 25.559 12.965C25.8491 14.2236 26.8698 15.2837 28.1614 15.2837Z" />
|
|
28
|
-
</svg>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const SpinnerSecondary = ({
|
|
33
|
-
size,
|
|
34
|
-
className,
|
|
35
|
-
}: {
|
|
36
|
-
size: number;
|
|
37
|
-
className?: string;
|
|
38
|
-
}) => {
|
|
39
|
-
return (
|
|
40
|
-
<svg
|
|
41
|
-
width={size}
|
|
42
|
-
height={size}
|
|
43
|
-
viewBox="0 0 31 31"
|
|
44
|
-
fill="none"
|
|
45
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
46
|
-
class={cn('IncodeLoadingIconSecondaryIcon', className)}
|
|
47
|
-
>
|
|
48
|
-
<title>Spinner Outer part</title>
|
|
49
|
-
<path d="M30.5 15.2837C30.5 23.568 23.7843 30.2837 15.5 30.2837C7.21573 30.2837 0.5 23.568 0.5 15.2837C0.5 6.99942 7.21573 0.283691 15.5 0.283691C23.7843 0.283691 30.5 6.99942 30.5 15.2837ZM5.17725 15.2837C5.17725 20.9848 9.7989 25.6064 15.5 25.6064C21.2011 25.6064 25.8227 20.9848 25.8227 15.2837C25.8227 9.5826 21.2011 4.96095 15.5 4.96095C9.7989 4.96095 5.17725 9.5826 5.17725 15.2837Z" />
|
|
50
|
-
</svg>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const LoadingIcon = ({
|
|
55
|
-
size = 30,
|
|
56
|
-
secondaryClass,
|
|
57
|
-
primaryClass,
|
|
58
|
-
}: LoadingIconProps) => {
|
|
59
|
-
return (
|
|
60
|
-
<div class="IncodeLoadingIcon">
|
|
61
|
-
<SpinnerSecondary size={size} className={secondaryClass} />
|
|
62
|
-
<div class="IncodeLoadingIconPrimary">
|
|
63
|
-
<SpinnerPrimary size={size} className={primaryClass} />
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'preact';
|
|
2
|
-
import { useEffect, useRef } from 'preact/hooks';
|
|
3
|
-
|
|
4
|
-
export type LottieAnimationData = {
|
|
5
|
-
fr: number;
|
|
6
|
-
v: string;
|
|
7
|
-
ip: number;
|
|
8
|
-
op: number;
|
|
9
|
-
w: number;
|
|
10
|
-
h: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type LottieInstance = {
|
|
14
|
-
loadAnimation: (options: {
|
|
15
|
-
container: HTMLElement | null;
|
|
16
|
-
renderer: string;
|
|
17
|
-
loop: boolean;
|
|
18
|
-
autoplay: boolean;
|
|
19
|
-
animationData: LottieAnimationData;
|
|
20
|
-
}) => {
|
|
21
|
-
addEventListener: (event: string, callback: () => void) => void;
|
|
22
|
-
removeEventListener: (event: string, callback: () => void) => void;
|
|
23
|
-
destroy: () => void;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
declare global {
|
|
28
|
-
interface Window {
|
|
29
|
-
lottie: LottieInstance;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let lottiePromise: Promise<LottieInstance> | null = null;
|
|
34
|
-
function loadLottie() {
|
|
35
|
-
if (lottiePromise) return lottiePromise;
|
|
36
|
-
|
|
37
|
-
lottiePromise = new Promise((resolve, reject) => {
|
|
38
|
-
const script = document.createElement('script');
|
|
39
|
-
script.src =
|
|
40
|
-
'https://cdn.jsdelivr.net/npm/lottie-web@5.13.0/build/player/lottie_light.min.js';
|
|
41
|
-
script.onload = () => resolve(window.lottie);
|
|
42
|
-
script.onerror = reject;
|
|
43
|
-
document.head.appendChild(script);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return lottiePromise;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
type LottieProps = {
|
|
50
|
-
animationData: LottieAnimationData;
|
|
51
|
-
loop?: boolean;
|
|
52
|
-
autoplay?: boolean;
|
|
53
|
-
style?: CSSProperties;
|
|
54
|
-
className?: string;
|
|
55
|
-
onComplete?: () => void;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export function Lottie({
|
|
59
|
-
animationData,
|
|
60
|
-
loop = true,
|
|
61
|
-
autoplay = true,
|
|
62
|
-
style,
|
|
63
|
-
className,
|
|
64
|
-
onComplete,
|
|
65
|
-
}: LottieProps) {
|
|
66
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
67
|
-
const animationOptionsRef = useRef({
|
|
68
|
-
container: containerRef.current,
|
|
69
|
-
renderer: 'svg',
|
|
70
|
-
loop,
|
|
71
|
-
autoplay,
|
|
72
|
-
animationData,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
animationOptionsRef.current = {
|
|
77
|
-
container: containerRef.current,
|
|
78
|
-
renderer: 'svg',
|
|
79
|
-
loop,
|
|
80
|
-
autoplay,
|
|
81
|
-
animationData,
|
|
82
|
-
};
|
|
83
|
-
}, [animationData, loop, autoplay]);
|
|
84
|
-
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
if (!containerRef.current) return;
|
|
87
|
-
|
|
88
|
-
let anim: ReturnType<LottieInstance['loadAnimation']>;
|
|
89
|
-
|
|
90
|
-
loadLottie().then((lottie) => {
|
|
91
|
-
anim = lottie.loadAnimation(animationOptionsRef.current);
|
|
92
|
-
if (onComplete) {
|
|
93
|
-
anim.addEventListener('complete', onComplete);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
return () => {
|
|
98
|
-
if (anim) {
|
|
99
|
-
if (onComplete) {
|
|
100
|
-
anim.removeEventListener('complete', onComplete);
|
|
101
|
-
}
|
|
102
|
-
anim.destroy();
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}, [onComplete]);
|
|
106
|
-
|
|
107
|
-
return <div ref={containerRef} style={style} className={className} />;
|
|
108
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
@reference "../../styles/tailwind.css";
|
|
2
|
-
|
|
3
|
-
.IncodeOtpInput {
|
|
4
|
-
@apply flex flex-col items-center w-full flex-1;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.IncodeOtpInputContainer {
|
|
8
|
-
@apply flex flex-col items-center w-full;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/* Individual digit boxes container */
|
|
12
|
-
.IncodeOtpInputBoxes {
|
|
13
|
-
@apply flex justify-center gap-4 max-w-full;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@media (min-width: 400px) {
|
|
17
|
-
.IncodeOtpInputBoxes {
|
|
18
|
-
@apply gap-12;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* Individual digit box - base styles (must come before higher specificity selectors) */
|
|
23
|
-
.IncodeOtpInputBox {
|
|
24
|
-
@apply w-[48px] h-[48px] shrink-0;
|
|
25
|
-
@apply text-center text-24 font-bold;
|
|
26
|
-
@apply border border-input-border-default rounded-small;
|
|
27
|
-
@apply bg-input-surface-default text-input-text-field-default;
|
|
28
|
-
@apply outline-none transition-colors duration-200;
|
|
29
|
-
font-family: inherit;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@media (min-width: 400px) {
|
|
33
|
-
.IncodeOtpInputBox {
|
|
34
|
-
@apply w-[56px] h-[56px];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/* Synchronized focus - when any input is focused, all show active styling */
|
|
39
|
-
.IncodeOtpInputBoxes:focus-within .IncodeOtpInputBox {
|
|
40
|
-
@apply border-2 border-input-border-active bg-input-surface-active;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* Error state for all boxes */
|
|
44
|
-
.IncodeOtpInputBoxes.IncodeOtpInputBoxesError .IncodeOtpInputBox {
|
|
45
|
-
@apply border-input-border-negative;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.IncodeOtpInputBox::placeholder {
|
|
49
|
-
@apply text-input-text-field-placeholder;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.IncodeOtpInputBox:disabled {
|
|
53
|
-
@apply bg-input-surface-disabled border-input-border-disabled;
|
|
54
|
-
@apply text-input-text-field-disabled cursor-not-allowed;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.IncodeOtpInputError {
|
|
58
|
-
@apply text-input-text-helper-negative text-14 text-center m-0 font-medium;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.IncodeOtpInputActions {
|
|
62
|
-
@apply flex flex-col items-center w-full;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.IncodeOtpInputTimer {
|
|
66
|
-
@apply text-text-body-tertiary text-18 m-0 font-normal text-center;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.IncodeOtpInputResendText {
|
|
70
|
-
@apply text-text-body-primary text-18 m-0 font-medium text-center;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.IncodeOtpInputLink {
|
|
74
|
-
@apply bg-transparent border-none p-0 m-0 cursor-pointer;
|
|
75
|
-
@apply text-button-primary-surface-default text-18 font-medium underline;
|
|
76
|
-
font-family: inherit;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.IncodeOtpInputLink:hover {
|
|
80
|
-
@apply text-button-primary-surface-default;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.IncodeOtpInputLink:disabled {
|
|
84
|
-
@apply text-text-body-tertiary cursor-not-allowed;
|
|
85
|
-
}
|