@livechat/platform-workflows 0.0.6 → 0.0.9

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
@@ -1,21 +1,12 @@
1
- import React, { ReactNode } from 'react';
2
- import { IntegrationNames, GithubClientAuthorization, NetlifyClientAuthorization, VercelClientAuthorization, NeonClientAuthorization, MailchimpClientAuthorization, ShopifyClientAuthorization, HubspotClientAuthorization, BigCommerceClientAuthorization, TextClientAuthorization, initApi as initApi$1, UserSurveyDto, UserDto, ClientInfoDto, AccountDto, AgentDto } from '@livechat/developer-studio-api';
3
- import AccountsSDK from '@livechat/accounts-sdk';
1
+ import { ConfigBase, Config } from '@livechat/developer-studio-ui-react';
2
+ import React from 'react';
3
+ import { IntegrationNames, GithubClientAuthorization, NetlifyClientAuthorization, VercelClientAuthorization, NeonClientAuthorization, MailchimpClientAuthorization, ShopifyClientAuthorization, HubspotClientAuthorization, BigCommerceClientAuthorization, TextClientAuthorization } from '@livechat/developer-studio-api';
4
4
 
5
- interface WorkflowsConfigBase {
6
- env: string;
5
+ interface WorkflowsConfigBase extends ConfigBase {
7
6
  publicUrl: string;
7
+ isHeadless?: boolean;
8
8
  }
9
- interface WorkflowsConfig extends WorkflowsConfigBase {
10
- accountsUrl: string;
11
- platformUrl: string;
12
- adapterUrl: string;
13
- workflowsApiUr: string;
14
- dpsApiUrl: string;
15
- billingApiUrl: string;
16
- adapterApiUrl: string;
17
- livechatApiUrl: string;
18
- textApiUrl: string;
9
+ type WorkflowsConfig = WorkflowsConfigBase & Config & {
19
10
  accountsClientId: string;
20
11
  bigcommerceClientId: string;
21
12
  githubAppClientId: string;
@@ -32,10 +23,10 @@ interface WorkflowsConfig extends WorkflowsConfigBase {
32
23
  aiAgentId: string;
33
24
  pusherKey: string;
34
25
  amplitudeKey: string;
35
- }
26
+ };
36
27
  declare function setWorkflowsConfig(newConfig: Partial<WorkflowsConfigBase>): void;
37
28
  declare function getWorkflowsConfig(): WorkflowsConfig;
38
- declare const getWorkflowEnv: (key: keyof WorkflowsConfig) => string;
29
+ declare const getWorkflowEnv: <T extends "publicUrl" | "isHeadless" | "env" | "accountsClientId" | "bigcommerceClientId" | "githubAppClientId" | "githubOauthClientId" | "hubpotClientId" | "mailchimpClientId" | "neonClientId" | "netlifyClientId" | "shopifyClientId" | "vercelClientId" | "textClientId" | "workflowsAppId" | "workflowsWebhooksAppId" | "aiAgentId" | "pusherKey" | "amplitudeKey" | "accountsUrl" | "platformUrl" | "adapterUrl" | "workflowsApiUr" | "dpsApiUrl" | "billingApiUrl" | "adapterApiUrl" | "livechatApiUrl" | "textApiUrl">(key: T) => WorkflowsConfig[T];
39
30
 
40
31
  type AuthSource = IntegrationNames.Accounts | IntegrationNames.GitHub | IntegrationNames.Vercel | IntegrationNames.Netlify | IntegrationNames.Neon | IntegrationNames.Mailchimp | IntegrationNames.Shopify | IntegrationNames.HubSpot | IntegrationNames.BigCommerce | IntegrationNames.Text;
41
32
  interface AuthState {
@@ -113,94 +104,9 @@ declare function AuthProvider({ children }: {
113
104
  children: React.ReactNode;
114
105
  }): JSX.Element;
115
106
 
116
- interface ModeContextProps {
117
- mode: Mode;
118
- isMarketplaceFullscreenApp: boolean;
119
- }
120
- declare const PATHS: {
121
- MARKETPLACE_FULLSCREEN_APP: string;
122
- };
123
- declare enum Mode {
124
- MarketplaceFullscreenApp = "marketplace-fullscreen-app",
125
- Regular = "regular"
126
- }
127
- declare const ModeContext: React.Context<ModeContextProps>;
128
- declare function ModeProvider({ children }: {
129
- children: ReactNode;
130
- }): JSX.Element;
131
- declare const useMode: () => ModeContextProps;
132
-
133
- declare const initApi: (tokens: Parameters<typeof initApi$1>[1]) => void;
134
-
135
- declare const accountsSDK: AccountsSDK;
136
- declare const clearRootData: () => void;
137
- declare const setRootData: ({ access_token, scope, expires_in, }: {
138
- access_token: string;
139
- scope?: string | undefined;
140
- expires_in?: string | undefined;
141
- }) => void;
142
- interface RootContextProps {
143
- isAuthenticated: boolean;
144
- hasLoginFailed: boolean;
145
- login: (tokens: Parameters<typeof initApi>[0]) => Promise<void>;
146
- logout: () => void;
147
- authorize: (manually?: boolean) => void;
148
- bootstrap: () => void;
149
- }
150
- declare const RootContext: React.Context<RootContextProps>;
151
- declare function RootProvider({ children }: {
152
- children: ReactNode;
153
- }): JSX.Element;
154
- declare const useRootContext: () => RootContextProps;
155
-
156
- interface UserAggregate {
157
- profile: {
158
- id: string;
159
- surveys: UserSurveyDto[];
160
- } & UserDto["profile"];
161
- auth: ClientInfoDto | Record<string, unknown>;
162
- features: UserDto["features"];
163
- meta: {
164
- name?: string;
165
- email?: string;
166
- links: UserDto["links"];
167
- organization_id: ClientInfoDto["organization_id"];
168
- license: number;
169
- roles?: {
170
- role: string;
171
- product: string;
172
- }[];
173
- avatar_url?: string;
174
- properties?: {
175
- avatar_url?: string;
176
- };
177
- } & Partial<AccountDto> & Partial<AgentDto>;
178
- }
179
-
180
- interface UserContextProps {
181
- user: UserAggregate;
182
- isUserFetching: boolean;
183
- updateUser: unknown;
184
- isUserUpdating: boolean;
185
- isUserLoaded: boolean;
186
- isUserAdmin: boolean;
187
- isUserOwnerOrViceOwner: boolean;
188
- isUserAgentInLiveChat: boolean;
189
- userHasAccessToWorkflows: boolean;
190
- }
191
- declare const isUserLiveChatAgent: (userInfo: UserAggregate) => boolean;
192
- declare const isUserOrgAdmin: (userInfo: UserAggregate) => boolean;
193
- declare const isUserLivechatAdmin: (userInfo: UserAggregate) => boolean;
194
- declare const isUserOrgOwnerOrViceOwner: (userInfo: UserAggregate) => boolean;
195
- declare const UserContext: React.Context<UserContextProps>;
196
- declare function UserProvider({ children }: {
197
- children: ReactNode;
198
- }): JSX.Element;
199
- declare const useUserContext: () => UserContextProps;
200
-
201
107
  declare function Flows(): JSX.Element;
202
108
 
203
109
  declare function SettingsSubNav(): JSX.Element;
204
110
  declare function Settings(): JSX.Element;
205
111
 
206
- export { AuthContext, AuthProvider, type AuthSource, type AuthState, Flows, type IAuthContext, Mode, ModeContext, ModeProvider, PATHS, RootContext, RootProvider, Settings, SettingsSubNav, UserContext, UserProvider, type WorkflowsConfig, type WorkflowsConfigBase, accountsSDK, clearRootData, getWorkflowEnv, getWorkflowsConfig, isUserLiveChatAgent, isUserLivechatAdmin, isUserOrgAdmin, isUserOrgOwnerOrViceOwner, setRootData, setWorkflowsConfig, useMode, useRootContext, useUserContext };
112
+ export { AuthContext, AuthProvider, type AuthSource, type AuthState, Flows, type IAuthContext, Settings, SettingsSubNav, type WorkflowsConfig, type WorkflowsConfigBase, getWorkflowEnv, getWorkflowsConfig, setWorkflowsConfig };
package/dist/index.d.ts CHANGED
@@ -1,21 +1,12 @@
1
- import React, { ReactNode } from 'react';
2
- import { IntegrationNames, GithubClientAuthorization, NetlifyClientAuthorization, VercelClientAuthorization, NeonClientAuthorization, MailchimpClientAuthorization, ShopifyClientAuthorization, HubspotClientAuthorization, BigCommerceClientAuthorization, TextClientAuthorization, initApi as initApi$1, UserSurveyDto, UserDto, ClientInfoDto, AccountDto, AgentDto } from '@livechat/developer-studio-api';
3
- import AccountsSDK from '@livechat/accounts-sdk';
1
+ import { ConfigBase, Config } from '@livechat/developer-studio-ui-react';
2
+ import React from 'react';
3
+ import { IntegrationNames, GithubClientAuthorization, NetlifyClientAuthorization, VercelClientAuthorization, NeonClientAuthorization, MailchimpClientAuthorization, ShopifyClientAuthorization, HubspotClientAuthorization, BigCommerceClientAuthorization, TextClientAuthorization } from '@livechat/developer-studio-api';
4
4
 
5
- interface WorkflowsConfigBase {
6
- env: string;
5
+ interface WorkflowsConfigBase extends ConfigBase {
7
6
  publicUrl: string;
7
+ isHeadless?: boolean;
8
8
  }
9
- interface WorkflowsConfig extends WorkflowsConfigBase {
10
- accountsUrl: string;
11
- platformUrl: string;
12
- adapterUrl: string;
13
- workflowsApiUr: string;
14
- dpsApiUrl: string;
15
- billingApiUrl: string;
16
- adapterApiUrl: string;
17
- livechatApiUrl: string;
18
- textApiUrl: string;
9
+ type WorkflowsConfig = WorkflowsConfigBase & Config & {
19
10
  accountsClientId: string;
20
11
  bigcommerceClientId: string;
21
12
  githubAppClientId: string;
@@ -32,10 +23,10 @@ interface WorkflowsConfig extends WorkflowsConfigBase {
32
23
  aiAgentId: string;
33
24
  pusherKey: string;
34
25
  amplitudeKey: string;
35
- }
26
+ };
36
27
  declare function setWorkflowsConfig(newConfig: Partial<WorkflowsConfigBase>): void;
37
28
  declare function getWorkflowsConfig(): WorkflowsConfig;
38
- declare const getWorkflowEnv: (key: keyof WorkflowsConfig) => string;
29
+ declare const getWorkflowEnv: <T extends "publicUrl" | "isHeadless" | "env" | "accountsClientId" | "bigcommerceClientId" | "githubAppClientId" | "githubOauthClientId" | "hubpotClientId" | "mailchimpClientId" | "neonClientId" | "netlifyClientId" | "shopifyClientId" | "vercelClientId" | "textClientId" | "workflowsAppId" | "workflowsWebhooksAppId" | "aiAgentId" | "pusherKey" | "amplitudeKey" | "accountsUrl" | "platformUrl" | "adapterUrl" | "workflowsApiUr" | "dpsApiUrl" | "billingApiUrl" | "adapterApiUrl" | "livechatApiUrl" | "textApiUrl">(key: T) => WorkflowsConfig[T];
39
30
 
40
31
  type AuthSource = IntegrationNames.Accounts | IntegrationNames.GitHub | IntegrationNames.Vercel | IntegrationNames.Netlify | IntegrationNames.Neon | IntegrationNames.Mailchimp | IntegrationNames.Shopify | IntegrationNames.HubSpot | IntegrationNames.BigCommerce | IntegrationNames.Text;
41
32
  interface AuthState {
@@ -113,94 +104,9 @@ declare function AuthProvider({ children }: {
113
104
  children: React.ReactNode;
114
105
  }): JSX.Element;
115
106
 
116
- interface ModeContextProps {
117
- mode: Mode;
118
- isMarketplaceFullscreenApp: boolean;
119
- }
120
- declare const PATHS: {
121
- MARKETPLACE_FULLSCREEN_APP: string;
122
- };
123
- declare enum Mode {
124
- MarketplaceFullscreenApp = "marketplace-fullscreen-app",
125
- Regular = "regular"
126
- }
127
- declare const ModeContext: React.Context<ModeContextProps>;
128
- declare function ModeProvider({ children }: {
129
- children: ReactNode;
130
- }): JSX.Element;
131
- declare const useMode: () => ModeContextProps;
132
-
133
- declare const initApi: (tokens: Parameters<typeof initApi$1>[1]) => void;
134
-
135
- declare const accountsSDK: AccountsSDK;
136
- declare const clearRootData: () => void;
137
- declare const setRootData: ({ access_token, scope, expires_in, }: {
138
- access_token: string;
139
- scope?: string | undefined;
140
- expires_in?: string | undefined;
141
- }) => void;
142
- interface RootContextProps {
143
- isAuthenticated: boolean;
144
- hasLoginFailed: boolean;
145
- login: (tokens: Parameters<typeof initApi>[0]) => Promise<void>;
146
- logout: () => void;
147
- authorize: (manually?: boolean) => void;
148
- bootstrap: () => void;
149
- }
150
- declare const RootContext: React.Context<RootContextProps>;
151
- declare function RootProvider({ children }: {
152
- children: ReactNode;
153
- }): JSX.Element;
154
- declare const useRootContext: () => RootContextProps;
155
-
156
- interface UserAggregate {
157
- profile: {
158
- id: string;
159
- surveys: UserSurveyDto[];
160
- } & UserDto["profile"];
161
- auth: ClientInfoDto | Record<string, unknown>;
162
- features: UserDto["features"];
163
- meta: {
164
- name?: string;
165
- email?: string;
166
- links: UserDto["links"];
167
- organization_id: ClientInfoDto["organization_id"];
168
- license: number;
169
- roles?: {
170
- role: string;
171
- product: string;
172
- }[];
173
- avatar_url?: string;
174
- properties?: {
175
- avatar_url?: string;
176
- };
177
- } & Partial<AccountDto> & Partial<AgentDto>;
178
- }
179
-
180
- interface UserContextProps {
181
- user: UserAggregate;
182
- isUserFetching: boolean;
183
- updateUser: unknown;
184
- isUserUpdating: boolean;
185
- isUserLoaded: boolean;
186
- isUserAdmin: boolean;
187
- isUserOwnerOrViceOwner: boolean;
188
- isUserAgentInLiveChat: boolean;
189
- userHasAccessToWorkflows: boolean;
190
- }
191
- declare const isUserLiveChatAgent: (userInfo: UserAggregate) => boolean;
192
- declare const isUserOrgAdmin: (userInfo: UserAggregate) => boolean;
193
- declare const isUserLivechatAdmin: (userInfo: UserAggregate) => boolean;
194
- declare const isUserOrgOwnerOrViceOwner: (userInfo: UserAggregate) => boolean;
195
- declare const UserContext: React.Context<UserContextProps>;
196
- declare function UserProvider({ children }: {
197
- children: ReactNode;
198
- }): JSX.Element;
199
- declare const useUserContext: () => UserContextProps;
200
-
201
107
  declare function Flows(): JSX.Element;
202
108
 
203
109
  declare function SettingsSubNav(): JSX.Element;
204
110
  declare function Settings(): JSX.Element;
205
111
 
206
- export { AuthContext, AuthProvider, type AuthSource, type AuthState, Flows, type IAuthContext, Mode, ModeContext, ModeProvider, PATHS, RootContext, RootProvider, Settings, SettingsSubNav, UserContext, UserProvider, type WorkflowsConfig, type WorkflowsConfigBase, accountsSDK, clearRootData, getWorkflowEnv, getWorkflowsConfig, isUserLiveChatAgent, isUserLivechatAdmin, isUserOrgAdmin, isUserOrgOwnerOrViceOwner, setRootData, setWorkflowsConfig, useMode, useRootContext, useUserContext };
112
+ export { AuthContext, AuthProvider, type AuthSource, type AuthState, Flows, type IAuthContext, Settings, SettingsSubNav, type WorkflowsConfig, type WorkflowsConfigBase, getWorkflowEnv, getWorkflowsConfig, setWorkflowsConfig };