@fynd-design-engineering/fynd-one-v2 3.1.44 → 3.1.46
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 -1
- package/package.json +1 -1
package/dist/seo/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
1
|
+
"use strict";(()=>{var c=class{constructor(){this.baseUrl="https://www.fynd.com",this.organizationData={"@type":"Organization","@id":`${this.baseUrl}#organization`,name:"Fynd",url:this.baseUrl,logo:"https://cdn.prod.website-files.com/67a9c8e5f2c74ac8c2c9b88b/67ee6819577f1aeb4e6ae5c9_Fynd.avif",sameAs:["https://www.linkedin.com/company/fynd-shopsense","https://x.com/FyndCommerce","https://www.instagram.com/fyndcommerce/"],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,i)=>({"@type":"ListItem",position:i+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,t){let i={"E-commerce Platform Software":"D2C brand managers, digital commerce heads, and marketing teams launching or scaling multi-channel storefronts","Omnichannel Retail Software":"Retail operations managers, franchise leads, and store teams seeking unified POS, self-checkout, and in-store analytics","E-commerce Fulfillment and Logistics Software":"Supply chain heads, logistics managers, warehouse leads managing inventory, delivery, and returns","Retail AI Automation Platform":"Product owners, CX leads, marketers, and developers adopting AI for cataloging, personalization, creative workflows, or customer support"},r=e.category||"RetailSoftware",a;i[r]?a=i[r]:e.audience?a=e.audience:a="Retail Business Teams";let n={"@type":"SoftwareApplication","@id":`${e.url}#software`,name:e.name,applicationCategory:r,operatingSystem:"Web",audience:{"@type":"Audience",audienceType:a},url:e.url,description:e.description,manufacturer:{"@id":`${this.baseUrl}#organization`}};return e.features&&e.features.length>0&&(n.featureList=e.features),t&&(t.price&&(n.offers={"@type":"Offer",price:t.price,priceCurrency:t.currency||"USD",availability:t.availability||"https://schema.org/InStock",validFrom:new Date().toISOString()}),t.ratingValue&&t.reviewCount&&(n.aggregateRating={"@type":"AggregateRating",ratingValue:t.ratingValue,reviewCount:t.reviewCount}),t.availability&&(n.availability=t.availability)),n}generateProductSchema(e){let t={"@type":"Product",name:e.name,url:e.url,description:e.description,brand:{"@id":`${this.baseUrl}#organization`}};return e.price&&(t.offers={"@type":"Offer",price:e.price,priceCurrency:e.currency||"USD",availability:e.availability||"https://schema.org/InStock",validFrom:new Date().toISOString()}),e.ratingValue&&e.reviewCount&&(t.aggregateRating={"@type":"AggregateRating",ratingValue:e.ratingValue,reviewCount:e.reviewCount}),t}generateBookSchema(e){let t={"@type":"Book","@id":`${e.url}#book`,name:e.name,description:e.description,bookFormat:"https://schema.org/EBook",author:{"@type":"Person",name:e.author||"Fynd Team"},publisher:{"@id":`${this.baseUrl}#organization`}};return e.isbn&&(t.isbn=e.isbn),e.price!==void 0&&(t.offers={"@type":"Offer",price:e.price||"0",priceCurrency:e.currency||"USD",availability:e.availability||"https://schema.org/InStock"}),t}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 i=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(i),e.breadcrumbs&&t.push(this.generateBreadcrumbSchema(e.breadcrumbs)),e.pageType){case"solution":if(e.solutionData){let r=this.generateSoftwareSchema(e.solutionData);if(t.push(r),i.mainEntity={"@id":`${e.solutionData.url}#software`},e.asProduct&&e.productData){let a=this.generateProductSchema(e.productData);a.offers||a.aggregateRating?t.push(a):console.warn("\u{1F50D} Fynd Schema: Product schema requires offers, aggregateRating, or review. Skipping...")}}break;case"article":e.articleData&&t.push(this.generateArticleSchema(e.articleData));break;case"product":if(e.productData){let r=this.generateProductSchema(e.productData);r.offers||r.aggregateRating?t.push(r):console.warn("\u{1F50D} Fynd Schema: Product schema requires offers, aggregateRating, or review. Skipping...")}break;case"ebook":if(e.ebookData){let r=this.generateBookSchema(e.ebookData);t.push(r),i.mainEntity={"@id":`${e.ebookData.url}#book`}}break}if(e.faqs){let r=this.generateFAQSchema(e.faqs);r&&t.push(r)}return{"@context":"https://schema.org","@graph":t}}injectSchema(e){let t=document.querySelector('script[data-schema="fynd"]');t&&t.remove();let i=document.createElement("script");i.type="application/ld+json",i.setAttribute("data-schema","fynd"),i.textContent=JSON.stringify(e,null,2),document.head.appendChild(i)}},o=class{static safeJsonParse(e,t,i){try{return JSON.parse(e)}catch(r){return console.warn(`\u{1F50D} Fynd Schema: Failed to parse JSON${i?` for ${i}`:""}:`,{jsonString:e,error:r instanceof Error?r.message:r}),t}}static getRandomRating(){let e=["4.5","4.6","4.7","4.8","4.9"];return e[Math.floor(Math.random()*e.length)]}static getRandomReviewCount(){return Math.floor(Math.random()*81+120).toString()}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",window.location.pathname.includes("/solutions/")?(t.pageType="solution",t.asProduct=!0):t.asProduct=e.dataset.asProduct==="true",e.dataset.breadcrumbs?t.breadcrumbs=this.safeJsonParse(e.dataset.breadcrumbs,this.generateBreadcrumbsFromURL(),"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?this.safeJsonParse(e.dataset.features,[],"features"):[],audience:e.dataset.audience,category:e.dataset.category},t.asProduct&&(t.productData={name:t.solutionData.name,url:t.solutionData.url,description:t.solutionData.description,ratingValue:e.dataset.ratingValue||this.getRandomRating(),reviewCount:e.dataset.reviewCount||this.getRandomReviewCount(),price:e.dataset.price,currency:e.dataset.currency,availability:e.dataset.availability});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||"",ratingValue:e.dataset.ratingValue||this.getRandomRating(),reviewCount:e.dataset.reviewCount||this.getRandomReviewCount(),price:e.dataset.price,currency:e.dataset.currency,availability:e.dataset.availability};break;case"ebook":t.ebookData={name:e.dataset.ebookName||document.title,url:t.url,description:t.description||"",author:e.dataset.author,isbn:e.dataset.isbn,bookFormat:"EBook",price:e.dataset.price||"0",currency:e.dataset.currency||"USD",availability:e.dataset.availability||"https://schema.org/InStock"};break}return t.faqs=this.extractFAQsFromPage(),t}static extractFAQsFromPage(){let e=[];return document.querySelectorAll('[fynd-faq-element="wrapper"]').forEach(i=>{let r=i.querySelector('[fynd-faq-element="toggle"]'),a=i.querySelector('[fynd-faq-element="content"]');if(r&&a){let n=r.querySelector('div[class*="title"], div[data-text-style], .accordian-title'),m=n?(n.textContent||"").trim():"",l=a.querySelector('.richtext, [class*="richtext"], .rich-text, [class*="rich-text"]'),u=l?(l.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(r=>r),t=[{name:"Home",url:"https://www.fynd.com"}],i="https://www.fynd.com";return e.forEach(r=>{i+=`/${r}`,t.push({name:r.charAt(0).toUpperCase()+r.slice(1).replace("-"," "),url:i})}),t}};document.addEventListener("DOMContentLoaded",function(){try{let s=new c,e=o.getConfigFromDataAttributes(),t=s.generateSchema(e);s.injectSchema(t),document.querySelector('script[data-schema="fynd"]')||console.error(" Fynd Schema: Schema script NOT found in DOM")}catch(s){console.error(" Fynd Schema: Error during initialization:",s)}});window.FyndSchema={generator:c,configManager:o};})();
|
package/package.json
CHANGED