tienjs-chartbrew-plugin-strapi 0.1.0 → 0.1.2

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.
@@ -4,8 +4,8 @@ import { Link, Routes, Route } from "react-router-dom";
4
4
  import { Layouts, Page } from "@strapi/strapi/admin";
5
5
  import { LinkButton, Loader, Box, Flex, Typography, SingleSelect, SingleSelectOption, EmptyStateLayout, Alert, Link as Link$1, Checkbox, Grid, Button, Divider, Combobox, ComboboxOption } from "@strapi/design-system";
6
6
  import { ChartCircle, Plus, ExternalLink, ArrowLeft } from "@strapi/icons";
7
- import { P as PLUGIN_ID } from "./index-CXvgiYYO.mjs";
8
- import { g as getSettings, s as setSettings, i as instance } from "./store-CES_iNgI.mjs";
7
+ import { P as PLUGIN_ID } from "./index-Cjgwr2aI.mjs";
8
+ import { g as getSettings, s as setSettings, i as instance } from "./store-CDGc86NS.mjs";
9
9
  async function login() {
10
10
  const { host, token } = await getSettings();
11
11
  return fetch(`${host}/user/relog`, {
@@ -6,8 +6,8 @@ const reactRouterDom = require("react-router-dom");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
- const index = require("./index-Bk9ujIXz.js");
10
- const store = require("./store-B-zkLoDr.js");
9
+ const index = require("./index-D2poyYLZ.js");
10
+ const store = require("./store-DrVugT1Q.js");
11
11
  async function login() {
12
12
  const { host, token } = await store.getSettings();
13
13
  return fetch(`${host}/user/relog`, {
@@ -4,8 +4,8 @@ import { LinkButton, Box, Typography, Tabs, Field, Button, Link, Flex, Alert } f
4
4
  import { useNotification, Layouts } from "@strapi/strapi/admin";
5
5
  import { ExternalLink, Magic, Check, Cross, ChevronRight } from "@strapi/icons";
6
6
  import { Link as Link$1 } from "react-router-dom";
7
- import { P as PLUGIN_ID } from "./index-CXvgiYYO.mjs";
8
- import { g as getSettings, s as setSettings } from "./store-CES_iNgI.mjs";
7
+ import { P as PLUGIN_ID } from "./index-Cjgwr2aI.mjs";
8
+ import { g as getSettings, s as setSettings } from "./store-CDGc86NS.mjs";
9
9
  const defaultHost = "https://api.chartbrew.com";
10
10
  const defaultClientHost = "https://app.chartbrew.com";
11
11
  const strapiHostEnv = process.env.STRAPI_ADMIN_BACKEND_URL;
@@ -6,8 +6,8 @@ const designSystem = require("@strapi/design-system");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const icons = require("@strapi/icons");
8
8
  const reactRouterDom = require("react-router-dom");
9
- const index = require("./index-Bk9ujIXz.js");
10
- const store = require("./store-B-zkLoDr.js");
9
+ const index = require("./index-D2poyYLZ.js");
10
+ const store = require("./store-DrVugT1Q.js");
11
11
  const defaultHost = "https://api.chartbrew.com";
12
12
  const defaultClientHost = "https://app.chartbrew.com";
13
13
  const strapiHostEnv = process.env.STRAPI_ADMIN_BACKEND_URL;
@@ -37,7 +37,7 @@ const index = {
37
37
  defaultMessage: "Chartbrew"
38
38
  },
39
39
  Component: async () => {
40
- const { App } = await import("./App-Be1FtvNK.mjs");
40
+ const { App } = await import("./App-BCYezLLX.mjs");
41
41
  return App;
42
42
  }
43
43
  });
@@ -58,7 +58,7 @@ const index = {
58
58
  id: "settings",
59
59
  to: `/settings/${PLUGIN_ID}`,
60
60
  Component: async () => {
61
- const { Setup } = await import("./Setup-C_xPro4U.mjs");
61
+ const { Setup } = await import("./Setup-CFHScO45.mjs");
62
62
  return Setup;
63
63
  }
64
64
  }
@@ -38,7 +38,7 @@ const index = {
38
38
  defaultMessage: "Chartbrew"
39
39
  },
40
40
  Component: async () => {
41
- const { App } = await Promise.resolve().then(() => require("./App-ngsyON1R.js"));
41
+ const { App } = await Promise.resolve().then(() => require("./App-Dqp66kas.js"));
42
42
  return App;
43
43
  }
44
44
  });
@@ -59,7 +59,7 @@ const index = {
59
59
  id: "settings",
60
60
  to: `/settings/${PLUGIN_ID}`,
61
61
  Component: async () => {
62
- const { Setup } = await Promise.resolve().then(() => require("./Setup-CL3F4zOi.js"));
62
+ const { Setup } = await Promise.resolve().then(() => require("./Setup-D_mIow3G.js"));
63
63
  return Setup;
64
64
  }
65
65
  }
@@ -1,4 +1,5 @@
1
- import { P as PLUGIN_ID } from "./index-CXvgiYYO.mjs";
1
+ import Cookies from "js-cookie";
2
+ import { P as PLUGIN_ID } from "./index-Cjgwr2aI.mjs";
2
3
  function bind(fn, thisArg) {
3
4
  return function wrap() {
4
5
  return fn.apply(thisArg, arguments);
@@ -310,15 +311,15 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
310
311
  if (setImmediateSupported) {
311
312
  return setImmediate;
312
313
  }
313
- return postMessageSupported ? ((token2, callbacks) => {
314
+ return postMessageSupported ? ((token, callbacks) => {
314
315
  _global.addEventListener("message", ({ source, data }) => {
315
- if (source === _global && data === token2) {
316
+ if (source === _global && data === token) {
316
317
  callbacks.length && callbacks.shift()();
317
318
  }
318
319
  }, false);
319
320
  return (cb) => {
320
321
  callbacks.push(cb);
321
- _global.postMessage(token2, "*");
322
+ _global.postMessage(token, "*");
322
323
  };
323
324
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
324
325
  })(
@@ -472,9 +473,9 @@ function removeBrackets(key) {
472
473
  }
473
474
  function renderKey(path, key, dots) {
474
475
  if (!path) return key;
475
- return path.concat(key).map(function each(token2, i) {
476
- token2 = removeBrackets(token2);
477
- return !dots && i ? "[" + token2 + "]" : token2;
476
+ return path.concat(key).map(function each(token, i) {
477
+ token = removeBrackets(token);
478
+ return !dots && i ? "[" + token + "]" : token;
478
479
  }).join(dots ? "." : "");
479
480
  }
480
481
  function isFlatArray(arr) {
@@ -2252,32 +2253,32 @@ let CancelToken$1 = class CancelToken {
2252
2253
  this.promise = new Promise(function promiseExecutor(resolve) {
2253
2254
  resolvePromise = resolve;
2254
2255
  });
2255
- const token2 = this;
2256
+ const token = this;
2256
2257
  this.promise.then((cancel) => {
2257
- if (!token2._listeners) return;
2258
- let i = token2._listeners.length;
2258
+ if (!token._listeners) return;
2259
+ let i = token._listeners.length;
2259
2260
  while (i-- > 0) {
2260
- token2._listeners[i](cancel);
2261
+ token._listeners[i](cancel);
2261
2262
  }
2262
- token2._listeners = null;
2263
+ token._listeners = null;
2263
2264
  });
2264
2265
  this.promise.then = (onfulfilled) => {
2265
2266
  let _resolve;
2266
2267
  const promise = new Promise((resolve) => {
2267
- token2.subscribe(resolve);
2268
+ token.subscribe(resolve);
2268
2269
  _resolve = resolve;
2269
2270
  }).then(onfulfilled);
2270
2271
  promise.cancel = function reject() {
2271
- token2.unsubscribe(_resolve);
2272
+ token.unsubscribe(_resolve);
2272
2273
  };
2273
2274
  return promise;
2274
2275
  };
2275
2276
  executor(function cancel(message, config, request) {
2276
- if (token2.reason) {
2277
+ if (token.reason) {
2277
2278
  return;
2278
2279
  }
2279
- token2.reason = new CanceledError$1(message, config, request);
2280
- resolvePromise(token2.reason);
2280
+ token.reason = new CanceledError$1(message, config, request);
2281
+ resolvePromise(token.reason);
2281
2282
  });
2282
2283
  }
2283
2284
  /**
@@ -2329,11 +2330,11 @@ let CancelToken$1 = class CancelToken {
2329
2330
  */
2330
2331
  static source() {
2331
2332
  let cancel;
2332
- const token2 = new CancelToken(function executor(c) {
2333
+ const token = new CancelToken(function executor(c) {
2333
2334
  cancel = c;
2334
2335
  });
2335
2336
  return {
2336
- token: token2,
2337
+ token,
2337
2338
  cancel
2338
2339
  };
2339
2340
  }
@@ -2462,15 +2463,19 @@ const {
2462
2463
  getAdapter,
2463
2464
  mergeConfig
2464
2465
  } = axios;
2465
- let token = localStorage.getItem("jwtToken");
2466
- if (token) {
2467
- token = token.replaceAll('"', "");
2468
- }
2469
2466
  const instance = axios.create({
2470
2467
  baseURL: process.env.STRAPI_ADMIN_BACKEND_URL
2471
2468
  });
2472
2469
  instance.interceptors.request.use(
2473
2470
  async (config) => {
2471
+ let tokenCookie = Cookies.get("jwtToken");
2472
+ let tokenLocalStorage = localStorage.getItem("jwtToken");
2473
+ let token = tokenLocalStorage || tokenCookie;
2474
+ if (token) {
2475
+ token = token.replaceAll('"', "");
2476
+ } else {
2477
+ token = "token-undefined";
2478
+ }
2474
2479
  config.headers = {
2475
2480
  Authorization: `Bearer ${token}`,
2476
2481
  Accept: "application/json",
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
- const index = require("./index-Bk9ujIXz.js");
2
+ const Cookies = require("js-cookie");
3
+ const index = require("./index-D2poyYLZ.js");
4
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
5
+ const Cookies__default = /* @__PURE__ */ _interopDefault(Cookies);
3
6
  function bind(fn, thisArg) {
4
7
  return function wrap() {
5
8
  return fn.apply(thisArg, arguments);
@@ -311,15 +314,15 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
311
314
  if (setImmediateSupported) {
312
315
  return setImmediate;
313
316
  }
314
- return postMessageSupported ? ((token2, callbacks) => {
317
+ return postMessageSupported ? ((token, callbacks) => {
315
318
  _global.addEventListener("message", ({ source, data }) => {
316
- if (source === _global && data === token2) {
319
+ if (source === _global && data === token) {
317
320
  callbacks.length && callbacks.shift()();
318
321
  }
319
322
  }, false);
320
323
  return (cb) => {
321
324
  callbacks.push(cb);
322
- _global.postMessage(token2, "*");
325
+ _global.postMessage(token, "*");
323
326
  };
324
327
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
325
328
  })(
@@ -473,9 +476,9 @@ function removeBrackets(key) {
473
476
  }
474
477
  function renderKey(path, key, dots) {
475
478
  if (!path) return key;
476
- return path.concat(key).map(function each(token2, i) {
477
- token2 = removeBrackets(token2);
478
- return !dots && i ? "[" + token2 + "]" : token2;
479
+ return path.concat(key).map(function each(token, i) {
480
+ token = removeBrackets(token);
481
+ return !dots && i ? "[" + token + "]" : token;
479
482
  }).join(dots ? "." : "");
480
483
  }
481
484
  function isFlatArray(arr) {
@@ -2253,32 +2256,32 @@ let CancelToken$1 = class CancelToken {
2253
2256
  this.promise = new Promise(function promiseExecutor(resolve) {
2254
2257
  resolvePromise = resolve;
2255
2258
  });
2256
- const token2 = this;
2259
+ const token = this;
2257
2260
  this.promise.then((cancel) => {
2258
- if (!token2._listeners) return;
2259
- let i = token2._listeners.length;
2261
+ if (!token._listeners) return;
2262
+ let i = token._listeners.length;
2260
2263
  while (i-- > 0) {
2261
- token2._listeners[i](cancel);
2264
+ token._listeners[i](cancel);
2262
2265
  }
2263
- token2._listeners = null;
2266
+ token._listeners = null;
2264
2267
  });
2265
2268
  this.promise.then = (onfulfilled) => {
2266
2269
  let _resolve;
2267
2270
  const promise = new Promise((resolve) => {
2268
- token2.subscribe(resolve);
2271
+ token.subscribe(resolve);
2269
2272
  _resolve = resolve;
2270
2273
  }).then(onfulfilled);
2271
2274
  promise.cancel = function reject() {
2272
- token2.unsubscribe(_resolve);
2275
+ token.unsubscribe(_resolve);
2273
2276
  };
2274
2277
  return promise;
2275
2278
  };
2276
2279
  executor(function cancel(message, config, request) {
2277
- if (token2.reason) {
2280
+ if (token.reason) {
2278
2281
  return;
2279
2282
  }
2280
- token2.reason = new CanceledError$1(message, config, request);
2281
- resolvePromise(token2.reason);
2283
+ token.reason = new CanceledError$1(message, config, request);
2284
+ resolvePromise(token.reason);
2282
2285
  });
2283
2286
  }
2284
2287
  /**
@@ -2330,11 +2333,11 @@ let CancelToken$1 = class CancelToken {
2330
2333
  */
2331
2334
  static source() {
2332
2335
  let cancel;
2333
- const token2 = new CancelToken(function executor(c) {
2336
+ const token = new CancelToken(function executor(c) {
2334
2337
  cancel = c;
2335
2338
  });
2336
2339
  return {
2337
- token: token2,
2340
+ token,
2338
2341
  cancel
2339
2342
  };
2340
2343
  }
@@ -2463,15 +2466,19 @@ const {
2463
2466
  getAdapter,
2464
2467
  mergeConfig
2465
2468
  } = axios;
2466
- let token = localStorage.getItem("jwtToken");
2467
- if (token) {
2468
- token = token.replaceAll('"', "");
2469
- }
2470
2469
  const instance = axios.create({
2471
2470
  baseURL: process.env.STRAPI_ADMIN_BACKEND_URL
2472
2471
  });
2473
2472
  instance.interceptors.request.use(
2474
2473
  async (config) => {
2474
+ let tokenCookie = Cookies__default.default.get("jwtToken");
2475
+ let tokenLocalStorage = localStorage.getItem("jwtToken");
2476
+ let token = tokenLocalStorage || tokenCookie;
2477
+ if (token) {
2478
+ token = token.replaceAll('"', "");
2479
+ } else {
2480
+ token = "token-undefined";
2481
+ }
2475
2482
  config.headers = {
2476
2483
  Authorization: `Bearer ${token}`,
2477
2484
  Accept: "application/json",
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-Bk9ujIXz.js");
2
+ const index = require("../_chunks/index-D2poyYLZ.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-CXvgiYYO.mjs";
1
+ import { i } from "../_chunks/index-Cjgwr2aI.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tienjs-chartbrew-plugin-strapi",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Chartbrew brings data visualization to your Strapi dashboard",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/chartbrew/strapi-plugin-chartbrew#readme",