@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
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { fetchAndApplyTheme, fetchAssets, fetchTheme } from './fetchTheme';
|
|
3
|
-
import type { AssetsResponse, ThemeConfig } from './themeTypes';
|
|
4
|
-
|
|
5
|
-
const mockApiGet = vi.fn();
|
|
6
|
-
const mockFetch = vi.fn();
|
|
7
|
-
|
|
8
|
-
vi.mock('@incodetech/core', () => ({
|
|
9
|
-
api: {
|
|
10
|
-
get: (...args: unknown[]) => mockApiGet(...args),
|
|
11
|
-
},
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
|
-
global.fetch = mockFetch as typeof fetch;
|
|
15
|
-
|
|
16
|
-
class MockFileReaderClass {
|
|
17
|
-
result = '';
|
|
18
|
-
onloadend: (() => void) | null = null;
|
|
19
|
-
onerror: ((error: Event) => void) | null = null;
|
|
20
|
-
readAsDataURL = vi.fn((_blob: Blob) => {
|
|
21
|
-
const mockResult = (global as { __mockFileReaderResult?: string })
|
|
22
|
-
.__mockFileReaderResult;
|
|
23
|
-
if (mockResult) {
|
|
24
|
-
this.result = mockResult;
|
|
25
|
-
}
|
|
26
|
-
setTimeout(() => {
|
|
27
|
-
if (this.onloadend) {
|
|
28
|
-
this.onloadend();
|
|
29
|
-
}
|
|
30
|
-
}, 0);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
constructor() {
|
|
34
|
-
const mockResult = (global as { __mockFileReaderResult?: string })
|
|
35
|
-
.__mockFileReaderResult;
|
|
36
|
-
if (mockResult) {
|
|
37
|
-
this.result = mockResult;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
global.FileReader = MockFileReaderClass as unknown as typeof FileReader;
|
|
43
|
-
|
|
44
|
-
describe('fetchTheme', () => {
|
|
45
|
-
beforeEach(() => {
|
|
46
|
-
vi.clearAllMocks();
|
|
47
|
-
(global as { __mockFileReaderResult?: string }).__mockFileReaderResult =
|
|
48
|
-
undefined;
|
|
49
|
-
const styleElement = document.getElementById('incode-theme');
|
|
50
|
-
if (styleElement) {
|
|
51
|
-
styleElement.remove();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe('fetchAssets', () => {
|
|
56
|
-
it('should fetch assets from API', async () => {
|
|
57
|
-
const mockAssets: AssetsResponse = {
|
|
58
|
-
theme: '/api/theme.json',
|
|
59
|
-
'logo.png': 'https://example.com/logo.png',
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
mockApiGet.mockResolvedValueOnce({
|
|
63
|
-
data: mockAssets,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const result = await fetchAssets();
|
|
67
|
-
|
|
68
|
-
expect(mockApiGet).toHaveBeenCalledWith('/omni/asset/fetch-all');
|
|
69
|
-
expect(result).toEqual(mockAssets);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('should handle API errors', async () => {
|
|
73
|
-
mockApiGet.mockRejectedValueOnce(new Error('Network error'));
|
|
74
|
-
|
|
75
|
-
await expect(fetchAssets()).rejects.toThrow('Network error');
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
describe('fetchTheme', () => {
|
|
80
|
-
it('should fetch theme with relative URL using API', async () => {
|
|
81
|
-
const mockAssets: AssetsResponse = {
|
|
82
|
-
theme: '/api/theme.json',
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const mockTheme: ThemeConfig = {
|
|
86
|
-
main: '#ff0000',
|
|
87
|
-
buttonColor: '#ffffff',
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
mockApiGet
|
|
91
|
-
.mockResolvedValueOnce({
|
|
92
|
-
data: mockAssets,
|
|
93
|
-
})
|
|
94
|
-
.mockResolvedValueOnce({
|
|
95
|
-
data: mockTheme,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const result = await fetchTheme();
|
|
99
|
-
|
|
100
|
-
expect(mockApiGet).toHaveBeenCalledTimes(2);
|
|
101
|
-
expect(mockApiGet).toHaveBeenNthCalledWith(1, '/omni/asset/fetch-all');
|
|
102
|
-
expect(mockApiGet).toHaveBeenNthCalledWith(2, '/api/theme.json');
|
|
103
|
-
expect(result.main).toBe('#ff0000');
|
|
104
|
-
expect(result.buttonColor).toBe('#ffffff');
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should fetch theme with absolute URL using fetch', async () => {
|
|
108
|
-
const mockAssets: AssetsResponse = {
|
|
109
|
-
theme: 'https://example.com/theme.json',
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const mockTheme: ThemeConfig = {
|
|
113
|
-
main: '#00ff00',
|
|
114
|
-
buttonColor: '#000000',
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
mockApiGet.mockResolvedValueOnce({
|
|
118
|
-
data: mockAssets,
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
mockFetch.mockResolvedValueOnce({
|
|
122
|
-
ok: true,
|
|
123
|
-
json: async () => mockTheme,
|
|
124
|
-
} as Response);
|
|
125
|
-
|
|
126
|
-
const result = await fetchTheme();
|
|
127
|
-
|
|
128
|
-
expect(mockApiGet).toHaveBeenCalledTimes(1);
|
|
129
|
-
expect(mockFetch).toHaveBeenCalledWith('https://example.com/theme.json');
|
|
130
|
-
expect(result.main).toBe('#00ff00');
|
|
131
|
-
expect(result.buttonColor).toBe('#000000');
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('should throw error when theme URL is not found in assets', async () => {
|
|
135
|
-
const mockAssets: AssetsResponse = {} as AssetsResponse;
|
|
136
|
-
|
|
137
|
-
mockApiGet.mockResolvedValueOnce({
|
|
138
|
-
data: mockAssets,
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
await expect(fetchTheme()).rejects.toThrow(
|
|
142
|
-
'Theme URL not found in assets response',
|
|
143
|
-
);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('should throw error when absolute URL fetch fails', async () => {
|
|
147
|
-
const mockAssets: AssetsResponse = {
|
|
148
|
-
theme: 'https://example.com/theme.json',
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
mockApiGet.mockResolvedValueOnce({
|
|
152
|
-
data: mockAssets,
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
mockFetch.mockResolvedValueOnce({
|
|
156
|
-
ok: false,
|
|
157
|
-
statusText: 'Not Found',
|
|
158
|
-
} as Response);
|
|
159
|
-
|
|
160
|
-
await expect(fetchTheme()).rejects.toThrow(
|
|
161
|
-
'Failed to fetch theme: Not Found',
|
|
162
|
-
);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('should convert logo URL to data URL', async () => {
|
|
166
|
-
const mockAssets: AssetsResponse = {
|
|
167
|
-
theme: '/api/theme.json',
|
|
168
|
-
'logo.png': 'https://example.com/logo.png',
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const mockTheme: ThemeConfig = {
|
|
172
|
-
main: '#ff0000',
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const mockBlob = new Blob(['logo-data'], { type: 'image/png' });
|
|
176
|
-
|
|
177
|
-
mockApiGet
|
|
178
|
-
.mockResolvedValueOnce({
|
|
179
|
-
data: mockAssets,
|
|
180
|
-
})
|
|
181
|
-
.mockResolvedValueOnce({
|
|
182
|
-
data: mockTheme,
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
mockFetch.mockResolvedValueOnce({
|
|
186
|
-
blob: async () => mockBlob,
|
|
187
|
-
} as Response);
|
|
188
|
-
|
|
189
|
-
(global as { __mockFileReaderResult?: string }).__mockFileReaderResult =
|
|
190
|
-
'data:image/png;base64,logo-data';
|
|
191
|
-
|
|
192
|
-
const result = await fetchTheme();
|
|
193
|
-
|
|
194
|
-
expect(mockFetch).toHaveBeenCalledWith('https://example.com/logo.png');
|
|
195
|
-
expect(result.logo).toBe('data:image/png;base64,logo-data');
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('should return data URL as-is if logo is already a data URL', async () => {
|
|
199
|
-
const mockAssets: AssetsResponse = {
|
|
200
|
-
theme: '/api/theme.json',
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
const mockTheme: ThemeConfig = {
|
|
204
|
-
main: '#ff0000',
|
|
205
|
-
logo: 'data:image/png;base64,existing-data',
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
mockApiGet
|
|
209
|
-
.mockResolvedValueOnce({
|
|
210
|
-
data: mockAssets,
|
|
211
|
-
})
|
|
212
|
-
.mockResolvedValueOnce({
|
|
213
|
-
data: mockTheme,
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
const result = await fetchTheme();
|
|
217
|
-
|
|
218
|
-
expect(result.logo).toBe('data:image/png;base64,existing-data');
|
|
219
|
-
expect(mockFetch).not.toHaveBeenCalled();
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it('should prefer logo from assets over theme', async () => {
|
|
223
|
-
const mockAssets: AssetsResponse = {
|
|
224
|
-
theme: '/api/theme.json',
|
|
225
|
-
'logo.png': 'https://example.com/assets-logo.png',
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
const mockTheme: ThemeConfig = {
|
|
229
|
-
main: '#ff0000',
|
|
230
|
-
logo: 'https://example.com/theme-logo.png',
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
mockApiGet
|
|
234
|
-
.mockResolvedValueOnce({
|
|
235
|
-
data: mockAssets,
|
|
236
|
-
})
|
|
237
|
-
.mockResolvedValueOnce({
|
|
238
|
-
data: mockTheme,
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
mockFetch.mockResolvedValueOnce({
|
|
242
|
-
blob: async () => new Blob(['logo'], { type: 'image/png' }),
|
|
243
|
-
} as Response);
|
|
244
|
-
|
|
245
|
-
(global as { __mockFileReaderResult?: string }).__mockFileReaderResult =
|
|
246
|
-
'data:image/png;base64,assets-logo';
|
|
247
|
-
|
|
248
|
-
await fetchTheme();
|
|
249
|
-
|
|
250
|
-
expect(mockFetch).toHaveBeenCalledWith(
|
|
251
|
-
'https://example.com/assets-logo.png',
|
|
252
|
-
);
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
it('should check multiple logo formats in order', async () => {
|
|
256
|
-
const uniqueUrl = `https://example.com/logo-formats-${Date.now()}.png`;
|
|
257
|
-
const mockAssets: AssetsResponse = {
|
|
258
|
-
theme: '/api/theme.json',
|
|
259
|
-
'logo.svg': `https://example.com/logo-formats-${Date.now()}.svg`,
|
|
260
|
-
'logo.png': uniqueUrl,
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
const mockTheme: ThemeConfig = {
|
|
264
|
-
main: '#ff0000',
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
mockApiGet
|
|
268
|
-
.mockResolvedValueOnce({
|
|
269
|
-
data: mockAssets,
|
|
270
|
-
})
|
|
271
|
-
.mockResolvedValueOnce({
|
|
272
|
-
data: mockTheme,
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
mockFetch.mockResolvedValueOnce({
|
|
276
|
-
blob: async () => new Blob(['logo'], { type: 'image/png' }),
|
|
277
|
-
} as Response);
|
|
278
|
-
|
|
279
|
-
(global as { __mockFileReaderResult?: string }).__mockFileReaderResult =
|
|
280
|
-
'data:image/png;base64,logo-formats';
|
|
281
|
-
|
|
282
|
-
const result = await fetchTheme();
|
|
283
|
-
|
|
284
|
-
expect(mockFetch).toHaveBeenCalledWith(uniqueUrl);
|
|
285
|
-
expect(result.logo).toBe('data:image/png;base64,logo-formats');
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
it('should cache converted logo URLs', async () => {
|
|
289
|
-
const uniqueUrl = `https://example.com/cached-logo-${Date.now()}.png`;
|
|
290
|
-
const mockAssets: AssetsResponse = {
|
|
291
|
-
theme: '/api/theme.json',
|
|
292
|
-
'logo.png': uniqueUrl,
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
const mockTheme: ThemeConfig = {
|
|
296
|
-
main: '#ff0000',
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
mockApiGet
|
|
300
|
-
.mockResolvedValueOnce({
|
|
301
|
-
data: mockAssets,
|
|
302
|
-
})
|
|
303
|
-
.mockResolvedValueOnce({
|
|
304
|
-
data: mockTheme,
|
|
305
|
-
})
|
|
306
|
-
.mockResolvedValueOnce({
|
|
307
|
-
data: mockAssets,
|
|
308
|
-
})
|
|
309
|
-
.mockResolvedValueOnce({
|
|
310
|
-
data: mockTheme,
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
mockFetch.mockResolvedValue({
|
|
314
|
-
blob: async () => new Blob(['logo'], { type: 'image/png' }),
|
|
315
|
-
} as Response);
|
|
316
|
-
|
|
317
|
-
(global as { __mockFileReaderResult?: string }).__mockFileReaderResult =
|
|
318
|
-
'data:image/png;base64,cached-logo';
|
|
319
|
-
|
|
320
|
-
const result1 = await fetchTheme();
|
|
321
|
-
const result2 = await fetchTheme();
|
|
322
|
-
|
|
323
|
-
expect(mockFetch).toHaveBeenCalledTimes(1);
|
|
324
|
-
expect(result1.logo).toBe('data:image/png;base64,cached-logo');
|
|
325
|
-
expect(result2.logo).toBe('data:image/png;base64,cached-logo');
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
describe('fetchAndApplyTheme', () => {
|
|
330
|
-
it('should fetch theme and apply it', async () => {
|
|
331
|
-
const mockAssets: AssetsResponse = {
|
|
332
|
-
theme: '/api/theme.json',
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
const mockTheme: ThemeConfig = {
|
|
336
|
-
main: '#ff0000',
|
|
337
|
-
buttonColor: '#ffffff',
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
mockApiGet
|
|
341
|
-
.mockResolvedValueOnce({
|
|
342
|
-
data: mockAssets,
|
|
343
|
-
})
|
|
344
|
-
.mockResolvedValueOnce({
|
|
345
|
-
data: mockTheme,
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
const result = await fetchAndApplyTheme();
|
|
349
|
-
|
|
350
|
-
expect(result).toEqual({
|
|
351
|
-
...mockTheme,
|
|
352
|
-
logo: undefined,
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
const styleElement = document.getElementById(
|
|
356
|
-
'incode-theme',
|
|
357
|
-
) as HTMLStyleElement;
|
|
358
|
-
expect(styleElement).toBeTruthy();
|
|
359
|
-
expect(styleElement.textContent).toContain('--primitive-color-brand-500');
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
it('should not apply theme if main color is missing', async () => {
|
|
363
|
-
const styleElement = document.getElementById('incode-theme');
|
|
364
|
-
if (styleElement) {
|
|
365
|
-
styleElement.remove();
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
const mockAssets: AssetsResponse = {
|
|
369
|
-
theme: '/api/theme.json',
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
const mockTheme = {
|
|
373
|
-
buttonColor: '#ffffff',
|
|
374
|
-
} as ThemeConfig;
|
|
375
|
-
|
|
376
|
-
mockApiGet
|
|
377
|
-
.mockResolvedValueOnce({
|
|
378
|
-
data: mockAssets,
|
|
379
|
-
})
|
|
380
|
-
.mockResolvedValueOnce({
|
|
381
|
-
data: mockTheme,
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
await fetchAndApplyTheme();
|
|
385
|
-
|
|
386
|
-
const newStyleElement = document.getElementById('incode-theme');
|
|
387
|
-
expect(newStyleElement).toBeFalsy();
|
|
388
|
-
});
|
|
389
|
-
});
|
|
390
|
-
});
|
package/src/styles/fetchTheme.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { api } from '@incodetech/core';
|
|
2
|
-
import { applyTheme } from './applyTheme';
|
|
3
|
-
import type { AssetsResponse, ThemeConfig } from './themeTypes';
|
|
4
|
-
|
|
5
|
-
export async function fetchAssets(): Promise<AssetsResponse> {
|
|
6
|
-
const response = await api.get<AssetsResponse>('/omni/asset/fetch-all');
|
|
7
|
-
return response.data;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const dataUrlCache = new Map<string, string>();
|
|
11
|
-
|
|
12
|
-
async function urlToDataUrl(url: string): Promise<string> {
|
|
13
|
-
if (url.startsWith('data:')) {
|
|
14
|
-
return url;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const cached = dataUrlCache.get(url);
|
|
18
|
-
if (cached) {
|
|
19
|
-
return cached;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const response = await fetch(url);
|
|
23
|
-
const blob = await response.blob();
|
|
24
|
-
const dataUrl = await new Promise<string>((resolve, reject) => {
|
|
25
|
-
const reader = new FileReader();
|
|
26
|
-
reader.onloadend = () => resolve(reader.result as string);
|
|
27
|
-
reader.onerror = reject;
|
|
28
|
-
reader.readAsDataURL(blob);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
dataUrlCache.set(url, dataUrl);
|
|
32
|
-
return dataUrl;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export async function fetchTheme(): Promise<ThemeConfig> {
|
|
36
|
-
const assets = await fetchAssets();
|
|
37
|
-
|
|
38
|
-
if (!assets.theme) {
|
|
39
|
-
throw new Error('Theme URL not found in assets response');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const themeUrl = assets.theme;
|
|
43
|
-
const isAbsoluteUrl =
|
|
44
|
-
themeUrl.startsWith('http://') || themeUrl.startsWith('https://');
|
|
45
|
-
|
|
46
|
-
let theme: ThemeConfig;
|
|
47
|
-
|
|
48
|
-
if (isAbsoluteUrl) {
|
|
49
|
-
const themeResponse = await fetch(themeUrl);
|
|
50
|
-
|
|
51
|
-
if (!themeResponse.ok) {
|
|
52
|
-
throw new Error(`Failed to fetch theme: ${themeResponse.statusText}`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
theme = (await themeResponse.json()) as ThemeConfig;
|
|
56
|
-
} else {
|
|
57
|
-
const themeResponse = await api.get<ThemeConfig>(themeUrl);
|
|
58
|
-
theme = themeResponse.data;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const logoUrl =
|
|
62
|
-
assets['logo.png'] ||
|
|
63
|
-
assets['logo.svg'] ||
|
|
64
|
-
assets['logo.jpg'] ||
|
|
65
|
-
assets['logo.jpeg'] ||
|
|
66
|
-
assets['logo.webp'] ||
|
|
67
|
-
theme.logo;
|
|
68
|
-
|
|
69
|
-
let cachedLogoUrl = logoUrl;
|
|
70
|
-
if (logoUrl) {
|
|
71
|
-
cachedLogoUrl = await urlToDataUrl(logoUrl);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
...theme,
|
|
76
|
-
logo: cachedLogoUrl,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export async function fetchAndApplyTheme(): Promise<ThemeConfig> {
|
|
81
|
-
const theme = await fetchTheme();
|
|
82
|
-
|
|
83
|
-
if (theme.main) {
|
|
84
|
-
applyTheme(theme.main, theme.buttonColor);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return theme;
|
|
88
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
type HslColor = {
|
|
2
|
-
h: number;
|
|
3
|
-
s: number;
|
|
4
|
-
l: number;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
function hexToHsl(hex: string): HslColor | null {
|
|
8
|
-
let normalizedHex = hex.replace('#', '');
|
|
9
|
-
if (normalizedHex.length === 3) {
|
|
10
|
-
normalizedHex = normalizedHex
|
|
11
|
-
.split('')
|
|
12
|
-
.map((char) => char + char)
|
|
13
|
-
.join('');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const result = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(normalizedHex);
|
|
17
|
-
if (!result) return null;
|
|
18
|
-
|
|
19
|
-
const r = Number.parseInt(result[1], 16) / 255;
|
|
20
|
-
const g = Number.parseInt(result[2], 16) / 255;
|
|
21
|
-
const b = Number.parseInt(result[3], 16) / 255;
|
|
22
|
-
|
|
23
|
-
const max = Math.max(r, g, b);
|
|
24
|
-
const min = Math.min(r, g, b);
|
|
25
|
-
let h = 0;
|
|
26
|
-
let s = 0;
|
|
27
|
-
const l = (max + min) / 2;
|
|
28
|
-
|
|
29
|
-
if (max !== min) {
|
|
30
|
-
const d = max - min;
|
|
31
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
32
|
-
|
|
33
|
-
switch (max) {
|
|
34
|
-
case r:
|
|
35
|
-
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
36
|
-
break;
|
|
37
|
-
case g:
|
|
38
|
-
h = ((b - r) / d + 2) / 6;
|
|
39
|
-
break;
|
|
40
|
-
case b:
|
|
41
|
-
h = ((r - g) / d + 4) / 6;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return { h: h * 360, s: s * 100, l: l * 100 };
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function hslToHex(h: number, s: number, l: number): string {
|
|
50
|
-
const hNorm = h / 360;
|
|
51
|
-
const sNorm = s / 100;
|
|
52
|
-
const lNorm = l / 100;
|
|
53
|
-
|
|
54
|
-
let r: number;
|
|
55
|
-
let g: number;
|
|
56
|
-
let b: number;
|
|
57
|
-
|
|
58
|
-
if (sNorm === 0) {
|
|
59
|
-
r = g = b = lNorm;
|
|
60
|
-
} else {
|
|
61
|
-
const hue2rgb = (p: number, q: number, t: number) => {
|
|
62
|
-
if (t < 0) t += 1;
|
|
63
|
-
if (t > 1) t -= 1;
|
|
64
|
-
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
65
|
-
if (t < 1 / 2) return q;
|
|
66
|
-
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
67
|
-
return p;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const q = lNorm < 0.5 ? lNorm * (1 + sNorm) : lNorm + sNorm - lNorm * sNorm;
|
|
71
|
-
const p = 2 * lNorm - q;
|
|
72
|
-
|
|
73
|
-
r = hue2rgb(p, q, hNorm + 1 / 3);
|
|
74
|
-
g = hue2rgb(p, q, hNorm);
|
|
75
|
-
b = hue2rgb(p, q, hNorm - 1 / 3);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const toHex = (n: number) => {
|
|
79
|
-
const hex = Math.round(n * 255).toString(16);
|
|
80
|
-
return hex.length === 1 ? `0${hex}` : hex;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export type BrandPalette = {
|
|
87
|
-
'50': string;
|
|
88
|
-
'200': string;
|
|
89
|
-
'300': string;
|
|
90
|
-
'400': string;
|
|
91
|
-
'500': string;
|
|
92
|
-
'600': string;
|
|
93
|
-
'900': string;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export function generateBrandPalette(mainColor: string): BrandPalette {
|
|
97
|
-
const hsl = hexToHsl(mainColor);
|
|
98
|
-
if (!hsl) {
|
|
99
|
-
throw new Error(`Invalid color format: ${mainColor}`);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
'50': hslToHex(hsl.h, hsl.s, 95),
|
|
104
|
-
'200': hslToHex(hsl.h, hsl.s, 80),
|
|
105
|
-
'300': hslToHex(hsl.h, hsl.s, 65),
|
|
106
|
-
'400': hslToHex(hsl.h, hsl.s, Math.min(100, hsl.l + 10)),
|
|
107
|
-
'500': mainColor,
|
|
108
|
-
'600': hslToHex(hsl.h, hsl.s, Math.max(0, hsl.l - 10)),
|
|
109
|
-
'900': hslToHex(hsl.h, hsl.s, 20),
|
|
110
|
-
};
|
|
111
|
-
}
|
package/src/styles/reset.css
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
.IncodeComponent,
|
|
2
|
-
.IncodeComponent * {
|
|
3
|
-
box-sizing: border-box;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.IncodeComponent {
|
|
7
|
-
font-family: var(--primitive-typography-family-dm-sans), sans-serif;
|
|
8
|
-
-webkit-font-smoothing: antialiased;
|
|
9
|
-
-moz-osx-font-smoothing: grayscale;
|
|
10
|
-
text-rendering: optimizeLegibility;
|
|
11
|
-
color: var(--text-body-primary);
|
|
12
|
-
margin: 0;
|
|
13
|
-
padding: 0;
|
|
14
|
-
height: 100%;
|
|
15
|
-
width: 100%;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.IncodeComponent {
|
|
19
|
-
*,
|
|
20
|
-
::after,
|
|
21
|
-
::before,
|
|
22
|
-
::backdrop,
|
|
23
|
-
::file-selector-button {
|
|
24
|
-
margin: 0;
|
|
25
|
-
padding: 0;
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
border: 0 solid;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
h1,
|
|
31
|
-
h2,
|
|
32
|
-
h3,
|
|
33
|
-
h4,
|
|
34
|
-
h5,
|
|
35
|
-
h6 {
|
|
36
|
-
font-size: inherit;
|
|
37
|
-
font-weight: inherit;
|
|
38
|
-
margin: 0;
|
|
39
|
-
padding: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
ol,
|
|
43
|
-
ul,
|
|
44
|
-
menu {
|
|
45
|
-
list-style: none;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
img,
|
|
49
|
-
svg,
|
|
50
|
-
video,
|
|
51
|
-
canvas,
|
|
52
|
-
audio,
|
|
53
|
-
iframe,
|
|
54
|
-
embed,
|
|
55
|
-
object {
|
|
56
|
-
display: block;
|
|
57
|
-
vertical-align: middle;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
img,
|
|
61
|
-
video {
|
|
62
|
-
max-width: 100%;
|
|
63
|
-
height: auto;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export const resolveCssVariableToHex = (cssVar: string): string | null => {
|
|
2
|
-
if (typeof document === 'undefined') return null;
|
|
3
|
-
|
|
4
|
-
const tempEl = document.createElement('div');
|
|
5
|
-
tempEl.style.color = cssVar;
|
|
6
|
-
tempEl.style.position = 'absolute';
|
|
7
|
-
tempEl.style.visibility = 'hidden';
|
|
8
|
-
document.body.appendChild(tempEl);
|
|
9
|
-
|
|
10
|
-
const computedColor = getComputedStyle(tempEl).color;
|
|
11
|
-
document.body.removeChild(tempEl);
|
|
12
|
-
|
|
13
|
-
if (!computedColor || computedColor === 'transparent') return null;
|
|
14
|
-
|
|
15
|
-
const rgbMatch = computedColor.match(/\d+/g);
|
|
16
|
-
if (rgbMatch && rgbMatch.length >= 3) {
|
|
17
|
-
const r = Number.parseInt(rgbMatch[0], 10);
|
|
18
|
-
const g = Number.parseInt(rgbMatch[1], 10);
|
|
19
|
-
const b = Number.parseInt(rgbMatch[2], 10);
|
|
20
|
-
const toHex = (n: number) => {
|
|
21
|
-
const hex = n.toString(16);
|
|
22
|
-
return hex.length === 1 ? `0${hex}` : hex;
|
|
23
|
-
};
|
|
24
|
-
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
};
|