@creopse/react 0.0.20 → 0.0.22

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.
@@ -7034,7 +7034,7 @@ const useHelper = () => {
7034
7034
  userLanguage = props.userData.preferences.locale;
7035
7035
  }
7036
7036
  if (!lang2) {
7037
- lang2 = localStorage.getItem(langKey) || userLanguage || props.appLocale || config?.locale || "en";
7037
+ lang2 = localStorage.getItem(langKey) || (config?.useUserLocaleAsFallback ? userLanguage : false) || props.appLocale || config?.locale || "en";
7038
7038
  }
7039
7039
  try {
7040
7040
  parsedData = JSON.parse(data);
@@ -7043,7 +7043,13 @@ const useHelper = () => {
7043
7043
  }
7044
7044
  return parsedData ? parsedData[lang2.toUpperCase()] || parsedData[lang2] || "" : "";
7045
7045
  },
7046
- [config?.locale, langKey, props.appLocale, props.userData]
7046
+ [
7047
+ config?.locale,
7048
+ config?.useUserLocaleAsFallback,
7049
+ langKey,
7050
+ props.appLocale,
7051
+ props.userData
7052
+ ]
7047
7053
  );
7048
7054
  const tr = React.useCallback(
7049
7055
  (data, lang2) => {
@@ -7033,7 +7033,7 @@ const useHelper = () => {
7033
7033
  userLanguage = props.userData.preferences.locale;
7034
7034
  }
7035
7035
  if (!lang2) {
7036
- lang2 = localStorage.getItem(langKey) || userLanguage || props.appLocale || config?.locale || "en";
7036
+ lang2 = localStorage.getItem(langKey) || (config?.useUserLocaleAsFallback ? userLanguage : false) || props.appLocale || config?.locale || "en";
7037
7037
  }
7038
7038
  try {
7039
7039
  parsedData = JSON.parse(data);
@@ -7042,7 +7042,13 @@ const useHelper = () => {
7042
7042
  }
7043
7043
  return parsedData ? parsedData[lang2.toUpperCase()] || parsedData[lang2] || "" : "";
7044
7044
  },
7045
- [config?.locale, langKey, props.appLocale, props.userData]
7045
+ [
7046
+ config?.locale,
7047
+ config?.useUserLocaleAsFallback,
7048
+ langKey,
7049
+ props.appLocale,
7050
+ props.userData
7051
+ ]
7046
7052
  );
7047
7053
  const tr = useCallback(
7048
7054
  (data, lang2) => {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const content = require("../content-qfcmWHIZ.cjs");
3
+ const content = require("../content-BpVMJ1wf.cjs");
4
4
  const React = require("react");
5
5
  const useNewsletter = () => {
6
6
  const { request } = content.useApi();
@@ -1,5 +1,5 @@
1
- import { e as useApi } from "../content-BoknRW3o.js";
2
- import { f, a, u, b } from "../content-BoknRW3o.js";
1
+ import { e as useApi } from "../content-CSFJStkb.js";
2
+ import { f, a, u, b } from "../content-CSFJStkb.js";
3
3
  import { useState, useCallback } from "react";
4
4
  const useNewsletter = () => {
5
5
  const { request } = useApi();
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
- const content = require("./content-qfcmWHIZ.cjs");
4
+ const content = require("./content-BpVMJ1wf.cjs");
5
5
  const react = require("@inertiajs/react");
6
6
  const reactDom = require("react-dom");
7
7
  function _interopNamespaceDefault(e) {
@@ -5537,29 +5537,29 @@ function transformPoint(info, transformPagePoint) {
5537
5537
  function subtractPoint(a, b) {
5538
5538
  return { x: a.x - b.x, y: a.y - b.y };
5539
5539
  }
5540
- function getPanInfo({ point }, history) {
5540
+ function getPanInfo({ point }, history2) {
5541
5541
  return {
5542
5542
  point,
5543
- delta: subtractPoint(point, lastDevicePoint(history)),
5544
- offset: subtractPoint(point, startDevicePoint(history)),
5545
- velocity: getVelocity(history, 0.1)
5543
+ delta: subtractPoint(point, lastDevicePoint(history2)),
5544
+ offset: subtractPoint(point, startDevicePoint(history2)),
5545
+ velocity: getVelocity(history2, 0.1)
5546
5546
  };
5547
5547
  }
5548
- function startDevicePoint(history) {
5549
- return history[0];
5548
+ function startDevicePoint(history2) {
5549
+ return history2[0];
5550
5550
  }
5551
- function lastDevicePoint(history) {
5552
- return history[history.length - 1];
5551
+ function lastDevicePoint(history2) {
5552
+ return history2[history2.length - 1];
5553
5553
  }
5554
- function getVelocity(history, timeDelta) {
5555
- if (history.length < 2) {
5554
+ function getVelocity(history2, timeDelta) {
5555
+ if (history2.length < 2) {
5556
5556
  return { x: 0, y: 0 };
5557
5557
  }
5558
- let i = history.length - 1;
5558
+ let i = history2.length - 1;
5559
5559
  let timestampedPoint = null;
5560
- const lastPoint = lastDevicePoint(history);
5560
+ const lastPoint = lastDevicePoint(history2);
5561
5561
  while (i >= 0) {
5562
- timestampedPoint = history[i];
5562
+ timestampedPoint = history2[i];
5563
5563
  if (lastPoint.timestamp - timestampedPoint.timestamp > /* @__PURE__ */ secondsToMilliseconds(timeDelta)) {
5564
5564
  break;
5565
5565
  }
@@ -8231,6 +8231,57 @@ const RootContainer$1 = () => {
8231
8231
  return () => clearTimeout(timer);
8232
8232
  }, [page.props.sectionData, sections]);
8233
8233
  React.useEffect(() => {
8234
+ const lockIframeNavigation = () => {
8235
+ document.addEventListener(
8236
+ "click",
8237
+ (e) => {
8238
+ const link = e.target.closest("a");
8239
+ if (link) {
8240
+ e.preventDefault();
8241
+ e.stopPropagation();
8242
+ e.stopImmediatePropagation();
8243
+ console.debug("🚫 Navigation blocked:", link.href);
8244
+ return false;
8245
+ }
8246
+ },
8247
+ true
8248
+ );
8249
+ ["assign", "replace"].forEach((method) => {
8250
+ Object.defineProperty(window.location, method, {
8251
+ value: function() {
8252
+ console.debug(`🚫 location.${method}() blocked`);
8253
+ },
8254
+ writable: false,
8255
+ configurable: false
8256
+ });
8257
+ });
8258
+ const currentHref = window.location.href;
8259
+ Object.defineProperty(window.location, "href", {
8260
+ get: () => currentHref,
8261
+ set: (value) => {
8262
+ console.debug("🚫 location.href = blocked:", value);
8263
+ },
8264
+ configurable: false
8265
+ });
8266
+ window.open = function() {
8267
+ console.debug("🚫 window.open() blocked");
8268
+ return null;
8269
+ };
8270
+ ["pushState", "replaceState"].forEach((method) => {
8271
+ history[method] = function() {
8272
+ console.debug(`🚫 history.${method}() blocked`);
8273
+ };
8274
+ });
8275
+ document.addEventListener(
8276
+ "submit",
8277
+ (e) => {
8278
+ e.preventDefault();
8279
+ console.debug("🚫 Form submission blocked");
8280
+ },
8281
+ true
8282
+ );
8283
+ console.debug("✅ Navigation lock activated");
8284
+ };
8234
8285
  const deselectAllSections = () => {
8235
8286
  Object.keys(sectionsStateRef.current).forEach((key) => {
8236
8287
  sectionsStateRef.current[key].isActive = false;
@@ -8283,6 +8334,7 @@ const RootContainer$1 = () => {
8283
8334
  }
8284
8335
  }
8285
8336
  });
8337
+ lockIframeNavigation();
8286
8338
  break;
8287
8339
  }
8288
8340
  case content.EditorMessageType.DESELECT_ALL_SECTIONS:
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import React__default, { useState, useEffect, createContext, useRef, useLayoutEffect, useId, useContext, useInsertionEffect, useMemo, useCallback, Children, isValidElement, Fragment, createElement, forwardRef, Component } from "react";
3
- import { u as useHelper, a as useContent, b as useProps, P as PropsContext, R as ResolveSectionsContext, c as cloneDeep, s as slideToId, E as EditorMessageType, d as RouterContext, C as ConfigContext } from "./content-BoknRW3o.js";
3
+ import { u as useHelper, a as useContent, b as useProps, P as PropsContext, R as ResolveSectionsContext, c as cloneDeep, s as slideToId, E as EditorMessageType, d as RouterContext, C as ConfigContext } from "./content-CSFJStkb.js";
4
4
  import { router } from "@inertiajs/react";
5
5
  import { createPortal } from "react-dom";
6
6
  var jsxRuntime = { exports: {} };
@@ -5519,29 +5519,29 @@ function transformPoint(info, transformPagePoint) {
5519
5519
  function subtractPoint(a, b) {
5520
5520
  return { x: a.x - b.x, y: a.y - b.y };
5521
5521
  }
5522
- function getPanInfo({ point }, history) {
5522
+ function getPanInfo({ point }, history2) {
5523
5523
  return {
5524
5524
  point,
5525
- delta: subtractPoint(point, lastDevicePoint(history)),
5526
- offset: subtractPoint(point, startDevicePoint(history)),
5527
- velocity: getVelocity(history, 0.1)
5525
+ delta: subtractPoint(point, lastDevicePoint(history2)),
5526
+ offset: subtractPoint(point, startDevicePoint(history2)),
5527
+ velocity: getVelocity(history2, 0.1)
5528
5528
  };
5529
5529
  }
5530
- function startDevicePoint(history) {
5531
- return history[0];
5530
+ function startDevicePoint(history2) {
5531
+ return history2[0];
5532
5532
  }
5533
- function lastDevicePoint(history) {
5534
- return history[history.length - 1];
5533
+ function lastDevicePoint(history2) {
5534
+ return history2[history2.length - 1];
5535
5535
  }
5536
- function getVelocity(history, timeDelta) {
5537
- if (history.length < 2) {
5536
+ function getVelocity(history2, timeDelta) {
5537
+ if (history2.length < 2) {
5538
5538
  return { x: 0, y: 0 };
5539
5539
  }
5540
- let i = history.length - 1;
5540
+ let i = history2.length - 1;
5541
5541
  let timestampedPoint = null;
5542
- const lastPoint = lastDevicePoint(history);
5542
+ const lastPoint = lastDevicePoint(history2);
5543
5543
  while (i >= 0) {
5544
- timestampedPoint = history[i];
5544
+ timestampedPoint = history2[i];
5545
5545
  if (lastPoint.timestamp - timestampedPoint.timestamp > /* @__PURE__ */ secondsToMilliseconds(timeDelta)) {
5546
5546
  break;
5547
5547
  }
@@ -8213,6 +8213,57 @@ const RootContainer$1 = () => {
8213
8213
  return () => clearTimeout(timer);
8214
8214
  }, [page.props.sectionData, sections]);
8215
8215
  useEffect(() => {
8216
+ const lockIframeNavigation = () => {
8217
+ document.addEventListener(
8218
+ "click",
8219
+ (e) => {
8220
+ const link = e.target.closest("a");
8221
+ if (link) {
8222
+ e.preventDefault();
8223
+ e.stopPropagation();
8224
+ e.stopImmediatePropagation();
8225
+ console.debug("🚫 Navigation blocked:", link.href);
8226
+ return false;
8227
+ }
8228
+ },
8229
+ true
8230
+ );
8231
+ ["assign", "replace"].forEach((method) => {
8232
+ Object.defineProperty(window.location, method, {
8233
+ value: function() {
8234
+ console.debug(`🚫 location.${method}() blocked`);
8235
+ },
8236
+ writable: false,
8237
+ configurable: false
8238
+ });
8239
+ });
8240
+ const currentHref = window.location.href;
8241
+ Object.defineProperty(window.location, "href", {
8242
+ get: () => currentHref,
8243
+ set: (value) => {
8244
+ console.debug("🚫 location.href = blocked:", value);
8245
+ },
8246
+ configurable: false
8247
+ });
8248
+ window.open = function() {
8249
+ console.debug("🚫 window.open() blocked");
8250
+ return null;
8251
+ };
8252
+ ["pushState", "replaceState"].forEach((method) => {
8253
+ history[method] = function() {
8254
+ console.debug(`🚫 history.${method}() blocked`);
8255
+ };
8256
+ });
8257
+ document.addEventListener(
8258
+ "submit",
8259
+ (e) => {
8260
+ e.preventDefault();
8261
+ console.debug("🚫 Form submission blocked");
8262
+ },
8263
+ true
8264
+ );
8265
+ console.debug("✅ Navigation lock activated");
8266
+ };
8216
8267
  const deselectAllSections = () => {
8217
8268
  Object.keys(sectionsStateRef.current).forEach((key) => {
8218
8269
  sectionsStateRef.current[key].isActive = false;
@@ -8265,6 +8316,7 @@ const RootContainer$1 = () => {
8265
8316
  }
8266
8317
  }
8267
8318
  });
8319
+ lockIframeNavigation();
8268
8320
  break;
8269
8321
  }
8270
8322
  case EditorMessageType.DESELECT_ALL_SECTIONS:
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.20",
4
+ "version": "0.0.22",
5
5
  "private": false,
6
6
  "author": "Noé Gnanih <noegnanih@gmail.com>",
7
7
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "react-dom": "^19.1.0"
44
44
  },
45
45
  "dependencies": {
46
- "@creopse/utils": "^0.0.12",
46
+ "@creopse/utils": "^0.0.13",
47
47
  "@vueuse/core": "^14.1.0",
48
48
  "axios": "^1.13.2",
49
49
  "framer-motion": "^12.23.9",
@@ -14,6 +14,6 @@ export declare const useConfig: () => {
14
14
  appUrl: string;
15
15
  locale: string;
16
16
  fallbackLocale: string;
17
- encryptionKey: string;
17
+ useUserLocaleAsFallback: boolean;
18
18
  langKey: string;
19
19
  };
@@ -9,7 +9,7 @@ export interface PluginConfig {
9
9
  appUrl: string;
10
10
  locale: string;
11
11
  fallbackLocale: string;
12
- encryptionKey: string;
12
+ useUserLocaleAsFallback: boolean;
13
13
  langKey: string;
14
14
  }
15
15
  export interface PluginOptions {