@pack/react 0.0.12 → 0.0.13
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-sections.d.ts","sourceRoot":"","sources":["../src/render-sections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"render-sections.d.ts","sourceRoot":"","sources":["../src/render-sections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAwClD,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,4BA8B9C"}
|
package/dist/render-sections.js
CHANGED
|
@@ -11,6 +11,8 @@ function Sections({ sections }) {
|
|
|
11
11
|
// Normalize section data
|
|
12
12
|
const key = section.id || section.clientId;
|
|
13
13
|
const data = section.data || section;
|
|
14
|
+
// Attach dataSource to the provided cms data
|
|
15
|
+
data.dataSource = section.dataSource;
|
|
14
16
|
const schemaKey = data._template;
|
|
15
17
|
const Component = sectionMap.get(schemaKey);
|
|
16
18
|
if (!Component)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-customizer-shell.d.ts","sourceRoot":"","sources":["../src/use-customizer-shell.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,mFAM5B,GAAG;;;
|
|
1
|
+
{"version":3,"file":"use-customizer-shell.d.ts","sourceRoot":"","sources":["../src/use-customizer-shell.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,mFAM5B,GAAG;;;CAiIL,CAAC"}
|
|
@@ -5,9 +5,16 @@ export const useCustomizerShell = ({ environment = "production", isPreview, sect
|
|
|
5
5
|
const [content, setContent] = useState(data.content);
|
|
6
6
|
const [storefrontSettings, setStorefrontSettings] = useState(null);
|
|
7
7
|
const [parentConnection, setParentConnection] = useState(null);
|
|
8
|
+
const [shouldConnectToParent, setShouldConnectToParent] = useState(false);
|
|
8
9
|
const navigate = (path) => {
|
|
9
10
|
window.location.href = path;
|
|
10
11
|
};
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const isIframe = window.self !== window.top;
|
|
14
|
+
if (!isIframe)
|
|
15
|
+
return;
|
|
16
|
+
setShouldConnectToParent(true);
|
|
17
|
+
}, []);
|
|
11
18
|
useEffect(() => {
|
|
12
19
|
setLocation(window.location);
|
|
13
20
|
}, [data.handle]);
|
|
@@ -47,7 +54,7 @@ export const useCustomizerShell = ({ environment = "production", isPreview, sect
|
|
|
47
54
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
55
|
}, [data.handle, parentConnection, storefrontSettingsSchema]);
|
|
49
56
|
useEffect(() => {
|
|
50
|
-
if (!isPreview || !location?.pathname)
|
|
57
|
+
if (!isPreview || !location?.pathname || !shouldConnectToParent)
|
|
51
58
|
return;
|
|
52
59
|
const connection = connectToParent({
|
|
53
60
|
methods: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pack/react",
|
|
3
3
|
"description": "React",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"engines": {
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@shopify/remix-oxygen": "^1.1.3",
|
|
26
25
|
"@types/react": "^18.2.20",
|
|
27
26
|
"react": "^18.2.0",
|
|
28
27
|
"react-dom": "^18.2.0"
|