@incodetech/web 2.0.0-alpha.5 → 2.0.0-alpha.7

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.
@@ -0,0 +1,20 @@
1
+ import { setup as p } from "@incodetech/core";
2
+ import { c, s as m } from "./instance-B-q0ZREN.js";
3
+ import "./vendor-preact-CK0WeTOR.js";
4
+ import { s as f } from "./uiConfig-CQ1W9cUD.js";
5
+ async function y({
6
+ apiURL: t,
7
+ token: a,
8
+ customHeaders: n,
9
+ timeout: e,
10
+ wasm: o,
11
+ i18n: r,
12
+ uiConfig: s
13
+ }) {
14
+ s && f(s), await p({ apiURL: t, token: a, customHeaders: n, timeout: e, wasm: o });
15
+ const i = c(r);
16
+ m(i);
17
+ }
18
+ export {
19
+ y as s
20
+ };
@@ -52,8 +52,8 @@
52
52
  --primitive-color-negative-950: #240001;
53
53
 
54
54
  /* Typography / Family */
55
- --primitive-typography-family-rethink-sans: "Rethink Sans";
56
- --primitive-typography-family-dm-sans: "DM Sans";
55
+ --primitive-typography-family-rethink-sans: 'Rethink Sans';
56
+ --primitive-typography-family-dm-sans: 'DM Sans';
57
57
 
58
58
  /* Typography / Size */
59
59
 
@@ -294,7 +294,7 @@
294
294
  --text-status-positive: var(--primitive-color-positive-600);
295
295
  --text-status-positive-static: var(--primitive-color-positive-600);
296
296
  }
297
- [data-incode-theme="dark"] {
297
+ [data-incode-theme='dark'] {
298
298
  /* Surface / Neutral */
299
299
 
300
300
  --surface-neutral-0: var(--primitive-color-gray-1000);
@@ -52,8 +52,8 @@
52
52
  --primitive-color-negative-950: #240001;
53
53
 
54
54
  /* Typography / Family */
55
- --primitive-typography-family-rethink-sans: "Rethink Sans";
56
- --primitive-typography-family-dm-sans: "DM Sans";
55
+ --primitive-typography-family-rethink-sans: 'Rethink Sans';
56
+ --primitive-typography-family-dm-sans: 'DM Sans';
57
57
 
58
58
  /* Typography / Size */
59
59
 
@@ -294,7 +294,7 @@
294
294
  --text-status-positive: var(--primitive-color-positive-600);
295
295
  --text-status-positive-static: var(--primitive-color-positive-600);
296
296
  }
297
- [data-incode-theme="dark"] {
297
+ [data-incode-theme='dark'] {
298
298
  /* Surface / Neutral */
299
299
 
300
300
  --surface-neutral-0: var(--primitive-color-gray-1000);
@@ -0,0 +1,25 @@
1
+ import { d as o, y as s } from "./vendor-preact-CK0WeTOR.js";
2
+ import { g as l } from "./instance-B-q0ZREN.js";
3
+ import { u as c } from "./incodeModule-Dv8Qllrv.js";
4
+ function h() {
5
+ const n = l(), [, e] = o(0), [d, r] = o(n.isInitialized);
6
+ return s(() => {
7
+ const t = () => {
8
+ e((a) => a + 1);
9
+ }, i = () => {
10
+ r(!0), e((a) => a + 1);
11
+ };
12
+ return n.on("languageChanged", t), n.on("initialized", i), n.on("loaded", t), () => {
13
+ n.off("languageChanged", t), n.off("initialized", i), n.off("loaded", t);
14
+ };
15
+ }, [n]), {
16
+ t: n.t.bind(n),
17
+ ready: d,
18
+ i18n: n
19
+ };
20
+ }
21
+ const m = ({ children: n, className: e }) => /* @__PURE__ */ c("h2", { class: `IncodeTitle ${e ?? ""}`, children: n });
22
+ export {
23
+ m as T,
24
+ h as u
25
+ };
@@ -1,4 +1,4 @@
1
- import { EmailConfig } from '../../../core/src/email';
1
+ import { EmailConfig } from '@incodetech/core/email';
2
2
  import { FC } from 'preact/compat';
3
3
 
4
4
  /**
@@ -48,3 +48,9 @@ declare type IncodeModuleProps<TConfig> = {
48
48
  };
49
49
 
50
50
  export { }
51
+
52
+ declare global {
53
+ interface HTMLElementTagNameMap {
54
+ 'incode-email': HTMLElement & IncodeModuleProps<EmailConfig>;
55
+ }
56
+ }
@@ -1,23 +1,40 @@
1
1
  import { FC } from 'preact/compat';
2
- import { FinishStatus } from '../../../core/src/flow';
3
- import { WasmConfig } from '../../../core/src';
2
+ import { FinishStatus } from '@incodetech/core/flow';
3
+ import { WasmConfig } from '@incodetech/core';
4
4
 
5
- export declare const IncodeFlow: FC<IncodeFlowProps>;
6
-
7
- export declare type IncodeFlowProps = {
5
+ export declare type FlowConfig = {
8
6
  apiURL: string;
9
7
  token: string;
10
8
  wasmConfig?: WasmConfig;
11
9
  lang?: string;
12
10
  disableDashboardTheme?: boolean;
13
11
  onComplete: (result: FinishStatus) => void;
14
- onError?: (error: string) => void;
15
12
  onModuleLoading?: (moduleKey: string) => void;
16
13
  onModuleLoaded?: (moduleKey: string) => void;
17
14
  onWasmWarmup?: (pipelines: string[]) => void;
18
15
  spinnerConfig?: SpinnerConfig;
19
16
  };
20
17
 
18
+ export declare const IncodeFlow: FC<IncodeFlowProps>;
19
+
20
+ declare type IncodeFlowProps = IncodeModuleProps<FlowConfig>;
21
+
22
+ declare type IncodeModuleProps<TConfig> = {
23
+ /**
24
+ * Module configuration required to render the flow.
25
+ * For Web Components, this is typically assigned via `element.config = ...`.
26
+ */
27
+ config?: TConfig;
28
+ /**
29
+ * Callback invoked when the module completes successfully.
30
+ */
31
+ onFinish?: () => void;
32
+ /**
33
+ * Callback invoked when a fatal module error occurs.
34
+ */
35
+ onError?: (error: string | undefined) => void;
36
+ };
37
+
21
38
  declare type PreloadConfig = {
22
39
  apiURL: string;
23
40
  token: string;
@@ -44,3 +61,9 @@ export declare type SpinnerConfig = {
44
61
  declare type SpinnerSize = 'small' | 'medium' | 'large';
45
62
 
46
63
  export { }
64
+
65
+ declare global {
66
+ interface HTMLElementTagNameMap {
67
+ 'incode-flow': HTMLElement & IncodeModuleProps<FlowConfig>;
68
+ }
69
+ }
@@ -1,165 +1,12 @@
1
- import { EmailConfig } from '../../../core/src/email';
2
- import { FC } from 'preact/compat';
3
- import { FinishStatus } from '../../../core/src/flow';
4
- import { i18n } from 'i18next';
5
- import { PhoneConfig } from '../../../core/src/phone';
6
- import { SelfieConfig } from '../../../core/src/selfie';
7
- import { TFunction } from 'i18next';
8
- import { WasmConfig } from '../../../core/src';
9
- import { WasmConfig as WasmConfig_2 } from '../../core/src';
10
-
11
- export declare const FlowCompleted: FC<FlowCompletedProps>;
12
-
13
- /**
14
- * Element type for the `<incode-flow-completed>` web component.
15
- *
16
- * @example
17
- * ```typescript
18
- * const completed = document.createElement('incode-flow-completed');
19
- * completed.action = 'approved';
20
- * completed.scoreStatus = 'OK';
21
- * document.body.appendChild(completed);
22
- * ```
23
- */
24
- export declare type FlowCompletedElement = HTMLElement & FlowCompletedProps;
25
-
26
- export declare type FlowCompletedProps = {
27
- title?: string;
28
- message?: string;
29
- redirectionUrl?: string;
30
- action?: 'approved' | 'rejected' | 'none';
31
- scoreStatus?: 'OK' | 'WARN' | 'MANUAL_OK' | 'FAIL' | 'UNKNOWN' | 'MANUAL_FAIL';
32
- redirectDelay?: number;
33
- disableRedirect?: boolean;
34
- redirectOriginOnly?: boolean;
35
- flowId?: string;
36
- interviewId?: string;
37
- };
38
-
39
- export declare const FlowStart: FC<FlowStartProps>;
40
-
41
- declare type FlowStartProps = {
42
- logoUrl?: string;
43
- subtitle?: string;
44
- onStart: () => void;
45
- };
1
+ import { WasmConfig } from '@incodetech/core';
46
2
 
47
3
  declare type I18nOptions = {
48
4
  lang?: string;
49
5
  translations?: Translations;
50
6
  };
51
7
 
52
- /**
53
- * Element type for the `<incode-email>` web component.
54
- *
55
- * @example
56
- * ```typescript
57
- * const email = document.createElement('incode-email');
58
- * email.config = { otpVerification: true, otpExpirationInMinutes: 5 };
59
- * email.onFinish = () => console.log('Email verified!');
60
- * email.onError = (error) => console.error(error);
61
- * document.body.appendChild(email);
62
- * ```
63
- */
64
- export declare type IncodeEmailElement = HTMLElement & IncodeModuleProps<EmailConfig>;
65
-
66
- export declare const IncodeFlow: FC<IncodeFlowProps>;
67
-
68
- /**
69
- * Element type for the `<incode-flow>` web component.
70
- *
71
- * @example
72
- * ```typescript
73
- * const flow = document.createElement('incode-flow');
74
- * flow.apiURL = 'https://api.example.com';
75
- * flow.token = 'session-token';
76
- * flow.onComplete = (result) => console.log(result);
77
- * document.body.appendChild(flow);
78
- * ```
79
- */
80
- export declare type IncodeFlowElement = HTMLElement & IncodeFlowProps;
81
-
82
- export declare type IncodeFlowProps = {
83
- apiURL: string;
84
- token: string;
85
- wasmConfig?: WasmConfig;
86
- lang?: string;
87
- disableDashboardTheme?: boolean;
88
- onComplete: (result: FinishStatus) => void;
89
- onError?: (error: string) => void;
90
- onModuleLoading?: (moduleKey: string) => void;
91
- onModuleLoaded?: (moduleKey: string) => void;
92
- onWasmWarmup?: (pipelines: string[]) => void;
93
- spinnerConfig?: SpinnerConfig;
94
- };
95
-
96
- export declare type IncodeModuleProps<TConfig> = {
97
- /**
98
- * Module configuration required to render the flow.
99
- * For Web Components, this is typically assigned via `element.config = ...`.
100
- */
101
- config?: TConfig;
102
- /**
103
- * Callback invoked when the module completes successfully.
104
- */
105
- onFinish?: () => void;
106
- /**
107
- * Callback invoked when a fatal module error occurs.
108
- */
109
- onError?: (error: string | undefined) => void;
110
- };
111
-
112
- /**
113
- * Element type for the `<incode-phone>` web component.
114
- *
115
- * @example
116
- * ```typescript
117
- * const phone = document.createElement('incode-phone');
118
- * phone.config = { otpVerification: true, otpExpirationInMinutes: 5 };
119
- * phone.onFinish = () => console.log('Phone verified!');
120
- * phone.onError = (error) => console.error(error);
121
- * document.body.appendChild(phone);
122
- * ```
123
- */
124
- export declare type IncodePhoneElement = HTMLElement & IncodeModuleProps<PhoneConfig>;
125
-
126
- /**
127
- * Element type for the `<incode-selfie>` web component.
128
- *
129
- * @example
130
- * ```typescript
131
- * const selfie = document.createElement('incode-selfie');
132
- * selfie.config = { showTutorial: true };
133
- * selfie.onFinish = () => console.log('Selfie captured!');
134
- * selfie.onError = (error) => console.error(error);
135
- * document.body.appendChild(selfie);
136
- * ```
137
- */
138
- export declare type IncodeSelfieElement = HTMLElement & IncodeModuleProps<SelfieConfig>;
139
-
140
- declare type InferState<T> = T extends {
141
- getState: () => infer S;
142
- } ? S : never;
143
-
144
8
  declare type LanguageTranslations = Record<string, TranslationValue>;
145
9
 
146
- declare type PreloadConfig = {
147
- apiURL: string;
148
- token: string;
149
- lang?: string;
150
- disableDashboardTheme?: boolean;
151
- wasmConfig?: WasmConfig;
152
- };
153
-
154
- export declare type PreloadHandle = {
155
- get isReady(): boolean;
156
- get error(): string | null;
157
- waitUntilReady(): Promise<void>;
158
- cancel(): void;
159
- };
160
-
161
- export declare function preloadIncodeFlow(config: PreloadConfig): PreloadHandle;
162
-
163
10
  /**
164
11
  * Sets global UI configuration defaults for `@incodetech/ui`.
165
12
  */
@@ -172,19 +19,11 @@ declare type SetupOptions = {
172
19
  token: string;
173
20
  customHeaders?: Record<string, string>;
174
21
  timeout?: number;
175
- wasm?: WasmConfig_2;
22
+ wasm?: WasmConfig;
176
23
  i18n?: I18nOptions;
177
24
  uiConfig?: UiConfig;
178
25
  };
179
26
 
180
- export declare type SpinnerConfig = {
181
- title?: string;
182
- subtitle?: string;
183
- size?: SpinnerSize;
184
- };
185
-
186
- declare type SpinnerSize = 'small' | 'medium' | 'large';
187
-
188
27
  declare type Translations = Partial<Record<string, LanguageTranslations>>;
189
28
 
190
29
  declare type TranslationValue = string | Record<string, unknown>;
@@ -196,28 +35,4 @@ export declare type UiConfig = {
196
35
  hideFooterBranding?: boolean;
197
36
  };
198
37
 
199
- /**
200
- * Hook for subscribing to manager state updates
201
- * @param factory - Factory function that creates the manager instance
202
- * @param options - Configuration options
203
- * @returns Tuple of [state, manager]
204
- */
205
- export declare function useManager<TManager extends {
206
- getState: () => TState;
207
- subscribe: (listener: (state: TState) => void) => () => void;
208
- load?: () => void;
209
- }, TState = InferState<TManager>>(factory: () => TManager, options?: UseManagerOptions): [TState, TManager];
210
-
211
- declare type UseManagerOptions = {
212
- autoLoad?: boolean;
213
- };
214
-
215
- export declare function useTranslation(): UseTranslationReturn;
216
-
217
- declare type UseTranslationReturn = {
218
- t: TFunction;
219
- ready: boolean;
220
- i18n: i18n;
221
- };
222
-
223
38
  export { }
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'preact/compat';
2
- import { PhoneConfig } from '../../../core/src/phone';
2
+ import { PhoneConfig } from '@incodetech/core/phone';
3
3
 
4
4
  declare type IncodeModuleProps<TConfig> = {
5
5
  /**
@@ -49,3 +49,9 @@ export declare const Phone: FC<PhoneProps>;
49
49
  declare type PhoneProps = IncodeModuleProps<PhoneConfig>;
50
50
 
51
51
  export { }
52
+
53
+ declare global {
54
+ interface HTMLElementTagNameMap {
55
+ 'incode-phone': HTMLElement & IncodeModuleProps<PhoneConfig>;
56
+ }
57
+ }
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'preact/compat';
2
- import { SelfieConfig } from '../../../core/src/selfie';
2
+ import { SelfieConfig } from '@incodetech/core/selfie';
3
3
 
4
4
  declare type IncodeModuleProps<TConfig> = {
5
5
  /**
@@ -22,3 +22,9 @@ export declare const Selfie: FC<SelfieProps>;
22
22
  declare type SelfieProps = IncodeModuleProps<SelfieConfig>;
23
23
 
24
24
  export { }
25
+
26
+ declare global {
27
+ interface HTMLElementTagNameMap {
28
+ 'incode-selfie': HTMLElement & IncodeModuleProps<SelfieConfig>;
29
+ }
30
+ }
@@ -0,0 +1 @@
1
+ export { }
@@ -0,0 +1,23 @@
1
+ import { C as i } from "./vendor-preact-CK0WeTOR.js";
2
+ let e = {};
3
+ const t = /* @__PURE__ */ new Set();
4
+ function r(n) {
5
+ return t.add(n), () => {
6
+ t.delete(n);
7
+ };
8
+ }
9
+ function s() {
10
+ return e;
11
+ }
12
+ function f(n) {
13
+ e = n;
14
+ for (const o of t)
15
+ o();
16
+ }
17
+ function c() {
18
+ return i(r, s);
19
+ }
20
+ export {
21
+ f as s,
22
+ c as u
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "2.0.0-alpha.5",
3
+ "version": "2.0.0-alpha.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -19,28 +19,28 @@
19
19
  "default": "./dist/base.css"
20
20
  },
21
21
  "./selfie": {
22
- "types": "./dist/types/selfie/selfie.d.ts",
22
+ "types": "./dist/types/selfie.d.ts",
23
23
  "import": "./dist/selfie/selfie.es.js"
24
24
  },
25
25
  "./selfie/styles.css": {
26
26
  "default": "./dist/selfie/styles.css"
27
27
  },
28
28
  "./phone": {
29
- "types": "./dist/types/phone/phone.d.ts",
29
+ "types": "./dist/types/phone.d.ts",
30
30
  "import": "./dist/phone/phone.es.js"
31
31
  },
32
32
  "./phone/styles.css": {
33
33
  "default": "./dist/phone/styles.css"
34
34
  },
35
35
  "./email": {
36
- "types": "./dist/types/email/email.d.ts",
36
+ "types": "./dist/types/email.d.ts",
37
37
  "import": "./dist/email/email.es.js"
38
38
  },
39
39
  "./email/styles.css": {
40
40
  "default": "./dist/email/styles.css"
41
41
  },
42
42
  "./flow": {
43
- "types": "./dist/types/flow/flow.d.ts",
43
+ "types": "./dist/types/flow.d.ts",
44
44
  "import": "./dist/flow/flow.es.js"
45
45
  },
46
46
  "./flow/styles.css": {
@@ -58,10 +58,9 @@
58
58
  "libphonenumber-js": "^1.11.0",
59
59
  "preact-custom-element": "^4.6.0",
60
60
  "tailwindcss": "^4.1.17",
61
- "@incodetech/core": "2.0.0-alpha.5"
61
+ "@incodetech/core": "2.0.0-alpha.7"
62
62
  },
63
63
  "devDependencies": {
64
- "@biomejs/biome": "^2.3.7",
65
64
  "@preact/preset-vite": "^2.10.2",
66
65
  "@tailwindcss/postcss": "^4.1.17",
67
66
  "@testing-library/preact": "^3.2.4",
@@ -84,8 +83,10 @@
84
83
  "build": "vite build",
85
84
  "test": "vitest run",
86
85
  "coverage": "vitest run --coverage",
87
- "lint": "biome lint .",
88
- "format": "biome format . --write",
86
+ "lint": "eslint .",
87
+ "lint:fix": "eslint . --fix",
88
+ "format": "prettier --write .",
89
+ "format:check": "prettier --check .",
89
90
  "typecheck": "tsc -p tsconfig.json --noEmit"
90
91
  }
91
92
  }