@gem-sdk/pages 1.1.0 → 1.5.0-canary-4fb10428
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/cjs/index.js +4 -0
- package/dist/cjs/libs/api/get-home-page-props-v2.js +1 -0
- package/dist/cjs/libs/api/get-static-page-props-v2.js +1 -0
- package/dist/cjs/libs/helpers/user-agent.js +7 -0
- package/dist/cjs/libs/hooks/use-tracking-view.js +40 -0
- package/dist/cjs/pages/static-v2.js +3 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/libs/api/get-home-page-props-v2.js +1 -0
- package/dist/esm/libs/api/get-static-page-props-v2.js +1 -0
- package/dist/esm/libs/helpers/user-agent.js +5 -0
- package/dist/esm/libs/hooks/use-tracking-view.js +38 -0
- package/dist/esm/pages/static-v2.js +3 -1
- package/dist/types/index.d.ts +116 -111
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -12,6 +12,8 @@ var getStaticPagePropsPreview = require('./libs/api/get-static-page-props-previe
|
|
|
12
12
|
var fetcher = require('./libs/fetcher.js');
|
|
13
13
|
var getLayout = require('./libs/get-layout.js');
|
|
14
14
|
var genCss = require('./libs/helpers/gen-css.js');
|
|
15
|
+
var useTrackingView = require('./libs/hooks/use-tracking-view.js');
|
|
16
|
+
var userAgent = require('./libs/helpers/user-agent.js');
|
|
15
17
|
var collectionDetail = require('./pages/collection-detail.js');
|
|
16
18
|
var preview = require('./pages/preview.js');
|
|
17
19
|
var productDetail = require('./pages/product-detail.js');
|
|
@@ -44,6 +46,8 @@ exports.createFetcher = fetcher.createFetcher;
|
|
|
44
46
|
exports.createShopifyFetcher = fetcher.createShopifyFetcher;
|
|
45
47
|
exports.getLayout = getLayout.getLayout;
|
|
46
48
|
exports.genCSS = genCss.genCSS;
|
|
49
|
+
exports.useTrackingView = useTrackingView.useTrackingView;
|
|
50
|
+
exports.isBot = userAgent.isBot;
|
|
47
51
|
exports.CollectionDetailPage = collectionDetail.default;
|
|
48
52
|
exports.PreviewPage = preview.PreviewPage;
|
|
49
53
|
exports.ProductDetailPage = productDetail.default;
|
|
@@ -116,6 +116,7 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher) => async () => {
|
|
|
116
116
|
gaTrackingId: dataBuilder.themePageAnalytic?.gaTrackingID ?? null,
|
|
117
117
|
facebookPixelId: dataBuilder.themePageAnalytic?.fbPixelID ?? null,
|
|
118
118
|
tiktokPixelId: dataBuilder.themePageAnalytic?.tiktokPixelID ?? null,
|
|
119
|
+
pageHandle: dataBuilder.handle ?? null,
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
catch (err) {
|
|
@@ -121,6 +121,7 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher) => async (slug) => {
|
|
|
121
121
|
tiktokPixelId: dataBuilder.themePageAnalytic?.tiktokPixelID ?? null,
|
|
122
122
|
customCodeHeader: dataBuilder.themePageCustomCode?.header ?? null,
|
|
123
123
|
customCodeBody: dataBuilder.themePageCustomCode?.body ?? null,
|
|
124
|
+
pageHandle: dataBuilder.handle ?? null,
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
127
|
catch (err) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function isBot(input) {
|
|
4
|
+
return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(input);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
exports.isBot = isBot;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var userAgent = require('../helpers/user-agent.js');
|
|
6
|
+
|
|
7
|
+
const useTrackingView = (token, handle, isFallback) => {
|
|
8
|
+
const shopToken = token || process.env.NEXT_PUBLIC_SHOP_TOKEN;
|
|
9
|
+
const apiURL = process.env.NEXT_PUBLIC_API_URL;
|
|
10
|
+
const sendTracking = react.useCallback((handle) => {
|
|
11
|
+
if (!apiURL || !shopToken)
|
|
12
|
+
return;
|
|
13
|
+
const bot = userAgent.isBot(navigator.userAgent);
|
|
14
|
+
const variables = {
|
|
15
|
+
pageHandle: handle,
|
|
16
|
+
userAgent: bot ? 'BOT' : 'BROWSER',
|
|
17
|
+
};
|
|
18
|
+
const headers = {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
'X-GemX-Shop-Token': shopToken,
|
|
21
|
+
};
|
|
22
|
+
fetch(apiURL, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers,
|
|
25
|
+
body: JSON.stringify({
|
|
26
|
+
query: core.PageViewUpDocument,
|
|
27
|
+
variables,
|
|
28
|
+
}),
|
|
29
|
+
}).finally(() => {
|
|
30
|
+
//
|
|
31
|
+
});
|
|
32
|
+
}, [apiURL, shopToken]);
|
|
33
|
+
react.useEffect(() => {
|
|
34
|
+
if (!handle || isFallback)
|
|
35
|
+
return;
|
|
36
|
+
sendTracking(handle);
|
|
37
|
+
}, [handle, sendTracking, isFallback]);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.useTrackingView = useTrackingView;
|
|
@@ -5,10 +5,12 @@ var core = require('@gem-sdk/core');
|
|
|
5
5
|
var nextSeo = require('next-seo');
|
|
6
6
|
var Head = require('next/head');
|
|
7
7
|
var router = require('next/router');
|
|
8
|
+
var useTrackingView = require('../libs/hooks/use-tracking-view.js');
|
|
8
9
|
var parseHtml = require('../libs/parse-html.js');
|
|
9
10
|
|
|
10
|
-
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, customCodeHeader, }) => {
|
|
11
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, customCodeHeader, shopToken, pageHandle, }) => {
|
|
11
12
|
const router$1 = router.useRouter();
|
|
13
|
+
useTrackingView.useTrackingView(shopToken, pageHandle, router$1.isFallback);
|
|
12
14
|
if (router$1.isFallback) {
|
|
13
15
|
return (jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: jsxRuntime.jsxs("div", { className: "flex gap-2", children: [jsxRuntime.jsx("span", { className: "aspect-square h-2 animate-[flashing_500ms_infinite_alternate] rounded-full bg-slate-800" }), jsxRuntime.jsx("span", { className: "aspect-square h-2 animate-[flashing_500ms_infinite_200ms_linear_alternate] rounded-full bg-slate-800" }), jsxRuntime.jsx("span", { className: "aspect-square h-2 animate-[flashing_500ms_infinite_500ms_alternate] rounded-full bg-slate-800" })] }) }));
|
|
14
16
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -10,6 +10,8 @@ export { getStaticPagePropsPreview } from './libs/api/get-static-page-props-prev
|
|
|
10
10
|
export { createFetcher, createShopifyFetcher } from './libs/fetcher.js';
|
|
11
11
|
export { getLayout } from './libs/get-layout.js';
|
|
12
12
|
export { genCSS } from './libs/helpers/gen-css.js';
|
|
13
|
+
export { useTrackingView } from './libs/hooks/use-tracking-view.js';
|
|
14
|
+
export { isBot } from './libs/helpers/user-agent.js';
|
|
13
15
|
export { default as CollectionDetailPage } from './pages/collection-detail.js';
|
|
14
16
|
export { PreviewPage } from './pages/preview.js';
|
|
15
17
|
export { default as ProductDetailPage } from './pages/product-detail.js';
|
|
@@ -114,6 +114,7 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher) => async () => {
|
|
|
114
114
|
gaTrackingId: dataBuilder.themePageAnalytic?.gaTrackingID ?? null,
|
|
115
115
|
facebookPixelId: dataBuilder.themePageAnalytic?.fbPixelID ?? null,
|
|
116
116
|
tiktokPixelId: dataBuilder.themePageAnalytic?.tiktokPixelID ?? null,
|
|
117
|
+
pageHandle: dataBuilder.handle ?? null,
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
120
|
catch (err) {
|
|
@@ -119,6 +119,7 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher) => async (slug) => {
|
|
|
119
119
|
tiktokPixelId: dataBuilder.themePageAnalytic?.tiktokPixelID ?? null,
|
|
120
120
|
customCodeHeader: dataBuilder.themePageCustomCode?.header ?? null,
|
|
121
121
|
customCodeBody: dataBuilder.themePageCustomCode?.body ?? null,
|
|
122
|
+
pageHandle: dataBuilder.handle ?? null,
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
catch (err) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
function isBot(input) {
|
|
2
|
+
return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(input);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export { isBot };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PageViewUpDocument } from '@gem-sdk/core';
|
|
2
|
+
import { useCallback, useEffect } from 'react';
|
|
3
|
+
import { isBot } from '../helpers/user-agent.js';
|
|
4
|
+
|
|
5
|
+
const useTrackingView = (token, handle, isFallback) => {
|
|
6
|
+
const shopToken = token || process.env.NEXT_PUBLIC_SHOP_TOKEN;
|
|
7
|
+
const apiURL = process.env.NEXT_PUBLIC_API_URL;
|
|
8
|
+
const sendTracking = useCallback((handle) => {
|
|
9
|
+
if (!apiURL || !shopToken)
|
|
10
|
+
return;
|
|
11
|
+
const bot = isBot(navigator.userAgent);
|
|
12
|
+
const variables = {
|
|
13
|
+
pageHandle: handle,
|
|
14
|
+
userAgent: bot ? 'BOT' : 'BROWSER',
|
|
15
|
+
};
|
|
16
|
+
const headers = {
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
'X-GemX-Shop-Token': shopToken,
|
|
19
|
+
};
|
|
20
|
+
fetch(apiURL, {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
headers,
|
|
23
|
+
body: JSON.stringify({
|
|
24
|
+
query: PageViewUpDocument,
|
|
25
|
+
variables,
|
|
26
|
+
}),
|
|
27
|
+
}).finally(() => {
|
|
28
|
+
//
|
|
29
|
+
});
|
|
30
|
+
}, [apiURL, shopToken]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!handle || isFallback)
|
|
33
|
+
return;
|
|
34
|
+
sendTracking(handle);
|
|
35
|
+
}, [handle, sendTracking, isFallback]);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { useTrackingView };
|
|
@@ -3,10 +3,12 @@ import { BuilderComponentProvider, SectionProvider, BuilderProvider, Render } fr
|
|
|
3
3
|
import { NextSeo } from 'next-seo';
|
|
4
4
|
import Head from 'next/head';
|
|
5
5
|
import { useRouter } from 'next/router';
|
|
6
|
+
import { useTrackingView } from '../libs/hooks/use-tracking-view.js';
|
|
6
7
|
import { parseHtml } from '../libs/parse-html.js';
|
|
7
8
|
|
|
8
|
-
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, customCodeHeader, }) => {
|
|
9
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, customCodeHeader, shopToken, pageHandle, }) => {
|
|
9
10
|
const router = useRouter();
|
|
11
|
+
useTrackingView(shopToken, pageHandle, router.isFallback);
|
|
10
12
|
if (router.isFallback) {
|
|
11
13
|
return (jsx("div", { className: "flex h-full items-center justify-center", children: jsxs("div", { className: "flex gap-2", children: [jsx("span", { className: "aspect-square h-2 animate-[flashing_500ms_infinite_alternate] rounded-full bg-slate-800" }), jsx("span", { className: "aspect-square h-2 animate-[flashing_500ms_infinite_200ms_linear_alternate] rounded-full bg-slate-800" }), jsx("span", { className: "aspect-square h-2 animate-[flashing_500ms_infinite_500ms_alternate] rounded-full bg-slate-800" })] }) }));
|
|
12
14
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,51 +6,52 @@ import { SWRConfig } from 'swr';
|
|
|
6
6
|
import * as react from 'react';
|
|
7
7
|
import { Component } from 'react';
|
|
8
8
|
|
|
9
|
-
type PageBuilderProps = {
|
|
10
|
-
seo?: NextSeoProps;
|
|
11
|
-
builderData?: BuilderState;
|
|
12
|
-
sectionData?: Record<string, SectionData>;
|
|
13
|
-
themeStyle?: string | null;
|
|
14
|
-
fontStyle?: string | null;
|
|
15
|
-
swr?: React.ComponentProps<typeof SWRConfig>['value'];
|
|
16
|
-
plugins?: string[];
|
|
17
|
-
pageType?: ShopType.PublishedThemePageType;
|
|
18
|
-
storefrontToken?: string | null;
|
|
19
|
-
storefrontHandle?: string | null;
|
|
20
|
-
shopToken?: string | null;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
9
|
+
type PageBuilderProps = {
|
|
10
|
+
seo?: NextSeoProps;
|
|
11
|
+
builderData?: BuilderState;
|
|
12
|
+
sectionData?: Record<string, SectionData>;
|
|
13
|
+
themeStyle?: string | null;
|
|
14
|
+
fontStyle?: string | null;
|
|
15
|
+
swr?: React.ComponentProps<typeof SWRConfig>['value'];
|
|
16
|
+
plugins?: string[];
|
|
17
|
+
pageType?: ShopType.PublishedThemePageType;
|
|
18
|
+
storefrontToken?: string | null;
|
|
19
|
+
storefrontHandle?: string | null;
|
|
20
|
+
shopToken?: string | null;
|
|
21
|
+
pageHandle?: string | null;
|
|
22
|
+
currency?: string | null;
|
|
23
|
+
locale?: string | null;
|
|
24
|
+
favicon?: string | null;
|
|
25
|
+
mobileOnly?: boolean | null;
|
|
26
|
+
swatches?: any[] | null;
|
|
27
|
+
mode?: RenderMode;
|
|
28
|
+
gaTrackingId?: string | null;
|
|
29
|
+
tiktokPixelId?: string | null;
|
|
30
|
+
facebookPixelId?: string | null;
|
|
31
|
+
customCodeHeader?: string | null;
|
|
32
|
+
customCodeBody?: string | null;
|
|
33
|
+
};
|
|
34
|
+
type PageBuilderPropsV2 = {
|
|
35
|
+
builderData?: {
|
|
36
|
+
uid: string;
|
|
37
|
+
lazy?: boolean;
|
|
38
|
+
priority?: boolean;
|
|
39
|
+
data: BuilderState;
|
|
40
|
+
}[];
|
|
41
|
+
} & Omit<PageBuilderProps, 'builderData'>;
|
|
42
|
+
type AdditionalPageBuilderProps = {
|
|
43
|
+
components: Record<string, React.ComponentType<any>>;
|
|
44
|
+
};
|
|
45
|
+
type NextPageWithLayout<P = PageBuilderProps, IP = P> = NextPage<P, IP> & {
|
|
46
|
+
getLayout?: (page: React.ReactElement, pageProps?: any) => React.ReactNode;
|
|
47
|
+
};
|
|
48
|
+
type AppPropsWithLayout<P = PageBuilderProps> = AppProps<P> & {
|
|
49
|
+
Component: NextPageWithLayout;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type CollectionPageProps = PageBuilderProps & {
|
|
53
|
+
collection?: CollectionQueryResponse['collection'];
|
|
54
|
+
};
|
|
54
55
|
declare const CollectionDetailPage: React.FC<CollectionPageProps & AdditionalPageBuilderProps>;
|
|
55
56
|
|
|
56
57
|
declare const getCollectionProps: (fetcher: FetchFunc) => (handle?: string) => Promise<CollectionPageProps>;
|
|
@@ -61,12 +62,12 @@ declare const getHomePagePropsV2: (fetcher: FetchFunc, shopifyFetcher: FetchFunc
|
|
|
61
62
|
|
|
62
63
|
declare const getPreviewProps: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (pageType: ShopType.PublishedThemePageType, slug?: string) => Promise<PageBuilderProps>;
|
|
63
64
|
|
|
64
|
-
type Props$4 = Pick<PageBuilderProps, 'swr' | 'themeStyle' | 'seo' | 'currency' | 'locale' | 'swatches'>;
|
|
65
|
+
type Props$4 = Pick<PageBuilderProps, 'swr' | 'themeStyle' | 'seo' | 'currency' | 'locale' | 'swatches'>;
|
|
65
66
|
declare const getBuilderProps: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => Promise<Props$4>;
|
|
66
67
|
|
|
67
|
-
type ProductPageProps = PageBuilderProps & {
|
|
68
|
-
product?: ProductSelectFragment;
|
|
69
|
-
};
|
|
68
|
+
type ProductPageProps = PageBuilderProps & {
|
|
69
|
+
product?: ProductSelectFragment;
|
|
70
|
+
};
|
|
70
71
|
declare const ProductDetailPage: React.FC<ProductPageProps & AdditionalPageBuilderProps>;
|
|
71
72
|
|
|
72
73
|
declare const getProductProps: (fetcher: FetchFunc) => (handle?: string) => Promise<ProductPageProps>;
|
|
@@ -77,99 +78,103 @@ declare const getStaticPagePropsV2: (fetcher: FetchFunc, shopifyFetcher: FetchFu
|
|
|
77
78
|
|
|
78
79
|
declare const getStaticPagePropsPreview: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (slug: string) => Promise<PageBuilderPropsV2>;
|
|
79
80
|
|
|
80
|
-
declare const createFetcher: (token?: string | null) => FetchFunc;
|
|
81
|
+
declare const createFetcher: (token?: string | null) => FetchFunc;
|
|
81
82
|
declare const createShopifyFetcher: (storefrontToken?: string, handle?: string) => FetchFunc;
|
|
82
83
|
|
|
83
84
|
declare const getLayout: (page: React.ReactElement, pageProps?: any) => JSX.Element;
|
|
84
85
|
|
|
85
86
|
declare const genCSS: (input?: string | Record<string, any>, mobileOnly?: boolean) => string;
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
declare const useTrackingView: (token?: string | null, handle?: string | null, isFallback?: boolean) => void;
|
|
89
|
+
|
|
90
|
+
declare function isBot(input: string): boolean;
|
|
91
|
+
|
|
92
|
+
type PreviewPageProps = {
|
|
93
|
+
components: Record<string, React.ComponentType<any>>;
|
|
94
|
+
pageType: ShopType.PublishedThemePageType;
|
|
95
|
+
};
|
|
91
96
|
declare const PreviewPage: React.FC<PreviewPageProps>;
|
|
92
97
|
|
|
93
|
-
type StaticPageProps = PageBuilderProps;
|
|
98
|
+
type StaticPageProps = PageBuilderProps;
|
|
94
99
|
declare const StaticPage: React.FC<StaticPageProps & AdditionalPageBuilderProps>;
|
|
95
100
|
|
|
96
|
-
type BuilderPageProps = {
|
|
97
|
-
components: Record<string, React.ComponentType<any>>;
|
|
98
|
-
seo?: NextSeoProps;
|
|
99
|
-
themeStyle?: string | null;
|
|
100
|
-
fontStyle?: string | null;
|
|
101
|
-
header?: BuilderState;
|
|
102
|
-
footer?: BuilderState;
|
|
103
|
-
sectionData?: Record<string, SectionData>;
|
|
104
|
-
storefrontToken?: string | null;
|
|
105
|
-
storefrontHandle?: string | null;
|
|
106
|
-
shopToken?: string | null;
|
|
107
|
-
mode?: RenderMode;
|
|
108
|
-
};
|
|
101
|
+
type BuilderPageProps = {
|
|
102
|
+
components: Record<string, React.ComponentType<any>>;
|
|
103
|
+
seo?: NextSeoProps;
|
|
104
|
+
themeStyle?: string | null;
|
|
105
|
+
fontStyle?: string | null;
|
|
106
|
+
header?: BuilderState;
|
|
107
|
+
footer?: BuilderState;
|
|
108
|
+
sectionData?: Record<string, SectionData>;
|
|
109
|
+
storefrontToken?: string | null;
|
|
110
|
+
storefrontHandle?: string | null;
|
|
111
|
+
shopToken?: string | null;
|
|
112
|
+
mode?: RenderMode;
|
|
113
|
+
};
|
|
109
114
|
declare const BuilderPage: React.FC<BuilderPageProps>;
|
|
110
115
|
|
|
111
|
-
type StaticPagePropsV2 = PageBuilderPropsV2;
|
|
116
|
+
type StaticPagePropsV2 = PageBuilderPropsV2;
|
|
112
117
|
declare const StaticPageV2: React.FC<StaticPagePropsV2 & AdditionalPageBuilderProps>;
|
|
113
118
|
|
|
114
119
|
declare const getStaticPaths: GetStaticPaths;
|
|
115
120
|
|
|
116
|
-
type FontItem = {
|
|
117
|
-
family: string;
|
|
118
|
-
variants: string[];
|
|
119
|
-
subsets: string[];
|
|
120
|
-
};
|
|
121
|
-
type FontOption = {
|
|
122
|
-
display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
|
|
123
|
-
subset?: string;
|
|
124
|
-
effect?: string;
|
|
125
|
-
};
|
|
121
|
+
type FontItem = {
|
|
122
|
+
family: string;
|
|
123
|
+
variants: string[];
|
|
124
|
+
subsets: string[];
|
|
125
|
+
};
|
|
126
|
+
type FontOption = {
|
|
127
|
+
display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
|
|
128
|
+
subset?: string;
|
|
129
|
+
effect?: string;
|
|
130
|
+
};
|
|
126
131
|
declare function getFonts(fonts: FontItem[], option?: FontOption): Promise<string>;
|
|
127
132
|
|
|
128
133
|
declare const getStorefrontApi: (handle: string, provider?: 'BIGCOMMERCE' | 'SHOPIFY') => string;
|
|
129
134
|
|
|
130
|
-
type ErrorBoundaryProps = {
|
|
131
|
-
children?: React.ReactNode;
|
|
132
|
-
FallbackComponent: React.ComponentType<{
|
|
133
|
-
error?: Error;
|
|
134
|
-
resetErrorBoundary: () => void;
|
|
135
|
-
}>;
|
|
136
|
-
onError?: (error: Error, info: React.ErrorInfo) => void;
|
|
137
|
-
};
|
|
138
|
-
type ErrorBoundaryState = {
|
|
139
|
-
hasError?: boolean;
|
|
140
|
-
error?: Error;
|
|
141
|
-
};
|
|
142
|
-
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
143
|
-
state: ErrorBoundaryState;
|
|
144
|
-
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
145
|
-
reset: () => void;
|
|
146
|
-
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
147
|
-
render(): string | number | boolean | react.ReactFragment | JSX.Element | null | undefined;
|
|
135
|
+
type ErrorBoundaryProps = {
|
|
136
|
+
children?: React.ReactNode;
|
|
137
|
+
FallbackComponent: React.ComponentType<{
|
|
138
|
+
error?: Error;
|
|
139
|
+
resetErrorBoundary: () => void;
|
|
140
|
+
}>;
|
|
141
|
+
onError?: (error: Error, info: React.ErrorInfo) => void;
|
|
142
|
+
};
|
|
143
|
+
type ErrorBoundaryState = {
|
|
144
|
+
hasError?: boolean;
|
|
145
|
+
error?: Error;
|
|
146
|
+
};
|
|
147
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
148
|
+
state: ErrorBoundaryState;
|
|
149
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
150
|
+
reset: () => void;
|
|
151
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
152
|
+
render(): string | number | boolean | react.ReactFragment | JSX.Element | null | undefined;
|
|
148
153
|
}
|
|
149
154
|
|
|
150
|
-
type Props$3 = {
|
|
151
|
-
error?: Error;
|
|
152
|
-
resetErrorBoundary: () => void;
|
|
153
|
-
};
|
|
155
|
+
type Props$3 = {
|
|
156
|
+
error?: Error;
|
|
157
|
+
resetErrorBoundary: () => void;
|
|
158
|
+
};
|
|
154
159
|
declare const ErrorFallback: ({ error, resetErrorBoundary }: Props$3) => JSX.Element;
|
|
155
160
|
|
|
156
161
|
declare const Page404: () => JSX.Element;
|
|
157
162
|
|
|
158
163
|
declare const Page500: () => JSX.Element;
|
|
159
164
|
|
|
160
|
-
type Props$2 = {
|
|
161
|
-
trackingId?: string | null;
|
|
162
|
-
};
|
|
165
|
+
type Props$2 = {
|
|
166
|
+
trackingId?: string | null;
|
|
167
|
+
};
|
|
163
168
|
declare const GoogleAnalytic: ({ trackingId }: Props$2) => JSX.Element | null;
|
|
164
169
|
|
|
165
|
-
type Props$1 = {
|
|
166
|
-
pixelId?: string | null;
|
|
167
|
-
};
|
|
170
|
+
type Props$1 = {
|
|
171
|
+
pixelId?: string | null;
|
|
172
|
+
};
|
|
168
173
|
declare const FacebookPixel: ({ pixelId }: Props$1) => JSX.Element | null;
|
|
169
174
|
|
|
170
|
-
type Props = {
|
|
171
|
-
pixelId?: string | null;
|
|
172
|
-
};
|
|
175
|
+
type Props = {
|
|
176
|
+
pixelId?: string | null;
|
|
177
|
+
};
|
|
173
178
|
declare const TikTokPixel: ({ pixelId }: Props) => JSX.Element | null;
|
|
174
179
|
|
|
175
|
-
export { AppPropsWithLayout, BuilderPage, CollectionDetailPage, CollectionPageProps, ErrorBoundary, ErrorFallback, FacebookPixel, GoogleAnalytic, NextPageWithLayout, Page404, Page500, PageBuilderProps, PreviewPage, ProductDetailPage, ProductPageProps, StaticPage, StaticPageProps, StaticPagePropsV2, StaticPageV2, TikTokPixel, createFetcher, createShopifyFetcher, genCSS, getBuilderProps, getCollectionProps, getFonts, getHomePageProps, getHomePagePropsV2, getLayout, getPreviewProps, getProductProps, getStaticPageProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi };
|
|
180
|
+
export { AppPropsWithLayout, BuilderPage, CollectionDetailPage, CollectionPageProps, ErrorBoundary, ErrorFallback, FacebookPixel, GoogleAnalytic, NextPageWithLayout, Page404, Page500, PageBuilderProps, PreviewPage, ProductDetailPage, ProductPageProps, StaticPage, StaticPageProps, StaticPagePropsV2, StaticPageV2, TikTokPixel, createFetcher, createShopifyFetcher, genCSS, getBuilderProps, getCollectionProps, getFonts, getHomePageProps, getHomePagePropsV2, getLayout, getPreviewProps, getProductProps, getStaticPageProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, useTrackingView };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-canary-4fb10428",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"next-seo": "^5.15.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@gem-sdk/core": "
|
|
28
|
+
"@gem-sdk/core": "1.5.0-canary-4fb10428",
|
|
29
29
|
"@gem-sdk/plugin-cookie-bar": "*",
|
|
30
30
|
"@gem-sdk/plugin-quick-view": "*",
|
|
31
31
|
"@gem-sdk/plugin-sticky-add-to-cart": "*"
|