@wf-financing/ui 3.2.0 → 3.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wf-financing/ui",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./dist/index.es.js",
@@ -46,6 +46,7 @@
46
46
  "dev": "vite",
47
47
  "build": "vite build",
48
48
  "preview": "vite preview",
49
+ "analyze": "vite build --mode analyze-html && npx http-server dist/bundle-stats -p 8083",
49
50
  "publish-sdk-cta-ui": "pnpm clean && pnpm build && pnpm publish --access public --no-git-checks",
50
51
  "test": "vitest",
51
52
  "test:coverage": "vitest --coverage"
@@ -1,15 +1,17 @@
1
1
  import { Themes } from '@wayflyer/flyui';
2
2
 
3
3
  export type PartnerTheme = Exclude<Themes, 'staff'>;
4
- export type PartnerId = (typeof WHITELISTED_PARTNER_IDS)[PartnerTheme];
4
+ export type PartnerId = keyof typeof WHITELISTED_PARTNER_IDS;
5
5
 
6
6
  /**
7
7
  * List of partner IDs that are allowed to use custom CTA themes
8
8
  * when embedded into their platform.
9
9
  */
10
10
  export const WHITELISTED_PARTNER_IDS = {
11
- whiteLabel: '2416e2af-c9f7-40ac-a2f0-f37dcfe59674',
12
- wayflyer: '1f309265-5324-4f8b-88d7-9b0d5c77a27c',
13
- athena: '970df87a-e7d5-4942-9450-a77cf771dca3',
11
+ '2416e2af-c9f7-40ac-a2f0-f37dcfe59674': 'whiteLabel',
12
+ '1f309265-5324-4f8b-88d7-9b0d5c77a27c': 'wayflyer',
13
+ '970df87a-e7d5-4942-9450-a77cf771dca3': 'athena',
14
+ '01756129-a8a8-4314-8813-97057195dcfa': 'athena',
15
+
14
16
  defaultTheme: 'defaultTheme',
15
- } as const satisfies Record<PartnerTheme, string>;
17
+ } as const satisfies Record<string, PartnerTheme>;
@@ -1,9 +1,5 @@
1
1
  import { PartnerId, PartnerTheme, WHITELISTED_PARTNER_IDS } from '../config';
2
2
 
3
- const PARTNER_BY_VALUE: Record<PartnerId, PartnerTheme> = Object.fromEntries(
4
- Object.entries(WHITELISTED_PARTNER_IDS).map(([k, v]) => [v, k]),
5
- ) as Record<PartnerId, PartnerTheme>;
6
-
7
3
  export const getPartnerThemeById = (value: PartnerId): PartnerTheme => {
8
- return PARTNER_BY_VALUE[value] || 'whiteLabel';
4
+ return WHITELISTED_PARTNER_IDS[value] || 'whiteLabel';
9
5
  };
@@ -0,0 +1,44 @@
1
+ import react from '@vitejs/plugin-react';
2
+ import path from 'path';
3
+ import { defineConfig, type ConfigEnv, type UserConfig, type PluginOption } from 'vite';
4
+ import { visualizer } from 'rollup-plugin-visualizer';
5
+ import inject from '@rollup/plugin-inject';
6
+
7
+ const visualizerOptions = {
8
+ 'analyze-html': { emitFile: true, filename: `bundle-stats/index.html`, gzipSize: true },
9
+ 'analyze-json': { emitFile: true, filename: `bundle-stats/stats.json`, template: 'raw-data', gzipSize: true },
10
+ };
11
+
12
+ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
13
+ return {
14
+ plugins: [react(), ...(mode?.includes('analyze') ? [visualizer(visualizerOptions[mode])] : [])] as PluginOption[],
15
+ optimizeDeps: {
16
+ exclude: ['@wayflyer/*'],
17
+ },
18
+ define: {
19
+ 'process.env': {},
20
+ 'process.env.NODE_ENV': JSON.stringify(mode),
21
+ },
22
+ server: {
23
+ host: true,
24
+ port: 5176,
25
+ strictPort: true,
26
+ },
27
+ build: {
28
+ lib: {
29
+ entry: path.resolve(__dirname, 'index.ts'),
30
+ name: 'sdkCtaUiComponents',
31
+ fileName: (format) => `index.${format}.js`,
32
+ formats: ['es'],
33
+ },
34
+ rollupOptions: {
35
+ external: [],
36
+ plugins: [
37
+ inject({
38
+ process: 'process',
39
+ }),
40
+ ],
41
+ },
42
+ },
43
+ };
44
+ });
package/vite.config.ts DELETED
@@ -1,31 +0,0 @@
1
- /// <reference types="vitest/config" />
2
- import react from '@vitejs/plugin-react';
3
- import path from 'path';
4
- import { defineConfig } from 'vite';
5
-
6
- export default defineConfig(({ mode }) => ({
7
- plugins: [react()],
8
- optimizeDeps: {
9
- exclude: ['@wayflyer/*'],
10
- },
11
- define: {
12
- 'process.env': {},
13
- 'process.env.NODE_ENV': JSON.stringify(mode),
14
- },
15
- server: {
16
- host: true,
17
- port: 5176,
18
- strictPort: true,
19
- },
20
- build: {
21
- lib: {
22
- entry: path.resolve(__dirname, 'index.ts'),
23
- name: 'sdkCtaUiComponents',
24
- fileName: (format) => `index.${format}.js`,
25
- formats: ['es'],
26
- },
27
- rollupOptions: {
28
- external: [],
29
- },
30
- },
31
- }));