@incodetech/web 2.0.0-alpha.2 → 2.0.0-alpha.4
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/{styles/core.css → base.css} +53 -57
- package/dist/email/email.es.js +1 -1
- package/dist/email/styles.css +11 -11
- package/dist/flow/styles.css +688 -1
- package/dist/{incodeModule-BF5MX9GT.js → incodeModule-Ct9jp5k6.js} +22 -19
- package/dist/index.es.js +18 -18
- package/dist/phone/phone.es.js +1 -1
- package/dist/phone/styles.css +31 -31
- package/dist/selfie/selfie.es.js +16 -16
- package/dist/selfie/styles.css +0 -51
- package/dist/themes/dark.css +652 -0
- package/dist/types/dark.d.ts +1 -0
- package/dist/types/light.d.ts +1 -0
- package/dist/types/themes/light.d.ts +1 -0
- package/package.json +12 -6
- 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/dist/asset-manifest.json +0 -18
- 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
- /package/dist/{styles/tokens.css → themes/light.css} +0 -0
- /package/dist/types/{core.d.ts → base.d.ts} +0 -0
- /package/dist/types/{styles/core.d.ts → themes/dark.d.ts} +0 -0
package/dev/main.tsx
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
import '../src/styles/tokens/index.css';
|
|
2
|
-
import '../src/selfie/selfie';
|
|
3
|
-
import { setup } from '@incodetech/core';
|
|
4
|
-
import type { FlowModuleConfig } from '@incodetech/core/flow';
|
|
5
|
-
import { createFlowManager } from '@incodetech/core/flow';
|
|
6
|
-
import { createSelfieManager, type SelfieState } from '@incodetech/core/selfie';
|
|
7
|
-
import { getToken } from './getToken';
|
|
8
|
-
|
|
9
|
-
const app = async () => {
|
|
10
|
-
const { token } = await getToken();
|
|
11
|
-
setup({
|
|
12
|
-
apiURL: 'https://user-service-k8s.stage.incodetest.com/0',
|
|
13
|
-
token,
|
|
14
|
-
});
|
|
15
|
-
const flowManager = createFlowManager();
|
|
16
|
-
flowManager.load();
|
|
17
|
-
flowManager.subscribe((state) => {
|
|
18
|
-
const root = document.getElementById('root');
|
|
19
|
-
if (!root) return;
|
|
20
|
-
root.innerText = '';
|
|
21
|
-
console.log(state, 'state changed!');
|
|
22
|
-
if (state.status === 'ready') {
|
|
23
|
-
console.log(state.flow, 'current flow');
|
|
24
|
-
|
|
25
|
-
const { currentStep, config } = state;
|
|
26
|
-
if (currentStep) {
|
|
27
|
-
console.log(config, 'module config');
|
|
28
|
-
document.title = currentStep;
|
|
29
|
-
if (currentStep === 'TUTORIAL_ID' || currentStep === 'ID') {
|
|
30
|
-
const idElement = document.createElement('div');
|
|
31
|
-
const button = document.createElement('button');
|
|
32
|
-
button.innerHTML = 'Continue';
|
|
33
|
-
button.addEventListener('click', () => {
|
|
34
|
-
flowManager.nextStep();
|
|
35
|
-
});
|
|
36
|
-
idElement.innerHTML = `<h1>This is ${currentStep}</h1><p>Hi!</p>`;
|
|
37
|
-
idElement.appendChild(button);
|
|
38
|
-
document.getElementById('root')?.appendChild(idElement);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (currentStep === 'SELFIE') {
|
|
43
|
-
const selfieConfig = config as FlowModuleConfig['SELFIE'];
|
|
44
|
-
|
|
45
|
-
const selfieManager = createSelfieManager({ config: selfieConfig });
|
|
46
|
-
selfieManager.load();
|
|
47
|
-
|
|
48
|
-
let videoElement: HTMLVideoElement | null = null;
|
|
49
|
-
let currentStream: MediaStream | null = null;
|
|
50
|
-
let isLoadingButton = false;
|
|
51
|
-
|
|
52
|
-
const renderSelfieUI = (selfieState: SelfieState) => {
|
|
53
|
-
const selfieRoot = document.getElementById('selfie-root');
|
|
54
|
-
if (!selfieRoot) return;
|
|
55
|
-
|
|
56
|
-
const isDetecting =
|
|
57
|
-
selfieState.status === 'capture' &&
|
|
58
|
-
selfieState.captureStatus === 'detecting';
|
|
59
|
-
|
|
60
|
-
if (isDetecting) {
|
|
61
|
-
const statusEl = document.getElementById('detection-status');
|
|
62
|
-
if (statusEl) {
|
|
63
|
-
statusEl.innerHTML = `
|
|
64
|
-
<p>Status: <strong>${selfieState.detectionStatus}</strong></p>
|
|
65
|
-
<p>Attempts remaining: ${selfieState.attemptsRemaining}</p>
|
|
66
|
-
`;
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
videoElement = null;
|
|
71
|
-
currentStream = null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (selfieState.status !== 'tutorial') {
|
|
75
|
-
isLoadingButton = false;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
selfieRoot.innerHTML = '';
|
|
79
|
-
console.log(selfieState, 'selfieState');
|
|
80
|
-
|
|
81
|
-
if (selfieState.status === 'loading') {
|
|
82
|
-
selfieRoot.innerHTML = '<p>Loading...</p>';
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (selfieState.status === 'tutorial') {
|
|
87
|
-
const tutorialDiv = document.createElement('div');
|
|
88
|
-
tutorialDiv.innerHTML =
|
|
89
|
-
'<h2>Selfie Tutorial</h2><p>Position your face in the center</p>';
|
|
90
|
-
const continueBtn = document.createElement('button');
|
|
91
|
-
|
|
92
|
-
if (isLoadingButton) {
|
|
93
|
-
continueBtn.textContent = 'Loading...';
|
|
94
|
-
continueBtn.disabled = true;
|
|
95
|
-
} else {
|
|
96
|
-
continueBtn.textContent = 'Continue';
|
|
97
|
-
continueBtn.disabled = false;
|
|
98
|
-
continueBtn.addEventListener('click', () => {
|
|
99
|
-
isLoadingButton = true;
|
|
100
|
-
selfieManager.nextStep();
|
|
101
|
-
renderSelfieUI(selfieManager.getState());
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
tutorialDiv.appendChild(continueBtn);
|
|
106
|
-
selfieRoot.appendChild(tutorialDiv);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (selfieState.status === 'permissions') {
|
|
111
|
-
const permDiv = document.createElement('div');
|
|
112
|
-
|
|
113
|
-
if (selfieState.permissionStatus === 'idle') {
|
|
114
|
-
permDiv.innerHTML =
|
|
115
|
-
'<h2>Camera Permission</h2><p>We need access to your camera</p>';
|
|
116
|
-
const allowBtn = document.createElement('button');
|
|
117
|
-
allowBtn.textContent = 'Allow Camera';
|
|
118
|
-
allowBtn.addEventListener('click', () =>
|
|
119
|
-
selfieManager.requestPermission(),
|
|
120
|
-
);
|
|
121
|
-
const learnMoreBtn = document.createElement('button');
|
|
122
|
-
learnMoreBtn.textContent = 'Learn More';
|
|
123
|
-
learnMoreBtn.addEventListener('click', () =>
|
|
124
|
-
selfieManager.goToLearnMore(),
|
|
125
|
-
);
|
|
126
|
-
permDiv.appendChild(allowBtn);
|
|
127
|
-
permDiv.appendChild(learnMoreBtn);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (selfieState.permissionStatus === 'requesting') {
|
|
131
|
-
permDiv.innerHTML = '<p>Requesting camera access...</p>';
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (selfieState.permissionStatus === 'denied') {
|
|
135
|
-
permDiv.innerHTML =
|
|
136
|
-
'<h2>Permission Denied</h2><p>Camera access was denied. Please refresh your browser to grant permissions.</p>';
|
|
137
|
-
const refreshBtn = document.createElement('button');
|
|
138
|
-
refreshBtn.textContent = 'Refresh Browser';
|
|
139
|
-
refreshBtn.addEventListener('click', () => {
|
|
140
|
-
window.location.reload();
|
|
141
|
-
});
|
|
142
|
-
permDiv.appendChild(refreshBtn);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (selfieState.permissionStatus === 'learnMore') {
|
|
146
|
-
permDiv.innerHTML =
|
|
147
|
-
'<h2>Why we need camera</h2><p>To verify your identity</p>';
|
|
148
|
-
const allowBtn = document.createElement('button');
|
|
149
|
-
allowBtn.textContent = 'Allow Camera';
|
|
150
|
-
allowBtn.addEventListener('click', () =>
|
|
151
|
-
selfieManager.requestPermission(),
|
|
152
|
-
);
|
|
153
|
-
const backBtn = document.createElement('button');
|
|
154
|
-
backBtn.textContent = 'Back';
|
|
155
|
-
backBtn.addEventListener('click', () => selfieManager.back());
|
|
156
|
-
const quitBtn = document.createElement('button');
|
|
157
|
-
quitBtn.textContent = 'Quit';
|
|
158
|
-
quitBtn.addEventListener('click', () => selfieManager.close());
|
|
159
|
-
permDiv.appendChild(allowBtn);
|
|
160
|
-
permDiv.appendChild(backBtn);
|
|
161
|
-
permDiv.appendChild(quitBtn);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
selfieRoot.appendChild(permDiv);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (selfieState.status === 'capture') {
|
|
169
|
-
const captureDiv = document.createElement('div');
|
|
170
|
-
|
|
171
|
-
if (selfieState.captureStatus === 'initializing') {
|
|
172
|
-
captureDiv.innerHTML = `
|
|
173
|
-
<h2>Initializing Camera</h2>
|
|
174
|
-
<div style="display: flex; justify-content: center; align-items: center; margin: 20px 0;">
|
|
175
|
-
<div style="border: 4px solid #f3f3f3; border-top: 4px solid #3498db; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite;"></div>
|
|
176
|
-
</div>
|
|
177
|
-
<p>Please wait...</p>
|
|
178
|
-
<style>
|
|
179
|
-
@keyframes spin {
|
|
180
|
-
0% { transform: rotate(0deg); }
|
|
181
|
-
100% { transform: rotate(360deg); }
|
|
182
|
-
}
|
|
183
|
-
</style>
|
|
184
|
-
`;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (selfieState.captureStatus === 'detecting') {
|
|
188
|
-
captureDiv.innerHTML = '<h2>Face Detection</h2>';
|
|
189
|
-
|
|
190
|
-
const statusDiv = document.createElement('div');
|
|
191
|
-
statusDiv.id = 'detection-status';
|
|
192
|
-
statusDiv.innerHTML = `
|
|
193
|
-
<p>Status: <strong>${selfieState.detectionStatus}</strong></p>
|
|
194
|
-
<p>Attempts remaining: ${selfieState.attemptsRemaining}</p>
|
|
195
|
-
`;
|
|
196
|
-
captureDiv.appendChild(statusDiv);
|
|
197
|
-
|
|
198
|
-
if (
|
|
199
|
-
selfieState.stream &&
|
|
200
|
-
selfieState.stream !== currentStream
|
|
201
|
-
) {
|
|
202
|
-
currentStream = selfieState.stream;
|
|
203
|
-
videoElement = document.createElement('video');
|
|
204
|
-
videoElement.srcObject = selfieState.stream;
|
|
205
|
-
videoElement.autoplay = true;
|
|
206
|
-
videoElement.playsInline = true;
|
|
207
|
-
videoElement.muted = true;
|
|
208
|
-
videoElement.style.width = '320px';
|
|
209
|
-
videoElement.style.height = '240px';
|
|
210
|
-
videoElement.style.transform = 'scaleX(-1)';
|
|
211
|
-
videoElement.style.display = 'block';
|
|
212
|
-
videoElement.style.marginTop = '16px';
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (videoElement) {
|
|
216
|
-
captureDiv.appendChild(videoElement);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (selfieState.captureStatus === 'capturing') {
|
|
221
|
-
captureDiv.innerHTML =
|
|
222
|
-
'<h2>Capturing</h2><p>Taking photo...</p>';
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (selfieState.captureStatus === 'uploading') {
|
|
226
|
-
captureDiv.innerHTML =
|
|
227
|
-
'<h2>Uploading</h2><p>Sending selfie to server...</p>';
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (selfieState.captureStatus === 'uploadError') {
|
|
231
|
-
captureDiv.innerHTML = `
|
|
232
|
-
<h2>Upload Failed</h2>
|
|
233
|
-
<p>Error: ${selfieState.uploadError}</p>
|
|
234
|
-
<p>Attempts remaining: ${selfieState.attemptsRemaining}</p>
|
|
235
|
-
`;
|
|
236
|
-
if (selfieState.attemptsRemaining > 0) {
|
|
237
|
-
const retryBtn = document.createElement('button');
|
|
238
|
-
retryBtn.textContent = 'Retry';
|
|
239
|
-
retryBtn.addEventListener('click', () =>
|
|
240
|
-
selfieManager.retryCapture(),
|
|
241
|
-
);
|
|
242
|
-
captureDiv.appendChild(retryBtn);
|
|
243
|
-
} else {
|
|
244
|
-
const noAttemptsMsg = document.createElement('p');
|
|
245
|
-
noAttemptsMsg.innerHTML =
|
|
246
|
-
'<strong style="color: red;">No more attempts available!</strong>';
|
|
247
|
-
captureDiv.appendChild(noAttemptsMsg);
|
|
248
|
-
const continueBtn = document.createElement('button');
|
|
249
|
-
continueBtn.textContent = 'Continue';
|
|
250
|
-
continueBtn.addEventListener('click', () =>
|
|
251
|
-
flowManager.nextStep(),
|
|
252
|
-
);
|
|
253
|
-
captureDiv.appendChild(continueBtn);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (selfieState.captureStatus === 'success') {
|
|
258
|
-
captureDiv.innerHTML =
|
|
259
|
-
'<h2>Success!</h2><p>Selfie captured successfully!</p>';
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
selfieRoot.appendChild(captureDiv);
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (selfieState.status === 'finished') {
|
|
267
|
-
selfieRoot.innerHTML = '<p>Selfie complete!</p>';
|
|
268
|
-
flowManager.nextStep();
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (selfieState.status === 'closed') {
|
|
273
|
-
const errorDiv = document.createElement('div');
|
|
274
|
-
errorDiv.innerHTML =
|
|
275
|
-
'<h2>Process Cancelled</h2><p>You quit the selfie process</p>';
|
|
276
|
-
selfieRoot.appendChild(errorDiv);
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (selfieState.status === 'error') {
|
|
281
|
-
const errorDiv = document.createElement('div');
|
|
282
|
-
errorDiv.innerHTML = `<h2>Error</h2><p>${selfieState.error}</p>`;
|
|
283
|
-
const resetBtn = document.createElement('button');
|
|
284
|
-
resetBtn.textContent = 'Try Again';
|
|
285
|
-
resetBtn.addEventListener('click', () => selfieManager.reset());
|
|
286
|
-
errorDiv.appendChild(resetBtn);
|
|
287
|
-
selfieRoot.appendChild(errorDiv);
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
const selfieElement = document.createElement('div');
|
|
293
|
-
selfieElement.innerHTML = '<h1>Selfie Module</h1>';
|
|
294
|
-
const selfieRoot = document.createElement('div');
|
|
295
|
-
selfieRoot.id = 'selfie-root';
|
|
296
|
-
selfieElement.appendChild(selfieRoot);
|
|
297
|
-
document.getElementById('root')?.appendChild(selfieElement);
|
|
298
|
-
|
|
299
|
-
selfieManager.subscribe(renderSelfieUI);
|
|
300
|
-
renderSelfieUI(selfieManager.getState());
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
document.title = 'Unknown step';
|
|
304
|
-
const unknownStepElement = document.createElement('div');
|
|
305
|
-
const button = document.createElement('button');
|
|
306
|
-
button.innerHTML = 'Continue';
|
|
307
|
-
button.addEventListener('click', () => {
|
|
308
|
-
flowManager.nextStep();
|
|
309
|
-
});
|
|
310
|
-
unknownStepElement.innerHTML = `<h1>Unknown step</h1><p>step: ${currentStep}</p>`;
|
|
311
|
-
unknownStepElement.appendChild(button);
|
|
312
|
-
document.getElementById('root')?.appendChild(unknownStepElement);
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (state.status === 'finished') {
|
|
318
|
-
console.log(state.flow, 'finished');
|
|
319
|
-
const finishedElement = document.createElement('div');
|
|
320
|
-
finishedElement.innerHTML = `<h1>Finished</h1><p>Hi!</p>`;
|
|
321
|
-
document.getElementById('root')?.appendChild(finishedElement);
|
|
322
|
-
}
|
|
323
|
-
if (state.status === 'error') {
|
|
324
|
-
console.log(state.error);
|
|
325
|
-
const errorElement = document.createElement('div');
|
|
326
|
-
errorElement.innerHTML = state.error;
|
|
327
|
-
document.getElementById('root')?.appendChild(errorElement);
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
app();
|
package/dev/manual.html
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Incode Flow - Manual Control</title>
|
|
7
|
-
<style>
|
|
8
|
-
html,
|
|
9
|
-
body {
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 100%;
|
|
12
|
-
margin: 0;
|
|
13
|
-
padding: 0;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
}
|
|
16
|
-
#root {
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
}
|
|
20
|
-
</style>
|
|
21
|
-
</head>
|
|
22
|
-
<body>
|
|
23
|
-
<div id="root"></div>
|
|
24
|
-
<script type="module" src="./main-web-component.tsx"></script>
|
|
25
|
-
</body>
|
|
26
|
-
</html>
|
|
27
|
-
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Incode Flow - Orchestrated</title>
|
|
7
|
-
<style>
|
|
8
|
-
html,
|
|
9
|
-
body {
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 100%;
|
|
12
|
-
margin: 0;
|
|
13
|
-
padding: 0;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
}
|
|
16
|
-
#root {
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/*
|
|
22
|
-
* ============================================================================
|
|
23
|
-
* SPINNER CSS VARIABLE OVERRIDES
|
|
24
|
-
* ============================================================================
|
|
25
|
-
* You can customize the SDK's Spinner component appearance using CSS variables.
|
|
26
|
-
* These variables control the spinner icon colors, text colors, and overlay.
|
|
27
|
-
*
|
|
28
|
-
* Available variables:
|
|
29
|
-
* --spinner-surface-primary - Primary spinner icon color (rotating part)
|
|
30
|
-
* --spinner-surface-secondary - Secondary/track color
|
|
31
|
-
* --spinner-text-title - Title text color
|
|
32
|
-
* --spinner-text-subtitle - Subtitle text color
|
|
33
|
-
* --spinner-surface-overlay - Full-screen overlay background color
|
|
34
|
-
* --spinner-surface-overlay-opacity - Overlay opacity (0-1)
|
|
35
|
-
* ============================================================================
|
|
36
|
-
*/
|
|
37
|
-
:root {
|
|
38
|
-
/* Example: Blue & Gold themed spinner */
|
|
39
|
-
--spinner-surface-primary: #f59e0b; /* Gold primary */
|
|
40
|
-
--spinner-surface-secondary: #1e3a5f; /* Dark blue track */
|
|
41
|
-
--spinner-text-title: #1e3a5f; /* Dark blue title */
|
|
42
|
-
--spinner-text-subtitle: #64748b; /* Gray subtitle */
|
|
43
|
-
--spinner-surface-overlay: #f8fafc; /* Light gray background */
|
|
44
|
-
--spinner-surface-overlay-opacity: 1;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/*
|
|
48
|
-
* You can also directly target spinner CSS classes for advanced customization:
|
|
49
|
-
*
|
|
50
|
-
* .IncodeSpinner - Base spinner container
|
|
51
|
-
* .IncodeSpinnerFullScreen - Applied when fullScreen={true}
|
|
52
|
-
* .IncodeSpinnerContent - Inner content wrapper
|
|
53
|
-
* .IncodeSpinnerText - Text container
|
|
54
|
-
* .IncodeSpinnerTitle - Title element
|
|
55
|
-
* .IncodeSpinnerSubtitle - Subtitle element
|
|
56
|
-
*/
|
|
57
|
-
</style>
|
|
58
|
-
</head>
|
|
59
|
-
<body>
|
|
60
|
-
<div id="root"></div>
|
|
61
|
-
<script type="module" src="./main-orchestrated-flow.tsx"></script>
|
|
62
|
-
</body>
|
|
63
|
-
</html>
|
|
64
|
-
|
package/dev/simplified.html
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Incode Flow - Simplified</title>
|
|
7
|
-
<style>
|
|
8
|
-
html,
|
|
9
|
-
body {
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 100%;
|
|
12
|
-
margin: 0;
|
|
13
|
-
padding: 0;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
}
|
|
16
|
-
#root {
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
}
|
|
20
|
-
incode-flow {
|
|
21
|
-
display: block;
|
|
22
|
-
width: 100%;
|
|
23
|
-
height: 100%;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/*
|
|
27
|
-
* ============================================================================
|
|
28
|
-
* SPINNER CUSTOMIZATION VIA CSS VARIABLES
|
|
29
|
-
* ============================================================================
|
|
30
|
-
* The IncodeFlow component uses a Spinner during loading states.
|
|
31
|
-
* Customize its appearance by overriding these CSS variables:
|
|
32
|
-
* ============================================================================
|
|
33
|
-
*/
|
|
34
|
-
:root {
|
|
35
|
-
/* Spinner icon colors */
|
|
36
|
-
--spinner-surface-primary: #3b82f6; /* Primary blue */
|
|
37
|
-
--spinner-surface-secondary: #dbeafe; /* Light blue track */
|
|
38
|
-
|
|
39
|
-
/* Text colors */
|
|
40
|
-
--spinner-text-title: #1e293b; /* Dark slate */
|
|
41
|
-
--spinner-text-subtitle: #64748b; /* Medium slate */
|
|
42
|
-
|
|
43
|
-
/* Full-screen overlay */
|
|
44
|
-
--spinner-surface-overlay: #ffffff; /* White background */
|
|
45
|
-
--spinner-surface-overlay-opacity: 1;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/*
|
|
49
|
-
* For advanced styling, you can also target spinner classes directly:
|
|
50
|
-
*
|
|
51
|
-
* .IncodeSpinner - Container element
|
|
52
|
-
* .IncodeSpinnerFullScreen - Applied for full-screen mode
|
|
53
|
-
* .IncodeSpinnerContent - Inner content wrapper
|
|
54
|
-
* .IncodeSpinnerTitle - Title text
|
|
55
|
-
* .IncodeSpinnerSubtitle - Subtitle text
|
|
56
|
-
*/
|
|
57
|
-
</style>
|
|
58
|
-
</head>
|
|
59
|
-
<body>
|
|
60
|
-
<div id="root"></div>
|
|
61
|
-
<script type="module" src="./main-simplified.tsx"></script>
|
|
62
|
-
</body>
|
|
63
|
-
</html>
|
|
64
|
-
|
package/dev/tiktok-logo.svg
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo
|
|
2
|
-
Mixer Tools -->
|
|
3
|
-
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 512 512" id="icons"
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
5
|
-
<path
|
|
6
|
-
d="M412.19,118.66a109.27,109.27,0,0,1-9.45-5.5,132.87,132.87,0,0,1-24.27-20.62c-18.1-20.71-24.86-41.72-27.35-56.43h.1C349.14,23.9,350,16,350.13,16H267.69V334.78c0,4.28,0,8.51-.18,12.69,0,.52-.05,1-.08,1.56,0,.23,0,.47-.05.71,0,.06,0,.12,0,.18a70,70,0,0,1-35.22,55.56,68.8,68.8,0,0,1-34.11,9c-38.41,0-69.54-31.32-69.54-70s31.13-70,69.54-70a68.9,68.9,0,0,1,21.41,3.39l.1-83.94a153.14,153.14,0,0,0-118,34.52,161.79,161.79,0,0,0-35.3,43.53c-3.48,6-16.61,30.11-18.2,69.24-1,22.21,5.67,45.22,8.85,54.73v.2c2,5.6,9.75,24.71,22.38,40.82A167.53,167.53,0,0,0,115,470.66v-.2l.2.2C155.11,497.78,199.36,496,199.36,496c7.66-.31,33.32,0,62.46-13.81,32.32-15.31,50.72-38.12,50.72-38.12a158.46,158.46,0,0,0,27.64-45.93c7.46-19.61,9.95-43.13,9.95-52.53V176.49c1,.6,14.32,9.41,14.32,9.41s19.19,12.3,49.13,20.31c21.48,5.7,50.42,6.9,50.42,6.9V131.27C453.86,132.37,433.27,129.17,412.19,118.66Z" />
|
|
7
|
-
</svg>
|
package/dist/asset-manifest.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"shared/page/incode-logo.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/incode-logo-ed68c8e9.svg",
|
|
3
|
-
"permissions/assets/safari-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/safari-icon-7823d73d.svg",
|
|
4
|
-
"permissions/assets/camera-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/camera-icon-b2fc4c1c.svg",
|
|
5
|
-
"permissions/assets/android-settings-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/android-settings-icon-8bd49c8d.svg",
|
|
6
|
-
"permissions/assets/chrome-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/chrome-icon-4c3b130c.svg",
|
|
7
|
-
"permissions/assets/android-dots-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/android-dots-icon-846d605c.svg",
|
|
8
|
-
"permissions/assets/warning-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/warning-icon-f3eadd0b.svg",
|
|
9
|
-
"permissions/assets/toggle-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/toggle-icon-351f86ce.svg",
|
|
10
|
-
"permissions/assets/bank-card-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/bank-card-icon-6af62350.svg",
|
|
11
|
-
"permissions/assets/android-toggle-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/android-toggle-icon-03e22d7a.svg",
|
|
12
|
-
"permissions/assets/camera-ios.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/camera-ios-9eac3be1.svg",
|
|
13
|
-
"permissions/assets/settings-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/settings-icon-9743cbda.svg",
|
|
14
|
-
"permissions/assets/check-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/check-icon-b1d1ddd8.svg",
|
|
15
|
-
"permissions/assets/permissions-img.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/permissions-img-83924a96.svg",
|
|
16
|
-
"permissions/assets/password-icon.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/password-icon-f5257b0b.svg",
|
|
17
|
-
"flow/incode-logo.svg": "https://assets.incode.com/@incodetech/ui/2.0.0-alpha.2/assets/incode-logo-00b4a3b0.svg"
|
|
18
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ComponentType } from 'preact';
|
|
2
|
-
import register from 'preact-custom-element';
|
|
3
|
-
|
|
4
|
-
type DefineCustomElementOptions<
|
|
5
|
-
T extends Record<string, unknown>,
|
|
6
|
-
TTagName extends string,
|
|
7
|
-
> = {
|
|
8
|
-
component: ComponentType<T>;
|
|
9
|
-
tagName: TTagName;
|
|
10
|
-
attributes?: (keyof T)[];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export function defineCustomElement<
|
|
14
|
-
T extends Record<string, unknown>,
|
|
15
|
-
TTagName extends string,
|
|
16
|
-
>({
|
|
17
|
-
component,
|
|
18
|
-
tagName,
|
|
19
|
-
attributes = [],
|
|
20
|
-
}: DefineCustomElementOptions<T, TTagName>) {
|
|
21
|
-
if (!customElements.get(tagName)) {
|
|
22
|
-
register(component, tagName, attributes as string[]);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
component,
|
|
27
|
-
tagName,
|
|
28
|
-
attributes,
|
|
29
|
-
};
|
|
30
|
-
}
|