@tfehotels/tfe-gatsby-library 1.0.149 → 1.0.150
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/lib/index.node.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e=9){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let s="";for(let r=0;r<e;r++)s+=t.charAt(Math.floor(62*Math.random()));return s}const t=(e,t)=>`${e.replace(new RegExp("/$"),"")}/${t.replace(new RegExp("^/"),"")}`,s=module.require("slugify"),r=e=>e.filter((e=>!!e)).join(", ");const n=module.require("fs");module.require("path");const o=async(e,t)=>{let s=[];e=(e=>{const t=process.env.HOST.replace(/^(test\.|staging\.)/,"");if(e.data?.metas?.[t]?.[e.language])for(const[s,r]of Object.entries(e.data.metas[t][e.language]))"title"!==s?e.head.metas[s]=r:e.head.title=r;return e})(e);for(const r of e.body)s.push(await i(r,{slug:e.slug,tags:e.tags,data:e.data,pageLangs:t.reduce(((t,s)=>(t[s]=e[s],t)),{})}));return e.body=s,e},a=(e,t,s,r)=>{const o=[...r,...JSON.parse(n.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,"utf-8")).reduce(((e,r)=>{if(t)for(const t of s)e.push({type:r.type,page:`/${t}${r.page}`,redirection:`${"/"===r.redirection[0]?`/${t}`:""}${r.redirection}`});else e.push(r);return e}),[])];t&&o.push({page:"/",redirection:`${process.env.PROTOCOL}://${process.env.HOST}/en/`,type:"301"}),o.forEach((t=>{e({fromPath:t.page,toPath:t.redirection,isPermanent:Boolean(process.env.NOT_CREATE_S3_ROUTING_RULES)||"301"===t.type,redirectInBrowser:!0,force:!0})}))},i=async(e,t)=>{const s=`${process.env.GATSBY_PROJECT_ROOT}/src/components/element/${e.type}/${e.name}/build.js`;if(n.existsSync(s)){const r=await import(s);if(r?.build)return await r.build(e,t)}else"development"===process.env.ENV&&console.warn(`build.js file not found: ${s}`);return e},{getImage:c,withArtDirection:l}=module.require("gatsby-plugin-image"),p=module.require("fs"),u=module.require("path"),d=(e="",s=null)=>`${t(`${process.env.API_PROTOCOL}://${process.env.API_HOST}`,e)}${s?`?${new URLSearchParams(s).toString()}`:""}`,g=e=>{if(!e)return;let t={src:e.url,sizes:"100vw",srcSet:""},s=[],r={fallback:e.url};const n=[e.width,360,769,1024,1216,1408].sort(((e,t)=>e-t));if(e.optimized){t.src=e.url+e.name+"-"+e.width+"w.jpg",r.fallback=e.url+e.name+"-20w.jpg",s.push({sizes:"100vw",srcSet:"",type:"image/avif"}),s.push({sizes:"100vw",srcSet:"",type:"image/webp"});for(let r in n){if(n[r]>e.width)break;let o=("0"===r?"":",")+e.url+e.name+"-"+n[r];t.srcSet+=o+"w.jpg "+n[r]+"w",s[0].srcSet+=o+"w.avif "+n[r]+"w",s[1].srcSet+=o+"w.webp "+n[r]+"w"}}return c({childImageSharp:{gatsbyImageData:{backgroundColor:"transparent",height:e.height/e.width,width:1,layout:"fullWidth",placeholder:r,images:{fallback:t,sources:s}}}})},O=(e,t)=>{const s=g(e),r=g(t);return s&&r?l(s,[{media:"(max-width: 768px)",image:r}]):s},m=require("fs");exports.apiLink=d,exports.buildElement=i,exports.buildImage=g,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 t=JSON.parse(n.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/projectMetadata.json`,"utf-8")),s=t.languages.length>1,{createPage:r,createRedirect:i}=e;let c=[],l=[];for(const e of t.languages){const a=JSON.parse(n.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/site-${e}.json`,"utf-8"));for(const n of a){if(n.is_hidden&&l.push(n.slug),!n.is_active)continue;if(s&&n.redirect_to_english&&!n[e]){c.push({page:n.slug,redirection:`${process.env.PROTOCOL}://${process.env.HOST}/en/${n.slug.slice(4)}`,type:"302"});continue}if(process.env.DEV_PAGE&&n.id!==parseInt(`${process.env.DEV_PAGE}`)){console.warn("DEV_PAGE is defined on .env.development file! Only one page will be generated!");continue}const a=require.resolve(`${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`),i=await o(n,t.languages);r({path:n.slug,component:a,context:i}),s&&"/en/404/"===n.slug&&r({path:"/404/",component:a,context:i})}}a(i,s,t.languages,c),n.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,JSON.stringify(l))},exports.createWebpackConfig=({actions:e,getConfig:t})=>{const s=t();let r={...s.resolve.alias};s.resolve={...s.resolve,alias:r},e.replaceWebpackConfig(s)},exports.cropText=function(e,t=250){if(e.length<=t)return e;const s=e.substring(0,t),r=s.lastIndexOf(" ");return r>0?s.substring(0,r)+"...":s+"..."},exports.dealLink=e=>{if(!process.env.DEALS_ROOT_SLUG)throw new Error("The env variable DEALS_ROOT_SLUG is not defined!");return t(process.env.DEALS_ROOT_SLUG,e)},exports.defaultGatsbyConfig=(e={},t=[])=>{if(!process.env.GATSBY_PROJECT_ROOT)throw new Error('Please define "process.env.GATSBY_PROJECT_ROOT = __dirname" within the ./gatsby-config.js file.');const s=process.env.GATSBY_PROJECT_ROOT,r=JSON.parse(m.readFileSync(`${s}/src/data/projectMetadata.json`,"utf-8")),n=r.languages.length>1;return n&&(t.push({resolve:"gatsby-source-filesystem",options:{path:`${s}/locales`,name:"locale"}}),t.push({resolve:"gatsby-plugin-react-i18next",options:{localeJsonSourceName:"locale",defaultLanguage:process.env.PROJECT_DEFAULT_LANGUAGE,fallbackLng:process.env.PROJECT_DEFAULT_LANGUAGE,languages:r.languages,siteUrl:`${process.env.PROTOCOL}://${process.env.HOST}`,trailingSlash:"always",i18nextOptions:{interpolation:{escapeValue:!1},keySeparator:!1,nsSeparator:!1,react:{transSupportBasicHtmlNodes:!0,transKeepBasicHtmlNodesFor:["a","br","span","strong","i","p","ul","li","h1","h2","h3","h4","h5"]}},redirect:!1,pages:[{matchPath:"/:lang?/(.*)",getLanguageFromPath:!0,languages:r.languages}]}})),process.env.GTM_ID&&t.push({resolve:"gatsby-plugin-google-tagmanager",options:{id:process.env.GTM_ID}}),{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:r.name,short_name:r.name,lang:process.env.PROJECT_DEFAULT_LANGUAGE,background_color:r.background_colour,theme_color:r.colour,start_url:"/",display:"standalone",icon:process.env.PROJECT_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}/redirection/`,headers:{"Content-Type":"application/json"},name:"redirections",skipCreateNode:!0,localSave:!0,path:`${s}/src/data/pages/`},...r.languages.map((e=>({url:`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/?language=${e}`,headers:{"Content-Type":"application/json"},name:`site-${e}`,skipCreateNode:!0,localSave:!0,path:`${s}/src/data/pages/`})))]}},{resolve:"gatsby-plugin-s3",options:{bucketName:process.env.S3_BUCKET,protocol:process.env.PROTOCOL,hostname:process.env.HOST,generateRoutingRules:!process.env.NOT_CREATE_S3_ROUTING_RULES,generateRedirectObjectsForPermanentRedirects:!0,generateRedirectObjectsForTemporaryRedirects:!0,acl:"private"}},{resolve:"gatsby-plugin-sitemap",options:{excludes:["/404/","/**/404/",n?"/":""],query:"\n {\n allSitePage {\n nodes {\n path\n pageContext\n }\n }\n }\n ",resolveSiteUrl:()=>`${process.env.PROTOCOL}://${process.env.HOST}`,filterPages:e=>e.pageContext.is_hidden,serialize:(e,{resolvePagePath:t})=>{const s={url:t(e),lastmod:e.pageContext.published_at};return n&&(s.links=r.languages.reduce(((t,r)=>(e.pageContext.redirect_to_english&&"en"!==r||t.push({lang:r,url:s.url.replace(/^\/[a-z]{2}\//,`/${r}/`)}),t)),[{lang:"x-default",url:s.url.replace(/^\/[a-z]{2}\//,`/${process.env.PROJECT_DEFAULT_LANGUAGE}/`)}])),s}}},...t],...e}},exports.extractForm=e=>{let t={settings:{pk:0,name:"",form_method:"post",form_submit:d("/v1/project/request/contact"),form_redirection:null,form_ajax_request:null,recaptcha_action:"",recaptcha_v3:!1,gtm_event:null},items:[],fields:{}};t.settings.recaptcha_v3=!!e.recaptcha_v3,t.settings.recaptcha_action=e.data.recaptcha_action??e.name,t.settings.pk=e.pk,t.settings.name=e.name,["form_submit","form_recipient","form_method","form_redirection","form_ajax_request","form_success_msg","gtm_event"].map((s=>{e.hasOwnProperty(s)&&(t.settings[s]=e[s])}));const s=new Set(["checkbox","input","select","button","google-places","country-prefix","country","textarea","recaptcha2","title","text","link","image"]);let r=0;const n=(e,s)=>{let r=t.items;for(let t of e)r=r[t],Array.isArray(r)||(r=r.children);r.push(s)},o=(e,a,i)=>{let c=e.input_name&&!t.fields[e.input_name]?e.input_name:e.name??`${e.type}${r++}`;if("section"===e.type){const t=e.name??`sec_${a.length}-${i}`;n(a,{name:t,children:[]}),e.children.map(((e,t)=>o(e,[...a,i],t)))}else s.has(e.type)&&(n(a,c),t.fields[c]=e,"image"===e.type&&(t.fields[c].imageData=O(e.image,e.mobile_image)))};return e.children.map(((e,t)=>o(e,[],t))),t},exports.fetchProjectMetadata=async e=>{const t=`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/`;try{const s=await fetch(t);if(!s.ok)throw new Error(`Failed to fetch project metadata data from "${t}": ${s.statusText}`);const r=await s.json(),n=`${e}/src/data/`,o="projectMetadata.json";p.writeFileSync(u.resolve(n,o),JSON.stringify(r,null,2)),console.log(`[32msuccess[0m Project metadata fetched and saved to:\r\n"${n}${o}"`)}catch(e){console.error(`Error fetching project metadata from "${t}" data:\r\n`,e),process.exit(1)}},exports.getImageData=O,exports.hotelOptionsByCity=(e,t)=>{const s=["Sydney","Melbourne","Brisbane","Perth","Hobart","Canberra","Adelaide","Gold Coast","Darwin","Auckland","Wellington","Queenstown","Singapore"],r={};for(const t in e)if(e.hasOwnProperty(t)){const s=e[t];r[s.city]||(r[s.city]=[]),r[s.city].push({label:s.name,value:t,sort:s.sort,country_id:s.country_id})}let n=Object.keys(r).map((e=>({label:e,options:r[e].sort(((e,t)=>e.sort-t.sort))})));return t?n.sort(((e,r)=>{const n=e.options.length>0?e.options[0].country_id:null,o=r.options.length>0?r.options[0].country_id:null,a=n&&void 0!==t[n]?t[n]:1/0,i=o&&void 0!==t[o]?t[o]:1/0;if(a!==i)return a-i;return(s.includes(e.label)?s.indexOf(e.label):1/0)-(s.includes(r.label)?s.indexOf(r.label):1/0)})):n.sort(((e,t)=>(s.includes(e.label)?s.indexOf(e.label):1/0)-(s.includes(t.label)?s.indexOf(t.label):1/0))),n},exports.hotelPageLink=(e,t,r="en")=>{const n={TRA:{root:`/book-accommodation/${s(e,{lower:!0})}`,slice:11},VIB:{root:`/book-accommodation/${s(e,{lower:!0})}`,slice:5},ADI:{root:`/${r}/apartments/`,slice:22}};return`${n[process.env.PROJECT].root}/${s(t,{lower:!0}).slice(n[process.env.PROJECT].slice)}`},exports.joinAddress=r,exports.joinPaths=t,exports.localizedAddress=function(e,t={}){const{city:s,address1:n,address2:o,postalCode:a}=t;let{stateId:i}=t;i&&/^[a-zA-Z]{2}-/.test(i)&&(i=i.split("-")[1]);const c=[n,o].filter(Boolean).join(" ");let l;const p=e?.toLowerCase();if(["de","dk","at","ch"].includes(p)){l=[c,[a,s].filter(Boolean).join(" ")]}else l="hu"===p?[s,c,a]:[c,s,i,a];return r(l)},exports.nOptions=(e,t=0,s={})=>{const r={...s};for(let s=t;s<t+e;s++)r[s.toString()]=s.toString();return r},exports.opentableLink=t=>`https://www.opentable.com.au/restref/client?rid=${t}&restref=${t}&lang=en-AU&r3uid=${e(9)}&ot_source=Restaurant+website&color=1`,exports.postBuild=()=>{const e=JSON.parse(n.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,"utf-8")),t=["User-agent: *",""+("production"===process.env.ENV?"Allow: /":"Disallow: /"),`${e.length?e.map((e=>`Disallow: ${e}`)).join("\n"):""}`,`Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/sitemap-index.xml`,`Host: ${process.env.PROTOCOL}://${process.env.HOST}`];n.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/public/robots.txt`,t.join("\n"))},exports.randomString=e,exports.ssoURL=e=>{if(!process.env.SABRE_SSO_HOST)throw new Error("The env variable SABRE_SSO_HOST is not defined!");if("development"!==process.env.ENV){const t=[".co.nz",".com.au",".com",".co",".au",".nz"].find((e=>process.env.SABRE_SSO_HOST.endsWith(e)));if(t&&process.env.HOST&&!process.env.HOST.endsWith(t)){const t=process.env.HOST.replace(/^(test\.|staging\.)/,"");return`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST?.split(".")[0]}.${t}${e}`}}return`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${e}`},exports.tagExists=(e,...t)=>{for(const s of Object.keys(e))if(t.includes(s))return!0;return!1},exports.tripadvisorRatingURL=e=>`https://www.tripadvisor.com/img/cdsi/img2/ratings/traveler/${(Math.floor(2*parseFloat(e))/2).toFixed(1)}-41022-5.svg`;
|
|
1
|
+
"use strict";function e(e=9){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let s="";for(let r=0;r<e;r++)s+=t.charAt(Math.floor(62*Math.random()));return s}const t=(e,t)=>`${e.replace(new RegExp("/$"),"")}/${t.replace(new RegExp("^/"),"")}`,s=module.require("slugify"),r=e=>e.filter((e=>!!e)).join(", ");const n=module.require("fs");module.require("path");const o=async(e,t)=>{let s=[];e=(e=>{const t=process.env.HOST.replace(/^(test\.|staging\.)/,"");if(e.data?.metas?.[t]?.[e.language])for(const[s,r]of Object.entries(e.data.metas[t][e.language]))"title"!==s?e.head.metas[s]=r:e.head.title=r;return e})(e);for(const r of e.body)s.push(await i(r,{slug:e.slug,tags:e.tags,data:e.data,pageLangs:t.reduce(((t,s)=>(t[s]=e[s],t)),{})}));return e.body=s,e},a=(e,t,s,r)=>{const o=[...r,...JSON.parse(n.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,"utf-8")).reduce(((e,r)=>{if(t)for(const t of s)e.push({type:r.type,page:`/${t}${r.page}`,redirection:`${"/"===r.redirection[0]?`/${t}`:""}${r.redirection}`});else e.push(r);return e}),[])];t&&o.push({page:"/",redirection:`${process.env.PROTOCOL}://${process.env.HOST}/en/`,type:"301"}),o.forEach((t=>{e({fromPath:t.page,toPath:t.redirection,isPermanent:Boolean(process.env.NOT_CREATE_S3_ROUTING_RULES)||"301"===t.type,redirectInBrowser:!0,force:!0})}))},i=async(e,t)=>{const s=`${process.env.GATSBY_PROJECT_ROOT}/src/components/element/${e.type}/${e.name}/build.js`;if(n.existsSync(s)){const r=await import(s);if(r?.build)return await r.build(e,t)}else"development"===process.env.ENV&&console.warn(`build.js file not found: ${s}`);return e},{getImage:c,withArtDirection:l}=module.require("gatsby-plugin-image"),p=module.require("fs"),u=module.require("path"),d=(e="",s=null)=>`${t(`${process.env.API_PROTOCOL}://${process.env.API_HOST}`,e)}${s?`?${new URLSearchParams(s).toString()}`:""}`,g=e=>{if(!e)return;let t={src:e.url,sizes:"100vw",srcSet:""},s=[],r={fallback:e.url};const n=[e.width,360,769,1024,1216,1408].sort(((e,t)=>e-t));if(e.optimized){t.src=e.url+e.name+"-"+e.width+"w.jpg",r.fallback=e.url+e.name+"-20w.jpg",s.push({sizes:"100vw",srcSet:"",type:"image/avif"}),s.push({sizes:"100vw",srcSet:"",type:"image/webp"});for(let r in n){if(n[r]>e.width)break;let o=("0"===r?"":",")+e.url+e.name+"-"+n[r];t.srcSet+=o+"w.jpg "+n[r]+"w",s[0].srcSet+=o+"w.avif "+n[r]+"w",s[1].srcSet+=o+"w.webp "+n[r]+"w"}}return c({childImageSharp:{gatsbyImageData:{backgroundColor:"transparent",height:e.height/e.width,width:1,layout:"fullWidth",placeholder:r,images:{fallback:t,sources:s}}}})},O=(e,t)=>{const s=g(e),r=g(t);return s&&r?l(s,[{media:"(max-width: 768px)",image:r}]):s},m=require("fs");exports.apiLink=d,exports.buildElement=i,exports.buildImage=g,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 t=JSON.parse(n.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/projectMetadata.json`,"utf-8")),s=t.languages.length>1,{createPage:r,createRedirect:i}=e;let c=[],l=[];for(const e of t.languages){const a=JSON.parse(n.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/site-${e}.json`,"utf-8"));for(const n of a){if(n.is_hidden&&l.push(n.slug),!n.is_active)continue;if(s&&n.redirect_to_english&&!n[e]){c.push({page:n.slug,redirection:`${process.env.PROTOCOL}://${process.env.HOST}/en/${n.slug.slice(4)}`,type:"302"});continue}if(process.env.DEV_PAGE&&n.id!==parseInt(`${process.env.DEV_PAGE}`)){console.warn("DEV_PAGE is defined on .env.development file! Only one page will be generated!");continue}const a=require.resolve(`${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`),i=await o(n,t.languages);r({path:n.slug,component:a,context:i}),s&&"/en/404/"===n.slug&&r({path:"/404/",component:a,context:i})}}a(i,s,t.languages,c),n.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,JSON.stringify(l))},exports.createWebpackConfig=({actions:e,getConfig:t})=>{const s=t();let r={...s.resolve.alias};s.resolve={...s.resolve,alias:r},e.replaceWebpackConfig(s)},exports.cropText=function(e,t=250){if(e.length<=t)return e;const s=e.substring(0,t),r=s.lastIndexOf(" ");return r>0?s.substring(0,r)+"...":s+"..."},exports.dealLink=e=>{if(!process.env.DEALS_ROOT_SLUG)throw new Error("The env variable DEALS_ROOT_SLUG is not defined!");return t(process.env.DEALS_ROOT_SLUG,e)},exports.defaultGatsbyConfig=(e={},t=[])=>{if(!process.env.GATSBY_PROJECT_ROOT)throw new Error('Please define "process.env.GATSBY_PROJECT_ROOT = __dirname" within the ./gatsby-config.js file.');const s=process.env.GATSBY_PROJECT_ROOT,{version:r}=JSON.parse(m.readFileSync(`${s}/package.json`,"utf-8")),n=JSON.parse(m.readFileSync(`${s}/src/data/projectMetadata.json`,"utf-8")),o=n.languages.length>1;return o&&(t.push({resolve:"gatsby-source-filesystem",options:{path:`${s}/locales`,name:"locale"}}),t.push({resolve:"gatsby-plugin-react-i18next",options:{localeJsonSourceName:"locale",defaultLanguage:process.env.PROJECT_DEFAULT_LANGUAGE,fallbackLng:process.env.PROJECT_DEFAULT_LANGUAGE,languages:n.languages,siteUrl:`${process.env.PROTOCOL}://${process.env.HOST}`,trailingSlash:"always",i18nextOptions:{interpolation:{escapeValue:!1},keySeparator:!1,nsSeparator:!1,react:{transSupportBasicHtmlNodes:!0,transKeepBasicHtmlNodesFor:["a","br","span","strong","i","p","ul","li","h1","h2","h3","h4","h5"]}},redirect:!1,pages:[{matchPath:"/:lang?/(.*)",getLanguageFromPath:!0,languages:n.languages}]}})),process.env.GTM_ID&&t.push({resolve:"gatsby-plugin-google-tagmanager",options:{id:process.env.GTM_ID}}),{siteMetadata:{version:r,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:n.name,short_name:n.name,lang:process.env.PROJECT_DEFAULT_LANGUAGE,background_color:n.background_colour,theme_color:n.colour,start_url:"/",display:"standalone",icon:process.env.PROJECT_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}/redirection/`,headers:{"Content-Type":"application/json"},name:"redirections",skipCreateNode:!0,localSave:!0,path:`${s}/src/data/pages/`},...n.languages.map((e=>({url:`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/?language=${e}`,headers:{"Content-Type":"application/json"},name:`site-${e}`,skipCreateNode:!0,localSave:!0,path:`${s}/src/data/pages/`})))]}},{resolve:"gatsby-plugin-s3",options:{bucketName:process.env.S3_BUCKET,protocol:process.env.PROTOCOL,hostname:process.env.HOST,generateRoutingRules:!process.env.NOT_CREATE_S3_ROUTING_RULES,generateRedirectObjectsForPermanentRedirects:!0,generateRedirectObjectsForTemporaryRedirects:!0,acl:"private"}},{resolve:"gatsby-plugin-sitemap",options:{excludes:["/404/","/**/404/",o?"/":""],query:"\n {\n allSitePage {\n nodes {\n path\n pageContext\n }\n }\n }\n ",resolveSiteUrl:()=>`${process.env.PROTOCOL}://${process.env.HOST}`,filterPages:e=>e.pageContext.is_hidden,serialize:(e,{resolvePagePath:t})=>{const s={url:t(e),lastmod:e.pageContext.published_at};return o&&(s.links=n.languages.reduce(((t,r)=>(e.pageContext.redirect_to_english&&"en"!==r||t.push({lang:r,url:s.url.replace(/^\/[a-z]{2}\//,`/${r}/`)}),t)),[{lang:"x-default",url:s.url.replace(/^\/[a-z]{2}\//,`/${process.env.PROJECT_DEFAULT_LANGUAGE}/`)}])),s}}},...t],...e}},exports.extractForm=e=>{let t={settings:{pk:0,name:"",form_method:"post",form_submit:d("/v1/project/request/contact"),form_redirection:null,form_ajax_request:null,recaptcha_action:"",recaptcha_v3:!1,gtm_event:null},items:[],fields:{}};t.settings.recaptcha_v3=!!e.recaptcha_v3,t.settings.recaptcha_action=e.data.recaptcha_action??e.name,t.settings.pk=e.pk,t.settings.name=e.name,["form_submit","form_recipient","form_method","form_redirection","form_ajax_request","form_success_msg","gtm_event"].map((s=>{e.hasOwnProperty(s)&&(t.settings[s]=e[s])}));const s=new Set(["checkbox","input","select","button","google-places","country-prefix","country","textarea","recaptcha2","title","text","link","image"]);let r=0;const n=(e,s)=>{let r=t.items;for(let t of e)r=r[t],Array.isArray(r)||(r=r.children);r.push(s)},o=(e,a,i)=>{let c=e.input_name&&!t.fields[e.input_name]?e.input_name:e.name??`${e.type}${r++}`;if("section"===e.type){const t=e.name??`sec_${a.length}-${i}`;n(a,{name:t,children:[]}),e.children.map(((e,t)=>o(e,[...a,i],t)))}else s.has(e.type)&&(n(a,c),t.fields[c]=e,"image"===e.type&&(t.fields[c].imageData=O(e.image,e.mobile_image)))};return e.children.map(((e,t)=>o(e,[],t))),t},exports.fetchProjectMetadata=async e=>{const t=`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/`;try{const s=await fetch(t);if(!s.ok)throw new Error(`Failed to fetch project metadata data from "${t}": ${s.statusText}`);const r=await s.json(),n=`${e}/src/data/`,o="projectMetadata.json";p.writeFileSync(u.resolve(n,o),JSON.stringify(r,null,2)),console.log(`[32msuccess[0m Project metadata fetched and saved to:\r\n"${n}${o}"`)}catch(e){console.error(`Error fetching project metadata from "${t}" data:\r\n`,e),process.exit(1)}},exports.getImageData=O,exports.hotelOptionsByCity=(e,t)=>{const s=["Sydney","Melbourne","Brisbane","Perth","Hobart","Canberra","Adelaide","Gold Coast","Darwin","Auckland","Wellington","Queenstown","Singapore"],r={};for(const t in e)if(e.hasOwnProperty(t)){const s=e[t];r[s.city]||(r[s.city]=[]),r[s.city].push({label:s.name,value:t,sort:s.sort,country_id:s.country_id})}let n=Object.keys(r).map((e=>({label:e,options:r[e].sort(((e,t)=>e.sort-t.sort))})));return t?n.sort(((e,r)=>{const n=e.options.length>0?e.options[0].country_id:null,o=r.options.length>0?r.options[0].country_id:null,a=n&&void 0!==t[n]?t[n]:1/0,i=o&&void 0!==t[o]?t[o]:1/0;if(a!==i)return a-i;return(s.includes(e.label)?s.indexOf(e.label):1/0)-(s.includes(r.label)?s.indexOf(r.label):1/0)})):n.sort(((e,t)=>(s.includes(e.label)?s.indexOf(e.label):1/0)-(s.includes(t.label)?s.indexOf(t.label):1/0))),n},exports.hotelPageLink=(e,t,r="en")=>{const n={TRA:{root:`/book-accommodation/${s(e,{lower:!0})}`,slice:11},VIB:{root:`/book-accommodation/${s(e,{lower:!0})}`,slice:5},ADI:{root:`/${r}/apartments/`,slice:22}};return`${n[process.env.PROJECT].root}/${s(t,{lower:!0}).slice(n[process.env.PROJECT].slice)}`},exports.joinAddress=r,exports.joinPaths=t,exports.localizedAddress=function(e,t={}){const{city:s,address1:n,address2:o,postalCode:a}=t;let{stateId:i}=t;i&&/^[a-zA-Z]{2}-/.test(i)&&(i=i.split("-")[1]);const c=[n,o].filter(Boolean).join(" ");let l;const p=e?.toLowerCase();if(["de","dk","at","ch"].includes(p)){l=[c,[a,s].filter(Boolean).join(" ")]}else l="hu"===p?[s,c,a]:[c,s,i,a];return r(l)},exports.nOptions=(e,t=0,s={})=>{const r={...s};for(let s=t;s<t+e;s++)r[s.toString()]=s.toString();return r},exports.opentableLink=t=>`https://www.opentable.com.au/restref/client?rid=${t}&restref=${t}&lang=en-AU&r3uid=${e(9)}&ot_source=Restaurant+website&color=1`,exports.postBuild=()=>{const e=JSON.parse(n.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,"utf-8")),t=["User-agent: *",""+("production"===process.env.ENV?"Allow: /":"Disallow: /"),`${e.length?e.map((e=>`Disallow: ${e}`)).join("\n"):""}`,`Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/sitemap-index.xml`,`Host: ${process.env.PROTOCOL}://${process.env.HOST}`];n.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/public/robots.txt`,t.join("\n"))},exports.randomString=e,exports.ssoURL=e=>{if(!process.env.SABRE_SSO_HOST)throw new Error("The env variable SABRE_SSO_HOST is not defined!");if("development"!==process.env.ENV){const t=[".co.nz",".com.au",".com",".co",".au",".nz"].find((e=>process.env.SABRE_SSO_HOST.endsWith(e)));if(t&&process.env.HOST&&!process.env.HOST.endsWith(t)){const t=process.env.HOST.replace(/^(test\.|staging\.)/,"");return`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST?.split(".")[0]}.${t}${e}`}}return`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${e}`},exports.tagExists=(e,...t)=>{for(const s of Object.keys(e))if(t.includes(s))return!0;return!1},exports.tripadvisorRatingURL=e=>`https://www.tripadvisor.com/img/cdsi/img2/ratings/traveler/${(Math.floor(2*parseFloat(e))/2).toFixed(1)}-41022-5.svg`;
|
|
2
2
|
//# sourceMappingURL=index.node.cjs.map
|
package/lib/index.node.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.cjs","sources":["../src/node/string/index.ts","../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 function randomString(length: number = 9): string {\n const characters =\n \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * characters.length));\n }\n return result;\n}\n\n/**\n * Reduces text to the specified size, adding \"...\" (ellipses) to the last word.\n *\n * @param text string\n * @param maxLength number\n * @returns string\n */\nexport function cropText(text: string, maxLength = 250) {\n if (text.length <= maxLength) {\n return text;\n }\n const croppedText = text.substring(0, maxLength);\n // Find the last space to avoid cutting words in half\n const lastSpaceIndex = croppedText.lastIndexOf(\" \");\n\n if (lastSpaceIndex > 0) {\n return croppedText.substring(0, lastSpaceIndex) + \"...\";\n } else {\n // If no space is found, just add ellipsis at the maxLength\n return croppedText + \"...\";\n }\n}\n","import { randomString } from \"../string\";\n\nexport const joinPaths = (path1: string, path2: string): string =>\n `${path1.replace(new RegExp(`/$`), \"\")}/${path2.replace(\n new RegExp(`^/`),\n \"\"\n )}`;\n\nexport const dealLink = (dealSlug: string): string => {\n if (!process.env.DEALS_ROOT_SLUG)\n throw new Error(\"The env variable DEALS_ROOT_SLUG is not defined!\");\n return joinPaths(process.env.DEALS_ROOT_SLUG as string, dealSlug);\n};\n\nexport const ssoURL = (path: string) => {\n if (!process.env.SABRE_SSO_HOST) {\n throw new Error(\"The env variable SABRE_SSO_HOST is not defined!\");\n }\n if ((process.env.ENV as string) !== \"development\") {\n const suffixes = [\".co.nz\", \".com.au\", \".com\", \".co\", \".au\", \".nz\"];\n const matchedSuffix = suffixes.find((suffix) =>\n (process.env.SABRE_SSO_HOST as string).endsWith(suffix)\n );\n if (\n matchedSuffix &&\n process.env.HOST &&\n !process.env.HOST.endsWith(matchedSuffix)\n ) {\n // On test/staging removes the subdomain part: \"test.\", \"staging.\"\n const host = (process.env.HOST as string).replace(\n /^(test\\.|staging\\.)/,\n \"\"\n );\n return `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST?.split(\".\")[0]}.${host}${path}`;\n }\n }\n return `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${path}`;\n};\n\nexport const tripadvisorRatingURL = (score: string) =>\n `https://www.tripadvisor.com/img/cdsi/img2/ratings/traveler/${(\n Math.floor(parseFloat(score) * 2) / 2\n ).toFixed(1)}-41022-5.svg`;\n\nexport const opentableLink = (id: number): string =>\n `https://www.opentable.com.au/restref/client?rid=${id}&restref=${id}&lang=en-AU&r3uid=${randomString(\n 9\n )}&ot_source=Restaurant+website&color=1`;\n","const slugify = module.require(\"slugify\");\nimport {\n HotelOptionsByCityType,\n HotelPagesType,\n CityKeyType,\n HotelOptionType,\n AddressDataType,\n} from \"./types\";\n\n/**\n *\n * Returns Select options sorting by the cities with more hotels, otherwise alphabetically.\n * When the countryPriority is provided, it will sort the cities by the priority of the country.\n * For instance when countryPriority = {\"NZ\": 1, \"AU\": 2} it will display cities from New Zealand and then from Australia.\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 countryPriority?: { [countryCode: string]: number },\n): HotelOptionsByCityType[] => {\n const defaultCityOrder = [\n \"Sydney\",\n \"Melbourne\",\n \"Brisbane\",\n \"Perth\",\n \"Hobart\",\n \"Canberra\",\n \"Adelaide\",\n \"Gold Coast\",\n \"Darwin\",\n \"Auckland\",\n \"Wellington\",\n \"Queenstown\",\n \"Singapore\",\n ];\n\n const hotelsByCity: { [city: string]: HotelOptionType[] } = {};\n\n // Group hotels by city, including sort and country_id\n for (const hotelCode in hotelPages) {\n if (hotelPages.hasOwnProperty(hotelCode)) {\n const hotel = hotelPages[hotelCode];\n if (!hotelsByCity[hotel.city]) {\n hotelsByCity[hotel.city] = [];\n }\n hotelsByCity[hotel.city].push({\n label: hotel.name,\n value: hotelCode,\n sort: hotel.sort,\n country_id: hotel.country_id,\n });\n }\n }\n\n let result: HotelOptionsByCityType[] = Object.keys(hotelsByCity).map(\n (city) => ({\n label: city,\n options: hotelsByCity[city].sort((a, b) => a.sort - b.sort), // Sort within city by 'sort'\n }),\n );\n\n // Apply country priority if provided\n if (countryPriority) {\n result.sort((a, b) => {\n const countryA = a.options.length > 0 ? a.options[0].country_id : null;\n const countryB = b.options.length > 0 ? b.options[0].country_id : null;\n\n const priorityA =\n countryA && countryPriority[countryA] !== undefined\n ? countryPriority[countryA]\n : Infinity;\n const priorityB =\n countryB && countryPriority[countryB] !== undefined\n ? countryPriority[countryB]\n : Infinity;\n\n if (priorityA !== priorityB) {\n return priorityA - priorityB;\n }\n\n // If countries have the same priority, maintain the default city order\n const indexA = defaultCityOrder.includes(a.label)\n ? defaultCityOrder.indexOf(a.label)\n : Infinity;\n const indexB = defaultCityOrder.includes(b.label)\n ? defaultCityOrder.indexOf(b.label)\n : Infinity;\n return indexA - indexB;\n });\n } else {\n // If no countryPriority, sort by the default city order\n result.sort((a, b) => {\n const indexA = defaultCityOrder.includes(a.label)\n ? defaultCityOrder.indexOf(a.label)\n : Infinity;\n const indexB = defaultCityOrder.includes(b.label)\n ? defaultCityOrder.indexOf(b.label)\n : Infinity;\n return indexA - indexB;\n });\n }\n\n return result;\n};\n\n/**\n * Joins the Property address\n */\nexport const joinAddress = (a: (string | null | undefined)[]): string =>\n a.filter((p): p is string => !!p).join(\", \");\n\n/**\n * Formats a localized address based on the country code.\n * @param countryCode - ISO country code (e.g., 'DE', 'HU', 'US')\n * @param data - Object containing address components\n */\nexport function localizedAddress(\n countryCode: string | null | undefined,\n data: AddressDataType = {},\n): string {\n const { city, address1, address2, postalCode } = data;\n let { stateId } = data;\n\n // 1. Cleanup stateId\n if (stateId && /^[a-zA-Z]{2}-/.test(stateId)) {\n stateId = stateId.split(\"-\")[1];\n }\n\n const fullAddress = [address1, address2].filter(Boolean).join(\" \");\n\n // 2. Define the \"Parts\" based on Country\n let parts: any[];\n\n const code = countryCode?.toLowerCase();\n\n if ([\"de\", \"dk\", \"at\", \"ch\"].includes(code as string)) {\n // Format: [Address], [Post Code] [City]\n // Note: postalCode and city are joined by a space first\n const zipCity = [postalCode, city].filter(Boolean).join(\" \");\n parts = [fullAddress, zipCity];\n } else if (code === \"hu\") {\n // Format: [City], [Address], [Post Code]\n parts = [city, fullAddress, postalCode];\n } else {\n // Default format: [Address], [City], [State], [Post Code]\n parts = [fullAddress, city, stateId, postalCode];\n }\n return joinAddress(parts);\n}\n\nexport const hotelPageLink = (\n city: string,\n hotelName: string,\n lang: String = \"en\",\n) => {\n const slugs: any = {\n TRA: {\n root: `/book-accommodation/${slugify(city, { lower: true })}`,\n slice: 11,\n },\n VIB: {\n root: `/book-accommodation/${slugify(city, { lower: true })}`,\n slice: 5,\n },\n ADI: { root: `/${lang}/apartments/`, slice: 22 },\n };\n return `${slugs[process.env.PROJECT as string].root}/${slugify(hotelName, {\n lower: true,\n }).slice(slugs[process.env.PROJECT as string].slice)}`;\n};\n","import { Actions } from \"gatsby\";\nimport { RedirectionType } from \"./types\";\nconst fs = module.require(\"fs\");\nconst path = module.require(\"path\");\n\n/**\n * Replace Page Metas\n *\n * Replaces the page metas only on multi-domain projects.\n * For instance if the current page has the following metas defined within the page attributes:\n *\n * {\n * \"metas\": {\n * \"rendezvoushotels.co.nz\": {\n * \"en\": {\n * \"title\": \"Rendezvous hotels in New Zealand\",\n * \"description\": \"Book the best hotels in New Zealand\"\n * }\n * }\n * }\n * }\n *\n * and if the current HOST domain (e.g: \"rendezvoushotels.co.nz\") matches one defined in the metas,\n * the page metas will be replaced by the ones defined on this page attributes.\n *\n * @param page Gatsby Page context\n */\nexport const replacePageMetas = (page: any) => {\n // Remove \"staging.\" and \"test.\" prefixes when checking domain metas for convenience (avoids duplication)\n const domainRoot = (process.env.HOST as string).replace(\n /^(test\\.|staging\\.)/,\n \"\",\n );\n if (page.data?.metas?.[domainRoot]?.[page.language]) {\n for (const [key, value] of Object.entries(\n page.data.metas[domainRoot][page.language],\n )) {\n if (key === \"title\") {\n page.head.title = value;\n continue;\n }\n page.head.metas[key] = value;\n }\n }\n return page;\n};\n\n// Build page elements (only for the ones having a build.js)\nexport const build = async (page: any, languages: string[]) => {\n let body = [];\n page = replacePageMetas(page); // Multi-domain projects\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 pageLangs: languages.reduce((acc, lang) => {\n acc[lang] = page[lang];\n return acc;\n }, {} as any),\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 project = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/projectMetadata.json`,\n \"utf-8\",\n ),\n );\n const isMultiLingual = project.languages.length > 1;\n const { createPage, createRedirect } = actions;\n let redirections: RedirectionType[] = [];\n let excluded: string[] = []; // List of excluded pages\n for (const language of project.languages) {\n const jsonDoc = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/site-${language}.json`,\n `utf-8`,\n ),\n );\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 creation of non-English pages when they are not translated (only on multi-language projects)\n // Also, creates a 302 (temporally) redirection to English version.\n if (isMultiLingual && page.redirect_to_english && !page[language]) {\n redirections.push({\n page: page.slug,\n redirection: `${process.env.PROTOCOL}://${process.env.HOST}/en/${page.slug.slice(4)}`,\n type: \"302\",\n });\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 console.warn(\n \"DEV_PAGE is defined on .env.development file! Only one page will be generated!\",\n );\n continue;\n }\n const component = require.resolve(\n `${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`,\n );\n const context = await build(page, project.languages);\n createPage({\n path: page.slug,\n component: component,\n context: context,\n });\n // The root /404/ page must also be created on multi-language projects to\n // handle non-existing root pages without language prefix, E.G: https://mysite.com/non-existing-page\n if (isMultiLingual && page.slug === \"/en/404/\") {\n createPage({\n path: \"/404/\",\n component: component,\n context: context,\n });\n }\n }\n }\n\n createAPIRedirections(\n createRedirect,\n isMultiLingual,\n project.languages,\n redirections,\n );\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 isMultiLingual: boolean,\n languages: string[],\n pagesRedirections: RedirectionType[],\n) => {\n // Load API redirections\n const redirections = [\n ...pagesRedirections,\n ...JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,\n `utf-8`,\n ),\n ).reduce((acc: RedirectionType[], r: RedirectionType) => {\n if (isMultiLingual) {\n // Add language prefixes to page redirection slug on multi-language projects.\n // E.G: A project with languages [\"en\", \"de\"] will transform the redirection slug \"/my-page/\"\n // into \"/en/my-page/\" and \"/de/my-page/\".\n for (const languageCode of languages) {\n acc.push({\n type: r.type,\n page: `/${languageCode}${r.page}`,\n redirection: `${r.redirection[0] === \"/\" ? `/${languageCode}` : \"\"}${r.redirection}`,\n });\n }\n } else {\n acc.push(r);\n }\n return acc;\n }, []),\n ];\n // Redirect homepage \"/\" to \"/en/\" on multi-language projects\n if (isMultiLingual) {\n redirections.push({\n page: \"/\",\n redirection: `${process.env.PROTOCOL}://${process.env.HOST}/en/`,\n type: \"301\",\n });\n }\n\n redirections.forEach((redirect: RedirectionType) => {\n createRedirect({\n fromPath: redirect.page,\n toPath: redirect.redirection,\n isPermanent:\n Boolean(process.env.NOT_CREATE_S3_ROUTING_RULES) || // Must always be a 301 redirect when S3 Routing Rules is disabled (has to be disabled if there are more than 50 redirections)\n redirect.type === \"301\",\n redirectInBrowser: true, // Redirect also in browser because 302 redirection only work on full page loads.\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 `${process.env.ENV === \"production\" ? \"Allow: /\" : \"Disallow: /\"}`,\n `${excludedPages.length ? excludedPages.map((slug: string) => `Disallow: ${slug}`).join(\"\\n\") : \"\"}`,\n `Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/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\n/**\n *\n * Fixes Development bugs on forms (Recaptcha v3) and Toast.\n * The bug is caused when running `yarn link \"@tfehotels/tfe-gatsby-library\"` on development\n * because this library will try to find the modules at the @tfehotels/tfe-gatsby-library/node_modules folder\n * instead of using the ./node_modules/ of the project.\n *\n */\nexport const createWebpackConfig = ({ actions, getConfig }: any) => {\n const config = getConfig();\n let alias = {\n ...config.resolve.alias,\n };\n // if (process.env.ENV === \"development\") {\n // alias[\"react-hot-toast\"] = path.resolve(\n // process.env.GATSBY_PROJECT_ROOT,\n // \"node_modules\",\n // \"react-hot-toast\"\n // );\n // }\n config.resolve = {\n ...config.resolve,\n alias: alias,\n };\n actions.replaceWebpackConfig(config);\n};\n","import { joinPaths } from \"../url\";\nimport { ImageType, PageTagsType, QueryParamsType } from \"./types\";\nconst { getImage, withArtDirection } = module.require(\"gatsby-plugin-image\");\nconst fs = module.require(\"fs\");\nconst path = module.require(\"path\");\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 apiLink = (\n apiPath: string = \"\",\n queryParams: QueryParamsType | null = null,\n): string =>\n `${joinPaths(\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: apiLink(\"/v1/project/request/contact\"),\n form_redirection: null,\n form_ajax_request: null,\n recaptcha_action: \"\",\n recaptcha_v3: false,\n gtm_event: null,\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 \"gtm_event\",\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 \"country\",\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\nexport const fetchProjectMetadata = async (rootDir: string) => {\n // The URL of the JSON data you want to fetch\n const url = `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/`;\n try {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch project metadata data from \"${url}\": ${response.statusText}`,\n );\n }\n const data = await response.json();\n const filePath = `${rootDir}/src/data/`;\n const fileName = \"projectMetadata.json\";\n // Write the data to a local JSON file\n fs.writeFileSync(\n path.resolve(filePath, fileName),\n JSON.stringify(data, null, 2),\n );\n console.log(\n `\\x1b[32msuccess\\x1b[0m Project metadata fetched and saved to:\\r\\n\"${filePath}${fileName}\"`,\n );\n } catch (error) {\n console.error(\n `Error fetching project metadata from \"${url}\" data:\\r\\n`,\n error,\n );\n process.exit(1);\n }\n};\n","const fs = require(\"fs\");\n\nexport 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 const rootDir = process.env.GATSBY_PROJECT_ROOT;\n const project = JSON.parse(\n fs.readFileSync(`${rootDir}/src/data/projectMetadata.json`, \"utf-8\"),\n );\n const isMultiLingual = project.languages.length > 1;\n\n // Add multi-language plugins (only multi-language projects):\n if (isMultiLingual) {\n plugins.push({\n resolve: `gatsby-source-filesystem`,\n options: {\n path: `${rootDir}/locales`,\n name: `locale`,\n },\n });\n plugins.push({\n resolve: `gatsby-plugin-react-i18next`,\n options: {\n localeJsonSourceName: `locale`,\n defaultLanguage: process.env.PROJECT_DEFAULT_LANGUAGE,\n fallbackLng: process.env.PROJECT_DEFAULT_LANGUAGE,\n languages: project.languages,\n siteUrl: `${process.env.PROTOCOL}://${process.env.HOST}`,\n trailingSlash: \"always\",\n i18nextOptions: {\n interpolation: {\n escapeValue: false,\n },\n keySeparator: false,\n nsSeparator: false,\n react: {\n transSupportBasicHtmlNodes: true,\n transKeepBasicHtmlNodesFor: [\n \"a\",\n \"br\",\n \"span\",\n \"strong\",\n \"i\",\n \"p\",\n \"ul\",\n \"li\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n ],\n },\n },\n redirect: false,\n pages: [\n {\n matchPath: \"/:lang?/(.*)\", // Prevents duplication of pages (Otherwise i18 plugin duplicates pages adding language code prefix)\n getLanguageFromPath: true,\n languages: project.languages,\n },\n ],\n },\n });\n }\n // Add Google Tag Manager (GTM) only when the \"GTM_ID\" is defined.\n if (process.env.GTM_ID) {\n plugins.push({\n resolve: \"gatsby-plugin-google-tagmanager\",\n options: {\n id: process.env.GTM_ID,\n },\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: project.name,\n short_name: project.name,\n lang: process.env.PROJECT_DEFAULT_LANGUAGE,\n background_color: project.background_colour,\n theme_color: project.colour,\n start_url: `/`,\n display: `standalone`,\n icon: process.env.PROJECT_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}/redirection/`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: \"redirections\",\n skipCreateNode: true,\n localSave: true,\n path: `${rootDir}/src/data/pages/`,\n },\n ...project.languages.map((language: string) => ({\n url: `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/?language=${language}`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: `site-${language}`,\n skipCreateNode: true,\n localSave: true,\n path: `${rootDir}/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: !process.env.NOT_CREATE_S3_ROUTING_RULES, // Generates routing rules by default, but must be disabled if there are more than 50 redirections.\n generateRedirectObjectsForPermanentRedirects: true,\n generateRedirectObjectsForTemporaryRedirects: true,\n acl: \"private\",\n },\n },\n {\n resolve: `gatsby-plugin-sitemap`,\n options: {\n // Skip homepage \"/\" on multi-language projects, because it uses \"/en/\" instead.\n excludes: [\"/404/\", \"/**/404/\", isMultiLingual ? \"/\" : \"\"],\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.pageContext.is_hidden,\n serialize: (page: any, { resolvePagePath }: any) => {\n const url: any = {\n url: resolvePagePath(page),\n lastmod: page.pageContext.published_at,\n };\n // Generate hreflang links for multi-language projects:\n if (isMultiLingual) {\n url.links = project.languages.reduce(\n (acc: any, lang: string) => {\n // Avoid creating links for non-English pages when the \"redirect_to_english\" flag is active:\n if (!page.pageContext.redirect_to_english || lang === \"en\") {\n acc.push({\n lang: lang,\n url: url.url.replace(/^\\/[a-z]{2}\\//, `/${lang}/`),\n });\n }\n return acc;\n },\n [\n {\n lang: \"x-default\",\n url: url.url.replace(\n /^\\/[a-z]{2}\\//,\n `/${process.env.PROJECT_DEFAULT_LANGUAGE}/`,\n ),\n },\n ],\n );\n }\n return url;\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":["randomString","length","characters","result","i","charAt","Math","floor","random","joinPaths","path1","path2","replace","RegExp","slugify","module","require","joinAddress","a","filter","p","join","fs","build","async","page","languages","body","domainRoot","process","env","HOST","data","metas","language","key","value","Object","entries","head","title","replacePageMetas","element","push","buildElement","slug","tags","pageLangs","reduce","acc","lang","createAPIRedirections","createRedirect","isMultiLingual","pagesRedirections","redirections","JSON","parse","readFileSync","GATSBY_PROJECT_ROOT","r","languageCode","type","redirection","PROTOCOL","forEach","redirect","fromPath","toPath","isPermanent","Boolean","NOT_CREATE_S3_ROUTING_RULES","redirectInBrowser","force","context","path","name","existsSync","import","ENV","console","warn","getImage","withArtDirection","apiLink","apiPath","queryParams","API_PROTOCOL","API_HOST","URLSearchParams","toString","buildImage","img","fallback","src","url","sizes","srcSet","sources","placeholder","width","sort","b","optimized","index","image_url","childImageSharp","gatsbyImageData","backgroundColor","height","layout","images","getImageData","image","mobileImage","image_data","mobile_image_data","media","Error","project","createPage","actions","excluded","jsonDoc","is_hidden","is_active","redirect_to_english","slice","DEV_PAGE","id","parseInt","component","resolve","writeFileSync","stringify","createWebpackConfig","getConfig","config","alias","replaceWebpackConfig","text","maxLength","croppedText","substring","lastSpaceIndex","lastIndexOf","dealSlug","DEALS_ROOT_SLUG","defaultGatsbyConfig","plugins","rootDir","options","localeJsonSourceName","defaultLanguage","PROJECT_DEFAULT_LANGUAGE","fallbackLng","siteUrl","trailingSlash","i18nextOptions","interpolation","escapeValue","keySeparator","nsSeparator","react","transSupportBasicHtmlNodes","transKeepBasicHtmlNodesFor","pages","matchPath","getLanguageFromPath","GTM_ID","siteMetadata","SITE_TITLE","description","SITE_DESCRIPTION","SITE_IMAGE","protocol","domain","short_name","background_color","background_colour","theme_color","colour","start_url","display","icon","PROJECT_ICON","defaults","formats","quality","breakpoints","tracedSVGOptions","blurredOptions","jpgOptions","pngOptions","webpOptions","avifOptions","typePrefix","method","allowCache","headers","params","verboseOutput","entitiesArray","PROJECT","skipCreateNode","localSave","map","bucketName","S3_BUCKET","hostname","generateRoutingRules","generateRedirectObjectsForPermanentRedirects","generateRedirectObjectsForTemporaryRedirects","acl","excludes","query","resolveSiteUrl","filterPages","pageContext","serialize","resolvePagePath","lastmod","published_at","links","formSection","form","settings","pk","form_method","form_submit","form_redirection","form_ajax_request","recaptcha_action","recaptcha_v3","gtm_event","items","fields","cfg","hasOwnProperty","validTypes","Set","uniqueId","addItem","parents","newItem","item","Array","isArray","children","setFormFields","field","k","fieldName","input_name","sectionName","k2","has","imageData","mobile_image","response","fetch","ok","statusText","json","filePath","fileName","log","error","exit","hotelOptionsByCity","hotelPages","countryPriority","defaultCityOrder","hotelsByCity","hotelCode","hotel","city","label","country_id","keys","countryA","countryB","priorityA","undefined","Infinity","priorityB","includes","indexOf","hotelPageLink","hotelName","slugs","TRA","root","lower","VIB","ADI","countryCode","address1","address2","postalCode","stateId","test","split","fullAddress","parts","code","toLowerCase","nOptions","n","start","defaultOpt","obj","postBuild","excludedPages","robotsTxt","SABRE_SSO_HOST","matchedSuffix","find","suffix","endsWith","host","SABRE_SSO_PROTOCOL","tagExists","pageTags","tag","score","parseFloat","toFixed"],"mappings":"aAAO,SAASA,EAAaC,EAAiB,GAC5C,MAAMC,EACJ,iEACF,IAAIC,EAAS,GACb,IAAK,IAAIC,EAAI,EAAGA,EAAIH,EAAQG,IAC1BD,GAAUD,EAAWG,OAAOC,KAAKC,MAAsBL,GAAhBI,KAAKE,WAE9C,OAAOL,CACT,CCNaM,MAAAA,EAAYA,CAACC,EAAeC,IACtC,GAAED,EAAME,QAAQ,IAAIC,OAAQ,MAAM,OAAOF,EAAMC,QAC9C,IAAIC,OAAQ,MACZ,MCLEC,EAAUC,OAAOC,QAAQ,WA6HlBC,EAAeC,GAC1BA,EAAEC,QAAQC,KAAqBA,IAAGC,KAAK,MAyClC,MCrKDC,EAAKP,OAAOC,QAAQ,MACbD,OAAOC,QAAQ,QAw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C,sBACA,IAEF,MAAQ,GAAEiB,QAAQC,IAAImS,wBAAwBpS,QAAQC,IAAI6R,gBAAgBb,MAAM,KAAK,MAAMkB,IAAOrP,GACpG,CACF,CACA,MAAQ,GAAE9C,QAAQC,IAAImS,wBAAwBpS,QAAQC,IAAI6R,iBAAiBhP,GAAM,oBG9B1DuP,CACvBC,KACGrR,KAEH,IAAK,MAAMsR,KAAO/R,OAAOkP,KAAK4C,GAC5B,GAAIrR,EAAKgP,SAASsC,GAChB,OAAO,EAGX,OAAO,CAAK,+BHwBuBC,GAClC,+DACC/T,KAAKC,MAA0B,EAApB+T,WAAWD,IAAc,GACpCE,QAAQ"}
|
|
1
|
+
{"version":3,"file":"index.node.cjs","sources":["../src/node/string/index.ts","../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 function randomString(length: number = 9): string {\n const characters =\n \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * characters.length));\n }\n return result;\n}\n\n/**\n * Reduces text to the specified size, adding \"...\" (ellipses) to the last word.\n *\n * @param text string\n * @param maxLength number\n * @returns string\n */\nexport function cropText(text: string, maxLength = 250) {\n if (text.length <= maxLength) {\n return text;\n }\n const croppedText = text.substring(0, maxLength);\n // Find the last space to avoid cutting words in half\n const lastSpaceIndex = croppedText.lastIndexOf(\" \");\n\n if (lastSpaceIndex > 0) {\n return croppedText.substring(0, lastSpaceIndex) + \"...\";\n } else {\n // If no space is found, just add ellipsis at the maxLength\n return croppedText + \"...\";\n }\n}\n","import { randomString } from \"../string\";\n\nexport const joinPaths = (path1: string, path2: string): string =>\n `${path1.replace(new RegExp(`/$`), \"\")}/${path2.replace(\n new RegExp(`^/`),\n \"\"\n )}`;\n\nexport const dealLink = (dealSlug: string): string => {\n if (!process.env.DEALS_ROOT_SLUG)\n throw new Error(\"The env variable DEALS_ROOT_SLUG is not defined!\");\n return joinPaths(process.env.DEALS_ROOT_SLUG as string, dealSlug);\n};\n\nexport const ssoURL = (path: string) => {\n if (!process.env.SABRE_SSO_HOST) {\n throw new Error(\"The env variable SABRE_SSO_HOST is not defined!\");\n }\n if ((process.env.ENV as string) !== \"development\") {\n const suffixes = [\".co.nz\", \".com.au\", \".com\", \".co\", \".au\", \".nz\"];\n const matchedSuffix = suffixes.find((suffix) =>\n (process.env.SABRE_SSO_HOST as string).endsWith(suffix)\n );\n if (\n matchedSuffix &&\n process.env.HOST &&\n !process.env.HOST.endsWith(matchedSuffix)\n ) {\n // On test/staging removes the subdomain part: \"test.\", \"staging.\"\n const host = (process.env.HOST as string).replace(\n /^(test\\.|staging\\.)/,\n \"\"\n );\n return `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST?.split(\".\")[0]}.${host}${path}`;\n }\n }\n return `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${path}`;\n};\n\nexport const tripadvisorRatingURL = (score: string) =>\n `https://www.tripadvisor.com/img/cdsi/img2/ratings/traveler/${(\n Math.floor(parseFloat(score) * 2) / 2\n ).toFixed(1)}-41022-5.svg`;\n\nexport const opentableLink = (id: number): string =>\n `https://www.opentable.com.au/restref/client?rid=${id}&restref=${id}&lang=en-AU&r3uid=${randomString(\n 9\n )}&ot_source=Restaurant+website&color=1`;\n","const slugify = module.require(\"slugify\");\nimport {\n HotelOptionsByCityType,\n HotelPagesType,\n CityKeyType,\n HotelOptionType,\n AddressDataType,\n} from \"./types\";\n\n/**\n *\n * Returns Select options sorting by the cities with more hotels, otherwise alphabetically.\n * When the countryPriority is provided, it will sort the cities by the priority of the country.\n * For instance when countryPriority = {\"NZ\": 1, \"AU\": 2} it will display cities from New Zealand and then from Australia.\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 countryPriority?: { [countryCode: string]: number },\n): HotelOptionsByCityType[] => {\n const defaultCityOrder = [\n \"Sydney\",\n \"Melbourne\",\n \"Brisbane\",\n \"Perth\",\n \"Hobart\",\n \"Canberra\",\n \"Adelaide\",\n \"Gold Coast\",\n \"Darwin\",\n \"Auckland\",\n \"Wellington\",\n \"Queenstown\",\n \"Singapore\",\n ];\n\n const hotelsByCity: { [city: string]: HotelOptionType[] } = {};\n\n // Group hotels by city, including sort and country_id\n for (const hotelCode in hotelPages) {\n if (hotelPages.hasOwnProperty(hotelCode)) {\n const hotel = hotelPages[hotelCode];\n if (!hotelsByCity[hotel.city]) {\n hotelsByCity[hotel.city] = [];\n }\n hotelsByCity[hotel.city].push({\n label: hotel.name,\n value: hotelCode,\n sort: hotel.sort,\n country_id: hotel.country_id,\n });\n }\n }\n\n let result: HotelOptionsByCityType[] = Object.keys(hotelsByCity).map(\n (city) => ({\n label: city,\n options: hotelsByCity[city].sort((a, b) => a.sort - b.sort), // Sort within city by 'sort'\n }),\n );\n\n // Apply country priority if provided\n if (countryPriority) {\n result.sort((a, b) => {\n const countryA = a.options.length > 0 ? a.options[0].country_id : null;\n const countryB = b.options.length > 0 ? b.options[0].country_id : null;\n\n const priorityA =\n countryA && countryPriority[countryA] !== undefined\n ? countryPriority[countryA]\n : Infinity;\n const priorityB =\n countryB && countryPriority[countryB] !== undefined\n ? countryPriority[countryB]\n : Infinity;\n\n if (priorityA !== priorityB) {\n return priorityA - priorityB;\n }\n\n // If countries have the same priority, maintain the default city order\n const indexA = defaultCityOrder.includes(a.label)\n ? defaultCityOrder.indexOf(a.label)\n : Infinity;\n const indexB = defaultCityOrder.includes(b.label)\n ? defaultCityOrder.indexOf(b.label)\n : Infinity;\n return indexA - indexB;\n });\n } else {\n // If no countryPriority, sort by the default city order\n result.sort((a, b) => {\n const indexA = defaultCityOrder.includes(a.label)\n ? defaultCityOrder.indexOf(a.label)\n : Infinity;\n const indexB = defaultCityOrder.includes(b.label)\n ? defaultCityOrder.indexOf(b.label)\n : Infinity;\n return indexA - indexB;\n });\n }\n\n return result;\n};\n\n/**\n * Joins the Property address\n */\nexport const joinAddress = (a: (string | null | undefined)[]): string =>\n a.filter((p): p is string => !!p).join(\", \");\n\n/**\n * Formats a localized address based on the country code.\n * @param countryCode - ISO country code (e.g., 'DE', 'HU', 'US')\n * @param data - Object containing address components\n */\nexport function localizedAddress(\n countryCode: string | null | undefined,\n data: AddressDataType = {},\n): string {\n const { city, address1, address2, postalCode } = data;\n let { stateId } = data;\n\n // 1. Cleanup stateId\n if (stateId && /^[a-zA-Z]{2}-/.test(stateId)) {\n stateId = stateId.split(\"-\")[1];\n }\n\n const fullAddress = [address1, address2].filter(Boolean).join(\" \");\n\n // 2. Define the \"Parts\" based on Country\n let parts: any[];\n\n const code = countryCode?.toLowerCase();\n\n if ([\"de\", \"dk\", \"at\", \"ch\"].includes(code as string)) {\n // Format: [Address], [Post Code] [City]\n // Note: postalCode and city are joined by a space first\n const zipCity = [postalCode, city].filter(Boolean).join(\" \");\n parts = [fullAddress, zipCity];\n } else if (code === \"hu\") {\n // Format: [City], [Address], [Post Code]\n parts = [city, fullAddress, postalCode];\n } else {\n // Default format: [Address], [City], [State], [Post Code]\n parts = [fullAddress, city, stateId, postalCode];\n }\n return joinAddress(parts);\n}\n\nexport const hotelPageLink = (\n city: string,\n hotelName: string,\n lang: String = \"en\",\n) => {\n const slugs: any = {\n TRA: {\n root: `/book-accommodation/${slugify(city, { lower: true })}`,\n slice: 11,\n },\n VIB: {\n root: `/book-accommodation/${slugify(city, { lower: true })}`,\n slice: 5,\n },\n ADI: { root: `/${lang}/apartments/`, slice: 22 },\n };\n return `${slugs[process.env.PROJECT as string].root}/${slugify(hotelName, {\n lower: true,\n }).slice(slugs[process.env.PROJECT as string].slice)}`;\n};\n","import { Actions } from \"gatsby\";\nimport { RedirectionType } from \"./types\";\nconst fs = module.require(\"fs\");\nconst path = module.require(\"path\");\n\n/**\n * Replace Page Metas\n *\n * Replaces the page metas only on multi-domain projects.\n * For instance if the current page has the following metas defined within the page attributes:\n *\n * {\n * \"metas\": {\n * \"rendezvoushotels.co.nz\": {\n * \"en\": {\n * \"title\": \"Rendezvous hotels in New Zealand\",\n * \"description\": \"Book the best hotels in New Zealand\"\n * }\n * }\n * }\n * }\n *\n * and if the current HOST domain (e.g: \"rendezvoushotels.co.nz\") matches one defined in the metas,\n * the page metas will be replaced by the ones defined on this page attributes.\n *\n * @param page Gatsby Page context\n */\nexport const replacePageMetas = (page: any) => {\n // Remove \"staging.\" and \"test.\" prefixes when checking domain metas for convenience (avoids duplication)\n const domainRoot = (process.env.HOST as string).replace(\n /^(test\\.|staging\\.)/,\n \"\",\n );\n if (page.data?.metas?.[domainRoot]?.[page.language]) {\n for (const [key, value] of Object.entries(\n page.data.metas[domainRoot][page.language],\n )) {\n if (key === \"title\") {\n page.head.title = value;\n continue;\n }\n page.head.metas[key] = value;\n }\n }\n return page;\n};\n\n// Build page elements (only for the ones having a build.js)\nexport const build = async (page: any, languages: string[]) => {\n let body = [];\n page = replacePageMetas(page); // Multi-domain projects\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 pageLangs: languages.reduce((acc, lang) => {\n acc[lang] = page[lang];\n return acc;\n }, {} as any),\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 project = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/projectMetadata.json`,\n \"utf-8\",\n ),\n );\n const isMultiLingual = project.languages.length > 1;\n const { createPage, createRedirect } = actions;\n let redirections: RedirectionType[] = [];\n let excluded: string[] = []; // List of excluded pages\n for (const language of project.languages) {\n const jsonDoc = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/site-${language}.json`,\n `utf-8`,\n ),\n );\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 creation of non-English pages when they are not translated (only on multi-language projects)\n // Also, creates a 302 (temporally) redirection to English version.\n if (isMultiLingual && page.redirect_to_english && !page[language]) {\n redirections.push({\n page: page.slug,\n redirection: `${process.env.PROTOCOL}://${process.env.HOST}/en/${page.slug.slice(4)}`,\n type: \"302\",\n });\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 console.warn(\n \"DEV_PAGE is defined on .env.development file! Only one page will be generated!\",\n );\n continue;\n }\n const component = require.resolve(\n `${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`,\n );\n const context = await build(page, project.languages);\n createPage({\n path: page.slug,\n component: component,\n context: context,\n });\n // The root /404/ page must also be created on multi-language projects to\n // handle non-existing root pages without language prefix, E.G: https://mysite.com/non-existing-page\n if (isMultiLingual && page.slug === \"/en/404/\") {\n createPage({\n path: \"/404/\",\n component: component,\n context: context,\n });\n }\n }\n }\n\n createAPIRedirections(\n createRedirect,\n isMultiLingual,\n project.languages,\n redirections,\n );\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 isMultiLingual: boolean,\n languages: string[],\n pagesRedirections: RedirectionType[],\n) => {\n // Load API redirections\n const redirections = [\n ...pagesRedirections,\n ...JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,\n `utf-8`,\n ),\n ).reduce((acc: RedirectionType[], r: RedirectionType) => {\n if (isMultiLingual) {\n // Add language prefixes to page redirection slug on multi-language projects.\n // E.G: A project with languages [\"en\", \"de\"] will transform the redirection slug \"/my-page/\"\n // into \"/en/my-page/\" and \"/de/my-page/\".\n for (const languageCode of languages) {\n acc.push({\n type: r.type,\n page: `/${languageCode}${r.page}`,\n redirection: `${r.redirection[0] === \"/\" ? `/${languageCode}` : \"\"}${r.redirection}`,\n });\n }\n } else {\n acc.push(r);\n }\n return acc;\n }, []),\n ];\n // Redirect homepage \"/\" to \"/en/\" on multi-language projects\n if (isMultiLingual) {\n redirections.push({\n page: \"/\",\n redirection: `${process.env.PROTOCOL}://${process.env.HOST}/en/`,\n type: \"301\",\n });\n }\n\n redirections.forEach((redirect: RedirectionType) => {\n createRedirect({\n fromPath: redirect.page,\n toPath: redirect.redirection,\n isPermanent:\n Boolean(process.env.NOT_CREATE_S3_ROUTING_RULES) || // Must always be a 301 redirect when S3 Routing Rules is disabled (has to be disabled if there are more than 50 redirections)\n redirect.type === \"301\",\n redirectInBrowser: true, // Redirect also in browser because 302 redirection only work on full page loads.\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 `${process.env.ENV === \"production\" ? \"Allow: /\" : \"Disallow: /\"}`,\n `${excludedPages.length ? excludedPages.map((slug: string) => `Disallow: ${slug}`).join(\"\\n\") : \"\"}`,\n `Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/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\n/**\n *\n * Fixes Development bugs on forms (Recaptcha v3) and Toast.\n * The bug is caused when running `yarn link \"@tfehotels/tfe-gatsby-library\"` on development\n * because this library will try to find the modules at the @tfehotels/tfe-gatsby-library/node_modules folder\n * instead of using the ./node_modules/ of the project.\n *\n */\nexport const createWebpackConfig = ({ actions, getConfig }: any) => {\n const config = getConfig();\n let alias = {\n ...config.resolve.alias,\n };\n // if (process.env.ENV === \"development\") {\n // alias[\"react-hot-toast\"] = path.resolve(\n // process.env.GATSBY_PROJECT_ROOT,\n // \"node_modules\",\n // \"react-hot-toast\"\n // );\n // }\n config.resolve = {\n ...config.resolve,\n alias: alias,\n };\n actions.replaceWebpackConfig(config);\n};\n","import { joinPaths } from \"../url\";\nimport { ImageType, PageTagsType, QueryParamsType } from \"./types\";\nconst { getImage, withArtDirection } = module.require(\"gatsby-plugin-image\");\nconst fs = module.require(\"fs\");\nconst path = module.require(\"path\");\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 apiLink = (\n apiPath: string = \"\",\n queryParams: QueryParamsType | null = null,\n): string =>\n `${joinPaths(\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: apiLink(\"/v1/project/request/contact\"),\n form_redirection: null,\n form_ajax_request: null,\n recaptcha_action: \"\",\n recaptcha_v3: false,\n gtm_event: null,\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 \"gtm_event\",\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 \"country\",\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\nexport const fetchProjectMetadata = async (rootDir: string) => {\n // The URL of the JSON data you want to fetch\n const url = `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/`;\n try {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch project metadata data from \"${url}\": ${response.statusText}`,\n );\n }\n const data = await response.json();\n const filePath = `${rootDir}/src/data/`;\n const fileName = \"projectMetadata.json\";\n // Write the data to a local JSON file\n fs.writeFileSync(\n path.resolve(filePath, fileName),\n JSON.stringify(data, null, 2),\n );\n console.log(\n `\\x1b[32msuccess\\x1b[0m Project metadata fetched and saved to:\\r\\n\"${filePath}${fileName}\"`,\n );\n } catch (error) {\n console.error(\n `Error fetching project metadata from \"${url}\" data:\\r\\n`,\n error,\n );\n process.exit(1);\n }\n};\n","const fs = require(\"fs\");\n\nexport 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 const rootDir = process.env.GATSBY_PROJECT_ROOT;\n const { version } = JSON.parse(\n fs.readFileSync(`${rootDir}/package.json`, \"utf-8\"),\n );\n const project = JSON.parse(\n fs.readFileSync(`${rootDir}/src/data/projectMetadata.json`, \"utf-8\"),\n );\n const isMultiLingual = project.languages.length > 1;\n\n // Add multi-language plugins (only multi-language projects):\n if (isMultiLingual) {\n plugins.push({\n resolve: `gatsby-source-filesystem`,\n options: {\n path: `${rootDir}/locales`,\n name: `locale`,\n },\n });\n plugins.push({\n resolve: `gatsby-plugin-react-i18next`,\n options: {\n localeJsonSourceName: `locale`,\n defaultLanguage: process.env.PROJECT_DEFAULT_LANGUAGE,\n fallbackLng: process.env.PROJECT_DEFAULT_LANGUAGE,\n languages: project.languages,\n siteUrl: `${process.env.PROTOCOL}://${process.env.HOST}`,\n trailingSlash: \"always\",\n i18nextOptions: {\n interpolation: {\n escapeValue: false,\n },\n keySeparator: false,\n nsSeparator: false,\n react: {\n transSupportBasicHtmlNodes: true,\n transKeepBasicHtmlNodesFor: [\n \"a\",\n \"br\",\n \"span\",\n \"strong\",\n \"i\",\n \"p\",\n \"ul\",\n \"li\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n ],\n },\n },\n redirect: false,\n pages: [\n {\n matchPath: \"/:lang?/(.*)\", // Prevents duplication of pages (Otherwise i18 plugin duplicates pages adding language code prefix)\n getLanguageFromPath: true,\n languages: project.languages,\n },\n ],\n },\n });\n }\n // Add Google Tag Manager (GTM) only when the \"GTM_ID\" is defined.\n if (process.env.GTM_ID) {\n plugins.push({\n resolve: \"gatsby-plugin-google-tagmanager\",\n options: {\n id: process.env.GTM_ID,\n },\n });\n }\n\n return {\n siteMetadata: {\n version: version,\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: project.name,\n short_name: project.name,\n lang: process.env.PROJECT_DEFAULT_LANGUAGE,\n background_color: project.background_colour,\n theme_color: project.colour,\n start_url: `/`,\n display: `standalone`,\n icon: process.env.PROJECT_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}/redirection/`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: \"redirections\",\n skipCreateNode: true,\n localSave: true,\n path: `${rootDir}/src/data/pages/`,\n },\n ...project.languages.map((language: string) => ({\n url: `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/?language=${language}`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: `site-${language}`,\n skipCreateNode: true,\n localSave: true,\n path: `${rootDir}/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: !process.env.NOT_CREATE_S3_ROUTING_RULES, // Generates routing rules by default, but must be disabled if there are more than 50 redirections.\n generateRedirectObjectsForPermanentRedirects: true,\n generateRedirectObjectsForTemporaryRedirects: true,\n acl: \"private\",\n },\n },\n {\n resolve: `gatsby-plugin-sitemap`,\n options: {\n // Skip homepage \"/\" on multi-language projects, because it uses \"/en/\" instead.\n excludes: [\"/404/\", \"/**/404/\", isMultiLingual ? \"/\" : \"\"],\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.pageContext.is_hidden,\n serialize: (page: any, { resolvePagePath }: any) => {\n const url: any = {\n url: resolvePagePath(page),\n lastmod: page.pageContext.published_at,\n };\n // Generate hreflang links for multi-language projects:\n if (isMultiLingual) {\n url.links = project.languages.reduce(\n (acc: any, lang: string) => {\n // Avoid creating links for non-English pages when the \"redirect_to_english\" flag is active:\n if (!page.pageContext.redirect_to_english || lang === \"en\") {\n acc.push({\n lang: lang,\n url: url.url.replace(/^\\/[a-z]{2}\\//, `/${lang}/`),\n });\n }\n return acc;\n },\n [\n {\n lang: \"x-default\",\n url: url.url.replace(\n /^\\/[a-z]{2}\\//,\n `/${process.env.PROJECT_DEFAULT_LANGUAGE}/`,\n ),\n },\n ],\n );\n }\n return url;\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":["randomString","length","characters","result","i","charAt","Math","floor","random","joinPaths","path1","path2","replace","RegExp","slugify","module","require","joinAddress","a","filter","p","join","fs","build","async","page","languages","body","domainRoot","process","env","HOST","data","metas","language","key","value","Object","entries","head","title","replacePageMetas","element","push","buildElement","slug","tags","pageLangs","reduce","acc","lang","createAPIRedirections","createRedirect","isMultiLingual","pagesRedirections","redirections","JSON","parse","readFileSync","GATSBY_PROJECT_ROOT","r","languageCode","type","redirection","PROTOCOL","forEach","redirect","fromPath","toPath","isPermanent","Boolean","NOT_CREATE_S3_ROUTING_RULES","redirectInBrowser","force","context","path","name","existsSync","import","ENV","console","warn","getImage","withArtDirection","apiLink","apiPath","queryParams","API_PROTOCOL","API_HOST","URLSearchParams","toString","buildImage","img","fallback","src","url","sizes","srcSet","sources","placeholder","width","sort","b","optimized","index","image_url","childImageSharp","gatsbyImageData","backgroundColor","height","layout","images","getImageData","image","mobileImage","image_data","mobile_image_data","media","Error","project","createPage","actions","excluded","jsonDoc","is_hidden","is_active","redirect_to_english","slice","DEV_PAGE","id","parseInt","component","resolve","writeFileSync","stringify","createWebpackConfig","getConfig","config","alias","replaceWebpackConfig","text","maxLength","croppedText","substring","lastSpaceIndex","lastIndexOf","dealSlug","DEALS_ROOT_SLUG","defaultGatsbyConfig","plugins","rootDir","version","options","localeJsonSourceName","defaultLanguage","PROJECT_DEFAULT_LANGUAGE","fallbackLng","siteUrl","trailingSlash","i18nextOptions","interpolation","escapeValue","keySeparator","nsSeparator","react","transSupportBasicHtmlNodes","transKeepBasicHtmlNodesFor","pages","matchPath","getLanguageFromPath","GTM_ID","siteMetadata","SITE_TITLE","description","SITE_DESCRIPTION","SITE_IMAGE","protocol","domain","short_name","background_color","background_colour","theme_color","colour","start_url","display","icon","PROJECT_ICON","defaults","formats","quality","breakpoints","tracedSVGOptions","blurredOptions","jpgOptions","pngOptions","webpOptions","avifOptions","typePrefix","method","allowCache","headers","params","verboseOutput","entitiesArray","PROJECT","skipCreateNode","localSave","map","bucketName","S3_BUCKET","hostname","generateRoutingRules","generateRedirectObjectsForPermanentRedirects","generateRedirectObjectsForTemporaryRedirects","acl","excludes","query","resolveSiteUrl","filterPages","pageContext","serialize","resolvePagePath","lastmod","published_at","links","formSection","form","settings","pk","form_method","form_submit","form_redirection","form_ajax_request","recaptcha_action","recaptcha_v3","gtm_event","items","fields","cfg","hasOwnProperty","validTypes","Set","uniqueId","addItem","parents","newItem","item","Array","isArray","children","setFormFields","field","k","fieldName","input_name","sectionName","k2","has","imageData","mobile_image","response","fetch","ok","statusText","json","filePath","fileName","log","error","exit","hotelOptionsByCity","hotelPages","countryPriority","defaultCityOrder","hotelsByCity","hotelCode","hotel","city","label","country_id","keys","countryA","countryB","priorityA","undefined","Infinity","priorityB","includes","indexOf","hotelPageLink","hotelName","slugs","TRA","root","lower","VIB","ADI","countryCode","address1","address2","postalCode","stateId","test","split","fullAddress","parts","code","toLowerCase","nOptions","n","start","defaultOpt","obj","postBuild","excludedPages","robotsTxt","SABRE_SSO_HOST","matchedSuffix","find","suffix","endsWith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AAa,eAClD,GAAE2O,EAAczT,OAASyT,EAAc3G,KAAKlK,GAAkB,aAAYA,MAAQxB,KAAK,MAAQ,KAC/F,YAAWQ,QAAQC,IAAIkC,cAAcnC,QAAQC,IAAIC,yBACjD,SAAQF,QAAQC,IAAIkC,cAAcnC,QAAQC,IAAIC,QAGjDT,EAAG+G,cACA,GAAExG,QAAQC,IAAI6B,wCACfgQ,EAAUtS,KAAK,MAChB,wCFhOoBsD,IACrB,IAAK9C,QAAQC,IAAI8R,eACf,MAAM,IAAItM,MAAM,mDAElB,GAAoC,gBAA/BzF,QAAQC,IAAIiD,IAAkC,CACjD,MACM8O,EADW,CAAC,SAAU,UAAW,OAAQ,MAAO,MAAO,OAC9BC,MAAMC,GAClClS,QAAQC,IAAI8R,eAA0BI,SAASD,KAElD,GACEF,GACAhS,QAAQC,IAAIC,OACXF,QAAQC,IAAIC,KAAKiS,SAASH,GAC3B,CAEA,MAAMI,EAAQpS,QAAQC,IAAIC,KAAgBnB,QACxC,sBACA,IAEF,MAAQ,GAAEiB,QAAQC,IAAIoS,wBAAwBrS,QAAQC,IAAI8R,gBAAgBb,MAAM,KAAK,MAAMkB,IAAOtP,GACpG,CACF,CACA,MAAQ,GAAE9C,QAAQC,IAAIoS,wBAAwBrS,QAAQC,IAAI8R,iBAAiBjP,GAAM,oBG9B1DwP,CACvBC,KACGtR,KAEH,IAAK,MAAMuR,KAAOhS,OAAOmP,KAAK4C,GAC5B,GAAItR,EAAKiP,SAASsC,GAChB,OAAO,EAGX,OAAO,CAAK,+BHwBuBC,GAClC,+DACChU,KAAKC,MAA0B,EAApBgU,WAAWD,IAAc,GACpCE,QAAQ"}
|
package/lib/index.node.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e=9){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let s="";for(let n=0;n<e;n++)s+=t.charAt(Math.floor(62*Math.random()));return s}function t(e,t=250){if(e.length<=t)return e;const s=e.substring(0,t),n=s.lastIndexOf(" ");return n>0?s.substring(0,n)+"...":s+"..."}const s=(e,t)=>`${e.replace(new RegExp("/$"),"")}/${t.replace(new RegExp("^/"),"")}`,n=e=>{if(!process.env.DEALS_ROOT_SLUG)throw new Error("The env variable DEALS_ROOT_SLUG is not defined!");return s(process.env.DEALS_ROOT_SLUG,e)},r=e=>{if(!process.env.SABRE_SSO_HOST)throw new Error("The env variable SABRE_SSO_HOST is not defined!");if("development"!==process.env.ENV){const t=[".co.nz",".com.au",".com",".co",".au",".nz"].find((e=>process.env.SABRE_SSO_HOST.endsWith(e)));if(t&&process.env.HOST&&!process.env.HOST.endsWith(t)){const t=process.env.HOST.replace(/^(test\.|staging\.)/,"");return`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST?.split(".")[0]}.${t}${e}`}}return`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${e}`},o=e=>`https://www.tripadvisor.com/img/cdsi/img2/ratings/traveler/${(Math.floor(2*parseFloat(e))/2).toFixed(1)}-41022-5.svg`,a=t=>`https://www.opentable.com.au/restref/client?rid=${t}&restref=${t}&lang=en-AU&r3uid=${e(9)}&ot_source=Restaurant+website&color=1`,i=(e,t=0,s={})=>{const n={...s};for(let s=t;s<t+e;s++)n[s.toString()]=s.toString();return n},c=module.require("slugify"),l=(e,t)=>{const s=["Sydney","Melbourne","Brisbane","Perth","Hobart","Canberra","Adelaide","Gold Coast","Darwin","Auckland","Wellington","Queenstown","Singapore"],n={};for(const t in e)if(e.hasOwnProperty(t)){const s=e[t];n[s.city]||(n[s.city]=[]),n[s.city].push({label:s.name,value:t,sort:s.sort,country_id:s.country_id})}let r=Object.keys(n).map((e=>({label:e,options:n[e].sort(((e,t)=>e.sort-t.sort))})));return t?r.sort(((e,n)=>{const r=e.options.length>0?e.options[0].country_id:null,o=n.options.length>0?n.options[0].country_id:null,a=r&&void 0!==t[r]?t[r]:1/0,i=o&&void 0!==t[o]?t[o]:1/0;if(a!==i)return a-i;return(s.includes(e.label)?s.indexOf(e.label):1/0)-(s.includes(n.label)?s.indexOf(n.label):1/0)})):r.sort(((e,t)=>(s.includes(e.label)?s.indexOf(e.label):1/0)-(s.includes(t.label)?s.indexOf(t.label):1/0))),r},p=e=>e.filter((e=>!!e)).join(", ");function u(e,t={}){const{city:s,address1:n,address2:r,postalCode:o}=t;let{stateId:a}=t;a&&/^[a-zA-Z]{2}-/.test(a)&&(a=a.split("-")[1]);const i=[n,r].filter(Boolean).join(" ");let c;const l=e?.toLowerCase();if(["de","dk","at","ch"].includes(l)){c=[i,[o,s].filter(Boolean).join(" ")]}else c="hu"===l?[s,i,o]:[i,s,a,o];return p(c)}const g=(e,t,s="en")=>{const n={TRA:{root:`/book-accommodation/${c(e,{lower:!0})}`,slice:11},VIB:{root:`/book-accommodation/${c(e,{lower:!0})}`,slice:5},ADI:{root:`/${s}/apartments/`,slice:22}};return`${n[process.env.PROJECT].root}/${c(t,{lower:!0}).slice(n[process.env.PROJECT].slice)}`},d=module.require("fs");module.require("path");const O=async(e,t)=>{let s=[];e=(e=>{const t=process.env.HOST.replace(/^(test\.|staging\.)/,"");if(e.data?.metas?.[t]?.[e.language])for(const[s,n]of Object.entries(e.data.metas[t][e.language]))"title"!==s?e.head.metas[s]=n:e.head.title=n;return e})(e);for(const n of e.body)s.push(await f(n,{slug:e.slug,tags:e.tags,data:e.data,pageLangs:t.reduce(((t,s)=>(t[s]=e[s],t)),{})}));return e.body=s,e},m=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 t=JSON.parse(d.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/projectMetadata.json`,"utf-8")),s=t.languages.length>1,{createPage:n,createRedirect:r}=e;let o=[],a=[];for(const e of t.languages){const r=JSON.parse(d.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/site-${e}.json`,"utf-8"));for(const i of r){if(i.is_hidden&&a.push(i.slug),!i.is_active)continue;if(s&&i.redirect_to_english&&!i[e]){o.push({page:i.slug,redirection:`${process.env.PROTOCOL}://${process.env.HOST}/en/${i.slug.slice(4)}`,type:"302"});continue}if(process.env.DEV_PAGE&&i.id!==parseInt(`${process.env.DEV_PAGE}`)){console.warn("DEV_PAGE is defined on .env.development file! Only one page will be generated!");continue}const r=require.resolve(`${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`),c=await O(i,t.languages);n({path:i.slug,component:r,context:c}),s&&"/en/404/"===i.slug&&n({path:"/404/",component:r,context:c})}}_(r,s,t.languages,o),d.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,JSON.stringify(a))},_=(e,t,s,n)=>{const r=[...n,...JSON.parse(d.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,"utf-8")).reduce(((e,n)=>{if(t)for(const t of s)e.push({type:n.type,page:`/${t}${n.page}`,redirection:`${"/"===n.redirection[0]?`/${t}`:""}${n.redirection}`});else e.push(n);return e}),[])];t&&r.push({page:"/",redirection:`${process.env.PROTOCOL}://${process.env.HOST}/en/`,type:"301"}),r.forEach((t=>{e({fromPath:t.page,toPath:t.redirection,isPermanent:Boolean(process.env.NOT_CREATE_S3_ROUTING_RULES)||"301"===t.type,redirectInBrowser:!0,force:!0})}))},v=()=>{const e=JSON.parse(d.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,"utf-8")),t=["User-agent: *",""+("production"===process.env.ENV?"Allow: /":"Disallow: /"),`${e.length?e.map((e=>`Disallow: ${e}`)).join("\n"):""}`,`Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/sitemap-index.xml`,`Host: ${process.env.PROTOCOL}://${process.env.HOST}`];d.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/public/robots.txt`,t.join("\n"))},f=async(e,t)=>{const s=`${process.env.GATSBY_PROJECT_ROOT}/src/components/element/${e.type}/${e.name}/build.js`;if(d.existsSync(s)){const n=await import(s);if(n?.build)return await n.build(e,t)}else"development"===process.env.ENV&&console.warn(`build.js file not found: ${s}`);return e},h=({actions:e,getConfig:t})=>{const s=t();let n={...s.resolve.alias};s.resolve={...s.resolve,alias:n},e.replaceWebpackConfig(s)},{getImage:T,withArtDirection:S}=module.require("gatsby-plugin-image"),$=module.require("fs"),y=module.require("path"),R=(e,...t)=>{for(const s of Object.keys(e))if(t.includes(s))return!0;return!1},b=(e="",t=null)=>`${s(`${process.env.API_PROTOCOL}://${process.env.API_HOST}`,e)}${t?`?${new URLSearchParams(t).toString()}`:""}`,E=e=>{if(!e)return;let t={src:e.url,sizes:"100vw",srcSet:""},s=[],n={fallback:e.url};const r=[e.width,360,769,1024,1216,1408].sort(((e,t)=>e-t));if(e.optimized){t.src=e.url+e.name+"-"+e.width+"w.jpg",n.fallback=e.url+e.name+"-20w.jpg",s.push({sizes:"100vw",srcSet:"",type:"image/avif"}),s.push({sizes:"100vw",srcSet:"",type:"image/webp"});for(let n in r){if(r[n]>e.width)break;let o=("0"===n?"":",")+e.url+e.name+"-"+r[n];t.srcSet+=o+"w.jpg "+r[n]+"w",s[0].srcSet+=o+"w.avif "+r[n]+"w",s[1].srcSet+=o+"w.webp "+r[n]+"w"}}return T({childImageSharp:{gatsbyImageData:{backgroundColor:"transparent",height:e.height/e.width,width:1,layout:"fullWidth",placeholder:n,images:{fallback:t,sources:s}}}})},w=(e,t)=>{const s=E(e),n=E(t);return s&&n?S(s,[{media:"(max-width: 768px)",image:n}]):s},P=e=>{let t={settings:{pk:0,name:"",form_method:"post",form_submit:b("/v1/project/request/contact"),form_redirection:null,form_ajax_request:null,recaptcha_action:"",recaptcha_v3:!1,gtm_event:null},items:[],fields:{}};t.settings.recaptcha_v3=!!e.recaptcha_v3,t.settings.recaptcha_action=e.data.recaptcha_action??e.name,t.settings.pk=e.pk,t.settings.name=e.name,["form_submit","form_recipient","form_method","form_redirection","form_ajax_request","form_success_msg","gtm_event"].map((s=>{e.hasOwnProperty(s)&&(t.settings[s]=e[s])}));const s=new Set(["checkbox","input","select","button","google-places","country-prefix","country","textarea","recaptcha2","title","text","link","image"]);let n=0;const r=(e,s)=>{let n=t.items;for(let t of e)n=n[t],Array.isArray(n)||(n=n.children);n.push(s)},o=(e,a,i)=>{let c=e.input_name&&!t.fields[e.input_name]?e.input_name:e.name??`${e.type}${n++}`;if("section"===e.type){const t=e.name??`sec_${a.length}-${i}`;r(a,{name:t,children:[]}),e.children.map(((e,t)=>o(e,[...a,i],t)))}else s.has(e.type)&&(r(a,c),t.fields[c]=e,"image"===e.type&&(t.fields[c].imageData=w(e.image,e.mobile_image)))};return e.children.map(((e,t)=>o(e,[],t))),t},A=async e=>{const t=`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/`;try{const s=await fetch(t);if(!s.ok)throw new Error(`Failed to fetch project metadata data from "${t}": ${s.statusText}`);const n=await s.json(),r=`${e}/src/data/`,o="projectMetadata.json";$.writeFileSync(y.resolve(r,o),JSON.stringify(n,null,2)),console.log(`[32msuccess[0m Project metadata fetched and saved to:\r\n"${r}${o}"`)}catch(e){console.error(`Error fetching project metadata from "${t}" data:\r\n`,e),process.exit(1)}},C=require("fs"),j=(e={},t=[])=>{if(!process.env.GATSBY_PROJECT_ROOT)throw new Error('Please define "process.env.GATSBY_PROJECT_ROOT = __dirname" within the ./gatsby-config.js file.');const s=process.env.GATSBY_PROJECT_ROOT,n=JSON.parse(C.readFileSync(`${s}/src/data/projectMetadata.json`,"utf-8")),r=n.languages.length>1;return r&&(t.push({resolve:"gatsby-source-filesystem",options:{path:`${s}/locales`,name:"locale"}}),t.push({resolve:"gatsby-plugin-react-i18next",options:{localeJsonSourceName:"locale",defaultLanguage:process.env.PROJECT_DEFAULT_LANGUAGE,fallbackLng:process.env.PROJECT_DEFAULT_LANGUAGE,languages:n.languages,siteUrl:`${process.env.PROTOCOL}://${process.env.HOST}`,trailingSlash:"always",i18nextOptions:{interpolation:{escapeValue:!1},keySeparator:!1,nsSeparator:!1,react:{transSupportBasicHtmlNodes:!0,transKeepBasicHtmlNodesFor:["a","br","span","strong","i","p","ul","li","h1","h2","h3","h4","h5"]}},redirect:!1,pages:[{matchPath:"/:lang?/(.*)",getLanguageFromPath:!0,languages:n.languages}]}})),process.env.GTM_ID&&t.push({resolve:"gatsby-plugin-google-tagmanager",options:{id:process.env.GTM_ID}}),{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:n.name,short_name:n.name,lang:process.env.PROJECT_DEFAULT_LANGUAGE,background_color:n.background_colour,theme_color:n.colour,start_url:"/",display:"standalone",icon:process.env.PROJECT_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}/redirection/`,headers:{"Content-Type":"application/json"},name:"redirections",skipCreateNode:!0,localSave:!0,path:`${s}/src/data/pages/`},...n.languages.map((e=>({url:`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/?language=${e}`,headers:{"Content-Type":"application/json"},name:`site-${e}`,skipCreateNode:!0,localSave:!0,path:`${s}/src/data/pages/`})))]}},{resolve:"gatsby-plugin-s3",options:{bucketName:process.env.S3_BUCKET,protocol:process.env.PROTOCOL,hostname:process.env.HOST,generateRoutingRules:!process.env.NOT_CREATE_S3_ROUTING_RULES,generateRedirectObjectsForPermanentRedirects:!0,generateRedirectObjectsForTemporaryRedirects:!0,acl:"private"}},{resolve:"gatsby-plugin-sitemap",options:{excludes:["/404/","/**/404/",r?"/":""],query:"\n {\n allSitePage {\n nodes {\n path\n pageContext\n }\n }\n }\n ",resolveSiteUrl:()=>`${process.env.PROTOCOL}://${process.env.HOST}`,filterPages:e=>e.pageContext.is_hidden,serialize:(e,{resolvePagePath:t})=>{const s={url:t(e),lastmod:e.pageContext.published_at};return r&&(s.links=n.languages.reduce(((t,n)=>(e.pageContext.redirect_to_english&&"en"!==n||t.push({lang:n,url:s.url.replace(/^\/[a-z]{2}\//,`/${n}/`)}),t)),[{lang:"x-default",url:s.url.replace(/^\/[a-z]{2}\//,`/${process.env.PROJECT_DEFAULT_LANGUAGE}/`)}])),s}}},...t],...e}};export{b as apiLink,f as buildElement,E as buildImage,m as createAPIPages,h as createWebpackConfig,t as cropText,n as dealLink,j as defaultGatsbyConfig,P as extractForm,A as fetchProjectMetadata,w as getImageData,l as hotelOptionsByCity,g as hotelPageLink,p as joinAddress,s as joinPaths,u as localizedAddress,i as nOptions,a as opentableLink,v as postBuild,e as randomString,r as ssoURL,R as tagExists,o as tripadvisorRatingURL};
|
|
1
|
+
function e(e=9){const s="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let t="";for(let n=0;n<e;n++)t+=s.charAt(Math.floor(62*Math.random()));return t}function s(e,s=250){if(e.length<=s)return e;const t=e.substring(0,s),n=t.lastIndexOf(" ");return n>0?t.substring(0,n)+"...":t+"..."}const t=(e,s)=>`${e.replace(new RegExp("/$"),"")}/${s.replace(new RegExp("^/"),"")}`,n=e=>{if(!process.env.DEALS_ROOT_SLUG)throw new Error("The env variable DEALS_ROOT_SLUG is not defined!");return t(process.env.DEALS_ROOT_SLUG,e)},r=e=>{if(!process.env.SABRE_SSO_HOST)throw new Error("The env variable SABRE_SSO_HOST is not defined!");if("development"!==process.env.ENV){const s=[".co.nz",".com.au",".com",".co",".au",".nz"].find((e=>process.env.SABRE_SSO_HOST.endsWith(e)));if(s&&process.env.HOST&&!process.env.HOST.endsWith(s)){const s=process.env.HOST.replace(/^(test\.|staging\.)/,"");return`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST?.split(".")[0]}.${s}${e}`}}return`${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${e}`},o=e=>`https://www.tripadvisor.com/img/cdsi/img2/ratings/traveler/${(Math.floor(2*parseFloat(e))/2).toFixed(1)}-41022-5.svg`,a=s=>`https://www.opentable.com.au/restref/client?rid=${s}&restref=${s}&lang=en-AU&r3uid=${e(9)}&ot_source=Restaurant+website&color=1`,i=(e,s=0,t={})=>{const n={...t};for(let t=s;t<s+e;t++)n[t.toString()]=t.toString();return n},c=module.require("slugify"),l=(e,s)=>{const t=["Sydney","Melbourne","Brisbane","Perth","Hobart","Canberra","Adelaide","Gold Coast","Darwin","Auckland","Wellington","Queenstown","Singapore"],n={};for(const s in e)if(e.hasOwnProperty(s)){const t=e[s];n[t.city]||(n[t.city]=[]),n[t.city].push({label:t.name,value:s,sort:t.sort,country_id:t.country_id})}let r=Object.keys(n).map((e=>({label:e,options:n[e].sort(((e,s)=>e.sort-s.sort))})));return s?r.sort(((e,n)=>{const r=e.options.length>0?e.options[0].country_id:null,o=n.options.length>0?n.options[0].country_id:null,a=r&&void 0!==s[r]?s[r]:1/0,i=o&&void 0!==s[o]?s[o]:1/0;if(a!==i)return a-i;return(t.includes(e.label)?t.indexOf(e.label):1/0)-(t.includes(n.label)?t.indexOf(n.label):1/0)})):r.sort(((e,s)=>(t.includes(e.label)?t.indexOf(e.label):1/0)-(t.includes(s.label)?t.indexOf(s.label):1/0))),r},p=e=>e.filter((e=>!!e)).join(", ");function u(e,s={}){const{city:t,address1:n,address2:r,postalCode:o}=s;let{stateId:a}=s;a&&/^[a-zA-Z]{2}-/.test(a)&&(a=a.split("-")[1]);const i=[n,r].filter(Boolean).join(" ");let c;const l=e?.toLowerCase();if(["de","dk","at","ch"].includes(l)){c=[i,[o,t].filter(Boolean).join(" ")]}else c="hu"===l?[t,i,o]:[i,t,a,o];return p(c)}const g=(e,s,t="en")=>{const n={TRA:{root:`/book-accommodation/${c(e,{lower:!0})}`,slice:11},VIB:{root:`/book-accommodation/${c(e,{lower:!0})}`,slice:5},ADI:{root:`/${t}/apartments/`,slice:22}};return`${n[process.env.PROJECT].root}/${c(s,{lower:!0}).slice(n[process.env.PROJECT].slice)}`},d=module.require("fs");module.require("path");const O=async(e,s)=>{let t=[];e=(e=>{const s=process.env.HOST.replace(/^(test\.|staging\.)/,"");if(e.data?.metas?.[s]?.[e.language])for(const[t,n]of Object.entries(e.data.metas[s][e.language]))"title"!==t?e.head.metas[t]=n:e.head.title=n;return e})(e);for(const n of e.body)t.push(await f(n,{slug:e.slug,tags:e.tags,data:e.data,pageLangs:s.reduce(((s,t)=>(s[t]=e[t],s)),{})}));return e.body=t,e},m=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 s=JSON.parse(d.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/projectMetadata.json`,"utf-8")),t=s.languages.length>1,{createPage:n,createRedirect:r}=e;let o=[],a=[];for(const e of s.languages){const r=JSON.parse(d.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/site-${e}.json`,"utf-8"));for(const i of r){if(i.is_hidden&&a.push(i.slug),!i.is_active)continue;if(t&&i.redirect_to_english&&!i[e]){o.push({page:i.slug,redirection:`${process.env.PROTOCOL}://${process.env.HOST}/en/${i.slug.slice(4)}`,type:"302"});continue}if(process.env.DEV_PAGE&&i.id!==parseInt(`${process.env.DEV_PAGE}`)){console.warn("DEV_PAGE is defined on .env.development file! Only one page will be generated!");continue}const r=require.resolve(`${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`),c=await O(i,s.languages);n({path:i.slug,component:r,context:c}),t&&"/en/404/"===i.slug&&n({path:"/404/",component:r,context:c})}}v(r,t,s.languages,o),d.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,JSON.stringify(a))},v=(e,s,t,n)=>{const r=[...n,...JSON.parse(d.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,"utf-8")).reduce(((e,n)=>{if(s)for(const s of t)e.push({type:n.type,page:`/${s}${n.page}`,redirection:`${"/"===n.redirection[0]?`/${s}`:""}${n.redirection}`});else e.push(n);return e}),[])];s&&r.push({page:"/",redirection:`${process.env.PROTOCOL}://${process.env.HOST}/en/`,type:"301"}),r.forEach((s=>{e({fromPath:s.page,toPath:s.redirection,isPermanent:Boolean(process.env.NOT_CREATE_S3_ROUTING_RULES)||"301"===s.type,redirectInBrowser:!0,force:!0})}))},_=()=>{const e=JSON.parse(d.readFileSync(`${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/excluded.json`,"utf-8")),s=["User-agent: *",""+("production"===process.env.ENV?"Allow: /":"Disallow: /"),`${e.length?e.map((e=>`Disallow: ${e}`)).join("\n"):""}`,`Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/sitemap-index.xml`,`Host: ${process.env.PROTOCOL}://${process.env.HOST}`];d.writeFileSync(`${process.env.GATSBY_PROJECT_ROOT}/public/robots.txt`,s.join("\n"))},f=async(e,s)=>{const t=`${process.env.GATSBY_PROJECT_ROOT}/src/components/element/${e.type}/${e.name}/build.js`;if(d.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},h=({actions:e,getConfig:s})=>{const t=s();let n={...t.resolve.alias};t.resolve={...t.resolve,alias:n},e.replaceWebpackConfig(t)},{getImage:T,withArtDirection:S}=module.require("gatsby-plugin-image"),$=module.require("fs"),y=module.require("path"),R=(e,...s)=>{for(const t of Object.keys(e))if(s.includes(t))return!0;return!1},b=(e="",s=null)=>`${t(`${process.env.API_PROTOCOL}://${process.env.API_HOST}`,e)}${s?`?${new URLSearchParams(s).toString()}`:""}`,E=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 o=("0"===n?"":",")+e.url+e.name+"-"+r[n];s.srcSet+=o+"w.jpg "+r[n]+"w",t[0].srcSet+=o+"w.avif "+r[n]+"w",t[1].srcSet+=o+"w.webp "+r[n]+"w"}}return T({childImageSharp:{gatsbyImageData:{backgroundColor:"transparent",height:e.height/e.width,width:1,layout:"fullWidth",placeholder:n,images:{fallback:s,sources:t}}}})},w=(e,s)=>{const t=E(e),n=E(s);return t&&n?S(t,[{media:"(max-width: 768px)",image:n}]):t},P=e=>{let s={settings:{pk:0,name:"",form_method:"post",form_submit:b("/v1/project/request/contact"),form_redirection:null,form_ajax_request:null,recaptcha_action:"",recaptcha_v3:!1,gtm_event:null},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","gtm_event"].map((t=>{e.hasOwnProperty(t)&&(s.settings[t]=e[t])}));const t=new Set(["checkbox","input","select","button","google-places","country-prefix","country","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)},o=(e,a,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_${a.length}-${i}`;r(a,{name:s,children:[]}),e.children.map(((e,s)=>o(e,[...a,i],s)))}else t.has(e.type)&&(r(a,c),s.fields[c]=e,"image"===e.type&&(s.fields[c].imageData=w(e.image,e.mobile_image)))};return e.children.map(((e,s)=>o(e,[],s))),s},A=async e=>{const s=`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/`;try{const t=await fetch(s);if(!t.ok)throw new Error(`Failed to fetch project metadata data from "${s}": ${t.statusText}`);const n=await t.json(),r=`${e}/src/data/`,o="projectMetadata.json";$.writeFileSync(y.resolve(r,o),JSON.stringify(n,null,2)),console.log(`[32msuccess[0m Project metadata fetched and saved to:\r\n"${r}${o}"`)}catch(e){console.error(`Error fetching project metadata from "${s}" data:\r\n`,e),process.exit(1)}},C=require("fs"),j=(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.');const t=process.env.GATSBY_PROJECT_ROOT,{version:n}=JSON.parse(C.readFileSync(`${t}/package.json`,"utf-8")),r=JSON.parse(C.readFileSync(`${t}/src/data/projectMetadata.json`,"utf-8")),o=r.languages.length>1;return o&&(s.push({resolve:"gatsby-source-filesystem",options:{path:`${t}/locales`,name:"locale"}}),s.push({resolve:"gatsby-plugin-react-i18next",options:{localeJsonSourceName:"locale",defaultLanguage:process.env.PROJECT_DEFAULT_LANGUAGE,fallbackLng:process.env.PROJECT_DEFAULT_LANGUAGE,languages:r.languages,siteUrl:`${process.env.PROTOCOL}://${process.env.HOST}`,trailingSlash:"always",i18nextOptions:{interpolation:{escapeValue:!1},keySeparator:!1,nsSeparator:!1,react:{transSupportBasicHtmlNodes:!0,transKeepBasicHtmlNodesFor:["a","br","span","strong","i","p","ul","li","h1","h2","h3","h4","h5"]}},redirect:!1,pages:[{matchPath:"/:lang?/(.*)",getLanguageFromPath:!0,languages:r.languages}]}})),process.env.GTM_ID&&s.push({resolve:"gatsby-plugin-google-tagmanager",options:{id:process.env.GTM_ID}}),{siteMetadata:{version:n,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:r.name,short_name:r.name,lang:process.env.PROJECT_DEFAULT_LANGUAGE,background_color:r.background_colour,theme_color:r.colour,start_url:"/",display:"standalone",icon:process.env.PROJECT_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}/redirection/`,headers:{"Content-Type":"application/json"},name:"redirections",skipCreateNode:!0,localSave:!0,path:`${t}/src/data/pages/`},...r.languages.map((e=>({url:`${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/?language=${e}`,headers:{"Content-Type":"application/json"},name:`site-${e}`,skipCreateNode:!0,localSave:!0,path:`${t}/src/data/pages/`})))]}},{resolve:"gatsby-plugin-s3",options:{bucketName:process.env.S3_BUCKET,protocol:process.env.PROTOCOL,hostname:process.env.HOST,generateRoutingRules:!process.env.NOT_CREATE_S3_ROUTING_RULES,generateRedirectObjectsForPermanentRedirects:!0,generateRedirectObjectsForTemporaryRedirects:!0,acl:"private"}},{resolve:"gatsby-plugin-sitemap",options:{excludes:["/404/","/**/404/",o?"/":""],query:"\n {\n allSitePage {\n nodes {\n path\n pageContext\n }\n }\n }\n ",resolveSiteUrl:()=>`${process.env.PROTOCOL}://${process.env.HOST}`,filterPages:e=>e.pageContext.is_hidden,serialize:(e,{resolvePagePath:s})=>{const t={url:s(e),lastmod:e.pageContext.published_at};return o&&(t.links=r.languages.reduce(((s,n)=>(e.pageContext.redirect_to_english&&"en"!==n||s.push({lang:n,url:t.url.replace(/^\/[a-z]{2}\//,`/${n}/`)}),s)),[{lang:"x-default",url:t.url.replace(/^\/[a-z]{2}\//,`/${process.env.PROJECT_DEFAULT_LANGUAGE}/`)}])),t}}},...s],...e}};export{b as apiLink,f as buildElement,E as buildImage,m as createAPIPages,h as createWebpackConfig,s as cropText,n as dealLink,j as defaultGatsbyConfig,P as extractForm,A as fetchProjectMetadata,w as getImageData,l as hotelOptionsByCity,g as hotelPageLink,p as joinAddress,t as joinPaths,u as localizedAddress,i as nOptions,a as opentableLink,_ as postBuild,e as randomString,r as ssoURL,R as tagExists,o as tripadvisorRatingURL};
|
|
2
2
|
//# sourceMappingURL=index.node.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.esm.js","sources":["../src/node/string/index.ts","../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 function randomString(length: number = 9): string {\n const characters =\n \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * characters.length));\n }\n return result;\n}\n\n/**\n * Reduces text to the specified size, adding \"...\" (ellipses) to the last word.\n *\n * @param text string\n * @param maxLength number\n * @returns string\n */\nexport function cropText(text: string, maxLength = 250) {\n if (text.length <= maxLength) {\n return text;\n }\n const croppedText = text.substring(0, maxLength);\n // Find the last space to avoid cutting words in half\n const lastSpaceIndex = croppedText.lastIndexOf(\" \");\n\n if (lastSpaceIndex > 0) {\n return croppedText.substring(0, lastSpaceIndex) + \"...\";\n } else {\n // If no space is found, just add ellipsis at the maxLength\n return croppedText + \"...\";\n }\n}\n","import { randomString } from \"../string\";\n\nexport const joinPaths = (path1: string, path2: string): string =>\n `${path1.replace(new RegExp(`/$`), \"\")}/${path2.replace(\n new RegExp(`^/`),\n \"\"\n )}`;\n\nexport const dealLink = (dealSlug: string): string => {\n if (!process.env.DEALS_ROOT_SLUG)\n throw new Error(\"The env variable DEALS_ROOT_SLUG is not defined!\");\n return joinPaths(process.env.DEALS_ROOT_SLUG as string, dealSlug);\n};\n\nexport const ssoURL = (path: string) => {\n if (!process.env.SABRE_SSO_HOST) {\n throw new Error(\"The env variable SABRE_SSO_HOST is not defined!\");\n }\n if ((process.env.ENV as string) !== \"development\") {\n const suffixes = [\".co.nz\", \".com.au\", \".com\", \".co\", \".au\", \".nz\"];\n const matchedSuffix = suffixes.find((suffix) =>\n (process.env.SABRE_SSO_HOST as string).endsWith(suffix)\n );\n if (\n matchedSuffix &&\n process.env.HOST &&\n !process.env.HOST.endsWith(matchedSuffix)\n ) {\n // On test/staging removes the subdomain part: \"test.\", \"staging.\"\n const host = (process.env.HOST as string).replace(\n /^(test\\.|staging\\.)/,\n \"\"\n );\n return `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST?.split(\".\")[0]}.${host}${path}`;\n }\n }\n return `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${path}`;\n};\n\nexport const tripadvisorRatingURL = (score: string) =>\n `https://www.tripadvisor.com/img/cdsi/img2/ratings/traveler/${(\n Math.floor(parseFloat(score) * 2) / 2\n ).toFixed(1)}-41022-5.svg`;\n\nexport const opentableLink = (id: number): string =>\n `https://www.opentable.com.au/restref/client?rid=${id}&restref=${id}&lang=en-AU&r3uid=${randomString(\n 9\n )}&ot_source=Restaurant+website&color=1`;\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 {\n HotelOptionsByCityType,\n HotelPagesType,\n CityKeyType,\n HotelOptionType,\n AddressDataType,\n} from \"./types\";\n\n/**\n *\n * Returns Select options sorting by the cities with more hotels, otherwise alphabetically.\n * When the countryPriority is provided, it will sort the cities by the priority of the country.\n * For instance when countryPriority = {\"NZ\": 1, \"AU\": 2} it will display cities from New Zealand and then from Australia.\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 countryPriority?: { [countryCode: string]: number },\n): HotelOptionsByCityType[] => {\n const defaultCityOrder = [\n \"Sydney\",\n \"Melbourne\",\n \"Brisbane\",\n \"Perth\",\n \"Hobart\",\n \"Canberra\",\n \"Adelaide\",\n \"Gold Coast\",\n \"Darwin\",\n \"Auckland\",\n \"Wellington\",\n \"Queenstown\",\n \"Singapore\",\n ];\n\n const hotelsByCity: { [city: string]: HotelOptionType[] } = {};\n\n // Group hotels by city, including sort and country_id\n for (const hotelCode in hotelPages) {\n if (hotelPages.hasOwnProperty(hotelCode)) {\n const hotel = hotelPages[hotelCode];\n if (!hotelsByCity[hotel.city]) {\n hotelsByCity[hotel.city] = [];\n }\n hotelsByCity[hotel.city].push({\n label: hotel.name,\n value: hotelCode,\n sort: hotel.sort,\n country_id: hotel.country_id,\n });\n }\n }\n\n let result: HotelOptionsByCityType[] = Object.keys(hotelsByCity).map(\n (city) => ({\n label: city,\n options: hotelsByCity[city].sort((a, b) => a.sort - b.sort), // Sort within city by 'sort'\n }),\n );\n\n // Apply country priority if provided\n if (countryPriority) {\n result.sort((a, b) => {\n const countryA = a.options.length > 0 ? a.options[0].country_id : null;\n const countryB = b.options.length > 0 ? b.options[0].country_id : null;\n\n const priorityA =\n countryA && countryPriority[countryA] !== undefined\n ? countryPriority[countryA]\n : Infinity;\n const priorityB =\n countryB && countryPriority[countryB] !== undefined\n ? countryPriority[countryB]\n : Infinity;\n\n if (priorityA !== priorityB) {\n return priorityA - priorityB;\n }\n\n // If countries have the same priority, maintain the default city order\n const indexA = defaultCityOrder.includes(a.label)\n ? defaultCityOrder.indexOf(a.label)\n : Infinity;\n const indexB = defaultCityOrder.includes(b.label)\n ? defaultCityOrder.indexOf(b.label)\n : Infinity;\n return indexA - indexB;\n });\n } else {\n // If no countryPriority, sort by the default city order\n result.sort((a, b) => {\n const indexA = defaultCityOrder.includes(a.label)\n ? defaultCityOrder.indexOf(a.label)\n : Infinity;\n const indexB = defaultCityOrder.includes(b.label)\n ? defaultCityOrder.indexOf(b.label)\n : Infinity;\n return indexA - indexB;\n });\n }\n\n return result;\n};\n\n/**\n * Joins the Property address\n */\nexport const joinAddress = (a: (string | null | undefined)[]): string =>\n a.filter((p): p is string => !!p).join(\", \");\n\n/**\n * Formats a localized address based on the country code.\n * @param countryCode - ISO country code (e.g., 'DE', 'HU', 'US')\n * @param data - Object containing address components\n */\nexport function localizedAddress(\n countryCode: string | null | undefined,\n data: AddressDataType = {},\n): string {\n const { city, address1, address2, postalCode } = data;\n let { stateId } = data;\n\n // 1. Cleanup stateId\n if (stateId && /^[a-zA-Z]{2}-/.test(stateId)) {\n stateId = stateId.split(\"-\")[1];\n }\n\n const fullAddress = [address1, address2].filter(Boolean).join(\" \");\n\n // 2. Define the \"Parts\" based on Country\n let parts: any[];\n\n const code = countryCode?.toLowerCase();\n\n if ([\"de\", \"dk\", \"at\", \"ch\"].includes(code as string)) {\n // Format: [Address], [Post Code] [City]\n // Note: postalCode and city are joined by a space first\n const zipCity = [postalCode, city].filter(Boolean).join(\" \");\n parts = [fullAddress, zipCity];\n } else if (code === \"hu\") {\n // Format: [City], [Address], [Post Code]\n parts = [city, fullAddress, postalCode];\n } else {\n // Default format: [Address], [City], [State], [Post Code]\n parts = [fullAddress, city, stateId, postalCode];\n }\n return joinAddress(parts);\n}\n\nexport const hotelPageLink = (\n city: string,\n hotelName: string,\n lang: String = \"en\",\n) => {\n const slugs: any = {\n TRA: {\n root: `/book-accommodation/${slugify(city, { lower: true })}`,\n slice: 11,\n },\n VIB: {\n root: `/book-accommodation/${slugify(city, { lower: true })}`,\n slice: 5,\n },\n ADI: { root: `/${lang}/apartments/`, slice: 22 },\n };\n return `${slugs[process.env.PROJECT as string].root}/${slugify(hotelName, {\n lower: true,\n }).slice(slugs[process.env.PROJECT as string].slice)}`;\n};\n","import { Actions } from \"gatsby\";\nimport { RedirectionType } from \"./types\";\nconst fs = module.require(\"fs\");\nconst path = module.require(\"path\");\n\n/**\n * Replace Page Metas\n *\n * Replaces the page metas only on multi-domain projects.\n * For instance if the current page has the following metas defined within the page attributes:\n *\n * {\n * \"metas\": {\n * \"rendezvoushotels.co.nz\": {\n * \"en\": {\n * \"title\": \"Rendezvous hotels in New Zealand\",\n * \"description\": \"Book the best hotels in New Zealand\"\n * }\n * }\n * }\n * }\n *\n * and if the current HOST domain (e.g: \"rendezvoushotels.co.nz\") matches one defined in the metas,\n * the page metas will be replaced by the ones defined on this page attributes.\n *\n * @param page Gatsby Page context\n */\nexport const replacePageMetas = (page: any) => {\n // Remove \"staging.\" and \"test.\" prefixes when checking domain metas for convenience (avoids duplication)\n const domainRoot = (process.env.HOST as string).replace(\n /^(test\\.|staging\\.)/,\n \"\",\n );\n if (page.data?.metas?.[domainRoot]?.[page.language]) {\n for (const [key, value] of Object.entries(\n page.data.metas[domainRoot][page.language],\n )) {\n if (key === \"title\") {\n page.head.title = value;\n continue;\n }\n page.head.metas[key] = value;\n }\n }\n return page;\n};\n\n// Build page elements (only for the ones having a build.js)\nexport const build = async (page: any, languages: string[]) => {\n let body = [];\n page = replacePageMetas(page); // Multi-domain projects\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 pageLangs: languages.reduce((acc, lang) => {\n acc[lang] = page[lang];\n return acc;\n }, {} as any),\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 project = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/projectMetadata.json`,\n \"utf-8\",\n ),\n );\n const isMultiLingual = project.languages.length > 1;\n const { createPage, createRedirect } = actions;\n let redirections: RedirectionType[] = [];\n let excluded: string[] = []; // List of excluded pages\n for (const language of project.languages) {\n const jsonDoc = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/site-${language}.json`,\n `utf-8`,\n ),\n );\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 creation of non-English pages when they are not translated (only on multi-language projects)\n // Also, creates a 302 (temporally) redirection to English version.\n if (isMultiLingual && page.redirect_to_english && !page[language]) {\n redirections.push({\n page: page.slug,\n redirection: `${process.env.PROTOCOL}://${process.env.HOST}/en/${page.slug.slice(4)}`,\n type: \"302\",\n });\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 console.warn(\n \"DEV_PAGE is defined on .env.development file! Only one page will be generated!\",\n );\n continue;\n }\n const component = require.resolve(\n `${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`,\n );\n const context = await build(page, project.languages);\n createPage({\n path: page.slug,\n component: component,\n context: context,\n });\n // The root /404/ page must also be created on multi-language projects to\n // handle non-existing root pages without language prefix, E.G: https://mysite.com/non-existing-page\n if (isMultiLingual && page.slug === \"/en/404/\") {\n createPage({\n path: \"/404/\",\n component: component,\n context: context,\n });\n }\n }\n }\n\n createAPIRedirections(\n createRedirect,\n isMultiLingual,\n project.languages,\n redirections,\n );\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 isMultiLingual: boolean,\n languages: string[],\n pagesRedirections: RedirectionType[],\n) => {\n // Load API redirections\n const redirections = [\n ...pagesRedirections,\n ...JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,\n `utf-8`,\n ),\n ).reduce((acc: RedirectionType[], r: RedirectionType) => {\n if (isMultiLingual) {\n // Add language prefixes to page redirection slug on multi-language projects.\n // E.G: A project with languages [\"en\", \"de\"] will transform the redirection slug \"/my-page/\"\n // into \"/en/my-page/\" and \"/de/my-page/\".\n for (const languageCode of languages) {\n acc.push({\n type: r.type,\n page: `/${languageCode}${r.page}`,\n redirection: `${r.redirection[0] === \"/\" ? `/${languageCode}` : \"\"}${r.redirection}`,\n });\n }\n } else {\n acc.push(r);\n }\n return acc;\n }, []),\n ];\n // Redirect homepage \"/\" to \"/en/\" on multi-language projects\n if (isMultiLingual) {\n redirections.push({\n page: \"/\",\n redirection: `${process.env.PROTOCOL}://${process.env.HOST}/en/`,\n type: \"301\",\n });\n }\n\n redirections.forEach((redirect: RedirectionType) => {\n createRedirect({\n fromPath: redirect.page,\n toPath: redirect.redirection,\n isPermanent:\n Boolean(process.env.NOT_CREATE_S3_ROUTING_RULES) || // Must always be a 301 redirect when S3 Routing Rules is disabled (has to be disabled if there are more than 50 redirections)\n redirect.type === \"301\",\n redirectInBrowser: true, // Redirect also in browser because 302 redirection only work on full page loads.\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 `${process.env.ENV === \"production\" ? \"Allow: /\" : \"Disallow: /\"}`,\n `${excludedPages.length ? excludedPages.map((slug: string) => `Disallow: ${slug}`).join(\"\\n\") : \"\"}`,\n `Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/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\n/**\n *\n * Fixes Development bugs on forms (Recaptcha v3) and Toast.\n * The bug is caused when running `yarn link \"@tfehotels/tfe-gatsby-library\"` on development\n * because this library will try to find the modules at the @tfehotels/tfe-gatsby-library/node_modules folder\n * instead of using the ./node_modules/ of the project.\n *\n */\nexport const createWebpackConfig = ({ actions, getConfig }: any) => {\n const config = getConfig();\n let alias = {\n ...config.resolve.alias,\n };\n // if (process.env.ENV === \"development\") {\n // alias[\"react-hot-toast\"] = path.resolve(\n // process.env.GATSBY_PROJECT_ROOT,\n // \"node_modules\",\n // \"react-hot-toast\"\n // );\n // }\n config.resolve = {\n ...config.resolve,\n alias: alias,\n };\n actions.replaceWebpackConfig(config);\n};\n","import { joinPaths } from \"../url\";\nimport { ImageType, PageTagsType, QueryParamsType } from \"./types\";\nconst { getImage, withArtDirection } = module.require(\"gatsby-plugin-image\");\nconst fs = module.require(\"fs\");\nconst path = module.require(\"path\");\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 apiLink = (\n apiPath: string = \"\",\n queryParams: QueryParamsType | null = null,\n): string =>\n `${joinPaths(\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: apiLink(\"/v1/project/request/contact\"),\n form_redirection: null,\n form_ajax_request: null,\n recaptcha_action: \"\",\n recaptcha_v3: false,\n gtm_event: null,\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 \"gtm_event\",\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 \"country\",\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\nexport const fetchProjectMetadata = async (rootDir: string) => {\n // The URL of the JSON data you want to fetch\n const url = `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/`;\n try {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch project metadata data from \"${url}\": ${response.statusText}`,\n );\n }\n const data = await response.json();\n const filePath = `${rootDir}/src/data/`;\n const fileName = \"projectMetadata.json\";\n // Write the data to a local JSON file\n fs.writeFileSync(\n path.resolve(filePath, fileName),\n JSON.stringify(data, null, 2),\n );\n console.log(\n `\\x1b[32msuccess\\x1b[0m Project metadata fetched and saved to:\\r\\n\"${filePath}${fileName}\"`,\n );\n } catch (error) {\n console.error(\n `Error fetching project metadata from \"${url}\" data:\\r\\n`,\n error,\n );\n process.exit(1);\n }\n};\n","const fs = require(\"fs\");\n\nexport 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 const rootDir = process.env.GATSBY_PROJECT_ROOT;\n const project = JSON.parse(\n fs.readFileSync(`${rootDir}/src/data/projectMetadata.json`, \"utf-8\"),\n );\n const isMultiLingual = project.languages.length > 1;\n\n // Add multi-language plugins (only multi-language projects):\n if (isMultiLingual) {\n plugins.push({\n resolve: `gatsby-source-filesystem`,\n options: {\n path: `${rootDir}/locales`,\n name: `locale`,\n },\n });\n plugins.push({\n resolve: `gatsby-plugin-react-i18next`,\n options: {\n localeJsonSourceName: `locale`,\n defaultLanguage: process.env.PROJECT_DEFAULT_LANGUAGE,\n fallbackLng: process.env.PROJECT_DEFAULT_LANGUAGE,\n languages: project.languages,\n siteUrl: `${process.env.PROTOCOL}://${process.env.HOST}`,\n trailingSlash: \"always\",\n i18nextOptions: {\n interpolation: {\n escapeValue: false,\n },\n keySeparator: false,\n nsSeparator: false,\n react: {\n transSupportBasicHtmlNodes: true,\n transKeepBasicHtmlNodesFor: [\n \"a\",\n \"br\",\n \"span\",\n \"strong\",\n \"i\",\n \"p\",\n \"ul\",\n \"li\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n ],\n },\n },\n redirect: false,\n pages: [\n {\n matchPath: \"/:lang?/(.*)\", // Prevents duplication of pages (Otherwise i18 plugin duplicates pages adding language code prefix)\n getLanguageFromPath: true,\n languages: project.languages,\n },\n ],\n },\n });\n }\n // Add Google Tag Manager (GTM) only when the \"GTM_ID\" is defined.\n if (process.env.GTM_ID) {\n plugins.push({\n resolve: \"gatsby-plugin-google-tagmanager\",\n options: {\n id: process.env.GTM_ID,\n },\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: project.name,\n short_name: project.name,\n lang: process.env.PROJECT_DEFAULT_LANGUAGE,\n background_color: project.background_colour,\n theme_color: project.colour,\n start_url: `/`,\n display: `standalone`,\n icon: process.env.PROJECT_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}/redirection/`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: \"redirections\",\n skipCreateNode: true,\n localSave: true,\n path: `${rootDir}/src/data/pages/`,\n },\n ...project.languages.map((language: string) => ({\n url: `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/?language=${language}`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: `site-${language}`,\n skipCreateNode: true,\n localSave: true,\n path: `${rootDir}/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: !process.env.NOT_CREATE_S3_ROUTING_RULES, // Generates routing rules by default, but must be disabled if there are more than 50 redirections.\n generateRedirectObjectsForPermanentRedirects: true,\n generateRedirectObjectsForTemporaryRedirects: true,\n acl: \"private\",\n },\n },\n {\n resolve: `gatsby-plugin-sitemap`,\n options: {\n // Skip homepage \"/\" on multi-language projects, because it uses \"/en/\" instead.\n excludes: [\"/404/\", \"/**/404/\", isMultiLingual ? \"/\" : \"\"],\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.pageContext.is_hidden,\n serialize: (page: any, { resolvePagePath }: any) => {\n const url: any = {\n url: resolvePagePath(page),\n lastmod: page.pageContext.published_at,\n };\n // Generate hreflang links for multi-language projects:\n if (isMultiLingual) {\n url.links = project.languages.reduce(\n (acc: any, lang: string) => {\n // Avoid creating links for non-English pages when the \"redirect_to_english\" flag is active:\n if (!page.pageContext.redirect_to_english || lang === \"en\") {\n acc.push({\n lang: lang,\n url: url.url.replace(/^\\/[a-z]{2}\\//, `/${lang}/`),\n });\n }\n return acc;\n },\n [\n {\n lang: \"x-default\",\n url: url.url.replace(\n /^\\/[a-z]{2}\\//,\n `/${process.env.PROJECT_DEFAULT_LANGUAGE}/`,\n ),\n },\n ],\n );\n }\n return url;\n },\n },\n },\n ...plugins,\n ],\n ...config,\n };\n};\n"],"names":["randomString","length","characters","result","i","charAt","Math","floor","random","cropText","text","maxLength","croppedText","substring","lastSpaceIndex","lastIndexOf","joinPaths","path1","path2","replace","RegExp","dealLink","dealSlug","process","env","DEALS_ROOT_SLUG","Error","ssoURL","path","SABRE_SSO_HOST","ENV","matchedSuffix","find","suffix","endsWith","HOST","host","SABRE_SSO_PROTOCOL","split","tripadvisorRatingURL","score","parseFloat","toFixed","opentableLink","id","nOptions","n","start","defaultOpt","obj","toString","slugify","module","require","hotelOptionsByCity","hotelPages","countryPriority","defaultCityOrder","hotelsByCity","hotelCode","hasOwnProperty","hotel","city","push","label","name","value","sort","country_id","Object","keys","map","options","a","b","countryA","countryB","priorityA","undefined","Infinity","priorityB","includes","indexOf","joinAddress","filter","p","join","localizedAddress","countryCode","data","address1","address2","postalCode","stateId","test","fullAddress","Boolean","parts","code","toLowerCase","hotelPageLink","hotelName","lang","slugs","TRA","root","lower","slice","VIB","ADI","PROJECT","fs","build","async","page","languages","body","domainRoot","metas","language","key","entries","head","title","replacePageMetas","element","buildElement","slug","tags","pageLangs","reduce","acc","createAPIPages","GATSBY_PROJECT_ROOT","project","JSON","parse","readFileSync","isMultiLingual","createPage","createRedirect","actions","redirections","excluded","jsonDoc","is_hidden","is_active","redirect_to_english","redirection","PROTOCOL","type","DEV_PAGE","parseInt","console","warn","component","resolve","context","createAPIRedirections","writeFileSync","stringify","pagesRedirections","r","languageCode","forEach","redirect","fromPath","toPath","isPermanent","NOT_CREATE_S3_ROUTING_RULES","redirectInBrowser","force","postBuild","excludedPages","robotsTxt","existsSync","import","createWebpackConfig","getConfig","config","alias","replaceWebpackConfig","getImage","withArtDirection","tagExists","pageTags","tag","apiLink","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","gtm_event","items","fields","cfg","validTypes","Set","uniqueId","addItem","parents","newItem","item","Array","isArray","children","setFormFields","field","k","fieldName","input_name","sectionName","k2","has","imageData","mobile_image","fetchProjectMetadata","response","fetch","ok","statusText","json","filePath","rootDir","fileName","log","error","exit","defaultGatsbyConfig","plugins","localeJsonSourceName","defaultLanguage","PROJECT_DEFAULT_LANGUAGE","fallbackLng","siteUrl","trailingSlash","i18nextOptions","interpolation","escapeValue","keySeparator","nsSeparator","react","transSupportBasicHtmlNodes","transKeepBasicHtmlNodesFor","pages","matchPath","getLanguageFromPath","GTM_ID","siteMetadata","SITE_TITLE","description","SITE_DESCRIPTION","SITE_IMAGE","protocol","domain","short_name","background_color","background_colour","theme_color","colour","start_url","display","icon","PROJECT_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","generateRedirectObjectsForTemporaryRedirects","acl","excludes","query","resolveSiteUrl","filterPages","pageContext","serialize","resolvePagePath","lastmod","published_at","links"],"mappings":"AAAO,SAASA,EAAaC,EAAiB,GAC5C,MAAMC,EACJ,iEACF,IAAIC,EAAS,GACb,IAAK,IAAIC,EAAI,EAAGA,EAAIH,EAAQG,IAC1BD,GAAUD,EAAWG,OAAOC,KAAKC,MAAsBL,GAAhBI,KAAKE,WAE9C,OAAOL,CACT,CASO,SAASM,EAASC,EAAcC,EAAY,KACjD,GAAID,EAAKT,QAAUU,EACjB,OAAOD,EAET,MAAME,EAAcF,EAAKG,UAAU,EAAGF,GAEhCG,EAAiBF,EAAYG,YAAY,KAE/C,OAAID,EAAiB,EACZF,EAAYC,UAAU,EAAGC,GAAkB,MAG3CF,EAAc,KAEzB,CC7BaI,MAAAA,EAAYA,CAACC,EAAeC,IACtC,GAAED,EAAME,QAAQ,IAAIC,OAAQ,MAAM,OAAOF,EAAMC,QAC9C,IAAIC,OAAQ,MACZ,MAGSC,EAAYC,IACvB,IAAKC,QAAQC,IAAIC,gBACf,MAAM,IAAIC,MAAM,oDAClB,OAAOV,EAAUO,QAAQC,IAAIC,gBAA2BH,EAAS,EAGtDK,EAAUC,IACrB,IAAKL,QAAQC,IAAIK,eACf,MAAM,IAAIH,MAAM,mDAElB,GAAoC,gBAA/BH,QAAQC,IAAIM,IA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C,IAAIqP,iCAMnBxE,CAAG,OAIbqE,MAEFvF,EACJ"}
|
|
1
|
+
{"version":3,"file":"index.node.esm.js","sources":["../src/node/string/index.ts","../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 function randomString(length: number = 9): string {\n const characters =\n \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * characters.length));\n }\n return result;\n}\n\n/**\n * Reduces text to the specified size, adding \"...\" (ellipses) to the last word.\n *\n * @param text string\n * @param maxLength number\n * @returns string\n */\nexport function cropText(text: string, maxLength = 250) {\n if (text.length <= maxLength) {\n return text;\n }\n const croppedText = text.substring(0, maxLength);\n // Find the last space to avoid cutting words in half\n const lastSpaceIndex = croppedText.lastIndexOf(\" \");\n\n if (lastSpaceIndex > 0) {\n return croppedText.substring(0, lastSpaceIndex) + \"...\";\n } else {\n // If no space is found, just add ellipsis at the maxLength\n return croppedText + \"...\";\n }\n}\n","import { randomString } from \"../string\";\n\nexport const joinPaths = (path1: string, path2: string): string =>\n `${path1.replace(new RegExp(`/$`), \"\")}/${path2.replace(\n new RegExp(`^/`),\n \"\"\n )}`;\n\nexport const dealLink = (dealSlug: string): string => {\n if (!process.env.DEALS_ROOT_SLUG)\n throw new Error(\"The env variable DEALS_ROOT_SLUG is not defined!\");\n return joinPaths(process.env.DEALS_ROOT_SLUG as string, dealSlug);\n};\n\nexport const ssoURL = (path: string) => {\n if (!process.env.SABRE_SSO_HOST) {\n throw new Error(\"The env variable SABRE_SSO_HOST is not defined!\");\n }\n if ((process.env.ENV as string) !== \"development\") {\n const suffixes = [\".co.nz\", \".com.au\", \".com\", \".co\", \".au\", \".nz\"];\n const matchedSuffix = suffixes.find((suffix) =>\n (process.env.SABRE_SSO_HOST as string).endsWith(suffix)\n );\n if (\n matchedSuffix &&\n process.env.HOST &&\n !process.env.HOST.endsWith(matchedSuffix)\n ) {\n // On test/staging removes the subdomain part: \"test.\", \"staging.\"\n const host = (process.env.HOST as string).replace(\n /^(test\\.|staging\\.)/,\n \"\"\n );\n return `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST?.split(\".\")[0]}.${host}${path}`;\n }\n }\n return `${process.env.SABRE_SSO_PROTOCOL}://${process.env.SABRE_SSO_HOST}${path}`;\n};\n\nexport const tripadvisorRatingURL = (score: string) =>\n `https://www.tripadvisor.com/img/cdsi/img2/ratings/traveler/${(\n Math.floor(parseFloat(score) * 2) / 2\n ).toFixed(1)}-41022-5.svg`;\n\nexport const opentableLink = (id: number): string =>\n `https://www.opentable.com.au/restref/client?rid=${id}&restref=${id}&lang=en-AU&r3uid=${randomString(\n 9\n )}&ot_source=Restaurant+website&color=1`;\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 {\n HotelOptionsByCityType,\n HotelPagesType,\n CityKeyType,\n HotelOptionType,\n AddressDataType,\n} from \"./types\";\n\n/**\n *\n * Returns Select options sorting by the cities with more hotels, otherwise alphabetically.\n * When the countryPriority is provided, it will sort the cities by the priority of the country.\n * For instance when countryPriority = {\"NZ\": 1, \"AU\": 2} it will display cities from New Zealand and then from Australia.\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 countryPriority?: { [countryCode: string]: number },\n): HotelOptionsByCityType[] => {\n const defaultCityOrder = [\n \"Sydney\",\n \"Melbourne\",\n \"Brisbane\",\n \"Perth\",\n \"Hobart\",\n \"Canberra\",\n \"Adelaide\",\n \"Gold Coast\",\n \"Darwin\",\n \"Auckland\",\n \"Wellington\",\n \"Queenstown\",\n \"Singapore\",\n ];\n\n const hotelsByCity: { [city: string]: HotelOptionType[] } = {};\n\n // Group hotels by city, including sort and country_id\n for (const hotelCode in hotelPages) {\n if (hotelPages.hasOwnProperty(hotelCode)) {\n const hotel = hotelPages[hotelCode];\n if (!hotelsByCity[hotel.city]) {\n hotelsByCity[hotel.city] = [];\n }\n hotelsByCity[hotel.city].push({\n label: hotel.name,\n value: hotelCode,\n sort: hotel.sort,\n country_id: hotel.country_id,\n });\n }\n }\n\n let result: HotelOptionsByCityType[] = Object.keys(hotelsByCity).map(\n (city) => ({\n label: city,\n options: hotelsByCity[city].sort((a, b) => a.sort - b.sort), // Sort within city by 'sort'\n }),\n );\n\n // Apply country priority if provided\n if (countryPriority) {\n result.sort((a, b) => {\n const countryA = a.options.length > 0 ? a.options[0].country_id : null;\n const countryB = b.options.length > 0 ? b.options[0].country_id : null;\n\n const priorityA =\n countryA && countryPriority[countryA] !== undefined\n ? countryPriority[countryA]\n : Infinity;\n const priorityB =\n countryB && countryPriority[countryB] !== undefined\n ? countryPriority[countryB]\n : Infinity;\n\n if (priorityA !== priorityB) {\n return priorityA - priorityB;\n }\n\n // If countries have the same priority, maintain the default city order\n const indexA = defaultCityOrder.includes(a.label)\n ? defaultCityOrder.indexOf(a.label)\n : Infinity;\n const indexB = defaultCityOrder.includes(b.label)\n ? defaultCityOrder.indexOf(b.label)\n : Infinity;\n return indexA - indexB;\n });\n } else {\n // If no countryPriority, sort by the default city order\n result.sort((a, b) => {\n const indexA = defaultCityOrder.includes(a.label)\n ? defaultCityOrder.indexOf(a.label)\n : Infinity;\n const indexB = defaultCityOrder.includes(b.label)\n ? defaultCityOrder.indexOf(b.label)\n : Infinity;\n return indexA - indexB;\n });\n }\n\n return result;\n};\n\n/**\n * Joins the Property address\n */\nexport const joinAddress = (a: (string | null | undefined)[]): string =>\n a.filter((p): p is string => !!p).join(\", \");\n\n/**\n * Formats a localized address based on the country code.\n * @param countryCode - ISO country code (e.g., 'DE', 'HU', 'US')\n * @param data - Object containing address components\n */\nexport function localizedAddress(\n countryCode: string | null | undefined,\n data: AddressDataType = {},\n): string {\n const { city, address1, address2, postalCode } = data;\n let { stateId } = data;\n\n // 1. Cleanup stateId\n if (stateId && /^[a-zA-Z]{2}-/.test(stateId)) {\n stateId = stateId.split(\"-\")[1];\n }\n\n const fullAddress = [address1, address2].filter(Boolean).join(\" \");\n\n // 2. Define the \"Parts\" based on Country\n let parts: any[];\n\n const code = countryCode?.toLowerCase();\n\n if ([\"de\", \"dk\", \"at\", \"ch\"].includes(code as string)) {\n // Format: [Address], [Post Code] [City]\n // Note: postalCode and city are joined by a space first\n const zipCity = [postalCode, city].filter(Boolean).join(\" \");\n parts = [fullAddress, zipCity];\n } else if (code === \"hu\") {\n // Format: [City], [Address], [Post Code]\n parts = [city, fullAddress, postalCode];\n } else {\n // Default format: [Address], [City], [State], [Post Code]\n parts = [fullAddress, city, stateId, postalCode];\n }\n return joinAddress(parts);\n}\n\nexport const hotelPageLink = (\n city: string,\n hotelName: string,\n lang: String = \"en\",\n) => {\n const slugs: any = {\n TRA: {\n root: `/book-accommodation/${slugify(city, { lower: true })}`,\n slice: 11,\n },\n VIB: {\n root: `/book-accommodation/${slugify(city, { lower: true })}`,\n slice: 5,\n },\n ADI: { root: `/${lang}/apartments/`, slice: 22 },\n };\n return `${slugs[process.env.PROJECT as string].root}/${slugify(hotelName, {\n lower: true,\n }).slice(slugs[process.env.PROJECT as string].slice)}`;\n};\n","import { Actions } from \"gatsby\";\nimport { RedirectionType } from \"./types\";\nconst fs = module.require(\"fs\");\nconst path = module.require(\"path\");\n\n/**\n * Replace Page Metas\n *\n * Replaces the page metas only on multi-domain projects.\n * For instance if the current page has the following metas defined within the page attributes:\n *\n * {\n * \"metas\": {\n * \"rendezvoushotels.co.nz\": {\n * \"en\": {\n * \"title\": \"Rendezvous hotels in New Zealand\",\n * \"description\": \"Book the best hotels in New Zealand\"\n * }\n * }\n * }\n * }\n *\n * and if the current HOST domain (e.g: \"rendezvoushotels.co.nz\") matches one defined in the metas,\n * the page metas will be replaced by the ones defined on this page attributes.\n *\n * @param page Gatsby Page context\n */\nexport const replacePageMetas = (page: any) => {\n // Remove \"staging.\" and \"test.\" prefixes when checking domain metas for convenience (avoids duplication)\n const domainRoot = (process.env.HOST as string).replace(\n /^(test\\.|staging\\.)/,\n \"\",\n );\n if (page.data?.metas?.[domainRoot]?.[page.language]) {\n for (const [key, value] of Object.entries(\n page.data.metas[domainRoot][page.language],\n )) {\n if (key === \"title\") {\n page.head.title = value;\n continue;\n }\n page.head.metas[key] = value;\n }\n }\n return page;\n};\n\n// Build page elements (only for the ones having a build.js)\nexport const build = async (page: any, languages: string[]) => {\n let body = [];\n page = replacePageMetas(page); // Multi-domain projects\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 pageLangs: languages.reduce((acc, lang) => {\n acc[lang] = page[lang];\n return acc;\n }, {} as any),\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 project = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/projectMetadata.json`,\n \"utf-8\",\n ),\n );\n const isMultiLingual = project.languages.length > 1;\n const { createPage, createRedirect } = actions;\n let redirections: RedirectionType[] = [];\n let excluded: string[] = []; // List of excluded pages\n for (const language of project.languages) {\n const jsonDoc = JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/site-${language}.json`,\n `utf-8`,\n ),\n );\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 creation of non-English pages when they are not translated (only on multi-language projects)\n // Also, creates a 302 (temporally) redirection to English version.\n if (isMultiLingual && page.redirect_to_english && !page[language]) {\n redirections.push({\n page: page.slug,\n redirection: `${process.env.PROTOCOL}://${process.env.HOST}/en/${page.slug.slice(4)}`,\n type: \"302\",\n });\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 console.warn(\n \"DEV_PAGE is defined on .env.development file! Only one page will be generated!\",\n );\n continue;\n }\n const component = require.resolve(\n `${process.env.GATSBY_PROJECT_ROOT}/src/components/page/index.tsx`,\n );\n const context = await build(page, project.languages);\n createPage({\n path: page.slug,\n component: component,\n context: context,\n });\n // The root /404/ page must also be created on multi-language projects to\n // handle non-existing root pages without language prefix, E.G: https://mysite.com/non-existing-page\n if (isMultiLingual && page.slug === \"/en/404/\") {\n createPage({\n path: \"/404/\",\n component: component,\n context: context,\n });\n }\n }\n }\n\n createAPIRedirections(\n createRedirect,\n isMultiLingual,\n project.languages,\n redirections,\n );\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 isMultiLingual: boolean,\n languages: string[],\n pagesRedirections: RedirectionType[],\n) => {\n // Load API redirections\n const redirections = [\n ...pagesRedirections,\n ...JSON.parse(\n fs.readFileSync(\n `${process.env.GATSBY_PROJECT_ROOT}/src/data/pages/redirections.json`,\n `utf-8`,\n ),\n ).reduce((acc: RedirectionType[], r: RedirectionType) => {\n if (isMultiLingual) {\n // Add language prefixes to page redirection slug on multi-language projects.\n // E.G: A project with languages [\"en\", \"de\"] will transform the redirection slug \"/my-page/\"\n // into \"/en/my-page/\" and \"/de/my-page/\".\n for (const languageCode of languages) {\n acc.push({\n type: r.type,\n page: `/${languageCode}${r.page}`,\n redirection: `${r.redirection[0] === \"/\" ? `/${languageCode}` : \"\"}${r.redirection}`,\n });\n }\n } else {\n acc.push(r);\n }\n return acc;\n }, []),\n ];\n // Redirect homepage \"/\" to \"/en/\" on multi-language projects\n if (isMultiLingual) {\n redirections.push({\n page: \"/\",\n redirection: `${process.env.PROTOCOL}://${process.env.HOST}/en/`,\n type: \"301\",\n });\n }\n\n redirections.forEach((redirect: RedirectionType) => {\n createRedirect({\n fromPath: redirect.page,\n toPath: redirect.redirection,\n isPermanent:\n Boolean(process.env.NOT_CREATE_S3_ROUTING_RULES) || // Must always be a 301 redirect when S3 Routing Rules is disabled (has to be disabled if there are more than 50 redirections)\n redirect.type === \"301\",\n redirectInBrowser: true, // Redirect also in browser because 302 redirection only work on full page loads.\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 `${process.env.ENV === \"production\" ? \"Allow: /\" : \"Disallow: /\"}`,\n `${excludedPages.length ? excludedPages.map((slug: string) => `Disallow: ${slug}`).join(\"\\n\") : \"\"}`,\n `Sitemap: ${process.env.PROTOCOL}://${process.env.HOST}/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\n/**\n *\n * Fixes Development bugs on forms (Recaptcha v3) and Toast.\n * The bug is caused when running `yarn link \"@tfehotels/tfe-gatsby-library\"` on development\n * because this library will try to find the modules at the @tfehotels/tfe-gatsby-library/node_modules folder\n * instead of using the ./node_modules/ of the project.\n *\n */\nexport const createWebpackConfig = ({ actions, getConfig }: any) => {\n const config = getConfig();\n let alias = {\n ...config.resolve.alias,\n };\n // if (process.env.ENV === \"development\") {\n // alias[\"react-hot-toast\"] = path.resolve(\n // process.env.GATSBY_PROJECT_ROOT,\n // \"node_modules\",\n // \"react-hot-toast\"\n // );\n // }\n config.resolve = {\n ...config.resolve,\n alias: alias,\n };\n actions.replaceWebpackConfig(config);\n};\n","import { joinPaths } from \"../url\";\nimport { ImageType, PageTagsType, QueryParamsType } from \"./types\";\nconst { getImage, withArtDirection } = module.require(\"gatsby-plugin-image\");\nconst fs = module.require(\"fs\");\nconst path = module.require(\"path\");\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 apiLink = (\n apiPath: string = \"\",\n queryParams: QueryParamsType | null = null,\n): string =>\n `${joinPaths(\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: apiLink(\"/v1/project/request/contact\"),\n form_redirection: null,\n form_ajax_request: null,\n recaptcha_action: \"\",\n recaptcha_v3: false,\n gtm_event: null,\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 \"gtm_event\",\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 \"country\",\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\nexport const fetchProjectMetadata = async (rootDir: string) => {\n // The URL of the JSON data you want to fetch\n const url = `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/`;\n try {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch project metadata data from \"${url}\": ${response.statusText}`,\n );\n }\n const data = await response.json();\n const filePath = `${rootDir}/src/data/`;\n const fileName = \"projectMetadata.json\";\n // Write the data to a local JSON file\n fs.writeFileSync(\n path.resolve(filePath, fileName),\n JSON.stringify(data, null, 2),\n );\n console.log(\n `\\x1b[32msuccess\\x1b[0m Project metadata fetched and saved to:\\r\\n\"${filePath}${fileName}\"`,\n );\n } catch (error) {\n console.error(\n `Error fetching project metadata from \"${url}\" data:\\r\\n`,\n error,\n );\n process.exit(1);\n }\n};\n","const fs = require(\"fs\");\n\nexport 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 const rootDir = process.env.GATSBY_PROJECT_ROOT;\n const { version } = JSON.parse(\n fs.readFileSync(`${rootDir}/package.json`, \"utf-8\"),\n );\n const project = JSON.parse(\n fs.readFileSync(`${rootDir}/src/data/projectMetadata.json`, \"utf-8\"),\n );\n const isMultiLingual = project.languages.length > 1;\n\n // Add multi-language plugins (only multi-language projects):\n if (isMultiLingual) {\n plugins.push({\n resolve: `gatsby-source-filesystem`,\n options: {\n path: `${rootDir}/locales`,\n name: `locale`,\n },\n });\n plugins.push({\n resolve: `gatsby-plugin-react-i18next`,\n options: {\n localeJsonSourceName: `locale`,\n defaultLanguage: process.env.PROJECT_DEFAULT_LANGUAGE,\n fallbackLng: process.env.PROJECT_DEFAULT_LANGUAGE,\n languages: project.languages,\n siteUrl: `${process.env.PROTOCOL}://${process.env.HOST}`,\n trailingSlash: \"always\",\n i18nextOptions: {\n interpolation: {\n escapeValue: false,\n },\n keySeparator: false,\n nsSeparator: false,\n react: {\n transSupportBasicHtmlNodes: true,\n transKeepBasicHtmlNodesFor: [\n \"a\",\n \"br\",\n \"span\",\n \"strong\",\n \"i\",\n \"p\",\n \"ul\",\n \"li\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n ],\n },\n },\n redirect: false,\n pages: [\n {\n matchPath: \"/:lang?/(.*)\", // Prevents duplication of pages (Otherwise i18 plugin duplicates pages adding language code prefix)\n getLanguageFromPath: true,\n languages: project.languages,\n },\n ],\n },\n });\n }\n // Add Google Tag Manager (GTM) only when the \"GTM_ID\" is defined.\n if (process.env.GTM_ID) {\n plugins.push({\n resolve: \"gatsby-plugin-google-tagmanager\",\n options: {\n id: process.env.GTM_ID,\n },\n });\n }\n\n return {\n siteMetadata: {\n version: version,\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: project.name,\n short_name: project.name,\n lang: process.env.PROJECT_DEFAULT_LANGUAGE,\n background_color: project.background_colour,\n theme_color: project.colour,\n start_url: `/`,\n display: `standalone`,\n icon: process.env.PROJECT_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}/redirection/`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: \"redirections\",\n skipCreateNode: true,\n localSave: true,\n path: `${rootDir}/src/data/pages/`,\n },\n ...project.languages.map((language: string) => ({\n url: `${process.env.API_PROTOCOL}://${process.env.API_HOST}/v1/${process.env.PROJECT}/full-content/?language=${language}`,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n name: `site-${language}`,\n skipCreateNode: true,\n localSave: true,\n path: `${rootDir}/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: !process.env.NOT_CREATE_S3_ROUTING_RULES, // Generates routing rules by default, but must be disabled if there are more than 50 redirections.\n generateRedirectObjectsForPermanentRedirects: true,\n generateRedirectObjectsForTemporaryRedirects: true,\n acl: \"private\",\n },\n },\n {\n resolve: `gatsby-plugin-sitemap`,\n options: {\n // Skip homepage \"/\" on multi-language projects, because it uses \"/en/\" instead.\n excludes: [\"/404/\", \"/**/404/\", isMultiLingual ? \"/\" : \"\"],\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.pageContext.is_hidden,\n serialize: (page: any, { resolvePagePath }: any) => {\n const url: any = {\n url: resolvePagePath(page),\n lastmod: page.pageContext.published_at,\n };\n // Generate hreflang links for multi-language projects:\n if (isMultiLingual) {\n url.links = project.languages.reduce(\n (acc: any, lang: string) => {\n // Avoid creating links for non-English pages when the \"redirect_to_english\" flag is active:\n if (!page.pageContext.redirect_to_english || lang === \"en\") {\n acc.push({\n lang: lang,\n url: url.url.replace(/^\\/[a-z]{2}\\//, `/${lang}/`),\n });\n }\n return acc;\n },\n [\n {\n lang: \"x-default\",\n url: url.url.replace(\n /^\\/[a-z]{2}\\//,\n `/${process.env.PROJECT_DEFAULT_LANGUAGE}/`,\n ),\n },\n ],\n );\n }\n return url;\n },\n },\n },\n ...plugins,\n ],\n ...config,\n };\n};\n"],"names":["randomString","length","characters","result","i","charAt","Math","floor","random","cropText","text","maxLength","croppedText","substring","lastSpaceIndex","lastIndexOf","joinPaths","path1","path2","replace","RegExp","dealLink","dealSlug","process","env","DEALS_ROOT_SLUG","Error","ssoURL","path","SABRE_SSO_HOST","ENV","matchedSuffix","find","suffix","endsWith","HOST","host","SABRE_SSO_PROTOCOL","split","tripadvisorRatingURL","score","parseFloat","toFixed","opentableLink","id","nOptions","n","start","defaultOpt","obj","toString","slugify","module","require","hotelOptionsByCity","hotelPages","countryPriority","defaultCityOrder","hotelsByCity","hotelCode","hasOwnProperty","hotel","city","push","label","name","value","sort","country_id","Object","keys","map","options","a","b","countryA","countryB","priorityA","undefined","Infinity","priorityB","includes","indexOf","joinAddress","filter","p","join","localizedAddress","countryCode","data","address1","address2","postalCode","stateId","test","fullAddress","Boolean","parts","code","toLowerCase","hotelPageLink","hotelName","lang","slugs","TRA","root","lower","slice","VIB","ADI","PROJECT","fs","build","async","page","languages","body","domainRoot","metas","language","key","entries","head","title","replacePageMetas","element","buildElement","slug","tags","pageLangs","reduce","acc","createAPIPages","GATSBY_PROJECT_ROOT","project","JSON","parse","readFileSync","isMultiLingual","createPage","createRedirect","actions","redirections","excluded","jsonDoc","is_hidden","is_active","redirect_to_english","redirection","PROTOCOL","type","DEV_PAGE","parseInt","console","warn","component","resolve","context","createAPIRedirections","writeFileSync","stringify","pagesRedirections","r","languageCode","forEach","redirect","fromPath","toPath","isPermanent","NOT_CREATE_S3_ROUTING_RULES","redirectInBrowser","force","postBuild","excludedPages","robotsTxt","existsSync","import","createWebpackConfig","getConfig","config","alias","replaceWebpackConfig","getImage","withArtDirection","tagExists","pageTags","tag","apiLink","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","gtm_event","items","fields","cfg","validTypes","Set","uniqueId","addItem","parents","newItem","item","Array","isArray","children","setFormFields","field","k","fieldName","input_name","sectionName","k2","has","imageData","mobile_image","fetchProjectMetadata","response","fetch","ok","statusText","json","filePath","rootDir","fileName","log","error","exit","defaultGatsbyConfig","plugins","version","localeJsonSourceName","defaultLanguage","PROJECT_DEFAULT_LANGUAGE","fallbackLng","siteUrl","trailingSlash","i18nextOptions","interpolation","escapeValue","keySeparator","nsSeparator","react","transSupportBasicHtmlNodes","transKeepBasicHtmlNodesFor","pages","matchPath","getLanguageFromPath","GTM_ID","siteMetadata","SITE_TITLE","description","SITE_DESCRIPTION","SITE_IMAGE","protocol","domain","short_name","background_color","background_colour","theme_color","colour","start_url","display","icon","PROJECT_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","generateRedirectObjectsForTemporaryRedirects","acl","excludes","query","resolveSiteUrl","filterPages","pageContext","serialize","resolvePagePath","lastmod","published_at","links"],"mappings":"AAAO,SAASA,EAAaC,EAAiB,GAC5C,MAAMC,EACJ,iEACF,IAAIC,EAAS,GACb,IAAK,IAAIC,EAAI,EAAGA,EAAIH,EAAQG,IAC1BD,GAAUD,EAAWG,OAAOC,KAAKC,MAAsBL,GAAhBI,KAAKE,WAE9C,OAAOL,CACT,CASO,SAASM,EAASC,EAAcC,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