@webbycrown/webbycommerce 1.0.1 → 1.1.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.
@@ -19,23 +19,63 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
19
19
  });
20
20
  };
21
21
  const PLUGIN_ID = "webbycommerce";
22
+ const provideCheckUserHasPermissions = () => {
23
+ const defaultImpl = async () => true;
24
+ if (typeof window !== "undefined") {
25
+ if (!window.checkUserHasPermissions) {
26
+ window.checkUserHasPermissions = defaultImpl;
27
+ }
28
+ }
29
+ if (typeof globalThis !== "undefined") {
30
+ if (!globalThis.checkUserHasPermissions) {
31
+ globalThis.checkUserHasPermissions = defaultImpl;
32
+ }
33
+ }
34
+ if (typeof global !== "undefined") {
35
+ if (!global.checkUserHasPermissions) {
36
+ global.checkUserHasPermissions = defaultImpl;
37
+ }
38
+ }
39
+ };
40
+ provideCheckUserHasPermissions();
22
41
  const Initializer = () => {
23
42
  const hasInitialized = React.useRef(false);
24
43
  React.useEffect(() => {
25
44
  if (!hasInitialized.current) {
26
45
  hasInitialized.current = true;
46
+ provideCheckUserHasPermissions();
47
+ try {
48
+ const checkInterval = setInterval(() => {
49
+ if (window.strapi?.app && typeof window.strapi.app.checkUserHasPermissions === "undefined") {
50
+ window.strapi.app.checkUserHasPermissions = async () => true;
51
+ clearInterval(checkInterval);
52
+ }
53
+ }, 100);
54
+ setTimeout(() => clearInterval(checkInterval), 5e3);
55
+ } catch (error) {
56
+ }
27
57
  }
28
58
  }, []);
29
59
  return null;
30
60
  };
31
61
  const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.ShoppingCart, {});
62
+ if (typeof globalThis !== "undefined") {
63
+ if (!globalThis.checkUserHasPermissions) {
64
+ globalThis.checkUserHasPermissions = async () => true;
65
+ }
66
+ }
32
67
  const index = {
33
68
  register(app) {
69
+ if (app && typeof app.checkUserHasPermissions === "undefined") {
70
+ app.checkUserHasPermissions = async () => true;
71
+ }
34
72
  app.registerPlugin({
35
73
  id: PLUGIN_ID,
36
74
  initializer: Initializer,
37
- isReady: true,
38
- name: "Strapi Advanced Ecommerce"
75
+ // Use a function for isReady to ensure proper initialization order
76
+ // This helps prevent conflicts with Strapi's core (tours, etc.)
77
+ isReady: () => true,
78
+ name: "WebbyCommerce"
39
79
  });
40
80
  app.addSettingsLink(
41
81
  {
@@ -53,25 +93,28 @@ const index = {
53
93
  defaultMessage: "Configure"
54
94
  },
55
95
  to: `${PLUGIN_ID}`,
56
- Component: () => Promise.resolve().then(() => require("./Settings-FFmXhBSE.js"))
96
+ Component: () => Promise.resolve().then(() => require("./Settings-C3yoIgMy.js"))
57
97
  }
58
98
  );
59
99
  },
60
100
  bootstrap(app) {
101
+ if (app && typeof app.checkUserHasPermissions === "undefined") {
102
+ app.checkUserHasPermissions = async () => true;
103
+ }
61
104
  },
62
105
  async registerTrads({ locales }) {
63
106
  return Promise.all(
64
107
  locales.map(async (locale) => {
65
108
  if (locale === "en") {
66
109
  try {
67
- const { default: data } = await Promise.resolve().then(() => require("./en-CwvqDxF2.js"));
110
+ const { default: data } = await Promise.resolve().then(() => require("./en-DIeqB4AB.js"));
68
111
  return { data, locale };
69
112
  } catch {
70
113
  return { data: {}, locale };
71
114
  }
72
115
  }
73
116
  try {
74
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-CwvqDxF2.js")) }), `./translations/${locale}.json`, 3);
117
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-DIeqB4AB.js")) }), `./translations/${locale}.json`, 3);
75
118
  return { data, locale };
76
119
  } catch {
77
120
  return { data: {}, locale };
@@ -18,23 +18,63 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
18
18
  });
19
19
  };
20
20
  const PLUGIN_ID = "webbycommerce";
21
+ const provideCheckUserHasPermissions = () => {
22
+ const defaultImpl = async () => true;
23
+ if (typeof window !== "undefined") {
24
+ if (!window.checkUserHasPermissions) {
25
+ window.checkUserHasPermissions = defaultImpl;
26
+ }
27
+ }
28
+ if (typeof globalThis !== "undefined") {
29
+ if (!globalThis.checkUserHasPermissions) {
30
+ globalThis.checkUserHasPermissions = defaultImpl;
31
+ }
32
+ }
33
+ if (typeof global !== "undefined") {
34
+ if (!global.checkUserHasPermissions) {
35
+ global.checkUserHasPermissions = defaultImpl;
36
+ }
37
+ }
38
+ };
39
+ provideCheckUserHasPermissions();
21
40
  const Initializer = () => {
22
41
  const hasInitialized = useRef(false);
23
42
  useEffect(() => {
24
43
  if (!hasInitialized.current) {
25
44
  hasInitialized.current = true;
45
+ provideCheckUserHasPermissions();
46
+ try {
47
+ const checkInterval = setInterval(() => {
48
+ if (window.strapi?.app && typeof window.strapi.app.checkUserHasPermissions === "undefined") {
49
+ window.strapi.app.checkUserHasPermissions = async () => true;
50
+ clearInterval(checkInterval);
51
+ }
52
+ }, 100);
53
+ setTimeout(() => clearInterval(checkInterval), 5e3);
54
+ } catch (error) {
55
+ }
26
56
  }
27
57
  }, []);
28
58
  return null;
29
59
  };
30
60
  const PluginIcon = () => /* @__PURE__ */ jsx(ShoppingCart, {});
61
+ if (typeof globalThis !== "undefined") {
62
+ if (!globalThis.checkUserHasPermissions) {
63
+ globalThis.checkUserHasPermissions = async () => true;
64
+ }
65
+ }
31
66
  const index = {
32
67
  register(app) {
68
+ if (app && typeof app.checkUserHasPermissions === "undefined") {
69
+ app.checkUserHasPermissions = async () => true;
70
+ }
33
71
  app.registerPlugin({
34
72
  id: PLUGIN_ID,
35
73
  initializer: Initializer,
36
- isReady: true,
37
- name: "Strapi Advanced Ecommerce"
74
+ // Use a function for isReady to ensure proper initialization order
75
+ // This helps prevent conflicts with Strapi's core (tours, etc.)
76
+ isReady: () => true,
77
+ name: "WebbyCommerce"
38
78
  });
39
79
  app.addSettingsLink(
40
80
  {
@@ -52,25 +92,28 @@ const index = {
52
92
  defaultMessage: "Configure"
53
93
  },
54
94
  to: `${PLUGIN_ID}`,
55
- Component: () => import("./Settings-DpLvkyId.mjs")
95
+ Component: () => import("./Settings-BWuSG1Bc.mjs")
56
96
  }
57
97
  );
58
98
  },
59
99
  bootstrap(app) {
100
+ if (app && typeof app.checkUserHasPermissions === "undefined") {
101
+ app.checkUserHasPermissions = async () => true;
102
+ }
60
103
  },
61
104
  async registerTrads({ locales }) {
62
105
  return Promise.all(
63
106
  locales.map(async (locale) => {
64
107
  if (locale === "en") {
65
108
  try {
66
- const { default: data } = await import("./en-BsbZxjAR.mjs");
109
+ const { default: data } = await import("./en-7gtFcumM.mjs");
67
110
  return { data, locale };
68
111
  } catch {
69
112
  return { data: {}, locale };
70
113
  }
71
114
  }
72
115
  try {
73
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-BsbZxjAR.mjs") }), `./translations/${locale}.json`, 3);
116
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-7gtFcumM.mjs") }), `./translations/${locale}.json`, 3);
74
117
  return { data, locale };
75
118
  } catch {
76
119
  return { data: {}, locale };
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-DaVBMS-M.js");
2
+ const index = require("../_chunks/index-CtxKh-aM.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-rT-5a8Cs.mjs";
1
+ import { i } from "../_chunks/index-DIGoLhGE.mjs";
2
2
  export {
3
3
  i as default
4
4
  };