@creopse/react 0.0.19 → 0.0.21
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/{content-j9XJsmqN.js → content-BrpVuVxT.js} +35 -29
- package/dist/{content-CGhgyzQQ.cjs → content-I5YJXH3C.cjs} +35 -29
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/index.cjs +66 -14
- package/dist/index.mjs +66 -14
- package/package.json +2 -2
- package/types/core/api.d.ts +2 -0
- package/types/hooks/api.d.ts +18 -16
- package/types/hooks/config.d.ts +0 -4
- package/types/types/api.d.ts +12 -5
- package/types/types/plugin.d.ts +0 -1
|
@@ -2499,6 +2499,18 @@ const {
|
|
|
2499
2499
|
getAdapter,
|
|
2500
2500
|
mergeConfig
|
|
2501
2501
|
} = axios;
|
|
2502
|
+
const api = axios.create({
|
|
2503
|
+
withCredentials: true,
|
|
2504
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
2505
|
+
xsrfHeaderName: "X-XSRF-TOKEN"
|
|
2506
|
+
});
|
|
2507
|
+
api.interceptors.request.use((config) => {
|
|
2508
|
+
const token2 = document.cookie.split("; ").find((row) => row.startsWith("XSRF-TOKEN="))?.split("=")[1];
|
|
2509
|
+
if (token2) {
|
|
2510
|
+
config.headers["X-XSRF-TOKEN"] = decodeURIComponent(token2);
|
|
2511
|
+
}
|
|
2512
|
+
return config;
|
|
2513
|
+
});
|
|
2502
2514
|
var MediaFileType;
|
|
2503
2515
|
(function(MediaFileType2) {
|
|
2504
2516
|
MediaFileType2[MediaFileType2["DOCUMENT"] = 1] = "DOCUMENT";
|
|
@@ -6810,15 +6822,12 @@ const useConfig = () => {
|
|
|
6810
6822
|
return {
|
|
6811
6823
|
...config,
|
|
6812
6824
|
apiBaseUrl,
|
|
6813
|
-
apiUrl: `${apiBaseUrl}/api
|
|
6814
|
-
apiRequestHeaders: {
|
|
6815
|
-
"X-API-Key": config.xApiKey
|
|
6816
|
-
}
|
|
6825
|
+
apiUrl: `${apiBaseUrl}/api`
|
|
6817
6826
|
};
|
|
6818
6827
|
}, [config]);
|
|
6819
6828
|
};
|
|
6820
6829
|
const useApi = () => {
|
|
6821
|
-
const { apiUrl,
|
|
6830
|
+
const { apiUrl, apiBaseUrl, debug } = useConfig();
|
|
6822
6831
|
const handleError = useCallback(
|
|
6823
6832
|
(error) => {
|
|
6824
6833
|
if (debug) {
|
|
@@ -6837,32 +6846,29 @@ const useApi = () => {
|
|
|
6837
6846
|
[debug]
|
|
6838
6847
|
);
|
|
6839
6848
|
const request = useCallback(
|
|
6840
|
-
async (payload,
|
|
6849
|
+
async (payload, accessForbiddenCallback) => {
|
|
6841
6850
|
let success = false;
|
|
6842
6851
|
let response = null;
|
|
6843
6852
|
let error = null;
|
|
6844
6853
|
try {
|
|
6845
|
-
|
|
6846
|
-
if (accessToken) {
|
|
6847
|
-
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
6848
|
-
}
|
|
6849
|
-
response = await axios.request({
|
|
6854
|
+
response = await api.request({
|
|
6850
6855
|
method: payload.method || "get",
|
|
6851
6856
|
params: payload.params || {},
|
|
6852
6857
|
data: payload.data || {},
|
|
6853
6858
|
url: payload.url || "/",
|
|
6854
|
-
baseURL: apiUrl,
|
|
6855
|
-
headers
|
|
6859
|
+
baseURL: payload.useApiBaseUrl ? apiBaseUrl : apiUrl,
|
|
6860
|
+
headers: payload.headers,
|
|
6861
|
+
...payload.responseType && { responseType: payload.responseType }
|
|
6856
6862
|
});
|
|
6857
6863
|
success = true;
|
|
6858
6864
|
} catch (err) {
|
|
6859
6865
|
error = err;
|
|
6860
6866
|
success = false;
|
|
6861
|
-
if (err.response
|
|
6867
|
+
if (err.response?.status == 401) {
|
|
6862
6868
|
accessForbiddenCallback?.();
|
|
6863
|
-
} else {
|
|
6864
|
-
|
|
6865
|
-
}
|
|
6869
|
+
} else if (err.response?.status == 419) {
|
|
6870
|
+
console.error("CSRF token mismatch");
|
|
6871
|
+
} else handleError(err);
|
|
6866
6872
|
}
|
|
6867
6873
|
return {
|
|
6868
6874
|
success,
|
|
@@ -6871,9 +6877,9 @@ const useApi = () => {
|
|
|
6871
6877
|
error
|
|
6872
6878
|
};
|
|
6873
6879
|
},
|
|
6874
|
-
[
|
|
6880
|
+
[apiBaseUrl, apiUrl, handleError]
|
|
6875
6881
|
);
|
|
6876
|
-
const
|
|
6882
|
+
const postItemRequest = useCallback(
|
|
6877
6883
|
async (payload) => {
|
|
6878
6884
|
const task = await request({
|
|
6879
6885
|
url: `/${payload.routeBase}`,
|
|
@@ -6884,7 +6890,7 @@ const useApi = () => {
|
|
|
6884
6890
|
},
|
|
6885
6891
|
[request]
|
|
6886
6892
|
);
|
|
6887
|
-
const
|
|
6893
|
+
const deleteItemRequest = useCallback(
|
|
6888
6894
|
async (payload) => {
|
|
6889
6895
|
const task = await request({
|
|
6890
6896
|
url: `/${payload.routeBase}/${payload.id}`,
|
|
@@ -6894,7 +6900,7 @@ const useApi = () => {
|
|
|
6894
6900
|
},
|
|
6895
6901
|
[request]
|
|
6896
6902
|
);
|
|
6897
|
-
const
|
|
6903
|
+
const putItemRequest = useCallback(
|
|
6898
6904
|
async (payload) => {
|
|
6899
6905
|
const task = await request({
|
|
6900
6906
|
url: `/${payload.routeBase}/${payload.id}`,
|
|
@@ -6905,7 +6911,7 @@ const useApi = () => {
|
|
|
6905
6911
|
},
|
|
6906
6912
|
[request]
|
|
6907
6913
|
);
|
|
6908
|
-
const
|
|
6914
|
+
const getAllItemsRequest = useCallback(
|
|
6909
6915
|
async (payload) => {
|
|
6910
6916
|
const task = await request({
|
|
6911
6917
|
url: `/${payload.routeBase}`
|
|
@@ -6914,7 +6920,7 @@ const useApi = () => {
|
|
|
6914
6920
|
},
|
|
6915
6921
|
[request]
|
|
6916
6922
|
);
|
|
6917
|
-
const
|
|
6923
|
+
const getItemRequest = useCallback(
|
|
6918
6924
|
async (payload) => {
|
|
6919
6925
|
const task = await request({
|
|
6920
6926
|
url: `/${payload.routeBase}/${payload.id}`
|
|
@@ -6925,11 +6931,11 @@ const useApi = () => {
|
|
|
6925
6931
|
);
|
|
6926
6932
|
return {
|
|
6927
6933
|
request,
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6934
|
+
getItemRequest,
|
|
6935
|
+
postItemRequest,
|
|
6936
|
+
putItemRequest,
|
|
6937
|
+
deleteItemRequest,
|
|
6938
|
+
getAllItemsRequest,
|
|
6933
6939
|
handleError
|
|
6934
6940
|
};
|
|
6935
6941
|
};
|
|
@@ -7027,7 +7033,7 @@ const useHelper = () => {
|
|
|
7027
7033
|
userLanguage = props.userData.preferences.locale;
|
|
7028
7034
|
}
|
|
7029
7035
|
if (!lang2) {
|
|
7030
|
-
lang2 = localStorage.getItem(langKey) ||
|
|
7036
|
+
lang2 = localStorage.getItem(langKey) || props.appLocale || config?.locale || userLanguage || "en";
|
|
7031
7037
|
}
|
|
7032
7038
|
try {
|
|
7033
7039
|
parsedData = JSON.parse(data);
|
|
@@ -2500,6 +2500,18 @@ const {
|
|
|
2500
2500
|
getAdapter,
|
|
2501
2501
|
mergeConfig
|
|
2502
2502
|
} = axios;
|
|
2503
|
+
const api = axios.create({
|
|
2504
|
+
withCredentials: true,
|
|
2505
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
2506
|
+
xsrfHeaderName: "X-XSRF-TOKEN"
|
|
2507
|
+
});
|
|
2508
|
+
api.interceptors.request.use((config) => {
|
|
2509
|
+
const token2 = document.cookie.split("; ").find((row) => row.startsWith("XSRF-TOKEN="))?.split("=")[1];
|
|
2510
|
+
if (token2) {
|
|
2511
|
+
config.headers["X-XSRF-TOKEN"] = decodeURIComponent(token2);
|
|
2512
|
+
}
|
|
2513
|
+
return config;
|
|
2514
|
+
});
|
|
2503
2515
|
var MediaFileType;
|
|
2504
2516
|
(function(MediaFileType2) {
|
|
2505
2517
|
MediaFileType2[MediaFileType2["DOCUMENT"] = 1] = "DOCUMENT";
|
|
@@ -6811,15 +6823,12 @@ const useConfig = () => {
|
|
|
6811
6823
|
return {
|
|
6812
6824
|
...config,
|
|
6813
6825
|
apiBaseUrl,
|
|
6814
|
-
apiUrl: `${apiBaseUrl}/api
|
|
6815
|
-
apiRequestHeaders: {
|
|
6816
|
-
"X-API-Key": config.xApiKey
|
|
6817
|
-
}
|
|
6826
|
+
apiUrl: `${apiBaseUrl}/api`
|
|
6818
6827
|
};
|
|
6819
6828
|
}, [config]);
|
|
6820
6829
|
};
|
|
6821
6830
|
const useApi = () => {
|
|
6822
|
-
const { apiUrl,
|
|
6831
|
+
const { apiUrl, apiBaseUrl, debug } = useConfig();
|
|
6823
6832
|
const handleError = React.useCallback(
|
|
6824
6833
|
(error) => {
|
|
6825
6834
|
if (debug) {
|
|
@@ -6838,32 +6847,29 @@ const useApi = () => {
|
|
|
6838
6847
|
[debug]
|
|
6839
6848
|
);
|
|
6840
6849
|
const request = React.useCallback(
|
|
6841
|
-
async (payload,
|
|
6850
|
+
async (payload, accessForbiddenCallback) => {
|
|
6842
6851
|
let success = false;
|
|
6843
6852
|
let response = null;
|
|
6844
6853
|
let error = null;
|
|
6845
6854
|
try {
|
|
6846
|
-
|
|
6847
|
-
if (accessToken) {
|
|
6848
|
-
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
6849
|
-
}
|
|
6850
|
-
response = await axios.request({
|
|
6855
|
+
response = await api.request({
|
|
6851
6856
|
method: payload.method || "get",
|
|
6852
6857
|
params: payload.params || {},
|
|
6853
6858
|
data: payload.data || {},
|
|
6854
6859
|
url: payload.url || "/",
|
|
6855
|
-
baseURL: apiUrl,
|
|
6856
|
-
headers
|
|
6860
|
+
baseURL: payload.useApiBaseUrl ? apiBaseUrl : apiUrl,
|
|
6861
|
+
headers: payload.headers,
|
|
6862
|
+
...payload.responseType && { responseType: payload.responseType }
|
|
6857
6863
|
});
|
|
6858
6864
|
success = true;
|
|
6859
6865
|
} catch (err) {
|
|
6860
6866
|
error = err;
|
|
6861
6867
|
success = false;
|
|
6862
|
-
if (err.response
|
|
6868
|
+
if (err.response?.status == 401) {
|
|
6863
6869
|
accessForbiddenCallback?.();
|
|
6864
|
-
} else {
|
|
6865
|
-
|
|
6866
|
-
}
|
|
6870
|
+
} else if (err.response?.status == 419) {
|
|
6871
|
+
console.error("CSRF token mismatch");
|
|
6872
|
+
} else handleError(err);
|
|
6867
6873
|
}
|
|
6868
6874
|
return {
|
|
6869
6875
|
success,
|
|
@@ -6872,9 +6878,9 @@ const useApi = () => {
|
|
|
6872
6878
|
error
|
|
6873
6879
|
};
|
|
6874
6880
|
},
|
|
6875
|
-
[
|
|
6881
|
+
[apiBaseUrl, apiUrl, handleError]
|
|
6876
6882
|
);
|
|
6877
|
-
const
|
|
6883
|
+
const postItemRequest = React.useCallback(
|
|
6878
6884
|
async (payload) => {
|
|
6879
6885
|
const task = await request({
|
|
6880
6886
|
url: `/${payload.routeBase}`,
|
|
@@ -6885,7 +6891,7 @@ const useApi = () => {
|
|
|
6885
6891
|
},
|
|
6886
6892
|
[request]
|
|
6887
6893
|
);
|
|
6888
|
-
const
|
|
6894
|
+
const deleteItemRequest = React.useCallback(
|
|
6889
6895
|
async (payload) => {
|
|
6890
6896
|
const task = await request({
|
|
6891
6897
|
url: `/${payload.routeBase}/${payload.id}`,
|
|
@@ -6895,7 +6901,7 @@ const useApi = () => {
|
|
|
6895
6901
|
},
|
|
6896
6902
|
[request]
|
|
6897
6903
|
);
|
|
6898
|
-
const
|
|
6904
|
+
const putItemRequest = React.useCallback(
|
|
6899
6905
|
async (payload) => {
|
|
6900
6906
|
const task = await request({
|
|
6901
6907
|
url: `/${payload.routeBase}/${payload.id}`,
|
|
@@ -6906,7 +6912,7 @@ const useApi = () => {
|
|
|
6906
6912
|
},
|
|
6907
6913
|
[request]
|
|
6908
6914
|
);
|
|
6909
|
-
const
|
|
6915
|
+
const getAllItemsRequest = React.useCallback(
|
|
6910
6916
|
async (payload) => {
|
|
6911
6917
|
const task = await request({
|
|
6912
6918
|
url: `/${payload.routeBase}`
|
|
@@ -6915,7 +6921,7 @@ const useApi = () => {
|
|
|
6915
6921
|
},
|
|
6916
6922
|
[request]
|
|
6917
6923
|
);
|
|
6918
|
-
const
|
|
6924
|
+
const getItemRequest = React.useCallback(
|
|
6919
6925
|
async (payload) => {
|
|
6920
6926
|
const task = await request({
|
|
6921
6927
|
url: `/${payload.routeBase}/${payload.id}`
|
|
@@ -6926,11 +6932,11 @@ const useApi = () => {
|
|
|
6926
6932
|
);
|
|
6927
6933
|
return {
|
|
6928
6934
|
request,
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6935
|
+
getItemRequest,
|
|
6936
|
+
postItemRequest,
|
|
6937
|
+
putItemRequest,
|
|
6938
|
+
deleteItemRequest,
|
|
6939
|
+
getAllItemsRequest,
|
|
6934
6940
|
handleError
|
|
6935
6941
|
};
|
|
6936
6942
|
};
|
|
@@ -7028,7 +7034,7 @@ const useHelper = () => {
|
|
|
7028
7034
|
userLanguage = props.userData.preferences.locale;
|
|
7029
7035
|
}
|
|
7030
7036
|
if (!lang2) {
|
|
7031
|
-
lang2 = localStorage.getItem(langKey) ||
|
|
7037
|
+
lang2 = localStorage.getItem(langKey) || props.appLocale || config?.locale || userLanguage || "en";
|
|
7032
7038
|
}
|
|
7033
7039
|
try {
|
|
7034
7040
|
parsedData = JSON.parse(data);
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const content = require("../content-
|
|
3
|
+
const content = require("../content-I5YJXH3C.cjs");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const useNewsletter = () => {
|
|
6
6
|
const { request } = content.useApi();
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as useApi } from "../content-
|
|
2
|
-
import { f, a, u, b } from "../content-
|
|
1
|
+
import { e as useApi } from "../content-BrpVuVxT.js";
|
|
2
|
+
import { f, a, u, b } from "../content-BrpVuVxT.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-
|
|
4
|
+
const content = require("./content-I5YJXH3C.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 },
|
|
5540
|
+
function getPanInfo({ point }, history2) {
|
|
5541
5541
|
return {
|
|
5542
5542
|
point,
|
|
5543
|
-
delta: subtractPoint(point, lastDevicePoint(
|
|
5544
|
-
offset: subtractPoint(point, startDevicePoint(
|
|
5545
|
-
velocity: getVelocity(
|
|
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(
|
|
5549
|
-
return
|
|
5548
|
+
function startDevicePoint(history2) {
|
|
5549
|
+
return history2[0];
|
|
5550
5550
|
}
|
|
5551
|
-
function lastDevicePoint(
|
|
5552
|
-
return
|
|
5551
|
+
function lastDevicePoint(history2) {
|
|
5552
|
+
return history2[history2.length - 1];
|
|
5553
5553
|
}
|
|
5554
|
-
function getVelocity(
|
|
5555
|
-
if (
|
|
5554
|
+
function getVelocity(history2, timeDelta) {
|
|
5555
|
+
if (history2.length < 2) {
|
|
5556
5556
|
return { x: 0, y: 0 };
|
|
5557
5557
|
}
|
|
5558
|
-
let i =
|
|
5558
|
+
let i = history2.length - 1;
|
|
5559
5559
|
let timestampedPoint = null;
|
|
5560
|
-
const lastPoint = lastDevicePoint(
|
|
5560
|
+
const lastPoint = lastDevicePoint(history2);
|
|
5561
5561
|
while (i >= 0) {
|
|
5562
|
-
timestampedPoint =
|
|
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-
|
|
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-BrpVuVxT.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 },
|
|
5522
|
+
function getPanInfo({ point }, history2) {
|
|
5523
5523
|
return {
|
|
5524
5524
|
point,
|
|
5525
|
-
delta: subtractPoint(point, lastDevicePoint(
|
|
5526
|
-
offset: subtractPoint(point, startDevicePoint(
|
|
5527
|
-
velocity: getVelocity(
|
|
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(
|
|
5531
|
-
return
|
|
5530
|
+
function startDevicePoint(history2) {
|
|
5531
|
+
return history2[0];
|
|
5532
5532
|
}
|
|
5533
|
-
function lastDevicePoint(
|
|
5534
|
-
return
|
|
5533
|
+
function lastDevicePoint(history2) {
|
|
5534
|
+
return history2[history2.length - 1];
|
|
5535
5535
|
}
|
|
5536
|
-
function getVelocity(
|
|
5537
|
-
if (
|
|
5536
|
+
function getVelocity(history2, timeDelta) {
|
|
5537
|
+
if (history2.length < 2) {
|
|
5538
5538
|
return { x: 0, y: 0 };
|
|
5539
5539
|
}
|
|
5540
|
-
let i =
|
|
5540
|
+
let i = history2.length - 1;
|
|
5541
5541
|
let timestampedPoint = null;
|
|
5542
|
-
const lastPoint = lastDevicePoint(
|
|
5542
|
+
const lastPoint = lastDevicePoint(history2);
|
|
5543
5543
|
while (i >= 0) {
|
|
5544
|
-
timestampedPoint =
|
|
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.
|
|
4
|
+
"version": "0.0.21",
|
|
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.
|
|
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",
|
package/types/hooks/api.d.ts
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Payload, Response } from '@/types/api';
|
|
2
|
+
import type { AxiosError } from 'axios';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* A hook that provides a way to make API requests.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
* @returns {Object} An object containing the following methods:
|
|
6
|
+
* The hook provides the following methods:
|
|
7
7
|
* - `request`: Makes an API request with the given payload.
|
|
8
|
-
* - `
|
|
9
|
-
* - `
|
|
10
|
-
* - `
|
|
11
|
-
* - `
|
|
12
|
-
* - `
|
|
8
|
+
* - `getItemRequest`: Makes a GET request to the specified API endpoint with the given payload.
|
|
9
|
+
* - `postItemRequest`: Makes a POST request to the specified API endpoint with the given payload.
|
|
10
|
+
* - `putItemRequest`: Makes a PUT request to the specified API endpoint with the given payload.
|
|
11
|
+
* - `deleteItemRequest`: Makes a DELETE request to the specified API endpoint with the given payload.
|
|
12
|
+
* - `getAllItemsRequest`: Makes a GET request to the specified API endpoint with the given payload.
|
|
13
13
|
* - `handleError`: Handles an error from the API.
|
|
14
|
+
*
|
|
15
|
+
* @returns {Object} An object containing the methods listed above.
|
|
14
16
|
*/
|
|
15
17
|
export declare const useApi: () => {
|
|
16
|
-
request: (payload: Payload,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
handleError: (error:
|
|
18
|
+
request: <T = any>(payload: Payload, accessForbiddenCallback?: () => void) => Promise<Response<T>>;
|
|
19
|
+
getItemRequest: <T = any>(payload: Payload) => Promise<Response<T>>;
|
|
20
|
+
postItemRequest: <T = any>(payload: Payload) => Promise<Response<T>>;
|
|
21
|
+
putItemRequest: <T = any>(payload: Payload) => Promise<Response<T>>;
|
|
22
|
+
deleteItemRequest: <T = any>(payload: Payload) => Promise<Response<T>>;
|
|
23
|
+
getAllItemsRequest: <T = any>(payload: Payload) => Promise<Response<T>>;
|
|
24
|
+
handleError: (error: AxiosError) => void;
|
|
23
25
|
};
|
package/types/hooks/config.d.ts
CHANGED
|
@@ -10,12 +10,8 @@
|
|
|
10
10
|
export declare const useConfig: () => {
|
|
11
11
|
apiBaseUrl: string;
|
|
12
12
|
apiUrl: string;
|
|
13
|
-
apiRequestHeaders: {
|
|
14
|
-
'X-API-Key': string;
|
|
15
|
-
};
|
|
16
13
|
debug: boolean;
|
|
17
14
|
appUrl: string;
|
|
18
|
-
xApiKey: string;
|
|
19
15
|
locale: string;
|
|
20
16
|
fallbackLocale: string;
|
|
21
17
|
encryptionKey: string;
|
package/types/types/api.d.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
+
import type { ResponseType } from 'axios';
|
|
1
2
|
export type Method = 'get' | 'post' | 'put' | 'delete';
|
|
2
3
|
export interface Payload {
|
|
3
4
|
method?: Method;
|
|
4
5
|
routeBase?: string;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
responseType?: ResponseType;
|
|
7
|
+
params?: Record<string, any>;
|
|
8
|
+
data?: Record<string, any>;
|
|
7
9
|
url?: string;
|
|
8
10
|
id?: string;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
useApiBaseUrl?: boolean;
|
|
9
13
|
}
|
|
10
|
-
export interface
|
|
14
|
+
export interface Response<T> {
|
|
11
15
|
success: boolean;
|
|
12
16
|
failure: boolean;
|
|
13
|
-
result:
|
|
14
|
-
|
|
17
|
+
result: {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
data?: T;
|
|
20
|
+
};
|
|
21
|
+
error?: any;
|
|
15
22
|
}
|