@zerohash-sdk/crypto-account-link-react 1.2.1 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -44,7 +44,7 @@ declare type AppEvent<TType extends string = string, TData = Record<string, unkn
44
44
  * // With callback functions
45
45
  * <CryptoAccountLink
46
46
  * jwt="your-jwt-token"
47
- * theme="auto"
47
+ * theme="light"
48
48
  * onLoaded={() => console.log('Crypto account link loaded and ready')}
49
49
  * onCompleted={(data) => console.log('Account linked successfully', data)}
50
50
  * onClose={() => console.log('Crypto account link closed')}
package/dist/index.js CHANGED
@@ -1,41 +1,41 @@
1
- import k, { useRef as x, useEffect as a } from "react";
1
+ import m, { useRef as x, useEffect as f } from "react";
2
2
  const b = {
3
3
  local: "http://localhost:5173/crypto-account-link-web/index.js",
4
4
  dev: "https://connect-sdk.dev.0hash.com/crypto-account-link-web/index.js",
5
5
  cert: "https://sdk.sandbox.connect.xyz/crypto-account-link-web/index.js",
6
6
  prod: "https://sdk.connect.xyz/crypto-account-link-web/index.js"
7
- }, I = "zerohash-crypto-account-link-script", f = "zerohash-crypto-account-link", R = (o = "prod") => b[o], w = ({
8
- jwt: o,
9
- env: e = "prod",
10
- theme: h,
11
- isPayouts: y = !1,
12
- onCompleted: r,
13
- onError: n,
14
- onClose: s,
15
- onLoaded: i,
16
- onExternalAccountCreated: p,
17
- onEvent: d,
18
- ...m
7
+ }, I = "zerohash-crypto-account-link-script", y = "zerohash-crypto-account-link", R = (e = "prod") => b[e], w = ({
8
+ jwt: e,
9
+ env: o = "prod",
10
+ theme: r,
11
+ isPayouts: h = !1,
12
+ onCompleted: n,
13
+ onError: s,
14
+ onClose: i,
15
+ onLoaded: p,
16
+ onExternalAccountCreated: d,
17
+ onEvent: l,
18
+ ...k
19
19
  }) => {
20
- const l = x(null);
21
- return a(() => {
22
- const t = l.current;
23
- t && (r && (t.onCompleted = r), n && (t.onError = n), s && (t.onClose = s), i && (t.onLoaded = i), p && (t.onExternalAccountCreated = p), d && (t.onEvent = d));
24
- }, [r, n, s, i, p, d]), a(() => {
25
- const t = R(e), u = `${I}-${e}`;
26
- if (document.getElementById(u))
20
+ const u = x(null);
21
+ return f(() => {
22
+ const t = u.current;
23
+ t && (r !== void 0 && (t.theme = r), n && (t.onCompleted = n), s && (t.onError = s), i && (t.onClose = i), p && (t.onLoaded = p), d && (t.onExternalAccountCreated = d), l && (t.onEvent = l));
24
+ }, [r, n, s, i, p, d, l]), f(() => {
25
+ const t = R(o), a = `${I}-${o}`;
26
+ if (document.getElementById(a))
27
27
  return;
28
28
  const c = document.createElement("script");
29
- c.id = u, c.src = t, c.type = "module", c.async = !0, c.onerror = () => {
30
- console.error(`Failed to load the script for ${f} from ${e} environment.`);
29
+ c.id = a, c.src = t, c.type = "module", c.async = !0, c.onerror = () => {
30
+ console.error(`Failed to load the script for ${y} from ${o} environment.`);
31
31
  }, document.head.appendChild(c);
32
- }, [e]), k.createElement(f, {
33
- ref: l,
34
- jwt: o,
35
- env: e,
36
- theme: h,
37
- "is-payouts": y,
38
- ...m
32
+ }, [o]), m.createElement(y, {
33
+ ref: u,
34
+ jwt: e,
35
+ env: o,
36
+ theme: r,
37
+ "is-payouts": h,
38
+ ...k
39
39
  });
40
40
  };
41
41
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerohash-sdk/crypto-account-link-react",
3
- "version": "1.2.1",
3
+ "version": "1.2.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -228,7 +228,7 @@ interface CryptoAccountLinkElement
228
228
  extends HTMLElement,
229
229
  Pick<
230
230
  CryptoAccountLinkProps,
231
- 'onCompleted' | 'onError' | 'onClose' | 'onLoaded' | 'onEvent' | 'onExternalAccountCreated'
231
+ 'theme' | 'onCompleted' | 'onError' | 'onClose' | 'onLoaded' | 'onEvent' | 'onExternalAccountCreated'
232
232
  > {}
233
233
 
234
234
  /**
@@ -263,7 +263,7 @@ interface CryptoAccountLinkElement
263
263
  * // With callback functions
264
264
  * <CryptoAccountLink
265
265
  * jwt="your-jwt-token"
266
- * theme="auto"
266
+ * theme="light"
267
267
  * onLoaded={() => console.log('Crypto account link loaded and ready')}
268
268
  * onCompleted={(data) => console.log('Account linked successfully', data)}
269
269
  * onClose={() => console.log('Crypto account link closed')}
@@ -290,18 +290,18 @@ export const CryptoAccountLink: React.FC<CryptoAccountLinkProps> = ({
290
290
  }) => {
291
291
  const ref = useRef<CryptoAccountLinkElement | null>(null);
292
292
 
293
- // Set up callback functions on the web component element
294
293
  useEffect(() => {
295
294
  const element = ref.current;
296
295
  if (!element) return;
297
296
 
297
+ if (theme !== undefined) element.theme = theme;
298
298
  if (onCompleted) element.onCompleted = onCompleted;
299
299
  if (onError) element.onError = onError;
300
300
  if (onClose) element.onClose = onClose;
301
301
  if (onLoaded) element.onLoaded = onLoaded;
302
302
  if (onExternalAccountCreated) element.onExternalAccountCreated = onExternalAccountCreated;
303
303
  if (onEvent) element.onEvent = onEvent;
304
- }, [onCompleted, onError, onClose, onLoaded, onExternalAccountCreated, onEvent]);
304
+ }, [theme, onCompleted, onError, onClose, onLoaded, onExternalAccountCreated, onEvent]);
305
305
 
306
306
  // Load connect script to render the web component.
307
307
  useEffect(() => {