@incodetech/web 2.0.0-alpha.1 → 2.0.0-alpha.10
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/base.css +1071 -0
- package/dist/browser-ponyfill-B6W6hHVY.js +344 -0
- package/dist/email/email.es.js +145 -0
- package/dist/email/styles.css +123 -0
- package/dist/flow/flow.es.js +555 -0
- package/dist/flow/styles.css +1119 -0
- package/dist/incodeModule-Dv8Qllrv.js +254 -0
- package/dist/index.es.js +6 -0
- package/dist/instance-B-q0ZREN.js +2140 -0
- package/dist/otpInput-BtoZe0Wz.js +151 -0
- package/dist/page-Dh_Zw2ik.js +234 -0
- package/dist/phone/phone.es.js +3441 -0
- package/dist/phone/styles.css +305 -0
- package/dist/selfie/selfie.es.js +893 -0
- package/dist/selfie/styles.css +590 -0
- package/dist/selfieTutorial-C-u5GufD.js +29 -0
- package/dist/setup-wNL83jmW.js +20 -0
- package/dist/themes/dark.css +652 -0
- package/dist/themes/light.css +543 -0
- package/dist/title-BfO5Dlzk.js +25 -0
- package/dist/types/base.d.ts +1 -0
- package/dist/types/dark.d.ts +1 -0
- package/dist/types/email.d.ts +57 -0
- package/dist/types/flow.d.ts +69 -0
- package/dist/types/index.d.ts +38 -0
- package/dist/types/light.d.ts +1 -0
- package/dist/types/phone.d.ts +58 -0
- package/dist/types/selfie.d.ts +31 -0
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/themes/dark.d.ts +1 -0
- package/dist/types/themes/light.d.ts +1 -0
- package/dist/uiConfig-CQ1W9cUD.js +23 -0
- package/dist/vendor-preact-CK0WeTOR.js +584 -0
- package/package.json +32 -26
- 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,129 +0,0 @@
|
|
|
1
|
-
:root,
|
|
2
|
-
:host {
|
|
3
|
-
/* Color / Gray */
|
|
4
|
-
|
|
5
|
-
--primitive-color-gray-0: #ffffff;
|
|
6
|
-
--primitive-color-gray-0-80: rgba(255, 255, 255, 0.8);
|
|
7
|
-
--primitive-color-gray-50: #fcfcfd;
|
|
8
|
-
--primitive-color-gray-100: #ebecef;
|
|
9
|
-
--primitive-color-gray-200: #c6c8d2;
|
|
10
|
-
--primitive-color-gray-300: #a3a8b8;
|
|
11
|
-
--primitive-color-gray-500: #60667c;
|
|
12
|
-
--primitive-color-gray-700: #3a3e4b;
|
|
13
|
-
--primitive-color-gray-800: #262831;
|
|
14
|
-
--primitive-color-gray-900: #14151a;
|
|
15
|
-
--primitive-color-gray-900-80: rgba(20, 21, 26, 0.8);
|
|
16
|
-
--primitive-color-gray-1000: #000000;
|
|
17
|
-
--primitive-color-gray-1000-80: rgba(0, 0, 0, 0.8);
|
|
18
|
-
|
|
19
|
-
/* Color / Brand */
|
|
20
|
-
|
|
21
|
-
--primitive-color-brand-50: #e5f0ff;
|
|
22
|
-
--primitive-color-brand-200: #99ceff;
|
|
23
|
-
--primitive-color-brand-300: #66a6ff;
|
|
24
|
-
--primitive-color-brand-400: #3388ff;
|
|
25
|
-
--primitive-color-brand-500: #006aff;
|
|
26
|
-
--primitive-color-brand-600: #0055cc;
|
|
27
|
-
--primitive-color-brand-900: #21273b;
|
|
28
|
-
|
|
29
|
-
/* Color / Brand Secondary */
|
|
30
|
-
|
|
31
|
-
--primitive-color-brand-secondary-50: #f2e2fe;
|
|
32
|
-
--primitive-color-brand-secondary-500: #820ad1;
|
|
33
|
-
|
|
34
|
-
/* Color / Positive */
|
|
35
|
-
|
|
36
|
-
--primitive-color-positive-50: #e4fbf0;
|
|
37
|
-
--primitive-color-positive-600: #189f60;
|
|
38
|
-
--primitive-color-positive-800: #0c5030;
|
|
39
|
-
|
|
40
|
-
/* Color / Warning */
|
|
41
|
-
|
|
42
|
-
--primitive-color-warning-50: #fff7eb;
|
|
43
|
-
--primitive-color-warning-400: #ffb647;
|
|
44
|
-
--primitive-color-warning-500: #ff9900;
|
|
45
|
-
--primitive-color-warning-950: #523100;
|
|
46
|
-
|
|
47
|
-
/* Color / Negative */
|
|
48
|
-
|
|
49
|
-
--primitive-color-negative-50: #fff0f0;
|
|
50
|
-
--primitive-color-negative-500: #ff5a5f;
|
|
51
|
-
--primitive-color-negative-600: #e71111;
|
|
52
|
-
--primitive-color-negative-950: #240001;
|
|
53
|
-
|
|
54
|
-
/* Typography / Family */
|
|
55
|
-
--primitive-typography-family-rethink-sans: "Rethink Sans";
|
|
56
|
-
--primitive-typography-family-dm-sans: "DM Sans";
|
|
57
|
-
|
|
58
|
-
/* Typography / Size */
|
|
59
|
-
|
|
60
|
-
--primitive-typography-size-12: 12px;
|
|
61
|
-
--primitive-typography-size-14: 14px;
|
|
62
|
-
--primitive-typography-size-16: 16px;
|
|
63
|
-
--primitive-typography-size-18: 18px;
|
|
64
|
-
--primitive-typography-size-20: 20px;
|
|
65
|
-
--primitive-typography-size-24: 24px;
|
|
66
|
-
--primitive-typography-size-32: 32px;
|
|
67
|
-
--primitive-typography-size-40: 40px;
|
|
68
|
-
--primitive-typography-size-48: 48px;
|
|
69
|
-
--primitive-typography-size-80: 80px;
|
|
70
|
-
|
|
71
|
-
/* Typography / Weight */
|
|
72
|
-
|
|
73
|
-
--primitive-typography-weight-thin: 300;
|
|
74
|
-
--primitive-typography-weight-regular: 400;
|
|
75
|
-
--primitive-typography-weight-medium: 500;
|
|
76
|
-
--primitive-typography-weight-semibold: 600;
|
|
77
|
-
--primitive-typography-weight-bold: 700;
|
|
78
|
-
--primitive-typography-weight-extrabold: 800;
|
|
79
|
-
|
|
80
|
-
/* Typography / Letter Spacing */
|
|
81
|
-
|
|
82
|
-
--primitive-typography-letter-spacing-0: 0px;
|
|
83
|
-
--primitive-typography-letter-spacing-minus-0-5: -0.5px;
|
|
84
|
-
--primitive-typography-letter-spacing-minus-1: -1px;
|
|
85
|
-
--primitive-typography-letter-spacing-minus-1-5: -1.5px;
|
|
86
|
-
|
|
87
|
-
/* Border / Width */
|
|
88
|
-
|
|
89
|
-
--primitive-border-width-0: 0px;
|
|
90
|
-
--primitive-border-width-1: 1px;
|
|
91
|
-
--primitive-border-width-2: 2px;
|
|
92
|
-
--primitive-border-width-4: 4px;
|
|
93
|
-
|
|
94
|
-
/* Border / Radius */
|
|
95
|
-
|
|
96
|
-
--primitive-border-radius-0: 0px;
|
|
97
|
-
--primitive-border-radius-4: 4px;
|
|
98
|
-
--primitive-border-radius-8: 8px;
|
|
99
|
-
--primitive-border-radius-16: 16px;
|
|
100
|
-
--primitive-border-radius-24: 24px;
|
|
101
|
-
--primitive-border-radius-40: 40px;
|
|
102
|
-
--primitive-border-radius-64: 64px;
|
|
103
|
-
--primitive-border-radius-9999: 9999px;
|
|
104
|
-
|
|
105
|
-
/* Scale */
|
|
106
|
-
|
|
107
|
-
--primitive-scale-0: 0px;
|
|
108
|
-
--primitive-scale-2: 2px;
|
|
109
|
-
--primitive-scale-4: 4px;
|
|
110
|
-
--primitive-scale-8: 8px;
|
|
111
|
-
--primitive-scale-12: 12px;
|
|
112
|
-
--primitive-scale-16: 16px;
|
|
113
|
-
--primitive-scale-20: 20px;
|
|
114
|
-
--primitive-scale-24: 24px;
|
|
115
|
-
--primitive-scale-32: 32px;
|
|
116
|
-
--primitive-scale-40: 40px;
|
|
117
|
-
--primitive-scale-48: 48px;
|
|
118
|
-
--primitive-scale-56: 56px;
|
|
119
|
-
--primitive-scale-64: 64px;
|
|
120
|
-
--primitive-scale-72: 72px;
|
|
121
|
-
--primitive-scale-80: 80px;
|
|
122
|
-
--primitive-scale-88: 88px;
|
|
123
|
-
--primitive-scale-96: 96px;
|
|
124
|
-
--primitive-scale-104: 104px;
|
|
125
|
-
--primitive-scale-120: 120px;
|
|
126
|
-
--primitive-scale-128: 128px;
|
|
127
|
-
--primitive-scale-160: 160px;
|
|
128
|
-
--primitive-scale-200: 200px;
|
|
129
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
:root,
|
|
2
|
-
:host {
|
|
3
|
-
/* Border / Width */
|
|
4
|
-
|
|
5
|
-
--border-none: var(--primitive-border-width-0);
|
|
6
|
-
--border-regular: var(--primitive-border-width-1);
|
|
7
|
-
--border-bold: var(--primitive-border-width-2);
|
|
8
|
-
|
|
9
|
-
/* Border / Radius */
|
|
10
|
-
|
|
11
|
-
--border-radius-none: var(--primitive-border-radius-0);
|
|
12
|
-
--border-radius-x-small: var(--primitive-border-radius-4);
|
|
13
|
-
--border-radius-small: var(--primitive-border-radius-8);
|
|
14
|
-
--border-radius-medium: var(--primitive-border-radius-16);
|
|
15
|
-
--border-radius-large: var(--primitive-border-radius-24);
|
|
16
|
-
--border-radius-x-large: var(--primitive-border-radius-40);
|
|
17
|
-
--border-radius-xx-large: var(--primitive-border-radius-64);
|
|
18
|
-
--border-radius-full: var(--primitive-border-radius-9999);
|
|
19
|
-
|
|
20
|
-
/* Spacing */
|
|
21
|
-
|
|
22
|
-
--spacing-none: var(--primitive-scale-0);
|
|
23
|
-
--spacing-2: var(--primitive-scale-2);
|
|
24
|
-
--spacing-4: var(--primitive-scale-4);
|
|
25
|
-
--spacing-8: var(--primitive-scale-8);
|
|
26
|
-
--spacing-12: var(--primitive-scale-12);
|
|
27
|
-
--spacing-16: var(--primitive-scale-16);
|
|
28
|
-
--spacing-20: var(--primitive-scale-20);
|
|
29
|
-
--spacing-24: var(--primitive-scale-24);
|
|
30
|
-
--spacing-32: var(--primitive-scale-32);
|
|
31
|
-
--spacing-40: var(--primitive-scale-40);
|
|
32
|
-
--spacing-48: var(--primitive-scale-48);
|
|
33
|
-
--spacing-64: var(--primitive-scale-64);
|
|
34
|
-
--spacing-80: var(--primitive-scale-80);
|
|
35
|
-
--spacing-96: var(--primitive-scale-96);
|
|
36
|
-
--spacing-104: var(--primitive-scale-104);
|
|
37
|
-
--spacing-120: var(--primitive-scale-120);
|
|
38
|
-
--spacing-160: var(--primitive-scale-160);
|
|
39
|
-
--spacing-200: var(--primitive-scale-200);
|
|
40
|
-
|
|
41
|
-
/* Icon / Size */
|
|
42
|
-
|
|
43
|
-
--icon-size-xx-small: var(--primitive-scale-16);
|
|
44
|
-
--icon-size-x-small: var(--primitive-scale-20);
|
|
45
|
-
--icon-size-small: var(--primitive-scale-24);
|
|
46
|
-
--icon-size-medium: var(--primitive-scale-32);
|
|
47
|
-
--icon-size-large: var(--primitive-scale-40);
|
|
48
|
-
--icon-size-x-large: var(--primitive-scale-48);
|
|
49
|
-
--icon-size-xx-large: var(--primitive-scale-64);
|
|
50
|
-
--icon-size-xxx-large: var(--primitive-scale-80);
|
|
51
|
-
}
|
package/src/svg.d.ts
DELETED
package/src/types/assets.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type AssetManifest = Record<string, string>;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { EmailConfig } from '@incodetech/core/email';
|
|
2
|
-
import type { PhoneConfig } from '@incodetech/core/phone';
|
|
3
|
-
import type { SelfieConfig } from '@incodetech/core/selfie';
|
|
4
|
-
import type { IncodeFlowProps, SpinnerConfig } from '../flow/flow';
|
|
5
|
-
import type { FlowCompletedProps } from '../flow/flowCompleted';
|
|
6
|
-
import type { IncodeModuleProps } from '../shared/webComponent/incodeModule';
|
|
7
|
-
|
|
8
|
-
// =============================================================================
|
|
9
|
-
// Flow Components
|
|
10
|
-
// =============================================================================
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Element type for the `<incode-flow>` web component.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* const flow = document.createElement('incode-flow');
|
|
18
|
-
* flow.apiURL = 'https://api.example.com';
|
|
19
|
-
* flow.token = 'session-token';
|
|
20
|
-
* flow.onComplete = (result) => console.log(result);
|
|
21
|
-
* document.body.appendChild(flow);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export type IncodeFlowElement = HTMLElement & IncodeFlowProps;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Element type for the `<incode-flow-completed>` web component.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* const completed = document.createElement('incode-flow-completed');
|
|
32
|
-
* completed.action = 'approved';
|
|
33
|
-
* completed.scoreStatus = 'OK';
|
|
34
|
-
* document.body.appendChild(completed);
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export type FlowCompletedElement = HTMLElement & FlowCompletedProps;
|
|
38
|
-
|
|
39
|
-
// =============================================================================
|
|
40
|
-
// Module Components
|
|
41
|
-
// =============================================================================
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Element type for the `<incode-phone>` web component.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* const phone = document.createElement('incode-phone');
|
|
49
|
-
* phone.config = { otpVerification: true, otpExpirationInMinutes: 5 };
|
|
50
|
-
* phone.onFinish = () => console.log('Phone verified!');
|
|
51
|
-
* phone.onError = (error) => console.error(error);
|
|
52
|
-
* document.body.appendChild(phone);
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export type IncodePhoneElement = HTMLElement & IncodeModuleProps<PhoneConfig>;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Element type for the `<incode-email>` web component.
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```typescript
|
|
62
|
-
* const email = document.createElement('incode-email');
|
|
63
|
-
* email.config = { otpVerification: true, otpExpirationInMinutes: 5 };
|
|
64
|
-
* email.onFinish = () => console.log('Email verified!');
|
|
65
|
-
* email.onError = (error) => console.error(error);
|
|
66
|
-
* document.body.appendChild(email);
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export type IncodeEmailElement = HTMLElement & IncodeModuleProps<EmailConfig>;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Element type for the `<incode-selfie>` web component.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```typescript
|
|
76
|
-
* const selfie = document.createElement('incode-selfie');
|
|
77
|
-
* selfie.config = { showTutorial: true };
|
|
78
|
-
* selfie.onFinish = () => console.log('Selfie captured!');
|
|
79
|
-
* selfie.onError = (error) => console.error(error);
|
|
80
|
-
* document.body.appendChild(selfie);
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
export type IncodeSelfieElement = HTMLElement & IncodeModuleProps<SelfieConfig>;
|
|
84
|
-
|
|
85
|
-
// =============================================================================
|
|
86
|
-
// Global Type Augmentation
|
|
87
|
-
// =============================================================================
|
|
88
|
-
|
|
89
|
-
declare global {
|
|
90
|
-
interface HTMLElementTagNameMap {
|
|
91
|
-
'incode-flow': IncodeFlowElement;
|
|
92
|
-
'incode-flow-completed': FlowCompletedElement;
|
|
93
|
-
'incode-phone': IncodePhoneElement;
|
|
94
|
-
'incode-email': IncodeEmailElement;
|
|
95
|
-
'incode-selfie': IncodeSelfieElement;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// =============================================================================
|
|
100
|
-
// Re-exports for Consumers
|
|
101
|
-
// =============================================================================
|
|
102
|
-
|
|
103
|
-
export type { IncodeFlowProps, SpinnerConfig, FlowCompletedProps };
|
|
104
|
-
export type { IncodeModuleProps };
|
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../config/ts/tsconfig.strict.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"jsx": "react-jsx",
|
|
5
|
-
"jsxImportSource": "preact",
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"declarationMap": false,
|
|
8
|
-
"resolveJsonModule": true,
|
|
9
|
-
"baseUrl": ".",
|
|
10
|
-
"paths": {
|
|
11
|
-
"@/*": ["src/*"],
|
|
12
|
-
"@incodetech/core": ["../core/src"],
|
|
13
|
-
"@incodetech/core/flow": ["../core/src/flow"],
|
|
14
|
-
"@incodetech/core/id": ["../core/src/id"],
|
|
15
|
-
"@incodetech/core/phone": ["../core/src/phone"],
|
|
16
|
-
"@incodetech/core/email": ["../core/src/email"],
|
|
17
|
-
"@incodetech/core/selfie": ["../core/src/selfie"],
|
|
18
|
-
"@incodetech/infra": ["../infra/src"]
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"include": ["src", "dev", "vitest.config.ts", "vitest.setup.ts"]
|
|
22
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { dirname, relative, resolve } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { preserveGlobals } from '@incodetech/config/vite/preact-globals';
|
|
5
|
-
import preact from '@preact/preset-vite';
|
|
6
|
-
import tailwindcss from '@tailwindcss/vite';
|
|
7
|
-
import postcss from 'postcss';
|
|
8
|
-
import postcssImport from 'postcss-import';
|
|
9
|
-
import type { Plugin } from 'vite';
|
|
10
|
-
import { defineConfig, loadEnv } from 'vite';
|
|
11
|
-
import dts from 'vite-plugin-dts';
|
|
12
|
-
|
|
13
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
|
|
15
|
-
const entries = {
|
|
16
|
-
index: resolve(__dirname, 'src/index.ts'),
|
|
17
|
-
'selfie/selfie': resolve(__dirname, 'src/selfie/selfie.tsx'),
|
|
18
|
-
'phone/phone': resolve(__dirname, 'src/phone/phone.tsx'),
|
|
19
|
-
'email/email': resolve(__dirname, 'src/email/email.tsx'),
|
|
20
|
-
'flow/flow': resolve(__dirname, 'src/flow/flow.tsx'),
|
|
21
|
-
'styles/core': resolve(__dirname, 'src/styles/core.css'),
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
function makeEntryMap(libEntries: Record<string, string>) {
|
|
25
|
-
const map: Record<string, { dir: string; base: string }> = {};
|
|
26
|
-
for (const key of Object.keys(libEntries)) {
|
|
27
|
-
const parts = key.split('/');
|
|
28
|
-
const base = parts.pop() ?? key;
|
|
29
|
-
const dir = parts.join('/');
|
|
30
|
-
map[key] = { dir, base };
|
|
31
|
-
}
|
|
32
|
-
return map;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const entryMap = makeEntryMap(entries);
|
|
36
|
-
|
|
37
|
-
function buildTokensCSS(): Plugin {
|
|
38
|
-
return {
|
|
39
|
-
name: 'build-tokens-css',
|
|
40
|
-
async closeBundle() {
|
|
41
|
-
const tokensCssPath = resolve(__dirname, 'src/styles/tokens/index.css');
|
|
42
|
-
const outputPath = resolve(__dirname, 'dist/styles/tokens.css');
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const css = readFileSync(tokensCssPath, 'utf-8');
|
|
46
|
-
const result = await postcss([postcssImport()]).process(css, {
|
|
47
|
-
from: tokensCssPath,
|
|
48
|
-
to: outputPath,
|
|
49
|
-
});
|
|
50
|
-
mkdirSync(resolve(__dirname, 'dist/styles'), { recursive: true });
|
|
51
|
-
writeFileSync(outputPath, result.css, 'utf-8');
|
|
52
|
-
} catch (error) {
|
|
53
|
-
console.error('Error building tokens.css:', error);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function buildCoreCSS(): Plugin {
|
|
60
|
-
return {
|
|
61
|
-
name: 'build-core-css',
|
|
62
|
-
async closeBundle() {
|
|
63
|
-
const coreCssPath = resolve(__dirname, 'dist/styles/core.css');
|
|
64
|
-
const outputPath = resolve(__dirname, 'dist/styles/core.css');
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
const css = readFileSync(coreCssPath, 'utf-8');
|
|
68
|
-
const processedCss = css.replace(/@reference\s+[^;]+;/g, '');
|
|
69
|
-
mkdirSync(resolve(__dirname, 'dist/styles'), { recursive: true });
|
|
70
|
-
writeFileSync(outputPath, processedCss, 'utf-8');
|
|
71
|
-
} catch (error) {
|
|
72
|
-
console.error('Error post-processing core.css:', error);
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function useCdnForSvgs(): Plugin {
|
|
79
|
-
let manifest: Record<string, string> | null = null;
|
|
80
|
-
|
|
81
|
-
function loadManifest() {
|
|
82
|
-
if (manifest) return manifest;
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
const manifestPath = resolve(__dirname, 'dist/asset-manifest.json');
|
|
86
|
-
const manifestContent = readFileSync(manifestPath, 'utf-8');
|
|
87
|
-
manifest = JSON.parse(manifestContent);
|
|
88
|
-
return manifest;
|
|
89
|
-
} catch (error) {
|
|
90
|
-
console.warn('[use-cdn-for-svgs] Could not load asset manifest:', error);
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
name: 'use-cdn-for-svgs',
|
|
97
|
-
enforce: 'pre',
|
|
98
|
-
buildStart() {
|
|
99
|
-
loadManifest();
|
|
100
|
-
},
|
|
101
|
-
async resolveId(id, importer) {
|
|
102
|
-
if (!id.endsWith('.svg')) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const cleanId = id.replace(/\?.*$/, '');
|
|
107
|
-
const manifestData = loadManifest();
|
|
108
|
-
if (!manifestData) {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
const resolved = await this.resolve(cleanId, importer, {
|
|
114
|
-
skipSelf: true,
|
|
115
|
-
});
|
|
116
|
-
if (!resolved || !resolved.id || typeof resolved.id !== 'string') {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const absolutePath = resolved.id.replace(/\?.*$/, '');
|
|
121
|
-
const relativePath = relative(
|
|
122
|
-
resolve(__dirname, 'src'),
|
|
123
|
-
absolutePath,
|
|
124
|
-
).replace(/\\/g, '/');
|
|
125
|
-
const cdnUrl = manifestData[relativePath];
|
|
126
|
-
|
|
127
|
-
if (cdnUrl) {
|
|
128
|
-
return {
|
|
129
|
-
id: `\0cdn-svg:${cdnUrl}`,
|
|
130
|
-
external: false,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
} catch {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
return null;
|
|
137
|
-
},
|
|
138
|
-
load(id) {
|
|
139
|
-
if (id.startsWith('\0cdn-svg:')) {
|
|
140
|
-
const cdnUrl = id.replace('\0cdn-svg:', '');
|
|
141
|
-
return `export default ${JSON.stringify(cdnUrl)}`;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (id.endsWith('.svg') && !id.includes('?')) {
|
|
145
|
-
const manifestData = loadManifest();
|
|
146
|
-
if (!manifestData) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const relativePath = relative(resolve(__dirname, 'src'), id).replace(
|
|
151
|
-
/\\/g,
|
|
152
|
-
'/',
|
|
153
|
-
);
|
|
154
|
-
const cdnUrl = manifestData[relativePath];
|
|
155
|
-
|
|
156
|
-
if (cdnUrl) {
|
|
157
|
-
return `export default ${JSON.stringify(cdnUrl)}`;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return null;
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const defaultAllowedHosts = ['localhost', '127.0.0.1', '::1'];
|
|
166
|
-
|
|
167
|
-
export default defineConfig(({ mode }) => {
|
|
168
|
-
const env = loadEnv(mode, __dirname, '');
|
|
169
|
-
const extraHosts = env.VITE_ALLOWED_HOSTS?.split(',').filter(Boolean) ?? [];
|
|
170
|
-
const allowedHosts = [...defaultAllowedHosts, ...extraHosts];
|
|
171
|
-
|
|
172
|
-
return {
|
|
173
|
-
plugins: [
|
|
174
|
-
useCdnForSvgs(),
|
|
175
|
-
preact(),
|
|
176
|
-
buildTokensCSS(),
|
|
177
|
-
buildCoreCSS(),
|
|
178
|
-
tailwindcss(),
|
|
179
|
-
dts({
|
|
180
|
-
tsconfigPath: resolve(__dirname, 'tsconfig.json'),
|
|
181
|
-
insertTypesEntry: true,
|
|
182
|
-
exclude: [
|
|
183
|
-
'vitest.config.ts',
|
|
184
|
-
'vitest.setup.ts',
|
|
185
|
-
'**/*.test.ts',
|
|
186
|
-
'**/*.test.tsx',
|
|
187
|
-
'dev/**',
|
|
188
|
-
],
|
|
189
|
-
include: [
|
|
190
|
-
resolve(__dirname, 'src/**/*.ts'),
|
|
191
|
-
resolve(__dirname, 'src/**/*.tsx'),
|
|
192
|
-
],
|
|
193
|
-
copyDtsFiles: true,
|
|
194
|
-
rollupTypes: true,
|
|
195
|
-
outDir: resolve(__dirname, 'dist/types'),
|
|
196
|
-
}),
|
|
197
|
-
preserveGlobals() as Plugin,
|
|
198
|
-
],
|
|
199
|
-
resolve: {
|
|
200
|
-
alias: {
|
|
201
|
-
'@': resolve(__dirname, 'src'),
|
|
202
|
-
'@incodetech/core': resolve(__dirname, '../core/src'),
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
root: resolve(__dirname, 'dev'),
|
|
206
|
-
server: {
|
|
207
|
-
port: 5173,
|
|
208
|
-
allowedHosts,
|
|
209
|
-
},
|
|
210
|
-
build: {
|
|
211
|
-
emptyOutDir: true,
|
|
212
|
-
target: 'es2021',
|
|
213
|
-
assetsInlineLimit: 0,
|
|
214
|
-
lib: {
|
|
215
|
-
entry: entries,
|
|
216
|
-
formats: ['es'],
|
|
217
|
-
fileName: (format, entryName) => `${entryName}.${format}.js`,
|
|
218
|
-
},
|
|
219
|
-
outDir: resolve(__dirname, 'dist'),
|
|
220
|
-
sourcemap: false,
|
|
221
|
-
cssCodeSplit: true,
|
|
222
|
-
cssMinify: false,
|
|
223
|
-
rollupOptions: {
|
|
224
|
-
external: [
|
|
225
|
-
'@incodetech/core',
|
|
226
|
-
'@incodetech/core/flow',
|
|
227
|
-
'@incodetech/core/phone',
|
|
228
|
-
'@incodetech/core/email',
|
|
229
|
-
'@incodetech/core/selfie',
|
|
230
|
-
],
|
|
231
|
-
output: {
|
|
232
|
-
manualChunks: {
|
|
233
|
-
'vendor-preact': ['preact', 'preact/hooks', 'preact/compat'],
|
|
234
|
-
},
|
|
235
|
-
assetFileNames: (assetInfo) => {
|
|
236
|
-
const names = assetInfo.names || [];
|
|
237
|
-
const fileName = names[0] || '';
|
|
238
|
-
if (fileName.endsWith('.css')) {
|
|
239
|
-
const cssBase = fileName.replace(/\.css$/, '');
|
|
240
|
-
if (
|
|
241
|
-
cssBase === 'styles/core' ||
|
|
242
|
-
cssBase.includes('styles/core')
|
|
243
|
-
) {
|
|
244
|
-
return 'styles/core.css';
|
|
245
|
-
}
|
|
246
|
-
for (const [key, { dir, base }] of Object.entries(entryMap)) {
|
|
247
|
-
if (cssBase === base || key.includes(cssBase)) {
|
|
248
|
-
const folder = dir ? `${dir}/` : '';
|
|
249
|
-
return `${folder}styles.css`;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return '[name].css';
|
|
253
|
-
}
|
|
254
|
-
return 'assets/[name][extname]';
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
};
|
|
260
|
-
});
|
package/vitest.config.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
2
|
-
import { defineConfig, mergeConfig } from 'vitest/config';
|
|
3
|
-
import baseConfig from '../config/vitest/base';
|
|
4
|
-
|
|
5
|
-
export default mergeConfig(
|
|
6
|
-
baseConfig,
|
|
7
|
-
defineConfig({
|
|
8
|
-
resolve: {
|
|
9
|
-
alias: {
|
|
10
|
-
'@': resolve(__dirname, 'src'),
|
|
11
|
-
'@incodetech/core/selfie': resolve(__dirname, '../core/src/selfie'),
|
|
12
|
-
'@incodetech/core/flow': resolve(__dirname, '../core/src/flow'),
|
|
13
|
-
'@incodetech/core': resolve(__dirname, '../core/src'),
|
|
14
|
-
'@incodetech/infra': resolve(__dirname, '../infra/src'),
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
test: {
|
|
18
|
-
environment: 'jsdom',
|
|
19
|
-
setupFiles: ['./vitest.setup.ts'],
|
|
20
|
-
coverage: {
|
|
21
|
-
exclude: [
|
|
22
|
-
'**/i18n/**',
|
|
23
|
-
'**/index.ts',
|
|
24
|
-
'**/phone/phone.tsx',
|
|
25
|
-
'**/shared/lottie/**',
|
|
26
|
-
'**/styles/generatePalette.ts',
|
|
27
|
-
'**/styles/applyTheme.ts',
|
|
28
|
-
],
|
|
29
|
-
thresholds: {
|
|
30
|
-
'src/permissions/**': {
|
|
31
|
-
statements: 0,
|
|
32
|
-
branches: 0,
|
|
33
|
-
functions: 0,
|
|
34
|
-
lines: 0,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
}),
|
|
40
|
-
);
|
package/vitest.setup.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
|
|
3
|
-
vi.mock('./src/i18n/useTranslation', () => ({
|
|
4
|
-
useTranslation: () => ({
|
|
5
|
-
t: (key: string) => key,
|
|
6
|
-
ready: true,
|
|
7
|
-
i18n: {
|
|
8
|
-
language: 'en',
|
|
9
|
-
isInitialized: true,
|
|
10
|
-
on: vi.fn(),
|
|
11
|
-
off: vi.fn(),
|
|
12
|
-
},
|
|
13
|
-
}),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
vi.mock('*.css', () => ({}));
|