@widgetic/ui-sdk 0.0.0-stage → 0.1.2
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/README.md +725 -2
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +2525 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2559 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk/core/component.d.ts +47 -0
- package/dist/sdk/core/component.d.ts.map +1 -0
- package/dist/sdk/core/events.d.ts +26 -0
- package/dist/sdk/core/events.d.ts.map +1 -0
- package/dist/sdk/core/index.d.ts +33 -0
- package/dist/sdk/core/index.d.ts.map +1 -0
- package/dist/sdk/core/lifecycle.d.ts +97 -0
- package/dist/sdk/core/lifecycle.d.ts.map +1 -0
- package/dist/sdk/core/local-events.d.ts +25 -0
- package/dist/sdk/core/local-events.d.ts.map +1 -0
- package/dist/sdk/core/messaging.d.ts +58 -0
- package/dist/sdk/core/messaging.d.ts.map +1 -0
- package/dist/sdk/core/state.d.ts +58 -0
- package/dist/sdk/core/state.d.ts.map +1 -0
- package/dist/sdk/core/theme-mode.d.ts +44 -0
- package/dist/sdk/core/theme-mode.d.ts.map +1 -0
- package/dist/sdk/core/theme.d.ts +58 -0
- package/dist/sdk/core/theme.d.ts.map +1 -0
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/integration/host.d.ts +54 -0
- package/dist/sdk/integration/host.d.ts.map +1 -0
- package/dist/sdk/integration/index.d.ts +19 -0
- package/dist/sdk/integration/index.d.ts.map +1 -0
- package/dist/sdk/layers/index.d.ts +36 -0
- package/dist/sdk/layers/index.d.ts.map +1 -0
- package/dist/sdk/loader/ui.d.ts +165 -0
- package/dist/sdk/loader/ui.d.ts.map +1 -0
- package/dist/sdk/modules/index.d.ts +9 -0
- package/dist/sdk/modules/index.d.ts.map +1 -0
- package/dist/sdk/modules/loader.d.ts +84 -0
- package/dist/sdk/modules/loader.d.ts.map +1 -0
- package/dist/sdk/types/component.d.ts +177 -0
- package/dist/sdk/types/component.d.ts.map +1 -0
- package/dist/sdk/types/events.d.ts +112 -0
- package/dist/sdk/types/events.d.ts.map +1 -0
- package/dist/sdk/types/index.d.ts +42 -0
- package/dist/sdk/types/index.d.ts.map +1 -0
- package/dist/sdk/types/messaging.d.ts +41 -0
- package/dist/sdk/types/messaging.d.ts.map +1 -0
- package/dist/sdk/types/module-language.d.ts +45 -0
- package/dist/sdk/types/module-language.d.ts.map +1 -0
- package/dist/sdk/types/module-theme.d.ts +93 -0
- package/dist/sdk/types/module-theme.d.ts.map +1 -0
- package/dist/sdk/types/state.d.ts +38 -0
- package/dist/sdk/types/state.d.ts.map +1 -0
- package/dist/sdk/types/theme.d.ts +76 -0
- package/dist/sdk/types/theme.d.ts.map +1 -0
- package/dist/sdk/utils/config.d.ts +70 -0
- package/dist/sdk/utils/config.d.ts.map +1 -0
- package/dist/sdk/utils/errors.d.ts +56 -0
- package/dist/sdk/utils/errors.d.ts.map +1 -0
- package/dist/sdk/utils/http.d.ts +21 -0
- package/dist/sdk/utils/http.d.ts.map +1 -0
- package/dist/sdk/utils/security.d.ts +95 -0
- package/dist/sdk/utils/security.d.ts.map +1 -0
- package/dist/sdk/utils/validation.d.ts +64 -0
- package/dist/sdk/utils/validation.d.ts.map +1 -0
- package/dist/sdk/version.d.ts +8 -0
- package/dist/sdk/version.d.ts.map +1 -0
- package/dist/services/dataService.d.ts +10 -0
- package/dist/services/dataService.d.ts.map +1 -0
- package/dist/umd/ui-sdk.js +2 -0
- package/dist/umd/ui-sdk.js.map +1 -0
- package/dist/utils/caseConversion.d.ts +3 -0
- package/dist/utils/caseConversion.d.ts.map +1 -0
- package/package.json +91 -4
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export declare class SecurityManager {
|
|
2
|
+
private allowedOrigins;
|
|
3
|
+
/**
|
|
4
|
+
* Validate domain against allowed list
|
|
5
|
+
* @param domain - Domain to validate
|
|
6
|
+
* @returns boolean indicating if domain is valid
|
|
7
|
+
*/
|
|
8
|
+
validateDomain(domain: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Development CSP Configuration
|
|
11
|
+
* Relaxed rules for local development
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
private readonly DEVELOPMENT_CSP;
|
|
15
|
+
/**
|
|
16
|
+
* Production CSP Configuration
|
|
17
|
+
* Strict rules for production environment
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
private readonly PRODUCTION_CSP;
|
|
21
|
+
/**
|
|
22
|
+
* Allowed Development Origins
|
|
23
|
+
* Origins that are always allowed in development
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
private readonly ALLOWED_DEV_ORIGINS;
|
|
27
|
+
/**
|
|
28
|
+
* Initialize security manager
|
|
29
|
+
* Sets up CSP and configures allowed origins
|
|
30
|
+
* @param allowedOrigins - List of allowed origins
|
|
31
|
+
*/
|
|
32
|
+
constructor(allowedOrigins?: string[]);
|
|
33
|
+
/**
|
|
34
|
+
* Set up Content Security Policy
|
|
35
|
+
* In an embedded UI SDK, injecting top-level document CSP meta tags
|
|
36
|
+
* can interfere with the host application. Boundaries are maintained
|
|
37
|
+
* via iframe isolation and shadow DOM scoping.
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private setupCSP;
|
|
41
|
+
/**
|
|
42
|
+
* Build CSP directive string
|
|
43
|
+
* Converts CSP config to valid directive string
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
private buildCSPString;
|
|
47
|
+
/**
|
|
48
|
+
* Validate request origin
|
|
49
|
+
* Checks if origin is allowed to make requests
|
|
50
|
+
* @param origin - Request origin to validate
|
|
51
|
+
*/
|
|
52
|
+
validateOrigin(origin: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Validate HTTP request
|
|
55
|
+
* Checks origin and CSRF token
|
|
56
|
+
* @param request - Request to validate
|
|
57
|
+
*/
|
|
58
|
+
validateRequest(request: Request): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Validate CSRF token
|
|
61
|
+
* Placeholder for CSRF token validation
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
private validateCSRFToken;
|
|
65
|
+
/**
|
|
66
|
+
* Validate message event
|
|
67
|
+
* Checks message structure and content
|
|
68
|
+
* @param event - Message event to validate
|
|
69
|
+
*/
|
|
70
|
+
validateMessage(event: MessageEvent): boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate origin against allowed list
|
|
74
|
+
* @param origin - Origin to validate
|
|
75
|
+
* @param allowedOrigins - List of allowed origins
|
|
76
|
+
* @returns True if origin is valid
|
|
77
|
+
*/
|
|
78
|
+
export declare function validateOrigin(origin: string, allowedOrigins?: string[]): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Sanitize input string
|
|
81
|
+
* @param input - Input to sanitize
|
|
82
|
+
* @returns Sanitized input
|
|
83
|
+
*/
|
|
84
|
+
export declare function sanitizeInput(input: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Create secure context for iframe communication
|
|
87
|
+
* @param allowedOrigins - List of allowed origins
|
|
88
|
+
* @returns Security context
|
|
89
|
+
*/
|
|
90
|
+
export declare function createSecureContext(allowedOrigins?: string[]): {
|
|
91
|
+
validateMessage: (event: MessageEvent) => boolean;
|
|
92
|
+
validateOrigin: (origin: string) => boolean;
|
|
93
|
+
sanitizeInput: typeof sanitizeInput;
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/security.ts"],"names":[],"mappings":"AAiCA,qBAAa,eAAe;IAuGZ,OAAO,CAAC,cAAc;IAtGlC;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAgCvC;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAmB9B;IAEF;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAe7B;IAEF;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAKlC;IAEF;;;;OAIG;gBACiB,cAAc,GAAE,MAAM,EAAO;IAIjD;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAiBtB;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAwCvC;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IA8B1C;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAKzB;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;CAuBhD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,GAAE,MAAM,EAAO,GAAG,OAAO,CAGrF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWnD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,GAAE,MAAM,EAAO;6BAIhC,YAAY;6BACZ,MAAM;;EAGtC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare class ValidationUtils {
|
|
2
|
+
/**
|
|
3
|
+
* Validate component or resource ID
|
|
4
|
+
* Ensures ID is non-empty string and properly formatted
|
|
5
|
+
* @param id - ID to validate
|
|
6
|
+
* @param context - Context for error messages
|
|
7
|
+
* @throws Error if ID is invalid
|
|
8
|
+
*/
|
|
9
|
+
static validateId(id: string | undefined, context: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Validate DOM container element
|
|
12
|
+
* Checks container existence and type, handles both selectors and elements
|
|
13
|
+
* @param container - Container element or selector
|
|
14
|
+
* @param context - Context for error messages
|
|
15
|
+
* @returns Validated HTMLElement
|
|
16
|
+
* @throws Error if container is invalid
|
|
17
|
+
*/
|
|
18
|
+
static validateContainer(container: string | HTMLElement | undefined, context: string): HTMLElement;
|
|
19
|
+
/**
|
|
20
|
+
* Refuse to run where there is no page
|
|
21
|
+
* Importing and constructing the SDK is safe on a server (it touches nothing), but a module can only be shown in a
|
|
22
|
+
* browser. Mounting during server-side rendering is a mistake worth a clear message, not "document is not defined".
|
|
23
|
+
* @param context - What was being attempted, for the message
|
|
24
|
+
* @throws Error with code NOT_IN_BROWSER when there is no `document`
|
|
25
|
+
*/
|
|
26
|
+
static requireBrowser(context: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Refuse an API key in SDK options
|
|
29
|
+
* An API key must never be in a browser: whoever opens the page's developer tools could read it. The partner's
|
|
30
|
+
* server keeps the key, mints an editor session token with it, and the page's `getToken` returns that token.
|
|
31
|
+
* Both the current spelling (`apiKey`) and the old one (`partner: { apiKey }`) are refused, with a message that
|
|
32
|
+
* says what to do instead. The key itself is never put into the message.
|
|
33
|
+
* @param options - SDK or mount options to check
|
|
34
|
+
* @throws Error with code API_KEY_NOT_ALLOWED if an API key is present
|
|
35
|
+
*/
|
|
36
|
+
static rejectApiKey(options: unknown): void;
|
|
37
|
+
/**
|
|
38
|
+
* Validate configuration object
|
|
39
|
+
* Checks for required fields in configuration objects
|
|
40
|
+
* @param config - Configuration object to validate
|
|
41
|
+
* @param requiredFields - Array of required field names
|
|
42
|
+
* @param context - Context for error messages
|
|
43
|
+
* @throws Error if required fields are missing
|
|
44
|
+
*/
|
|
45
|
+
static validateConfig(config: Record<string, any> | undefined, requiredFields: string[], context: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Validate event type
|
|
48
|
+
* Ensures event type is in list of valid types
|
|
49
|
+
* @param type - Event type to validate
|
|
50
|
+
* @param validTypes - Array of valid event types
|
|
51
|
+
* @throws Error if event type is invalid
|
|
52
|
+
*/
|
|
53
|
+
static validateEventType(type: string, validTypes: string[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Validate file upload
|
|
56
|
+
* Checks file size and type against allowed values
|
|
57
|
+
* @param file - File to validate
|
|
58
|
+
* @param maxSize - Maximum allowed file size
|
|
59
|
+
* @param allowedTypes - Array of allowed MIME types
|
|
60
|
+
* @throws Error if file is invalid
|
|
61
|
+
*/
|
|
62
|
+
static validateFileUpload(file: File, maxSize: number, allowedTypes: string[]): void;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/validation.ts"],"names":[],"mappings":"AAWA,qBAAa,eAAe;IACxB;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAShE;;;;;;;OAOG;IACH,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW;IA+BnG;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAU5C;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAa3C;;;;;;;OAOG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAkB/G;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IASlE;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI;CAevF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version and name of the SDK.
|
|
3
|
+
*
|
|
4
|
+
* Keep `SDK_VERSION` equal to "version" in package.json; `tests/unit/version.test.ts` fails when they differ.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SDK_VERSION = "0.1.0";
|
|
7
|
+
export declare const SDK_NAME = "@widgetic/ui-sdk";
|
|
8
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/sdk/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,UAAU,CAAC;AACnC,eAAO,MAAM,QAAQ,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type ApiClient = {
|
|
2
|
+
fetchMeta(): Promise<any>;
|
|
3
|
+
updateMeta(payload: any): Promise<any>;
|
|
4
|
+
};
|
|
5
|
+
export declare function createDataService(api: ApiClient): {
|
|
6
|
+
getMetaForUi(): Promise<any>;
|
|
7
|
+
updateMetaFromUi(uiPayload: any): Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=dataService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataService.d.ts","sourceRoot":"","sources":["../../src/services/dataService.ts"],"names":[],"mappings":"AAIA,KAAK,SAAS,GAAG;IACf,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,UAAU,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS;;gCAMV,GAAG;EAIxC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WidgeticUISDK={})}(this,function(e){"use strict";class t{static createError(e,t){const s=new Error(e);return s.code=t,s}static handleError(e,t){return e instanceof Error?e.code?e:this.createError(e.message,"UNKNOWN_ERROR"):"string"==typeof e?this.createError(e,"STRING_ERROR"):this.createError(`Unknown error in ${t}`,"UNKNOWN_ERROR")}static toSDKError(e){return{message:e.message,code:e.code||"UNKNOWN_ERROR",name:e.name,stack:e.stack,details:e}}}class s extends Error{constructor(e,t){super(e),this.field=t,this.name="ValidationError"}}class r extends Error{constructor(e,t){super(e),this.code=t,this.name="SecurityError"}}class n extends Error{constructor(e,t){super(e),this.componentId=t,this.name="ComponentError"}}class o{static validateId(e,s){if(!e||"string"!=typeof e||""===e.trim())throw t.createError(`Invalid ID provided in ${s}`,"INVALID_ID")}static validateContainer(e,s){if(o.requireBrowser(s),!e)throw t.createError(`Container is required in ${s}`,"MISSING_CONTAINER");if("string"==typeof e){const s=document.querySelector(e);if(!s)throw t.createError(`Container not found: ${e}`,"CONTAINER_NOT_FOUND");return s}if(!(e instanceof HTMLElement))throw t.createError(`Invalid container type in ${s}`,"INVALID_CONTAINER");return e}static requireBrowser(e){if("undefined"==typeof document)throw t.createError(`Widgetic modules can only be used in a browser (${e}). With server-side rendering, start them from an effect or an event handler, which only run on the client.`,"NOT_IN_BROWSER")}static rejectApiKey(e){const s=e??{},r=s.partner;if(void 0!==s.apiKey||void 0!==r?.apiKey)throw t.createError("The apiKey option is not accepted: an API key must never be in a browser. Mint an editor session on your server (POST /v1/managed-users/{id}/editor-sessions) and return its token from the getToken option.","API_KEY_NOT_ALLOWED")}static validateConfig(e,s,r){if(!e)throw t.createError(`Configuration is required in ${r}`,"MISSING_CONFIG");for(const n of s)if(!(n in e))throw t.createError(`Missing required field: ${String(n)} in ${r}`,"MISSING_REQUIRED_FIELD")}static validateEventType(e,s){if(!s.includes(e))throw t.createError(`Invalid event type: ${e}`,"INVALID_EVENT_TYPE")}static validateFileUpload(e,s,r){if(e.size>s)throw t.createError(`File size exceeds maximum allowed size of ${s} bytes`,"FILE_TOO_LARGE");if(!r.includes("*/*")&&!r.includes(e.type))throw t.createError(`File type ${e.type} is not allowed`,"INVALID_FILE_TYPE")}}const i=["mode","preset","colors","radius","font"],a=["light","dark","system"],c="(prefers-color-scheme: dark)";function h(e){return"string"==typeof e&&a.includes(e)}function l(e){const t="string"==typeof e?e:e?.mode;return h(t)?t:void 0}function d(e){if(!e||"object"!=typeof e||Array.isArray(e))return;const t=Object.fromEntries(Object.entries(e).filter(([e,t])=>"mode"!==e&&void 0!==t));return Object.keys(t).length>0?t:void 0}function u(e){return"system"===e?"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(c).matches?"dark":"light":"dark"===e?"dark":"light"}function m(e,t){const s=l(e),r=s?u(s):t.mode,n=d(e)??t.settings;return n?{...n,mode:r}:r}class f extends Error{constructor(e,t){super(`The "${e}" module failed to start: ${t instanceof Error?t.message:String(t)}`),this.code="MOUNT_FAILED",this.name="ModuleMountError",this.moduleName=e,this.cause=t,Object.setPrototypeOf(this,f.prototype)}}class g{constructor(e,t){this.events=e,this.options=t,this.active=new Map}async mount(e,s){o.rejectApiKey(s);const r=o.validateContainer(s.container,"LifecycleManager.mount"),{version:n,theme:i,placeholder:a,loadingLabel:c,on:h,callbacks:l,signal:u,...g}=s,y=function(e){const t={...e};return delete t.container,t}(g),w=this.generateInstanceId(),E=!1===a?null:this.showPlaceholder(r,e,c);let M=null;const S=[];try{p(u,e);const t=await this.options.loader.load(e,{version:n});p(u,e);const{getToken:s,apiUrl:o,locale:a}=this.options.moduleDefaults;try{M=new t.Module(r,{apiUrl:o,locale:a,...s?{getToken:async e=>s(e)}:{},...y,theme:m(i,{mode:this.options.getThemeMode(),settings:this.options.getThemeSettings?.()})}),S.push(...this.connectEvents(w,M,{on:h,callbacks:l})),await M.mount()}catch(t){throw new f(e,t)}p(u,e);const c=this.createMountedModule(w,e,t.version,r,M);return this.active.set(w,{mounted:c,stopListening:S,hasOwnSettings:void 0!==d(i)}),c}catch(e){for(const e of S)e();throw await this.unmountQuietly(M),t.handleError(e,"LifecycleManager.mount")}finally{E?.remove()}}async unmount(e){const s=this.active.get(e);if(!s)throw t.createError(`No instance found for ID: ${e}`,"INSTANCE_NOT_FOUND");this.active.delete(e);try{await(s.mounted.module.unmount?.())}finally{for(const e of s.stopListening)e()}}get(e){return this.active.get(e)?.mounted}setThemeMode(e){for(const{mounted:t}of this.active.values())this.tellModule(t,e)}setDefaultTheme(e,t,s=!0){for(const{mounted:r,hasOwnSettings:n}of this.active.values())n?s&&this.tellModule(r,t):this.tellModule(r,{...e,mode:t})}tellModule(e,t){try{e.module.setTheme?.(t)}catch(s){console.error(`[widgetic-ui] The "${e.type}" module could not apply the theme ${JSON.stringify(t)}:`,s)}}async cleanup(){const e=await Promise.allSettled([...this.active.keys()].map(e=>this.unmount(e)));for(const t of e)"rejected"===t.status&&console.error("[widgetic-ui] A module failed to unmount during cleanup:",t.reason)}connectEvents(e,t,{on:s,callbacks:r}){const n=[];if("function"!=typeof t.on)return n;const o=(e,s)=>{n.push(t.on(e,s))};for(const[e,t]of Object.entries(s??{}))"function"==typeof t&&o(e,t);return o("ready",()=>{r?.onReady?.(),this.events.emit("ready",{componentId:e})}),o("error",t=>{const s=function(e){if(e instanceof Error)return e;const{message:t,code:s,fatal:r}=e??{},n=new Error("string"==typeof t?t:"The module reported an error");"string"==typeof s&&(n.code=s);"boolean"==typeof r&&(n.fatal=r);return n}(t);r?.onError?.(s),this.events.emit("error",{componentId:e,error:s})}),n}createMountedModule(e,t,s,r,n){return{id:e,type:t,version:s,container:r,module:n,on:(e,s)=>"function"!=typeof n.on?(console.warn(`[widgetic-ui] The "${t}" module does not report events.`),()=>{}):n.on(e,s),off:(e,t)=>n.off?.(e,t),setTheme:s=>{if("function"!=typeof n.setTheme)return void console.warn(`[widgetic-ui] The "${t}" module cannot change its look.`);n.setTheme(s);const r=this.active.get(e);r&&"object"==typeof s&&(r.hasOwnSettings=!0)},setLanguage:e=>{"function"==typeof n.setLanguage?n.setLanguage(e):console.warn(`[widgetic-ui] The "${t}" module has no words to translate yet.`)},unmount:()=>this.unmount(e)}}async unmountQuietly(e){try{await(e?.unmount?.())}catch(e){console.warn("[widgetic-ui] A module that failed to start also failed to clean up:",e)}}showPlaceholder(e,t,s){const r=document.createElement("div");r.setAttribute("data-widgetic-ui-loading",t),r.setAttribute("role","status"),r.setAttribute("aria-label","string"==typeof s&&""!==s.trim()?s:"Loading"),Object.assign(r.style,{display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",width:"100%",minHeight:this.getComponentMinHeight(t)});const n=document.createElement("div");return Object.assign(n.style,{width:"28px",height:"28px",border:"3px solid rgba(128, 128, 128, 0.25)",borderTopColor:"#3b82f6",borderRadius:"50%"}),"function"==typeof n.animate&&n.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:1e3,iterations:1/0}),r.appendChild(n),e.appendChild(r),r}getComponentMinHeight(e){switch(e){case"widget-creator":case"composition-editor":return"480px";case"embed-editor":case"file-browser":return"380px";default:return"280px"}}generateInstanceId(){return`widgetic-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}}function p(e,s){if(e?.aborted){const e=t.createError(`Mounting the "${s}" module was cancelled.`,"MOUNT_ABORTED");throw e.name="AbortError",e}}class y{constructor(){this.handlers=new Map}on(e,t){const s=this.handlers.get(e)??new Set;return s.add(t),this.handlers.set(e,s),()=>this.off(e,t)}off(e,t){const s=this.handlers.get(e);s&&(s.delete(t),0===s.size&&this.handlers.delete(e))}emit(e,t){const s=this.handlers.get(e);if(!s)return;const r={type:e,...t,timestamp:Date.now()};for(const t of[...s])try{t(r)}catch(t){console.error(`[widgetic-ui] A handler for "${e}" threw:`,t)}}destroy(){this.handlers.clear()}}const w="https://api.widgetic.com",E="https://cdn.widgetic.com/modules",M={NODE_ENV:"production",API_URL:w,API_VERSION:"/v1",CLIENT_URL:"https://widgetic.com",PRODUCTION_URL:w,CDN_URL:"https://cdn.widgetic.com",EMBED_SDK_URL:"/widgetic.js"};class S{constructor(){this.config={...M}}static getInstance(){return S.instance||(S.instance=new S),S.instance}initialize(e){this.config={...M,...e}}getApiUrl(){return(this.isProduction?this.config.PRODUCTION_URL:this.config.API_URL)+this.config.API_VERSION}getCdnUrl(){return this.config.CDN_URL}get isProduction(){return"production"===this.config.NODE_ENV}validateConfig(){if(!this.config.API_URL)throw new Error("API_URL is required");if(!this.config.API_VERSION)throw new Error("API_VERSION is required");if(!this.config.CLIENT_URL)throw new Error("CLIENT_URL is required")}}const v=S.getInstance();class I extends Error{constructor(e,t,s){super(t),this.name="ModuleLoadError",this.code=e,this.moduleName=s.moduleName,this.url=s.url,this.cause=s.cause,Object.setPrototypeOf(this,I.prototype)}}const T=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,L=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z][0-9A-Za-z.-]*)?$/,b=[300,900],_=e=>import(e);class N{constructor(e={}){this.loads=new Map,this.baseUrl=function(e){const t="undefined"!=typeof document?document.baseURI:"http://localhost/";let s;try{s=new URL(e,t)}catch(t){throw new I("INVALID_MODULE_BASE_URL",`moduleBaseUrl is not an address: ${e}`,{moduleName:"",cause:t})}if("https:"!==s.protocol&&"http:"!==s.protocol)throw new I("INVALID_MODULE_BASE_URL",`moduleBaseUrl must be an http(s) address, got ${s.protocol}`,{moduleName:""});s.pathname.endsWith("/")||(s.pathname+="/");return s}(e.moduleBaseUrl??E),this.fetchImpl=e.fetchImpl??((e,t)=>fetch(e,t)),this.importImpl=e.importImpl??_,this.retryDelaysMs=e.retryDelaysMs??b}async load(e,t={}){!function(e){if("string"!=typeof e||e.length>64||!T.test(e))throw new I("INVALID_MODULE_NAME",`"${String(e)}" is not a module name. Use lowercase letters, digits and dashes, like "file-browser".`,{moduleName:String(e)})}(e);const s=t.version;void 0!==s&&function(e,t){if("string"!=typeof t||!L.test(t))throw new I("INVALID_VERSION",`"${String(t)}" is not a version. Use an exact version like "1.2.0".`,{moduleName:e})}(e,s);const r=`${e}@${s??"latest"}`,n=this.loads.get(r);if(n)return n;const o=this.loadUncached(e,s).catch(e=>{throw this.loads.delete(r),e});return this.loads.set(r,o),o}async loadUncached(e,t){let s,r;if(void 0!==t)s=t,r=new URL(`${e}/${t}/index.js`,this.baseUrl);else{const t=await this.fetchManifest(e);s=t.version,r=this.resolveEntryUrl(e,t)}return{Module:await this.importModuleFile(e,r),name:e,version:s,url:r.href}}async fetchManifest(e){const t=new URL(`${e}/manifest.json`,this.baseUrl);try{return await this.withRetries(async()=>{const s=await this.fetchImpl(t.href,{credentials:"omit"});if(404===s.status||403===s.status)throw new I("MODULE_NOT_FOUND",`There is no "${e}" module at ${t.href} (HTTP ${s.status}).`,{moduleName:e,url:t.href});if(!s.ok)throw new Error(`HTTP ${s.status} for ${t.href}`);let r;try{r=await s.json()}catch(s){throw new I("MANIFEST_INVALID",`The manifest at ${t.href} is not JSON.`,{moduleName:e,url:t.href,cause:s})}return this.validateManifest(e,t,r)})}catch(s){if(s instanceof I)throw s;throw new I("MANIFEST_UNAVAILABLE",`Could not load the manifest of "${e}" from ${t.href}: ${O(s)}`,{moduleName:e,url:t.href,cause:s})}}validateManifest(e,t,s){const r=s=>{throw new I("MANIFEST_INVALID",`The manifest at ${t.href} ${s}.`,{moduleName:e,url:t.href})};if("object"!=typeof s||null===s)return r("is not a JSON object");const{name:n,version:o,entry:i}=s;return n!==e?r(`is for "${String(n)}", not "${e}"`):"string"==typeof o&&L.test(o)?"string"!=typeof i||0===i.length?r('has no "entry"'):{name:n,version:o,entry:i}:r(`has no valid "version" (found ${JSON.stringify(o)})`)}resolveEntryUrl(e,t){const s=new URL(`${e}/manifest.json`,this.baseUrl),r=new URL(`${e}/`,this.baseUrl);let n;try{n=new URL(t.entry,s)}catch(r){throw new I("MANIFEST_INVALID",`The manifest of "${e}" has an "entry" that is not an address: ${t.entry}`,{moduleName:e,url:s.href,cause:r})}const o=n.origin===r.origin&&n.pathname.startsWith(r.pathname),i=/\.m?js$/.test(n.pathname);if(!o||!i)throw new I("MANIFEST_INVALID",`The manifest of "${e}" points at ${n.href}, which is not a script inside ${r.href}.`,{moduleName:e,url:s.href});return n}async importModuleFile(e,t){let s;try{s=await this.withRetries(async e=>{const s=0===e?t.href:function(e,t){const s=new URL(e.href);return s.searchParams.set("retry",String(t)),s.href}(t,e);return this.importImpl(s)})}catch(s){throw new I("MODULE_LOAD_FAILED",`Could not load the "${e}" module from ${t.href}: ${O(s)}`,{moduleName:e,url:t.href,cause:s})}const r=s?.default;if("function"!=typeof r)throw new I("MODULE_INVALID",`The file at ${t.href} does not export a module class as its default export.`,{moduleName:e,url:t.href});return r}async withRetries(e){let t;for(let s=0;s<=this.retryDelaysMs.length;s++)try{return await e(s)}catch(e){if(e instanceof I)throw e;t=e;const r=this.retryDelaysMs[s];void 0!==r&&await new Promise(e=>setTimeout(e,r))}throw t}}function O(e){return e instanceof Error?e.message:String(e)}const U=new Map;class ${constructor(e={}){this.stopWatchingSystemTheme=null,function(e){o.rejectApiKey(e);const s=e?.getToken;if(void 0!==s&&"function"!=typeof s)throw t.createError("WidgeticUI: getToken must be a function that resolves an editor session token (or { token, expiresAt }) minted by your server.","INVALID_GET_TOKEN")}(e),this.events=new y,this.loader=e.moduleLoader??function(e){let t=U.get(e);return t||(t=new N({moduleBaseUrl:e}),U.set(e,t)),t}(e.moduleBaseUrl??E),this.themeMode=l(e.theme)??"light",this.themeSettings=d(e.theme),this.lifecycleManager=new g(this.events,{loader:this.loader,moduleDefaults:{apiUrl:e.apiUrl??w,getToken:e.getToken,locale:e.locale},getThemeMode:()=>u(this.themeMode),getThemeSettings:()=>this.themeSettings}),this.followSystemThemeWhenAsked()}async mount(e,t){try{return await this.lifecycleManager.mount(e,t)}catch(e){if("MOUNT_ABORTED"===e?.code)throw e;throw console.error("Error mounting component:",e),t.callbacks?.onError?.(e),e}}async mountComponent(e,t){return(await this.mount(e,t)).id}async unmountComponent(e){try{await this.lifecycleManager.unmount(e)}catch(e){throw console.error("Error unmounting component:",e),e}}getComponent(e){return this.lifecycleManager.get(e)}async preload(e,t={}){o.requireBrowser(`preloading "${e}"`),await this.loader.load(e,t)}updateTheme(e){if(!function(e){if("string"==typeof e)return h(e);if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=Object.entries(e).filter(([,e])=>void 0!==e);if(0===t.length)return!1;if(!t.every(([e])=>i.includes(e)))return!1;const s=e.mode;return void 0===s||h(s)}(e))throw t.createError(`Unknown theme: ${JSON.stringify(e)}. Use 'light', 'dark', 'system', or an object with some of mode, preset, colors, radius, font.`,"INVALID_THEME");const s=l(e),r=d(e);s&&(this.themeMode=s),r&&(this.themeSettings=r),this.followSystemThemeWhenAsked();const n=u(this.themeMode);r?this.lifecycleManager.setDefaultTheme(r,n,void 0!==s):this.lifecycleManager.setThemeMode(n),this.events.emit("theme:update",{theme:r?{...r,mode:this.themeMode}:{mode:this.themeMode}})}getTheme(){return{mode:this.themeMode,...this.themeSettings}}on(e,t){return this.events.on(e,t)}off(e,t){this.events.off(e,t)}emit(e,t){this.events.emit(e,t)}async destroy(){this.stopWatchingSystemTheme?.(),this.stopWatchingSystemTheme=null,await this.lifecycleManager.cleanup(),this.events.destroy()}followSystemThemeWhenAsked(){this.stopWatchingSystemTheme?.(),this.stopWatchingSystemTheme=null,"system"===this.themeMode&&(this.stopWatchingSystemTheme=function(e){if("undefined"==typeof window||"function"!=typeof window.matchMedia)return()=>{};const t=window.matchMedia(c),s=t=>e(t.matches?"dark":"light");return t.addEventListener("change",s),()=>t.removeEventListener("change",s)}(e=>this.lifecycleManager.setThemeMode(e)))}}async function A(e,t){o.rejectApiKey(t);const{getToken:s,apiUrl:r,moduleBaseUrl:n,locale:i,moduleLoader:a,...c}=t,h=new $({getToken:s,apiUrl:r,moduleBaseUrl:n,locale:i,moduleLoader:a,theme:c.theme});let l;try{l=await h.mount(e,c)}catch(e){throw await h.destroy(),e}return{...l,unmount:async()=>{try{await l.unmount()}finally{await h.destroy()}}}}let D=null;function C(){if(!D)throw t.createError("Call HighLevelUIAPI.initialize({ getToken }) before mounting a component.","NOT_INITIALIZED");return D}const R={WidgeticUI:$,initialize:async e=>{const t=new $(e),s=D;return D=t,await(s?.destroy()),t},mountComponent:async(e,t,s={})=>C().mountComponent(e,{...s,container:t}),unmountComponent:async e=>{await C().unmountComponent(e)}};const P={mode:"light",colors:{primary:"#007bff",secondary:"#6c757d",background:"#ffffff",surface:"#f8f9fa",text:"#212529",border:"#dee2e6"},spacing:{unit:4,scale:[0,4,8,16,24,32,48,64]},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',scale:[12,14,16,18,20,24,30,36,48,60]}},k={colors:{primary:"#3b82f6",secondary:"#64748b",background:"#0f172a",surface:"#1e293b",text:"#f8fafc",border:"#334155"}};class j{validateDomain(e){if(!e||"string"!=typeof e)return!1;const t=e.replace(/^https?:\/\//i,"").replace(/\/.*$/,"").toLowerCase();return!("widgetic.com"!==t&&!t.endsWith(".widgetic.com"))||(!(v.isProduction||!this.ALLOWED_DEV_ORIGINS.includes(t))||this.allowedOrigins.some(e=>{if("*"===e)return!0;const s=e.replace(/^https?:\/\//i,"").replace(/\/.*$/,"").toLowerCase();if(s.startsWith("*.")){const e=s.slice(2);return t===e||t.endsWith("."+e)}return t===s}))}constructor(e=[]){this.allowedOrigins=e,this.DEVELOPMENT_CSP={defaultSrc:["'self'","http://localhost:*"],scriptSrc:["'self'","'unsafe-eval'","http://localhost:*",M.CDN_URL,"https://*.widgetic.com"],styleSrc:["'self'","'unsafe-inline'","http://localhost:*"],imgSrc:["'self'","data:","https:","http://localhost:*"],connectSrc:["'self'","http://localhost:*","ws://localhost:*",M.API_URL,"https://*.widgetic.com"],frameAncestors:["'self'","http://localhost:*"]},this.PRODUCTION_CSP={defaultSrc:["'self'"],scriptSrc:["'self'",M.CDN_URL,"https://*.widgetic.com"],styleSrc:["'self'","'unsafe-inline'"],imgSrc:["'self'","data:","https:"],connectSrc:["'self'",M.API_URL,"https://*.widgetic.com"],frameAncestors:["'self'"]},this.ALLOWED_DEV_ORIGINS=["localhost","127.0.0.1",M.CLIENT_URL,"null"],this.setupCSP()}setupCSP(){}buildCSPString(){const e=v.isProduction?this.PRODUCTION_CSP:this.DEVELOPMENT_CSP,t=[];for(const[s,r]of Object.entries(e))if(r&&r.length){const e=s.replace(/([A-Z])/g,"-$1").toLowerCase();t.push(`${e} ${r.join(" ")}`)}return t.join("; ")}validateOrigin(e){if(!e||"string"!=typeof e)return!1;if("null"===e)return!v.isProduction;let t;try{t=new URL(e.startsWith("http")?e:`https://${e}`).hostname.toLowerCase()}catch{t=e.replace(/^https?:\/\//i,"").replace(/\/.*$/,"").toLowerCase()}return!(v.isProduction||!this.ALLOWED_DEV_ORIGINS.includes(t))||(!("widgetic.com"!==t&&!t.endsWith(".widgetic.com"))||this.allowedOrigins.some(s=>{if("*"===s)return!0;const r=s.replace(/^https?:\/\//i,"").replace(/\/.*$/,"").toLowerCase();if(r.startsWith("*.")){const e=r.slice(2);return t===e||t.endsWith("."+e)}return t===r||e.toLowerCase()===s.toLowerCase()}))}validateRequest(e){const t=e.headers.get("origin");if(!t&&!v.isProduction)return!0;if(!t)return!1;if(!this.validateOrigin(t))return console.warn(`Invalid request origin: ${t}`),!1;if(!v.isProduction)return!0;const s=e.headers.get("x-csrf-token");return!(s&&!this.validateCSRFToken(s))||(console.warn("Invalid CSRF token"),!1)}validateCSRFToken(e){return!0}validateMessage(e){if(!e.data)return console.warn("Invalid message: missing data"),!1;const{type:t,data:s}=e.data;return t&&"string"==typeof t?!s||"object"==typeof s||(console.warn("Invalid message: data must be an object"),!1):(console.warn("Invalid message: missing or invalid type"),!1)}}function x(e){return"string"!=typeof e?"":e.replace(/[<>]/g,"").replace(/javascript:/gi,"").replace(/on\w+=/gi,"").trim()}const V="0.1.0",F="@widgetic/ui-sdk";var W={SDK_VERSION:V,SDK_NAME:F,WidgeticUI:$,mountModule:A,HighLevelUIAPI:R};e.ComponentError=n,e.ConfigManager=S,e.Core=class{constructor(){}},e.DEFAULT_API_URL=w,e.DEFAULT_CONFIG=M,e.DEFAULT_MODULE_BASE_URL=E,e.EventSystem=class{constructor(e,t){this.handlers=new Map,this.hostHandlers=new Map,this.messageListener=null,this.bridge=e||("undefined"!=typeof window?window.parent:{}),this.targetOrigin=t||("undefined"!=typeof window&&window.location?.origin?window.location.origin:"*"),this.setupMessageListener()}setupMessageListener(){this.messageListener=e=>{this.handleMessage(e)},this.bridge instanceof MessagePort?this.bridge.onmessage=this.messageListener:"undefined"!=typeof window&&window.addEventListener("message",this.messageListener)}handleMessage(e){try{if(!this.validateMessage(e))return;const{type:t,data:s}=e.data,r=this.hostHandlers.get(t);r&&r.forEach(e=>{try{e(s)}catch(e){console.error(`Error in host event handler for ${t}:`,e),this.emitError("message_handler_error",e)}})}catch(e){console.error("Error processing message:",e),this.emitError("message_processing_error",e)}}validateMessage(e){if(this.bridge instanceof MessagePort)return!0;if(!e.data||"object"!=typeof e.data)return!1;const{type:t,source:s}=e.data;return!(!t||!s)&&"partner-platform"===s}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e)?.add(t),()=>this.off(e,t)}off(e,t){const s=this.handlers.get(e);s&&(s.delete(t),0===s.size&&this.handlers.delete(e))}emit(e,t){try{const s={...t,timestamp:Date.now()},r={type:e,...s},n=this.handlers.get(e);n?.forEach(t=>{try{t(r)}catch(t){console.error(`Error in event handler for ${e}:`,t),this.emitError("event_handler_error",t)}}),this.bridge&&this.sendToHost(r)}catch(e){console.error("Error emitting event:",e),this.emitError("event_emission_error",e)}}sendToHost(e){const t={...e,source:"widgetic-ui-sdk"};this.bridge instanceof MessagePort?this.bridge.postMessage(t):"undefined"!=typeof window&&this.bridge&&"postMessage"in this.bridge&&this.bridge.postMessage(t,this.targetOrigin)}emitError(e,t){const s={type:"messaging:error",error:{message:t.message,code:e,name:t.name,stack:t.stack,details:t},timestamp:Date.now()},r=this.handlers.get("error");r?.forEach(e=>{try{e(s)}catch(e){console.error("Error in error handler:",e)}})}destroy(){this.bridge instanceof MessagePort?this.bridge.close():"undefined"!=typeof window&&this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null),this.handlers.clear(),this.hostHandlers.clear()}},e.HighLevelUIAPI=R,e.HostCommunication=class{constructor(e,t,s){this.origin=e,this.events=t,this.boundHandleMessage=e=>{this.handleMessage(e)},this.security=s,this.setupMessageHandling()}setupMessageHandling(){"undefined"!=typeof window&&window.addEventListener("message",this.boundHandleMessage)}handleMessage(e){try{if(!this.validateMessage(e))return;const{type:t,data:s}=e.data;this.events.emit(t,s)}catch(e){console.error("Error handling message:",e),this.events.emit("error",{componentId:"host-communication",error:e instanceof Error?e:new Error("Message handling failed")})}}validateMessage(e){return e.origin===this.origin&&!!this.security.validateMessage(e)}async createSecureChannel(){const e=new MessageChannel;window.parent.postMessage({type:"secure-channel-request"},this.origin,[e.port2]),this.channel=e.port1,this.channel.onmessage=this.boundHandleMessage}destroy(){"undefined"!=typeof window&&window.removeEventListener("message",this.boundHandleMessage),this.channel?.close()}},e.LifecycleManager=g,e.MessagingSystem=class{constructor(e){this.config=e,this.handlers=new Map,this.hostHandlers=new Map,this.messageListener=null;try{o.validateConfig(e,["origin"],"MessagingSystem.constructor"),this.bridge="undefined"!=typeof window?window.parent:{},this.security=e.security,this.setupMessageListener()}catch(e){throw t.handleError(e,"MessagingSystem.constructor")}}setupMessageListener(){this.messageListener=e=>{try{if(!this.validateMessage(e))return;const{type:t,data:s}=e.data,r=this.hostHandlers.get(t);r&&r.forEach(e=>{try{e(s)}catch(e){console.error(`Error in host event handler for ${t}:`,e),this.emitError("message_handler_error",e)}})}catch(e){console.error("Error processing message:",e),this.emitError("message_processing_error",e)}},this.bridge instanceof MessagePort?this.bridge.onmessage=this.messageListener:"undefined"!=typeof window&&window.addEventListener("message",this.messageListener)}validateMessage(e){if(this.bridge instanceof MessagePort)return!0;if(!e.data||"object"!=typeof e.data)return!1;const{type:t,source:s}=e.data;return!(!t||!s)&&"partner-platform"===s}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e)?.add(t),()=>this.off(e,t)}off(e,t){this.handlers.get(e)?.delete(t)}emit(e,t){try{const s={...t,timestamp:Date.now()},r={type:e,...s},n=this.handlers.get(e);n?.forEach(t=>{try{t(r)}catch(t){console.error(`Error in event handler for ${e}:`,t),this.emitError("event_handler_error",t)}}),this.bridge&&this.sendToHost(r)}catch(e){console.error("Error emitting event:",e),this.emitError("event_emission_error",e)}}sendToHost(e){const t={...e,source:"widgetic-ui-sdk"};this.bridge instanceof MessagePort?this.bridge.postMessage(t):"undefined"!=typeof window&&this.bridge&&"postMessage"in this.bridge&&this.bridge.postMessage(t,this.config.origin||window.location.origin)}emitError(e,t){const s={type:"messaging:error",error:{message:t.message,code:e,name:t.name,stack:t.stack,details:t},timestamp:Date.now()},r=this.handlers.get("error");r?.forEach(e=>{try{e(s)}catch(e){console.error("Error in error handler:",e)}})}destroy(){this.bridge instanceof MessagePort?this.bridge.close():"undefined"!=typeof window&&this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null),this.handlers.clear(),this.hostHandlers.clear()}},e.ModuleLoadError=I,e.ModuleLoader=N,e.ModuleMountError=f,e.SDK_NAME=F,e.SDK_VERSION=V,e.SecurityError=r,e.StateManager=class{constructor(e={}){this.state=new Map,this.listeners=new Map,this.snapshots=new Map,this.maxSnapshots=e.maxSnapshots||10}setState(e,t,s,r={}){try{this.state.has(e)||this.state.set(e,new Map);const n=this.state.get(e),o=n.get(t);n.set(t,s),r.snapshot&&this.createSnapshot(e),r.silent||this.notifyStateChange(e,t,s,o)}catch(e){throw console.error("Error setting state:",e),e}}getState(e,t){return this.state.get(e)?.get(t)}getComponentState(e){return this.state.get(e)}subscribe(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){this.listeners.get(e)?.delete(t)}createSnapshot(e){this.snapshots.has(e)||this.snapshots.set(e,[]);const t={timestamp:Date.now(),state:new Map(this.state.get(e))},s=this.snapshots.get(e);s.push(t),s.length>this.maxSnapshots&&s.shift()}restoreSnapshot(e,t=-1){try{const s=this.snapshots.get(e);if(!s?.length)return!1;const r=s[t<0?s.length-1:t];return!!r&&(this.state.set(e,new Map(r.state)),this.notifyStateChange(e,"*",this.getComponentState(e)),!0)}catch(e){return console.error("Error restoring snapshot:",e),!1}}notifyStateChange(e,t,s,r){const n=this.listeners.get(e);n&&n.forEach(n=>{try{n({componentId:e,key:t,newValue:s,oldValue:r})}catch(e){console.error("Error in state change listener:",e)}})}cleanup(e){e?(this.state.delete(e),this.listeners.delete(e),this.snapshots.delete(e)):(this.state.clear(),this.listeners.clear(),this.snapshots.clear())}},e.ThemeManager=class{constructor(e,t){this.events=e,this.activePreset="default",this.currentTheme=this.createDefaultTheme(),t&&this.updateTheme(t),this.setupSystemThemeListener()}getCurrentTheme(){return{...this.currentTheme}}updateTheme(e){try{const t=this.mergeThemes(this.currentTheme,e);this.validateTheme(t),this.currentTheme=t,this.applyTheme(),this.notifyThemeUpdate()}catch(e){throw console.error("Error updating theme:",e),new Error(`Theme update failed: ${e instanceof Error?e.message:"Unknown error"}`)}}setMode(e){this.updateTheme({mode:e}),this.applyColorScheme(e)}setupSystemThemeListener(){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{"system"===this.currentTheme.mode&&this.applyColorScheme(e.matches?"dark":"light")})}createDefaultTheme(){return{...P}}mergeThemes(e,t){return{mode:t.mode??e.mode,colors:t.colors?{...e.colors,...t.colors}:e.colors,spacing:t.spacing?{...e.spacing,...t.spacing}:e.spacing,typography:t.typography?{...e.typography,...t.typography}:e.typography}}validateTheme(e){if(Object.entries(e.colors).forEach(([e,t])=>{if(!this.isValidColor(t))throw new Error(`Invalid color value for ${e}: ${t}`)}),e.spacing.unit<=0)throw new Error("Spacing unit must be positive");if(!e.typography.fontFamily)throw new Error("Font family is required")}isValidColor(e){return/^(#[0-9A-Fa-f]{6}|#[0-9A-Fa-f]{8}|rgb\(.*\)|rgba\(.*\)|hsl\(.*\)|hsla\(.*\))$/.test(e)}applyColorScheme(e){const t="dark"===e?k:P;this.updateTheme({colors:t.colors})}applyTheme(){document.documentElement.style.setProperty("--theme-mode",this.currentTheme.mode),Object.entries(this.currentTheme.colors).forEach(([e,t])=>{document.documentElement.style.setProperty(`--color-${e}`,t)}),document.documentElement.style.setProperty("--spacing-unit",`${this.currentTheme.spacing.unit}px`),this.currentTheme.spacing.scale.forEach((e,t)=>{document.documentElement.style.setProperty(`--spacing-${t}`,`${e}px`)}),document.documentElement.style.setProperty("--font-family",this.currentTheme.typography.fontFamily),this.currentTheme.typography.scale.forEach((e,t)=>{document.documentElement.style.setProperty(`--font-size-${t}`,`${e}px`)})}notifyThemeUpdate(){this.events.emit("theme:update",{theme:this.currentTheme})}},e.UILoader=$,e.ValidationError=s,e.WidgeticComponent=class{constructor(e,t){this.container=e,this.config=t,this.shadow=this.initializeShadowDOM(),this.state={status:"initializing",error:null},this.events=t.events,this.id=t.id,t.theme&&this.applyTheme(t.theme),this.events&&this.events.on("theme:update",e=>{const t=e?.theme||e;t&&"object"==typeof t&&this.applyTheme(t)})}initializeShadowDOM(){try{return this.container.attachShadow({mode:"closed"})}catch(e){throw console.error("Error initializing shadow DOM:",e),new Error("Failed to initialize component shadow DOM")}}setState(e){this.state={...this.state,...e},this.events.emit("state:update",{componentId:this.id,state:this.state})}handleError(e){console.error(`Error in ${this.constructor.name}:`,e),this.setState({status:"error",error:e}),this.events.emit("error",{componentId:this.id,error:e})}applyTheme(e){this.container.style.setProperty("--theme-mode",e.mode);const t=`\n :host {\n --theme-mode: ${e.mode};\n ${Object.entries(e.colors).map(([e,t])=>`--color-${e}: ${t};`).join("\n")}\n --spacing-unit: ${e.spacing.unit}px;\n ${e.spacing.scale.map((e,t)=>`--spacing-${t}: ${e}px;`).join("\n")}\n --font-family: ${e.typography.fontFamily};\n ${e.typography.scale.map((e,t)=>`--font-size-${t}: ${e}px;`).join("\n")}\n }\n `;if("undefined"!=typeof CSSStyleSheet&&"replaceSync"in CSSStyleSheet.prototype&&this.shadow&&"adoptedStyleSheets"in this.shadow)try{return this.themeStyleSheet||(this.themeStyleSheet=new CSSStyleSheet,this.shadow.adoptedStyleSheets=[...this.shadow.adoptedStyleSheets,this.themeStyleSheet]),void this.themeStyleSheet.replaceSync(t)}catch{}let s=this.shadow.querySelector("style[data-widgetic-theme]");s||(s=document.createElement("style"),s.setAttribute("data-widgetic-theme","true"),this.shadow.appendChild(s)),s.textContent=t}},e.WidgeticUI=$,e.config=v,e.createSecureContext=function(e=[]){const t=new j(e);return{validateMessage:e=>t.validateMessage(e),validateOrigin:e=>t.validateOrigin(e),sanitizeInput:x}},e.createSecureRequest=function(e,t={}){const s=new Headers(t.headers);return s.set("X-Requested-With","XMLHttpRequest"),new Request(e,{...t,headers:s,credentials:"same-origin"})},e.default=W,e.mountModule=A,e.sanitizeInput=x,e.validateOrigin=function(e,t=[]){return new j(t).validateOrigin(e)},e.validateResponse=function(e){if(!e.ok)return!1;const t=e.headers.get("content-type");return t&&!t.includes("application/json")&&console.warn("Unexpected content type:",t),!0},Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
|
+
//# sourceMappingURL=ui-sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-sdk.js","sources":["../../src/sdk/utils/errors.ts","../../src/sdk/utils/validation.ts","../../src/sdk/core/theme-mode.ts","../../src/sdk/core/lifecycle.ts","../../src/sdk/core/local-events.ts","../../src/sdk/utils/config.ts","../../src/sdk/modules/loader.ts","../../src/sdk/loader/ui.ts","../../src/sdk/layers/index.ts","../../src/sdk/core/theme.ts","../../src/sdk/utils/security.ts","../../src/sdk/version.ts","../../src/index.ts","../../src/sdk/core/index.ts","../../src/sdk/core/events.ts","../../src/sdk/integration/host.ts","../../src/sdk/core/messaging.ts","../../src/sdk/core/state.ts","../../src/sdk/core/component.ts","../../src/sdk/utils/http.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["SDKErrorHandler","createError","message","code","error","Error","handleError","context","this","toSDKError","name","stack","details","ValidationError","constructor","field","super","SecurityError","ComponentError","componentId","ValidationUtils","validateId","id","trim","validateContainer","container","requireBrowser","element","document","querySelector","HTMLElement","rejectApiKey","options","loose","partner","undefined","apiKey","validateConfig","config","requiredFields","String","validateEventType","type","validTypes","includes","validateFileUpload","file","maxSize","allowedTypes","size","THEME_KEYS","MODES","DARK_SCHEME_QUERY","isMode","value","modeOfThemeOption","theme","mode","settingsOfThemeOption","Array","isArray","settings","Object","fromEntries","entries","filter","key","entry","keys","length","resolveMode","window","matchMedia","matches","themeForModule","own","pageWide","ownMode","ModuleMountError","moduleName","cause","setPrototypeOf","prototype","LifecycleManager","events","active","Map","mount","mountConfig","version","placeholder","loadingLabel","on","callbacks","signal","optionsWithContainer","moduleOptions","withoutContainer","instanceId","generateInstanceId","placeholderElement","showPlaceholder","module","stopListening","throwIfAborted","loaded","loader","load","getToken","partnerGetToken","apiUrl","locale","moduleDefaults","Module","async","getThemeMode","getThemeSettings","push","connectEvents","mounted","createMountedModule","set","hasOwnSettings","stop","unmountQuietly","remove","unmount","activeModule","get","delete","setThemeMode","values","tellModule","setDefaultTheme","modeChanged","setTheme","console","JSON","stringify","cleanup","results","Promise","allSettled","map","result","status","reason","stopFunctions","listen","eventName","handler","onReady","emit","payload","fatal","toError","onError","warn","off","setLanguage","language","createElement","setAttribute","assign","style","display","alignItems","justifyContent","boxSizing","width","minHeight","getComponentMinHeight","spinner","height","border","borderTopColor","borderRadius","animate","transform","duration","iterations","Infinity","appendChild","Date","now","Math","random","toString","slice","aborted","LocalEventEmitter","handlers","event","handlersForEvent","Set","add","data","timestamp","destroy","clear","DEFAULT_API_URL","DEFAULT_MODULE_BASE_URL","DEFAULT_CONFIG","NODE_ENV","API_URL","API_VERSION","CLIENT_URL","PRODUCTION_URL","CDN_URL","EMBED_SDK_URL","ConfigManager","getInstance","instance","initialize","getApiUrl","isProduction","getCdnUrl","ModuleLoadError","url","MODULE_NAME_PATTERN","VERSION_PATTERN","DEFAULT_RETRY_DELAYS_MS","importFromBrowser","specifier","import","ModuleLoader","loads","baseUrl","moduleBaseUrl","pageUrl","baseURI","URL","protocol","pathname","endsWith","resolveBaseUrl","fetchImpl","input","init","fetch","importImpl","retryDelaysMs","test","assertValidModuleName","pinnedVersion","assertValidVersion","cacheKey","existingLoad","pendingLoad","loadUncached","catch","entryUrl","manifest","fetchManifest","resolveEntryUrl","importModuleFile","href","manifestUrl","withRetries","response","credentials","ok","json","parseError","validateManifest","describeError","fail","manifestName","moduleFolder","staysInsideFolder","origin","startsWith","isScript","namespace","attemptIndex","retryUrl","searchParams","withRetryParameter","exported","default","operation","lastError","pause","resolve","setTimeout","sharedModuleLoaders","WidgeticUI","stopWatchingSystemTheme","assertValidOptions","moduleLoader","sharedModuleLoaderFor","themeMode","themeSettings","lifecycleManager","followSystemThemeWhenAsked","mountComponent","unmountComponent","getComponent","preload","updateTheme","given","every","isThemeOption","requestedMode","requestedSettings","resolvedMode","getTheme","onChange","query","listener","addEventListener","removeEventListener","watchSystemTheme","systemMode","mountModule","ui","sharedUIInstance","requireSharedUI","HighLevelUIAPI","newInstance","previousInstance","DEFAULT_THEME","colors","primary","secondary","background","surface","text","spacing","unit","scale","typography","fontFamily","DARK_THEME","SecurityManager","validateDomain","domain","cleanDomain","replace","toLowerCase","ALLOWED_DEV_ORIGINS","allowedOrigins","some","allowed","cleanAllowed","domainPart","DEVELOPMENT_CSP","defaultSrc","scriptSrc","styleSrc","imgSrc","connectSrc","frameAncestors","PRODUCTION_CSP","setupCSP","buildCSPString","cspConfig","directives","directive","join","validateOrigin","hostname","validateRequest","request","headers","csrfToken","validateCSRFToken","token","validateMessage","sanitizeInput","SDK_VERSION","SDK_NAME","index","bridge","targetOrigin","hostHandlers","messageListener","parent","location","setupMessageListener","handleMessage","MessagePort","onmessage","forEach","emitError","source","has","eventData","sendToHost","postMessage","errorEvent","err","close","security","boundHandleMessage","setupMessageHandling","createSecureChannel","channel","MessageChannel","port2","port1","state","listeners","snapshots","maxSnapshots","setState","componentState","oldValue","snapshot","createSnapshot","silent","notifyStateChange","getState","getComponentState","subscribe","callback","unsubscribe","componentSnapshots","shift","restoreSnapshot","newValue","initialTheme","activePreset","currentTheme","createDefaultTheme","setupSystemThemeListener","getCurrentTheme","updates","newTheme","mergeThemes","validateTheme","applyTheme","notifyThemeUpdate","setMode","applyColorScheme","e","base","isValidColor","color","documentElement","setProperty","shadow","initializeShadowDOM","attachShadow","cssText","CSSStyleSheet","themeStyleSheet","adoptedStyleSheets","replaceSync","textContent","Headers","Request","contentType"],"mappings":"0PAOaA,EAQT,kBAAOC,CAAYC,EAAiBC,GAChC,MAAMC,EAAQ,IAAIC,MAAMH,GAExB,OADCE,EAAcD,KAAOA,EACfC,CACX,CASA,kBAAOE,CAAYF,EAAgBG,GAE/B,OAAIH,aAAiBC,MACZD,EAAcD,KACRC,EAEJI,KAAKP,YAAYG,EAAMF,QAAS,iBAItB,iBAAVE,EACAI,KAAKP,YAAYG,EAAO,gBAI5BI,KAAKP,YACR,oBAAoBM,IACpB,gBAER,CAQA,iBAAOE,CAAWL,GACd,MAAO,CACHF,QAASE,EAAMF,QACfC,KAAOC,EAAcD,MAAQ,gBAC7BO,KAAMN,EAAMM,KACZC,MAAOP,EAAMO,MACbC,QAASR,EAEjB,EAOE,MAAOS,UAAwBR,MACjC,WAAAS,CAAYZ,EAAwBa,GAChCC,MAAMd,GAD0BM,KAAAO,MAAAA,EAEhCP,KAAKE,KAAO,iBAChB,EAOE,MAAOO,UAAsBZ,MAC/B,WAAAS,CAAYZ,EAAwBC,GAChCa,MAAMd,GAD0BM,KAAAL,KAAAA,EAEhCK,KAAKE,KAAO,eAChB,EAOE,MAAOQ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KAAKib,OAAOnQ,YAAYlB,IAE5BA,EAAM6R,YAAcL,CACxB,mDRqLE,SAA8BvG,EAA2B,IAC3D,MAAMoD,EAAW,IAAI3D,EAAgBO,GAErC,MAAO,CACH2B,gBAAkBhL,GAAwByM,EAASzB,gBAAgBhL,GACnEwK,eAAiB1F,GAAmB2H,EAASjC,eAAe1F,GAC5DmG,gBAER,iCSjUoCvJ,EAAa1L,EAAuB,IACpE,MAAM4U,EAAU,IAAIsF,QAAQla,EAAQ4U,SAKpC,OAFAA,EAAQnP,IAAI,mBAAoB,kBAEzB,IAAI0U,QAAQzO,EAAK,IACjB1L,EACH4U,UACAxG,YAAa,eAErB,0ETkR+BU,EAAgBuE,EAA2B,IAEtE,OADiB,IAAIP,EAAgBO,GACrBmB,eAAe1F,EACnC,qBS9QM,SAA2BX,GAE7B,IAAKA,EAASE,GACV,OAAO,EAIX,MAAM+L,EAAcjM,EAASyG,QAAQ5O,IAAI,gBAKzC,OAJIoU,IAAgBA,EAAYxZ,SAAS,qBACrC4F,QAAQqB,KAAK,2BAA4BuS,IAGtC,CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caseConversion.d.ts","sourceRoot":"","sources":["../../src/utils/caseConversion.ts"],"names":[],"mappings":"AAWA,wBAAgB,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,CAS9C;AAED,wBAAgB,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,CAS9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,93 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widgetic/ui-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Framework-agnostic UI components for building Widgetic integrations",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"unpkg": "dist/umd/ui-sdk.js",
|
|
9
|
+
"jsdelivr": "dist/umd/ui-sdk.js",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.esm.js",
|
|
15
|
+
"require": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"widgetic",
|
|
28
|
+
"ui-sdk",
|
|
29
|
+
"components",
|
|
30
|
+
"framework-agnostic",
|
|
31
|
+
"widgets",
|
|
32
|
+
"integration"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"i": "rm -rf node_modules && npm i && npm run lapisdk",
|
|
36
|
+
"build": "rollup -c",
|
|
37
|
+
"build:publish": "rm -rf dist && npm run build",
|
|
38
|
+
"build:dev": "rollup -c --watch",
|
|
39
|
+
"dev": "vite dev",
|
|
40
|
+
"dev:demo": "vite dev",
|
|
41
|
+
"dev:sdk": "rollup -c ./scripts-sdk/rollup.config.js -w",
|
|
42
|
+
"build:sdk": "REPLICABLE=1 NODE_ENV=production rollup -c ./scripts-sdk/rollup.config.js",
|
|
43
|
+
"lapisdk": "rm -rf node_modules/@widgetic/api-sdk && ln -s ../../../api-sdk node_modules/@widgetic/api-sdk",
|
|
44
|
+
"clean-npm-cache": "npm cache clean --force",
|
|
45
|
+
"clean-sveltekit-cache": "rm -rf .svelte-kit",
|
|
46
|
+
"dev:web": "vite dev",
|
|
47
|
+
"build:web": "vite build",
|
|
48
|
+
"preview": "vite preview",
|
|
49
|
+
"preview:web": "vite preview",
|
|
50
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
51
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
52
|
+
"test": "vitest",
|
|
53
|
+
"test:e2e": "npm --prefix modules run test:e2e",
|
|
54
|
+
"test:coverage": "vitest run --coverage",
|
|
55
|
+
"lint": "eslint .",
|
|
56
|
+
"build:sdk:local": "NODE_ENV=production rollup -c ./scripts-sdk/rollup.config.js",
|
|
57
|
+
"prepublishOnly": "npm run build:publish && node scripts-sdk/check-no-secrets.js"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@playwright/test": "^1.48.2",
|
|
61
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
62
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
63
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
64
|
+
"@rollup/plugin-replace": "^6.0.1",
|
|
65
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
66
|
+
"@rollup/plugin-typescript": "^12.1.1",
|
|
67
|
+
"@sveltejs/adapter-auto": "^3.0.0",
|
|
68
|
+
"@sveltejs/kit": "^2.20.3",
|
|
69
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
70
|
+
"@testing-library/dom": "^9.3.3",
|
|
71
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
72
|
+
"@testing-library/svelte": "^4.2.3",
|
|
73
|
+
"@types/node": "^22.20.5",
|
|
74
|
+
"@types/testing-library__jest-dom": "^5.14.9",
|
|
75
|
+
"@widgetic/api-sdk": "^1.0.0",
|
|
76
|
+
"autoprefixer": "^10.4.20",
|
|
77
|
+
"jsdom": "^22.1.0",
|
|
78
|
+
"rollup": "^4.0.0",
|
|
79
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
80
|
+
"svelte": "^5.25.6",
|
|
81
|
+
"svelte-check": "^4.0.0",
|
|
82
|
+
"tailwindcss": "^3.4.14",
|
|
83
|
+
"terser": "^5.0.0",
|
|
84
|
+
"tslib": "^2.8.1",
|
|
85
|
+
"typescript": "^5.2.2",
|
|
86
|
+
"vite": "^6.2.6",
|
|
87
|
+
"vitest": "^5.0.3"
|
|
88
|
+
},
|
|
89
|
+
"type": "module",
|
|
90
|
+
"overrides": {
|
|
91
|
+
"form-data": "^4.0.6"
|
|
92
|
+
}
|
|
93
|
+
}
|