@pack/react 4.3.1 → 4.3.2
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/README.md +3 -14
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/pack/pack-context.d.ts +1 -4
- package/dist/pack/pack-context.d.ts.map +1 -1
- package/dist/pack/pack-context.js +2 -4
- package/dist/version.js +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -15,26 +15,17 @@ npm install @pack/react
|
|
|
15
15
|
- `registerSection`
|
|
16
16
|
- `registerStorefrontSettingsSchema`
|
|
17
17
|
- `usePackContext`, `useSiteSettings`, `useLocale`
|
|
18
|
-
- `PackErrorBoundary`
|
|
19
18
|
|
|
20
19
|
## Usage
|
|
21
20
|
|
|
22
21
|
```tsx
|
|
23
|
-
import { PackProvider, RenderSections } from
|
|
24
|
-
|
|
25
|
-
export function App({
|
|
26
|
-
sections,
|
|
27
|
-
siteSettings,
|
|
28
|
-
packSessionId,
|
|
29
|
-
isPreviewModeEnabled,
|
|
30
|
-
packErrorTracking,
|
|
31
|
-
}: Props) {
|
|
22
|
+
import { PackProvider, RenderSections } from "@pack/react";
|
|
23
|
+
|
|
24
|
+
export function App({ sections, siteSettings, isPreviewModeEnabled }: Props) {
|
|
32
25
|
return (
|
|
33
26
|
<PackProvider
|
|
34
27
|
siteSettings={siteSettings}
|
|
35
|
-
packSessionId={packSessionId}
|
|
36
28
|
isPreviewModeEnabled={isPreviewModeEnabled}
|
|
37
|
-
packErrorTracking={packErrorTracking}
|
|
38
29
|
>
|
|
39
30
|
<RenderSections sections={sections} />
|
|
40
31
|
</PackProvider>
|
|
@@ -42,8 +33,6 @@ export function App({
|
|
|
42
33
|
}
|
|
43
34
|
```
|
|
44
35
|
|
|
45
|
-
`packSessionId` and `packErrorTracking` can be passed from `...pack.getPackContextData()` when using `@pack/hydrogen`.
|
|
46
|
-
|
|
47
36
|
## Development
|
|
48
37
|
|
|
49
38
|
```bash
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { RenderSection, RenderSections, useSections } from "./pack/render-sections";
|
|
2
2
|
import { PackProvider, PreviewProvider } from "./pack/pack-context";
|
|
3
3
|
import { usePackContext } from "./pack/pack-context";
|
|
4
|
-
import { PackErrorBoundary } from "@pack/errors-react";
|
|
5
4
|
import { useSiteSettings } from "./use-site-settings";
|
|
6
5
|
import { useLocale } from "./use-locale";
|
|
7
6
|
import { useOverlayScript } from "./use-overlay-script";
|
|
8
7
|
import { registerSection } from "./register-section";
|
|
9
8
|
import { registerStorefrontSettingsSchema } from "./register-storefront-settings-schema";
|
|
10
|
-
export
|
|
11
|
-
export { PackErrorBoundary, PackProvider, PreviewProvider, RenderSection, RenderSections, registerSection, registerStorefrontSettingsSchema, useLocale, useOverlayScript, usePackContext, useSections, useSiteSettings, };
|
|
9
|
+
export { PackProvider, PreviewProvider, RenderSection, RenderSections, registerSection, registerStorefrontSettingsSchema, useLocale, useOverlayScript, usePackContext, useSections, useSiteSettings, };
|
|
12
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,gCAAgC,EAChC,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,GAChB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { RenderSection, RenderSections, useSections } from "./pack/render-sections";
|
|
1
|
+
import { RenderSection, RenderSections, useSections, } from "./pack/render-sections";
|
|
2
2
|
import { PackProvider, PreviewProvider } from "./pack/pack-context";
|
|
3
3
|
import { usePackContext } from "./pack/pack-context";
|
|
4
|
-
import { PackErrorBoundary } from "@pack/errors-react";
|
|
5
4
|
import { useSiteSettings } from "./use-site-settings";
|
|
6
5
|
import { useLocale } from "./use-locale";
|
|
7
6
|
import { useOverlayScript } from "./use-overlay-script";
|
|
8
7
|
import { registerSection } from "./register-section";
|
|
9
8
|
import { registerStorefrontSettingsSchema } from "./register-storefront-settings-schema";
|
|
10
|
-
export {
|
|
9
|
+
export { PackProvider, PreviewProvider, RenderSection, RenderSections, registerSection, registerStorefrontSettingsSchema, useLocale, useOverlayScript, usePackContext, useSections, useSiteSettings, };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { type ReactNode } from "react";
|
|
2
|
-
import { type ErrorTrackingOptions } from "@pack/errors-react";
|
|
3
2
|
import "./pack-debug";
|
|
4
3
|
type PackContextValue = {
|
|
5
4
|
isPreview: boolean;
|
|
@@ -36,7 +35,6 @@ export declare const usePackContext: () => PackContextValue;
|
|
|
36
35
|
interface PackContentProps {
|
|
37
36
|
children: ReactNode;
|
|
38
37
|
siteSettings: any;
|
|
39
|
-
packSessionId?: string;
|
|
40
38
|
isPreviewModeEnabled?: boolean;
|
|
41
39
|
customizerMeta?: PackContextValue["customizerMeta"];
|
|
42
40
|
contentEnvironment?: string;
|
|
@@ -45,9 +43,8 @@ interface PackContentProps {
|
|
|
45
43
|
country: string;
|
|
46
44
|
} | null;
|
|
47
45
|
liveContent?: any;
|
|
48
|
-
packErrorTracking?: ErrorTrackingOptions;
|
|
49
46
|
}
|
|
50
|
-
export declare function PackProvider({ children,
|
|
47
|
+
export declare function PackProvider({ children, isPreviewModeEnabled, siteSettings: previewStorefrontSettings, customizerMeta, contentEnvironment, locale: previewLocale, }: PackContentProps): React.JSX.Element;
|
|
51
48
|
export declare const PreviewProvider: typeof PackProvider;
|
|
52
49
|
export {};
|
|
53
50
|
//# sourceMappingURL=pack-context.d.ts.map
|
|
@@ -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,EAEf,MAAM,OAAO,CAAC;
|
|
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;AAKf,OAAO,cAAc,CAAC;AAEtB,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,CAAC,EAAE;YACf,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;YAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;SAC5B,CAAC;QACF,CAAC,GAAG,EAAE,MAAM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rack } from "./pack-analytics";
|
|
3
|
-
import { usePackErrorTrack, PackErrorBoundary, } from "@pack/errors-react";
|
|
4
3
|
import { PreviewToast } from "./preview-toast";
|
|
5
4
|
import { useOverlayScript } from "../use-overlay-script";
|
|
6
5
|
import { useCustomizerShell } from "../use-customizer-shell";
|
|
@@ -24,7 +23,7 @@ const CustomizerShell = () => {
|
|
|
24
23
|
useOverlayScript();
|
|
25
24
|
return null;
|
|
26
25
|
};
|
|
27
|
-
export function PackProvider({ children,
|
|
26
|
+
export function PackProvider({ children, isPreviewModeEnabled = false, siteSettings: previewStorefrontSettings, customizerMeta, contentEnvironment = "", locale: previewLocale = null, }) {
|
|
28
27
|
const [liveContent, setLiveContent] = useState(null);
|
|
29
28
|
const [siteSettings, setSiteSettings] = useState(previewStorefrontSettings);
|
|
30
29
|
const [locale, setLocale] = useState(previewLocale);
|
|
@@ -54,10 +53,9 @@ export function PackProvider({ children, packSessionId, isPreviewModeEnabled = f
|
|
|
54
53
|
setSiteSettings(previewStorefrontSettings);
|
|
55
54
|
}, [previewStorefrontSettings]);
|
|
56
55
|
usePackTrack();
|
|
57
|
-
usePackErrorTrack(!!isPreviewModeEnabled, packErrorTracking, packSessionId);
|
|
58
56
|
return (React.createElement(PackContext.Provider, { value: value },
|
|
59
57
|
React.createElement(CustomizerShell, null),
|
|
60
|
-
|
|
58
|
+
children,
|
|
61
59
|
React.createElement(PreviewToast, { isPreviewModeEnabled: !!isPreviewModeEnabled, environment: value.contentEnvironment, previewContext: customizerMeta?.previewContext })));
|
|
62
60
|
}
|
|
63
61
|
export const PreviewProvider = PackProvider;
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "4.3.
|
|
1
|
+
export const VERSION = "4.3.2";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pack/react",
|
|
3
3
|
"description": "React",
|
|
4
|
-
"version": "4.3.
|
|
4
|
+
"version": "4.3.2",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"engines": {
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@pack/
|
|
26
|
-
"@pack/types": "^0.2.0"
|
|
25
|
+
"@pack/types": "^0.2.1"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"@types/react": "^18.2.20",
|