@donotdev/templates 0.0.8 → 0.0.10

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.
Files changed (69) hide show
  1. package/README.md +42 -0
  2. package/dist/AdminLandingTemplate.d.ts +0 -1
  3. package/dist/AdminLandingTemplate.d.ts.map +1 -1
  4. package/dist/AdminLandingTemplate.js +1 -1
  5. package/dist/DashboardTemplate.d.ts.map +1 -1
  6. package/dist/DashboardTemplate.js +1 -1
  7. package/dist/HomeTemplate.js +1 -1
  8. package/dist/LoginTemplate.d.ts.map +1 -1
  9. package/dist/LoginTemplate.js +1 -1
  10. package/dist/ProfileTemplate.d.ts.map +1 -1
  11. package/dist/ProfileTemplate.js +1 -1
  12. package/dist/WhatsNewTemplate.d.ts.map +1 -1
  13. package/dist/WhatsNewTemplate.js +1 -1
  14. package/dist/billing/BillingSuccessTemplate.d.ts +1 -3
  15. package/dist/billing/BillingSuccessTemplate.d.ts.map +1 -1
  16. package/dist/billing/BillingSuccessTemplate.js +1 -1
  17. package/dist/billing/CheckoutTemplate.d.ts +1 -2
  18. package/dist/billing/CheckoutTemplate.d.ts.map +1 -1
  19. package/dist/billing/CheckoutTemplate.js +1 -1
  20. package/dist/billing/PaymentTemplate.d.ts +2 -3
  21. package/dist/billing/PaymentTemplate.d.ts.map +1 -1
  22. package/dist/billing/PaymentTemplate.js +1 -1
  23. package/dist/billing/SubscriptionTemplate.d.ts +2 -3
  24. package/dist/billing/SubscriptionTemplate.d.ts.map +1 -1
  25. package/dist/billing/SubscriptionTemplate.js +1 -1
  26. package/dist/billing/UserSubscriptionTemplate.js +1 -1
  27. package/dist/blog/BlogList.d.ts +28 -0
  28. package/dist/blog/BlogList.d.ts.map +1 -0
  29. package/dist/blog/BlogList.js +1 -0
  30. package/dist/blog/BlogPost.d.ts +29 -0
  31. package/dist/blog/BlogPost.d.ts.map +1 -0
  32. package/dist/blog/BlogPost.js +1 -0
  33. package/dist/blog/blog-loader.d.ts +136 -0
  34. package/dist/blog/blog-loader.d.ts.map +1 -0
  35. package/dist/blog/blog-loader.js +2 -0
  36. package/dist/blog/index.d.ts +31 -0
  37. package/dist/blog/index.d.ts.map +1 -0
  38. package/dist/blog/index.js +1 -0
  39. package/dist/components/MarkdownViewer.d.ts +0 -1
  40. package/dist/components/MarkdownViewer.d.ts.map +1 -1
  41. package/dist/components/MarkdownViewer.js +1 -1
  42. package/dist/crud/CarCardListTemplate.d.ts +0 -1
  43. package/dist/crud/CarCardListTemplate.d.ts.map +1 -1
  44. package/dist/crud/CarCardListTemplate.js +1 -1
  45. package/dist/crud/CarDetailTemplate.d.ts +0 -1
  46. package/dist/crud/CarDetailTemplate.d.ts.map +1 -1
  47. package/dist/crud/CarDetailTemplate.js +1 -1
  48. package/dist/crud/InquiryAdminTemplate.d.ts +1 -2
  49. package/dist/crud/InquiryAdminTemplate.d.ts.map +1 -1
  50. package/dist/crud/InquiryAdminTemplate.js +1 -1
  51. package/dist/crud/InquiryFormTemplate.d.ts +0 -1
  52. package/dist/crud/InquiryFormTemplate.d.ts.map +1 -1
  53. package/dist/crud/InquiryFormTemplate.js +1 -1
  54. package/dist/crud/ProductCardListTemplate.d.ts +0 -1
  55. package/dist/crud/ProductCardListTemplate.d.ts.map +1 -1
  56. package/dist/crud/ProductCardListTemplate.js +1 -40
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/legal/LegalNoticeTemplate.d.ts +10 -1
  61. package/dist/legal/LegalNoticeTemplate.d.ts.map +1 -1
  62. package/dist/legal/LegalNoticeTemplate.js +1 -1
  63. package/dist/legal/PrivacyPolicyTemplate.d.ts +10 -2
  64. package/dist/legal/PrivacyPolicyTemplate.d.ts.map +1 -1
  65. package/dist/legal/PrivacyPolicyTemplate.js +1 -1
  66. package/dist/legal/TermsOfServiceTemplate.d.ts +10 -2
  67. package/dist/legal/TermsOfServiceTemplate.d.ts.map +1 -1
  68. package/dist/legal/TermsOfServiceTemplate.js +1 -1
  69. package/package.json +12 -12
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog-loader.d.ts","sourceRoot":"","sources":["../../src/blog/blog-loader.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,QAAQ;IACvB,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,QAAQ;IACvB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,kDAAkD;IAClD,WAAW,EAAE,MAAM,QAAQ,EAAE,CAAC;IAC9B,sDAAsD;IACtD,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,GAAG,IAAI,CAAC;IACjD,2CAA2C;IAC3C,UAAU,EAAE,MAAM,MAAM,EAAE,CAAC;IAC3B,gCAAgC;IAChC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,QAAQ,EAAE,CAAC;CAC5C;AA4BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;IAC7C,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAoBA;AA6BD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,WAAW,EAAE,MAAM,GAClB,UAAU,CAsDZ"}
@@ -0,0 +1,2 @@
1
+ const p=200;function g(s){const t=s.trim().split(/\s+/).length;return Math.max(1,Math.ceil(t/200))}function f(s){return s?s.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function d(s){const t=s.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);if(!t)return{meta:{title:"",description:"",date:""},content:s};const o={title:"",description:"",date:""},r=t[1]??"";for(const a of r.split(`
2
+ `)){const l=a.indexOf(":");if(l===-1)continue;const e=a.slice(0,l).trim(),n=a.slice(l+1).trim();e&&(o[e]=n)}return{meta:o,content:t[2]??""}}function m(s){const t=s.split("/").pop()?.replace(/\.md$/,"");if(!t)return null;const o=t.lastIndexOf("_");if(o===-1)return{slug:t,lang:"en"};const r=t.slice(o+1),a=t.slice(0,o);return r.length>5?{slug:t,lang:"en"}:{slug:a,lang:r}}function h(s,t){const o=new Map;for(const[e,n]of Object.entries(s)){const i=m(e);i&&(o.has(i.slug)||o.set(i.slug,new Map),o.get(i.slug).set(i.lang,n))}const r=[];for(const[e,n]of o){const i=n.get(t)||n.get("en");if(!i)continue;const{meta:c,content:u}=d(i);r.push({slug:e,meta:c,content:u,readingTime:g(u),tags:f(c.tags)})}r.sort((e,n)=>!e.meta.date&&!n.meta.date?0:e.meta.date?n.meta.date?n.meta.date.localeCompare(e.meta.date):-1:1);const a=new Set;for(const e of r)for(const n of e.tags)a.add(n);const l=[...a].sort();return{getAllPosts:()=>r,getPostBySlug:e=>r.find(n=>n.slug===e)||null,getAllTags:()=>l,getPostsByTag:e=>r.filter(n=>n.tags.includes(e.toLowerCase()))}}export{h as createBlogLoader,d as parseFrontmatter};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @fileoverview Blog utilities and components
3
+ * @description Convention-based blog system using markdown files with frontmatter.
4
+ *
5
+ * ## Features
6
+ * - i18n with `slug_lang.md` convention and `_en` fallback
7
+ * - Reading time estimation
8
+ * - Tag-based filtering
9
+ * - Lazy image loading via MarkdownViewer
10
+ * - RSS 2.0 + sitemap auto-generated at build time by SEOGenerator
11
+ *
12
+ * ## File Convention
13
+ * `src/content/blog/slug_lang.md` (e.g. `my-post_en.md`, `my-post_fr.md`)
14
+ *
15
+ * ## Exports
16
+ * - `createBlogLoader` — Core loader function
17
+ * - `parseFrontmatter` — Frontmatter parser
18
+ * - `BlogList` — Post listing component
19
+ * - `BlogPostView` — Single post component
20
+ * - Types: `BlogPost`, `BlogMeta`, `BlogLoader`
21
+ *
22
+ * @see {@link https://donotdev.com/blog | DoNotDev Blog} for a live example
23
+ *
24
+ * @version 0.0.3
25
+ * @since 0.0.1
26
+ * @author AMBROISE PARK Consulting
27
+ */
28
+ export * from './blog-loader';
29
+ export * from './BlogList';
30
+ export * from './BlogPost';
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blog/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ export*from"./blog-loader";export*from"./BlogList";export*from"./BlogPost";
@@ -5,5 +5,4 @@ export interface MarkdownViewerProps {
5
5
  className?: string;
6
6
  }
7
7
  export declare const MarkdownViewer: import("react").NamedExoticComponent<MarkdownViewerProps>;
8
- export default MarkdownViewer;
9
8
  //# sourceMappingURL=MarkdownViewer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownViewer.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownViewer.tsx"],"names":[],"mappings":"AA0BA,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiFD,eAAO,MAAM,cAAc,2DAA2B,CAAC;AACvD,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"MarkdownViewer.d.ts","sourceRoot":"","sources":["../../src/components/MarkdownViewer.tsx"],"names":[],"mappings":"AAmDA,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAyFD,eAAO,MAAM,cAAc,2DAA2B,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as s}from"react/jsx-runtime";import h,{domToReact as g,Element as o}from"html-react-parser";import{marked as k}from"marked";import{memo as x,useMemo as b}from"react";import{Code as w,cn as M}from"@donotdev/components";import{Link as j}from"@donotdev/ui";function m(a){let n="";for(const r of a.children)r.type==="text"?n+=r.data:r instanceof o&&(n+=m(r));return n}const v=({content:a,className:n})=>{const r=b(()=>{if(!a)return null;const d=k.parse(a,{async:!1,gfm:!0,breaks:!0});return h(d,{replace(c){if(!(c instanceof o))return;const{name:i,attribs:u,children:f}=c;if(i==="pre"){const e=f.find(t=>t instanceof o&&t.name==="code");if(e){const t=/language-(\w+)/.exec(e.attribs?.class||"")?.[1]||"text";return s(w,{language:t,children:m(e).replace(/\n$/,"")})}}if(i==="a"){const e=u?.href||"",t=e.startsWith("http")||e.startsWith("//"),l=g(f);return t?s("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:l}):s(j,{path:e,children:l})}}})},[a]);return r?s("div",{className:M("prose",n),children:r}):null},p=x(v);var y=p;export{p as MarkdownViewer,y as default};
1
+ "use client";import{jsx as c}from"react/jsx-runtime";import g,{domToReact as u,Element as o}from"html-react-parser";import{marked as E}from"marked";import{memo as R,useMemo as h}from"react";import{Code as _,cn as x}from"@donotdev/components";import{Link as S}from"@donotdev/ui";const w=/<script[\s\S]*?<\/script>/gi,b=/<iframe[\s\S]*?(?:<\/iframe>|\/?>)/gi,j=/<object[\s\S]*?(?:<\/object>|\/?>)/gi,k=/<embed[\s\S]*?(?:\/?>)/gi,T=/<svg[^>]*\s+on\w+[\s\S]*?(?:<\/svg>|\/?>)/gi,v=/\s+on\w+\s*=\s*["'][^"']*["']/gi,y=/\s+(?:xlink:)?href\s*=\s*["']\s*(?:javascript:|&#\d+;|&#x[0-9a-f]+;)[^"']*["']/gi,M=/\s+src\s*=\s*["']\s*(?:javascript:|&#\d+;|&#x[0-9a-f]+;)[^"']*["']/gi;function V(e){return e.replace(w,"").replace(b,"").replace(j,"").replace(k,"").replace(T,"").replace(v,"").replace(y,"").replace(M,"")}function m(e){let n="";for(const r of e.children)r.type==="text"?n+=r.data:r instanceof o&&(n+=m(r));return n}const C=({content:e,className:n})=>{const r=h(()=>{if(!e)return null;const p=E.parse(e,{async:!1,gfm:!0,breaks:!0}),d=V(p);return g(d,{replace(l){if(!(l instanceof o))return;const{name:a,attribs:i,children:f}=l;if(a==="pre"){const t=f.find(s=>s instanceof o&&s.name==="code");if(t){const s=/language-(\w+)/.exec(t.attribs?.class||"")?.[1]||"text";return c(_,{language:s,children:m(t).replace(/\n$/,"")})}}if(a==="a"){const t=i?.href||"";return c(S,{path:t,children:u(f)})}if(a==="img"){const t=i?.src||"",s=i?.alt||"";return c("img",{src:t,alt:s,loading:"lazy",decoding:"async",style:{maxWidth:"100%",height:"auto"}})}}})},[e]);return r?c("div",{className:x("prose",n),children:r}):null},D=R(C);export{D as MarkdownViewer};
@@ -46,5 +46,4 @@ export interface CarCardListTemplateProps extends Omit<EntityCardListProps, 'col
46
46
  * @returns React component
47
47
  */
48
48
  export declare function CarCardListTemplate({ entity, title, description, basePath, onClick, cols, staleTime, filter, hideFilters, makeField, modelField, imageField, mileageField, yearField, transmissionField, fuelTypeField, priceField, subtitleField, locale, imageAspectRatio, hideSection, }: CarCardListTemplateProps): import("react/jsx-runtime").JSX.Element;
49
- export default CarCardListTemplate;
50
49
  //# sourceMappingURL=CarCardListTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CarCardListTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/CarCardListTemplate.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAgB1D,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CACpD,mBAAmB,EACnB,MAAM,CACP;IACC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8GAA8G;IAC9G,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,IAAmB,EACnB,SAA0B,EAC1B,MAAM,EACN,WAAmB,EACnB,SAAkB,EAClB,UAAoB,EACpB,UAAqB,EACrB,YAAwB,EACxB,SAAkB,EAClB,iBAAkC,EAClC,aAA0B,EAC1B,UAAoB,EACpB,aAAyB,EACzB,MAAM,EACN,gBAAyB,EACzB,WAAmB,GACpB,EAAE,wBAAwB,2CAsZ1B;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"CarCardListTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/CarCardListTemplate.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAY1D,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CACpD,mBAAmB,EACnB,MAAM,CACP;IACC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8GAA8G;IAC9G,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,IAAmB,EACnB,SAA0B,EAC1B,MAAM,EACN,WAAmB,EACnB,SAAkB,EAClB,UAAoB,EACpB,UAAqB,EACrB,YAAwB,EACxB,SAAkB,EAClB,iBAAkC,EAClC,aAA0B,EAC1B,UAAoB,EACpB,aAAyB,EACzB,MAAM,EACN,gBAAyB,EACzB,WAAmB,GACpB,EAAE,wBAAwB,2CA+Y1B"}
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as a,Fragment as ye}from"react/jsx-runtime";import{useMemo as Fe,useCallback as v}from"react";import{Heart as D,Calendar as we,Gauge as be,Fuel as Ce,Sliders as Se}from"lucide-react";import{Grid as ke,Card as xe,Stack as r,Text as o,Section as J,Button as Ve,Spinner as Te}from"@donotdev/components";import{useTranslation as K}from"@donotdev/core";import{useNavigate as je}from"@donotdev/ui";import{useCrudCardList as Ne,useCrudStore as y,EntityFilters as Ae,matchesFilter as Oe,useEntityFavorites as $e,formatValue as A}from"@donotdev/crud";const ze={};function Y({entity:l,title:Le,description:Re,basePath:Q,onClick:F,cols:W=[1,2,3,4],staleTime:X=1e3*60*30,filter:w,hideFilters:Z=!1,makeField:ee="make",modelField:te="model",imageField:ie="images",mileageField:le="mileage",yearField:ae="year",transmissionField:O="transmission",fuelTypeField:$="fuelType",priceField:z="price",subtitleField:re="variant",locale:ne,imageAspectRatio:oe="16/9",hideSection:se=!1}){const B=je(),L=Q??`/${l.collection}`,d=l.collection,{t:g,i18n:de}=K([l.namespace,"crud"]),{t:n}=K("crud"),ce=ne||de?.language?.replace("_","-")||"en-US",{data:ue,loading:R}=Ne(l,{staleTime:X}),b=ue?.items||[],{isFavorite:me,toggleFavorite:ge,favoritesFilter:E}=$e({collection:d}),f=y(t=>t.collections[d]?.ui?.filters??ze),u=y(t=>t.collections[d]?.ui?.showFavoritesOnly??!1),fe=v(t=>{y.getState().setFilters(d,t)},[d]),he=v(t=>{y.getState().setShowFavoritesOnly(d,t)},[d]),G=v(t=>Object.keys(f).length===0?!0:Object.entries(f).every(([i,h])=>{const p=t[i],S=l.fields[i]?.type||"text";return Oe(p,h,S)}),[f,l.fields]),m=Fe(()=>{let t=b;return t=t.filter(G),u&&(t=t.filter(E)),w&&(t=t.filter(w)),t},[b,G,u,E,w]),pe=v(t=>{F?F(t):B(`${L}/${t}`)},[L,B,F]),C=g("name",{defaultValue:l.name});return a(ye,{children:[!Z&&e(J,{title:n("filters.title",{entity:C,defaultValue:`Browse ${C} - Filters`}),collapsible:!0,defaultOpen:!0,children:a(r,{direction:"column",gap:"medium",children:[e(Ve,{variant:u?"primary":"outline",icon:e(D,{size:18}),onClick:()=>he(!u),children:u?n("favorites.showAll",{defaultValue:"Show All"}):n("favorites.showFavorites",{defaultValue:"Show Favorites"})}),e(Ae,{entity:l,data:b,filters:f,onFiltersChange:fe,fieldsToFilter:l.listCardFields})]})}),(()=>{const t=R?e(r,{align:"center",justify:"center",gap:"medium",style:{padding:"var(--gap-3xl)"},children:e(Te,{})}):m.length===0?a(r,{align:"center",justify:"center",gap:"medium",style:{padding:"var(--gap-3xl)",textAlign:"center"},children:[e(o,{level:"h3",style:{color:"var(--muted-foreground)"},children:n("emptyState.title",{defaultValue:`No ${l.name.toLowerCase()} found`})}),e(o,{style:{color:"var(--muted-foreground)"},children:n("emptyState.description",{defaultValue:`No ${l.name.toLowerCase()} available at this time.`})})]}):e(ke,{cols:W,gap:"medium",children:m.map(i=>{if(i==null)return null;const h=i[ie],p=typeof h=="string"?h:null,S=i[ee],ve=i[te],c=i[le],k=i[ae],I=i[O],P=i[$],U=i[z],_=l.fields[z]??void 0,H=i[re??"variant"],x=me(i.id),M=l.fields[O],q=l.fields[$],V=M&&I!=null?A(I,M,g,{compact:!0}):null,T=q&&P!=null?A(P,q,g,{compact:!0}):null,j=[S,ve].filter(Boolean).join(" ");return a(xe,{clickable:!0,onClick:()=>pe(i.id),elevated:!0,style:{position:"relative",padding:0,overflow:"hidden"},children:[e(D,{fill:x?"#ef4444":"#ffffff",stroke:x?"#ef4444":"var(--muted-foreground)",onClick:s=>{s.stopPropagation(),ge(i.id)},style:{position:"absolute",top:"var(--gap-sm)",right:"var(--gap-sm)",zIndex:10,cursor:"pointer",width:"var(--icon-md)",height:"var(--icon-md)",transition:"fill 0.2s, stroke 0.2s"},"aria-label":x?n("favorites.remove",{defaultValue:"Remove from favorites"}):n("favorites.add",{defaultValue:"Add to favorites"})}),p&&e("div",{style:{width:"100%",aspectRatio:oe,overflow:"hidden"},children:e("img",{src:p,alt:j||C,style:{width:"100%",height:"100%",objectFit:"cover"}})}),a(r,{direction:"column",gap:"tight",style:{padding:"var(--gap-md)"},children:[j&&e(o,{level:"h4",weight:"semibold",children:j}),H&&e(o,{variant:"muted",level:"small",children:H}),U!=null&&_!=null&&(()=>{const s=_;if(!s)return null;const N=A(U,s,g,{compact:!0});return e("div",{style:{marginTop:"var(--gap-xs)",textAlign:"end"},children:typeof N=="string"?e(o,{variant:"accent",align:"end",weight:"bold",children:N}):N})})(),a(r,{direction:"column",gap:"tight",style:{marginTop:"var(--gap-sm)"},children:[(k||c)&&a(r,{direction:"row",gap:"tight",align:"center",children:[k&&a(r,{direction:"row",gap:"tight",align:"center",children:[e(we,{size:16,style:{color:"var(--muted-foreground)"}}),e(o,{level:"small",children:k})]}),c&&a(r,{direction:"row",gap:"tight",align:"center",children:[e(be,{size:16,style:{color:"var(--muted-foreground)"}}),e(o,{level:"small",children:(()=>{const s=typeof c=="number"?c:Number(c);if(isNaN(s))return String(c)+" km";try{return new Intl.NumberFormat(ce).format(s)+" km"}catch{return String(s)+" km"}})()})]})]}),(T||V)&&a(r,{direction:"row",gap:"tight",align:"center",children:[T&&a(r,{direction:"row",gap:"tight",align:"center",children:[e(Ce,{size:16,style:{color:"var(--muted-foreground)"}}),e(o,{level:"small",children:T})]}),V&&a(r,{direction:"row",gap:"tight",align:"center",children:[e(Se,{size:16,style:{color:"var(--muted-foreground)"}}),e(o,{level:"small",children:V})]})]})]})]})]},i.id)})});return se?t:e(J,{title:R?n("results.title.fetching",{defaultValue:"Fetching..."}):n("results.title.count",{count:m.length,defaultValue:m.length===1?"Found 1 item":`Found ${m.length} items`}),collapsible:!0,defaultOpen:!0,children:t})})()]})}var Be=Y;export{Y as CarCardListTemplate,Be as default};
1
+ "use client";import{jsx as e,jsxs as n,Fragment as pe}from"react/jsx-runtime";import{useMemo as he,useCallback as P}from"react";import{Heart as q,Calendar as ve,Gauge as ye,Fuel as we,Sliders as Fe}from"lucide-react";import{Grid as be,Card as Ce,Stack as i,Text as o,Section as J,Button as xe,Spinner as Ve}from"@donotdev/components";import{useTranslation as K,getListCardFieldNames as ke}from"@donotdev/core";import{useNavigate as Se}from"@donotdev/ui";import{useCrudCardList as je,useCrudFilters as Te,EntityFilters as Ne,matchesFilter as $e,useEntityFavorites as ze,formatValue as j}from"@donotdev/crud";function Ue({entity:l,title:Le,description:Oe,basePath:Q,onClick:p,cols:W=[1,2,3,4],staleTime:X=1e3*60*30,filter:h,hideFilters:Y=!1,makeField:Z="make",modelField:ee="model",imageField:te="images",mileageField:re="mileage",yearField:le="year",transmissionField:T="transmission",fuelTypeField:N="fuelType",priceField:$="price",subtitleField:ne="variant",locale:ie,imageAspectRatio:ae="16/9",hideSection:oe=!1}){const z=Se(),L=Q??`/${l.collection}`,O=l.collection,{t:g,i18n:se}=K([l.namespace,"crud"]),{t:a}=K("crud"),ce=ie||se?.language?.replace("_","-")||"en-US",{data:de,loading:A}=je(l,{staleTime:X}),v=de?.items||[],{isFavorite:ue,toggleFavorite:ge,favoritesFilter:I}=ze({collection:O}),{showFavoritesOnly:d,setShowFavoritesOnly:fe,filters:y}=Te({collection:O}),D=P(r=>Object.keys(y).length===0?!0:Object.entries(y).every(([t,f])=>{const m=r[t],F=l.fields[t]?.type||"text";return $e(m,f,F)}),[y,l.fields]),u=he(()=>{let r=v;return r=r.filter(D),d&&(r=r.filter(I)),h&&(r=r.filter(h)),r},[v,D,d,I,h]),me=P(r=>{p?p(r):z(`${L}/${r}`)},[L,z,p]),w=g("name",{defaultValue:l.name});return n(pe,{children:[!Y&&e(J,{title:a("filters.title",{entity:w,defaultValue:`Browse ${w} - Filters`}),collapsible:!0,defaultOpen:!0,children:n(i,{direction:"column",children:[e(xe,{variant:d?"primary":"outline",icon:e(q,{size:18}),onClick:()=>fe(!d),children:d?a("favorites.showAll",{defaultValue:"Show All"}):a("favorites.showFavorites",{defaultValue:"Show Favorites"})}),e(Ne,{entity:l,data:v,fieldsToFilter:ke(l)})]})}),(()=>{const r=A?e(i,{align:"center",justify:"center",style:{padding:"var(--gap-3xl)"},children:e(Ve,{})}):u.length===0?n(i,{align:"center",justify:"center",style:{padding:"var(--gap-3xl)",textAlign:"center"},children:[e(o,{level:"h3",style:{color:"var(--muted-foreground)"},children:a("emptyState.title",{defaultValue:`No ${l.name.toLowerCase()} found`})}),e(o,{style:{color:"var(--muted-foreground)"},children:a("emptyState.description",{defaultValue:`No ${l.name.toLowerCase()} available at this time.`})})]}):e(be,{cols:W,children:u.map(t=>{if(t==null)return null;const f=t[te],m=typeof f=="string"?f:null,R=t[Z],F=t[ee],c=t[re],b=t[le],_=t[T],B=t[N],E=t[$],G=l.fields[$]??void 0,U=t[ne??"variant"],C=ue(t.id),H=l.fields[T],M=l.fields[N],x=H&&_!=null?j(_,H,g,{compact:!0}):null,V=M&&B!=null?j(B,M,g,{compact:!0}):null,k=[R,F].filter(Boolean).join(" ");return n(Ce,{clickable:!0,onClick:()=>me(t.id),elevated:!0,style:{position:"relative",padding:0,overflow:"hidden"},children:[e("button",{type:"button",onClick:s=>{s.stopPropagation(),ge(t.id)},style:{position:"absolute",top:"var(--gap-sm)",insetInlineEnd:"var(--gap-sm)",zIndex:10,cursor:"pointer",padding:"var(--gap-xs)",borderRadius:"var(--radius-full)",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},"aria-label":C?a("favorites.remove",{defaultValue:"Remove from favorites"}):a("favorites.add",{defaultValue:"Add to favorites"}),children:e(q,{fill:C?"#ef4444":"#ffffff",stroke:C?"#ef4444":"var(--muted-foreground)",style:{width:"var(--icon-md)",height:"var(--icon-md)",transition:"fill 0.2s, stroke 0.2s"}})}),m&&e("div",{style:{width:"100%",aspectRatio:ae,overflow:"hidden"},children:e("img",{src:m,alt:k||w,style:{width:"100%",height:"100%",objectFit:"cover"}})}),n(i,{direction:"column",gap:"tight",style:{padding:"var(--gap-md)"},children:[k&&e(o,{level:"h4",weight:"semibold",children:k}),U&&e(o,{variant:"muted",level:"small",children:U}),E!=null&&G!=null&&(()=>{const s=G;if(!s)return null;const S=j(E,s,g,{compact:!0});return e("div",{style:{marginTop:"var(--gap-xs)",textAlign:"end"},children:typeof S=="string"?e(o,{variant:"accent",align:"end",weight:"bold",children:S}):S})})(),n(i,{direction:"column",gap:"tight",style:{marginTop:"var(--gap-sm)"},children:[(b||c)&&n(i,{direction:"row",gap:"tight",align:"center",children:[b&&n(i,{direction:"row",gap:"tight",align:"center",children:[e(ve,{size:16,style:{color:"var(--muted-foreground)"}}),e(o,{level:"small",children:b})]}),c&&n(i,{direction:"row",gap:"tight",align:"center",children:[e(ye,{size:16,style:{color:"var(--muted-foreground)"}}),e(o,{level:"small",children:(()=>{const s=typeof c=="number"?c:Number(c);if(isNaN(s))return String(c)+" km";try{return new Intl.NumberFormat(ce).format(s)+" km"}catch{return String(s)+" km"}})()})]})]}),(V||x)&&n(i,{direction:"row",gap:"tight",align:"center",children:[V&&n(i,{direction:"row",gap:"tight",align:"center",children:[e(we,{size:16,style:{color:"var(--muted-foreground)"}}),e(o,{level:"small",children:V})]}),x&&n(i,{direction:"row",gap:"tight",align:"center",children:[e(Fe,{size:16,style:{color:"var(--muted-foreground)"}}),e(o,{level:"small",children:x})]})]})]})]})]},t.id)})});return oe?r:e(J,{title:A?a("results.title.fetching",{defaultValue:"Fetching..."}):a("results.title.count",{count:u.length,defaultValue:u.length===1?"Found 1 item":`Found ${u.length} items`}),collapsible:!0,defaultOpen:!0,children:r})})()]})}export{Ue as CarCardListTemplate};
@@ -34,5 +34,4 @@ export interface CarDetailTemplateProps {
34
34
  * CarDetailTemplate - Full vehicle detail page
35
35
  */
36
36
  export declare function CarDetailTemplate({ entity, id: propId, customerEntity, inquiryEntity, relatedFields, locale, makeField, modelField, variantField, yearField, mileageField, fuelTypeField, transmissionField, priceField, imagesField, descriptionField, contextField, pageNamespace, }: CarDetailTemplateProps): ReactElement;
37
- export default CarDetailTemplate;
38
37
  //# sourceMappingURL=CarDetailTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CarDetailTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/CarDetailTemplate.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAOD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,EAAE,EAAE,MAAM,EACV,cAAc,EACd,aAAa,EACb,aAAiC,EACjC,MAAM,EACN,SAAkB,EAClB,UAAoB,EACpB,YAAwB,EACxB,SAAkB,EAClB,YAAwB,EACxB,aAA0B,EAC1B,iBAAkC,EAClC,UAAoB,EACpB,WAAsB,EACtB,gBAAgB,EAChB,YAAsB,EACtB,aAAa,GACd,EAAE,sBAAsB,GAAG,YAAY,CAwfvC;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"CarDetailTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/CarDetailTemplate.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAOD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,EAAE,EAAE,MAAM,EACV,cAAc,EACd,aAAa,EACb,aAAiC,EACjC,MAAM,EACN,SAAkB,EAClB,UAAoB,EACpB,YAAwB,EACxB,SAAkB,EAClB,YAAwB,EACxB,aAA0B,EAC1B,iBAAkC,EAClC,UAAoB,EACpB,WAAsB,EACtB,gBAAgB,EAChB,YAAsB,EACtB,aAAa,GACd,EAAE,sBAAsB,GAAG,YAAY,CAigBvC"}
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as s}from"react/jsx-runtime";import{useState as X,useEffect as ge,useMemo as x,useCallback as pe}from"react";import{Share2 as fe,Heart as ye}from"lucide-react";import{Grid as P,Card as E,Stack as h,Text as c,Section as T,Button as C,ImageGallery as ve,Spinner as be}from"@donotdev/components";import{PageContainer as G,Link as Se,useRouteParam as xe,useNavigate as ke}from"@donotdev/ui";import{useTranslation as H}from"@donotdev/core";import{useCrud as Fe,useCrudCardList as we,formatValue as I,useRelatedItems as Ue,useEntityFavorites as Ce}from"@donotdev/crud";import{InquiryFormTemplate as Ie}from"./InquiryFormTemplate";function Y({entity:n,id:Z,customerEntity:V,inquiryEntity:q,relatedFields:ee=["make","price"],locale:te,makeField:p="make",modelField:f="model",variantField:L="variant",yearField:m="year",mileageField:y="mileage",fuelTypeField:k="fuelType",transmissionField:F="transmission",priceField:d="price",imagesField:B="images",descriptionField:N,contextField:ie="carId",pageNamespace:re}){const ne=xe("id"),v=Z||ne||"",le=ke(),ae=n.namespace||`entity-${n.name.toLowerCase()}`,{t:a,i18n:oe}=H([ae,"crud"]),se=re||n.collection,{t:l}=H(se),{t:je}=H("crud"),z=te||oe?.language?.replace("_","-")||"en-US",{get:R}=Fe(n,{backend:"functions"}),[i,ce]=X(null),[$,w]=X("pending"),{data:de}=we(n,{staleTime:1e3*60*30}),{isFavorite:ue,toggleFavorite:he}=Ce({collection:n.collection}),A=ue(v),U=x(()=>n.fields[d],[n.fields,d]),j=pe(e=>e==null?"\u2014":new Intl.NumberFormat(z).format(e)+" km",[z]),W=x(()=>{if(N)return N;const e=`description_${z}`;return n.fields[e]?e:n.fields.description?"description":null},[N,z,n.fields]),_=x(()=>{const e=i?.[B];return e?Array.isArray(e)?e.map(r=>typeof r=="object"&&r&&"fullUrl"in r?{fullUrl:r.fullUrl,thumbUrl:r.thumbUrl}:{fullUrl:r,thumbUrl:r}):[{fullUrl:e,thumbUrl:e}]:[]},[i,B]),g=x(()=>{if(!i)return"";const e=i[p]||"",r=i[f]||"",o=i[L]||"";return[e,r,o].filter(Boolean).join(" ")},[i,p,f,L]),M=x(()=>{if(!i)return[];const e=[],r=i[m];r!=null&&e.push({label:a(m),value:String(r)});const o=i[y];o!=null&&e.push({label:a(y),value:j(o)});const b=i[k];if(b&&n.fields[k]){const u=I(b,n.fields[k],a,{compact:!0});e.push({label:a(k),value:typeof u=="string"?u:String(b)})}const S=i[F];if(S&&n.fields[F]){const u=I(S,n.fields[F],a,{compact:!0});e.push({label:a(F),value:typeof u=="string"?u:String(S)})}return e},[i,m,y,k,F,n.fields,a,j]),{items:J}=Ue(n,i,de?.items||[],ee,{limit:3,tolerance:.3}),K=x(()=>{if(!i)return g;const e=[];if(i[p]&&e.push(String(i[p])),i[f]&&e.push(String(i[f])),i[m]&&e.push(String(i[m])),i[y]&&e.push(j(i[y])),i[d]&&U){const r=i[d],o=I(r,U,a,{asString:!0});e.push(typeof o=="string"?o:String(i[d]))}return e.length>0?e.join(" \u2022 "):g},[i,p,f,m,y,d,U,j,a,g]);ge(()=>{if(!v){w("error");return}w("pending"),R(v).then(e=>{e?(ce(e),w("success")):w("error")}).catch(()=>{w("error")})},[v,R]);const me=async()=>{navigator.share?await navigator.share({title:g,url:window.location.href}):await navigator.clipboard.writeText(window.location.href)},O=W&&i?i[W]:null;return $==="pending"?t(G,{children:t(be,{overlay:!0})}):$==="error"||!i?t(G,{children:s(h,{direction:"column",gap:"large",style:{padding:"var(--gap-xl) 0",textAlign:"center"},children:[t(c,{level:"h2",children:l("notFound","Vehicle not found")}),t(Se,{path:"/",children:t(C,{variant:"primary",children:l("backToHome","Back to home")})})]})}):s(G,{children:[t(T,{children:s(P,{cols:[1,1,2,2],gap:"large",children:[t("div",{children:_.length>0?t(ve,{images:_,altPrefix:g}):t("div",{style:{width:"100%",aspectRatio:"16/9",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--muted)",borderRadius:"var(--radius-lg)"},children:t(c,{variant:"muted",children:l("noImages","No images")})})}),s(h,{direction:"column",gap:"large",children:[s(h,{direction:"column",gap:"tight",children:[t(h,{direction:"row",gap:"tight",align:"center",children:t(c,{level:"h1",style:{margin:0},children:g})}),t("div",{style:{fontSize:"var(--font-size-3xl)",fontWeight:700,color:"var(--accent)"},children:(()=>{const e=i[d];if(e==null||!U)return null;const r=I(e,U,a,{});return typeof r=="string"?t(c,{variant:"accent",weight:"bold",style:{fontSize:"var(--font-size-3xl)"},children:r}):r})()})]}),M.length>0&&t(E,{variant:"glass",children:t(P,{cols:2,gap:"medium",children:M.map(({label:e,value:r})=>s(h,{direction:"column",gap:"tight",children:[t(c,{variant:"muted",style:{fontSize:"var(--font-size-sm)"},children:e}),t(c,{style:{fontWeight:500},children:r})]},e))})}),s(h,{direction:"row",gap:"medium",children:[V&&q?t(C,{variant:"primary",style:{flex:1},onClick:()=>{const e=document.getElementById("inquiry-form");e&&e.scrollIntoView({behavior:"smooth",block:"start"})},children:l("contactUs","Contact us")}):t(C,{variant:"primary",style:{flex:1},disabled:!0,children:l("contactUs","Contact us")}),t(C,{variant:"outline",icon:t(fe,{size:18}),onClick:me,children:l("share","Share")}),t(C,{variant:A?"primary":"outline",icon:t(ye,{size:18}),onClick:()=>he(v),children:A?l("saved","Saved"):l("save","Save")})]})]})]})}),O&&t(T,{title:l("description","Description"),children:t(E,{variant:"glass",children:t(c,{style:{whiteSpace:"pre-wrap",lineHeight:1.7},children:O})})}),V&&q&&t(T,{id:"inquiry-form",title:l("interested","Interested?"),children:t(E,{variant:"glass",title:l("getInTouch","Get in touch"),children:t(Ie,{customerEntity:V,inquiryEntity:q,contextId:v,contextName:g,contextDetails:K,messagePlaceholder:K,contextField:ie})})}),J.length>0&&t(T,{title:l("similarVehicles","Similar Vehicles"),children:t(P,{cols:[1,2,3,3],gap:"medium",children:J.map(e=>{const r=e[B],o=r?typeof r=="string"?r:Array.isArray(r)?r[0]?.thumbUrl||r[0]?.fullUrl||r[0]:null:null,b=e[p]||"",S=e[f]||"";return t(E,{clickable:!0,onClick:()=>le(`/${n.collection}/${e.id}`),elevated:!0,children:s(h,{direction:"column",gap:"medium",children:[o&&t("div",{style:{width:"100%",aspectRatio:"16/9",borderRadius:"var(--radius-md)",overflow:"hidden",backgroundColor:"var(--muted)"},children:t("img",{src:o,alt:`${b} ${S}`,style:{width:"100%",height:"100%",objectFit:"cover"}})}),s(h,{direction:"column",gap:"tight",children:[s(c,{level:"h4",style:{margin:0},children:[b," ",S]}),t(c,{variant:"muted",children:e[m]}),(()=>{const u=e[d],Q=n.fields[d];if(u==null||!Q)return null;const D=I(u,Q,a,{compact:!0});return typeof D=="string"?t(c,{style:{fontWeight:700,color:"var(--accent)"},children:D}):t("div",{style:{fontWeight:700,color:"var(--accent)"},children:D})})()]})]})},e.id)})})})]})}var ze=Y;export{Y as CarDetailTemplate,ze as default};
1
+ "use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useState as Y,useEffect as ft,useMemo as C,useCallback as gt}from"react";import{Share2 as pt,Heart as mt}from"lucide-react";import{Grid as P,Card as z,Stack as d,Text as s,Section as N,Button as D,ImageGallery as vt,Spinner as St}from"@donotdev/components";import{PageContainer as _,Link as bt,useRouteParam as yt,useNavigate as Ct}from"@donotdev/ui";import{useTranslation as B}from"@donotdev/core";import{useCrud as wt,useCrudCardList as xt,formatValue as k,useRelatedItems as It,useEntityFavorites as Ut}from"@donotdev/crud";import{InquiryFormTemplate as Dt}from"./InquiryFormTemplate";function $t({entity:i,id:Z,customerEntity:A,inquiryEntity:E,relatedFields:F=["make","price"],locale:tt,makeField:p="make",modelField:m="model",variantField:L="variant",yearField:f="year",mileageField:v="mileage",fuelTypeField:w="fuelType",transmissionField:x="transmission",priceField:u="price",imagesField:R="images",descriptionField:T,contextField:et="carId",pageNamespace:rt}){const nt=yt("id"),S=Z||nt||"",it=Ct(),ot=i.namespace||`entity-${i.name.toLowerCase()}`,{t:a,i18n:at}=B([ot,"crud"]),ct=rt||i.collection,{t:o}=B(ct),{t:kt}=B("crud"),V=tt||at?.language?.replace("_","-")||"en-US",{get:M}=wt(i),[r,lt]=Y(null),[W,I]=Y("pending"),{data:st}=xt(i,{staleTime:1e3*60*30}),{isFavorite:ut,toggleFavorite:ht}=Ut({collection:i.collection}),q=ut(S),U=C(()=>i.fields[u],[i.fields,u]),j=gt(t=>t==null?"\u2014":new Intl.NumberFormat(V).format(t)+" km",[V]),G=C(()=>{if(T)return T;const t=`description_${V}`;return i.fields[t]?t:i.fields.description?"description":null},[T,V,i.fields]),H=C(()=>{const t=r?.[R];return t?Array.isArray(t)?t.map(n=>typeof n=="object"&&n&&"fullUrl"in n?{fullUrl:n.fullUrl,thumbUrl:n.thumbUrl}:{fullUrl:n,thumbUrl:n}):[{fullUrl:t,thumbUrl:t}]:[]},[r,R]),g=C(()=>{if(!r)return"";const t=r[p]||"",n=r[m]||"",c=r[L]||"";return[t,n,c].filter(Boolean).join(" ")},[r,p,m,L]),O=C(()=>{if(!r)return[];const t=[],n=r[f];n!=null&&t.push({label:a(f),value:String(n)});const c=r[v];c!=null&&t.push({label:a(v),value:j(c)});const b=r[w];if(b&&i.fields[w]){const h=k(b,i.fields[w],a,{compact:!0});t.push({label:a(w),value:typeof h=="string"?h:String(b)})}const y=r[x];if(y&&i.fields[x]){const h=k(y,i.fields[x],a,{compact:!0});t.push({label:a(x),value:typeof h=="string"?h:String(y)})}return t},[r,f,v,w,x,i.fields,a,j]),{items:J}=It(i,r,st?.items||[],F,{limit:3,tolerance:.3}),K=C(()=>{if(!r)return g;const t=[];if(r[p]&&t.push(String(r[p])),r[m]&&t.push(String(r[m])),r[f]&&t.push(String(r[f])),r[v]&&t.push(j(r[v])),r[u]&&U){const n=r[u],c=k(n,U,a,{asString:!0});t.push(typeof c=="string"?c:String(r[u]))}return t.length>0?t.join(" \u2022 "):g},[r,p,m,f,v,u,U,j,a,g]);ft(()=>{if(!S){I("error");return}I("pending"),M(S).then(t=>{t?(lt(t),I("success")):I("error")}).catch(()=>{I("error")})},[S,M]);const dt=async()=>{try{navigator.share?await navigator.share({title:g,url:window.location.href}):await navigator.clipboard.writeText(window.location.href)}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},Q=G&&r?r[G]:null;return W==="pending"?e(_,{children:e(St,{overlay:!0})}):W==="error"||!r?e(_,{children:l(d,{direction:"column",gap:"large",style:{padding:"var(--gap-xl) 0",textAlign:"center"},children:[e(s,{level:"h2",children:o("notFound","Vehicle not found")}),e(bt,{path:"/",children:e(D,{variant:"primary",children:o("backToHome","Back to home")})})]})}):l(_,{children:[e(N,{children:l(P,{cols:[1,1,2,2],gap:"large",children:[e("div",{children:H.length>0?e(vt,{images:H,altPrefix:g}):e("div",{style:{width:"100%",aspectRatio:"16/9",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--muted)",borderRadius:"var(--radius-lg)"},children:e(s,{variant:"muted",children:o("noImages","No images")})})}),l(d,{direction:"column",gap:"large",children:[l(d,{direction:"column",gap:"tight",children:[e(d,{direction:"row",gap:"tight",align:"center",children:e(s,{level:"h1",style:{margin:0},children:g})}),e("div",{style:{fontSize:"var(--font-size-3xl)",fontWeight:700,color:"var(--accent)"},children:(()=>{const t=r[u];if(t==null||!U)return null;const n=k(t,U,a,{});return typeof n=="string"?e(s,{variant:"accent",weight:"bold",style:{fontSize:"var(--font-size-3xl)"},children:n}):n})()})]}),O.length>0&&e(z,{variant:"glass",children:e(P,{cols:2,children:O.map(({label:t,value:n})=>l(d,{direction:"column",gap:"tight",children:[e(s,{variant:"muted",style:{fontSize:"var(--font-size-sm)"},children:t}),e(s,{style:{fontWeight:500},children:n})]},t))})}),l(d,{direction:"row",children:[A&&E?e(D,{variant:"primary",style:{flex:1},onClick:()=>{const t=document.getElementById("inquiry-form");t&&t.scrollIntoView({behavior:"smooth",block:"start"})},children:o("contactUs","Contact us")}):e(D,{variant:"primary",style:{flex:1},disabled:!0,children:o("contactUs","Contact us")}),e(D,{variant:"outline",icon:e(pt,{size:18}),onClick:dt,children:o("share","Share")}),e(D,{variant:q?"primary":"outline",icon:e(mt,{size:18}),onClick:()=>ht(S),children:q?o("saved","Saved"):o("save","Save")})]})]})]})}),Q&&e(N,{title:o("description","Description"),children:e(z,{variant:"glass",children:e(s,{style:{whiteSpace:"pre-wrap",lineHeight:1.7},children:Q})})}),A&&E&&e(N,{id:"inquiry-form",title:o("interested","Interested?"),children:e(z,{variant:"glass",title:o("getInTouch","Get in touch"),children:e(Dt,{customerEntity:A,inquiryEntity:E,contextId:S,contextName:g,contextDetails:K,messagePlaceholder:K,contextField:et})})}),J.length>0&&e(N,{title:o("similarVehicles","Similar Vehicles"),children:e(P,{cols:[1,2,3,3],children:J.map(t=>{const n=t[R],c=n?typeof n=="string"?n:Array.isArray(n)?n[0]?.thumbUrl||n[0]?.fullUrl||n[0]:null:null,b=t[p]||"",y=t[m]||"";return e(z,{clickable:!0,onClick:()=>it(`/${i.collection}/${t.id}`),elevated:!0,children:l(d,{direction:"column",children:[c&&e("div",{style:{width:"100%",aspectRatio:"16/9",borderRadius:"var(--radius-md)",overflow:"hidden",backgroundColor:"var(--muted)"},children:e("img",{src:c,alt:`${b} ${y}`,style:{width:"100%",height:"100%",objectFit:"cover"}})}),l(d,{direction:"column",gap:"tight",children:[l(s,{level:"h4",style:{margin:0},children:[b," ",y]}),e(s,{variant:"muted",children:t[f]}),(()=>{const h=t[u],X=i.fields[u];if(h==null||!X)return null;const $=k(h,X,a,{compact:!0});return typeof $=="string"?e(s,{style:{fontWeight:700,color:"var(--accent)"},children:$}):e("div",{style:{fontWeight:700,color:"var(--accent)"},children:$})})()]})]})},t.id)})})})]})}export{$t as CarDetailTemplate};
@@ -1,6 +1,6 @@
1
1
  import type { ReactElement } from 'react';
2
2
  import type { Entity } from '@donotdev/core';
3
- interface InquiryAdminTemplateProps {
3
+ export interface InquiryAdminTemplateProps {
4
4
  /** Customer entity definition (linked via customerId) */
5
5
  customerEntity: Entity;
6
6
  /** Inquiry entity definition */
@@ -19,5 +19,4 @@ interface InquiryAdminTemplateProps {
19
19
  title?: string;
20
20
  }
21
21
  export declare function InquiryAdminTemplate({ customerEntity, inquiryEntity, customerBasePath, collapsible, defaultOpen, open, onOpenChange, title, }: InquiryAdminTemplateProps): ReactElement;
22
- export {};
23
22
  //# sourceMappingURL=InquiryAdminTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InquiryAdminTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/InquiryAdminTemplate.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAe1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI7C,UAAU,yBAAyB;IACjC,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yCAAyC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0DAA0D;IAC1D,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,cAAc,EACd,aAAa,EACb,gBAA+B,EAC/B,WAAmB,EACnB,WAAmB,EACnB,IAAI,EACJ,YAAY,EACZ,KAAK,GACN,EAAE,yBAAyB,GAAG,YAAY,CAsO1C"}
1
+ {"version":3,"file":"InquiryAdminTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/InquiryAdminTemplate.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAe1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAS7C,MAAM,WAAW,yBAAyB;IACxC,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yCAAyC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0DAA0D;IAC1D,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,cAAc,EACd,aAAa,EACb,gBAA+B,EAC/B,WAAmB,EACnB,WAAmB,EACnB,IAAI,EACJ,YAAY,EACZ,KAAK,GACN,EAAE,yBAAyB,GAAG,YAAY,CAmS1C"}
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as o,Fragment as Y}from"react/jsx-runtime";import{useMemo as D,useCallback as H}from"react";import{Mail as J,Phone as K,User as Q,CheckCircle2 as P,Clock as X}from"lucide-react";import{Button as k,Card as V,Section as M,Stack as i,Text as c,Badge as Z,Grid as q,Spinner as ee}from"@donotdev/components";import{useTranslation as S,formatDate as te}from"@donotdev/core";import{Link as b}from"@donotdev/ui";import{useCrud as ae,useCrudList as L,translateLabel as ne}from"@donotdev/crud";function me({customerEntity:R,inquiryEntity:m,customerBasePath:T="/customers",collapsible:z=!1,defaultOpen:B=!1,open:W,onOpenChange:_,title:y}){const{t:f}=S(`entity-${m.name.toLowerCase()}`),{t:r}=S("crud"),F=y||f("name"),{items:p,loading:O,refresh:se}=L(m,{backend:"functions"}),{items:N}=L(R,{backend:"functions"}),U=D(()=>{const e=new Map;return N?.forEach(n=>{n.id&&e.set(n.id,n)}),e},[N]),{update:I}=ae(m,{backend:"functions"}),E=H(async e=>{await I(e,{status:"available"})},[I]),w=D(()=>p?[...p].filter(e=>(typeof e.status=="string"?e.status:"draft")==="draft").sort((e,n)=>{const a=(typeof e.createdAt=="string"?e.createdAt:typeof e.date=="string"?e.date:"")||"";return((typeof n.createdAt=="string"?n.createdAt:typeof n.date=="string"?n.date:"")||"").localeCompare(a)}):[],[p]);if(O)return t(M,{title:f("name"),children:t(ee,{})});const $=t(Y,{children:w.length===0?t(c,{variant:"muted",children:r("noInquiries",{defaultValue:"No inquiries found."})}):t(q,{cols:[1,1,2,2],gap:"medium",children:w.map(e=>{const n=typeof e.customerId=="string"?e.customerId:void 0,a=n?U.get(n):void 0,h=typeof e.status=="string"?e.status:"draft",g=h==="available",d=typeof a?.email=="string"?a.email:void 0,u=typeof a?.phone=="string"?a.phone:void 0,G=a&&(a.firstName||a.lastName)?[a.firstName,a.lastName].filter(Boolean).join(" "):void 0,j=typeof e.message=="string"&&e.message?e.message.length>150?`${e.message.substring(0,150)}...`:e.message:"",x=typeof e.date=="string"?e.date:typeof e.createdAt=="string"?e.createdAt:void 0,A=o(i,{gap:"medium",children:[o(i,{direction:"row",gap:"tight",align:"center",justify:"between",children:[t(Z,{variant:g?"secondary":"outline",children:o(i,{direction:"row",gap:"tight",align:"center",children:[g?t(P,{size:12}):t(X,{size:12}),ne(`status.${h}`,f)]})}),x&&t(c,{variant:"muted",level:"small",children:te(x)})]}),a?o(i,{gap:"tight",children:[o(i,{direction:"row",gap:"tight",align:"center",children:[t(Q,{size:14}),t(c,{weight:"medium",level:"small",children:G||r("customer",{defaultValue:"Customer"})})]}),d&&t(c,{level:"small",variant:"muted",children:d}),u&&t(c,{level:"small",variant:"muted",children:u})]}):t(c,{variant:"muted",level:"small",children:r("noCustomer",{defaultValue:"No customer linked"})}),j&&t(c,{level:"small",children:j}),o(i,{gap:"tight",children:[(d||u)&&o(i,{direction:"row",gap:"tight",children:[d&&t(k,{variant:"outline",icon:J,fullWidth:!0,className:"dndev-flex-1",render:({children:s,className:l,...v})=>t(b,{path:`mailto:${d}${typeof e.carId=="string"&&e.carId?`?subject=${encodeURIComponent(r("actions.replySubject",{defaultValue:"Re: Your inquiry"}))}`:""}`,className:l,onClick:C=>C.stopPropagation(),...v,children:s}),children:r("actions.email",{defaultValue:"Email"})}),u&&t(k,{variant:"outline",icon:K,fullWidth:!0,className:"dndev-flex-1",render:({children:s,className:l,...v})=>t(b,{path:`tel:${u}`,className:l,onClick:C=>C.stopPropagation(),...v,children:s}),children:r("actions.call",{defaultValue:"Call"})})]}),!g&&t(k,{variant:"outline",icon:P,fullWidth:!0,onClick:s=>{s.preventDefault(),s.stopPropagation(),E(e.id)},children:r("actions.markResponded",{defaultValue:"Mark responded"})})]})]});return a?.id?t(b,{path:`${T}/${a.id}`,className:"dndev-block dndev-h-full",onClick:s=>{const l=s.target;(l.closest("button")||l.closest('a[href^="mailto:"]')||l.closest('a[href^="tel:"]'))&&(s.preventDefault(),s.stopPropagation())},children:t(V,{clickable:!0,children:A})},e.id):t(V,{children:A},e.id)})})});return z?t(M,{title:F,collapsible:!0,defaultOpen:B,open:W,onOpenChange:_,children:$}):$}export{me as InquiryAdminTemplate};
1
+ "use client";import{jsx as t,jsxs as o,Fragment as Y}from"react/jsx-runtime";import{useMemo as D,useCallback as H}from"react";import{Mail as J,Phone as K,User as Q,CheckCircle2 as P,Clock as X}from"lucide-react";import{Button as k,Card as V,Section as M,Stack as i,Text as d,Badge as Z,Grid as q,Spinner as ee}from"@donotdev/components";import{useTranslation as S,formatDate as te}from"@donotdev/core";import{Link as N}from"@donotdev/ui";import{useCrud as ae,useCrudList as L,translateLabel as ne}from"@donotdev/crud";function ue({customerEntity:R,inquiryEntity:m,customerBasePath:T="/customers",collapsible:z=!1,defaultOpen:B=!1,open:W,onOpenChange:_,title:y}){const{t:f}=S(`entity-${m.name.toLowerCase()}`),{t:r}=S("crud"),F=y||f("name"),{items:p,loading:O}=L(m),{items:b}=L(R),U=D(()=>{const e=new Map;return b?.forEach(n=>{n.id&&e.set(n.id,n)}),e},[b]),{update:I}=ae(m),E=H(async e=>{await I(e,{status:"responded"})},[I]),w=D(()=>p?[...p].filter(e=>(typeof e.status=="string"?e.status:"draft")==="draft").sort((e,n)=>{const a=(typeof e.createdAt=="string"?e.createdAt:typeof e.date=="string"?e.date:"")||"";return((typeof n.createdAt=="string"?n.createdAt:typeof n.date=="string"?n.date:"")||"").localeCompare(a)}):[],[p]);if(O)return t(M,{title:f("name"),children:t(ee,{})});const $=t(Y,{children:w.length===0?t(d,{variant:"muted",children:r("noInquiries",{defaultValue:"No inquiries found."})}):t(q,{cols:[1,1,2,2],children:w.map(e=>{const n=typeof e.customerId=="string"?e.customerId:void 0,a=n?U.get(n):void 0,h=typeof e.status=="string"?e.status:"draft",g=h==="available",c=typeof a?.email=="string"?a.email:void 0,u=typeof a?.phone=="string"?a.phone:void 0,G=a&&(a.firstName||a.lastName)?[a.firstName,a.lastName].filter(Boolean).join(" "):void 0,j=typeof e.message=="string"&&e.message?e.message.length>150?`${e.message.substring(0,150)}...`:e.message:"",x=typeof e.date=="string"?e.date:typeof e.createdAt=="string"?e.createdAt:void 0,A=o(i,{children:[o(i,{direction:"row",gap:"tight",align:"center",justify:"between",children:[t(Z,{variant:g?"secondary":"outline",children:o(i,{direction:"row",gap:"tight",align:"center",children:[g?t(P,{size:12}):t(X,{size:12}),ne(`status.${h}`,f)]})}),x&&t(d,{variant:"muted",level:"small",children:te(x)})]}),a?o(i,{gap:"tight",children:[o(i,{direction:"row",gap:"tight",align:"center",children:[t(Q,{size:14}),t(d,{weight:"medium",level:"small",children:G||r("customer",{defaultValue:"Customer"})})]}),c&&t(d,{level:"small",variant:"muted",children:c}),u&&t(d,{level:"small",variant:"muted",children:u})]}):t(d,{variant:"muted",level:"small",children:r("noCustomer",{defaultValue:"No customer linked"})}),j&&t(d,{level:"small",children:j}),o(i,{gap:"tight",children:[(c||u)&&o(i,{direction:"row",gap:"tight",children:[c&&t(k,{variant:"outline",icon:J,fullWidth:!0,className:"dndev-flex-1",render:({children:s,className:l,...v})=>t(N,{path:`mailto:${c}${typeof e.carId=="string"&&e.carId?`?subject=${encodeURIComponent(r("actions.replySubject",{defaultValue:"Re: Your inquiry"}))}`:""}`,className:l,onClick:C=>C.stopPropagation(),...v,children:s}),children:r("actions.email",{defaultValue:"Email"})}),u&&t(k,{variant:"outline",icon:K,fullWidth:!0,className:"dndev-flex-1",render:({children:s,className:l,...v})=>t(N,{path:`tel:${u}`,className:l,onClick:C=>C.stopPropagation(),...v,children:s}),children:r("actions.call",{defaultValue:"Call"})})]}),!g&&t(k,{variant:"outline",icon:P,fullWidth:!0,onClick:s=>{s.preventDefault(),s.stopPropagation(),E(e.id)},children:r("actions.markResponded",{defaultValue:"Mark responded"})})]})]});return a?.id?t(N,{path:`${T}/${a.id}`,className:"dndev-block dndev-h-full",onClick:s=>{const l=s.target;(l.closest("button")||l.closest('a[href^="mailto:"]')||l.closest('a[href^="tel:"]'))&&(s.preventDefault(),s.stopPropagation())},children:t(V,{clickable:!0,children:A})},e.id):t(V,{children:A},e.id)})})});return z?t(M,{title:F,collapsible:!0,defaultOpen:B,open:W,onOpenChange:_,children:$}):$}export{ue as InquiryAdminTemplate};
@@ -43,5 +43,4 @@ export interface InquiryFormTemplateProps {
43
43
  * ```
44
44
  */
45
45
  export declare function InquiryFormTemplate({ customerEntity, inquiryEntity, contextId, contextName, contextDetails, messagePlaceholder, contextField, customerFields, messageField, consentField, onSuccess, onError, }: InquiryFormTemplateProps): ReactElement;
46
- export default InquiryFormTemplate;
47
46
  //# sourceMappingURL=InquiryFormTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InquiryFormTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/InquiryFormTemplate.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,OAAO,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wFAAwF;IACxF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,cAAc,EACd,aAAa,EACb,SAAS,EACT,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,YAAsB,EACtB,cAA4D,EAC5D,YAAwB,EACxB,YAA4B,EAC5B,SAAS,EACT,OAAO,GACR,EAAE,wBAAwB,GAAG,YAAY,CAoPzC;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"InquiryFormTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/InquiryFormTemplate.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,OAAO,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wFAAwF;IACxF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,cAAc,EACd,aAAa,EACb,SAAS,EACT,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,YAAsB,EACtB,cAA4D,EAC5D,YAAwB,EACxB,YAA4B,EAC5B,SAAS,EACT,OAAO,GACR,EAAE,wBAAwB,GAAG,YAAY,CAiPzC"}
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as y,Fragment as G}from"react/jsx-runtime";import{useState as E}from"react";import{Stack as N,Button as R,Card as W,Alert as H,Text as D}from"@donotdev/components";import{useCrud as T,useEntityForm as $,FormFieldRenderer as l}from"@donotdev/crud";import{useTranslation as C}from"@donotdev/core";function V({customerEntity:s,inquiryEntity:m,contextId:b,contextName:S,contextDetails:v,messagePlaceholder:j,contextField:w="carId",customerFields:u=["firstName","lastName","email","phone"],messageField:c="message",consentField:f="gdprConsent",onSuccess:L,onError:O}){const{add:P}=T(s,{backend:"functions"}),{add:z}=T(m,{backend:"functions"}),d=C(`entity-${s.name.toLowerCase()}`),a=C(`entity-${m.name.toLowerCase()}`),I=v?a.t("message.placeholder.withDetails",`Inquiry about: ${v}`,{details:v}):S?a.t("message.placeholder.context",`Inquiry about: ${S}`,{name:S}):"",g=$(m,{operation:"create",defaultValues:{[w]:b||void 0,date:new Date().toISOString(),status:"draft",[c]:I}}),p=m.fields[c],F=j||p?.options?.placeholder,r=$(s,{operation:"create",defaultValues:{type:"Prospect",status:"draft",[f]:!1}}),[h,x]=E("idle"),[k,q]=E(""),A=async o=>{x("loading"),q("");try{const n=await P(o),e=g.getValues(c),i=(typeof e=="string"?e.trim():"")||I||a.t("message.default","General inquiry"),B={customerId:n,[w]:b||void 0,[c]:i,date:new Date().toISOString(),status:"draft"};await z(B),x("success"),r.reset(),g.reset(),L?.()}catch(n){x("error");const e=n instanceof Error?n:new Error(String(n));q(e.message),O?.(e)}};return h==="success"?t(W,{variant:"glass",children:y(N,{direction:"column",gap:"medium",style:{textAlign:"center",padding:"var(--gap-lg)"},children:[t("div",{style:{fontSize:"2rem",color:"var(--success)"},children:"\u2713"}),t(D,{level:"h3",children:a.t("success.title","Thank you for your inquiry!")}),t(D,{variant:"muted",children:a.t("success.message","We'll get back to you as soon as possible.")})]})}):t("form",{onSubmit:o=>{o.preventDefault(),r.handleSubmit(A)(o)},children:y(N,{direction:"column",gap:"medium",children:[h==="error"&&k&&t(H,{variant:"error",description:k}),(()=>{const o=s.fields.firstName,n=s.fields.lastName;return u.includes("firstName")&&u.includes("lastName")&&o&&n?y(G,{children:[y(N,{direction:"row",gap:"medium",children:[t("div",{style:{flex:1},children:t(l,{name:"firstName",config:o,control:r.control,errors:r.formState.errors,t:d.t})}),t("div",{style:{flex:1},children:t(l,{name:"lastName",config:n,control:r.control,errors:r.formState.errors,t:d.t})})]}),u.filter(e=>e!=="firstName"&&e!=="lastName").map(e=>{const i=s.fields[e];return i?t(l,{name:e,config:i,control:r.control,errors:r.formState.errors,t:d.t},e):null})]}):u.map(e=>{const i=s.fields[e];return i?t(l,{name:e,config:i,control:r.control,errors:r.formState.errors,t:d.t},e):null})})(),p&&t(l,{name:c,config:{...p,options:{...p.options,...F&&{placeholder:F}}},control:g.control,errors:g.formState.errors,t:a.t}),s.fields[f]&&t(l,{name:f,config:s.fields[f],control:r.control,errors:r.formState.errors,t:d.t}),t(R,{type:"submit",variant:"primary",disabled:h==="loading"||r.formState.isSubmitting,style:{width:"100%"},children:h==="loading"?a.t("submit.sending","Sending..."):a.t("submit","Send Inquiry")})]})})}var J=V;export{V as InquiryFormTemplate,J as default};
1
+ "use client";import{jsx as e,jsxs as S,Fragment as G}from"react/jsx-runtime";import{useState as j}from"react";import{Stack as w,Button as R,Card as W,Alert as H,Text as x}from"@donotdev/components";import{useCrud as V,useEntityForm as $,FormFieldRenderer as l}from"@donotdev/crud";import{useTranslation as k}from"@donotdev/core";function Y({customerEntity:o,inquiryEntity:u,contextId:q,contextName:y,contextDetails:b,messagePlaceholder:D,contextField:C="carId",customerFields:f=["firstName","lastName","email","phone"],messageField:c="message",consentField:m="gdprConsent",onSuccess:_,onError:A}){const{add:L}=V(o),{add:O}=V(u),{t:d}=k(`entity-${o.name.toLowerCase()}`),{t:s}=k(`entity-${u.name.toLowerCase()}`),I=b?s("message.placeholder.withDetails",`Inquiry about: ${b}`,{details:b}):y?s("message.placeholder.context",`Inquiry about: ${y}`,{name:y}):"",g=$(u,{operation:"create",defaultValues:{[C]:q||void 0,date:new Date().toISOString(),status:"draft",[c]:I}}),p=u.fields[c],M=D||p?.options?.placeholder,t=$(o,{operation:"create",defaultValues:{type:"Prospect",status:"draft",[m]:!1}}),[h,v]=j("idle"),[N,T]=j(""),P=async a=>{v("loading"),T("");try{const n=await L(a),r=g.getValues(c),z=(typeof r=="string"?r.trim():"")||I||s("message.default","General inquiry"),B={customerId:n,[C]:q||void 0,[c]:z,date:new Date().toISOString(),status:"draft"};await O(B),v("success"),t.reset(),g.reset(),_?.()}catch(n){v("error");const r=n instanceof Error?n:new Error(String(n));T(r.message),A?.(r)}};return h==="success"?e(W,{variant:"glass",children:S(w,{direction:"column",style:{textAlign:"center",padding:"var(--gap-lg)"},children:[e("div",{style:{fontSize:"2rem",color:"var(--success)"},children:"\u2713"}),e(x,{level:"h3",children:s("success.title","Thank you for your inquiry!")}),e(x,{variant:"muted",children:s("success.message","We'll get back to you as soon as possible.")})]})}):e("form",{onSubmit:a=>{a.preventDefault(),t.handleSubmit(P)(a)},children:S(w,{direction:"column",children:[h==="error"&&N&&e(H,{variant:"error",description:N}),(()=>{const a=o.fields.firstName,n=o.fields.lastName;return f.includes("firstName")&&f.includes("lastName")&&a&&n?S(G,{children:[S(w,{direction:"row",children:[e("div",{style:{flex:1},children:e(l,{name:"firstName",config:a,control:t.control,errors:t.formState.errors,t:d})}),e("div",{style:{flex:1},children:e(l,{name:"lastName",config:n,control:t.control,errors:t.formState.errors,t:d})})]}),f.filter(r=>r!=="firstName"&&r!=="lastName").map(r=>{const i=o.fields[r];return i?e(l,{name:r,config:i,control:t.control,errors:t.formState.errors,t:d},r):null})]}):f.map(r=>{const i=o.fields[r];return i?e(l,{name:r,config:i,control:t.control,errors:t.formState.errors,t:d},r):null})})(),p&&e(l,{name:c,config:{...p,options:{...p.options,...M&&{placeholder:M}}},control:g.control,errors:g.formState.errors,t:s}),o.fields[m]&&e(l,{name:m,config:o.fields[m],control:t.control,errors:t.formState.errors,t:d}),e(R,{type:"submit",variant:"primary",disabled:h==="loading"||t.formState.isSubmitting,style:{width:"100%"},children:h==="loading"?s("submit.sending","Sending..."):s("submit","Send Inquiry")})]})})}export{Y as InquiryFormTemplate};
@@ -38,5 +38,4 @@ export interface ProductCardListTemplateProps extends Omit<EntityCardListProps,
38
38
  * @returns React component
39
39
  */
40
40
  export declare function ProductCardListTemplate({ entity, title, description, basePath, onClick, cols, staleTime, filter, hideFilters, titleFields, subtitleField, priceField, specsFields, badgeField, locale, imageAspectRatio, hideSection, }: ProductCardListTemplateProps): import("react/jsx-runtime").JSX.Element;
41
- export default ProductCardListTemplate;
42
41
  //# sourceMappingURL=ProductCardListTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductCardListTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/ProductCardListTemplate.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAY1D,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CACxD,mBAAmB,EACnB,MAAM,CACP;IACC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sGAAsG;IACtG,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAiCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,IAAmB,EACnB,SAA0B,EAC1B,MAAM,EACN,WAAmB,EACnB,WAAW,EACX,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,gBAAwB,EACxB,WAAmB,GACpB,EAAE,4BAA4B,2CA0e9B;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"ProductCardListTemplate.d.ts","sourceRoot":"","sources":["../../src/crud/ProductCardListTemplate.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAa1D,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CACxD,mBAAmB,EACnB,MAAM,CACP;IACC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sGAAsG;IACtG,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAiCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,IAAmB,EACnB,SAA0B,EAC1B,MAAM,EACN,WAAmB,EACnB,WAAW,EACX,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,gBAAwB,EACxB,WAAmB,GACpB,EAAE,4BAA4B,2CAgc9B"}
@@ -1,40 +1 @@
1
- "use client";import{jsx as i,jsxs as n,Fragment as ge}from"react/jsx-runtime";import{useMemo as d,useCallback as H,useState as U}from"react";import{Heart as W}from"lucide-react";import{Grid as ve,Card as he,Stack as b,Text as F,Section as Y,Badge as ye,Button as be}from"@donotdev/components";import{useTranslation as Fe}from"@donotdev/core";import{useNavigate as xe}from"@donotdev/ui";import{translateFieldLabel as q,useCrudCardList as we,EntityFilters as ke,matchesFilter as Ce,useEntityFavorites as Se,formatValue as D}from"@donotdev/crud";const ze={available:"success",active:"success",in_stock:"success",new:"success",pending:"warning",reserved:"warning",low_stock:"warning",sold:"destructive",unavailable:"destructive",out_of_stock:"destructive",inactive:"secondary",draft:"outline"};function Ve(e){const x=String(e).toLowerCase().replace(/[\s-]/g,"_");return ze[x]||"secondary"}function J({entity:e,title:x,description:K,basePath:Q,onClick:w,cols:X=[1,2,3,4],staleTime:Z=1e3*60*30,filter:k,hideFilters:ee=!1,titleFields:p,subtitleField:L,priceField:N,specsFields:m,badgeField:C,locale:te,imageAspectRatio:re="4/3",hideSection:ie=!1}){const $=xe(),B=Q??`/${e.collection}`,{t:a,i18n:ae}=Fe([e.namespace,"crud"]),Te=te||ae?.language?.replace("_","-")||"en-US",o=d(()=>N||(Object.keys(e.fields).find(t=>e.fields[t]?.type==="price")??void 0),[N,e.fields]),c=d(()=>{if(C)return C;const t=["status","state","condition","availability"];return Object.keys(e.fields).find(r=>t.includes(r.toLowerCase())&&(e.fields[r]?.type==="select"||e.fields[r]?.type==="text"))},[C,e.fields]),le=d(()=>{if(p&&p.length>0)return p;const t=Object.keys(e.fields).find(r=>e.fields[r]?.type==="text");return t?[t]:[]},[p,e.fields]),A=d(()=>m&&m.length>0?m:Object.keys(e.fields).filter(t=>{if(t===o||t===c)return!1;const r=e.fields[t]?.type;return r==="number"||r==="select"}).slice(0,3),[m,e.fields,o,c]),{data:se,loading:ne}=we(e,{staleTime:Z}),S=se?.items||[],{isFavorite:oe,toggleFavorite:de,favoritesFilter:E}=Se({collection:e.collection}),[u,ce]=U(!1),[g,ue]=U({}),I=H(t=>Object.keys(g).length===0?!0:Object.entries(g).every(([r,s])=>{const h=t[r],y=e.fields[r]?.type||"text";return Ce(h,s,y)}),[g,e.fields]),f=d(()=>{let t=S;return t=t.filter(I),u&&(t=t.filter(E)),k&&(t=t.filter(k)),t},[S,I,u,E,k]),R=d(()=>(e.listCardFields??e.listFields??[]).find(r=>{const s=e.fields[r];return s?.type==="image"||s?.type==="images"})||Object.keys(e.fields).find(r=>{const s=e.fields[r];return s?.type==="image"||s?.type==="images"}),[e.listCardFields,e.listFields,e.fields]),fe=H(t=>{w?w(t):$(`${B}/${t}`)},[B,$,w]),z=x||a("name",{defaultValue:e.name}),v=K||a("description",{defaultValue:""}),_=a("name",{defaultValue:e.name});return n(ge,{children:[i("style",{children:`
2
- .product-card {
3
- transition: transform 0.2s ease, box-shadow 0.2s ease;
4
- }
5
- .product-card:hover {
6
- transform: translateY(-4px);
7
- box-shadow: var(--shadow-lg);
8
- }
9
- .product-card-image {
10
- overflow: hidden;
11
- border-radius: var(--radius-md);
12
- background: var(--muted);
13
- }
14
- .product-card-image img {
15
- transition: transform 0.3s ease;
16
- }
17
- .product-card:hover .product-card-image img {
18
- transform: scale(1.05);
19
- }
20
- .product-price {
21
- font-size: var(--font-size-2xl);
22
- font-weight: 700;
23
- color: var(--primary);
24
- }
25
- .product-specs {
26
- display: flex;
27
- flex-wrap: wrap;
28
- gap: var(--gap-xs);
29
- }
30
- .product-spec-pill {
31
- display: inline-flex;
32
- align-items: center;
33
- gap: var(--gap-xs);
34
- padding: var(--gap-xs) var(--gap-sm);
35
- background: var(--muted);
36
- border-radius: var(--radius-full);
37
- font-size: var(--font-size-sm);
38
- color: var(--muted-foreground);
39
- }
40
- `}),(z||v)&&n("header",{style:{marginBottom:"var(--gap-lg)"},children:[z&&i("h1",{style:{fontSize:"var(--font-size-3xl)",fontWeight:700,margin:0,marginBottom:v?"var(--gap-sm)":0},children:z}),v&&i("p",{style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)",margin:0},children:v})]}),!ee&&i(Y,{title:a("crud:filters.title",{entity:_,defaultValue:`Browse ${_} - Filters`}),collapsible:!0,defaultOpen:!0,children:n(b,{direction:"column",gap:"medium",children:[i(be,{variant:u?"primary":"outline",icon:i(W,{size:18}),onClick:()=>ce(!u),children:u?a("crud:favorites.showAll",{defaultValue:"Show All"}):a("crud:favorites.showFavorites",{defaultValue:"Show Favorites"})}),i(ke,{entity:e,data:S,filters:g,onFiltersChange:ue,fieldsToFilter:e.listCardFields})]})}),(()=>{const t=f.length===0?n(b,{align:"center",justify:"center",gap:"medium",style:{padding:"var(--gap-3xl)",textAlign:"center"},children:[i(F,{level:"h3",style:{color:"var(--muted-foreground)"},children:a("crud:emptyState.title",{defaultValue:`No ${e.name.toLowerCase()} found`})}),i(F,{style:{color:"var(--muted-foreground)"},children:a("crud:emptyState.description",{defaultValue:`No ${e.name.toLowerCase()} available at this time.`})})]}):i(ve,{cols:X,gap:"medium",children:f.map(r=>{const s=R?r[R]:null,h=typeof s=="string"&&s.length>0?s:null,y=le.map(l=>r[l]).filter(Boolean).join(" ")||r.id,M=L?r[L]:null,P=o?r[o]:null,G=o?e.fields[o]:null,V=c?r[c]:null,j=oe(r.id);return n(he,{clickable:!0,onClick:()=>fe(r.id),elevated:!0,className:"product-card",children:[i("div",{onClick:l=>{l.stopPropagation(),de(r.id)},style:{position:"absolute",top:"var(--gap-sm)",left:"var(--gap-sm)",zIndex:10,cursor:"pointer",padding:"var(--gap-xs)",borderRadius:"var(--radius-full)",backgroundColor:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="rgba(255, 255, 255, 1)"},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.9)"},"aria-label":j?a("crud:favorites.remove",{defaultValue:"Remove from favorites"}):a("crud:favorites.add",{defaultValue:"Add to favorites"}),children:i(W,{size:20,fill:j?"#ef4444":"#ffffff",stroke:j?"#ef4444":"#ffffff",style:{transition:"fill 0.2s, stroke 0.2s"}})}),n(b,{direction:"column",gap:"medium",children:[h&&n("div",{className:"product-card-image",style:{position:"relative",width:"100%",aspectRatio:re},children:[i("img",{src:h,alt:y,style:{width:"100%",height:"100%",objectFit:"cover"}}),V&&i("div",{style:{position:"absolute",top:"var(--gap-sm)",insetInlineEnd:"var(--gap-sm)"},children:i(ye,{variant:Ve(V),children:q(String(V),e.fields[c],a)})})]}),n(b,{direction:"column",gap:"tight",children:[n("div",{children:[i(F,{level:"h4",style:{margin:0},children:y}),M&&i(F,{level:"small",variant:"muted",style:{marginTop:"var(--gap-xs)"},children:M})]}),P!=null&&G&&i("div",{className:"product-price",children:D(P,G,a,{compact:!0})}),A.length>0&&i("div",{className:"product-specs",children:A.map(l=>{const T=r[l];if(T==null)return null;const O=e.fields[l],pe=q(l,O,a),me=O?D(T,O,a,{compact:!0}):T;return n("span",{className:"product-spec-pill",children:[pe,": ",me]},l)})})]})]})]},r.id)})});return ie?t:i(Y,{title:ne?a("crud:results.title.fetching",{defaultValue:"Fetching..."}):a("crud:results.title.count",{count:f.length,defaultValue:f.length===1?"Found 1 item":`Found ${f.length} items`}),collapsible:!0,defaultOpen:!0,children:t})})()]})}var je=J;export{J as ProductCardListTemplate,je as default};
1
+ "use client";import{jsx as l,jsxs as i,Fragment as me}from"react/jsx-runtime";import{useMemo as d,useCallback as U}from"react";import{Heart as H}from"lucide-react";import p from"./ProductCardListTemplate.module.css";import{Grid as ve,Card as he,Stack as F,Text as y,Section as W,Badge as be,Button as Ce}from"@donotdev/components";import{useTranslation as Fe,getListCardFieldNames as q}from"@donotdev/core";import{useNavigate as ye}from"@donotdev/ui";import{translateFieldLabel as J,useCrudCardList as Ve,EntityFilters as ke,matchesFilter as we,useEntityFavorites as Se,formatValue as K,useCrudFilters as xe}from"@donotdev/crud";const je={available:"success",active:"success",in_stock:"success",new:"success",pending:"warning",reserved:"warning",low_stock:"warning",sold:"destructive",unavailable:"destructive",out_of_stock:"destructive",inactive:"secondary",draft:"outline"};function Te(e){const V=String(e).toLowerCase().replace(/[\s-]/g,"_");return je[V]||"secondary"}function $e({entity:e,title:V,description:Q,basePath:X,onClick:k,cols:Y=[1,2,3,4],staleTime:Z=1e3*60*30,filter:w,hideFilters:ee=!1,titleFields:m,subtitleField:z,priceField:S,specsFields:v,badgeField:x,locale:te,imageAspectRatio:re="4/3",hideSection:le=!1}){const I=ye(),N=X??`/${e.collection}`,{t:s,i18n:se}=Fe([e.namespace,"crud"]),Le=te||se?.language?.replace("_","-")||"en-US",c=d(()=>S||(Object.keys(e.fields).find(t=>e.fields[t]?.type==="price")??void 0),[S,e.fields]),u=d(()=>{if(x)return x;const t=["status","state","condition","availability"];return Object.keys(e.fields).find(r=>t.includes(r.toLowerCase())&&(e.fields[r]?.type==="select"||e.fields[r]?.type==="text"))},[x,e.fields]),ae=d(()=>{if(m&&m.length>0)return m;const t=Object.keys(e.fields).find(r=>e.fields[r]?.type==="text");return t?[t]:[]},[m,e.fields]),A=d(()=>v&&v.length>0?v:Object.keys(e.fields).filter(t=>{if(t===c||t===u)return!1;const r=e.fields[t]?.type;return r==="number"||r==="select"}).slice(0,3),[v,e.fields,c,u]),{data:oe,loading:ie}=Ve(e,{staleTime:Z}),j=oe?.items||[],{isFavorite:ne,toggleFavorite:ce,favoritesFilter:P}=Se({collection:e.collection}),{showFavoritesOnly:f,setShowFavoritesOnly:de,filters:T}=xe({collection:e.collection}),$=U(t=>Object.keys(T).length===0?!0:Object.entries(T).every(([r,n])=>{const o=t[r],b=e.fields[r]?.type||"text";return we(o,n,b)}),[T,e.fields]),g=d(()=>{let t=j;return t=t.filter($),f&&(t=t.filter(P)),w&&(t=t.filter(w)),t},[j,$,f,P,w]),D=d(()=>{const r=q(e).find(n=>{const o=e.fields[n];return o?.type==="image"||o?.type==="images"});return r||Object.keys(e.fields).find(n=>{const o=e.fields[n];return o?.type==="image"||o?.type==="images"})},[e.listCardFields,e.listFields,e.fields]),ue=U(t=>{k?k(t):I(`${N}/${t}`)},[N,I,k]),L=V||s("name",{defaultValue:e.name}),h=Q||s("description",{defaultValue:""}),E=s("name",{defaultValue:e.name});return i(me,{children:[(L||h)&&i("header",{style:{marginBottom:"var(--gap-lg)"},children:[L&&l("h1",{style:{fontSize:"var(--font-size-3xl)",fontWeight:700,margin:0,marginBottom:h?"var(--gap-sm)":0},children:L}),h&&l("p",{style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)",margin:0},children:h})]}),!ee&&l(W,{title:s("crud:filters.title",{entity:E,defaultValue:`Browse ${E} - Filters`}),collapsible:!0,defaultOpen:!0,children:i(F,{direction:"column",children:[l(Ce,{variant:f?"primary":"outline",icon:l(H,{size:18}),onClick:()=>de(!f),children:f?s("crud:favorites.showAll",{defaultValue:"Show All"}):s("crud:favorites.showFavorites",{defaultValue:"Show Favorites"})}),l(ke,{entity:e,data:j,fieldsToFilter:q(e)})]})}),(()=>{const t=g.length===0?i(F,{align:"center",justify:"center",style:{padding:"var(--gap-3xl)",textAlign:"center"},children:[l(y,{level:"h3",style:{color:"var(--muted-foreground)"},children:s("crud:emptyState.title",{defaultValue:`No ${e.name.toLowerCase()} found`})}),l(y,{style:{color:"var(--muted-foreground)"},children:s("crud:emptyState.description",{defaultValue:`No ${e.name.toLowerCase()} available at this time.`})})]}):l(ve,{cols:Y,children:g.map(r=>{const n=D?r[D]:null,o=typeof n=="string"&&n.length>0?n:null,b=ae.map(a=>r[a]).filter(Boolean).join(" ")||String(r.id??""),R=z?r[z]:null,M=c?r[c]:null,G=c?e.fields[c]:null,O=u?r[u]:null,_=ne(r.id);return i(he,{clickable:!0,onClick:()=>ue(r.id),elevated:!0,className:p.productCard,children:[l("button",{type:"button",onClick:a=>{a.stopPropagation(),ce(r.id)},style:{position:"absolute",top:"var(--gap-sm)",insetInlineStart:"var(--gap-sm)",zIndex:10,cursor:"pointer",padding:"var(--gap-xs)",borderRadius:"var(--radius-full)",backgroundColor:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",border:"none"},onMouseEnter:a=>{a.currentTarget.style.backgroundColor="rgba(255, 255, 255, 1)"},onMouseLeave:a=>{a.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.9)"},"aria-label":_?s("crud:favorites.remove",{defaultValue:"Remove from favorites"}):s("crud:favorites.add",{defaultValue:"Add to favorites"}),children:l(H,{size:20,fill:_?"#ef4444":"#ffffff",stroke:_?"#ef4444":"#ffffff",style:{transition:"fill 0.2s, stroke 0.2s"}})}),i(F,{direction:"column",children:[o&&i("div",{className:p.productCardImage,style:{position:"relative",width:"100%",aspectRatio:re},children:[l("img",{src:o,alt:b,style:{width:"100%",height:"100%",objectFit:"cover"}}),O&&l("div",{style:{position:"absolute",top:"var(--gap-sm)",insetInlineEnd:"var(--gap-sm)"},children:l(be,{variant:Te(O),children:J(String(O),e.fields[u],s)})})]}),i(F,{direction:"column",gap:"tight",children:[i("div",{children:[l(y,{level:"h4",style:{margin:0},children:b}),R&&l(y,{level:"small",variant:"muted",style:{marginTop:"var(--gap-xs)"},children:R})]}),M!=null&&G&&l("div",{className:p.productPrice,children:(()=>{const a=K(M,G,s,{compact:!0});return a})()}),A.length>0&&l("div",{className:p.productSpecs,children:A.map(a=>{const C=r[a];if(C==null)return null;const B=e.fields[a],ge=J(a,B,s),pe=B?K(C,B,s,{compact:!0}):String(C);return i("span",{className:p.productSpecPill,children:[ge,": ",pe]},a)})})]})]})]},r.id)})});return le?t:l(W,{title:ie?s("crud:results.title.fetching",{defaultValue:"Fetching..."}):s("crud:results.title.count",{count:g.length,defaultValue:g.length===1?"Found 1 item":`Found ${g.length} items`}),collapsible:!0,defaultOpen:!0,children:t})})()]})}export{$e as ProductCardListTemplate};
package/dist/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from './billing';
8
8
  export * from './crud';
9
9
  export * from './legal';
10
10
  export * from './components/MarkdownViewer';
11
+ export * from './blog';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use client";export*from"./HomeTemplate";export*from"./WhatsNewTemplate";export*from"./DashboardTemplate";export*from"./LoginTemplate";export*from"./AdminLandingTemplate";export*from"./ProfileTemplate";export*from"./billing";export*from"./crud";export*from"./legal";export*from"./components/MarkdownViewer";
1
+ "use client";export*from"./HomeTemplate";export*from"./WhatsNewTemplate";export*from"./DashboardTemplate";export*from"./LoginTemplate";export*from"./AdminLandingTemplate";export*from"./ProfileTemplate";export*from"./billing";export*from"./crud";export*from"./legal";export*from"./components/MarkdownViewer";export*from"./blog";
@@ -1,3 +1,12 @@
1
+ /**
2
+ * @fileoverview Legal Notice Template Component
3
+ * @description Reusable legal notice (Mentions Légales) template with configurable company details and i18n support
4
+ *
5
+ * @version 0.0.1
6
+ * @since 0.0.1
7
+ * @author AMBROISE PARK Consulting
8
+ */
9
+ import type { ComponentType } from 'react';
1
10
  /**
2
11
  * Legal Notice Template Configuration
3
12
  */
@@ -55,5 +64,5 @@ export interface LegalNoticeConfig {
55
64
  * @since 0.0.1
56
65
  * @author AMBROISE PARK Consulting
57
66
  */
58
- export declare const LegalNoticeTemplate: React.ComponentType<LegalNoticeConfig>;
67
+ export declare const LegalNoticeTemplate: ComponentType<LegalNoticeConfig>;
59
68
  //# sourceMappingURL=LegalNoticeTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LegalNoticeTemplate.d.ts","sourceRoot":"","sources":["../../src/legal/LegalNoticeTemplate.tsx"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,wBAAwB;IACxB,aAAa,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,EAAE;QACT,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAiVtE,CAAC"}
1
+ {"version":3,"file":"LegalNoticeTemplate.d.ts","sourceRoot":"","sources":["../../src/legal/LegalNoticeTemplate.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,wBAAwB;IACxB,aAAa,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,EAAE;QACT,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,iBAAiB,CAiVhE,CAAC"}
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import{Text as x,Stack as i}from"@donotdev/components";import{useTranslation as S,formatDate as T}from"@donotdev/core";const D=({publisherName:c,publisherType:o,legalStatus:d,registrationNumber:n,vatNumber:l,shareCapital:h,registeredOffice:y,email:p,phone:a,directorName:v,directorRole:m="Publication Director",hostingProvider:b,hostingAddress:g,hostingContact:f,lastUpdated:z,sections:s={intellectualProperty:!0,personalData:!0,cookies:!0}})=>{const{t,i18n:P}=S("legalNotice"),u=T(z,P?.language||"en");return r("div",{children:e("div",{style:{maxWidth:"none"},children:[e("div",{className:"dndev-text-center",style:{marginBottom:"3rem"},children:[e("h1",{style:{fontSize:"var(--font-size-3xl)",fontWeight:700,marginBottom:"1rem"},children:["\u2696\uFE0F ",t("title","Legal Notice")]}),e("p",{style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)"},children:[t("lastUpdated","Last updated"),": ",u]})]}),e(i,{gap:"large",children:[e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("publisher.title","1. Publisher Information")}),e(i,{gap:"tight",children:[e("p",{children:[e("strong",{children:[t("publisher.name","Publisher name"),":"]})," ",c]}),e("p",{children:[e("strong",{children:[t("publisher.type","Type"),":"]})," ",t(`publisher.types.${o}`,o==="company"?"Company":"Individual")]}),d&&e("p",{children:[e("strong",{children:[t("publisher.legalStatus","Legal status"),":"]})," ",d]}),h&&o==="company"&&e("p",{children:[e("strong",{children:[t("publisher.shareCapital","Share capital"),":"]})," ",h]})]})]}),(n||l)&&e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("registration.title","2. Registration Details")}),e(i,{gap:"tight",children:[n&&e("p",{children:[e("strong",{children:[t("registration.number","Registration number / SIRET"),":"]})," ",n]}),l&&e("p",{children:[e("strong",{children:[t("registration.vat","VAT number"),":"]})," ",l]})]})]}),e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("office.title","3. Registered Office")}),e("p",{children:[e("strong",{children:[t("office.address","Address"),":"]}),r("br",{}),y]})]}),e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("contact.title","4. Contact Information")}),e(i,{gap:"tight",children:[e("p",{children:[e("strong",{children:[t("contact.email","Email"),":"]})," ",e("a",{href:`mailto:${p}`,style:{color:"var(--primary)"},children:[" ",p]})]}),a&&e("p",{children:[e("strong",{children:[t("contact.phone","Phone"),":"]})," ",r("a",{href:`tel:${a}`,style:{color:"var(--primary)"},children:a})]})]})]}),e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("director.title","5. Publication Director")}),e(i,{gap:"tight",children:[e("p",{children:[e("strong",{children:[t("director.name","Name"),":"]})," ",v]}),m&&e("p",{children:[e("strong",{children:[t("director.role","Role"),":"]})," ",m]})]})]}),e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("hosting.title","6. Hosting Provider")}),e(i,{gap:"tight",children:[e("p",{children:[e("strong",{children:[t("hosting.provider","Provider"),":"]})," ",b]})," ",g&&e("p",{children:[e("strong",{children:[t("hosting.address","Address"),":"]}),r("br",{}),g]}),f&&e("p",{children:[e("strong",{children:[t("hosting.contact","Contact"),":"]})," ",f]})]})]}),s.intellectualProperty&&e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("intellectualProperty.title","7. Intellectual Property")}),r("p",{children:t("intellectualProperty.content","All content on this website, including but not limited to text, graphics, logos, images, audio clips, digital downloads, data compilations, and software, is the property of {publisherName} or its content suppliers and is protected by international copyright laws.",{publisherName:c})}),r("p",{style:{marginTop:"1rem"},children:t("intellectualProperty.unauthorized","The unauthorized use of any content from this website may violate copyright, trademark, and other laws.")})]}),s.personalData&&e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("personalData.title","8. Personal Data")}),e("p",{children:[t("personalData.content","For information about how we collect, use, and protect your personal data, please refer to our "),r("a",{href:"/privacy",style:{color:"var(--primary)",textDecoration:"underline"},children:t("personalData.privacyPolicy","Privacy Policy")}),"."]})]}),s.cookies&&e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("cookies.title","9. Cookies")}),e("p",{children:[t("cookies.content","This website uses cookies. For detailed information about cookies and how we use them, please refer to our "),r("a",{href:"/privacy",style:{color:"var(--primary)",textDecoration:"underline"},children:t("cookies.privacyPolicy","Privacy Policy")}),"."]})]})]}),r("div",{className:"dndev-text-center",style:{marginTop:"3rem",paddingTop:"2rem",borderTop:"1px solid var(--border)"},children:e(x,{variant:"muted",level:"small",children:[t("footer.accurate","The information in this Legal Notice is accurate as of")," ",u," ",t("footer.updated","and may be updated to reflect changes in our company information.")]})})]})})};export{D as LegalNoticeTemplate};
1
+ "use client";import{jsxs as e,jsx as r}from"react/jsx-runtime";import{Text as b,Stack as i}from"@donotdev/components";import{useTranslation as S,formatDate as D}from"@donotdev/core";const W=({publisherName:s,publisherType:n,legalStatus:d,registrationNumber:o,vatNumber:l,shareCapital:h,registeredOffice:y,email:p,phone:a,directorName:v,directorRole:m="Publication Director",hostingProvider:z,hostingAddress:g,hostingContact:f,lastUpdated:x,sections:c={intellectualProperty:!0,personalData:!0,cookies:!0}})=>{const{t,i18n:P}=S("legalNotice"),u=D(x,P?.language||"en");return r("div",{children:e("div",{style:{maxWidth:"none"},children:[e("div",{className:"dndev-text-center",style:{marginBottom:"3rem"},children:[e("h1",{style:{fontSize:"var(--font-size-3xl)",fontWeight:700,marginBottom:"1rem"},children:["\u2696\uFE0F ",t("title","Legal Notice")]}),e("p",{style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)"},children:[t("lastUpdated","Last updated"),": ",u]})]}),e(i,{gap:"large",children:[e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("publisher.title","1. Publisher Information")}),e(i,{gap:"tight",children:[e("p",{children:[e("strong",{children:[t("publisher.name","Publisher name"),":"]})," ",s]}),e("p",{children:[e("strong",{children:[t("publisher.type","Type"),":"]})," ",t(`publisher.types.${n}`,n==="company"?"Company":"Individual")]}),d&&e("p",{children:[e("strong",{children:[t("publisher.legalStatus","Legal status"),":"]})," ",d]}),h&&n==="company"&&e("p",{children:[e("strong",{children:[t("publisher.shareCapital","Share capital"),":"]})," ",h]})]})]}),(o||l)&&e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("registration.title","2. Registration Details")}),e(i,{gap:"tight",children:[o&&e("p",{children:[e("strong",{children:[t("registration.number","Registration number / SIRET"),":"]})," ",o]}),l&&e("p",{children:[e("strong",{children:[t("registration.vat","VAT number"),":"]})," ",l]})]})]}),e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("office.title","3. Registered Office")}),e("p",{children:[e("strong",{children:[t("office.address","Address"),":"]}),r("br",{}),y]})]}),e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("contact.title","4. Contact Information")}),e(i,{gap:"tight",children:[e("p",{children:[e("strong",{children:[t("contact.email","Email"),":"]})," ",e("a",{href:`mailto:${p}`,style:{color:"var(--primary)"},children:[" ",p]})]}),a&&e("p",{children:[e("strong",{children:[t("contact.phone","Phone"),":"]})," ",r("a",{href:`tel:${a}`,style:{color:"var(--primary)"},children:a})]})]})]}),e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("director.title","5. Publication Director")}),e(i,{gap:"tight",children:[e("p",{children:[e("strong",{children:[t("director.name","Name"),":"]})," ",v]}),m&&e("p",{children:[e("strong",{children:[t("director.role","Role"),":"]})," ",m]})]})]}),e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("hosting.title","6. Hosting Provider")}),e(i,{gap:"tight",children:[e("p",{children:[e("strong",{children:[t("hosting.provider","Provider"),":"]})," ",z]})," ",g&&e("p",{children:[e("strong",{children:[t("hosting.address","Address"),":"]}),r("br",{}),g]}),f&&e("p",{children:[e("strong",{children:[t("hosting.contact","Contact"),":"]})," ",f]})]})]}),c.intellectualProperty&&e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("intellectualProperty.title","7. Intellectual Property")}),r("p",{children:t("intellectualProperty.content","All content on this website, including but not limited to text, graphics, logos, images, audio clips, digital downloads, data compilations, and software, is the property of {publisherName} or its content suppliers and is protected by international copyright laws.",{publisherName:s})}),r("p",{style:{marginTop:"1rem"},children:t("intellectualProperty.unauthorized","The unauthorized use of any content from this website may violate copyright, trademark, and other laws.")})]}),c.personalData&&e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("personalData.title","8. Personal Data")}),e("p",{children:[t("personalData.content","For information about how we collect, use, and protect your personal data, please refer to our "),r("a",{href:"/privacy",style:{color:"var(--primary)",textDecoration:"underline"},children:t("personalData.privacyPolicy","Privacy Policy")}),"."]})]}),c.cookies&&e("section",{children:[r("h2",{style:{fontSize:"var(--font-size-xl)",fontWeight:600,marginBottom:"1rem"},children:t("cookies.title","9. Cookies")}),e("p",{children:[t("cookies.content","This website uses cookies. For detailed information about cookies and how we use them, please refer to our "),r("a",{href:"/privacy",style:{color:"var(--primary)",textDecoration:"underline"},children:t("cookies.privacyPolicy","Privacy Policy")}),"."]})]})]}),r("div",{className:"dndev-text-center",style:{marginTop:"3rem",paddingTop:"2rem",borderTop:"1px solid var(--border)"},children:e(b,{variant:"muted",level:"small",children:[t("footer.accurate","The information in this Legal Notice is accurate as of")," ",u," ",t("footer.updated","and may be updated to reflect changes in our company information.")]})})]})})};export{W as LegalNoticeTemplate};
@@ -1,3 +1,12 @@
1
+ /**
2
+ * @fileoverview Privacy Policy Template Component
3
+ * @description Reusable privacy policy template with configurable company details and i18n support
4
+ *
5
+ * @version 0.0.1
6
+ * @since 0.0.1
7
+ * @author AMBROISE PARK Consulting
8
+ */
9
+ import type { ComponentType } from 'react';
1
10
  /**
2
11
  * Privacy Policy Template Configuration
3
12
  */
@@ -43,6 +52,5 @@ export interface PrivacyPolicyConfig {
43
52
  * @since 0.0.1
44
53
  * @author AMBROISE PARK Consulting
45
54
  */
46
- export declare const PrivacyPolicyTemplate: React.ComponentType<PrivacyPolicyConfig>;
47
- export default PrivacyPolicyTemplate;
55
+ export declare const PrivacyPolicyTemplate: ComponentType<PrivacyPolicyConfig>;
48
56
  //# sourceMappingURL=PrivacyPolicyTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrivacyPolicyTemplate.d.ts","sourceRoot":"","sources":["../../src/legal/PrivacyPolicyTemplate.tsx"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,EAAE,CAAC,EAAE,OAAO,CAAC;KACd,CAAC;IACF,iCAAiC;IACjC,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,aAAa,CACrD,mBAAmB,CAy5BpB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"PrivacyPolicyTemplate.d.ts","sourceRoot":"","sources":["../../src/legal/PrivacyPolicyTemplate.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,EAAE,CAAC,EAAE,OAAO,CAAC;KACd,CAAC;IACF,iCAAiC;IACjC,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAC/C,mBAAmB,CAy5BpB,CAAC"}