zh-web-sdk 2.14.1 → 2.16.0
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/.github/PULL_REQUEST_TEMPLATE.md +10 -0
- package/CHANGELOG.md +10 -0
- package/dist/iframe-container/hooks/__tests__/use-style-updates.test.d.ts +1 -0
- package/dist/iframe-container/hooks/use-style-updates.d.ts +25 -0
- package/dist/index.js +50 -50
- package/dist/index.js.map +4 -4
- package/dist/types.d.ts +18 -1
- package/package.json +1 -1
- package/src/iframe-container/AppContainer.tsx +75 -36
- package/src/iframe-container/__tests__/AppContainer.test.tsx +178 -3
- package/src/iframe-container/hooks/__tests__/use-style-updates.test.ts +430 -0
- package/src/iframe-container/hooks/use-style-updates.ts +82 -0
- package/src/index.tsx +4 -0
- package/src/types.ts +18 -0
- package/src/utils/auth-to-fund-mapper.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
## [2.16.0] - 2026-02-20
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Add dynamic styles for "Auth into Fund" integration
|
|
13
|
+
|
|
14
|
+
## [2.15.0] - 2026-02-18
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- Add dynamic styles for "iframe" SDKs via postMessage
|
|
18
|
+
|
|
9
19
|
## [2.14.0] - 2026-01-16
|
|
10
20
|
|
|
11
21
|
### Added
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
export type StyleConfig = {
|
|
3
|
+
appWrapperStyle: CSSProperties;
|
|
4
|
+
modalStyle: CSSProperties;
|
|
5
|
+
iframeWrapperStyle: CSSProperties;
|
|
6
|
+
iframeStyle: CSSProperties;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Hook to manage style state and updates from postMessage events.
|
|
10
|
+
*
|
|
11
|
+
* Encapsulates:
|
|
12
|
+
* - Style state management (current styles and loaded status)
|
|
13
|
+
* - Style merging logic via postMessage
|
|
14
|
+
* - Origin validation
|
|
15
|
+
* - Fallback timeout to ensure modal displays even if STYLE_CONFIG is not received
|
|
16
|
+
*
|
|
17
|
+
* @param zeroHashAppURL - The app URL used for origin validation
|
|
18
|
+
* @param defaultStyles - Default style configuration to use as fallback
|
|
19
|
+
* @returns Object containing current styles, loaded status, and handler function
|
|
20
|
+
*/
|
|
21
|
+
export declare const useStyleUpdates: (zeroHashAppURL: string, defaultStyles: StyleConfig) => {
|
|
22
|
+
styles: StyleConfig;
|
|
23
|
+
stylesLoaded: boolean;
|
|
24
|
+
handleStyleConfig: (incomingStyles: Partial<StyleConfig>, eventOrigin: string) => boolean;
|
|
25
|
+
};
|