zh-web-sdk 2.16.1 → 3.0.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +239 -34
  3. package/dist/__mocks__/@zerohash-sdk/sdk-react-mock.d.ts +1 -0
  4. package/dist/__tests__/explicit-env.test.d.ts +1 -0
  5. package/dist/__tests__/message-router-origins.test.d.ts +1 -0
  6. package/dist/__tests__/sdk-version-attribution.test.d.ts +1 -0
  7. package/dist/__tests__/styles.test.d.ts +1 -0
  8. package/dist/api/convert-token.d.ts +12 -0
  9. package/dist/iframe-container/AppContainer.d.ts +13 -3
  10. package/dist/iframe-container/__tests__/get-new-sdk-env.test.d.ts +1 -0
  11. package/dist/iframe-container/hooks/use-style-updates.d.ts +1 -0
  12. package/dist/index.d.ts +30 -2
  13. package/dist/index.js +56 -54
  14. package/dist/index.js.map +4 -4
  15. package/dist/new-sdk/env.d.ts +35 -0
  16. package/dist/redux/__tests__/set-theme.test.d.ts +1 -0
  17. package/dist/redux/__tests__/set-use-new-sdk.test.d.ts +1 -0
  18. package/dist/redux/actions/index.d.ts +13 -1
  19. package/dist/redux/reducers/constants.d.ts +2 -0
  20. package/dist/redux/reducers/index.d.ts +3 -1
  21. package/dist/redux/reducers/new-sdk-flags.d.ts +11 -0
  22. package/dist/redux/reducers/theme.d.ts +10 -0
  23. package/dist/redux/store/index.d.ts +3 -1
  24. package/dist/styles.d.ts +7 -0
  25. package/dist/types.d.ts +42 -0
  26. package/dist/utils/test-utils.d.ts +48 -48
  27. package/dist/version.d.ts +1 -0
  28. package/package.json +32 -13
  29. package/.eslintrc.js +0 -12
  30. package/.github/CHANGELOG_TEMPLATE.md +0 -73
  31. package/.github/PULL_REQUEST_TEMPLATE.md +0 -10
  32. package/.github/backup/publish-tag.yaml +0 -14
  33. package/.github/workflows/build.yaml +0 -13
  34. package/.github/workflows/pr.yaml +0 -14
  35. package/.github/workflows/publish.yaml +0 -13
  36. package/.github/workflows/security.yml +0 -15
  37. package/.github/workflows/tag.yaml +0 -14
  38. package/RELEASING.md +0 -39
  39. package/jest.config.js +0 -8
  40. package/jest.setup.js +0 -24
  41. package/scripts/build.js +0 -34
  42. package/scripts/zip.js +0 -49
  43. package/src/__tests__/jwt-auth-detection.test.ts +0 -96
  44. package/src/api/convert-token.ts +0 -23
  45. package/src/constants.ts +0 -2
  46. package/src/hooks/__tests__/use-window-size.test.tsx +0 -26
  47. package/src/hooks/use-window-size.ts +0 -19
  48. package/src/iframe-container/AppContainer.tsx +0 -495
  49. package/src/iframe-container/__tests__/AppContainer.test.tsx +0 -300
  50. package/src/iframe-container/hooks/__tests__/use-style-updates.test.ts +0 -430
  51. package/src/iframe-container/hooks/use-style-updates.ts +0 -82
  52. package/src/index.tsx +0 -645
  53. package/src/redux/actions/index.ts +0 -27
  54. package/src/redux/reducers/constants.ts +0 -10
  55. package/src/redux/reducers/crypto-account-link-payouts.ts +0 -60
  56. package/src/redux/reducers/crypto-account-link.ts +0 -60
  57. package/src/redux/reducers/crypto-buy.ts +0 -75
  58. package/src/redux/reducers/crypto-sell.ts +0 -64
  59. package/src/redux/reducers/crypto-withdrawals.ts +0 -64
  60. package/src/redux/reducers/fiat-account-link.ts +0 -60
  61. package/src/redux/reducers/fiat-deposits.ts +0 -64
  62. package/src/redux/reducers/fiat-withdrawals.ts +0 -64
  63. package/src/redux/reducers/fund.ts +0 -75
  64. package/src/redux/reducers/index.ts +0 -35
  65. package/src/redux/reducers/onboarding.ts +0 -74
  66. package/src/redux/reducers/pay.ts +0 -64
  67. package/src/redux/reducers/payouts.ts +0 -64
  68. package/src/redux/reducers/profile.ts +0 -63
  69. package/src/redux/store/index.ts +0 -10
  70. package/src/styles.ts +0 -108
  71. package/src/types.ts +0 -578
  72. package/src/utils/auth-to-fund-mapper.ts +0 -174
  73. package/src/utils/strings.ts +0 -19
  74. package/src/utils/test-utils.tsx +0 -36
  75. package/src/utils/world-app-utils.ts +0 -8
  76. package/src/utils.ts +0 -27
  77. package/tsconfig.json +0 -26
@@ -0,0 +1,35 @@
1
+ import type { Environment, InternalEnvironment } from '../types';
2
+ /**
3
+ * Resolved env used internally to pick the CDN origin and forward to
4
+ * `@zerohash-sdk/*-react` components. Combines the public {@link Environment}
5
+ * surface (`'cert' | 'prod'`) with internal-only QA targets
6
+ * ({@link InternalEnvironment} — `'local' | 'dev'`).
7
+ */
8
+ export type NewSdkEnv = Environment | InternalEnvironment;
9
+ /**
10
+ * CDN origin that hosts the new `@zerohash-sdk/*` web components for a
11
+ * given environment. The `messageRouter` uses this to decide which
12
+ * origin is trusted to post lifecycle events back to the parent window.
13
+ */
14
+ export declare const NEW_SDK_ORIGIN_BY_ENV: Record<NewSdkEnv, string>;
15
+ /**
16
+ * Derive the environment from the host app's `zeroHashAppsURL`. Returns
17
+ * `'prod'` for any hostname not in the known lists, which is the safest
18
+ * default for a production-hardcoded CDN. When the fallback path is taken
19
+ * we log a one-time `console.warn` so integrators on a host outside the
20
+ * allowlist can spot the misconfiguration instead of silently being
21
+ * pointed at the production CDN.
22
+ */
23
+ export declare function getNewSdkEnv(url: string): NewSdkEnv;
24
+ /**
25
+ * Test-only: clear the warn-once cache so suites can assert the warning
26
+ * fires per URL without leaking state across tests.
27
+ */
28
+ export declare function _resetWarnedFallbackUrls(): void;
29
+ /**
30
+ * Auth-component env literal. `@connect-xyz/auth-react` only accepts
31
+ * `'sandbox' | 'production'` (no `dev` or `local`), so non-prod SDK envs
32
+ * collapse to `sandbox` — Auth's sandbox API serves cert/dev/local data.
33
+ */
34
+ export type AuthEnv = 'sandbox' | 'production';
35
+ export declare function toAuthEnv(env: NewSdkEnv): AuthEnv;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,19 @@
1
- import { AppIdentifier } from "../../types";
1
+ import { AppIdentifier, Theme } from "../../types";
2
2
  export declare const openModal: (appIdentifier: AppIdentifier) => void;
3
3
  export declare const closeModal: (appIdentifier: AppIdentifier) => void;
4
4
  export declare const appLoaded: (appIdentifier: AppIdentifier) => void;
5
5
  export declare const appPendingApproval: (appIdentifier: AppIdentifier) => void;
6
6
  export declare const appCompleted: (appIdentifier: AppIdentifier) => void;
7
7
  export declare const appFailed: (appIdentifier: AppIdentifier) => void;
8
+ /**
9
+ * setUseNewSdk dispatches into the `new-sdk-flags` slice directly (not
10
+ * through `dispatchActionBasedOnAppIdentifier`), because that slice is keyed
11
+ * by appIdentifier internally rather than having one reducer per app.
12
+ */
13
+ export declare const setUseNewSdk: (appIdentifier: AppIdentifier, useNewSdk: boolean) => void;
14
+ /**
15
+ * setTheme dispatches into the global `theme` slice. Forwarded to new
16
+ * @zerohash-sdk/*-react components via AppContainer; legacy iframe and
17
+ * Connect Auth paths ignore it.
18
+ */
19
+ export declare const setTheme: (theme: Theme) => void;
@@ -7,3 +7,5 @@ export declare const ACTION_FAILED = "FAILED";
7
7
  export declare const ACTION_SET_FILTERS = "ACTION_SET_FILTERS";
8
8
  export declare const ACTION_SET_NAVIGATE = "SET_NAVIGATE";
9
9
  export declare const ACTION_SET_USE_AUTH = "SET_USE_AUTH";
10
+ export declare const ACTION_SET_USE_NEW_SDK = "SET_USE_NEW_SDK";
11
+ export declare const ACTION_SET_THEME = "SET_THEME";
@@ -15,5 +15,7 @@ declare const rootReducer: import("redux").Reducer<import("redux").CombinedState
15
15
  payouts: import("./payouts").IPayoutsState;
16
16
  pay: import("./pay").IPayState;
17
17
  "fiat-account-link": import("./fiat-account-link").IFiatAccountLinkState;
18
- }>, import("./crypto-withdrawals").ICryptoWithdrawalsAction | import("./onboarding").IOnboardingAction | import("./crypto-buy").ICryptoBuyAction | import("./fund").IFundAction>;
18
+ "new-sdk-flags": import("./new-sdk-flags").INewSdkFlagsState;
19
+ theme: import("./theme").IThemeState;
20
+ }>, import("./crypto-withdrawals").ICryptoWithdrawalsAction | import("./onboarding").IOnboardingAction | import("./crypto-buy").ICryptoBuyAction | import("./fund").IFundAction | import("./new-sdk-flags").INewSdkFlagsAction | import("./theme").IThemeAction>;
19
21
  export default rootReducer;
@@ -0,0 +1,11 @@
1
+ import { AppIdentifier } from "../../types";
2
+ export interface INewSdkFlagsState {
3
+ flags: Partial<Record<AppIdentifier, boolean>>;
4
+ }
5
+ export interface INewSdkFlagsAction {
6
+ type: string;
7
+ appIdentifier?: AppIdentifier;
8
+ useNewSdk?: boolean;
9
+ }
10
+ declare const newSdkFlagsReducer: (state: INewSdkFlagsState | undefined, action: INewSdkFlagsAction) => INewSdkFlagsState;
11
+ export default newSdkFlagsReducer;
@@ -0,0 +1,10 @@
1
+ import { Theme } from "../../types";
2
+ export interface IThemeState {
3
+ value: Theme;
4
+ }
5
+ export interface IThemeAction {
6
+ type: string;
7
+ theme?: Theme;
8
+ }
9
+ declare const themeReducer: (state: IThemeState | undefined, action: IThemeAction) => IThemeState;
10
+ export default themeReducer;
@@ -17,7 +17,9 @@ declare const store: import("redux").Store<import("redux").EmptyObject & {
17
17
  payouts: import("../reducers/payouts").IPayoutsState;
18
18
  pay: import("../reducers/pay").IPayState;
19
19
  "fiat-account-link": import("../reducers/fiat-account-link").IFiatAccountLinkState;
20
- }, import("../reducers/crypto-withdrawals").ICryptoWithdrawalsAction | import("../reducers/onboarding").IOnboardingAction | import("../reducers/crypto-buy").ICryptoBuyAction | import("../reducers/fund").IFundAction>;
20
+ "new-sdk-flags": import("../reducers/new-sdk-flags").INewSdkFlagsState;
21
+ theme: import("../reducers/theme").IThemeState;
22
+ }, import("../reducers/crypto-withdrawals").ICryptoWithdrawalsAction | import("../reducers/onboarding").IOnboardingAction | import("../reducers/crypto-buy").ICryptoBuyAction | import("../reducers/fund").IFundAction | import("../reducers/new-sdk-flags").INewSdkFlagsAction | import("../reducers/theme").IThemeAction>;
21
23
  export default store;
22
24
  export type RootState = ReturnType<typeof rootReducer>;
23
25
  export type AppStore = ReturnType<typeof createStore>;
package/dist/styles.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { CSSProperties } from "react";
2
+ import { Theme } from "./types";
2
3
  /**
3
4
  * Returns the modal border radius based on device type
4
5
  * Mobile devices: 0
@@ -19,6 +20,12 @@ export declare const containerMediaStyles: {
19
20
  [id: string]: CSSProperties;
20
21
  };
21
22
  export declare const appWrapperStyle: CSSProperties;
23
+ export declare const getModalStyle: (theme?: Theme) => CSSProperties;
24
+ /**
25
+ * Default light-mode modal style retained as a named export so existing
26
+ * imports keep compiling. Prefer `getModalStyle(theme)` in render paths
27
+ * that have the resolved theme available.
28
+ */
22
29
  export declare const modalStyle: CSSProperties;
23
30
  export declare const iframeWrapperStyle: CSSProperties;
24
31
  export declare const iframeStyle: CSSProperties;
package/dist/types.d.ts CHANGED
@@ -11,6 +11,28 @@ declare global {
11
11
  MiniKit: typeof MiniKit;
12
12
  }
13
13
  }
14
+ /**
15
+ * Theme controls the appearance of new @zerohash-sdk/*-react components
16
+ * rendered by this SDK. Does not affect the legacy iframe path or the
17
+ * Connect Auth (Fund) component.
18
+ */
19
+ export type Theme = 'light' | 'dark' | 'auto';
20
+ /**
21
+ * Environment selects which deployment of the new @zerohash-sdk/*-react
22
+ * components and their backing services should be used. When set, this
23
+ * takes precedence over hostname-based inference from `zeroHashAppsURL`
24
+ * and is the recommended way to target a specific environment going
25
+ * forward.
26
+ */
27
+ export type Environment = 'cert' | 'prod';
28
+ /**
29
+ * @internal
30
+ * InternalEnvironment exposes Zero Hash dev/local CDN targets used by our
31
+ * own QA tooling (sdk-mobile against simulators, kyc-mock-platform-server).
32
+ * Not part of the public API; values may change without notice. Integrators
33
+ * must use {@link Environment} (`'cert' | 'prod'`).
34
+ */
35
+ export type InternalEnvironment = 'local' | 'dev';
14
36
  /**
15
37
  * IInitializeParameters describes the parameters
16
38
  * required for initializing the platform SDK
@@ -122,6 +144,22 @@ export interface IInitializeParameters {
122
144
  * be a replacement for zeroHashOnboardingURL.
123
145
  */
124
146
  zeroHashAppsURL: string;
147
+ /**
148
+ * env selects which deployment the SDK should target ('cert' | 'prod').
149
+ * When set, it is the source of truth for environment resolution and
150
+ * overrides hostname-based inference from `zeroHashAppsURL` /
151
+ * `zeroHashOnboardingURL`.
152
+ */
153
+ env?: Environment | InternalEnvironment;
154
+ /**
155
+ * theme controls the appearance of new @zerohash-sdk/*-react components
156
+ * rendered by this SDK (e.g. CryptoBuy, CryptoSell, Onboarding).
157
+ *
158
+ * Defaults to 'light'. Does not affect the legacy iframe path or the
159
+ * Connect Auth (Fund) component — the Auth component is themed via
160
+ * authSettings.theme.
161
+ */
162
+ theme?: Theme;
125
163
  }
126
164
  /**
127
165
  * ISetUserOnboardingJWTParameters describes the
@@ -464,6 +502,7 @@ export interface IZeroHashSDK {
464
502
  isOnboardingModalOpen(): boolean;
465
503
  openOnboardingModal(params: IOpenOnboardingModalParameters): void;
466
504
  closeOnboardingModal(): void;
505
+ setTheme(params: ISetThemeParameters): void;
467
506
  }
468
507
  /**
469
508
  * App identifier used to identify to which App we want to perform
@@ -495,6 +534,9 @@ export interface ISetJWTParameters {
495
534
  jwt: string;
496
535
  appIdentifier: AppIdentifier;
497
536
  }
537
+ export interface ISetThemeParameters {
538
+ theme: Theme;
539
+ }
498
540
  export interface Filters {
499
541
  getAssets?: {
500
542
  deposit_address_creation?: string;
@@ -12,54 +12,54 @@ export declare function renderWithProviders(ui: React.ReactElement, extendedRend
12
12
  rerender: (ui: React.ReactNode) => void;
13
13
  unmount: () => void;
14
14
  asFragment: () => DocumentFragment;
15
- getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
16
- getAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
17
- queryByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
18
- queryAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
19
- findByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
20
- findAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
21
- getByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
22
- getAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
23
- queryByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
24
- queryAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
25
- findByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
26
- findAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
27
- getByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
28
- getAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
29
- queryByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
30
- queryAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
31
- findByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
32
- findAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
33
- getByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
34
- getAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
35
- queryByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
36
- queryAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
37
- findByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
38
- findAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
39
- getByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
40
- getAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
41
- queryByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
42
- queryAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
43
- findByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
44
- findAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
45
- getByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
46
- getAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
47
- queryByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
48
- queryAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
49
- findByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
50
- findAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
51
- getByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement;
52
- getAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
53
- queryByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement | null;
54
- queryAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
55
- findByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
56
- findAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
57
- getByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
58
- getAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
59
- queryByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
60
- queryAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
61
- findByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
62
- findAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
15
+ getByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement;
16
+ getAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
17
+ queryByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement | null;
18
+ queryAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
19
+ findByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
20
+ findAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
21
+ getByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
22
+ getAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
23
+ queryByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
24
+ queryAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
25
+ findByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
26
+ findAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
27
+ getByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement;
28
+ getAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
29
+ queryByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement | null;
30
+ queryAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
31
+ findByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
32
+ findAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
33
+ getByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
34
+ getAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
35
+ queryByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
36
+ queryAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
37
+ findByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
38
+ findAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
39
+ getByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
40
+ getAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
41
+ queryByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
42
+ queryAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
43
+ findByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
44
+ findAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
45
+ getByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
46
+ getAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
47
+ queryByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
48
+ queryAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
49
+ findByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
50
+ findAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
51
+ getByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement;
52
+ getAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement[];
53
+ queryByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement | null;
54
+ queryAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement[];
55
+ findByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
56
+ findAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
57
+ getByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
58
+ getAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
59
+ queryByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
60
+ queryAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
61
+ findByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
62
+ findAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
63
63
  store: import("redux").Store<unknown, import("redux").Action<any>>;
64
64
  };
65
65
  export {};
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zh-web-sdk",
3
- "version": "2.16.1",
3
+ "version": "3.0.0",
4
4
  "private": false,
5
5
  "description": "ZeroHash Web SDK",
6
6
  "homepage": "https://github.com/seedcx/zh-web-sdk",
@@ -8,6 +8,11 @@
8
8
  "module": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
10
10
  "keywords": [],
11
+ "files": [
12
+ "dist/",
13
+ "README.md",
14
+ "CHANGELOG.md"
15
+ ],
11
16
  "author": "support@zerohash.com",
12
17
  "license": "MIT",
13
18
  "scripts": {
@@ -21,13 +26,15 @@
21
26
  "test": "jest --silent"
22
27
  },
23
28
  "devDependencies": {
24
- "@testing-library/dom": "^10.4.0",
25
- "@testing-library/react": "^16.0.1",
29
+ "@testing-library/dom": "^10.4.1",
30
+ "@testing-library/react": "^16.3.2",
26
31
  "@types/jest": "^29.5.14",
27
- "@types/react": "^18.3.12",
28
- "@types/react-dom": "^18.3.1",
32
+ "@types/react": "^18.3.29",
33
+ "@types/react-dom": "^18.3.7",
29
34
  "@typescript-eslint/eslint-plugin": "^6.4.0",
30
35
  "archiver": "^5.3.1",
36
+ "braces": "3.0.3",
37
+ "cross-spawn": "^7.0.5",
31
38
  "esbuild": "0.25.0",
32
39
  "eslint": "^8.47.0",
33
40
  "eslint-config-prettier": "6.15.0",
@@ -38,22 +45,34 @@
38
45
  "eslint-plugin-promise": "^6.1.1",
39
46
  "eslint-plugin-react-hooks": "^4.6.0",
40
47
  "eslint-plugin-react-refresh": "^0.3.4",
48
+ "form-data": "4.0.4",
41
49
  "jest": "^29.7.0",
42
50
  "jest-environment-jsdom": "^29.7.0",
43
- "cross-spawn": "^7.0.5",
44
- "form-data": "4.0.4",
45
51
  "rimraf": "^5.0.1",
46
52
  "ts-jest": "^29.2.5",
47
53
  "ts-node": "^10.9.2",
48
- "typescript": "^5.7.2",
49
- "braces": "3.0.3"
54
+ "typescript": "^5.7.2"
50
55
  },
51
56
  "dependencies": {
52
- "@connect-xyz/auth-react": "^0.46.0",
57
+ "@connect-xyz/auth-react": "^0.72.3",
53
58
  "@worldcoin/minikit-js": "^1.9.6",
54
- "react": "^18.2.0",
55
- "react-dom": "^18.2.0",
56
- "react-redux": "^8.1.1",
59
+ "@zerohash-sdk/crypto-account-link-react": "^1.2.3",
60
+ "@zerohash-sdk/crypto-buy-react": "^1.3.3",
61
+ "@zerohash-sdk/crypto-sell-react": "^1.3.3",
62
+ "@zerohash-sdk/crypto-withdrawals-react": "^1.3.3",
63
+ "@zerohash-sdk/csp-crypto-sell-react": "^1.3.3",
64
+ "@zerohash-sdk/csp-crypto-withdrawals-react": "^1.3.3",
65
+ "@zerohash-sdk/csp-fiat-withdrawals-react": "^0.1.2",
66
+ "@zerohash-sdk/fiat-account-link-react": "^1.3.2",
67
+ "@zerohash-sdk/fiat-deposits-react": "^1.3.3",
68
+ "@zerohash-sdk/fiat-withdrawals-react": "^1.3.3",
69
+ "@zerohash-sdk/fund-react": "^1.3.3",
70
+ "@zerohash-sdk/fund-withdrawals-react": "^0.2.2",
71
+ "@zerohash-sdk/onboarding-react": "^1.3.3",
72
+ "@zerohash-sdk/profile-react": "^0.2.2",
73
+ "react": "^18.3.1",
74
+ "react-dom": "^18.3.1",
75
+ "react-redux": "^8.1.3",
57
76
  "redux": "^4.2.1"
58
77
  },
59
78
  "repository": {
package/.eslintrc.js DELETED
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- env: { browser: true, es2020: true },
3
- extends: [
4
- 'eslint:recommended',
5
- 'plugin:@typescript-eslint/recommended',
6
- 'plugin:react-hooks/recommended',
7
- ],
8
- parser: '@typescript-eslint/parser',
9
- parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
10
- plugins: ['react-refresh'],
11
- rules: {},
12
- }
@@ -1,73 +0,0 @@
1
- # Changelog Entry Template
2
-
3
- Use this template when adding a new version to CHANGELOG.md
4
-
5
- ---
6
-
7
- ## [X.Y.Z] - YYYY-MM-DD
8
-
9
- ### Added
10
- - New feature that allows users to [describe user benefit] [#PR_NUMBER]
11
- - Another feature description focusing on customer value
12
-
13
- ### Changed
14
- - Updated [feature/behavior] to [improvement description]
15
- - [Behavior change] now [new behavior] instead of [old behavior]
16
-
17
- ### Deprecated
18
- - [Feature name] is deprecated and will be removed in version [X.Y.Z]
19
- - Migration path: Use [alternative approach] instead
20
- - See [documentation link] for details
21
-
22
- ### Removed
23
- - Removed [feature name] (deprecated since version [X.Y.Z])
24
- - See [migration guide link] for alternatives
25
-
26
- ### Fixed
27
- - Fixed issue where [problem description] [#PR_NUMBER]
28
- - Resolved [bug description] affecting [user impact]
29
-
30
- ### Security
31
- - Updated [dependency name] to address [vulnerability type]
32
- - Fixed [security issue description]
33
-
34
- ---
35
-
36
- ## Guidelines
37
-
38
- ### Writing Tips
39
-
40
- 1. **Focus on User Impact**
41
- - ✅ Good: "Fixed SDK positioning to prevent scrolling issues"
42
- - ❌ Avoid: "Refactored internal positioning logic"
43
-
44
- 2. **Be Specific and Clear**
45
- - ✅ Good: "Added bank account linking feature for direct deposits"
46
- - ❌ Avoid: "Added new feature"
47
-
48
-
49
- ### Breaking Changes
50
-
51
- For MAJOR version releases, clearly mark breaking changes:
52
-
53
- ```markdown
54
- ## [3.0.0] - 2026-XX-XX
55
-
56
- ### Changed
57
- - ⚠️ **BREAKING**: Renamed `cryptoBuyJWT` parameter to `jwt` in SDK configuration
58
-
59
- **Migration Guide:**
60
- \`\`\`typescript
61
- // Before (v2.x)
62
- const sdk = new ZeroHashSDK({
63
- cryptoBuyJWT: token
64
- })
65
-
66
- // After (v3.x)
67
- const sdk = new ZeroHashSDK({
68
- jwt: token
69
- })
70
- \`\`\`
71
-
72
- See [Migration Guide v2 to v3](link) for full details.
73
- ```
@@ -1,10 +0,0 @@
1
- ## Description
2
-
3
- ## Solution
4
-
5
- ## Result
6
-
7
- ## Checklist
8
-
9
- - [ ] CHANGELOG.md has been updated
10
- - [ ] Official docs have been updated
@@ -1,14 +0,0 @@
1
- name: "Reusable NPM Publish tag"
2
-
3
- on:
4
- push:
5
- tags:
6
- - "v*"
7
- workflow_dispatch:
8
-
9
- jobs:
10
- from_reusable:
11
- uses: seedcx/composite-actions/.github/workflows/rw-npm-publish-public-oidc.yml@main
12
- secrets: inherit
13
- with:
14
- NODE_VERSION: "22.21.1"
@@ -1,13 +0,0 @@
1
- name: "Reusable NPM Build"
2
-
3
- on:
4
- pull_request:
5
- branches: [ main, master ]
6
-
7
- jobs:
8
- from_reusable:
9
- uses: seedcx/composite-actions/.github/workflows/rw-npm-build.yml@main
10
- secrets: inherit
11
- with:
12
- NODE_VERSION: "22.22.0"
13
- NPM_VERSION: "9"
@@ -1,14 +0,0 @@
1
- name: "Pull Request"
2
-
3
- on:
4
- pull_request:
5
- branches: [main]
6
-
7
- jobs:
8
- from_reusable:
9
- uses: seedcx/composite-actions/.github/workflows/rw-node-pull-request.yml@main
10
- secrets: inherit
11
- with:
12
- NODE_VERSION: "22.22.0"
13
- TEST_PLATFORM: 'npm'
14
- TEST_REPORTER: 'jest-junit'
@@ -1,13 +0,0 @@
1
- name: "Reusable NPM Publish"
2
-
3
- on:
4
- push:
5
- tags:
6
- - "*"
7
-
8
- jobs:
9
- from_reusable:
10
- uses: seedcx/composite-actions/.github/workflows/rw-npm-publish-public.yml@main
11
- secrets: inherit
12
- with:
13
- NODE_VERSION: "22.22.0"
@@ -1,15 +0,0 @@
1
- name: 'Security Workflow'
2
-
3
- on:
4
- workflow_dispatch:
5
- pull_request:
6
- branches: [main]
7
- schedule:
8
- - cron: '0 16 * * 2'
9
-
10
- jobs:
11
- security:
12
- uses: seedcx/composite-actions/.github/workflows/rw-security.yml@main
13
- with:
14
- NODE_VERSION: 22.12.0
15
- secrets: inherit
@@ -1,14 +0,0 @@
1
- name: 'Tag New Version'
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- workflow_dispatch:
8
-
9
- jobs:
10
- from_reusable:
11
- uses: seedcx/composite-actions/.github/workflows/rw-npm-tag.yml@main
12
- secrets: inherit
13
- with:
14
- NODE_VERSION: "22.22.0"