@tfehotels/tfe-gatsby-library 1.0.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 +41 -0
- package/lib/index.browser.cjs +2 -0
- package/lib/index.browser.cjs.map +1 -0
- package/lib/index.browser.d.ts +640 -0
- package/lib/index.browser.esm.js +2 -0
- package/lib/index.browser.esm.js.map +1 -0
- package/lib/index.node.cjs +2 -0
- package/lib/index.node.cjs.map +1 -0
- package/lib/index.node.d.ts +116 -0
- package/lib/index.node.esm.js +2 -0
- package/lib/index.node.esm.js.map +1 -0
- package/package.json +84 -0
- package/src/browser/api/button/index.tsx +16 -0
- package/src/browser/api/button/types.ts +7 -0
- package/src/browser/api/checkbox/index.tsx +74 -0
- package/src/browser/api/checkbox/types.tsx +21 -0
- package/src/browser/api/country-prefix/index.tsx +150 -0
- package/src/browser/api/country-prefix/types.tsx +17 -0
- package/src/browser/api/form/index.tsx +330 -0
- package/src/browser/api/form/types.ts +31 -0
- package/src/browser/api/google-places/index.tsx +90 -0
- package/src/browser/api/google-places/types.ts +24 -0
- package/src/browser/api/icon/index.tsx +26 -0
- package/src/browser/api/icon/types.tsx +24 -0
- package/src/browser/api/image/index.tsx +91 -0
- package/src/browser/api/image/types.ts +11 -0
- package/src/browser/api/input/index.tsx +44 -0
- package/src/browser/api/input/types.ts +10 -0
- package/src/browser/api/link/index.tsx +54 -0
- package/src/browser/api/link/types.ts +24 -0
- package/src/browser/api/linklist/index.tsx +17 -0
- package/src/browser/api/linklist/types.ts +6 -0
- package/src/browser/api/select/index.tsx +99 -0
- package/src/browser/api/select/types.ts +24 -0
- package/src/browser/api/svg/index.tsx +8 -0
- package/src/browser/api/svg/types.ts +8 -0
- package/src/browser/api/text/index.tsx +14 -0
- package/src/browser/api/text/types.ts +12 -0
- package/src/browser/api/textarea/index.tsx +12 -0
- package/src/browser/api/title/index.tsx +19 -0
- package/src/browser/api/title/types.ts +10 -0
- package/src/browser/api/types.ts +245 -0
- package/src/browser/carousel/buttons/index.tsx +81 -0
- package/src/browser/carousel/buttons/types.ts +15 -0
- package/src/browser/carousel/dots/index.tsx +53 -0
- package/src/browser/carousel/dots/types.ts +14 -0
- package/src/browser/carousel/index.tsx +131 -0
- package/src/browser/carousel/types.ts +21 -0
- package/src/browser/markdown/index.tsx +41 -0
- package/src/browser/markdown/types.ts +11 -0
- package/src/browser/modal/index.tsx +35 -0
- package/src/browser/modal/types.ts +9 -0
- package/src/browser/spinner/index.tsx +19 -0
- package/src/browser/spinner/types.ts +5 -0
- package/src/browser/toast/index.tsx +84 -0
- package/src/browser/use_viewport/index.tsx +34 -0
- package/src/browser/use_viewport/types.ts +5 -0
- package/src/browser/utils/animation.ts +12 -0
- package/src/browser/utils/booking_engine.ts +180 -0
- package/src/browser/utils/eclub.ts +30 -0
- package/src/browser/utils/forms.ts +76 -0
- package/src/browser/utils/hotel.ts +25 -0
- package/src/browser/utils/image.ts +63 -0
- package/src/browser/utils/location.ts +213 -0
- package/src/browser/utils/notifications.tsx +25 -0
- package/src/browser/utils/number.ts +6 -0
- package/src/browser/utils/requests.ts +2 -0
- package/src/browser/utils/search.ts +25 -0
- package/src/browser/utils/string.ts +9 -0
- package/src/browser/utils/types.ts +106 -0
- package/src/browser/utils/url.ts +116 -0
- package/src/browser/utils/viewport.ts +59 -0
- package/src/index.browser.ts +103 -0
- package/src/index.node.ts +16 -0
- package/src/node/api/index.ts +174 -0
- package/src/node/api/types.ts +19 -0
- package/src/node/build/index.ts +142 -0
- package/src/node/build/types.ts +5 -0
- package/src/node/config/index.ts +149 -0
- package/src/node/form/index.ts +23 -0
- package/src/node/form/types.ts +3 -0
- package/src/node/property/index.ts +78 -0
- package/src/node/property/types.ts +25 -0
- package/src/node/url/index.ts +8 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=(e,s)=>`${e.replace(new RegExp("/$"),"")}/${s.replace(new RegExp("^/"),"")}`,s=module.require("slugify"),t=module.require("fs"),r=async e=>{let s=[];for(const t of e.body)s.push(await a(t,{slug:e.slug,tags:e.tags,data:e.data}));return e.body=s,e},n=e=>{JSON.parse(t.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,"utf-8")).forEach((s=>{e({fromPath:s.page,toPath:s.redirection,isPermanent:"301"===s.type,force:!0})}))},a=async(e,s)=>{const r=`${process.env.GATSBY_PROJECT_ROOT}/src/components/element/${e.type}/${e.name}/build.js`;if(t.existsSync(r)){const t=await import(r);if(t?.build)return await t.build(e,s)}else"development"===process.env.ENV&&console.warn(`build.js file not found: ${r}`);return e},{getImage:o,withArtDirection:i}=module.require("gatsby-plugin-image"),p=(s="",t=null)=>`${e(`${process.env.API_PROTOCOL}://${process.env.API_HOST}`,s)}${t?`?${new URLSearchParams(t).toString()}`:""}`,c=e=>{if(!e)return;let s={src:e.url,sizes:"100vw",srcSet:""},t=[],r={fallback:e.url};const n=[e.width,360,769,1024,1216,1408].sort(((e,s)=>e-s));if(e.optimized){s.src=e.url+e.name+"-"+e.width+"w.jpg",r.fallback=e.url+e.name+"-20w.jpg",t.push({sizes:"100vw",srcSet:"",type:"image/avif"}),t.push({sizes:"100vw",srcSet:"",type:"image/webp"});for(let r in n){if(n[r]>e.width)break;let a=("0"===r?"":",")+e.url+e.name+"-"+n[r];s.srcSet+=a+"w.jpg "+n[r]+"w",t[0].srcSet+=a+"w.avif "+n[r]+"w",t[1].srcSet+=a+"w.webp "+n[r]+"w"}}return o({childImageSharp:{gatsbyImageData:{backgroundColor:"transparent",height:e.height/e.width,width:1,layout:"fullWidth",placeholder:r,images:{fallback:s,sources:t}}}})},l=(e,s)=>{const t=c(e),r=c(s);return t&&r?i(t,[{media:"(max-width: 768px)",image:r}]):t};exports.api_link=p,exports.buildElement=a,exports.buildImage=c,exports.createAPIPages=async e=>{if(!process.env.GATSBY_PROJECT_ROOT)throw new Error('Please define "process.env.GATSBY_PROJECT_ROOT = __dirname" within the ./gatsby-config.js file.');const{createPage:s,createRedirect:a}=e,o=JSON.parse(t.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/full-content.json`,"utf-8"));let i=[];for(const e of o)e.is_hidden&&i.push(e.slug),e.is_active&&(process.env.DEV_PAGE&&e.id!==parseInt(`${process.env.DEV_PAGE}`)||s({path:e.slug,component:require.resolve(`${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`),context:await r(e)}));n(a),t.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,JSON.stringify(i))},exports.defaultGatsbyConfig=(e={},s=[])=>{if(!process.env.GATSBY_PROJECT_ROOT)throw new Error('Please define "process.env.GATSBY_PROJECT_ROOT = __dirname" within the ./gatsby-config.js file.');return{siteMetadata:{title:process.env.SITE_TITLE,description:process.env.SITE_DESCRIPTION,siteUrl:`${process.env.PROTOCOL}://${process.env.HOST}`,image:process.env.SITE_IMAGE,protocol:process.env.PROTOCOL,domain:process.env.HOST},plugins:["gatsby-plugin-image","gatsby-plugin-use-query-params","gatsby-plugin-svgr","gatsby-transformer-sharp","gatsby-plugin-sass",{resolve:"gatsby-plugin-manifest",options:{name:process.env.PROJECT_NAME,short_name:process.env.PROJECT,lang:process.env.PROJECT_DEFAULT_LANGUAGE,start_url:"/",display:"standalone",icon:"static/icons/favicon.png"}},{resolve:"gatsby-plugin-sharp",options:{defaults:{formats:["auto","webp","avif"],placeholder:"blurred",quality:80,breakpoints:[360,769,1024,1216,1408],backgroundColor:"transparent",tracedSVGOptions:{},blurredOptions:{},jpgOptions:{},pngOptions:{},webpOptions:{},avifOptions:{}}}},{resolve:"gatsby-source-apiserver",options:{typePrefix:"API__",method:"get",allowCache:!1,headers:{"Content-Type":"application/json"},data:{},params:{},verboseOutput:!1,entitiesArray:[{url:`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/`,headers:{"Content-Type":"application/json"},name:"full-content",skipCreateNode:!0,localSave:!0,path:`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/`},{url:`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/redirection/`,headers:{"Content-Type":"application/json"},name:"redirections",skipCreateNode:!0,localSave:!0,path:`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/`}]}},{resolve:"gatsby-plugin-s3",options:{bucketName:process.env.S3_BUCKET,protocol:process.env.PROTOCOL,hostname:process.env.HOST,generateRoutingRules:!0,generateRedirectObjectsForPermanentRedirects:!0,acl:"private"}},{resolve:"gatsby-plugin-sitemap",options:{excludes:["/404/"],query:"\n {\n allSitePage {\n nodes {\n path\n pageContext\n }\n }\n }\n ",resolveSiteUrl:()=>`${process.env.PROTOCOL}://${process.env.HOST}`,filterPages:e=>e.is_hidden,serialize:(e,{resolvePagePath:s})=>({url:`${s(e)}`,lastmod:e.pageContext.published_at})}},{resolve:"gatsby-plugin-google-tagmanager",options:{id:process.env.GTM_ID}},{resolve:"gatsby-plugin-newrelic",options:{config:{instrumentationType:"proAndSPA",accountId:process.env.NEWRELIC_ACCOUNT_ID,trustKey:process.env.NEWRELIC_TRUST_KEY,agentID:process.env.NEWRELIC_AGENT_ID,licenseKey:process.env.NEWRELIC_LICENSE_KEY,applicationID:process.env.NEWRELIC_APP_ID,beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net"}}},...s],...e}},exports.extractForm=e=>{let s={settings:{pk:0,name:"",form_method:"post",form_submit:p("/v1/project/request/contact"),form_redirection:null,form_ajax_request:null,recaptcha_action:"",recaptcha_v3:!1},items:[],fields:{}};s.settings.recaptcha_v3=!!e.recaptcha_v3,s.settings.recaptcha_action=e.data.recaptcha_action??e.name,s.settings.pk=e.pk,s.settings.name=e.name,["form_submit","form_recipient","form_method","form_redirection","form_ajax_request","form_success_msg"].map((t=>{e.hasOwnProperty(t)&&(s.settings[t]=e[t])}));const t=new Set(["checkbox","input","select","button","google-places","country-prefix","textarea","recaptcha2","title","text","link","image"]);let r=0;const n=(e,t)=>{let r=s.items;for(let s of e)r=r[s],Array.isArray(r)||(r=r.children);r.push(t)},a=(e,o,i)=>{let p=e.input_name&&!s.fields[e.input_name]?e.input_name:e.name??`${e.type}${r++}`;if("section"===e.type){const s=e.name??`sec_${o.length}-${i}`;n(o,{name:s,children:[]}),e.children.map(((e,s)=>a(e,[...o,i],s)))}else t.has(e.type)&&(n(o,p),s.fields[p]=e,"image"===e.type&&(s.fields[p].imageData=l(e.image,e.mobile_image)))};return e.children.map(((e,s)=>a(e,[],s))),s},exports.getImageData=l,exports.hotelOptionsByCity=e=>{let s={Sydney:[],Melbourne:[],Perth:[],Hobart:[],Canberra:[],Adelaide:[],"Gold Coast":[],Darwin:[],Singapore:[]};const t=Object.entries(e).reduce(((e,[t,r])=>(s[r.city]&&(s[r.city].push({label:r.name,value:t}),e[t]=r.sort),e)),{});return Object.entries(s).map((([e,s])=>({label:e,options:s.sort(((e,s)=>t[e.value]-t[s.value]))})))},exports.hotel_page_link=(e,t)=>`/book-accommodation/${s(e,{lower:!0})}/${s(t,{lower:!0}).slice(5)}`,exports.joinAddress=e=>e.reduce(((e,s)=>(s&&e.push(s),e)),[]).join(", "),exports.join_paths=e,exports.nOptions=(e,s=0,t={})=>{const r={...t};for(let t=s;t<s+e;t++)r[t.toString()]=t.toString();return r},exports.postBuild=()=>{const e=JSON.parse(t.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,"utf-8")),s=["User-agent: *",`${e.length?e.map((e=>`Disallow: ${e}`)).join("\n"):"Allow: /"}`,`Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/sitemap/sitemap-index.xml`,`Host: ${process.env.PROTOCOL}://${process.env.HOST}`];t.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/public/robots.txt`,s.join("\n"))},exports.ssoURL=e=>`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${e}`,exports.tagExists=(e,...s)=>{for(const t of Object.keys(e))if(s.includes(t))return!0;return!1};
|
|
2
|
+
//# sourceMappingURL=index.node.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.node.cjs","sources":["../src/node/url/index.ts","../src/node/property/index.ts","../src/node/build/index.ts","../src/node/api/index.ts","../src/node/config/index.ts","../src/node/form/index.ts"],"sourcesContent":["export const join_paths = (path1: string, path2: string): string =>\n `${path1.replace(new RegExp(`/$`), \"\")}/${path2.replace(\n new RegExp(`^/`),\n \"\"\n )}`;\n\nexport const ssoURL = (path: string) =>\n `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${path}`;\n","const slugify = module.require(\"slugify\");\nimport { HotelOptionsByCityType, HotelPagesType, CityKeyType } from \"./types\";\n\n/**\n *\n * Returns Select options sorting by the cities with more hotels, otherwise alphabetically.\n *\n * For instance:\n *\n * [\n * {\n * label: 'Sydney',\n * options: [\n * { label: 'Vibe Hotel Sydney', value: \"58443\" },\n * { label: 'Vibe Hotel Sydney Darling Harbour', value: \"8565\" }\n * ]\n * },\n * {\n * label: 'Mebourne',\n * options: [\n * { label: 'Vibe Hotel Melbourne', value: \"9969\" },\n * ]\n * },\n * ]\n */\nexport const hotelOptionsByCity = (\n hotelPages: HotelPagesType\n): HotelOptionsByCityType[] => {\n let hotelsByCity: Record<CityKeyType, { value: string; label: string }[]> = {\n Sydney: [],\n Melbourne: [],\n Perth: [],\n Hobart: [],\n Canberra: [],\n Adelaide: [],\n \"Gold Coast\": [],\n Darwin: [],\n Singapore: [],\n };\n const propertyOrder = Object.entries(hotelPages).reduce(\n (acc, [id, hotel]) => {\n if (hotelsByCity[hotel.city]) {\n hotelsByCity[hotel.city].push({ label: hotel.name, value: id });\n acc[id] = hotel.sort;\n }\n return acc;\n },\n {} as { [k: string]: number }\n );\n return Object.entries(hotelsByCity).map(([city, options]) => {\n return {\n label: city,\n options: options.sort(\n (a, b) => propertyOrder[a.value] - propertyOrder[b.value]\n ),\n };\n });\n};\n\n/**\n * Joins the Property address\n */\nexport const joinAddress = (addressParams: (string | null)[]) =>\n addressParams\n .reduce((acc: string[], param: string | null) => {\n if (param) {\n acc.push(param);\n }\n return acc;\n }, [])\n .join(\", \");\n\nexport const hotel_page_link = (city: string, hotelName: string) =>\n `/book-accommodation/${slugify(city, {\n lower: true,\n })}/${slugify(hotelName, {\n lower: true,\n }).slice(5)}`;\n","import { Actions } from \"gatsby\";\nimport { RedirectionType } from \"./types\";\nconst fs = module.require(\"fs\");\n\n// Build page elements (only for the ones having a build.js)\nexport const build = async (page: any) => {\n let body = [];\n for (const element of page.body) {\n body.push(\n await buildElement(element, {\n slug: page.slug,\n tags: page.tags,\n data: page.data,\n })\n );\n }\n page.body = body;\n return page;\n};\n\n/**\n * Generate API pages\n *\n * @param actions Gatsby actions: https://www.gatsbyjs.com/docs/reference/config-files/actions/\n */\nexport const createAPIPages = async (actions: Actions) => {\n if (!process.env.GATSBY_PROJECT_ROOT) {\n throw new Error(\n 'Please define \"process.env.GATSBY_PROJECT_ROOT = __dirname\" within the ./gatsby-config.js file.'\n );\n }\n const { createPage, createRedirect } = actions;\n // Generate Pages\n const jsonDoc = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/full-content.json`,\n `utf-8`\n )\n );\n let excluded = []; // List of excluded pages\n for (const page of jsonDoc) {\n if (page.is_hidden) {\n excluded.push(page.slug);\n }\n // Skip disabled pages\n if (!page.is_active) {\n continue;\n }\n // Skip when \"DEV_PAGE\" is defined on \"./.env.development\" and doesn't match current page:\n if (\n process.env.DEV_PAGE &&\n page.id !== parseInt(`${process.env.DEV_PAGE}`)\n ) {\n continue;\n }\n\n createPage({\n path: page.slug,\n component: require.resolve(\n `${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`\n ),\n context: await build(page),\n });\n }\n\n createAPIRedirections(createRedirect);\n // Generate the file \"./src/data/excluded.json\" containing the pages which should be excluded on the sitemap and disallowed within robots.txt.\n fs.writeFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,\n JSON.stringify(excluded)\n );\n};\n\n/**\n * Generate API redirections\n */\nexport const createAPIRedirections = (\n createRedirect: Actions[\"createRedirect\"]\n) => {\n const redirections = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,\n `utf-8`\n )\n );\n redirections.forEach((redirect: RedirectionType) => {\n createRedirect({\n fromPath: redirect.page,\n toPath: redirect.redirection,\n isPermanent: redirect.type === \"301\",\n force: true,\n });\n });\n};\n\n/**\n * Function executed after creating pages to perform following tasks:\n * - Creation of \"robots.txt\"\n */\nexport const postBuild = () => {\n const excludedPages = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,\n `utf-8`\n )\n );\n\n const robotsTxt = [\n \"User-agent: *\",\n `${excludedPages.length ? excludedPages.map((slug: string) => `Disallow: ${slug}`).join(\"\\n\") : \"Allow: /\"}`,\n `Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/sitemap/sitemap-index.xml`,\n `Host: ${process.env.PROTOCOL}://${process.env.HOST}`,\n ];\n\n fs.writeFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/public/robots.txt`,\n robotsTxt.join(\"\\n\")\n );\n};\n\n/**\n * Builds API Element (usually for \"section\" and \"data\" elements)\n * This generates a initial data structure for the section/data to avoid processing the React component\n * initial state on every single render.\n *\n * @param element API element\n * @param context\n * @returns\n */\nexport const buildElement = async (element: any, context: any) => {\n const path = `${process.env.GATSBY_PROJECT_ROOT}/src/components/element/${element.type}/${element.name}/build.js`;\n if (fs.existsSync(path)) {\n const module = await import(path);\n if (module?.build) {\n return await module.build(element, context);\n }\n // Show warning on development:\n } else if (process.env.ENV === \"development\") {\n console.warn(`build.js file not found: ${path}`);\n }\n return element;\n};\n","import { join_paths } from \"../url\";\nimport { ImageType, PageTagsType, QueryParamsType } from \"./types\";\nconst { getImage, withArtDirection } = module.require(\"gatsby-plugin-image\");\n\nexport const tagExists = (\n pageTags: PageTagsType,\n ...tags: string[]\n): boolean => {\n for (const tag of Object.keys(pageTags)) {\n if (tags.includes(tag)) {\n return true;\n }\n }\n return false;\n};\n\nexport const api_link = (\n apiPath: string = \"\",\n queryParams: QueryParamsType | null = null\n): string =>\n `${join_paths(\n `${process.env.API_PROTOCOL}://${process.env.API_HOST}`,\n apiPath\n )}${queryParams ? `?${new URLSearchParams(queryParams).toString()}` : \"\"}`;\n\nexport const buildImage = (img: ImageType) => {\n if (!img) {\n return undefined;\n }\n\n let fallback = {\n src: img.url,\n sizes: \"100vw\",\n srcSet: \"\",\n };\n let sources = [];\n let placeholder = { fallback: img.url };\n const sizes = [img.width, 360, 769, 1024, 1216, 1408].sort((a, b) => a - b);\n\n if (img.optimized) {\n fallback.src = img.url + img.name + \"-\" + img.width + \"w.jpg\";\n placeholder.fallback = img.url + img.name + \"-20w.jpg\";\n sources.push({ sizes: \"100vw\", srcSet: \"\", type: \"image/avif\" });\n sources.push({ sizes: \"100vw\", srcSet: \"\", type: \"image/webp\" });\n for (let index in sizes) {\n if (sizes[index] > img.width) {\n break;\n }\n let image_url =\n (index === \"0\" ? \"\" : \",\") + img.url + img.name + \"-\" + sizes[index];\n fallback.srcSet += image_url + \"w.jpg \" + sizes[index] + \"w\";\n sources[0].srcSet += image_url + \"w.avif \" + sizes[index] + \"w\";\n sources[1].srcSet += image_url + \"w.webp \" + sizes[index] + \"w\";\n }\n }\n\n return getImage({\n childImageSharp: {\n gatsbyImageData: {\n backgroundColor: \"transparent\",\n height: img.height / img.width,\n width: 1,\n layout: \"fullWidth\",\n placeholder: placeholder,\n images: {\n fallback: fallback,\n sources: sources,\n },\n },\n },\n });\n};\n\nexport const getImageData = (image: ImageType, mobileImage: ImageType) => {\n const image_data = buildImage(image);\n const mobile_image_data = buildImage(mobileImage);\n return image_data && mobile_image_data // If mobile image exists, it must be added using Art Direction.\n ? withArtDirection(image_data, [\n {\n media: \"(max-width: 768px)\",\n image: mobile_image_data,\n },\n ])\n : image_data;\n};\n\nexport const extractForm = (formSection: any) => {\n let form: any = {\n settings: {\n pk: 0,\n name: \"\",\n form_method: \"post\",\n form_submit: api_link(\"/v1/project/request/contact\"),\n form_redirection: null,\n form_ajax_request: null,\n recaptcha_action: \"\",\n recaptcha_v3: false,\n },\n items: [],\n fields: {},\n };\n\n form.settings.recaptcha_v3 = !!formSection.recaptcha_v3;\n form.settings.recaptcha_action =\n formSection.data.recaptcha_action ?? formSection.name;\n form.settings.pk = formSection.pk;\n form.settings.name = formSection.name;\n [\n \"form_submit\",\n \"form_recipient\",\n \"form_method\",\n \"form_redirection\",\n \"form_ajax_request\",\n \"form_success_msg\",\n ].map((cfg) => {\n if (formSection.hasOwnProperty(cfg)) {\n // @ts-ignore\n form.settings[cfg] = formSection[cfg];\n }\n });\n const validTypes = new Set([\n \"checkbox\",\n \"input\",\n \"select\",\n \"button\",\n \"google-places\",\n \"country-prefix\",\n \"textarea\",\n \"recaptcha2\",\n \"title\",\n \"text\",\n \"link\",\n \"image\",\n ]);\n let uniqueId = 0;\n const addItem = (parents: any, newItem: any): any => {\n let item = form.items;\n for (let key of parents) {\n item = item[key];\n if (!Array.isArray(item)) {\n item = item.children;\n }\n }\n item.push(newItem);\n };\n // Set Form fields:\n const setFormFields = (field: any, parents: any, k: number) => {\n let fieldName =\n field.input_name && !form.fields[field.input_name]\n ? field.input_name\n : field.name ?? `${field.type}${uniqueId++}`;\n\n if (\"section\" === field.type) {\n const sectionName = field.name ?? `sec_${parents.length}-${k}`;\n addItem(parents, { name: sectionName, children: [] });\n field.children.map((field: any, k2: any) =>\n setFormFields(field, [...parents, k], k2)\n );\n } else if (validTypes.has(field.type)) {\n addItem(parents, fieldName);\n form.fields[fieldName] = field;\n // Pre-process images (fixes flickering issue)\n if (field.type === \"image\") {\n form.fields[fieldName].imageData = getImageData(\n field.image,\n field.mobile_image\n );\n }\n }\n };\n\n formSection.children.map((field: any, k: any) => setFormFields(field, [], k));\n return form;\n};\n","export const defaultGatsbyConfig = (config: any = {}, plugins: any[] = []) => {\n if (!process.env.GATSBY_PROJECT_ROOT) {\n throw new Error(\n 'Please define \"process.env.GATSBY_PROJECT_ROOT = __dirname\" within the ./gatsby-config.js file.'\n );\n }\n\n return {\n siteMetadata: {\n title: process.env.SITE_TITLE,\n description: process.env.SITE_DESCRIPTION,\n siteUrl: `${process.env.PROTOCOL}://${process.env.HOST}`,\n image: process.env.SITE_IMAGE,\n protocol: process.env.PROTOCOL,\n domain: process.env.HOST,\n },\n plugins: [\n `gatsby-plugin-image`,\n \"gatsby-plugin-use-query-params\",\n \"gatsby-plugin-svgr\",\n `gatsby-transformer-sharp`,\n \"gatsby-plugin-sass\",\n {\n resolve: `gatsby-plugin-manifest`,\n options: {\n name: process.env.PROJECT_NAME,\n short_name: process.env.PROJECT,\n lang: process.env.PROJECT_DEFAULT_LANGUAGE,\n start_url: `/`,\n display: `standalone`,\n icon: `static/icons/favicon.png`,\n },\n },\n {\n resolve: `gatsby-plugin-sharp`,\n options: {\n defaults: {\n formats: [`auto`, `webp`, \"avif\"],\n placeholder: `blurred`,\n quality: 80,\n breakpoints: [360, 769, 1024, 1216, 1408],\n backgroundColor: `transparent`,\n tracedSVGOptions: {},\n blurredOptions: {},\n jpgOptions: {},\n pngOptions: {},\n webpOptions: {},\n avifOptions: {},\n },\n },\n },\n {\n resolve: \"gatsby-source-apiserver\",\n options: {\n typePrefix: \"API__\",\n method: \"get\",\n allowCache: false,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n data: {}, // Request body\n params: {},\n verboseOutput: false,\n // enableDevRefresh: true,\n entitiesArray: [\n {\n url: `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: \"full-content\",\n skipCreateNode: true,\n localSave: true,\n path: `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/`,\n },\n {\n url: `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/redirection/`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: \"redirections\",\n skipCreateNode: true,\n localSave: true,\n path: `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/`,\n },\n ],\n },\n },\n {\n resolve: `gatsby-plugin-s3`,\n options: {\n bucketName: process.env.S3_BUCKET,\n protocol: process.env.PROTOCOL,\n hostname: process.env.HOST,\n generateRoutingRules: true,\n generateRedirectObjectsForPermanentRedirects: true,\n acl: \"private\",\n },\n },\n {\n resolve: `gatsby-plugin-sitemap`,\n options: {\n excludes: [\"/404/\"],\n query: `\n {\n allSitePage {\n nodes {\n path\n pageContext\n }\n }\n }\n `,\n resolveSiteUrl: () => `${process.env.PROTOCOL}://${process.env.HOST}`,\n filterPages: (page: any) => page.is_hidden,\n serialize: (page: any, { resolvePagePath }: any) => {\n return {\n url: `${resolvePagePath(page)}`,\n lastmod: page.pageContext.published_at,\n };\n },\n },\n },\n {\n resolve: \"gatsby-plugin-google-tagmanager\",\n options: {\n id: process.env.GTM_ID,\n },\n },\n {\n resolve: \"gatsby-plugin-newrelic\",\n options: {\n config: {\n instrumentationType: \"proAndSPA\",\n accountId: process.env.NEWRELIC_ACCOUNT_ID,\n trustKey: process.env.NEWRELIC_TRUST_KEY,\n agentID: process.env.NEWRELIC_AGENT_ID,\n licenseKey: process.env.NEWRELIC_LICENSE_KEY,\n applicationID: process.env.NEWRELIC_APP_ID,\n beacon: \"bam.nr-data.net\",\n errorBeacon: \"bam.nr-data.net\",\n },\n },\n },\n ...plugins,\n ],\n ...config,\n };\n};\n","import { NOptionsType } from \"./types\";\n\n/**\n *\n * Creates a Object with numeric options for a Select input.\n *\n * @param n Number of options to create\n * @param start The number from which the options start\n * @param defaultOpt Default options to be added into the resulting object\n * @returns Object with the created options, for instance: { \"0\": \"0\", \"1\": \"1\", ... }\n *\n */\nexport const nOptions = (\n n: number,\n start = 0,\n defaultOpt = {}\n): NOptionsType => {\n const obj: NOptionsType = { ...defaultOpt };\n for (let i = start; i < start + n; i++) {\n obj[i.toString()] = i.toString();\n }\n return obj;\n};\n"],"names":["join_paths","path1","path2","replace","RegExp","slugify","module","require","fs","build","async","body","element","page","push","buildElement","slug","tags","data","createAPIRedirections","createRedirect","JSON","parse","readFileSync","process","env","GATSBY_PROJECT_ROOT","forEach","redirect","fromPath","toPath","redirection","isPermanent","type","force","context","path","name","existsSync","import","ENV","console","warn","getImage","withArtDirection","api_link","apiPath","queryParams","API_PROTOCOL","API_HOST","URLSearchParams","toString","buildImage","img","fallback","src","url","sizes","srcSet","sources","placeholder","width","sort","a","b","optimized","index","image_url","childImageSharp","gatsbyImageData","backgroundColor","height","layout","images","getImageData","image","mobileImage","image_data","mobile_image_data","media","Error","createPage","actions","jsonDoc","excluded","is_hidden","is_active","DEV_PAGE","id","parseInt","component","resolve","writeFileSync","stringify","defaultGatsbyConfig","config","plugins","siteMetadata","title","SITE_TITLE","description","SITE_DESCRIPTION","siteUrl","PROTOCOL","HOST","SITE_IMAGE","protocol","domain","options","PROJECT_NAME","short_name","PROJECT","lang","PROJECT_DEFAULT_LANGUAGE","start_url","display","icon","defaults","formats","quality","breakpoints","tracedSVGOptions","blurredOptions","jpgOptions","pngOptions","webpOptions","avifOptions","typePrefix","method","allowCache","headers","params","verboseOutput","entitiesArray","skipCreateNode","localSave","bucketName","S3_BUCKET","hostname","generateRoutingRules","generateRedirectObjectsForPermanentRedirects","acl","excludes","query","resolveSiteUrl","filterPages","serialize","resolvePagePath","lastmod","pageContext","published_at","GTM_ID","instrumentationType","accountId","NEWRELIC_ACCOUNT_ID","trustKey","NEWRELIC_TRUST_KEY","agentID","NEWRELIC_AGENT_ID","licenseKey","NEWRELIC_LICENSE_KEY","applicationID","NEWRELIC_APP_ID","beacon","errorBeacon","formSection","form","settings","pk","form_method","form_submit","form_redirection","form_ajax_request","recaptcha_action","recaptcha_v3","items","fields","map","cfg","hasOwnProperty","validTypes","Set","uniqueId","addItem","parents","newItem","item","key","Array","isArray","children","setFormFields","field","k","fieldName","input_name","sectionName","length","k2","has","imageData","mobile_image","hotelPages","hotelsByCity","Sydney","Melbourne","Perth","Hobart","Canberra","Adelaide","Darwin","Singapore","propertyOrder","Object","entries","reduce","acc","hotel","city","label","value","hotel_page_link","hotelName","lower","slice","addressParams","param","join","nOptions","n","start","defaultOpt","obj","i","postBuild","excludedPages","robotsTxt","SABRE_SSO_PROTOCOL","SABRE_SSO_HOST","tagExists","pageTags","tag","keys","includes"],"mappings":"aAAaA,MAAAA,EAAaA,CAACC,EAAeC,IACvC,GAAED,EAAME,QAAQ,IAAIC,OAAQ,MAAM,OAAOF,EAAMC,QAC9C,IAAIC,OAAQ,MACZ,MCHEC,EAAUC,OAAOC,QAAQ,WCEzBC,EAAKF,OAAOC,QAAQ,MAGbE,EAAQC,UACnB,IAAIC,EAAO,GACX,IAAK,MAAMC,KAAWC,EAAKF,KACzBA,EAAKG,WACGC,EAAaH,EAAS,CAC1BI,KAAMH,EAAKG,KACXC,KAAMJ,EAAKI,KACXC,KAAML,EAAKK,QAKjB,OADAL,EAAKF,KAAOA,EACLE,CAAI,EA2DAM,EACXC,IAEqBC,KAAKC,MACxBd,EAAGe,aACA,GAAEC,QAAQC,IAAIC,uDACd,UAGQC,SAASC,IACpBR,EAAe,CACbS,SAAUD,EAASf,KACnBiB,OAAQF,EAASG,YACjBC,YAA+B,QAAlBJ,EAASK,KACtBC,OAAO,GACP,GACF,EAqCSnB,EAAeL,MAAOE,EAAcuB,KAC/C,MAAMC,EAAQ,GAAEZ,QAAQC,IAAIC,8CAA8Cd,EAAQqB,QAAQrB,EAAQyB,gBAClG,GAAI7B,EAAG8B,WAAWF,GAAO,CACvB,MAAM9B,QAAeiC,OAAOH,GAC5B,GAAI9B,GAAQG,MACV,aAAaH,EAAOG,MAAMG,EAASuB,EAGtC,KAA8B,gBAApBX,QAAQC,IAAIe,KACrBC,QAAQC,KAAM,4BAA2BN,KAE3C,OAAOxB,CAAO,GC1IV+B,SAAEA,EAAQC,iB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AAcrJ,EAAE6J,OAASR,EAAcpJ,EAAE4J,YAGvD,0BAgB2BC,CAACH,EAAcI,IAC3C,uBAAsBzN,EAAQqN,EAAM,CACnCK,OAAO,OACH1N,EAAQyN,EAAW,CACvBC,OAAO,IACNC,MAAM,yBAfiBC,GAC1BA,EACGV,QAAO,CAACC,EAAeU,KAClBA,GACFV,EAAI1M,KAAKoN,GAEJV,IACN,IACFW,KAAK,4CI1DcC,CACtBC,EACAC,EAAQ,EACRC,EAAa,CAAA,KAEb,MAAMC,EAAoB,IAAKD,GAC/B,IAAK,IAAIE,EAAIH,EAAOG,EAAIH,EAAQD,EAAGI,IACjCD,EAAIC,EAAEtL,YAAcsL,EAAEtL,WAExB,OAAOqL,CAAG,oBH8EaE,KACvB,MAAMC,EAAgBtN,KAAKC,MACzBd,EAAGe,aACA,GAAEC,QAAQC,IAAIC,mDACd,UAICkN,EAAY,CAChB,gBACC,GAAED,EAActC,OAASsC,EAAc1D,KAAKjK,GAAkB,aAAYA,MAAQmN,KAAK,MAAQ,aAC/F,YAAW3M,QAAQC,IAAI8E,cAAc/E,QAAQC,IAAI+E,iCACjD,SAAQhF,QAAQC,IAAI8E,cAAc/E,QAAQC,IAAI+E,QAGjDhG,EAAGoF,cACA,GAAEpE,QAAQC,IAAIC,wCACfkN,EAAUT,KAAK,MAChB,iBF/GoB/L,GACpB,GAAEZ,QAAQC,IAAIoN,wBAAwBrN,QAAQC,IAAIqN,iBAAiB1M,sBGH7C2M,CACvBC,KACG/N,KAEH,IAAK,MAAMgO,KAAO5B,OAAO6B,KAAKF,GAC5B,GAAI/N,EAAKkO,SAASF,GAChB,OAAO,EAGX,OAAO,CAAK"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Actions } from 'gatsby';
|
|
2
|
+
|
|
3
|
+
declare const join_paths: (path1: string, path2: string) => string;
|
|
4
|
+
declare const ssoURL: (path: string) => string;
|
|
5
|
+
|
|
6
|
+
interface NOptionsType {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* Creates a Object with numeric options for a Select input.
|
|
13
|
+
*
|
|
14
|
+
* @param n Number of options to create
|
|
15
|
+
* @param start The number from which the options start
|
|
16
|
+
* @param defaultOpt Default options to be added into the resulting object
|
|
17
|
+
* @returns Object with the created options, for instance: { "0": "0", "1": "1", ... }
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
declare const nOptions: (n: number, start?: number, defaultOpt?: {}) => NOptionsType;
|
|
21
|
+
|
|
22
|
+
type CityKeyType = "Sydney" | "Melbourne" | "Perth" | "Hobart" | "Canberra" | "Adelaide" | "Gold Coast" | "Darwin" | "Singapore";
|
|
23
|
+
interface HotelPagesType {
|
|
24
|
+
[hotel_code: string]: {
|
|
25
|
+
name: string;
|
|
26
|
+
city: CityKeyType;
|
|
27
|
+
sort: number;
|
|
28
|
+
link: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface HotelOptionsByCityType {
|
|
32
|
+
label: string;
|
|
33
|
+
options: {
|
|
34
|
+
value: string;
|
|
35
|
+
label: string;
|
|
36
|
+
}[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* Returns Select options sorting by the cities with more hotels, otherwise alphabetically.
|
|
42
|
+
*
|
|
43
|
+
* For instance:
|
|
44
|
+
*
|
|
45
|
+
* [
|
|
46
|
+
* {
|
|
47
|
+
* label: 'Sydney',
|
|
48
|
+
* options: [
|
|
49
|
+
* { label: 'Vibe Hotel Sydney', value: "58443" },
|
|
50
|
+
* { label: 'Vibe Hotel Sydney Darling Harbour', value: "8565" }
|
|
51
|
+
* ]
|
|
52
|
+
* },
|
|
53
|
+
* {
|
|
54
|
+
* label: 'Mebourne',
|
|
55
|
+
* options: [
|
|
56
|
+
* { label: 'Vibe Hotel Melbourne', value: "9969" },
|
|
57
|
+
* ]
|
|
58
|
+
* },
|
|
59
|
+
* ]
|
|
60
|
+
*/
|
|
61
|
+
declare const hotelOptionsByCity: (hotelPages: HotelPagesType) => HotelOptionsByCityType[];
|
|
62
|
+
/**
|
|
63
|
+
* Joins the Property address
|
|
64
|
+
*/
|
|
65
|
+
declare const joinAddress: (addressParams: (string | null)[]) => string;
|
|
66
|
+
declare const hotel_page_link: (city: string, hotelName: string) => string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Generate API pages
|
|
70
|
+
*
|
|
71
|
+
* @param actions Gatsby actions: https://www.gatsbyjs.com/docs/reference/config-files/actions/
|
|
72
|
+
*/
|
|
73
|
+
declare const createAPIPages: (actions: Actions) => Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Function executed after creating pages to perform following tasks:
|
|
76
|
+
* - Creation of "robots.txt"
|
|
77
|
+
*/
|
|
78
|
+
declare const postBuild: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Builds API Element (usually for "section" and "data" elements)
|
|
81
|
+
* This generates a initial data structure for the section/data to avoid processing the React component
|
|
82
|
+
* initial state on every single render.
|
|
83
|
+
*
|
|
84
|
+
* @param element API element
|
|
85
|
+
* @param context
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
88
|
+
declare const buildElement: (element: any, context: any) => Promise<any>;
|
|
89
|
+
|
|
90
|
+
interface PageTagsType {
|
|
91
|
+
[k: string]: string;
|
|
92
|
+
}
|
|
93
|
+
interface QueryParamsType {
|
|
94
|
+
[key: string]: string;
|
|
95
|
+
}
|
|
96
|
+
interface ImageType {
|
|
97
|
+
type: "image";
|
|
98
|
+
url: string;
|
|
99
|
+
optimized: boolean;
|
|
100
|
+
name: string;
|
|
101
|
+
alt: string | null;
|
|
102
|
+
caption: string | null;
|
|
103
|
+
width: number;
|
|
104
|
+
height: number;
|
|
105
|
+
extension: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare const tagExists: (pageTags: PageTagsType, ...tags: string[]) => boolean;
|
|
109
|
+
declare const api_link: (apiPath?: string, queryParams?: QueryParamsType | null) => string;
|
|
110
|
+
declare const buildImage: (img: ImageType) => any;
|
|
111
|
+
declare const getImageData: (image: ImageType, mobileImage: ImageType) => any;
|
|
112
|
+
declare const extractForm: (formSection: any) => any;
|
|
113
|
+
|
|
114
|
+
declare const defaultGatsbyConfig: (config?: any, plugins?: any[]) => any;
|
|
115
|
+
|
|
116
|
+
export { api_link, buildElement, buildImage, createAPIPages, defaultGatsbyConfig, extractForm, getImageData, hotelOptionsByCity, hotel_page_link, joinAddress, join_paths, nOptions, postBuild, ssoURL, tagExists };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=(e,s)=>`${e.replace(new RegExp("/$"),"")}/${s.replace(new RegExp("^/"),"")}`,s=e=>`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${e}`,t=(e,s=0,t={})=>{const n={...t};for(let t=s;t<s+e;t++)n[t.toString()]=t.toString();return n},n=module.require("slugify"),r=e=>{let s={Sydney:[],Melbourne:[],Perth:[],Hobart:[],Canberra:[],Adelaide:[],"Gold Coast":[],Darwin:[],Singapore:[]};const t=Object.entries(e).reduce(((e,[t,n])=>(s[n.city]&&(s[n.city].push({label:n.name,value:t}),e[t]=n.sort),e)),{});return Object.entries(s).map((([e,s])=>({label:e,options:s.sort(((e,s)=>t[e.value]-t[s.value]))})))},a=e=>e.reduce(((e,s)=>(s&&e.push(s),e)),[]).join(", "),o=(e,s)=>`/book-accommodation/${n(e,{lower:!0})}/${n(s,{lower:!0}).slice(5)}`,i=module.require("fs"),c=async e=>{let s=[];for(const t of e.body)s.push(await g(t,{slug:e.slug,tags:e.tags,data:e.data}));return e.body=s,e},p=async e=>{if(!process.env.GATSBY_PROJECT_ROOT)throw new Error('Please define "process.env.GATSBY_PROJECT_ROOT = __dirname" within the ./gatsby-config.js file.');const{createPage:s,createRedirect:t}=e,n=JSON.parse(i.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/full-content.json`,"utf-8"));let r=[];for(const e of n)e.is_hidden&&r.push(e.slug),e.is_active&&(process.env.DEV_PAGE&&e.id!==parseInt(`${process.env.DEV_PAGE}`)||s({path:e.slug,component:require.resolve(`${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`),context:await c(e)}));l(t),i.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,JSON.stringify(r))},l=e=>{JSON.parse(i.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,"utf-8")).forEach((s=>{e({fromPath:s.page,toPath:s.redirection,isPermanent:"301"===s.type,force:!0})}))},u=()=>{const e=JSON.parse(i.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,"utf-8")),s=["User-agent: *",`${e.length?e.map((e=>`Disallow: ${e}`)).join("\n"):"Allow: /"}`,`Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/sitemap/sitemap-index.xml`,`Host: ${process.env.PROTOCOL}://${process.env.HOST}`];i.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/public/robots.txt`,s.join("\n"))},g=async(e,s)=>{const t=`${process.env.GATSBY_PROJECT_ROOT}/src/components/element/${e.type}/${e.name}/build.js`;if(i.existsSync(t)){const n=await import(t);if(n?.build)return await n.build(e,s)}else"development"===process.env.ENV&&console.warn(`build.js file not found: ${t}`);return e},{getImage:d,withArtDirection:O}=module.require("gatsby-plugin-image"),m=(e,...s)=>{for(const t of Object.keys(e))if(s.includes(t))return!0;return!1},_=(s="",t=null)=>`${e(`${process.env.API_PROTOCOL}://${process.env.API_HOST}`,s)}${t?`?${new URLSearchParams(t).toString()}`:""}`,v=e=>{if(!e)return;let s={src:e.url,sizes:"100vw",srcSet:""},t=[],n={fallback:e.url};const r=[e.width,360,769,1024,1216,1408].sort(((e,s)=>e-s));if(e.optimized){s.src=e.url+e.name+"-"+e.width+"w.jpg",n.fallback=e.url+e.name+"-20w.jpg",t.push({sizes:"100vw",srcSet:"",type:"image/avif"}),t.push({sizes:"100vw",srcSet:"",type:"image/webp"});for(let n in r){if(r[n]>e.width)break;let a=("0"===n?"":",")+e.url+e.name+"-"+r[n];s.srcSet+=a+"w.jpg "+r[n]+"w",t[0].srcSet+=a+"w.avif "+r[n]+"w",t[1].srcSet+=a+"w.webp "+r[n]+"w"}}return d({childImageSharp:{gatsbyImageData:{backgroundColor:"transparent",height:e.height/e.width,width:1,layout:"fullWidth",placeholder:n,images:{fallback:s,sources:t}}}})},T=(e,s)=>{const t=v(e),n=v(s);return t&&n?O(t,[{media:"(max-width: 768px)",image:n}]):t},f=e=>{let s={settings:{pk:0,name:"",form_method:"post",form_submit:_("/v1/project/request/contact"),form_redirection:null,form_ajax_request:null,recaptcha_action:"",recaptcha_v3:!1},items:[],fields:{}};s.settings.recaptcha_v3=!!e.recaptcha_v3,s.settings.recaptcha_action=e.data.recaptcha_action??e.name,s.settings.pk=e.pk,s.settings.name=e.name,["form_submit","form_recipient","form_method","form_redirection","form_ajax_request","form_success_msg"].map((t=>{e.hasOwnProperty(t)&&(s.settings[t]=e[t])}));const t=new Set(["checkbox","input","select","button","google-places","country-prefix","textarea","recaptcha2","title","text","link","image"]);let n=0;const r=(e,t)=>{let n=s.items;for(let s of e)n=n[s],Array.isArray(n)||(n=n.children);n.push(t)},a=(e,o,i)=>{let c=e.input_name&&!s.fields[e.input_name]?e.input_name:e.name??`${e.type}${n++}`;if("section"===e.type){const s=e.name??`sec_${o.length}-${i}`;r(o,{name:s,children:[]}),e.children.map(((e,s)=>a(e,[...o,i],s)))}else t.has(e.type)&&(r(o,c),s.fields[c]=e,"image"===e.type&&(s.fields[c].imageData=T(e.image,e.mobile_image)))};return e.children.map(((e,s)=>a(e,[],s))),s},h=(e={},s=[])=>{if(!process.env.GATSBY_PROJECT_ROOT)throw new Error('Please define "process.env.GATSBY_PROJECT_ROOT = __dirname" within the ./gatsby-config.js file.');return{siteMetadata:{title:process.env.SITE_TITLE,description:process.env.SITE_DESCRIPTION,siteUrl:`${process.env.PROTOCOL}://${process.env.HOST}`,image:process.env.SITE_IMAGE,protocol:process.env.PROTOCOL,domain:process.env.HOST},plugins:["gatsby-plugin-image","gatsby-plugin-use-query-params","gatsby-plugin-svgr","gatsby-transformer-sharp","gatsby-plugin-sass",{resolve:"gatsby-plugin-manifest",options:{name:process.env.PROJECT_NAME,short_name:process.env.PROJECT,lang:process.env.PROJECT_DEFAULT_LANGUAGE,start_url:"/",display:"standalone",icon:"static/icons/favicon.png"}},{resolve:"gatsby-plugin-sharp",options:{defaults:{formats:["auto","webp","avif"],placeholder:"blurred",quality:80,breakpoints:[360,769,1024,1216,1408],backgroundColor:"transparent",tracedSVGOptions:{},blurredOptions:{},jpgOptions:{},pngOptions:{},webpOptions:{},avifOptions:{}}}},{resolve:"gatsby-source-apiserver",options:{typePrefix:"API__",method:"get",allowCache:!1,headers:{"Content-Type":"application/json"},data:{},params:{},verboseOutput:!1,entitiesArray:[{url:`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/`,headers:{"Content-Type":"application/json"},name:"full-content",skipCreateNode:!0,localSave:!0,path:`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/`},{url:`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/redirection/`,headers:{"Content-Type":"application/json"},name:"redirections",skipCreateNode:!0,localSave:!0,path:`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/`}]}},{resolve:"gatsby-plugin-s3",options:{bucketName:process.env.S3_BUCKET,protocol:process.env.PROTOCOL,hostname:process.env.HOST,generateRoutingRules:!0,generateRedirectObjectsForPermanentRedirects:!0,acl:"private"}},{resolve:"gatsby-plugin-sitemap",options:{excludes:["/404/"],query:"\n {\n allSitePage {\n nodes {\n path\n pageContext\n }\n }\n }\n ",resolveSiteUrl:()=>`${process.env.PROTOCOL}://${process.env.HOST}`,filterPages:e=>e.is_hidden,serialize:(e,{resolvePagePath:s})=>({url:`${s(e)}`,lastmod:e.pageContext.published_at})}},{resolve:"gatsby-plugin-google-tagmanager",options:{id:process.env.GTM_ID}},{resolve:"gatsby-plugin-newrelic",options:{config:{instrumentationType:"proAndSPA",accountId:process.env.NEWRELIC_ACCOUNT_ID,trustKey:process.env.NEWRELIC_TRUST_KEY,agentID:process.env.NEWRELIC_AGENT_ID,licenseKey:process.env.NEWRELIC_LICENSE_KEY,applicationID:process.env.NEWRELIC_APP_ID,beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net"}}},...s],...e}};export{_ as api_link,g as buildElement,v as buildImage,p as createAPIPages,h as defaultGatsbyConfig,f as extractForm,T as getImageData,r as hotelOptionsByCity,o as hotel_page_link,a as joinAddress,e as join_paths,t as nOptions,u as postBuild,s as ssoURL,m as tagExists};
|
|
2
|
+
//# sourceMappingURL=index.node.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.node.esm.js","sources":["../src/node/url/index.ts","../src/node/form/index.ts","../src/node/property/index.ts","../src/node/build/index.ts","../src/node/api/index.ts","../src/node/config/index.ts"],"sourcesContent":["export const join_paths = (path1: string, path2: string): string =>\n `${path1.replace(new RegExp(`/$`), \"\")}/${path2.replace(\n new RegExp(`^/`),\n \"\"\n )}`;\n\nexport const ssoURL = (path: string) =>\n `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${path}`;\n","import { NOptionsType } from \"./types\";\n\n/**\n *\n * Creates a Object with numeric options for a Select input.\n *\n * @param n Number of options to create\n * @param start The number from which the options start\n * @param defaultOpt Default options to be added into the resulting object\n * @returns Object with the created options, for instance: { \"0\": \"0\", \"1\": \"1\", ... }\n *\n */\nexport const nOptions = (\n n: number,\n start = 0,\n defaultOpt = {}\n): NOptionsType => {\n const obj: NOptionsType = { ...defaultOpt };\n for (let i = start; i < start + n; i++) {\n obj[i.toString()] = i.toString();\n }\n return obj;\n};\n","const slugify = module.require(\"slugify\");\nimport { HotelOptionsByCityType, HotelPagesType, CityKeyType } from \"./types\";\n\n/**\n *\n * Returns Select options sorting by the cities with more hotels, otherwise alphabetically.\n *\n * For instance:\n *\n * [\n * {\n * label: 'Sydney',\n * options: [\n * { label: 'Vibe Hotel Sydney', value: \"58443\" },\n * { label: 'Vibe Hotel Sydney Darling Harbour', value: \"8565\" }\n * ]\n * },\n * {\n * label: 'Mebourne',\n * options: [\n * { label: 'Vibe Hotel Melbourne', value: \"9969\" },\n * ]\n * },\n * ]\n */\nexport const hotelOptionsByCity = (\n hotelPages: HotelPagesType\n): HotelOptionsByCityType[] => {\n let hotelsByCity: Record<CityKeyType, { value: string; label: string }[]> = {\n Sydney: [],\n Melbourne: [],\n Perth: [],\n Hobart: [],\n Canberra: [],\n Adelaide: [],\n \"Gold Coast\": [],\n Darwin: [],\n Singapore: [],\n };\n const propertyOrder = Object.entries(hotelPages).reduce(\n (acc, [id, hotel]) => {\n if (hotelsByCity[hotel.city]) {\n hotelsByCity[hotel.city].push({ label: hotel.name, value: id });\n acc[id] = hotel.sort;\n }\n return acc;\n },\n {} as { [k: string]: number }\n );\n return Object.entries(hotelsByCity).map(([city, options]) => {\n return {\n label: city,\n options: options.sort(\n (a, b) => propertyOrder[a.value] - propertyOrder[b.value]\n ),\n };\n });\n};\n\n/**\n * Joins the Property address\n */\nexport const joinAddress = (addressParams: (string | null)[]) =>\n addressParams\n .reduce((acc: string[], param: string | null) => {\n if (param) {\n acc.push(param);\n }\n return acc;\n }, [])\n .join(\", \");\n\nexport const hotel_page_link = (city: string, hotelName: string) =>\n `/book-accommodation/${slugify(city, {\n lower: true,\n })}/${slugify(hotelName, {\n lower: true,\n }).slice(5)}`;\n","import { Actions } from \"gatsby\";\nimport { RedirectionType } from \"./types\";\nconst fs = module.require(\"fs\");\n\n// Build page elements (only for the ones having a build.js)\nexport const build = async (page: any) => {\n let body = [];\n for (const element of page.body) {\n body.push(\n await buildElement(element, {\n slug: page.slug,\n tags: page.tags,\n data: page.data,\n })\n );\n }\n page.body = body;\n return page;\n};\n\n/**\n * Generate API pages\n *\n * @param actions Gatsby actions: https://www.gatsbyjs.com/docs/reference/config-files/actions/\n */\nexport const createAPIPages = async (actions: Actions) => {\n if (!process.env.GATSBY_PROJECT_ROOT) {\n throw new Error(\n 'Please define \"process.env.GATSBY_PROJECT_ROOT = __dirname\" within the ./gatsby-config.js file.'\n );\n }\n const { createPage, createRedirect } = actions;\n // Generate Pages\n const jsonDoc = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/full-content.json`,\n `utf-8`\n )\n );\n let excluded = []; // List of excluded pages\n for (const page of jsonDoc) {\n if (page.is_hidden) {\n excluded.push(page.slug);\n }\n // Skip disabled pages\n if (!page.is_active) {\n continue;\n }\n // Skip when \"DEV_PAGE\" is defined on \"./.env.development\" and doesn't match current page:\n if (\n process.env.DEV_PAGE &&\n page.id !== parseInt(`${process.env.DEV_PAGE}`)\n ) {\n continue;\n }\n\n createPage({\n path: page.slug,\n component: require.resolve(\n `${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`\n ),\n context: await build(page),\n });\n }\n\n createAPIRedirections(createRedirect);\n // Generate the file \"./src/data/excluded.json\" containing the pages which should be excluded on the sitemap and disallowed within robots.txt.\n fs.writeFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,\n JSON.stringify(excluded)\n );\n};\n\n/**\n * Generate API redirections\n */\nexport const createAPIRedirections = (\n createRedirect: Actions[\"createRedirect\"]\n) => {\n const redirections = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,\n `utf-8`\n )\n );\n redirections.forEach((redirect: RedirectionType) => {\n createRedirect({\n fromPath: redirect.page,\n toPath: redirect.redirection,\n isPermanent: redirect.type === \"301\",\n force: true,\n });\n });\n};\n\n/**\n * Function executed after creating pages to perform following tasks:\n * - Creation of \"robots.txt\"\n */\nexport const postBuild = () => {\n const excludedPages = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,\n `utf-8`\n )\n );\n\n const robotsTxt = [\n \"User-agent: *\",\n `${excludedPages.length ? excludedPages.map((slug: string) => `Disallow: ${slug}`).join(\"\\n\") : \"Allow: /\"}`,\n `Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/sitemap/sitemap-index.xml`,\n `Host: ${process.env.PROTOCOL}://${process.env.HOST}`,\n ];\n\n fs.writeFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/public/robots.txt`,\n robotsTxt.join(\"\\n\")\n );\n};\n\n/**\n * Builds API Element (usually for \"section\" and \"data\" elements)\n * This generates a initial data structure for the section/data to avoid processing the React component\n * initial state on every single render.\n *\n * @param element API element\n * @param context\n * @returns\n */\nexport const buildElement = async (element: any, context: any) => {\n const path = `${process.env.GATSBY_PROJECT_ROOT}/src/components/element/${element.type}/${element.name}/build.js`;\n if (fs.existsSync(path)) {\n const module = await import(path);\n if (module?.build) {\n return await module.build(element, context);\n }\n // Show warning on development:\n } else if (process.env.ENV === \"development\") {\n console.warn(`build.js file not found: ${path}`);\n }\n return element;\n};\n","import { join_paths } from \"../url\";\nimport { ImageType, PageTagsType, QueryParamsType } from \"./types\";\nconst { getImage, withArtDirection } = module.require(\"gatsby-plugin-image\");\n\nexport const tagExists = (\n pageTags: PageTagsType,\n ...tags: string[]\n): boolean => {\n for (const tag of Object.keys(pageTags)) {\n if (tags.includes(tag)) {\n return true;\n }\n }\n return false;\n};\n\nexport const api_link = (\n apiPath: string = \"\",\n queryParams: QueryParamsType | null = null\n): string =>\n `${join_paths(\n `${process.env.API_PROTOCOL}://${process.env.API_HOST}`,\n apiPath\n )}${queryParams ? `?${new URLSearchParams(queryParams).toString()}` : \"\"}`;\n\nexport const buildImage = (img: ImageType) => {\n if (!img) {\n return undefined;\n }\n\n let fallback = {\n src: img.url,\n sizes: \"100vw\",\n srcSet: \"\",\n };\n let sources = [];\n let placeholder = { fallback: img.url };\n const sizes = [img.width, 360, 769, 1024, 1216, 1408].sort((a, b) => a - b);\n\n if (img.optimized) {\n fallback.src = img.url + img.name + \"-\" + img.width + \"w.jpg\";\n placeholder.fallback = img.url + img.name + \"-20w.jpg\";\n sources.push({ sizes: \"100vw\", srcSet: \"\", type: \"image/avif\" });\n sources.push({ sizes: \"100vw\", srcSet: \"\", type: \"image/webp\" });\n for (let index in sizes) {\n if (sizes[index] > img.width) {\n break;\n }\n let image_url =\n (index === \"0\" ? \"\" : \",\") + img.url + img.name + \"-\" + sizes[index];\n fallback.srcSet += image_url + \"w.jpg \" + sizes[index] + \"w\";\n sources[0].srcSet += image_url + \"w.avif \" + sizes[index] + \"w\";\n sources[1].srcSet += image_url + \"w.webp \" + sizes[index] + \"w\";\n }\n }\n\n return getImage({\n childImageSharp: {\n gatsbyImageData: {\n backgroundColor: \"transparent\",\n height: img.height / img.width,\n width: 1,\n layout: \"fullWidth\",\n placeholder: placeholder,\n images: {\n fallback: fallback,\n sources: sources,\n },\n },\n },\n });\n};\n\nexport const getImageData = (image: ImageType, mobileImage: ImageType) => {\n const image_data = buildImage(image);\n const mobile_image_data = buildImage(mobileImage);\n return image_data && mobile_image_data // If mobile image exists, it must be added using Art Direction.\n ? withArtDirection(image_data, [\n {\n media: \"(max-width: 768px)\",\n image: mobile_image_data,\n },\n ])\n : image_data;\n};\n\nexport const extractForm = (formSection: any) => {\n let form: any = {\n settings: {\n pk: 0,\n name: \"\",\n form_method: \"post\",\n form_submit: api_link(\"/v1/project/request/contact\"),\n form_redirection: null,\n form_ajax_request: null,\n recaptcha_action: \"\",\n recaptcha_v3: false,\n },\n items: [],\n fields: {},\n };\n\n form.settings.recaptcha_v3 = !!formSection.recaptcha_v3;\n form.settings.recaptcha_action =\n formSection.data.recaptcha_action ?? formSection.name;\n form.settings.pk = formSection.pk;\n form.settings.name = formSection.name;\n [\n \"form_submit\",\n \"form_recipient\",\n \"form_method\",\n \"form_redirection\",\n \"form_ajax_request\",\n \"form_success_msg\",\n ].map((cfg) => {\n if (formSection.hasOwnProperty(cfg)) {\n // @ts-ignore\n form.settings[cfg] = formSection[cfg];\n }\n });\n const validTypes = new Set([\n \"checkbox\",\n \"input\",\n \"select\",\n \"button\",\n \"google-places\",\n \"country-prefix\",\n \"textarea\",\n \"recaptcha2\",\n \"title\",\n \"text\",\n \"link\",\n \"image\",\n ]);\n let uniqueId = 0;\n const addItem = (parents: any, newItem: any): any => {\n let item = form.items;\n for (let key of parents) {\n item = item[key];\n if (!Array.isArray(item)) {\n item = item.children;\n }\n }\n item.push(newItem);\n };\n // Set Form fields:\n const setFormFields = (field: any, parents: any, k: number) => {\n let fieldName =\n field.input_name && !form.fields[field.input_name]\n ? field.input_name\n : field.name ?? `${field.type}${uniqueId++}`;\n\n if (\"section\" === field.type) {\n const sectionName = field.name ?? `sec_${parents.length}-${k}`;\n addItem(parents, { name: sectionName, children: [] });\n field.children.map((field: any, k2: any) =>\n setFormFields(field, [...parents, k], k2)\n );\n } else if (validTypes.has(field.type)) {\n addItem(parents, fieldName);\n form.fields[fieldName] = field;\n // Pre-process images (fixes flickering issue)\n if (field.type === \"image\") {\n form.fields[fieldName].imageData = getImageData(\n field.image,\n field.mobile_image\n );\n }\n }\n };\n\n formSection.children.map((field: any, k: any) => setFormFields(field, [], k));\n return form;\n};\n","export const defaultGatsbyConfig = (config: any = {}, plugins: any[] = []) => {\n if (!process.env.GATSBY_PROJECT_ROOT) {\n throw new Error(\n 'Please define \"process.env.GATSBY_PROJECT_ROOT = __dirname\" within the ./gatsby-config.js file.'\n );\n }\n\n return {\n siteMetadata: {\n title: process.env.SITE_TITLE,\n description: process.env.SITE_DESCRIPTION,\n siteUrl: `${process.env.PROTOCOL}://${process.env.HOST}`,\n image: process.env.SITE_IMAGE,\n protocol: process.env.PROTOCOL,\n domain: process.env.HOST,\n },\n plugins: [\n `gatsby-plugin-image`,\n \"gatsby-plugin-use-query-params\",\n \"gatsby-plugin-svgr\",\n `gatsby-transformer-sharp`,\n \"gatsby-plugin-sass\",\n {\n resolve: `gatsby-plugin-manifest`,\n options: {\n name: process.env.PROJECT_NAME,\n short_name: process.env.PROJECT,\n lang: process.env.PROJECT_DEFAULT_LANGUAGE,\n start_url: `/`,\n display: `standalone`,\n icon: `static/icons/favicon.png`,\n },\n },\n {\n resolve: `gatsby-plugin-sharp`,\n options: {\n defaults: {\n formats: [`auto`, `webp`, \"avif\"],\n placeholder: `blurred`,\n quality: 80,\n breakpoints: [360, 769, 1024, 1216, 1408],\n backgroundColor: `transparent`,\n tracedSVGOptions: {},\n blurredOptions: {},\n jpgOptions: {},\n pngOptions: {},\n webpOptions: {},\n avifOptions: {},\n },\n },\n },\n {\n resolve: \"gatsby-source-apiserver\",\n options: {\n typePrefix: \"API__\",\n method: \"get\",\n allowCache: false,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n data: {}, // Request body\n params: {},\n verboseOutput: false,\n // enableDevRefresh: true,\n entitiesArray: [\n {\n url: `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: \"full-content\",\n skipCreateNode: true,\n localSave: true,\n path: `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/`,\n },\n {\n url: `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/redirection/`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: \"redirections\",\n skipCreateNode: true,\n localSave: true,\n path: `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/`,\n },\n ],\n },\n },\n {\n resolve: `gatsby-plugin-s3`,\n options: {\n bucketName: process.env.S3_BUCKET,\n protocol: process.env.PROTOCOL,\n hostname: process.env.HOST,\n generateRoutingRules: true,\n generateRedirectObjectsForPermanentRedirects: true,\n acl: \"private\",\n },\n },\n {\n resolve: `gatsby-plugin-sitemap`,\n options: {\n excludes: [\"/404/\"],\n query: `\n {\n allSitePage {\n nodes {\n path\n pageContext\n }\n }\n }\n `,\n resolveSiteUrl: () => `${process.env.PROTOCOL}://${process.env.HOST}`,\n filterPages: (page: any) => page.is_hidden,\n serialize: (page: any, { resolvePagePath }: any) => {\n return {\n url: `${resolvePagePath(page)}`,\n lastmod: page.pageContext.published_at,\n };\n },\n },\n },\n {\n resolve: \"gatsby-plugin-google-tagmanager\",\n options: {\n id: process.env.GTM_ID,\n },\n },\n {\n resolve: \"gatsby-plugin-newrelic\",\n options: {\n config: {\n instrumentationType: \"proAndSPA\",\n accountId: process.env.NEWRELIC_ACCOUNT_ID,\n trustKey: process.env.NEWRELIC_TRUST_KEY,\n agentID: process.env.NEWRELIC_AGENT_ID,\n licenseKey: process.env.NEWRELIC_LICENSE_KEY,\n applicationID: process.env.NEWRELIC_APP_ID,\n beacon: \"bam.nr-data.net\",\n errorBeacon: \"bam.nr-data.net\",\n },\n },\n },\n ...plugins,\n ],\n ...config,\n };\n};\n"],"names":["join_paths","path1","path2","replace","RegExp","ssoURL","path","process","env","SABRE_SSO_PROTOCOL","SABRE_SSO_HOST","nOptions","n","start","defaultOpt","obj","i","toString","slugify","module","require","hotelOptionsByCity","hotelPages","hotelsByCity","Sydney","Melbourne","Perth","Hobart","Canberra","Adelaide","Darwin","Singapore","propertyOrder","Object","entries","reduce","acc","id","hotel","city","push","label","name","value","sort","map","options","a","b","joinAddress","addressParams","param","join","hotel_page_link","hotelName","lower","slice","fs","build","async","body","element","page","buildElement","slug","tags","data","createAPIPages","GATSBY_PROJECT_ROOT","Error","createPage","createRedirect","actions","jsonDoc","JSON","parse","readFileSync","excluded","is_hidden","is_active","DEV_PAGE","parseInt","component","resolve","context","createAPIRedirections","writeFileSync","stringify","forEach","redirect","fromPath","toPath","redirection","isPermanent","type","force","postBuild","excludedPages","robotsTxt","length","PROTOCOL","HOST","existsSync","import","ENV","console","warn","getImage","withArtDirection","tagExists","pageTags","tag","keys","includes","api_link","apiPath","queryParams","API_PROTOCOL","API_HOST","URLSearchParams","buildImage","img","fallback","src","url","sizes","srcSet","sources","placeholder","width","optimized","index","image_url","childImageSharp","gatsbyImageData","backgroundColor","height","layout","images","getImageData","image","mobileImage","image_data","mobile_image_data","media","extractForm","formSection","form","settings","pk","form_method","form_submit","form_redirection","form_ajax_request","recaptcha_action","recaptcha_v3","items","fields","cfg","hasOwnProperty","validTypes","Set","uniqueId","addItem","parents","newItem","item","key","Array","isArray","children","setFormFields","field","k","fieldName","input_name","sectionName","k2","has","imageData","mobile_image","defaultGatsbyConfig","config","plugins","siteMetadata","title","SITE_TITLE","description","SITE_DESCRIPTION","siteUrl","SITE_IMAGE","protocol","domain","PROJECT_NAME","short_name","PROJECT","lang","PROJECT_DEFAULT_LANGUAGE","start_url","display","icon","defaults","formats","quality","breakpoints","tracedSVGOptions","blurredOptions","jpgOptions","pngOptions","webpOptions","avifOptions","typePrefix","method","allowCache","headers","params","verboseOutput","entitiesArray","skipCreateNode","localSave","bucketName","S3_BUCKET","hostname","generateRoutingRules","generateRedirectObjectsForPermanentRedirects","acl","excludes","query","resolveSiteUrl","filterPages","serialize","resolvePagePath","lastmod","pageContext","published_at","GTM_ID","instrumentationType","accountId","NEWRELIC_ACCOUNT_ID","trustKey","NEWRELIC_TRUST_KEY","agentID","NEWRELIC_AGENT_ID","licenseKey","NEWRELIC_LICENSE_KEY","applicationID","NEWRELIC_APP_ID","beacon","errorBeacon"],"mappings":"AAAaA,MAAAA,EAAaA,CAACC,EAAeC,IACvC,GAAED,EAAME,QAAQ,IAAIC,OAAQ,MAAM,OAAOF,EAAMC,QAC9C,IAAIC,OAAQ,MACZ,MAGSC,EAAUC,GACpB,GAAEC,QAAQC,IAAIC,wBAAwBF,QAAQC,IAAIE,iBAAiBJ,ICKzDK,EAAWA,CACtBC,EACAC,EAAQ,EACRC,EAAa,CAAA,KAEb,MAAMC,EAAoB,IAAKD,GAC/B,IAAK,IAAIE,EAAIH,EAAOG,EAAIH,EAAQD,EAAGI,IACjCD,EAAIC,EAAEC,YAAcD,EAAEC,WAExB,OAAOF,CAAG,ECrBNG,EAAU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AAgBzK,KACxB0K,QAAS1K,EAAK2K,YAAYC,iBAKlC,CACEvJ,QAAS,kCACTrC,QAAS,CACPT,GAAI9B,QAAQC,IAAImO,SAGpB,CACExJ,QAAS,yBACTrC,QAAS,CACPwI,OAAQ,CACNsD,oBAAqB,YACrBC,UAAWtO,QAAQC,IAAIsO,oBACvBC,SAAUxO,QAAQC,IAAIwO,mBACtBC,QAAS1O,QAAQC,IAAI0O,kBACrBC,WAAY5O,QAAQC,IAAI4O,qBACxBC,cAAe9O,QAAQC,IAAI8O,gBAC3BC,OAAQ,kBACRC,YAAa,wBAIhBjE,MAEFD,EACJ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tfehotels/tfe-gatsby-library",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared functions and utilities for TFE's Gatsby websites.",
|
|
5
|
+
"main": "./lib/index.node.cjs",
|
|
6
|
+
"module": "./lib/index.node.esm.js",
|
|
7
|
+
"types": "./lib/index.browser.d.ts",
|
|
8
|
+
"browser": {
|
|
9
|
+
"./lib/index.node.cjs": "./lib/index.browser.cjs"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./lib/index.browser.esm.js",
|
|
14
|
+
"require": "./lib/index.browser.cjs",
|
|
15
|
+
"types": "./lib/index.browser.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./node": {
|
|
18
|
+
"import": "./lib/index.node.esm.js",
|
|
19
|
+
"require": "./lib/index.node.cjs",
|
|
20
|
+
"types": "./lib/index.node.d.ts"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"repository": "git@github.com:tfehotels/tfe-gatsby-library.git",
|
|
25
|
+
"author": "TFE Hotels",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"private": false,
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "npm run clean; cross-env NODE_ENV=production rollup -c; npm run type:gen",
|
|
30
|
+
"clean": "rimraf ./coverage ./lib ./declarations-browser ./declarations-node",
|
|
31
|
+
"type:gen": "./scripts/typegen.sh"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"/lib",
|
|
35
|
+
"/src"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@fortawesome/fontawesome-svg-core": "^6.5.2",
|
|
39
|
+
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
40
|
+
"classnames": "^2.3.2",
|
|
41
|
+
"date-fns": "^2.30.0",
|
|
42
|
+
"embla-carousel-react": "^8.0.2",
|
|
43
|
+
"gatsby": "^5.13.3",
|
|
44
|
+
"gatsby-plugin-image": "^3.13.1",
|
|
45
|
+
"html-react-parser": "^5.1.10",
|
|
46
|
+
"marked": "^12.0.1",
|
|
47
|
+
"react": "^18.2.0",
|
|
48
|
+
"react-dom": "^18.2.0",
|
|
49
|
+
"react-google-autocomplete": "^2.7.3",
|
|
50
|
+
"react-google-recaptcha-v3": "^1.10.1",
|
|
51
|
+
"react-hot-toast": "^2.4.1",
|
|
52
|
+
"react-select": "^5.8.0",
|
|
53
|
+
"slugify": "^1.6.6",
|
|
54
|
+
"transition-hook": "^1.5.2"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@babel/core": "^7.24.4",
|
|
58
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
59
|
+
"@babel/plugin-transform-runtime": "^7.24.3",
|
|
60
|
+
"@babel/preset-env": "^7.24.4",
|
|
61
|
+
"@babel/preset-react": "^7.24.1",
|
|
62
|
+
"@babel/preset-typescript": "^7.24.1",
|
|
63
|
+
"@babel/register": "^7.23.7",
|
|
64
|
+
"@rollup/plugin-alias": "^5.1.0",
|
|
65
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
66
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
67
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
68
|
+
"@rollup/plugin-multi-entry": "^6.0.1",
|
|
69
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
70
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
71
|
+
"@types/googlemaps": "^3.43.3",
|
|
72
|
+
"@types/react": "^18.2.75",
|
|
73
|
+
"@types/react-dom": "^18.2.24",
|
|
74
|
+
"cross-env": "^7.0.3",
|
|
75
|
+
"prettier": "^3.2.5",
|
|
76
|
+
"rimraf": "^5.0.5",
|
|
77
|
+
"rollup": "^4.14.1",
|
|
78
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
79
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
80
|
+
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
81
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
82
|
+
"typescript": "^5.4.4"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { ButtonPropsType } from "./types"
|
|
3
|
+
|
|
4
|
+
const Button: React.FC<ButtonPropsType> = ({ ...props }) => {
|
|
5
|
+
return (
|
|
6
|
+
<button
|
|
7
|
+
className={props.className}
|
|
8
|
+
type={props.input_type ?? "button"}
|
|
9
|
+
onClick={props.onClick}
|
|
10
|
+
>
|
|
11
|
+
{props.value}
|
|
12
|
+
</button>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default Button;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { CheckboxPropsType } from "./types"
|
|
3
|
+
import Markdown from "../../markdown"
|
|
4
|
+
// import { motion, useMotionValue, useTransform } from "framer-motion"
|
|
5
|
+
|
|
6
|
+
// const tickVariants = {
|
|
7
|
+
// pressed: (isChecked: boolean) => ({ pathLength: isChecked ? 0.85 : 0.2 }),
|
|
8
|
+
// checked: { pathLength: 1 },
|
|
9
|
+
// unchecked: { pathLength: 0 },
|
|
10
|
+
// }
|
|
11
|
+
|
|
12
|
+
// const boxVariants = {
|
|
13
|
+
// hover: { scale: 1.05, strokeWidth: 4 },
|
|
14
|
+
// pressed: { scale: 0.95, strokeWidth: 4 },
|
|
15
|
+
// checked: { stroke: "#b4b2e6" },
|
|
16
|
+
// unchecked: { stroke: "#b4b2e6", strokeWidth: 4 },
|
|
17
|
+
// }
|
|
18
|
+
|
|
19
|
+
export default function Checkbox({
|
|
20
|
+
className,
|
|
21
|
+
label,
|
|
22
|
+
description,
|
|
23
|
+
...props
|
|
24
|
+
}: CheckboxPropsType) {
|
|
25
|
+
// const pathLength = useMotionValue(0)
|
|
26
|
+
// const opacity = useTransform(pathLength, [0.05, 0.15], [0, 1])
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<label
|
|
30
|
+
className={`checkbox ${className ? ` ${className}` : ""}`}
|
|
31
|
+
onClick={props.onClick}
|
|
32
|
+
onChange={props.onChange}
|
|
33
|
+
>
|
|
34
|
+
{!!label && <span>{label}</span>}
|
|
35
|
+
<svg
|
|
36
|
+
id={props.id}
|
|
37
|
+
// initial={props.value}
|
|
38
|
+
// animate={props.value ? "checked" : "unchecked"}
|
|
39
|
+
// whileHover="hover"
|
|
40
|
+
// whileTap="pressed"
|
|
41
|
+
width={props.width ? props.width : 30}
|
|
42
|
+
height={props.height ? props.height : 30}
|
|
43
|
+
viewBox="0 0 440 440"
|
|
44
|
+
>
|
|
45
|
+
<path
|
|
46
|
+
d="M 72 136 C 72 100.654 100.654 72 136 72 L 304 72 C 339.346 72 368 100.654 368 136 L 368 304 C 368 339.346 339.346 368 304 368 L 136 368 C 100.654 368 72 339.346 72 304 Z"
|
|
47
|
+
fill={props.color ? props.color : "#58595b"}
|
|
48
|
+
strokeWidth={3}
|
|
49
|
+
stroke="#FF008C"
|
|
50
|
+
// variants={boxVariants}
|
|
51
|
+
/>
|
|
52
|
+
<path
|
|
53
|
+
// d="M 90 110 L 128 240 L 341.808 0"
|
|
54
|
+
d="M 160 180 L 210 250 L 340 130"
|
|
55
|
+
// transform="translate(54.917 68.947) rotate(-4 170.904 18.687)"
|
|
56
|
+
transform="translate(40 65) rotate(-10 70.904 438.687)"
|
|
57
|
+
fill="transparent"
|
|
58
|
+
strokeWidth={30}
|
|
59
|
+
stroke="white"
|
|
60
|
+
strokeLinecap="square"
|
|
61
|
+
strokeLinejoin="miter"
|
|
62
|
+
// variants={tickVariants}
|
|
63
|
+
// style={{ pathLength, opacity }}
|
|
64
|
+
// custom={props.value}
|
|
65
|
+
/>
|
|
66
|
+
</svg>
|
|
67
|
+
{!!description && (
|
|
68
|
+
<div>
|
|
69
|
+
<Markdown>{description}</Markdown>
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
</label>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MouseEventHandler, ChangeEventHandler } from "react"
|
|
2
|
+
|
|
3
|
+
export interface CheckboxPropsType {
|
|
4
|
+
onClick?: MouseEventHandler<HTMLLabelElement>
|
|
5
|
+
onChange?: ChangeEventHandler<HTMLLabelElement>
|
|
6
|
+
className?: string
|
|
7
|
+
value: boolean
|
|
8
|
+
width?: number
|
|
9
|
+
height?: number
|
|
10
|
+
id?: string
|
|
11
|
+
name?: string
|
|
12
|
+
input_name?: string
|
|
13
|
+
color?: string
|
|
14
|
+
accept?: string
|
|
15
|
+
label?: string
|
|
16
|
+
description?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CheckboxesTypes {
|
|
20
|
+
[key: string]: any
|
|
21
|
+
}
|