@pack/react 4.0.0 → 4.2.0
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 +53 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/pack/pack-context.d.ts +5 -1
- package/dist/pack/pack-context.d.ts.map +1 -1
- package/dist/pack/pack-context.js +5 -2
- package/dist/pack/pack-debug.d.ts +22 -0
- package/dist/pack/pack-debug.d.ts.map +1 -0
- package/dist/pack/pack-debug.js +105 -0
- package/dist/version.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1 +1,53 @@
|
|
|
1
|
-
# react
|
|
1
|
+
# `@pack/react`
|
|
2
|
+
|
|
3
|
+
React UI primitives for rendering Pack content and storefront configuration.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @pack/react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Main exports
|
|
12
|
+
|
|
13
|
+
- `PackProvider` / `PreviewProvider`
|
|
14
|
+
- `RenderSections`, `useSections`
|
|
15
|
+
- `registerSection`
|
|
16
|
+
- `registerStorefrontSettingsSchema`
|
|
17
|
+
- `usePackContext`, `useSiteSettings`, `useLocale`
|
|
18
|
+
- `PackErrorBoundary`
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { PackProvider, RenderSections } from '@pack/react';
|
|
24
|
+
|
|
25
|
+
export function App({
|
|
26
|
+
sections,
|
|
27
|
+
siteSettings,
|
|
28
|
+
packSessionId,
|
|
29
|
+
isPreviewModeEnabled,
|
|
30
|
+
packErrorTracking,
|
|
31
|
+
}: Props) {
|
|
32
|
+
return (
|
|
33
|
+
<PackProvider
|
|
34
|
+
siteSettings={siteSettings}
|
|
35
|
+
packSessionId={packSessionId}
|
|
36
|
+
isPreviewModeEnabled={isPreviewModeEnabled}
|
|
37
|
+
packErrorTracking={packErrorTracking}
|
|
38
|
+
>
|
|
39
|
+
<RenderSections sections={sections} />
|
|
40
|
+
</PackProvider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`packSessionId` and `packErrorTracking` can be passed from `...pack.getPackContextData()` when using `@pack/hydrogen`.
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
yarn
|
|
51
|
+
yarn build
|
|
52
|
+
yarn test
|
|
53
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { 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";
|
|
4
5
|
import { useSiteSettings } from "./use-site-settings";
|
|
5
6
|
import { useLocale } from "./use-locale";
|
|
6
7
|
import { useOverlayScript } from "./use-overlay-script";
|
|
7
8
|
import { registerSection } from "./register-section";
|
|
8
9
|
import { registerStorefrontSettingsSchema } from "./register-storefront-settings-schema";
|
|
9
|
-
export {
|
|
10
|
+
export type { ErrorTrackingOptions, PackErrorBoundaryFallbackRenderArgs, } from "@pack/errors-react";
|
|
11
|
+
export { PackErrorBoundary, PackProvider, PreviewProvider, RenderSections, registerSection, registerStorefrontSettingsSchema, useLocale, useOverlayScript, usePackContext, useSections, useSiteSettings, };
|
|
10
12
|
//# 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,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB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AAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { 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";
|
|
4
5
|
import { useSiteSettings } from "./use-site-settings";
|
|
5
6
|
import { useLocale } from "./use-locale";
|
|
6
7
|
import { useOverlayScript } from "./use-overlay-script";
|
|
7
8
|
import { registerSection } from "./register-section";
|
|
8
9
|
import { registerStorefrontSettingsSchema } from "./register-storefront-settings-schema";
|
|
9
|
-
export { PackProvider, PreviewProvider, RenderSections, registerSection, registerStorefrontSettingsSchema, useLocale, useOverlayScript, usePackContext, useSections, useSiteSettings, };
|
|
10
|
+
export { PackErrorBoundary, PackProvider, PreviewProvider, RenderSections, registerSection, registerStorefrontSettingsSchema, useLocale, useOverlayScript, usePackContext, useSections, useSiteSettings, };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React, { type ReactNode } from "react";
|
|
2
|
+
import { type ErrorTrackingOptions } from "@pack/errors-react";
|
|
3
|
+
import "./pack-debug";
|
|
2
4
|
type PackContextValue = {
|
|
3
5
|
isPreview: boolean;
|
|
4
6
|
customizerMeta?: {
|
|
@@ -34,6 +36,7 @@ export declare const usePackContext: () => PackContextValue;
|
|
|
34
36
|
interface PackContentProps {
|
|
35
37
|
children: ReactNode;
|
|
36
38
|
siteSettings: any;
|
|
39
|
+
packSessionId?: string;
|
|
37
40
|
isPreviewModeEnabled?: boolean;
|
|
38
41
|
customizerMeta?: PackContextValue["customizerMeta"];
|
|
39
42
|
contentEnvironment?: string;
|
|
@@ -42,8 +45,9 @@ interface PackContentProps {
|
|
|
42
45
|
country: string;
|
|
43
46
|
} | null;
|
|
44
47
|
liveContent?: any;
|
|
48
|
+
packErrorTracking?: ErrorTrackingOptions;
|
|
45
49
|
}
|
|
46
|
-
export declare function PackProvider({ children, isPreviewModeEnabled, siteSettings: previewStorefrontSettings, customizerMeta, contentEnvironment, locale: previewLocale, }: PackContentProps): React.JSX.Element;
|
|
50
|
+
export declare function PackProvider({ children, packSessionId, isPreviewModeEnabled, siteSettings: previewStorefrontSettings, customizerMeta, contentEnvironment, locale: previewLocale, packErrorTracking, }: PackContentProps): React.JSX.Element;
|
|
47
51
|
export declare const PreviewProvider: typeof PackProvider;
|
|
48
52
|
export {};
|
|
49
53
|
//# 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;AAEf,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAC;AAI5B,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,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,YAAY,EAAE,GAAG,CAAC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ext, useContext, useState, useMemo, useEffect, } from "react";
|
|
2
2
|
import { usePackTrack } from "./pack-analytics";
|
|
3
|
+
import { usePackErrorTrack, PackErrorBoundary, } from "@pack/errors-react";
|
|
3
4
|
import { PreviewToast } from "./preview-toast";
|
|
4
5
|
import { useOverlayScript } from "../use-overlay-script";
|
|
5
6
|
import { useCustomizerShell } from "../use-customizer-shell";
|
|
7
|
+
import "./pack-debug";
|
|
6
8
|
export const PackContext = createContext({
|
|
7
9
|
isPreview: false,
|
|
8
10
|
setSiteSettings: () => { },
|
|
@@ -22,7 +24,7 @@ const CustomizerShell = () => {
|
|
|
22
24
|
useOverlayScript();
|
|
23
25
|
return null;
|
|
24
26
|
};
|
|
25
|
-
export function PackProvider({ children, isPreviewModeEnabled = false, siteSettings: previewStorefrontSettings, customizerMeta, contentEnvironment = "", locale: previewLocale = null, }) {
|
|
27
|
+
export function PackProvider({ children, packSessionId, isPreviewModeEnabled = false, siteSettings: previewStorefrontSettings, customizerMeta, contentEnvironment = "", locale: previewLocale = null, packErrorTracking, }) {
|
|
26
28
|
const [liveContent, setLiveContent] = useState(null);
|
|
27
29
|
const [siteSettings, setSiteSettings] = useState(previewStorefrontSettings);
|
|
28
30
|
const [locale, setLocale] = useState(previewLocale);
|
|
@@ -52,9 +54,10 @@ export function PackProvider({ children, isPreviewModeEnabled = false, siteSetti
|
|
|
52
54
|
setSiteSettings(previewStorefrontSettings);
|
|
53
55
|
}, [previewStorefrontSettings]);
|
|
54
56
|
usePackTrack();
|
|
57
|
+
usePackErrorTrack(!!isPreviewModeEnabled, packErrorTracking, packSessionId);
|
|
55
58
|
return (React.createElement(PackContext.Provider, { value: value },
|
|
56
59
|
React.createElement(CustomizerShell, null),
|
|
57
|
-
children,
|
|
60
|
+
React.createElement(PackErrorBoundary, { errorTracking: packErrorTracking, sessionId: packSessionId }, children),
|
|
58
61
|
React.createElement(PreviewToast, { isPreviewModeEnabled: !!isPreviewModeEnabled, environment: value.contentEnvironment, previewContext: customizerMeta?.previewContext })));
|
|
59
62
|
}
|
|
60
63
|
export const PreviewProvider = PackProvider;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface StorefrontTestInfo {
|
|
2
|
+
test: string;
|
|
3
|
+
variant: string;
|
|
4
|
+
expiresAt: string | null;
|
|
5
|
+
}
|
|
6
|
+
interface StorefrontTestRulesCacheInfo {
|
|
7
|
+
rulesCount: number;
|
|
8
|
+
cachedAt: string;
|
|
9
|
+
ageSeconds: number;
|
|
10
|
+
isFresh: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface PackDebugHelpers {
|
|
13
|
+
getTestInfo(): StorefrontTestInfo | null;
|
|
14
|
+
getTestRulesCacheInfo(): StorefrontTestRulesCacheInfo | null;
|
|
15
|
+
}
|
|
16
|
+
declare global {
|
|
17
|
+
interface Window {
|
|
18
|
+
packDebug?: PackDebugHelpers;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=pack-debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-debug.d.ts","sourceRoot":"","sources":["../../src/pack/pack-debug.ts"],"names":[],"mappings":"AAmBA,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,UAAU,4BAA4B;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,gBAAgB;IACxB,WAAW,IAAI,kBAAkB,GAAG,IAAI,CAAC;IACzC,qBAAqB,IAAI,4BAA4B,GAAG,IAAI,CAAC;CAC9D;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,SAAS,CAAC,EAAE,gBAAgB,CAAC;KAC9B;CACF;AA0HD,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Must mirror @pack/hydrogen/src/constants.ts (PACK_TEST_COOKIE_ID).
|
|
2
|
+
const PACK_TEST_COOKIE_ID = "__pack_test";
|
|
3
|
+
// Must mirror @pack/hydrogen/src/tests/test.ts cacheStrategy.maxAge (1 hour).
|
|
4
|
+
// Keep this in sync with @pack/hydrogen/src/session/test-session.ts default cacheDurationMs.
|
|
5
|
+
const TEST_RULES_CACHE_TTL_SECONDS = 3600;
|
|
6
|
+
function getCookieValue(cookieHeader, name) {
|
|
7
|
+
const prefix = `${name}=`;
|
|
8
|
+
const values = cookieHeader.split(";");
|
|
9
|
+
for (const value of values) {
|
|
10
|
+
const cookie = value.trim();
|
|
11
|
+
if (cookie.startsWith(prefix)) {
|
|
12
|
+
return cookie.slice(prefix.length);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
function decodeCookieValue(value) {
|
|
18
|
+
try {
|
|
19
|
+
return decodeURIComponent(value);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function decodeBase64Value(value) {
|
|
26
|
+
try {
|
|
27
|
+
const binary = atob(value);
|
|
28
|
+
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
29
|
+
return new TextDecoder().decode(bytes);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function parseTestSessionCookie(cookieHeader) {
|
|
36
|
+
const rawValue = getCookieValue(cookieHeader, PACK_TEST_COOKIE_ID);
|
|
37
|
+
if (!rawValue) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const decodedValue = decodeCookieValue(rawValue);
|
|
41
|
+
const signatureDelimiterIndex = decodedValue.lastIndexOf(".");
|
|
42
|
+
const unsignedValue = signatureDelimiterIndex === -1
|
|
43
|
+
? decodedValue
|
|
44
|
+
: decodedValue.slice(0, signatureDelimiterIndex);
|
|
45
|
+
const payload = decodeBase64Value(unsignedValue);
|
|
46
|
+
if (!payload) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const parsed = JSON.parse(payload);
|
|
51
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
function getStorefrontTestInfo() {
|
|
61
|
+
const payload = parseTestSessionCookie(document.cookie || "");
|
|
62
|
+
const test = payload?.test_data?.handle;
|
|
63
|
+
const variant = payload?.test_data?.testVariant?.handle;
|
|
64
|
+
if (!test || !variant) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
test,
|
|
69
|
+
variant,
|
|
70
|
+
expiresAt: payload?.test_expire_at || null,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function getStorefrontTestRulesCacheInfo() {
|
|
74
|
+
const payload = parseTestSessionCookie(document.cookie || "");
|
|
75
|
+
const timestamp = payload?.test_rules_cache_timestamp;
|
|
76
|
+
if (typeof timestamp !== "number" || Number.isNaN(timestamp)) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const cachedAtDate = new Date(timestamp);
|
|
80
|
+
if (Number.isNaN(cachedAtDate.getTime())) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const ageSeconds = Math.max(0, Math.floor((Date.now() - timestamp) / 1000));
|
|
84
|
+
const rulesCount = Array.isArray(payload?.test_rules_cache)
|
|
85
|
+
? payload.test_rules_cache.length
|
|
86
|
+
: 0;
|
|
87
|
+
return {
|
|
88
|
+
rulesCount,
|
|
89
|
+
cachedAt: cachedAtDate.toISOString(),
|
|
90
|
+
ageSeconds,
|
|
91
|
+
isFresh: ageSeconds < TEST_RULES_CACHE_TTL_SECONDS,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function initializePackDebugHelpers() {
|
|
95
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
window.packDebug = {
|
|
99
|
+
...window.packDebug,
|
|
100
|
+
getTestInfo: getStorefrontTestInfo,
|
|
101
|
+
getTestRulesCacheInfo: getStorefrontTestRulesCacheInfo,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
initializePackDebugHelpers();
|
|
105
|
+
export {};
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "4.
|
|
1
|
+
export const VERSION = "4.2.0";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pack/react",
|
|
3
3
|
"description": "React",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.2.0",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"engines": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@pack/errors-react": "^0.1.1",
|
|
25
26
|
"@pack/types": "^0.1.4"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|