@connectedxm/client 1.3.12 → 1.3.13

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.mts CHANGED
@@ -1855,7 +1855,7 @@ interface ConnectedXMClientContextState {
1855
1855
  queryClient: QueryClient;
1856
1856
  organizationId: string;
1857
1857
  apiUrl: "https://client-api.connected.dev" | "https://staging-client-api.connected.dev" | "http://localhost:4001";
1858
- authenticated: boolean;
1858
+ authenticated: boolean | null;
1859
1859
  setAuthenticated: (authenticated: boolean) => void;
1860
1860
  getToken: () => Promise<string | undefined>;
1861
1861
  getExecuteAs?: () => Promise<string | undefined> | string | undefined;
package/dist/index.d.ts CHANGED
@@ -1855,7 +1855,7 @@ interface ConnectedXMClientContextState {
1855
1855
  queryClient: QueryClient;
1856
1856
  organizationId: string;
1857
1857
  apiUrl: "https://client-api.connected.dev" | "https://staging-client-api.connected.dev" | "http://localhost:4001";
1858
- authenticated: boolean;
1858
+ authenticated: boolean | null;
1859
1859
  setAuthenticated: (authenticated: boolean) => void;
1860
1860
  getToken: () => Promise<string | undefined>;
1861
1861
  getExecuteAs?: () => Promise<string | undefined> | string | undefined;
package/dist/index.js CHANGED
@@ -1007,13 +1007,17 @@ var ConnectedXMProvider = ({
1007
1007
  getToken,
1008
1008
  ...state
1009
1009
  }) => {
1010
- const [authenticated, setAuthenticated] = import_react.default.useState(false);
1010
+ const [authenticated, setAuthenticated] = import_react.default.useState(
1011
+ null
1012
+ );
1011
1013
  const [ssr, setSSR] = import_react.default.useState(true);
1012
1014
  import_react.default.useEffect(() => {
1013
1015
  if (!authenticated) {
1014
1016
  getToken().then((token) => {
1015
1017
  if (token) {
1016
1018
  setAuthenticated(true);
1019
+ } else {
1020
+ setAuthenticated(false);
1017
1021
  }
1018
1022
  });
1019
1023
  }
@@ -5316,7 +5320,7 @@ var useGetSelf = (ignoreExecuteAs, options = {}) => {
5316
5320
  (params) => GetSelf({ ignoreExecuteAs, ...params }),
5317
5321
  {
5318
5322
  ...options,
5319
- enabled: authenticated && (options?.enabled ?? true)
5323
+ enabled: !!authenticated && (options?.enabled ?? true)
5320
5324
  }
5321
5325
  );
5322
5326
  };
@@ -7063,7 +7067,7 @@ var useGetSelfNotificationPreferences = (options = {}) => {
7063
7067
  (params) => GetSelfNotificationPreferences({ ...params }),
7064
7068
  {
7065
7069
  ...options,
7066
- enabled: authenticated && (options?.enabled ?? true)
7070
+ enabled: !!authenticated && (options?.enabled ?? true)
7067
7071
  }
7068
7072
  );
7069
7073
  };
package/dist/index.mjs CHANGED
@@ -12,13 +12,17 @@ var ConnectedXMProvider = ({
12
12
  getToken,
13
13
  ...state
14
14
  }) => {
15
- const [authenticated, setAuthenticated] = React.useState(false);
15
+ const [authenticated, setAuthenticated] = React.useState(
16
+ null
17
+ );
16
18
  const [ssr, setSSR] = React.useState(true);
17
19
  React.useEffect(() => {
18
20
  if (!authenticated) {
19
21
  getToken().then((token) => {
20
22
  if (token) {
21
23
  setAuthenticated(true);
24
+ } else {
25
+ setAuthenticated(false);
22
26
  }
23
27
  });
24
28
  }
@@ -4323,7 +4327,7 @@ var useGetSelf = (ignoreExecuteAs, options = {}) => {
4323
4327
  (params) => GetSelf({ ignoreExecuteAs, ...params }),
4324
4328
  {
4325
4329
  ...options,
4326
- enabled: authenticated && (options?.enabled ?? true)
4330
+ enabled: !!authenticated && (options?.enabled ?? true)
4327
4331
  }
4328
4332
  );
4329
4333
  };
@@ -6070,7 +6074,7 @@ var useGetSelfNotificationPreferences = (options = {}) => {
6070
6074
  (params) => GetSelfNotificationPreferences({ ...params }),
6071
6075
  {
6072
6076
  ...options,
6073
- enabled: authenticated && (options?.enabled ?? true)
6077
+ enabled: !!authenticated && (options?.enabled ?? true)
6074
6078
  }
6075
6079
  );
6076
6080
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectedxm/client",
3
- "version": "1.3.12",
3
+ "version": "1.3.13",
4
4
  "description": "Client API javascript SDK",
5
5
  "author": "ConnectedXM Inc.",
6
6
  "repository": {