@pack/react 3.0.0-beta.1 → 3.0.1
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/pack/pack-context.d.ts.map +1 -1
- package/dist/pack/pack-context.js +5 -2
- package/dist/pack/render-sections.d.ts.map +1 -1
- package/dist/pack/render-sections.js +2 -2
- package/dist/register-storefront-settings-schema.js +6 -6
- package/dist/use-customizer-shell.js +3 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-context.d.ts","sourceRoot":"","sources":["../../src/pack/pack-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"pack-context.d.ts","sourceRoot":"","sources":["../../src/pack/pack-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAMf,KAAK,gBAAgB,GAAG;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE;QACf,OAAO,CAAC,EAAE;YACR,GAAG,CAAC,EAAE,MAAM,CAAC;YACb,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC;QACF,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,YAAY,EAAE,GAAG,CAAC;IAClB,eAAe,EAAE,CAAC,YAAY,EAAE,GAAG,KAAK,IAAI,CAAC;IAC7C,WAAW,EAAE,GAAG,CAAC;IACjB,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACvC,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,WAAW,iCAQtB,CAAC;AAEH,eAAO,MAAM,cAAc,wBAAgC,CAAC;AAE5D,UAAU,gBAAgB;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACpD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,GAAG,CAAC;CACnB;AAUD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,oBAA4B,EAC5B,YAAY,EAAE,yBAAyB,EACvC,cAAc,EACd,kBAAuB,GACxB,EAAE,gBAAgB,qBAuClB;AAED,eAAO,MAAM,eAAe,qBAAe,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext, useContext, useState, useMemo, } from "react";
|
|
1
|
+
import React, { createContext, useContext, useState, useMemo, useEffect, } from "react";
|
|
2
2
|
import { usePackTrack } from "./pack-analytics";
|
|
3
3
|
import { PreviewToast } from "./preview-toast";
|
|
4
4
|
import { useOverlayScript } from "../use-overlay-script";
|
|
@@ -38,10 +38,13 @@ export function PackProvider({ children, isPreviewModeEnabled = false, siteSetti
|
|
|
38
38
|
liveContent,
|
|
39
39
|
contentEnvironment,
|
|
40
40
|
]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
setSiteSettings(previewStorefrontSettings);
|
|
43
|
+
}, [previewStorefrontSettings]);
|
|
41
44
|
usePackTrack();
|
|
42
45
|
return (React.createElement(PackContext.Provider, { value: value },
|
|
43
|
-
children,
|
|
44
46
|
React.createElement(CustomizerShell, null),
|
|
47
|
+
children,
|
|
45
48
|
React.createElement(PreviewToast, { isPreviewModeEnabled: !!isPreviewModeEnabled })));
|
|
46
49
|
}
|
|
47
50
|
export const PreviewProvider = PackProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-sections.d.ts","sourceRoot":"","sources":["../../src/pack/render-sections.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"render-sections.d.ts","sourceRoot":"","sources":["../../src/pack/render-sections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAiDlD,UAAU,mBAAmB;IAC3B,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAoBD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,4BAKxD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,mBAAmB,uCAOrD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from "react";
|
|
1
|
+
import React, { useMemo, useEffect } from "react";
|
|
2
2
|
import { usePackContext } from "./pack-context";
|
|
3
3
|
import { sectionMap } from "../register-section";
|
|
4
4
|
import { generateSectionStylesheet } from "../lib/style-utils";
|
|
@@ -32,7 +32,7 @@ function Sections({ sections }) {
|
|
|
32
32
|
function useRenderSections({ content }) {
|
|
33
33
|
const { isPreview, liveContent, setLiveContent } = usePackContext();
|
|
34
34
|
// Update content in context for preview mode
|
|
35
|
-
|
|
35
|
+
useEffect(() => {
|
|
36
36
|
if (isPreview && setLiveContent) {
|
|
37
37
|
setLiveContent(content);
|
|
38
38
|
}
|
|
@@ -5,15 +5,15 @@ export function registerStorefrontSettingsSchema(settings) {
|
|
|
5
5
|
const result = SiteSettingsObjectSchema.safeParse(setting);
|
|
6
6
|
if (result && !result.success) {
|
|
7
7
|
const errorParts = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
"\n\x1b[1m\x1b[31m@pack/react Schema Validation Error:\x1b[0m",
|
|
9
|
+
"\x1b[31mInvalid storefront settings schema\x1b[0m",
|
|
10
|
+
"\n\x1b[33mDetailed Errors:\x1b[0m",
|
|
11
11
|
];
|
|
12
|
-
result.error.issues.forEach(issue => {
|
|
13
|
-
errorParts.push(`\x1b[33m- Path:\x1b[0m ${issue.path.join(
|
|
12
|
+
result.error.issues.forEach((issue) => {
|
|
13
|
+
errorParts.push(`\x1b[33m- Path:\x1b[0m ${issue.path.join(".")}`);
|
|
14
14
|
errorParts.push(` \x1b[31m${issue.message}\x1b[0m`);
|
|
15
15
|
});
|
|
16
|
-
console.error(errorParts.join(
|
|
16
|
+
console.error(errorParts.join("\n"));
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -14,7 +14,7 @@ export const useCustomizerShell = () => {
|
|
|
14
14
|
};
|
|
15
15
|
const [hasInit, setHasInit] = useState(false);
|
|
16
16
|
const pendingMessagesRef = useRef(new Map());
|
|
17
|
-
const currentPathRef = useRef();
|
|
17
|
+
const currentPathRef = useRef(undefined);
|
|
18
18
|
const sendToParent = useCallback(async (type, data) => {
|
|
19
19
|
const messageId = crypto.randomUUID();
|
|
20
20
|
const message = {
|
|
@@ -179,8 +179,9 @@ export const useCustomizerShell = () => {
|
|
|
179
179
|
const { template, templateType, handle, title, description } = data;
|
|
180
180
|
if (!hasInit ||
|
|
181
181
|
!currentPathRef.current ||
|
|
182
|
-
(!template && !templateType && !handle && !title && !description))
|
|
182
|
+
(!template && !templateType && !handle && !title && !description)) {
|
|
183
183
|
return;
|
|
184
|
+
}
|
|
184
185
|
sendToParent("SET_CURRENT_ROUTE", {
|
|
185
186
|
environment: environment || "",
|
|
186
187
|
currentPath: currentPathRef.current,
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,EAAE,MAAgB,CAAC"}
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.
|
|
1
|
+
export const VERSION = "3.0.1";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pack/react",
|
|
3
3
|
"description": "React",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.1",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"engines": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@pack/types": "^0.
|
|
25
|
+
"@pack/types": "^0.1.1",
|
|
26
26
|
"@types/react": "^18.2.20",
|
|
27
27
|
"react": "^18.2.0",
|
|
28
28
|
"react-dom": "^18.2.0"
|