@connectedxm/client 4.3.1 → 5.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.
package/dist/index.d.ts CHANGED
@@ -2275,8 +2275,7 @@ interface ConnectedXMClientContextState {
2275
2275
  queryClient: QueryClient;
2276
2276
  organizationId: string;
2277
2277
  apiUrl: "https://client-api.connected.dev" | "https://staging-client-api.connected.dev" | "http://localhost:4001";
2278
- authenticated: boolean | null;
2279
- setAuthenticated: (authenticated: boolean) => void;
2278
+ authenticated: boolean;
2280
2279
  getToken: () => Promise<string | undefined>;
2281
2280
  getExecuteAs?: () => Promise<string | undefined> | string | undefined;
2282
2281
  locale: string;
@@ -2285,10 +2284,10 @@ interface ConnectedXMClientContextState {
2285
2284
  onNotFound?: (error: AxiosError<ConnectedXMResponse<any>>, key: QueryKey, shouldRedirect: boolean) => void;
2286
2285
  onMutationError?: (error: AxiosError<ConnectedXMResponse<null>>, variables: Omit<MutationParams, "queryClient" | "clientApiParams">, context: unknown) => void;
2287
2286
  }
2288
- interface ConnectedXMProviderProps extends Omit<ConnectedXMClientContextState, "token" | "setToken" | "executeAs" | "setExecuteAs" | "websocket" | "authenticated" | "setAuthenticated"> {
2287
+ interface ConnectedXMProviderProps extends ConnectedXMClientContextState {
2289
2288
  children: React.ReactNode;
2290
2289
  }
2291
- declare const ConnectedXMProvider: ({ queryClient, children, getToken, ...state }: ConnectedXMProviderProps) => React.JSX.Element;
2290
+ declare const ConnectedXMProvider: ({ children, ...state }: ConnectedXMProviderProps) => React.JSX.Element;
2292
2291
 
2293
2292
  declare const useConnectedXM: () => ConnectedXMClientContextState;
2294
2293
 
@@ -4768,17 +4767,17 @@ interface CancelGroupRequestParams extends MutationParams {
4768
4767
  declare const CancelGroupRequest: ({ groupId, clientApiParams, queryClient, }: CancelGroupRequestParams) => Promise<ConnectedXMResponse<null>>;
4769
4768
  declare const useCancelGroupRequest: (options?: Omit<MutationOptions<Awaited<ReturnType<typeof CancelGroupRequest>>, Omit<CancelGroupRequestParams, "queryClient" | "clientApiParams">>, "mutationFn">) => _tanstack_react_query.UseMutationResult<ConnectedXMResponse<null>, axios.AxiosError<ConnectedXMResponse<null>, any>, Omit<CancelGroupRequestParams, "queryClient" | "clientApiParams">, unknown>;
4770
4769
 
4771
- interface CreateGroupParams extends MutationParams {
4772
- group: CreateGroup;
4773
- imageDataUri?: string;
4774
- }
4775
- interface CreateGroup {
4770
+ interface CreateGroupData {
4776
4771
  name: string;
4777
4772
  description: string;
4778
4773
  access: keyof typeof GroupAccess;
4779
4774
  active: boolean;
4780
4775
  externalUrl?: string;
4781
4776
  }
4777
+ interface CreateGroupParams extends MutationParams {
4778
+ group: CreateGroupData;
4779
+ imageDataUri?: string;
4780
+ }
4782
4781
  declare const CreateGroup: ({ group, imageDataUri, clientApiParams, queryClient, }: CreateGroupParams) => Promise<ConnectedXMResponse<Group>>;
4783
4782
  declare const useCreateGroup: (options?: Omit<MutationOptions<Awaited<ReturnType<typeof CreateGroup>>, Omit<CreateGroupParams, "queryClient" | "clientApiParams">>, "mutationFn">) => _tanstack_react_query.UseMutationResult<ConnectedXMResponse<Group>, axios.AxiosError<ConnectedXMResponse<Group>, any>, Omit<CreateGroupParams, "queryClient" | "clientApiParams">, unknown>;
4784
4783
 
package/dist/index.js CHANGED
@@ -1,63 +1,13 @@
1
1
  // src/ConnectedXMProvider.tsx
2
2
  import React from "react";
3
- import {
4
- QueryClientProvider
5
- } from "@tanstack/react-query";
6
3
  var ConnectedXMClientContext = React.createContext(
7
4
  {}
8
5
  );
9
6
  var ConnectedXMProvider = ({
10
- queryClient,
11
7
  children,
12
- getToken,
13
8
  ...state
14
9
  }) => {
15
- const [authenticated, setAuthenticated] = React.useState(
16
- null
17
- );
18
- const [ssr, setSSR] = React.useState(true);
19
- React.useEffect(() => {
20
- if (!authenticated) {
21
- getToken().then((token) => {
22
- if (token) {
23
- setAuthenticated(true);
24
- } else {
25
- setAuthenticated(false);
26
- }
27
- });
28
- }
29
- }, [authenticated, getToken]);
30
- React.useEffect(() => {
31
- setSSR(false);
32
- }, []);
33
- if (ssr) {
34
- return /* @__PURE__ */ React.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React.createElement(
35
- ConnectedXMClientContext.Provider,
36
- {
37
- value: {
38
- ...state,
39
- getToken,
40
- authenticated,
41
- setAuthenticated,
42
- queryClient
43
- }
44
- },
45
- children
46
- ));
47
- }
48
- return /* @__PURE__ */ React.createElement(
49
- ConnectedXMClientContext.Provider,
50
- {
51
- value: {
52
- ...state,
53
- getToken,
54
- authenticated,
55
- setAuthenticated,
56
- queryClient
57
- }
58
- },
59
- children
60
- );
10
+ return /* @__PURE__ */ React.createElement(ConnectedXMClientContext.Provider, { value: state }, children);
61
11
  };
62
12
 
63
13
  // src/hooks/useConnectedXM.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectedxm/client",
3
- "version": "4.3.1",
3
+ "version": "5.0.0",
4
4
  "description": "Client API javascript SDK",
5
5
  "author": "ConnectedXM Inc.",
6
6
  "type": "module",