@fynd-design-engineering/fynd-one-v2 3.1.21 → 3.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/seo/schema.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(()=>{var s=class{constructor(){this.baseUrl="https://www.fynd.com",this.organizationData={"@type":"Organization","@id":`${this.baseUrl}#organization`,name:"Fynd",url:this.baseUrl,logo:`${this.baseUrl}/logo.png`,sameAs:["https://www.linkedin.com/company/fynd","https://en.wikipedia.org/wiki/Fynd","https://twitter.com/Fynd"],description:"Fynd is an AI-powered unified commerce platform enabling brands to manage end-to-end retail operations."}}generateWebsiteSchema(){return{"@type":"WebSite","@id":`${this.baseUrl}#website`,url:this.baseUrl,name:"Fynd",description:"AI-powered unified commerce platform",publisher:{"@id":`${this.baseUrl}#organization`},potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${this.baseUrl}/search?q={search_term_string}`},"query-input":"required name=search_term_string"}}}generateBreadcrumbSchema(e){return{"@type":"BreadcrumbList",itemListElement:e.map((t,r)=>({"@type":"ListItem",position:r+1,name:t.name,item:t.url}))}}generateWebPageSchema(e){let t={"@type":"WebPage","@id":e.url,url:e.url,name:e.title,description:e.description||"",isPartOf:{"@id":`${this.baseUrl}#website`}};return e.mainEntity&&(t.mainEntity=e.mainEntity),t}generateSoftwareSchema(e){return{"@type":"SoftwareApplication","@id":`${e.url}#software`,name:e.name,applicationCategory:e.category||"RetailSoftware",operatingSystem:"Web",featureList:e.features||[],offers:{"@type":"Offer",price:e.price||"Contact for Pricing",priceCurrency:"USD",availability:"InStock",url:`${this.baseUrl}/contact`},audience:{"@type":"Audience",audienceType:e.audience||"Business"},url:e.url,description:e.description,manufacturer:{"@id":`${this.baseUrl}#organization`}}}generateProductSchema(e){return{"@type":"Product",name:e.name,url:e.url,description:e.description,brand:{"@id":`${this.baseUrl}#organization`},offers:{"@type":"Offer",price:e.price||"Contact for Pricing",priceCurrency:"USD",availability:"InStock",url:`${this.baseUrl}/contact`}}}generateFAQSchema(e){return!e||e.length===0?null:{"@type":"FAQPage",mainEntity:e.map(t=>({"@type":"Question",name:t.question,acceptedAnswer:{"@type":"Answer",text:t.answer}}))}}generateArticleSchema(e){return{"@type":"Article",headline:e.title,description:e.description,image:e.image,author:{"@type":"Person",name:e.author||"Fynd Team"},publisher:{"@id":`${this.baseUrl}#organization`},datePublished:e.publishDate,dateModified:e.modifyDate||e.publishDate,mainEntityOfPage:{"@type":"WebPage","@id":e.url}}}generateSchema(e){let t=[];t.push(this.organizationData),t.push(this.generateWebsiteSchema());let r=this.generateWebPageSchema({url:e.url||window.location.href,title:e.title||document.title,description:e.description||document.querySelector('meta[name="description"]')?.content,mainEntity:e.mainEntity});switch(t.push(r),e.breadcrumbs&&t.push(this.generateBreadcrumbSchema(e.breadcrumbs)),e.pageType){case"solution":if(e.solutionData){let i=this.generateSoftwareSchema(e.solutionData);if(t.push(i),e.asProduct){let a=this.generateProductSchema({...e.solutionData});t.push(a)}}break;case"article":e.articleData&&t.push(this.generateArticleSchema(e.articleData));break;case"product":e.productData&&t.push(this.generateProductSchema(e.productData));break}if(e.faqs){let i=this.generateFAQSchema(e.faqs);i&&t.push(i)}return{"@context":"https://schema.org","@graph":t}}injectSchema(e){let t=document.querySelector('script[data-schema="fynd"]');t&&t.remove();let r=document.createElement("script");r.type="application/ld+json",r.setAttribute("data-schema","fynd"),r.textContent=JSON.stringify(e,null,2),document.head.appendChild(r)}},c=class{static getConfigFromDataAttributes(){let e=document.body,t={url:"",title:"",description:"",pageType:"default"};switch(t.url=window.location.href,t.title=document.title,t.description=document.querySelector('meta[name="description"]')?.content,t.pageType=e.dataset.pageType||"default",e.dataset.breadcrumbs?t.breadcrumbs=JSON.parse(e.dataset.breadcrumbs):t.breadcrumbs=this.generateBreadcrumbsFromURL(),t.pageType){case"solution":t.solutionData={name:e.dataset.solutionName||document.title,url:t.url,description:t.description||"",features:e.dataset.features?JSON.parse(e.dataset.features):[],audience:e.dataset.audience,price:e.dataset.price,category:e.dataset.category},t.asProduct=e.dataset.asProduct==="true";break;case"article":t.articleData={title:t.title,url:t.url,description:t.description||"",author:e.dataset.author,publishDate:e.dataset.publishDate||new Date().toISOString(),modifyDate:e.dataset.modifyDate,image:e.dataset.image||document.querySelector('meta[property="og:image"]')?.content};break;case"product":t.productData={name:e.dataset.productName||document.title,url:t.url,description:t.description||"",price:e.dataset.price};break}return t.faqs=this.extractFAQsFromPage(),t}static extractFAQsFromPage(){let e=[];return document.querySelectorAll('[fynd-faq-element="wrapper"]').forEach(r=>{let i=r.querySelector('[fynd-faq-element="toggle"]'),a=r.querySelector('[fynd-faq-element="content"]');if(i&&a){let o=i.querySelector('div[class*="title"], div[data-text-style], .accordian-title'),m=o?(o.textContent||"").trim():"",d=a.querySelector('.richtext, [class*="richtext"], .rich-text, [class*="rich-text"]'),u=d?(d.textContent||"").trim():(a.textContent||"").trim();m&&u&&e.push({question:m,answer:u})}}),e.length>0?e:null}static generateBreadcrumbsFromURL(){let e=window.location.pathname.split("/").filter(i=>i),t=[{name:"Home",url:"https://www.fynd.com"}],r="https://www.fynd.com";return e.forEach(i=>{r+=`/${i}`,t.push({name:i.charAt(0).toUpperCase()+i.slice(1).replace("-"," "),url:r})}),t}};document.addEventListener("DOMContentLoaded",function(){let n=new s,e=c.getConfigFromDataAttributes(),t=n.generateSchema(e);n.injectSchema(t)});window.FyndSchema={generator:s,configManager:c};})();
|
package/package.json
CHANGED