@appkit/dek-lib 0.54.0 → 0.57.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/components/BoardProvider/BoardProvider.d.ts +2 -1
- package/dist/components/LoginScreen/LoginScreen.d.ts +2 -1
- package/dist/data/fetchUserData.d.ts +1 -1
- package/dist/data/fetchUserPlugins.d.ts +1 -1
- package/dist/data/fetchUserToken.d.ts +1 -1
- package/dist/data/getClient.d.ts +1 -1
- package/dist/data/watchUser.d.ts +1 -1
- package/dist/index.es.js +38 -38
- package/dist/index.umd.js +38 -38
- package/dist/lib/data.d.ts +3 -3
- package/dist/lib/hooks/useAuthorization.d.ts +1 -1
- package/dist/lib/hooks/useUserConfigLoader.d.ts +1 -1
- package/dist/lib/plugins.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3,11 +3,12 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { PreviewConfig } from '../../lib/contexts/PreviewConfigContext';
|
|
4
4
|
type Props = {
|
|
5
5
|
authToken: string;
|
|
6
|
+
apiUrl?: string;
|
|
6
7
|
plugin?: DekPluginFactory;
|
|
7
8
|
pluginConfig?: any;
|
|
8
9
|
previewConfig?: PreviewConfig;
|
|
9
10
|
zoom?: number;
|
|
10
11
|
children?: ReactNode;
|
|
11
12
|
};
|
|
12
|
-
declare const BoardProvider: ({ authToken, plugin, pluginConfig, zoom, children, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const BoardProvider: ({ authToken, apiUrl, plugin, pluginConfig, zoom, children, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default BoardProvider;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const DEK_AUTH_TOKEN_KEY = "dek_auth_token";
|
|
2
2
|
type Props = {
|
|
3
3
|
onSuccess: (token: string) => void;
|
|
4
|
+
apiUrl?: string;
|
|
4
5
|
};
|
|
5
|
-
declare const LoginScreen: ({ onSuccess }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare const LoginScreen: ({ onSuccess, apiUrl }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export default LoginScreen;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { UserDataQuery } from './types/graphql';
|
|
2
2
|
export type UserData = UserDataQuery['currentUser'];
|
|
3
|
-
declare function fetchUserData(authToken: string): Promise<UserData>;
|
|
3
|
+
declare function fetchUserData(authToken: string, apiUrl: string): Promise<UserData>;
|
|
4
4
|
export default fetchUserData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloQueryResult } from '@apollo/client';
|
|
2
2
|
import { UserPluginsAndIntegrationsQuery } from './types/graphql';
|
|
3
3
|
export type FetchUserPluginsResult = ApolloQueryResult<UserPluginsAndIntegrationsQuery>['data']['currentUser'];
|
|
4
|
-
declare function fetchUserPlugins(authToken: string): Promise<FetchUserPluginsResult>;
|
|
4
|
+
declare function fetchUserPlugins(authToken: string, apiUrl: string): Promise<FetchUserPluginsResult>;
|
|
5
5
|
export default fetchUserPlugins;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function fetchUserToken(email: string, password: string): Promise<any>;
|
|
1
|
+
declare function fetchUserToken(email: string, password: string, apiUrl: string): Promise<any>;
|
|
2
2
|
export default fetchUserToken;
|
package/dist/data/getClient.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
|
|
2
|
-
declare function getClient(authToken: string): Promise<ApolloClient<NormalizedCacheObject>>;
|
|
2
|
+
declare function getClient(authToken: string, apiUrl: string): Promise<ApolloClient<NormalizedCacheObject>>;
|
|
3
3
|
export default getClient;
|
package/dist/data/watchUser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function watchUser(authToken: string, cb: () => void): Promise<void>;
|
|
1
|
+
declare function watchUser(authToken: string, apiUrl: string, cb: () => void): Promise<void>;
|
|
2
2
|
export default watchUser;
|
package/dist/index.es.js
CHANGED
|
@@ -64050,16 +64050,16 @@ function isFatalInternalCloseCode(code) {
|
|
|
64050
64050
|
function isWebSocket(val) {
|
|
64051
64051
|
return typeof val === "function" && "constructor" in val && "CLOSED" in val && "CLOSING" in val && "CONNECTING" in val && "OPEN" in val;
|
|
64052
64052
|
}
|
|
64053
|
-
async function getClient(authToken) {
|
|
64053
|
+
async function getClient(authToken, apiUrl) {
|
|
64054
64054
|
const httpLink = new HttpLink({
|
|
64055
|
-
uri:
|
|
64055
|
+
uri: apiUrl,
|
|
64056
64056
|
headers: {
|
|
64057
64057
|
authorization: `Bearer ${authToken}`
|
|
64058
64058
|
}
|
|
64059
64059
|
});
|
|
64060
64060
|
const wsLink = new GraphQLWsLink(
|
|
64061
64061
|
createClient({
|
|
64062
|
-
url: "wss://
|
|
64062
|
+
url: apiUrl.replace(/^https?:\/\//, (m) => m === "https://" ? "wss://" : "ws://"),
|
|
64063
64063
|
connectionParams: {
|
|
64064
64064
|
token: authToken
|
|
64065
64065
|
}
|
|
@@ -64154,14 +64154,14 @@ const USER_DATA_QUERY = gql(`
|
|
|
64154
64154
|
}
|
|
64155
64155
|
}
|
|
64156
64156
|
`);
|
|
64157
|
-
async function fetchUserData(authToken) {
|
|
64158
|
-
const client = await getClient(authToken);
|
|
64157
|
+
async function fetchUserData(authToken, apiUrl) {
|
|
64158
|
+
const client = await getClient(authToken, apiUrl);
|
|
64159
64159
|
const response = await client.query({
|
|
64160
64160
|
query: USER_DATA_QUERY
|
|
64161
64161
|
});
|
|
64162
64162
|
return response.data.currentUser;
|
|
64163
64163
|
}
|
|
64164
|
-
async function fetchUserToken(email, password) {
|
|
64164
|
+
async function fetchUserToken(email, password, apiUrl) {
|
|
64165
64165
|
const headers = new Headers();
|
|
64166
64166
|
headers.append("Content-Type", "application/json");
|
|
64167
64167
|
const graphql = JSON.stringify({
|
|
@@ -64183,10 +64183,7 @@ async function fetchUserToken(email, password) {
|
|
|
64183
64183
|
headers,
|
|
64184
64184
|
body: graphql
|
|
64185
64185
|
};
|
|
64186
|
-
const response = await fetch(
|
|
64187
|
-
"https://dek.appkit.net/v1/graphql",
|
|
64188
|
-
requestOptions
|
|
64189
|
-
);
|
|
64186
|
+
const response = await fetch(apiUrl, requestOptions);
|
|
64190
64187
|
const result = await response.json();
|
|
64191
64188
|
return result.data.login.token;
|
|
64192
64189
|
}
|
|
@@ -64200,12 +64197,12 @@ const USER_SUBSCRIPTION_QUERY = gql(`
|
|
|
64200
64197
|
}
|
|
64201
64198
|
`);
|
|
64202
64199
|
let subscription = null;
|
|
64203
|
-
async function watchUser(authToken, cb2) {
|
|
64200
|
+
async function watchUser(authToken, apiUrl, cb2) {
|
|
64204
64201
|
if (subscription) {
|
|
64205
64202
|
subscription.unsubscribe();
|
|
64206
64203
|
subscription = null;
|
|
64207
64204
|
}
|
|
64208
|
-
const client = await getClient(authToken);
|
|
64205
|
+
const client = await getClient(authToken, apiUrl);
|
|
64209
64206
|
const response = client.subscribe({
|
|
64210
64207
|
query: USER_SUBSCRIPTION_QUERY
|
|
64211
64208
|
});
|
|
@@ -64222,11 +64219,11 @@ const noopRegistry = {
|
|
|
64222
64219
|
registerCollectionItem: () => {
|
|
64223
64220
|
}
|
|
64224
64221
|
};
|
|
64225
|
-
async function updateData(authToken, plugin) {
|
|
64222
|
+
async function updateData(authToken, apiUrl, plugin) {
|
|
64226
64223
|
updateStateLoading(true);
|
|
64227
64224
|
let userData;
|
|
64228
64225
|
if (authToken) {
|
|
64229
|
-
userData = await fetchUserData(authToken);
|
|
64226
|
+
userData = await fetchUserData(authToken, apiUrl);
|
|
64230
64227
|
} else {
|
|
64231
64228
|
userData = {
|
|
64232
64229
|
boards: [],
|
|
@@ -64255,13 +64252,13 @@ async function updateData(authToken, plugin) {
|
|
|
64255
64252
|
updateStateData(userData);
|
|
64256
64253
|
updateStateLoading(false);
|
|
64257
64254
|
}
|
|
64258
|
-
function watchForDataChanges(authToken, cb2) {
|
|
64255
|
+
function watchForDataChanges(authToken, apiUrl, cb2) {
|
|
64259
64256
|
if (authToken) {
|
|
64260
|
-
watchUser(authToken, cb2);
|
|
64257
|
+
watchUser(authToken, apiUrl, cb2);
|
|
64261
64258
|
}
|
|
64262
64259
|
}
|
|
64263
|
-
async function authorize(email, password) {
|
|
64264
|
-
return fetchUserToken(email, password);
|
|
64260
|
+
async function authorize(email, password, apiUrl) {
|
|
64261
|
+
return fetchUserToken(email, password, apiUrl);
|
|
64265
64262
|
}
|
|
64266
64263
|
const DEK_AUTH_TOKEN_KEY = "dek_auth_token";
|
|
64267
64264
|
const DEK_EMAIL_KEY = "dek_auth_email";
|
|
@@ -64297,7 +64294,8 @@ const StyledInput = styled.input`
|
|
|
64297
64294
|
background: rgba(255, 255, 255, 0.12);
|
|
64298
64295
|
}
|
|
64299
64296
|
`;
|
|
64300
|
-
const
|
|
64297
|
+
const DEFAULT_API_URL$1 = "https://dek.appkit.net/v1/graphql";
|
|
64298
|
+
const LoginScreen = ({ onSuccess, apiUrl = DEFAULT_API_URL$1 }) => {
|
|
64301
64299
|
const [email, setEmail] = useState$1(() => localStorage.getItem(DEK_EMAIL_KEY) || "");
|
|
64302
64300
|
const [password, setPassword] = useState$1("");
|
|
64303
64301
|
const [error, setError] = useState$1("");
|
|
@@ -64314,7 +64312,7 @@ const LoginScreen = ({ onSuccess }) => {
|
|
|
64314
64312
|
setError("");
|
|
64315
64313
|
setLoading(true);
|
|
64316
64314
|
try {
|
|
64317
|
-
const token = await authorize(email, password);
|
|
64315
|
+
const token = await authorize(email, password, apiUrl);
|
|
64318
64316
|
localStorage.setItem(DEK_AUTH_TOKEN_KEY, token);
|
|
64319
64317
|
localStorage.setItem(DEK_EMAIL_KEY, email);
|
|
64320
64318
|
onSuccess(token);
|
|
@@ -64392,8 +64390,8 @@ const USER_PLUGIN_AND_INTEGRATIONS_QUERY = gql(`
|
|
|
64392
64390
|
}
|
|
64393
64391
|
}
|
|
64394
64392
|
`);
|
|
64395
|
-
async function fetchUserPlugins(authToken) {
|
|
64396
|
-
const client = await getClient(authToken);
|
|
64393
|
+
async function fetchUserPlugins(authToken, apiUrl) {
|
|
64394
|
+
const client = await getClient(authToken, apiUrl);
|
|
64397
64395
|
const response = await client.query({
|
|
64398
64396
|
query: USER_PLUGIN_AND_INTEGRATIONS_QUERY
|
|
64399
64397
|
});
|
|
@@ -64401,7 +64399,7 @@ async function fetchUserPlugins(authToken) {
|
|
|
64401
64399
|
result.integrations.unshift({
|
|
64402
64400
|
key: "base",
|
|
64403
64401
|
pluginName: "base",
|
|
64404
|
-
pluginVersion: "0.
|
|
64402
|
+
pluginVersion: "0.57.0",
|
|
64405
64403
|
pluginConfig: []
|
|
64406
64404
|
});
|
|
64407
64405
|
return result;
|
|
@@ -64470,7 +64468,7 @@ const ClockComponent = () => {
|
|
|
64470
64468
|
};
|
|
64471
64469
|
const About = () => {
|
|
64472
64470
|
return /* @__PURE__ */ jsxs(g0, { padding: 20, direction: "vert", children: [
|
|
64473
|
-
/* @__PURE__ */ jsx(eq1, { children: `Dek ${"0.
|
|
64471
|
+
/* @__PURE__ */ jsx(eq1, { children: `Dek ${"0.57.0"}` }),
|
|
64474
64472
|
/* @__PURE__ */ jsx(o4, { children: "From Appkit" })
|
|
64475
64473
|
] });
|
|
64476
64474
|
};
|
|
@@ -96432,19 +96430,19 @@ function getAllIntegrationInstances() {
|
|
|
96432
96430
|
}
|
|
96433
96431
|
return results;
|
|
96434
96432
|
}
|
|
96435
|
-
async function updatePlugins(authToken) {
|
|
96433
|
+
async function updatePlugins(authToken, apiUrl) {
|
|
96436
96434
|
updateStateLoading(true);
|
|
96437
96435
|
await unloadAllPlugins();
|
|
96438
96436
|
let integrationsAndPlugins;
|
|
96439
96437
|
if (authToken) {
|
|
96440
|
-
integrationsAndPlugins = await fetchUserPlugins(authToken);
|
|
96438
|
+
integrationsAndPlugins = await fetchUserPlugins(authToken, apiUrl);
|
|
96441
96439
|
} else {
|
|
96442
96440
|
integrationsAndPlugins = {
|
|
96443
96441
|
integrations: [
|
|
96444
96442
|
{
|
|
96445
96443
|
key: "base",
|
|
96446
96444
|
pluginName: "base",
|
|
96447
|
-
pluginVersion: "0.
|
|
96445
|
+
pluginVersion: "0.57.0",
|
|
96448
96446
|
pluginConfig: []
|
|
96449
96447
|
}
|
|
96450
96448
|
],
|
|
@@ -96490,21 +96488,21 @@ async function unloadLocalPlugin() {
|
|
|
96490
96488
|
localPluginFactory = void 0;
|
|
96491
96489
|
updateStatePlugins(getAllPluginFactories(), getAllIntegrationInstances());
|
|
96492
96490
|
}
|
|
96493
|
-
function useUserConfigLoader(authToken, plugin, pluginConfig) {
|
|
96491
|
+
function useUserConfigLoader(authToken, apiUrl, plugin, pluginConfig) {
|
|
96494
96492
|
const userConfig = useSnapshot(state);
|
|
96495
96493
|
const userChanged = useCallback(async () => {
|
|
96496
96494
|
console.log("### USER CHANGED");
|
|
96497
|
-
await updatePlugins(authToken);
|
|
96498
|
-
await updateData(authToken, plugin);
|
|
96499
|
-
}, [authToken, plugin]);
|
|
96495
|
+
await updatePlugins(authToken, apiUrl);
|
|
96496
|
+
await updateData(authToken, apiUrl, plugin);
|
|
96497
|
+
}, [authToken, apiUrl, plugin]);
|
|
96500
96498
|
useEffect$1(() => {
|
|
96501
96499
|
const update = async () => {
|
|
96502
|
-
await updatePlugins(authToken);
|
|
96500
|
+
await updatePlugins(authToken, apiUrl);
|
|
96503
96501
|
if (plugin) {
|
|
96504
96502
|
await updateLocalPlugin(plugin, pluginConfig);
|
|
96505
96503
|
}
|
|
96506
|
-
await updateData(authToken, plugin);
|
|
96507
|
-
await watchForDataChanges(authToken, userChanged);
|
|
96504
|
+
await updateData(authToken, apiUrl, plugin);
|
|
96505
|
+
await watchForDataChanges(authToken, apiUrl, userChanged);
|
|
96508
96506
|
};
|
|
96509
96507
|
update();
|
|
96510
96508
|
return () => {
|
|
@@ -96549,15 +96547,17 @@ const BoardStylesProvider = ({
|
|
|
96549
96547
|
children
|
|
96550
96548
|
] });
|
|
96551
96549
|
};
|
|
96550
|
+
const DEFAULT_API_URL = "https://dek.appkit.net/v1/graphql";
|
|
96552
96551
|
const transitionDelay = 0;
|
|
96553
96552
|
const BoardProvider = ({
|
|
96554
96553
|
authToken,
|
|
96554
|
+
apiUrl = DEFAULT_API_URL,
|
|
96555
96555
|
plugin,
|
|
96556
96556
|
pluginConfig,
|
|
96557
96557
|
zoom,
|
|
96558
96558
|
children
|
|
96559
96559
|
}) => {
|
|
96560
|
-
const config2 = useUserConfigLoader(authToken, plugin, pluginConfig);
|
|
96560
|
+
const config2 = useUserConfigLoader(authToken, apiUrl, plugin, pluginConfig);
|
|
96561
96561
|
console.log("### LOADED", config2);
|
|
96562
96562
|
return /* @__PURE__ */ jsx(UserConfigContext.Provider, { value: config2, children: /* @__PURE__ */ jsx(BoardStylesProvider, { zoom, transitionDelay, children }) });
|
|
96563
96563
|
};
|
|
@@ -96678,15 +96678,15 @@ const Component = ({ integrationKey, componentKey }) => {
|
|
|
96678
96678
|
}
|
|
96679
96679
|
return /* @__PURE__ */ jsx("div", { "aria-label": "component", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: component || null }) });
|
|
96680
96680
|
};
|
|
96681
|
-
function useAuthorization(email, password) {
|
|
96681
|
+
function useAuthorization(email, password, apiUrl) {
|
|
96682
96682
|
const [token, setToken] = useState$1("");
|
|
96683
96683
|
useEffect$1(() => {
|
|
96684
96684
|
const authorizeUser = async () => {
|
|
96685
|
-
const token2 = await authorize(email, password);
|
|
96685
|
+
const token2 = await authorize(email, password, apiUrl);
|
|
96686
96686
|
setToken(token2);
|
|
96687
96687
|
};
|
|
96688
96688
|
authorizeUser();
|
|
96689
|
-
}, [email, password]);
|
|
96689
|
+
}, [email, password, apiUrl]);
|
|
96690
96690
|
return token;
|
|
96691
96691
|
}
|
|
96692
96692
|
async function loadCustomPlugin(code) {
|
package/dist/index.umd.js
CHANGED
|
@@ -64066,16 +64066,16 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64066
64066
|
function isWebSocket(val) {
|
|
64067
64067
|
return typeof val === "function" && "constructor" in val && "CLOSED" in val && "CLOSING" in val && "CONNECTING" in val && "OPEN" in val;
|
|
64068
64068
|
}
|
|
64069
|
-
async function getClient(authToken) {
|
|
64069
|
+
async function getClient(authToken, apiUrl) {
|
|
64070
64070
|
const httpLink = new HttpLink({
|
|
64071
|
-
uri:
|
|
64071
|
+
uri: apiUrl,
|
|
64072
64072
|
headers: {
|
|
64073
64073
|
authorization: `Bearer ${authToken}`
|
|
64074
64074
|
}
|
|
64075
64075
|
});
|
|
64076
64076
|
const wsLink = new GraphQLWsLink(
|
|
64077
64077
|
createClient({
|
|
64078
|
-
url: "wss://
|
|
64078
|
+
url: apiUrl.replace(/^https?:\/\//, (m) => m === "https://" ? "wss://" : "ws://"),
|
|
64079
64079
|
connectionParams: {
|
|
64080
64080
|
token: authToken
|
|
64081
64081
|
}
|
|
@@ -64170,14 +64170,14 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64170
64170
|
}
|
|
64171
64171
|
}
|
|
64172
64172
|
`);
|
|
64173
|
-
async function fetchUserData(authToken) {
|
|
64174
|
-
const client = await getClient(authToken);
|
|
64173
|
+
async function fetchUserData(authToken, apiUrl) {
|
|
64174
|
+
const client = await getClient(authToken, apiUrl);
|
|
64175
64175
|
const response = await client.query({
|
|
64176
64176
|
query: USER_DATA_QUERY
|
|
64177
64177
|
});
|
|
64178
64178
|
return response.data.currentUser;
|
|
64179
64179
|
}
|
|
64180
|
-
async function fetchUserToken(email, password) {
|
|
64180
|
+
async function fetchUserToken(email, password, apiUrl) {
|
|
64181
64181
|
const headers = new Headers();
|
|
64182
64182
|
headers.append("Content-Type", "application/json");
|
|
64183
64183
|
const graphql = JSON.stringify({
|
|
@@ -64199,10 +64199,7 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64199
64199
|
headers,
|
|
64200
64200
|
body: graphql
|
|
64201
64201
|
};
|
|
64202
|
-
const response = await fetch(
|
|
64203
|
-
"https://dek.appkit.net/v1/graphql",
|
|
64204
|
-
requestOptions
|
|
64205
|
-
);
|
|
64202
|
+
const response = await fetch(apiUrl, requestOptions);
|
|
64206
64203
|
const result = await response.json();
|
|
64207
64204
|
return result.data.login.token;
|
|
64208
64205
|
}
|
|
@@ -64216,12 +64213,12 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64216
64213
|
}
|
|
64217
64214
|
`);
|
|
64218
64215
|
let subscription = null;
|
|
64219
|
-
async function watchUser(authToken, cb2) {
|
|
64216
|
+
async function watchUser(authToken, apiUrl, cb2) {
|
|
64220
64217
|
if (subscription) {
|
|
64221
64218
|
subscription.unsubscribe();
|
|
64222
64219
|
subscription = null;
|
|
64223
64220
|
}
|
|
64224
|
-
const client = await getClient(authToken);
|
|
64221
|
+
const client = await getClient(authToken, apiUrl);
|
|
64225
64222
|
const response = client.subscribe({
|
|
64226
64223
|
query: USER_SUBSCRIPTION_QUERY
|
|
64227
64224
|
});
|
|
@@ -64238,11 +64235,11 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64238
64235
|
registerCollectionItem: () => {
|
|
64239
64236
|
}
|
|
64240
64237
|
};
|
|
64241
|
-
async function updateData(authToken, plugin) {
|
|
64238
|
+
async function updateData(authToken, apiUrl, plugin) {
|
|
64242
64239
|
updateStateLoading(true);
|
|
64243
64240
|
let userData;
|
|
64244
64241
|
if (authToken) {
|
|
64245
|
-
userData = await fetchUserData(authToken);
|
|
64242
|
+
userData = await fetchUserData(authToken, apiUrl);
|
|
64246
64243
|
} else {
|
|
64247
64244
|
userData = {
|
|
64248
64245
|
boards: [],
|
|
@@ -64271,13 +64268,13 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64271
64268
|
updateStateData(userData);
|
|
64272
64269
|
updateStateLoading(false);
|
|
64273
64270
|
}
|
|
64274
|
-
function watchForDataChanges(authToken, cb2) {
|
|
64271
|
+
function watchForDataChanges(authToken, apiUrl, cb2) {
|
|
64275
64272
|
if (authToken) {
|
|
64276
|
-
watchUser(authToken, cb2);
|
|
64273
|
+
watchUser(authToken, apiUrl, cb2);
|
|
64277
64274
|
}
|
|
64278
64275
|
}
|
|
64279
|
-
async function authorize(email, password) {
|
|
64280
|
-
return fetchUserToken(email, password);
|
|
64276
|
+
async function authorize(email, password, apiUrl) {
|
|
64277
|
+
return fetchUserToken(email, password, apiUrl);
|
|
64281
64278
|
}
|
|
64282
64279
|
const DEK_AUTH_TOKEN_KEY = "dek_auth_token";
|
|
64283
64280
|
const DEK_EMAIL_KEY = "dek_auth_email";
|
|
@@ -64313,7 +64310,8 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64313
64310
|
background: rgba(255, 255, 255, 0.12);
|
|
64314
64311
|
}
|
|
64315
64312
|
`;
|
|
64316
|
-
const
|
|
64313
|
+
const DEFAULT_API_URL$1 = "https://dek.appkit.net/v1/graphql";
|
|
64314
|
+
const LoginScreen = ({ onSuccess, apiUrl = DEFAULT_API_URL$1 }) => {
|
|
64317
64315
|
const [email, setEmail] = React$3.useState(() => localStorage.getItem(DEK_EMAIL_KEY) || "");
|
|
64318
64316
|
const [password, setPassword] = React$3.useState("");
|
|
64319
64317
|
const [error, setError] = React$3.useState("");
|
|
@@ -64330,7 +64328,7 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64330
64328
|
setError("");
|
|
64331
64329
|
setLoading(true);
|
|
64332
64330
|
try {
|
|
64333
|
-
const token = await authorize(email, password);
|
|
64331
|
+
const token = await authorize(email, password, apiUrl);
|
|
64334
64332
|
localStorage.setItem(DEK_AUTH_TOKEN_KEY, token);
|
|
64335
64333
|
localStorage.setItem(DEK_EMAIL_KEY, email);
|
|
64336
64334
|
onSuccess(token);
|
|
@@ -64408,8 +64406,8 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64408
64406
|
}
|
|
64409
64407
|
}
|
|
64410
64408
|
`);
|
|
64411
|
-
async function fetchUserPlugins(authToken) {
|
|
64412
|
-
const client = await getClient(authToken);
|
|
64409
|
+
async function fetchUserPlugins(authToken, apiUrl) {
|
|
64410
|
+
const client = await getClient(authToken, apiUrl);
|
|
64413
64411
|
const response = await client.query({
|
|
64414
64412
|
query: USER_PLUGIN_AND_INTEGRATIONS_QUERY
|
|
64415
64413
|
});
|
|
@@ -64417,7 +64415,7 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64417
64415
|
result.integrations.unshift({
|
|
64418
64416
|
key: "base",
|
|
64419
64417
|
pluginName: "base",
|
|
64420
|
-
pluginVersion: "0.
|
|
64418
|
+
pluginVersion: "0.57.0",
|
|
64421
64419
|
pluginConfig: []
|
|
64422
64420
|
});
|
|
64423
64421
|
return result;
|
|
@@ -64486,7 +64484,7 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
64486
64484
|
};
|
|
64487
64485
|
const About = () => {
|
|
64488
64486
|
return /* @__PURE__ */ jsxRuntimeModule.jsxs(g0, { padding: 20, direction: "vert", children: [
|
|
64489
|
-
/* @__PURE__ */ jsxRuntimeModule.jsx(eq1, { children: `Dek ${"0.
|
|
64487
|
+
/* @__PURE__ */ jsxRuntimeModule.jsx(eq1, { children: `Dek ${"0.57.0"}` }),
|
|
64490
64488
|
/* @__PURE__ */ jsxRuntimeModule.jsx(o4, { children: "From Appkit" })
|
|
64491
64489
|
] });
|
|
64492
64490
|
};
|
|
@@ -96448,19 +96446,19 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
96448
96446
|
}
|
|
96449
96447
|
return results;
|
|
96450
96448
|
}
|
|
96451
|
-
async function updatePlugins(authToken) {
|
|
96449
|
+
async function updatePlugins(authToken, apiUrl) {
|
|
96452
96450
|
updateStateLoading(true);
|
|
96453
96451
|
await unloadAllPlugins();
|
|
96454
96452
|
let integrationsAndPlugins;
|
|
96455
96453
|
if (authToken) {
|
|
96456
|
-
integrationsAndPlugins = await fetchUserPlugins(authToken);
|
|
96454
|
+
integrationsAndPlugins = await fetchUserPlugins(authToken, apiUrl);
|
|
96457
96455
|
} else {
|
|
96458
96456
|
integrationsAndPlugins = {
|
|
96459
96457
|
integrations: [
|
|
96460
96458
|
{
|
|
96461
96459
|
key: "base",
|
|
96462
96460
|
pluginName: "base",
|
|
96463
|
-
pluginVersion: "0.
|
|
96461
|
+
pluginVersion: "0.57.0",
|
|
96464
96462
|
pluginConfig: []
|
|
96465
96463
|
}
|
|
96466
96464
|
],
|
|
@@ -96506,21 +96504,21 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
96506
96504
|
localPluginFactory = void 0;
|
|
96507
96505
|
updateStatePlugins(getAllPluginFactories(), getAllIntegrationInstances());
|
|
96508
96506
|
}
|
|
96509
|
-
function useUserConfigLoader(authToken, plugin, pluginConfig) {
|
|
96507
|
+
function useUserConfigLoader(authToken, apiUrl, plugin, pluginConfig) {
|
|
96510
96508
|
const userConfig = useSnapshot(state);
|
|
96511
96509
|
const userChanged = React$3.useCallback(async () => {
|
|
96512
96510
|
console.log("### USER CHANGED");
|
|
96513
|
-
await updatePlugins(authToken);
|
|
96514
|
-
await updateData(authToken, plugin);
|
|
96515
|
-
}, [authToken, plugin]);
|
|
96511
|
+
await updatePlugins(authToken, apiUrl);
|
|
96512
|
+
await updateData(authToken, apiUrl, plugin);
|
|
96513
|
+
}, [authToken, apiUrl, plugin]);
|
|
96516
96514
|
React$3.useEffect(() => {
|
|
96517
96515
|
const update = async () => {
|
|
96518
|
-
await updatePlugins(authToken);
|
|
96516
|
+
await updatePlugins(authToken, apiUrl);
|
|
96519
96517
|
if (plugin) {
|
|
96520
96518
|
await updateLocalPlugin(plugin, pluginConfig);
|
|
96521
96519
|
}
|
|
96522
|
-
await updateData(authToken, plugin);
|
|
96523
|
-
await watchForDataChanges(authToken, userChanged);
|
|
96520
|
+
await updateData(authToken, apiUrl, plugin);
|
|
96521
|
+
await watchForDataChanges(authToken, apiUrl, userChanged);
|
|
96524
96522
|
};
|
|
96525
96523
|
update();
|
|
96526
96524
|
return () => {
|
|
@@ -96565,15 +96563,17 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
96565
96563
|
children
|
|
96566
96564
|
] });
|
|
96567
96565
|
};
|
|
96566
|
+
const DEFAULT_API_URL = "https://dek.appkit.net/v1/graphql";
|
|
96568
96567
|
const transitionDelay = 0;
|
|
96569
96568
|
const BoardProvider = ({
|
|
96570
96569
|
authToken,
|
|
96570
|
+
apiUrl = DEFAULT_API_URL,
|
|
96571
96571
|
plugin,
|
|
96572
96572
|
pluginConfig,
|
|
96573
96573
|
zoom,
|
|
96574
96574
|
children
|
|
96575
96575
|
}) => {
|
|
96576
|
-
const config2 = useUserConfigLoader(authToken, plugin, pluginConfig);
|
|
96576
|
+
const config2 = useUserConfigLoader(authToken, apiUrl, plugin, pluginConfig);
|
|
96577
96577
|
console.log("### LOADED", config2);
|
|
96578
96578
|
return /* @__PURE__ */ jsxRuntimeModule.jsx(UserConfigContext.Provider, { value: config2, children: /* @__PURE__ */ jsxRuntimeModule.jsx(BoardStylesProvider, { zoom, transitionDelay, children }) });
|
|
96579
96579
|
};
|
|
@@ -96694,15 +96694,15 @@ Arguments: ` + Array.prototype.slice.call(n2).join("") + `
|
|
|
96694
96694
|
}
|
|
96695
96695
|
return /* @__PURE__ */ jsxRuntimeModule.jsx("div", { "aria-label": "component", children: /* @__PURE__ */ jsxRuntimeModule.jsx(ErrorBoundary, { children: component || null }) });
|
|
96696
96696
|
};
|
|
96697
|
-
function useAuthorization(email, password) {
|
|
96697
|
+
function useAuthorization(email, password, apiUrl) {
|
|
96698
96698
|
const [token, setToken] = React$3.useState("");
|
|
96699
96699
|
React$3.useEffect(() => {
|
|
96700
96700
|
const authorizeUser = async () => {
|
|
96701
|
-
const token2 = await authorize(email, password);
|
|
96701
|
+
const token2 = await authorize(email, password, apiUrl);
|
|
96702
96702
|
setToken(token2);
|
|
96703
96703
|
};
|
|
96704
96704
|
authorizeUser();
|
|
96705
|
-
}, [email, password]);
|
|
96705
|
+
}, [email, password, apiUrl]);
|
|
96706
96706
|
return token;
|
|
96707
96707
|
}
|
|
96708
96708
|
async function loadCustomPlugin(code) {
|
package/dist/lib/data.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DekPluginFactory } from '@appkit/dek-plugin';
|
|
2
|
-
export declare function updateData(authToken: string, plugin?: DekPluginFactory): Promise<void>;
|
|
3
|
-
export declare function watchForDataChanges(authToken: string, cb: () => void): void;
|
|
4
|
-
export declare function authorize(email: string, password: string): Promise<string>;
|
|
2
|
+
export declare function updateData(authToken: string, apiUrl: string, plugin?: DekPluginFactory): Promise<void>;
|
|
3
|
+
export declare function watchForDataChanges(authToken: string, apiUrl: string, cb: () => void): void;
|
|
4
|
+
export declare function authorize(email: string, password: string, apiUrl: string): Promise<string>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function useAuthorization(email: string, password: string): string;
|
|
1
|
+
declare function useAuthorization(email: string, password: string, apiUrl: string): string;
|
|
2
2
|
export default useAuthorization;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DekPluginFactory } from '@appkit/dek-plugin';
|
|
2
2
|
import { LibraryState } from '../state';
|
|
3
|
-
declare function useUserConfigLoader(authToken: string, plugin?: DekPluginFactory, pluginConfig?: any): Readonly<LibraryState>;
|
|
3
|
+
declare function useUserConfigLoader(authToken: string, apiUrl: string, plugin?: DekPluginFactory, pluginConfig?: any): Readonly<LibraryState>;
|
|
4
4
|
export default useUserConfigLoader;
|
package/dist/lib/plugins.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DekPluginFactory } from '@appkit/dek-plugin';
|
|
2
|
-
export declare function updatePlugins(authToken: string): Promise<void>;
|
|
2
|
+
export declare function updatePlugins(authToken: string, apiUrl: string): Promise<void>;
|
|
3
3
|
export declare function unloadPlugins(): Promise<void>;
|
|
4
4
|
export declare function updateLocalPlugin(plugin: DekPluginFactory, pluginConfig: any): Promise<void>;
|
|
5
5
|
export declare function unloadLocalPlugin(): Promise<void>;
|