@creopse/react 0.0.5 → 0.0.7

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.cjs CHANGED
@@ -12147,6 +12147,23 @@ hooks.defineLocale("fr", {
12147
12147
  // The week that contains Jan 4th is the first week of the year.
12148
12148
  }
12149
12149
  });
12150
+ var ItemCreatorType;
12151
+ (function(ItemCreatorType2) {
12152
+ ItemCreatorType2["USER"] = "user";
12153
+ ItemCreatorType2["ADMIN"] = "admin";
12154
+ ItemCreatorType2["SYSTEM"] = "system";
12155
+ })(ItemCreatorType || (ItemCreatorType = {}));
12156
+ var AccessScope;
12157
+ (function(AccessScope2) {
12158
+ AccessScope2["INTERNAL"] = "internal";
12159
+ AccessScope2["USER_EDITABLE"] = "user-editable";
12160
+ })(AccessScope || (AccessScope = {}));
12161
+ var Intent;
12162
+ (function(Intent2) {
12163
+ Intent2["EDITORIAL_CONTENT"] = "editorial-content";
12164
+ Intent2["USER_DATA"] = "user-data";
12165
+ Intent2["SYSTEM_DATA"] = "system-data";
12166
+ })(Intent || (Intent = {}));
12150
12167
  var AccountStatus;
12151
12168
  (function(AccountStatus2) {
12152
12169
  AccountStatus2[AccountStatus2["DISABLED"] = 0] = "DISABLED";
@@ -12178,6 +12195,11 @@ var ContentType;
12178
12195
  ContentType2["NEWS_ARTICLE"] = "news-article";
12179
12196
  ContentType2["CONTENT_MODEL"] = "content-model";
12180
12197
  })(ContentType || (ContentType = {}));
12198
+ var EditorMessageType;
12199
+ (function(EditorMessageType2) {
12200
+ EditorMessageType2["RELOAD"] = "reload";
12201
+ EditorMessageType2["RELOAD_COMPLETE"] = "reload-complete";
12202
+ })(EditorMessageType || (EditorMessageType = {}));
12181
12203
  var MenuItemTargetType;
12182
12204
  (function(MenuItemTargetType2) {
12183
12205
  MenuItemTargetType2["EXTERNAL_LINK"] = "external-link";
@@ -12245,6 +12267,25 @@ const RootContainer = ({
12245
12267
  }, 1e3);
12246
12268
  return () => clearTimeout(timeout);
12247
12269
  }, [page, sections]);
12270
+ React.useEffect(() => {
12271
+ const handleMessage = (event) => {
12272
+ if (event.data?.type === EditorMessageType.RELOAD) {
12273
+ sessionStorage.setItem("shouldNotifyReload", "1");
12274
+ sessionStorage.setItem("replyOrigin", event.origin);
12275
+ window.location.reload();
12276
+ }
12277
+ };
12278
+ window.addEventListener("message", handleMessage);
12279
+ if (sessionStorage.getItem("shouldNotifyReload") === "1") {
12280
+ const origin = sessionStorage.getItem("replyOrigin") || "*";
12281
+ window.parent.postMessage({ type: EditorMessageType.RELOAD_COMPLETE }, origin);
12282
+ sessionStorage.removeItem("shouldNotifyReload");
12283
+ sessionStorage.removeItem("replyOrigin");
12284
+ }
12285
+ return () => {
12286
+ window.removeEventListener("message", handleMessage);
12287
+ };
12288
+ }, []);
12248
12289
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: sections.map((section, i) => {
12249
12290
  const Component = components[section.name];
12250
12291
  if (!Component) return null;
package/dist/index.js CHANGED
@@ -12145,6 +12145,23 @@ var CreopseReactToolkit = function(exports, React2, reactDom) {
12145
12145
  // The week that contains Jan 4th is the first week of the year.
12146
12146
  }
12147
12147
  });
12148
+ var ItemCreatorType;
12149
+ (function(ItemCreatorType2) {
12150
+ ItemCreatorType2["USER"] = "user";
12151
+ ItemCreatorType2["ADMIN"] = "admin";
12152
+ ItemCreatorType2["SYSTEM"] = "system";
12153
+ })(ItemCreatorType || (ItemCreatorType = {}));
12154
+ var AccessScope;
12155
+ (function(AccessScope2) {
12156
+ AccessScope2["INTERNAL"] = "internal";
12157
+ AccessScope2["USER_EDITABLE"] = "user-editable";
12158
+ })(AccessScope || (AccessScope = {}));
12159
+ var Intent;
12160
+ (function(Intent2) {
12161
+ Intent2["EDITORIAL_CONTENT"] = "editorial-content";
12162
+ Intent2["USER_DATA"] = "user-data";
12163
+ Intent2["SYSTEM_DATA"] = "system-data";
12164
+ })(Intent || (Intent = {}));
12148
12165
  var AccountStatus;
12149
12166
  (function(AccountStatus2) {
12150
12167
  AccountStatus2[AccountStatus2["DISABLED"] = 0] = "DISABLED";
@@ -12176,6 +12193,11 @@ var CreopseReactToolkit = function(exports, React2, reactDom) {
12176
12193
  ContentType2["NEWS_ARTICLE"] = "news-article";
12177
12194
  ContentType2["CONTENT_MODEL"] = "content-model";
12178
12195
  })(ContentType || (ContentType = {}));
12196
+ var EditorMessageType;
12197
+ (function(EditorMessageType2) {
12198
+ EditorMessageType2["RELOAD"] = "reload";
12199
+ EditorMessageType2["RELOAD_COMPLETE"] = "reload-complete";
12200
+ })(EditorMessageType || (EditorMessageType = {}));
12179
12201
  var MenuItemTargetType;
12180
12202
  (function(MenuItemTargetType2) {
12181
12203
  MenuItemTargetType2["EXTERNAL_LINK"] = "external-link";
@@ -12243,6 +12265,25 @@ var CreopseReactToolkit = function(exports, React2, reactDom) {
12243
12265
  }, 1e3);
12244
12266
  return () => clearTimeout(timeout);
12245
12267
  }, [page, sections]);
12268
+ React2.useEffect(() => {
12269
+ const handleMessage = (event) => {
12270
+ if (event.data?.type === EditorMessageType.RELOAD) {
12271
+ sessionStorage.setItem("shouldNotifyReload", "1");
12272
+ sessionStorage.setItem("replyOrigin", event.origin);
12273
+ window.location.reload();
12274
+ }
12275
+ };
12276
+ window.addEventListener("message", handleMessage);
12277
+ if (sessionStorage.getItem("shouldNotifyReload") === "1") {
12278
+ const origin = sessionStorage.getItem("replyOrigin") || "*";
12279
+ window.parent.postMessage({ type: EditorMessageType.RELOAD_COMPLETE }, origin);
12280
+ sessionStorage.removeItem("shouldNotifyReload");
12281
+ sessionStorage.removeItem("replyOrigin");
12282
+ }
12283
+ return () => {
12284
+ window.removeEventListener("message", handleMessage);
12285
+ };
12286
+ }, []);
12246
12287
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: sections.map((section, i) => {
12247
12288
  const Component = components[section.name];
12248
12289
  if (!Component) return null;
package/dist/index.mjs CHANGED
@@ -12129,6 +12129,23 @@ hooks.defineLocale("fr", {
12129
12129
  // The week that contains Jan 4th is the first week of the year.
12130
12130
  }
12131
12131
  });
12132
+ var ItemCreatorType;
12133
+ (function(ItemCreatorType2) {
12134
+ ItemCreatorType2["USER"] = "user";
12135
+ ItemCreatorType2["ADMIN"] = "admin";
12136
+ ItemCreatorType2["SYSTEM"] = "system";
12137
+ })(ItemCreatorType || (ItemCreatorType = {}));
12138
+ var AccessScope;
12139
+ (function(AccessScope2) {
12140
+ AccessScope2["INTERNAL"] = "internal";
12141
+ AccessScope2["USER_EDITABLE"] = "user-editable";
12142
+ })(AccessScope || (AccessScope = {}));
12143
+ var Intent;
12144
+ (function(Intent2) {
12145
+ Intent2["EDITORIAL_CONTENT"] = "editorial-content";
12146
+ Intent2["USER_DATA"] = "user-data";
12147
+ Intent2["SYSTEM_DATA"] = "system-data";
12148
+ })(Intent || (Intent = {}));
12132
12149
  var AccountStatus;
12133
12150
  (function(AccountStatus2) {
12134
12151
  AccountStatus2[AccountStatus2["DISABLED"] = 0] = "DISABLED";
@@ -12160,6 +12177,11 @@ var ContentType;
12160
12177
  ContentType2["NEWS_ARTICLE"] = "news-article";
12161
12178
  ContentType2["CONTENT_MODEL"] = "content-model";
12162
12179
  })(ContentType || (ContentType = {}));
12180
+ var EditorMessageType;
12181
+ (function(EditorMessageType2) {
12182
+ EditorMessageType2["RELOAD"] = "reload";
12183
+ EditorMessageType2["RELOAD_COMPLETE"] = "reload-complete";
12184
+ })(EditorMessageType || (EditorMessageType = {}));
12163
12185
  var MenuItemTargetType;
12164
12186
  (function(MenuItemTargetType2) {
12165
12187
  MenuItemTargetType2["EXTERNAL_LINK"] = "external-link";
@@ -12227,6 +12249,25 @@ const RootContainer = ({
12227
12249
  }, 1e3);
12228
12250
  return () => clearTimeout(timeout);
12229
12251
  }, [page, sections]);
12252
+ useEffect(() => {
12253
+ const handleMessage = (event) => {
12254
+ if (event.data?.type === EditorMessageType.RELOAD) {
12255
+ sessionStorage.setItem("shouldNotifyReload", "1");
12256
+ sessionStorage.setItem("replyOrigin", event.origin);
12257
+ window.location.reload();
12258
+ }
12259
+ };
12260
+ window.addEventListener("message", handleMessage);
12261
+ if (sessionStorage.getItem("shouldNotifyReload") === "1") {
12262
+ const origin = sessionStorage.getItem("replyOrigin") || "*";
12263
+ window.parent.postMessage({ type: EditorMessageType.RELOAD_COMPLETE }, origin);
12264
+ sessionStorage.removeItem("shouldNotifyReload");
12265
+ sessionStorage.removeItem("replyOrigin");
12266
+ }
12267
+ return () => {
12268
+ window.removeEventListener("message", handleMessage);
12269
+ };
12270
+ }, []);
12230
12271
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: sections.map((section, i) => {
12231
12272
  const Component2 = components[section.name];
12232
12273
  if (!Component2) return null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@creopse/react",
3
3
  "description": "Creopse React Toolkit",
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "private": false,
6
6
  "author": "Noé Gnanih <noegnanih@gmail.com>",
7
7
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "react-dom": "^19.1.0"
37
37
  },
38
38
  "dependencies": {
39
- "@creopse/utils": "^0.0.6",
39
+ "@creopse/utils": "^0.0.9",
40
40
  "framer-motion": "^12.23.9"
41
41
  },
42
42
  "devDependencies": {