@gem-sdk/pages 2.0.0-dev.173 → 2.0.0-dev.194

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.
@@ -1,56 +1,97 @@
1
- 'use client';
2
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
2
  import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderProvider, Render } from '@gem-sdk/core';
3
+ import { NextSeo } from 'next-seo';
4
+ import Head from 'next/head';
5
+ import { useRouter } from 'next/router';
4
6
  import { useTrackingView } from '../libs/hooks/use-tracking-view.js';
5
7
  import { parseHtml } from '../libs/parse-html.js';
6
8
  import Header from '../components/builder/Header.js';
7
9
  import FooterForPostPurchase from '../components/FooterForPostPurchase.js';
8
10
  import Script from 'next/script';
11
+ import { useEffect } from 'react';
9
12
 
10
- const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction, pageBackground })=>{
13
+ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, dynamicDiscountOffer, isPreview, interaction, pageBackground })=>{
14
+ const router = useRouter();
11
15
  const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
12
- useTrackingView(shopToken, pageHandle);
16
+ useTrackingView(shopToken, pageHandle, router.isFallback);
17
+ const customCodeHeaderID = 'custom-code-header';
18
+ useEffect(()=>{
19
+ const customCodeHeaderElement = document.querySelectorAll(`#${customCodeHeaderID}`);
20
+ if (customCodeHeaderElement.length > 1) {
21
+ customCodeHeaderElement.forEach((script, index)=>{
22
+ if (index !== 0) script.remove();
23
+ });
24
+ }
25
+ }, []);
26
+ if (router.isFallback) {
27
+ return /*#__PURE__*/ jsx("div", {
28
+ className: "gp-flex gp-h-[100vh] gp-items-center gp-justify-center",
29
+ children: /*#__PURE__*/ jsxs("div", {
30
+ className: "gp-flex gp-gap-2",
31
+ children: [
32
+ /*#__PURE__*/ jsx("span", {
33
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"
34
+ }),
35
+ /*#__PURE__*/ jsx("span", {
36
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"
37
+ }),
38
+ /*#__PURE__*/ jsx("span", {
39
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"
40
+ })
41
+ ]
42
+ })
43
+ });
44
+ }
45
+ const hasInteraction = (interaction?.value || []).length > 0;
13
46
  return /*#__PURE__*/ jsxs(Fragment, {
14
47
  children: [
15
- parseHtml(customCodeHeader),
16
- themeStyle && /*#__PURE__*/ jsx("style", {
17
- "data-id": "global-style",
18
- type: "text/css",
19
- dangerouslySetInnerHTML: {
20
- __html: themeStyle
21
- }
48
+ /*#__PURE__*/ jsx(NextSeo, {
49
+ ...seo
22
50
  }),
23
- fontStyle && /*#__PURE__*/ jsx("style", {
24
- "data-id": "google-fonts",
25
- type: "text/css",
26
- dangerouslySetInnerHTML: {
27
- __html: fontStyle
28
- }
51
+ /*#__PURE__*/ jsxs(Head, {
52
+ children: [
53
+ parseHtml(customCodeHeaderID, customCodeHeader, true),
54
+ themeStyle && /*#__PURE__*/ jsx("style", {
55
+ "data-id": "global-style",
56
+ type: "text/css",
57
+ dangerouslySetInnerHTML: {
58
+ __html: themeStyle
59
+ }
60
+ }, "global-style"),
61
+ fontStyle && /*#__PURE__*/ jsx("style", {
62
+ "data-id": "google-fonts",
63
+ type: "text/css",
64
+ dangerouslySetInnerHTML: {
65
+ __html: fontStyle
66
+ }
67
+ }, "google-fonts"),
68
+ elementFontStyle && elementFontStyle.map((fontStyle)=>/*#__PURE__*/ jsx("style", {
69
+ "data-id": "google-element-fonts",
70
+ type: "text/css",
71
+ dangerouslySetInnerHTML: {
72
+ __html: fontStyle
73
+ }
74
+ }, fontStyle)),
75
+ customFonts && /*#__PURE__*/ jsx("style", {
76
+ "data-id": "custom-element-fonts",
77
+ type: "text/css",
78
+ dangerouslySetInnerHTML: {
79
+ __html: customFonts
80
+ }
81
+ }, fontStyle),
82
+ pageBackground?.isUsePageBackground && pageBackground?.background && /*#__PURE__*/ jsx("style", {
83
+ children: `
84
+ body {
85
+ background: ${pageBackground.background};
86
+ }
87
+ `
88
+ }, `page_background_${pageBackground?.background}`)
89
+ ]
29
90
  }),
30
- elementFontStyle && elementFontStyle.map((fontStyle)=>/*#__PURE__*/ jsx("style", {
31
- "data-id": "google-element-fonts",
32
- type: "text/css",
33
- dangerouslySetInnerHTML: {
34
- __html: fontStyle
35
- }
36
- }, fontStyle)),
37
- customFonts && /*#__PURE__*/ jsx("style", {
38
- "data-id": "custom-element-fonts",
39
- type: "text/css",
40
- dangerouslySetInnerHTML: {
41
- __html: customFonts
42
- }
43
- }, fontStyle),
44
- pageBackground?.isUsePageBackground && pageBackground?.background && /*#__PURE__*/ jsx("style", {
45
- children: `
46
- body {
47
- background: ${pageBackground.background};
48
- }
49
- `
50
- }, `page_background_${pageBackground?.background}`),
51
91
  /*#__PURE__*/ jsx(PageProvider, {
52
92
  productOffers: productOffers,
53
93
  publicStoreFrontData: publicStoreFrontData,
94
+ dynamicDiscountOffer: dynamicDiscountOffer,
54
95
  children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
55
96
  components: components,
56
97
  children: /*#__PURE__*/ jsxs("div", {
@@ -59,7 +100,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontSt
59
100
  isPostPurchase && /*#__PURE__*/ jsx(Header, {
60
101
  pageType: "POST_PURCHASE"
61
102
  }),
62
- /*#__PURE__*/ jsx("div", {
103
+ hasInteraction && /*#__PURE__*/ jsx("div", {
63
104
  dangerouslySetInnerHTML: {
64
105
  __html: `<div id="gp-interaction" style="display: none;">${JSON.stringify(interaction?.value || [])}</div>`
65
106
  }
@@ -76,9 +117,8 @@ const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontSt
76
117
  /*#__PURE__*/ jsx(Render, {
77
118
  uid: builder.uid
78
119
  }),
79
- /*#__PURE__*/ jsx(Script, {
120
+ hasInteraction && /*#__PURE__*/ jsx(Script, {
80
121
  defer: true,
81
- strategy: "lazyOnload",
82
122
  src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
83
123
  })
84
124
  ]
@@ -1,42 +1,53 @@
1
1
  'use client';
2
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderProvider, Render } from '@gem-sdk/core';
4
- import { Suspense } from 'react';
4
+ import { NextSeo } from 'next-seo';
5
+ import Head from 'next/head';
6
+ import { useRouter } from 'next/router';
5
7
 
6
- const StaticPage = ({ components, builderData, sectionData, themeStyle, fontStyle })=>{
7
- const fallbackContent = /*#__PURE__*/ jsx("div", {
8
- className: "gp-flex gp-h-[100vh] gp-items-center gp-justify-center",
9
- children: /*#__PURE__*/ jsxs("div", {
10
- className: "gp-flex gp-gap-2",
11
- children: [
12
- /*#__PURE__*/ jsx("span", {
13
- className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"
14
- }),
15
- /*#__PURE__*/ jsx("span", {
16
- className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"
17
- }),
18
- /*#__PURE__*/ jsx("span", {
19
- className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"
20
- })
21
- ]
22
- })
23
- });
24
- return /*#__PURE__*/ jsxs(Suspense, {
25
- fallback: fallbackContent,
8
+ const StaticPage = ({ components, builderData, sectionData, seo, themeStyle, fontStyle })=>{
9
+ const router = useRouter();
10
+ if (router.isFallback) {
11
+ return /*#__PURE__*/ jsx("div", {
12
+ className: "gp-flex gp-h-[100vh] gp-items-center gp-justify-center",
13
+ children: /*#__PURE__*/ jsxs("div", {
14
+ className: "gp-flex gp-gap-2",
15
+ children: [
16
+ /*#__PURE__*/ jsx("span", {
17
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"
18
+ }),
19
+ /*#__PURE__*/ jsx("span", {
20
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"
21
+ }),
22
+ /*#__PURE__*/ jsx("span", {
23
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"
24
+ })
25
+ ]
26
+ })
27
+ });
28
+ }
29
+ return /*#__PURE__*/ jsxs(Fragment, {
26
30
  children: [
27
- themeStyle && /*#__PURE__*/ jsx("style", {
28
- "data-id": "global-style",
29
- type: "text/css",
30
- dangerouslySetInnerHTML: {
31
- __html: themeStyle
32
- }
31
+ /*#__PURE__*/ jsx(NextSeo, {
32
+ ...seo
33
33
  }),
34
- fontStyle && /*#__PURE__*/ jsx("style", {
35
- "data-id": "google-fonts",
36
- type: "text/css",
37
- dangerouslySetInnerHTML: {
38
- __html: fontStyle
39
- }
34
+ /*#__PURE__*/ jsxs(Head, {
35
+ children: [
36
+ themeStyle && /*#__PURE__*/ jsx("style", {
37
+ "data-id": "global-style",
38
+ type: "text/css",
39
+ dangerouslySetInnerHTML: {
40
+ __html: themeStyle
41
+ }
42
+ }),
43
+ fontStyle && /*#__PURE__*/ jsx("style", {
44
+ "data-id": "google-fonts",
45
+ type: "text/css",
46
+ dangerouslySetInnerHTML: {
47
+ __html: fontStyle
48
+ }
49
+ })
50
+ ]
40
51
  }),
41
52
  /*#__PURE__*/ jsx(PageProvider, {
42
53
  children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
@@ -4,6 +4,7 @@ import * as next_seo from 'next-seo';
4
4
  import { NextSeoProps } from 'next-seo';
5
5
  import { AppProps } from 'next/app';
6
6
  import { SWRConfig } from 'swr';
7
+ import { OfferDynamicDiscount } from '@gem-sdk/core/src/types/appAPI';
7
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
8
9
  import { ShopMetaQueryResponse } from '@gem-sdk/adapter-shopify';
9
10
  import * as react from 'react';
@@ -41,11 +42,11 @@ type PageBuilderProps = {
41
42
  isStorefront?: boolean;
42
43
  customFonts?: string | null;
43
44
  interaction?: ShopType.Maybe<Pick<ShopType.PublishedPageInteraction, 'id' | 'value'>>;
45
+ timezone?: string;
44
46
  pageBackground?: {
45
47
  isUsePageBackground?: boolean;
46
48
  background?: string;
47
49
  };
48
- timezone?: string;
49
50
  };
50
51
  type PageBuilderPropsV2 = {
51
52
  builderData?: {
@@ -94,6 +95,7 @@ type StaticPagePropsV2 = PageBuilderPropsV2 & {
94
95
  isPostPurchase?: boolean;
95
96
  shopName?: string;
96
97
  productOffers?: ProductOffer[];
98
+ dynamicDiscountOffer?: OfferDynamicDiscount;
97
99
  publicStoreFrontData?: PublicStoreFrontData | null;
98
100
  isPreview?: boolean;
99
101
  };
@@ -123,7 +125,7 @@ declare const usePagePreview: (dataBuilder: ThemePageQueryResponse['themePage'],
123
125
  pageConfig: {
124
126
  mobileOnly: boolean;
125
127
  locale: string | null;
126
- languageIsoCode: ("ID" | "LT" | "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" | "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;
128
+ languageIsoCode: ("ID" | "LT" | "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" | "LA" | "LB" | "LU" | "LV" | "MG" | "MK" | "ML" | "MN" | "MO" | "MR" | "MS" | "MT" | "MY" | "NE" | "NL" | "NO" | "OM" | "PA" | "PL" | "PS" | "PT" | "RO" | "RU" | "RW" | "SA" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SK" | "SL" | "SN" | "SO" | "SR" | "SV" | "TA" | "TG" | "TH" | "TK" | "TO" | "TR" | "TT" | "UG" | "UZ" | "AK" | "AS" | "CE" | "CKB" | "CS" | "DA" | "EL" | "EN" | "EO" | "EU" | "FA" | "FF" | "FIL" | "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;
127
129
  countryIsoCode: ("ID" | "GT" | "LT" | "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" | "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" | "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;
128
130
  moneyFormat: string | null;
129
131
  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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "2.0.0-dev.173",
3
+ "version": "2.0.0-dev.194",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,10 +26,10 @@
26
26
  "next": "latest"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "2.0.0-dev.173",
30
- "@gem-sdk/plugin-cookie-bar": "1.58.0-dev.142",
31
- "@gem-sdk/plugin-quick-view": "1.58.0-dev.142",
32
- "@gem-sdk/plugin-sticky-add-to-cart": "1.58.0-dev.142"
29
+ "@gem-sdk/core": "2.0.0-dev.195",
30
+ "@gem-sdk/plugin-cookie-bar": "2.0.0-dev.184",
31
+ "@gem-sdk/plugin-quick-view": "2.0.0-dev.184",
32
+ "@gem-sdk/plugin-sticky-add-to-cart": "2.0.0-dev.184"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "next": ">=13"