@react-pakistan/util-functions 3.0.0 → 3.0.1
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/constants/api-methods.js +1 -1
- package/constants/api-methods.mjs +1 -1
- package/constants/cache-time.js +1 -1
- package/constants/cache-time.mjs +1 -1
- package/constants/countries-timezones.js +1 -1
- package/constants/countries-timezones.mjs +1 -1
- package/constants/currencies.js +1 -1
- package/constants/currencies.mjs +1 -1
- package/constants/dial-codes.js +1 -1
- package/constants/dial-codes.mjs +1 -1
- package/constants/layout-direction.js +1 -1
- package/constants/layout-direction.mjs +1 -1
- package/constants/react-pakistan-meta.js +1 -1
- package/constants/react-pakistan-meta.mjs +1 -1
- package/constants/react-pakistan.js +12 -1
- package/constants/react-pakistan.mjs +12 -1
- package/constants/select-value-delimiter.js +1 -1
- package/constants/select-value-delimiter.mjs +1 -1
- package/constants/social-media-colors.js +1 -1
- package/constants/social-media-colors.mjs +1 -1
- package/constants/social-media-sizes.js +1 -1
- package/constants/social-media-sizes.mjs +1 -1
- package/constants/user-roles.js +1 -1
- package/constants/user-roles.mjs +1 -1
- package/factory/generic-component-factory.js +1 -1
- package/factory/generic-component-factory.mjs +1 -1
- package/factory/generic-module-factory.js +1 -1
- package/factory/generic-module-factory.mjs +1 -1
- package/general/basic-get.js +1 -1
- package/general/basic-get.mjs +1 -1
- package/general/basic-post.js +1 -1
- package/general/basic-post.mjs +1 -1
- package/general/calculate-pages.js +1 -1
- package/general/calculate-pages.mjs +1 -1
- package/general/camel-to-sentence-case.js +1 -1
- package/general/camel-to-sentence-case.mjs +1 -1
- package/general/check-even-odd-length.js +1 -1
- package/general/check-even-odd-length.mjs +1 -1
- package/general/clear-cache.js +1 -1
- package/general/clear-cache.mjs +1 -1
- package/general/cnic-formatter.js +1 -1
- package/general/cnic-formatter.mjs +1 -1
- package/general/convert-url-to-base64.js +1 -1
- package/general/convert-url-to-base64.mjs +1 -1
- package/general/countries.js +1 -1
- package/general/countries.mjs +1 -1
- package/general/create-date.js +1 -1
- package/general/create-date.mjs +1 -1
- package/general/crypto.js +1 -1
- package/general/crypto.mjs +1 -1
- package/general/delete-image-from-private-supabase.js +1 -1
- package/general/delete-image-from-private-supabase.mjs +1 -1
- package/general/delete-image-from-public-supabase.js +1 -1
- package/general/delete-image-from-public-supabase.mjs +1 -1
- package/general/download-from-url.js +1 -1
- package/general/download-from-url.mjs +1 -1
- package/general/dynamic-page-limit.js +1 -1
- package/general/dynamic-page-limit.mjs +1 -1
- package/general/enum-to-text.js +1 -1
- package/general/enum-to-text.mjs +1 -1
- package/general/fetch-data.js +1 -1
- package/general/fetch-data.mjs +1 -1
- package/general/fetch-supabase-image.js +1 -1
- package/general/fetch-supabase-image.mjs +1 -1
- package/general/fetch-supabase-private-assets.js +1 -1
- package/general/fetch-supabase-private-assets.mjs +1 -1
- package/general/format-date.js +1 -1
- package/general/format-date.mjs +1 -1
- package/general/format-number.js +1 -1
- package/general/format-number.mjs +1 -1
- package/general/format-phone-display.js +1 -1
- package/general/format-phone-display.mjs +1 -1
- package/general/format-phone.js +1 -1
- package/general/format-phone.mjs +1 -1
- package/general/format-pricing.js +1 -1
- package/general/format-pricing.mjs +1 -1
- package/general/format-secs.js +1 -1
- package/general/format-secs.mjs +1 -1
- package/general/format-time.js +1 -1
- package/general/format-time.mjs +1 -1
- package/general/format-value.js +1 -1
- package/general/format-value.mjs +1 -1
- package/general/full-month-range.js +1 -1
- package/general/full-month-range.mjs +1 -1
- package/general/full-year-range.js +1 -1
- package/general/full-year-range.mjs +1 -1
- package/general/generate-article-schema.js +1 -1
- package/general/generate-article-schema.mjs +1 -1
- package/general/generate-blog-schema.js +1 -1
- package/general/generate-blog-schema.mjs +1 -1
- package/general/generate-book-schema.js +1 -1
- package/general/generate-book-schema.mjs +1 -1
- package/general/generate-breadcrumb-schema.js +1 -1
- package/general/generate-breadcrumb-schema.mjs +1 -1
- package/general/generate-carousel-schema.js +1 -1
- package/general/generate-carousel-schema.mjs +1 -1
- package/general/generate-course-schema.js +1 -1
- package/general/generate-course-schema.mjs +1 -1
- package/general/generate-dataset-schema.js +1 -1
- package/general/generate-dataset-schema.mjs +1 -1
- package/general/generate-discussion-forum-schema.js +1 -1
- package/general/generate-discussion-forum-schema.mjs +1 -1
- package/general/generate-education-schema.js +1 -1
- package/general/generate-education-schema.mjs +1 -1
- package/general/generate-employer-aggregate-rating-schema.js +1 -1
- package/general/generate-employer-aggregate-rating-schema.mjs +1 -1
- package/general/generate-event-schema.js +1 -1
- package/general/generate-event-schema.mjs +1 -1
- package/general/generate-faq-schema.js +1 -1
- package/general/generate-faq-schema.mjs +1 -1
- package/general/generate-grid.js +1 -1
- package/general/generate-grid.mjs +1 -1
- package/general/generate-image-metadata-schema.js +1 -1
- package/general/generate-image-metadata-schema.mjs +1 -1
- package/general/generate-job-posting-schema.js +1 -1
- package/general/generate-job-posting-schema.mjs +1 -1
- package/general/generate-local-business-schema.js +1 -1
- package/general/generate-local-business-schema.mjs +1 -1
- package/general/generate-math-solver-schema.js +1 -1
- package/general/generate-math-solver-schema.mjs +1 -1
- package/general/generate-movie-carousel-schema.js +1 -1
- package/general/generate-movie-carousel-schema.mjs +1 -1
- package/general/generate-organization-schema.js +1 -1
- package/general/generate-organization-schema.mjs +1 -1
- package/general/generate-profile-page-schema.js +1 -1
- package/general/generate-profile-page-schema.mjs +1 -1
- package/general/generate-qa-page-schema.js +1 -1
- package/general/generate-qa-page-schema.mjs +1 -1
- package/general/generate-recipe-schema.js +1 -1
- package/general/generate-recipe-schema.mjs +1 -1
- package/general/generate-ref.js +1 -1
- package/general/generate-ref.mjs +1 -1
- package/general/generate-review-snippet-schema.js +1 -1
- package/general/generate-review-snippet-schema.mjs +1 -1
- package/general/generate-shopping-loyalty-program-schema.js +1 -1
- package/general/generate-shopping-loyalty-program-schema.mjs +1 -1
- package/general/generate-shopping-merchant-listing-schema.js +1 -1
- package/general/generate-shopping-merchant-listing-schema.mjs +1 -1
- package/general/generate-shopping-merchant-return-policy-schema.js +1 -1
- package/general/generate-shopping-merchant-return-policy-schema.mjs +1 -1
- package/general/generate-shopping-merchant-shipping-policy-schema.js +1 -1
- package/general/generate-shopping-merchant-shipping-policy-schema.mjs +1 -1
- package/general/generate-shopping-overview-schema.js +1 -1
- package/general/generate-shopping-overview-schema.mjs +1 -1
- package/general/generate-shopping-product-snippet-schema.js +1 -1
- package/general/generate-shopping-product-snippet-schema.mjs +1 -1
- package/general/generate-shopping-variants-schema.js +1 -1
- package/general/generate-shopping-variants-schema.mjs +1 -1
- package/general/generate-software-app-schema.js +1 -1
- package/general/generate-software-app-schema.mjs +1 -1
- package/general/generate-speakable-schema.js +1 -1
- package/general/generate-speakable-schema.mjs +1 -1
- package/general/generate-subscription-schema.js +1 -1
- package/general/generate-subscription-schema.mjs +1 -1
- package/general/generate-vacation-rental-schema.js +1 -1
- package/general/generate-vacation-rental-schema.mjs +1 -1
- package/general/generate-video-schema.js +1 -1
- package/general/generate-video-schema.mjs +1 -1
- package/general/generic-cache.js +1 -1
- package/general/generic-cache.mjs +1 -1
- package/general/get-available-page-limit.js +1 -1
- package/general/get-available-page-limit.mjs +1 -1
- package/general/get-calendar-current-month.js +1 -1
- package/general/get-calendar-current-month.mjs +1 -1
- package/general/get-calendar-dates.js +1 -1
- package/general/get-calendar-dates.mjs +1 -1
- package/general/get-calendar-next-month.js +1 -1
- package/general/get-calendar-next-month.mjs +1 -1
- package/general/get-calendar-previous-month.js +1 -1
- package/general/get-calendar-previous-month.mjs +1 -1
- package/general/get-current-year.js +1 -1
- package/general/get-current-year.mjs +1 -1
- package/general/get-day-name.js +1 -1
- package/general/get-day-name.mjs +1 -1
- package/general/get-dial-code.js +1 -1
- package/general/get-dial-code.mjs +1 -1
- package/general/get-full-name.js +1 -1
- package/general/get-full-name.mjs +1 -1
- package/general/get-href.js +1 -1
- package/general/get-href.mjs +1 -1
- package/general/get-month-name.js +1 -1
- package/general/get-month-name.mjs +1 -1
- package/general/get-month-number.js +1 -1
- package/general/get-month-number.mjs +1 -1
- package/general/get-number-of-days-in-month.js +1 -1
- package/general/get-number-of-days-in-month.mjs +1 -1
- package/general/get-pathname.js +1 -1
- package/general/get-pathname.mjs +1 -1
- package/general/get-week-day.js +1 -1
- package/general/get-week-day.mjs +1 -1
- package/general/image-url-to-base64.js +1 -1
- package/general/image-url-to-base64.mjs +1 -1
- package/general/is-created-or-updated.js +1 -1
- package/general/is-created-or-updated.mjs +1 -1
- package/general/is-next-button-disabled.js +1 -1
- package/general/is-next-button-disabled.mjs +1 -1
- package/general/is-odd.js +1 -1
- package/general/is-odd.mjs +1 -1
- package/general/is-previous-button-disabled.js +1 -1
- package/general/is-previous-button-disabled.mjs +1 -1
- package/general/linear-gradients.js +1 -1
- package/general/linear-gradients.mjs +1 -1
- package/general/multi-part-search.js +1 -1
- package/general/multi-part-search.mjs +1 -1
- package/general/normalize-phone.js +1 -1
- package/general/normalize-phone.mjs +1 -1
- package/general/parse-frontmatter.js +2 -1
- package/general/parse-frontmatter.mjs +2 -1
- package/general/remove-data-image-prefix.js +1 -1
- package/general/remove-data-image-prefix.mjs +1 -1
- package/general/repeat-times.js +1 -1
- package/general/repeat-times.mjs +1 -1
- package/general/resolve-anchor-link.js +1 -1
- package/general/resolve-anchor-link.mjs +1 -1
- package/general/resolve-current-date.js +1 -1
- package/general/resolve-current-date.mjs +1 -1
- package/general/resolve-grid.js +1 -1
- package/general/resolve-grid.mjs +1 -1
- package/general/resolve-initials.js +1 -1
- package/general/resolve-initials.mjs +1 -1
- package/general/set-timezone.js +1 -1
- package/general/set-timezone.mjs +1 -1
- package/general/slugify.js +1 -1
- package/general/slugify.mjs +1 -1
- package/general/text-to-enum.js +1 -1
- package/general/text-to-enum.mjs +1 -1
- package/general/text-to-sentence-case.js +1 -1
- package/general/text-to-sentence-case.mjs +1 -1
- package/general/time-out.js +1 -1
- package/general/time-out.mjs +1 -1
- package/general/time-zones.js +1 -1
- package/general/time-zones.mjs +1 -1
- package/general/truncate-text.js +1 -1
- package/general/truncate-text.mjs +1 -1
- package/general/type.js +1 -1
- package/general/upload-blob-to-private-supabase.js +1 -1
- package/general/upload-blob-to-private-supabase.mjs +1 -1
- package/general/upload-blob-to-public-supabase.js +1 -1
- package/general/upload-blob-to-public-supabase.mjs +1 -1
- package/general/upload-image-to-private-supabase.js +1 -1
- package/general/upload-image-to-private-supabase.mjs +1 -1
- package/general/upload-image-to-public-supabase.js +1 -1
- package/general/upload-image-to-public-supabase.mjs +1 -1
- package/general/url-to-sentence-case.js +1 -1
- package/general/url-to-sentence-case.mjs +1 -1
- package/general/validate-comment.js +1 -1
- package/general/validate-comment.mjs +1 -1
- package/general/validate-email.js +1 -1
- package/general/validate-email.mjs +1 -1
- package/general/validate-form.js +1 -1
- package/general/validate-form.mjs +1 -1
- package/general/validate-name.js +1 -1
- package/general/validate-name.mjs +1 -1
- package/hooks/use-change.js +1 -1
- package/hooks/use-change.mjs +1 -1
- package/hooks/use-debounce.js +1 -1
- package/hooks/use-debounce.mjs +1 -1
- package/hooks/use-fetch.js +1 -1
- package/hooks/use-fetch.mjs +1 -1
- package/hooks/use-force-render.js +1 -1
- package/hooks/use-force-render.mjs +1 -1
- package/hooks/use-ip-geo-location.js +1 -1
- package/hooks/use-ip-geo-location.mjs +1 -1
- package/hooks/use-is-mobile.js +1 -1
- package/hooks/use-is-mobile.mjs +1 -1
- package/hooks/use-module-entity-v2.js +1 -1
- package/hooks/use-module-entity-v2.mjs +1 -1
- package/hooks/use-module-entity.js +1 -1
- package/hooks/use-module-entity.mjs +1 -1
- package/hooks/use-phone-formatter.js +1 -1
- package/hooks/use-phone-formatter.mjs +1 -1
- package/hooks/use-position.js +1 -1
- package/hooks/use-position.mjs +1 -1
- package/hooks/use-rtl.js +1 -1
- package/hooks/use-rtl.mjs +1 -1
- package/hooks/use-sticky.js +1 -1
- package/hooks/use-sticky.mjs +1 -1
- package/hooks/use-toggle-state.js +1 -1
- package/hooks/use-toggle-state.mjs +1 -1
- package/hooks/use-window-event-listener.js +1 -1
- package/hooks/use-window-event-listener.mjs +1 -1
- package/hooks/with-seo.js +1 -1
- package/hooks/with-seo.mjs +1 -1
- package/local-storage/get-storage-value.js +1 -1
- package/local-storage/get-storage-value.mjs +1 -1
- package/local-storage/remove-storage-value.js +1 -1
- package/local-storage/remove-storage-value.mjs +1 -1
- package/local-storage/set-storage-value.js +1 -1
- package/local-storage/set-storage-value.mjs +1 -1
- package/local-storage/type.js +1 -1
- package/package.json +2 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var P=(r,e)=>{for(var i in e)p(r,i,{get:e[i],enumerable:!0})},w=(r,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of v(e))!z.call(r,t)&&t!==i&&p(r,t,{get:()=>e[t],enumerable:!(s=O(e,t))||s.enumerable});return r};var C=r=>w(p({},"__esModule",{value:!0}),r);var A={};P(A,{generateMathSolverSchema:()=>x});module.exports=C(A);const I=r=>{if(r)return typeof r=="string"?{"@type":"Person",name:r}:{"@type":"Person",name:r.name,...r.url&&{url:r.url}}},b=r=>{if(r)return typeof r=="string"?{"@type":"Organization",name:r}:{"@type":"Organization",name:r.name,...r.url&&{url:r.url}}},M=r=>{if(r)return typeof r=="string"?r:{"@type":"ImageObject",url:r.url,...r.width&&{width:r.width},...r.height&&{height:r.height}}},x=({name:r,description:e,url:i,image:s,author:t,provider:d,softwareVersion:u,applicationCategory:f,operatingSystem:o,programmingLanguage:l,license:c,offers:g})=>{const n={"@context":"https://schema.org","@type":"MathSolver",name:r};e&&(n.description=e),i&&(n.url=i);const h=M(s);h&&(n.image=h);const y=I(t);y&&(n.author=y);const S=b(d);if(S&&(n.provider=S),u&&(n.softwareVersion=u),f&&(n.applicationCategory=f),o&&(n.operatingSystem=o),l&&(n.programmingLanguage=l),c&&(n.license=c),g){const m=(Array.isArray(g)?g:[g]).map(a=>({"@type":"Offer",...a.price!=null&&{price:a.price},...a.priceCurrency&&{priceCurrency:a.priceCurrency},...a.url&&{url:a.url}}));n.offers=m.length===1?m[0]:m}return n};0&&(module.exports={generateMathSolverSchema});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const d=r=>{if(r)return typeof r=="string"?{"@type":"Person",name:r}:{"@type":"Person",name:r.name,...r.url&&{url:r.url}}},O=r=>{if(r)return typeof r=="string"?{"@type":"Organization",name:r}:{"@type":"Organization",name:r.name,...r.url&&{url:r.url}}},v=r=>{if(r)return typeof r=="string"?r:{"@type":"ImageObject",url:r.url,...r.width&&{width:r.width},...r.height&&{height:r.height}}},P=({name:r,description:a,url:s,image:h,author:y,provider:S,softwareVersion:g,applicationCategory:m,operatingSystem:p,programmingLanguage:u,license:f,offers:i})=>{const e={"@context":"https://schema.org","@type":"MathSolver",name:r};a&&(e.description=a),s&&(e.url=s);const o=v(h);o&&(e.image=o);const l=d(y);l&&(e.author=l);const c=O(S);if(c&&(e.provider=c),g&&(e.softwareVersion=g),m&&(e.applicationCategory=m),p&&(e.operatingSystem=p),u&&(e.programmingLanguage=u),f&&(e.license=f),i){const t=(Array.isArray(i)?i:[i]).map(n=>({"@type":"Offer",...n.price!=null&&{price:n.price},...n.priceCurrency&&{priceCurrency:n.priceCurrency},...n.url&&{url:n.url}}));e.offers=t.length===1?t[0]:t}return e};export{P as generateMathSolverSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var P=(e,i)=>{for(var a in i)d(e,a,{get:i[a],enumerable:!0})},I=(e,i,a,u)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of b(i))!A.call(e,o)&&o!==a&&d(e,o,{get:()=>i[o],enumerable:!(u=C(i,o))||u.enumerable});return e};var O=e=>I(d({},"__esModule",{value:!0}),e);var L={};P(L,{generateMovieCarouselSchema:()=>M});module.exports=O(L);const g=e=>typeof e=="string"?{"@type":"Person",name:e}:{"@type":"Person",name:e.name,...e.url&&{url:e.url}},R=e=>{if(e)return typeof e=="string"?e:{"@type":"ImageObject",url:e.url,...e.width&&{width:e.width},...e.height&&{height:e.height}}},y=e=>e?/^[A-Z]{3}$/.test(e):!1,h=["InStock","OutOfStock","PreOrder","PreSale","Discontinued","OnlineOnly","InStoreOnly","LimitedAvailability","BackOrder"],w=e=>{if(e)try{const i=String(e);if(i.startsWith("http")){const a=i.replace(/https?:\/\/schema\.org\//i,"");return h.includes(a)?`https://schema.org/${a}`:void 0}return h.includes(i)?`https://schema.org/${i}`:void 0}catch{return}},M=({name:e,url:i,items:a,skipInvalidCurrency:u=!1})=>{const l={"@context":"https://schema.org","@type":"ItemList",itemListElement:a.map((r,v)=>{const t={"@type":"Movie",name:r.name};r.url&&(t.url=r.url),r.id&&(t["@id"]=r.id);const p=R(r.image);if(p&&(t.image=p),r.description&&(t.description=r.description),r.datePublished&&(t.datePublished=r.datePublished),r.duration&&(t.duration=r.duration),r.genre&&(t.genre=Array.isArray(r.genre)?r.genre.join(", "):r.genre),r.director&&(Array.isArray(r.director)?t.director=r.director.map(c=>g(c)):t.director=g(r.director)),r.actor&&(Array.isArray(r.actor)?t.actor=r.actor.map(c=>g(c)):t.actor=g(r.actor)),r.aggregateRating&&(t.aggregateRating={"@type":"AggregateRating",ratingValue:r.aggregateRating.ratingValue,...r.aggregateRating.reviewCount!=null&&{reviewCount:r.aggregateRating.reviewCount}}),r.offers){const c=Array.isArray(r.offers)?r.offers:[r.offers],f=c.map(n=>{if(n.priceCurrency&&!y(n.priceCurrency))return{__invalidCurrency:n.priceCurrency};const s={"@type":"Offer"};if(n.price!=null&&(s.price=n.price),n.priceCurrency&&(s.priceCurrency=n.priceCurrency),n.availability){const m=w(n.availability);m&&(s.availability=m)}return n.url&&(s.url=n.url),s}).filter(n=>n&&!("__invalidCurrency"in n));if(c.some(n=>n.priceCurrency&&!y(n.priceCurrency))&&!u){const n=c.find(s=>s.priceCurrency&&!y(s.priceCurrency));throw new Error(`Invalid currency code: ${n?.priceCurrency}`)}f.length===1?t.offers=f[0]:f.length>1&&(t.offers=f)}return{"@type":"ListItem",position:v+1,item:t}})};return e&&(l.name=e),i&&(l.mainEntityOfPage={"@type":"WebPage","@id":i}),l};0&&(module.exports={generateMovieCarouselSchema});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const u=e=>typeof e=="string"?{"@type":"Person",name:e}:{"@type":"Person",name:e.name,...e.url&&{url:e.url}},h=e=>{if(e)return typeof e=="string"?e:{"@type":"ImageObject",url:e.url,...e.width&&{width:e.width},...e.height&&{height:e.height}}},g=e=>e?/^[A-Z]{3}$/.test(e):!1,y=["InStock","OutOfStock","PreOrder","PreSale","Discontinued","OnlineOnly","InStoreOnly","LimitedAvailability","BackOrder"],v=e=>{if(e)try{const a=String(e);if(a.startsWith("http")){const c=a.replace(/https?:\/\/schema\.org\//i,"");return y.includes(c)?`https://schema.org/${c}`:void 0}return y.includes(a)?`https://schema.org/${a}`:void 0}catch{return}},A=({name:e,url:a,items:c,skipInvalidCurrency:p=!1})=>{const f={"@context":"https://schema.org","@type":"ItemList",itemListElement:c.map((r,m)=>{const i={"@type":"Movie",name:r.name};r.url&&(i.url=r.url),r.id&&(i["@id"]=r.id);const l=h(r.image);if(l&&(i.image=l),r.description&&(i.description=r.description),r.datePublished&&(i.datePublished=r.datePublished),r.duration&&(i.duration=r.duration),r.genre&&(i.genre=Array.isArray(r.genre)?r.genre.join(", "):r.genre),r.director&&(Array.isArray(r.director)?i.director=r.director.map(s=>u(s)):i.director=u(r.director)),r.actor&&(Array.isArray(r.actor)?i.actor=r.actor.map(s=>u(s)):i.actor=u(r.actor)),r.aggregateRating&&(i.aggregateRating={"@type":"AggregateRating",ratingValue:r.aggregateRating.ratingValue,...r.aggregateRating.reviewCount!=null&&{reviewCount:r.aggregateRating.reviewCount}}),r.offers){const s=Array.isArray(r.offers)?r.offers:[r.offers],o=s.map(n=>{if(n.priceCurrency&&!g(n.priceCurrency))return{__invalidCurrency:n.priceCurrency};const t={"@type":"Offer"};if(n.price!=null&&(t.price=n.price),n.priceCurrency&&(t.priceCurrency=n.priceCurrency),n.availability){const d=v(n.availability);d&&(t.availability=d)}return n.url&&(t.url=n.url),t}).filter(n=>n&&!("__invalidCurrency"in n));if(s.some(n=>n.priceCurrency&&!g(n.priceCurrency))&&!p){const n=s.find(t=>t.priceCurrency&&!g(t.priceCurrency));throw new Error(`Invalid currency code: ${n?.priceCurrency}`)}o.length===1?i.offers=o[0]:o.length>1&&(i.offers=o)}return{"@type":"ListItem",position:m+1,item:i}})};return e&&(f.name=e),a&&(f.mainEntityOfPage={"@type":"WebPage","@id":a}),f};export{A as generateMovieCarouselSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var n=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var h=(e,s)=>{for(var t in s)n(e,t,{get:s[t],enumerable:!0})},u=(e,s,t,a)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of y(s))!A.call(e,r)&&r!==t&&n(e,r,{get:()=>s[r],enumerable:!(a=c(s,r))||a.enumerable});return e};var z=e=>u(n({},"__esModule",{value:!0}),e);var O={};h(O,{generateOrganizationSchema:()=>C});module.exports=z(O);const C=({addressCountry:e,addressLocality:s,addressRegion:t,appName:a,baseUrl:r,description:i,email:o,image:g,logo:d,postalCode:l,sameAsArr:p,streetAddress:$,telephone:m})=>({"@context":"https://schema.org","@type":"Organization",image:`${g}`,url:`${r}`,sameAs:p,logo:`${d}`,name:`${a}`,description:`${i}`,email:`${o}`,telephone:`${m}`,address:{"@type":"PostalAddress",streetAddress:`${$}`,addressLocality:`${s}`,addressCountry:`${e}`,addressRegion:`${t}`,postalCode:`${l}`}});0&&(module.exports={generateOrganizationSchema});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const m=({addressCountry:s,addressLocality:e,addressRegion:r,appName:t,baseUrl:a,description:n,email:i,image:o,logo:g,postalCode:d,sameAsArr:l,streetAddress:p,telephone:$})=>({"@context":"https://schema.org","@type":"Organization",image:`${o}`,url:`${a}`,sameAs:l,logo:`${g}`,name:`${t}`,description:`${n}`,email:`${i}`,telephone:`${$}`,address:{"@type":"PostalAddress",streetAddress:`${p}`,addressLocality:`${e}`,addressCountry:`${s}`,addressRegion:`${r}`,postalCode:`${d}`}});export{m as generateOrganizationSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(e,n)=>{for(var t in n)a(e,t,{get:n[t],enumerable:!0})},d=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of P(n))!c.call(e,i)&&i!==t&&a(e,i,{get:()=>n[i],enumerable:!(s=l(n,i))||s.enumerable});return e};var R=e=>d(a({},"__esModule",{value:!0}),e);var j={};h(j,{generateProfilePageSchema:()=>b});module.exports=R(j);const y=e=>{if(e)return typeof e=="string"?e:{"@type":"ImageObject",url:e.url,...e.width&&{width:e.width},...e.height&&{height:e.height}}},u=e=>{if(!e)return;const n={"@type":"Person",name:e.name};e.url&&(n.url=e.url),e.sameAs&&(n.sameAs=e.sameAs),e.jobTitle&&(n.jobTitle=e.jobTitle);const t=y(e.image);return t&&(n.image=t),n},O=e=>{if(!e)return;if(e.jobTitle!==void 0||e.sameAs!==void 0)return u(e);const t={"@type":"Organization",name:e.name};return e.url&&(t.url=e.url),t},b=({name:e,headline:n,url:t,description:s,mainEntity:i,author:m,about:f})=>{const r={"@context":"https://schema.org","@type":"ProfilePage"};e&&(r.name=e),n&&(r.headline=n),t&&(r.mainEntityOfPage={"@type":"WebPage","@id":t}),s&&(r.description=s);const o=u(i);o&&(r.mainEntity=o);const g=O(m);return g&&(r.author=g),f&&f.length>0&&(r.about=f),r};0&&(module.exports={generateProfilePageSchema});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const m=e=>{if(e)return typeof e=="string"?e:{"@type":"ImageObject",url:e.url,...e.width&&{width:e.width},...e.height&&{height:e.height}}},o=e=>{if(!e)return;const n={"@type":"Person",name:e.name};e.url&&(n.url=e.url),e.sameAs&&(n.sameAs=e.sameAs),e.jobTitle&&(n.jobTitle=e.jobTitle);const t=m(e.image);return t&&(n.image=t),n},l=e=>{if(!e)return;if(e.jobTitle!==void 0||e.sameAs!==void 0)return o(e);const t={"@type":"Organization",name:e.name};return e.url&&(t.url=e.url),t},P=({name:e,headline:n,url:t,description:s,mainEntity:g,author:u,about:i})=>{const r={"@context":"https://schema.org","@type":"ProfilePage"};e&&(r.name=e),n&&(r.headline=n),t&&(r.mainEntityOfPage={"@type":"WebPage","@id":t}),s&&(r.description=s);const f=o(g);f&&(r.mainEntity=f);const a=l(u);return a&&(r.author=a),i&&i.length>0&&(r.about=i),r};export{P as generateProfilePageSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var s in e)a(t,s,{get:e[s],enumerable:!0})},g=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!f.call(t,r)&&r!==s&&a(t,r,{get:()=>e[r],enumerable:!(n=d(e,r))||n.enumerable});return t};var i=t=>g(a({},"__esModule",{value:!0}),t);var P={};h(P,{generateQAPageSchema:()=>w});module.exports=i(P);const o=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const e={"@type":"Person",name:t.name};return t.url&&(e.url=t.url),e},u=t=>{const e={"@type":"Answer"};return t.text&&(e.text=t.text),t.author&&(e.author=o(t.author)),t.datePublished&&(e.datePublished=t.datePublished),e},w=({headline:t,mainEntity:e})=>{const s={"@type":"Question",name:e.name};e.text&&(s.text=e.text),e.author&&(s.author=o(e.author)),e.datePublished&&(s.datePublished=e.datePublished),e.answers&&e.answers.length>0&&(s.answerCount=e.answers.length,s.acceptedAnswer=e.acceptedAnswer?u(e.acceptedAnswer):void 0,s.suggestedAnswer=e.answers.filter(r=>!e.acceptedAnswer||r.text!==e.acceptedAnswer.text).map(r=>u(r)));const n={"@context":"https://schema.org","@type":"QAPage",mainEntity:s};return t&&(n.headline=t),n};0&&(module.exports={generateQAPageSchema});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const e={"@type":"Person",name:t.name};return t.url&&(e.url=t.url),e},o=t=>{const e={"@type":"Answer"};return t.text&&(e.text=t.text),t.author&&(e.author=a(t.author)),t.datePublished&&(e.datePublished=t.datePublished),e},u=({headline:t,mainEntity:e})=>{const s={"@type":"Question",name:e.name};e.text&&(s.text=e.text),e.author&&(s.author=a(e.author)),e.datePublished&&(s.datePublished=e.datePublished),e.answers&&e.answers.length>0&&(s.answerCount=e.answers.length,s.acceptedAnswer=e.acceptedAnswer?o(e.acceptedAnswer):void 0,s.suggestedAnswer=e.answers.filter(r=>!e.acceptedAnswer||r.text!==e.acceptedAnswer.text).map(r=>o(r)));const n={"@context":"https://schema.org","@type":"QAPage",mainEntity:s};return t&&(n.headline=t),n};export{u as generateQAPageSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var x=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},I=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of A(e))!T.call(t,i)&&i!==r&&c(t,i,{get:()=>e[i],enumerable:!(a=d(e,i))||a.enumerable});return t};var P=t=>I(c({},"__esModule",{value:!0}),t);var j={};x(j,{generateRecipeSchema:()=>H});module.exports=P(j);const w=t=>{if(t)return typeof t=="string"?t:{"@type":"ImageObject",url:t.url,...t.width&&{width:t.width},...t.height&&{height:t.height}}},S=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const e={"@type":"Person",name:t.name};return t.url&&(e.url=t.url),e},b=t=>{const e={"@type":"HowToStep"};t.name&&(e.name=t.name),t.text&&(e.text=t.text),t.url&&(e.url=t.url);const r=w(t.image);return r&&(e.image=r),e},H=({name:t,description:e,image:r,author:a,recipeYield:i,prepTime:h,cookTime:l,totalTime:p,recipeCategory:g,recipeCuisine:o,keywords:s,recipeIngredient:u,recipeInstructions:m,aggregateRating:f})=>{const n={"@context":"https://schema.org","@type":"Recipe",name:t};e&&(n.description=e);const y=w(r);y&&(n.image=y);const R=S(a);return R&&(n.author=R),i&&(n.recipeYield=i),h&&(n.prepTime=h),l&&(n.cookTime=l),p&&(n.totalTime=p),g&&(n.recipeCategory=Array.isArray(g)?g.join(", "):g),o&&(n.recipeCuisine=Array.isArray(o)?o.join(", "):o),s&&(n.keywords=Array.isArray(s)?s.join(", "):s),u&&u.length>0&&(n.recipeIngredient=u),m&&m.length>0&&(n.recipeInstructions=m.map(b)),f&&(n.aggregateRating={"@type":"AggregateRating",ratingValue:f.ratingValue},f.reviewCount!=null&&(n.aggregateRating.reviewCount=f.reviewCount)),n};0&&(module.exports={generateRecipeSchema});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const y=t=>{if(t)return typeof t=="string"?t:{"@type":"ImageObject",url:t.url,...t.width&&{width:t.width},...t.height&&{height:t.height}}},w=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const n={"@type":"Person",name:t.name};return t.url&&(n.url=t.url),n},d=t=>{const n={"@type":"HowToStep"};t.name&&(n.name=t.name),t.text&&(n.text=t.text),t.url&&(n.url=t.url);const r=y(t.image);return r&&(n.image=r),n},A=({name:t,description:n,image:r,author:R,recipeYield:u,prepTime:m,cookTime:c,totalTime:h,recipeCategory:i,recipeCuisine:a,keywords:g,recipeIngredient:s,recipeInstructions:f,aggregateRating:o})=>{const e={"@context":"https://schema.org","@type":"Recipe",name:t};n&&(e.description=n);const l=y(r);l&&(e.image=l);const p=w(R);return p&&(e.author=p),u&&(e.recipeYield=u),m&&(e.prepTime=m),c&&(e.cookTime=c),h&&(e.totalTime=h),i&&(e.recipeCategory=Array.isArray(i)?i.join(", "):i),a&&(e.recipeCuisine=Array.isArray(a)?a.join(", "):a),g&&(e.keywords=Array.isArray(g)?g.join(", "):g),s&&s.length>0&&(e.recipeIngredient=s),f&&f.length>0&&(e.recipeInstructions=f.map(d)),o&&(e.aggregateRating={"@type":"AggregateRating",ratingValue:o.ratingValue},o.reviewCount!=null&&(e.aggregateRating.reviewCount=o.reviewCount)),e};export{A as generateRecipeSchema};
|
package/general/generate-ref.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var f=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},g=(r,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of i(e))!u.call(r,n)&&n!==t&&s(r,n,{get:()=>e[n],enumerable:!(a=c(e,n))||a.enumerable});return r};var m=r=>g(s({},"__esModule",{value:!0}),r);var p={};f(p,{generateRef:()=>l});module.exports=m(p);var o=require("../constants/select-value-delimiter");const l=({refLength:r=5})=>{const{v4:e}=require("uuid"),t=e().toUpperCase().slice(0,r),a=new Date().getFullYear().toString().slice(-2);return`${t}${o.VALUE_DELIMITER.SLASH}${a}`};0&&(module.exports={generateRef});
|
package/general/generate-ref.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{VALUE_DELIMITER as a}from"../constants/select-value-delimiter";const o=({refLength:e=5})=>{const{v4:r}=require("uuid"),t=r().toUpperCase().slice(0,e),n=new Date().getFullYear().toString().slice(-2);return`${t}${a.SLASH}${n}`};export{o as generateRef};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var o=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(t,n)=>{for(var e in n)o(t,e,{get:n[e],enumerable:!0})},w=(t,n,e,g)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of p(n))!c.call(t,i)&&i!==e&&o(t,i,{get:()=>n[i],enumerable:!(g=R(n,i))||g.enumerable});return t};var y=t=>w(o({},"__esModule",{value:!0}),t);var O={};h(O,{default:()=>C,generateReviewSnippetSchema:()=>l});module.exports=y(O);const b=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const n={"@type":"Person",name:t.name};return t.url&&(n.url=t.url),n},v=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Organization",name:t};const n={"@type":"Organization",name:t.name};return t.url&&(n.url=t.url),n},d=t=>{const n={"@type":"Review"};return t.author&&(n.author=b(t.author)),t.datePublished&&(n.datePublished=t.datePublished),t.reviewBody&&(n.reviewBody=t.reviewBody),t.name&&(n.name=t.name),t.url&&(n.url=t.url),t.publisher&&(n.publisher=v(t.publisher)),t.reviewRating&&(n.reviewRating={"@type":"Rating",ratingValue:t.reviewRating.ratingValue,...t.reviewRating.bestRating!=null&&{bestRating:t.reviewRating.bestRating},...t.reviewRating.worstRating!=null&&{worstRating:t.reviewRating.worstRating}}),n},l=({itemReviewed:t,reviews:n,aggregateRating:e})=>{const g=!!t,i=n&&n.length>0?n.map(d):void 0;let a;if(e)a={"@type":"AggregateRating",ratingValue:e.ratingValue,...e.reviewCount!=null&&{reviewCount:e.reviewCount},...e.ratingCount!=null&&{ratingCount:e.ratingCount},...e.bestRating!=null&&{bestRating:e.bestRating},...e.worstRating!=null&&{worstRating:e.worstRating}};else if(n&&n.length>0){const r=n.map(s=>s.reviewRating?Number(s.reviewRating.ratingValue):NaN).filter(s=>!Number.isNaN(s));r.length>0&&(a={"@type":"AggregateRating",ratingValue:r.reduce((f,m)=>f+m,0)/r.length,reviewCount:n.length,ratingCount:r.length})}if(g){const r={"@context":"https://schema.org","@type":typeof t=="string"?"Thing":t?.["@type"]||"Thing",name:typeof t=="string"?t:t.name};return i&&(r.review=i),a&&(r.aggregateRating=a),r}if(i&&i.length===1){const s={"@context":"https://schema.org",...i[0]};return a&&(s.aggregateRating=a),s}const u={"@context":"https://schema.org"};return i&&(u.review=i),a&&(u.aggregateRating=a),u};var C=l;0&&(module.exports={generateReviewSnippetSchema});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const f=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const n={"@type":"Person",name:t.name};return t.url&&(n.url=t.url),n},m=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Organization",name:t};const n={"@type":"Organization",name:t.name};return t.url&&(n.url=t.url),n},R=t=>{const n={"@type":"Review"};return t.author&&(n.author=f(t.author)),t.datePublished&&(n.datePublished=t.datePublished),t.reviewBody&&(n.reviewBody=t.reviewBody),t.name&&(n.name=t.name),t.url&&(n.url=t.url),t.publisher&&(n.publisher=m(t.publisher)),t.reviewRating&&(n.reviewRating={"@type":"Rating",ratingValue:t.reviewRating.ratingValue,...t.reviewRating.bestRating!=null&&{bestRating:t.reviewRating.bestRating},...t.reviewRating.worstRating!=null&&{worstRating:t.reviewRating.worstRating}}),n},p=({itemReviewed:t,reviews:n,aggregateRating:e})=>{const u=!!t,s=n&&n.length>0?n.map(R):void 0;let r;if(e)r={"@type":"AggregateRating",ratingValue:e.ratingValue,...e.reviewCount!=null&&{reviewCount:e.reviewCount},...e.ratingCount!=null&&{ratingCount:e.ratingCount},...e.bestRating!=null&&{bestRating:e.bestRating},...e.worstRating!=null&&{worstRating:e.worstRating}};else if(n&&n.length>0){const i=n.map(a=>a.reviewRating?Number(a.reviewRating.ratingValue):NaN).filter(a=>!Number.isNaN(a));i.length>0&&(r={"@type":"AggregateRating",ratingValue:i.reduce((o,l)=>o+l,0)/i.length,reviewCount:n.length,ratingCount:i.length})}if(u){const i={"@context":"https://schema.org","@type":typeof t=="string"?"Thing":t?.["@type"]||"Thing",name:typeof t=="string"?t:t.name};return s&&(i.review=s),r&&(i.aggregateRating=r),i}if(s&&s.length===1){const a={"@context":"https://schema.org",...s[0]};return r&&(a.aggregateRating=r),a}const g={"@context":"https://schema.org"};return s&&(g.review=s),r&&(g.aggregateRating=r),g};var c=p;export{c as default,p as generateReviewSnippetSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var i in r)o(e,i,{get:r[i],enumerable:!0})},h=(e,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of c(r))!y.call(e,t)&&t!==i&&o(e,t,{get:()=>r[t],enumerable:!(a=u(r,t))||a.enumerable});return e};var d=e=>h(o({},"__esModule",{value:!0}),e);var L={};b(L,{generateShoppingLoyaltyProgramSchema:()=>R});module.exports=d(L);const O=e=>{if(e)return{name:e.name,...e.url&&{url:e.url}}},R=({programName:e,programUrl:r,programId:i,member:a,membershipNumber:t,enrollmentDate:g,pointsBalance:l,pointsEarned:p,benefits:s,offers:m})=>{const n={"@context":"https://schema.org","@type":"ProgramMembership",programName:e};return r&&(n.url=r),i&&(n["@id"]=i),a&&(n.member=O(a)),t&&(n.membershipNumber=t),g&&(n.enrollmentDate=g),typeof l=="number"&&(n.pointsBalance=l),typeof p=="number"&&(n.pointsEarned=p),s&&s.length>0&&(n.benefits=s),m&&m.length>0&&(n.offers=m.map(f=>({"@type":"Offer",...f.description&&{description:f.description},...f.url&&{url:f.url}}))),n};0&&(module.exports={generateShoppingLoyaltyProgramSchema});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const p=r=>{if(r)return{name:r.name,...r.url&&{url:r.url}}},u=({programName:r,programUrl:a,programId:f,member:s,membershipNumber:m,enrollmentDate:o,pointsBalance:g,pointsEarned:l,benefits:t,offers:i})=>{const e={"@context":"https://schema.org","@type":"ProgramMembership",programName:r};return a&&(e.url=a),f&&(e["@id"]=f),s&&(e.member=p(s)),m&&(e.membershipNumber=m),o&&(e.enrollmentDate=o),typeof g=="number"&&(e.pointsBalance=g),typeof l=="number"&&(e.pointsEarned=l),t&&t.length>0&&(e.benefits=t),i&&i.length>0&&(e.offers=i.map(n=>({"@type":"Offer",...n.description&&{description:n.description},...n.url&&{url:n.url}}))),e};export{u as generateShoppingLoyaltyProgramSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var o=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var v=(r,i)=>{for(var s in i)o(r,s,{get:i[s],enumerable:!0})},L=(r,i,s,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of O(i))!b.call(r,c)&&c!==s&&o(r,c,{get:()=>i[c],enumerable:!(f=I(i,c))||f.enumerable});return r};var k=r=>L(o({},"__esModule",{value:!0}),r);var w={};v(w,{generateShoppingMerchantListingSchema:()=>S});module.exports=k(w);const A=r=>{if(r)return typeof r=="string"?r:{"@type":"ImageObject",url:r.url,...r.width&&{width:r.width},...r.height&&{height:r.height}}},B=r=>{if(r)return typeof r=="string"?{"@type":"Brand",name:r}:{"@type":"Brand",name:r.name,...r.url&&{url:r.url}}},g=r=>r?/^[A-Z]{3}$/.test(r):!1,h=["InStock","OutOfStock","PreOrder","PreSale","Discontinued","OnlineOnly","InStoreOnly","LimitedAvailability","BackOrder"],M=r=>{if(r)try{const i=String(r);if(i.startsWith("http")){const s=i.replace(/https?:\/\/schema\.org\//i,"");return h.includes(s)?`https://schema.org/${s}`:void 0}return h.includes(i)?`https://schema.org/${i}`:void 0}catch{return}},S=({merchant:r,name:i,url:s,products:f,skipInvalidCurrency:c=!1})=>{const u={"@context":"https://schema.org","@type":"ItemList",itemListElement:f.map((n,C)=>{const a={"@type":"Product",name:n.name};n.id&&(a["@id"]=n.id),n.url&&(a.url=n.url);const m=A(n.image);m&&(a.image=m),n.description&&(a.description=n.description);const y=B(n.brand);if(y&&(a.brand=y),n.sku&&(a.sku=n.sku),n.offers){const d=Array.isArray(n.offers)?n.offers:[n.offers],l=d.map(e=>{if(e.priceCurrency&&!g(e.priceCurrency))return{__invalidCurrency:e.priceCurrency};const t={"@type":"Offer"};if(e.price!=null&&(t.price=e.price),e.priceCurrency&&(t.priceCurrency=e.priceCurrency),e.availability){const p=M(e.availability);p&&(t.availability=p)}return e.url&&(t.url=e.url),e.seller&&(t.seller={"@type":"Organization",...e.seller.name&&{name:e.seller.name},...e.seller.url&&{url:e.seller.url}}),e.priceValidUntil&&(t.priceValidUntil=e.priceValidUntil),e.itemCondition&&(t.itemCondition=e.itemCondition),t}).filter(e=>e&&!("__invalidCurrency"in e));if(d.some(e=>e.priceCurrency&&!g(e.priceCurrency))&&!c){const e=d.find(t=>t.priceCurrency&&!g(t.priceCurrency));throw new Error(`Invalid currency code: ${e?.priceCurrency}`)}l.length===1?a.offers=l[0]:l.length>1&&(a.offers=l)}return{"@type":"ListItem",position:C+1,item:a}})};return i&&(u.name=i),s&&(u.mainEntityOfPage={"@type":"WebPage","@id":s}),r&&(u.provider={"@type":"Organization",name:r.name,...r.url&&{url:r.url}}),u};0&&(module.exports={generateShoppingMerchantListingSchema});
|