@gem-sdk/pages 1.23.0-staging.358 → 1.23.0-staging.384

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.
@@ -14,6 +14,9 @@ import Toolbar from '../components/builder/Toolbar.js';
14
14
 
15
15
  const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar })=>{
16
16
  const [loadSuccess, setLoadSuccess] = useState(false);
17
+ const isDisableHeaderFooter = ()=>{
18
+ return isThemeSectionEditor;
19
+ };
17
20
  const initState = useMemo(()=>({
18
21
  ROOT: {
19
22
  uid: 'ROOT',
@@ -63,12 +66,14 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
63
66
  loadSuccess && /*#__PURE__*/ jsxs("div", {
64
67
  className: "builder gp-z-1 gp-relative",
65
68
  children: [
66
- !hiddenToolbar && (isThemeSectionEditor ? /*#__PURE__*/ jsx("div", {
67
- className: "gp-h-[40px] gp-bg-[#f4f4f4]"
68
- }) : /*#__PURE__*/ jsx(Header, {})),
69
+ !hiddenToolbar && (isDisableHeaderFooter() ? /*#__PURE__*/ jsx("div", {
70
+ className: "h-[40px] bg-[#f4f4f4]"
71
+ }) : /*#__PURE__*/ jsx(Header, {
72
+ pageType: pageType
73
+ })),
69
74
  /*#__PURE__*/ jsx("div", {
70
75
  id: "storefront",
71
- className: isThemeSectionEditor ? 'theme-section-editor' : '',
76
+ className: `${isThemeSectionEditor ? 'theme-section-editor' : ''} ${pageType === 'POST_PURCHASE' ? 'post-purchase-page' : ''}`,
72
77
  children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
73
78
  children: /*#__PURE__*/ jsx(RenderPreview, {
74
79
  uid: "ROOT"
@@ -86,7 +91,9 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
86
91
  /*#__PURE__*/ jsx("div", {
87
92
  id: "visual-content"
88
93
  }),
89
- !isThemeSectionEditor && !hiddenToolbar && /*#__PURE__*/ jsx(Footer, {})
94
+ !isDisableHeaderFooter() && !hiddenToolbar && /*#__PURE__*/ jsx(Footer, {
95
+ pageType: pageType
96
+ })
90
97
  ]
91
98
  })
92
99
  ]
@@ -5,8 +5,10 @@ import Head from 'next/head';
5
5
  import { useRouter } from 'next/router';
6
6
  import { useTrackingView } from '../libs/hooks/use-tracking-view.js';
7
7
  import { parseHtml } from '../libs/parse-html.js';
8
+ import Header from '../components/Header.js';
9
+ import FooterForPostPurchase from '../components/FooterForPostPurchase.js';
8
10
 
9
- const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle })=>{
11
+ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, isPostPurchase, shopName })=>{
10
12
  const router = useRouter();
11
13
  useTrackingView(shopToken, pageHandle, router.isFallback);
12
14
  if (router.isFallback) {
@@ -60,19 +62,28 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
60
62
  ]
61
63
  }),
62
64
  /*#__PURE__*/ jsx(PageProvider, {
63
- children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
65
+ children: /*#__PURE__*/ jsxs(BuilderComponentProvider, {
64
66
  components: components,
65
- children: /*#__PURE__*/ jsx(SectionProvider, {
66
- data: sectionData,
67
- children: builderData?.map((builder)=>/*#__PURE__*/ jsx(BuilderProvider, {
68
- state: builder.data,
69
- lazy: builder.lazy,
70
- priority: builder.priority,
71
- children: /*#__PURE__*/ jsx(Render, {
72
- uid: builder.uid
73
- })
74
- }, builder.uid))
75
- })
67
+ children: [
68
+ isPostPurchase && /*#__PURE__*/ jsx(Header, {
69
+ pageType: "POST_PURCHASE"
70
+ }),
71
+ /*#__PURE__*/ jsx(SectionProvider, {
72
+ data: sectionData,
73
+ children: builderData?.map((builder)=>/*#__PURE__*/ jsx(BuilderProvider, {
74
+ state: builder.data,
75
+ lazy: builder.lazy,
76
+ priority: builder.priority,
77
+ isPostPurchase: isPostPurchase,
78
+ children: /*#__PURE__*/ jsx(Render, {
79
+ uid: builder.uid
80
+ })
81
+ }, builder.uid))
82
+ }),
83
+ isPostPurchase && /*#__PURE__*/ jsx(FooterForPostPurchase, {
84
+ shopName: shopName || ''
85
+ })
86
+ ]
76
87
  })
77
88
  })
78
89
  ]
@@ -1,9 +1,11 @@
1
- import { BuilderState, SectionData as SectionData$1, ShopType, RenderMode, CollectionQueryResponse, FetchFunc, ProductSelectFragment, PublishedThemePageSelectFragment } from '@gem-sdk/core';
1
+ import { BuilderState, SectionData as SectionData$1, ShopType, RenderMode, CollectionQueryResponse, FetchFunc, ProductSelectFragment, ThemePageQueryResponse, StorePropertyQueryResponse, PublishedThemePageSelectFragment } from '@gem-sdk/core';
2
2
  import { NextPage, GetStaticPaths } from 'next';
3
+ import * as next_seo from 'next-seo';
3
4
  import { NextSeoProps } from 'next-seo';
4
5
  import { AppProps } from 'next/app';
5
6
  import { SWRConfig } from 'swr';
6
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
8
+ import { ShopMetaQueryResponse } from '@gem-sdk/adapter-shopify';
7
9
  import * as react from 'react';
8
10
  import { Component } from 'react';
9
11
 
@@ -81,9 +83,12 @@ declare const getProductProps: (fetcher: FetchFunc) => (handle?: string) => Prom
81
83
 
82
84
  declare const getStaticPagePropsV2: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (slug: string) => Promise<PageBuilderPropsV2>;
83
85
 
86
+ declare const getPostPurchasePropsPreview: (fetcher: FetchFunc, shopifyFetcher: FetchFunc, isTemplate?: boolean) => (id: string) => Promise<PageBuilderPropsV2>;
87
+
84
88
  declare const getStaticPagePropsPreview: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (slug: string) => Promise<PageBuilderPropsV2>;
85
89
 
86
90
  declare const createFetcher: (token?: string | null) => FetchFunc;
91
+ declare const createAppAPIFetcher: (token?: string | null, shopID?: string) => FetchFunc;
87
92
  declare const createShopifyFetcher: (storefrontToken?: string, handle?: string) => FetchFunc;
88
93
 
89
94
  declare const getLayout: (page: React.ReactElement, pageProps?: any) => react_jsx_runtime.JSX.Element;
@@ -92,6 +97,19 @@ declare const genCSS: (input?: string | Record<string, any>, mobileOnly?: boolea
92
97
 
93
98
  declare const useTrackingView: (token?: string | null, handle?: string | null, isFallback?: boolean) => void;
94
99
 
100
+ declare const usePagePreview: (dataBuilder: ThemePageQueryResponse['themePage'], storeProperty: PromiseSettledResult<StorePropertyQueryResponse>, shopifyMeta: PromiseSettledResult<ShopMetaQueryResponse>) => {
101
+ seo: next_seo.NextSeoProps;
102
+ pageConfig: {
103
+ mobileOnly: boolean;
104
+ locale: string | null;
105
+ languageIsoCode: ("ID" | "AF" | "AM" | "AR" | "AZ" | "BE" | "BG" | "BM" | "BN" | "BO" | "BR" | "BS" | "CA" | "CU" | "CY" | "DE" | "DZ" | "EE" | "ES" | "ET" | "FI" | "FO" | "FR" | "GA" | "GD" | "GL" | "HR" | "HU" | "IS" | "IT" | "KI" | "KM" | "KN" | "KW" | "KY" | "LB" | "LT" | "LU" | "LV" | "MG" | "MK" | "ML" | "MN" | "MR" | "MS" | "MT" | "MY" | "NE" | "NL" | "NO" | "OM" | "PA" | "PL" | "PS" | "PT" | "RO" | "RU" | "RW" | "SD" | "SE" | "SG" | "SI" | "SK" | "SL" | "SN" | "SO" | "SR" | "SV" | "TA" | "TG" | "TH" | "TK" | "TO" | "TR" | "TT" | "UG" | "UZ" | "AK" | "AS" | "CE" | "CS" | "DA" | "EL" | "EN" | "EO" | "EU" | "FA" | "FF" | "FY" | "GU" | "GV" | "HA" | "HE" | "HI" | "HY" | "IA" | "IG" | "II" | "JA" | "JV" | "KA" | "KK" | "KL" | "KO" | "KS" | "KU" | "LG" | "LN" | "LO" | "MI" | "NB" | "ND" | "NN" | "OR" | "OS" | "PT_BR" | "PT_PT" | "QU" | "RM" | "RN" | "SQ" | "SU" | "SW" | "TE" | "TI" | "UK" | "UR" | "VI" | "VO" | "WO" | "XH" | "YI" | "YO" | "ZH" | "ZH_CN" | "ZH_TW" | "ZU") | null;
106
+ countryIsoCode: ("ID" | "AC" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AN" | "AO" | "AR" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MK" | "ML" | "MM" | "MN" | "MO" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PS" | "PT" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TA" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VN" | "VU" | "WF" | "WS" | "XK" | "YE" | "YT" | "ZA" | "ZM" | "ZW" | "ZZ") | null;
107
+ moneyFormat: string | null;
108
+ currency: ("AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BYR" | "BZD" | "CAD" | "CDF" | "CHF" | "CLP" | "CNY" | "COP" | "CRC" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JEP" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KID" | "KMF" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LTL" | "LVL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "SSP" | "STD" | "STN" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "UYU" | "UZS" | "VED" | "VEF" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XOF" | "XPF" | "XXX" | "YER" | "ZAR" | "ZMW") | null;
109
+ swatches: any;
110
+ };
111
+ };
112
+
95
113
  declare function isBot(input: string): boolean;
96
114
 
97
115
  type SectionData = {
@@ -151,7 +169,10 @@ type BuilderPageProps = {
151
169
  };
152
170
  declare const BuilderPage: React.FC<BuilderPageProps>;
153
171
 
154
- type StaticPagePropsV2 = PageBuilderPropsV2;
172
+ type StaticPagePropsV2 = PageBuilderPropsV2 & {
173
+ isPostPurchase?: boolean;
174
+ shopName?: string;
175
+ };
155
176
  declare const StaticPageV2: React.FC<StaticPagePropsV2 & AdditionalPageBuilderProps>;
156
177
 
157
178
  declare const getStaticPaths: GetStaticPaths;
@@ -220,4 +241,4 @@ type Props = {
220
241
  };
221
242
  declare const TikTokPixel: ({ pixelId }: Props) => react_jsx_runtime.JSX.Element | null;
222
243
 
223
- 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, getFallbackV2, getFontFromGlobalStyle, getFontFromGroupSetting, getFonts, getFontsFromDataBuilder, getHomePageProps, getHomePagePropsV2, getLayout, getPreviewProps, getProductProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, normalizePageSectionResponseV2, parseBuilderTemplateV2, retryWithDelay, useTrackingView };
244
+ export { AppPropsWithLayout, BuilderPage, CollectionDetailPage, CollectionPageProps, ErrorBoundary, ErrorFallback, FacebookPixel, GoogleAnalytic, NextPageWithLayout, Page404, Page500, PageBuilderProps, PreviewPage, ProductDetailPage, ProductPageProps, StaticPage, StaticPageProps, StaticPagePropsV2, StaticPageV2, TikTokPixel, createAppAPIFetcher, createFetcher, createShopifyFetcher, genCSS, getBuilderProps, getCollectionProps, getFallbackV2, getFontFromGlobalStyle, getFontFromGroupSetting, getFonts, getFontsFromDataBuilder, getHomePageProps, getHomePagePropsV2, getLayout, getPostPurchasePropsPreview, getPreviewProps, getProductProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, normalizePageSectionResponseV2, parseBuilderTemplateV2, retryWithDelay, usePagePreview, useTrackingView };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "1.23.0-staging.358",
3
+ "version": "1.23.0-staging.384",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,10 +25,10 @@
25
25
  "next-seo": "^6.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@gem-sdk/core": "1.23.0-staging.358",
29
- "@gem-sdk/plugin-cookie-bar": "1.23.0-staging.26",
30
- "@gem-sdk/plugin-quick-view": "1.23.0-staging.26",
31
- "@gem-sdk/plugin-sticky-add-to-cart": "1.23.0-staging.26"
28
+ "@gem-sdk/core": "1.23.0-staging.384",
29
+ "@gem-sdk/plugin-cookie-bar": "1.23.0-staging.383",
30
+ "@gem-sdk/plugin-quick-view": "1.23.0-staging.383",
31
+ "@gem-sdk/plugin-sticky-add-to-cart": "1.23.0-staging.383"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "next": ">=13"