@donotdev/templates 0.0.7 → 0.0.8

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.
@@ -1 +1 @@
1
- "use client";import{jsx as t,Fragment as x,jsxs as a}from"react/jsx-runtime";import{useEffect as P}from"react";import{MultipleAuthProviders as y}from"@donotdev/auth";import{HeroSection as z,Section as L,Text as T,Stack as j}from"@donotdev/components";import{useTranslation as A,useAppConfig as C,getPlatformEnvVar as _}from"@donotdev/core";import{PageContainer as R,useNavigate as W,useRedirectGuard as k,Loader as E,Link as u}from"@donotdev/ui";function F({title:f,subtitle:m,message:i,supportLink:s,publicWebsiteLink:c,redirectConfig:l,children:h}){const{t:d}=A("dndev"),p=W(),g=C("app"),{shouldRedirect:n,redirectTo:e,isChecking:v}=k({condition:l?.condition,redirectTo:l?.redirectTo});if(P(()=>{n&&e&&p(e,{replace:!0})},[n,e,p]),v)return t(E,{});if(n&&e)return null;const o=s?.path||g?.links?.support,r=c?.path||_("APP_URL"),b=s?.label||d("adminLanding.contactSupport","Contact Support"),S=c?.label||d("adminLanding.visitWebsite","Visit Website");return a(R,{children:[t(z,{title:f,subtitle:m,variant:"primary"}),i&&t(L,{title:i.title,align:"center",children:t(T,{as:"p",level:"body",children:i.content})}),t(y,{}),h,(o||r)&&a(j,{direction:"row",gap:"tight",justify:"center",align:"center",children:[o&&a(x,{children:[t(u,{path:o,style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:b}),r&&t("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:" | "})]}),r&&t(u,{path:r,style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:S})]})]})}var U=F;export{F as AdminLandingTemplate,U as default};
1
+ "use client";import{jsx as e,Fragment as k,jsxs as o}from"react/jsx-runtime";import{useEffect as y}from"react";import{MultipleAuthProviders as z}from"@donotdev/auth";import{HeroSection as T,Section as C,Text as P,Stack as x}from"@donotdev/components";import{useTranslation as A,useAppConfig as j,getPlatformEnvVar as R}from"@donotdev/core";import{PageContainer as W,useNavigate as E,useRedirectGuard as F,Loader as U,Link as u}from"@donotdev/ui";function m({title:f,subtitle:g,message:i,supportLink:s,publicWebsiteLink:l,redirectConfig:d,children:h}){const{t:c}=A("dndev"),p=E(),v=j("app"),{shouldRedirect:n,redirectTo:t,isChecking:b}=F({condition:d?.condition,redirectTo:d?.redirectTo});if(y(()=>{n&&t&&p(t,{replace:!0})},[n,t,p]),b)return e(U,{});if(n&&t)return null;const a=s?.path||v?.links?.support,r=l?.path||R("APP_URL"),L=s?.label||c("adminLanding.contactSupport","Contact Support"),S=l?.label||c("adminLanding.visitWebsite","Visit Website");return o(W,{children:[e(T,{title:f,subtitle:g,variant:"primary"}),i&&e(C,{title:i.title,align:"center",children:e(P,{as:"p",level:"body",children:i.content})}),e(z,{}),h,(a||r)&&o(x,{direction:"row",gap:"tight",justify:"center",align:"center",children:[a&&o(k,{children:[e(u,{path:a,style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:L}),r&&e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:" | "})]}),r&&e(u,{path:r,style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:S})]})]})}var V=m;export{m as AdminLandingTemplate,V as default};
@@ -0,0 +1,23 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { Entity } from '@donotdev/core';
3
+ interface InquiryAdminTemplateProps {
4
+ /** Customer entity definition (linked via customerId) */
5
+ customerEntity: Entity;
6
+ /** Inquiry entity definition */
7
+ inquiryEntity: Entity;
8
+ /** Optional base path for customer detail pages (defaults to `/customers`) */
9
+ customerBasePath?: string;
10
+ /** Whether the section is collapsible */
11
+ collapsible?: boolean;
12
+ /** Default open state (when collapsible) */
13
+ defaultOpen?: boolean;
14
+ /** Controlled open state (when collapsible) */
15
+ open?: boolean;
16
+ /** Callback when open state changes (when collapsible) */
17
+ onOpenChange?: (open: boolean) => void;
18
+ /** Section title (defaults to inquiry entity name) */
19
+ title?: string;
20
+ }
21
+ export declare function InquiryAdminTemplate({ customerEntity, inquiryEntity, customerBasePath, collapsible, defaultOpen, open, onOpenChange, title, }: InquiryAdminTemplateProps): ReactElement;
22
+ export {};
23
+ //# sourceMappingURL=InquiryAdminTemplate.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +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};
@@ -9,5 +9,6 @@
9
9
  export * from './ProductCardListTemplate';
10
10
  export * from './CarCardListTemplate';
11
11
  export * from './InquiryFormTemplate';
12
+ export * from './InquiryAdminTemplate';
12
13
  export * from './CarDetailTemplate';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crud/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crud/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- export*from"./ProductCardListTemplate";export*from"./CarCardListTemplate";export*from"./InquiryFormTemplate";export*from"./CarDetailTemplate";
1
+ export*from"./ProductCardListTemplate";export*from"./CarCardListTemplate";export*from"./InquiryFormTemplate";export*from"./InquiryAdminTemplate";export*from"./CarDetailTemplate";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donotdev/templates",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -47,8 +47,8 @@
47
47
  "dependencies": {
48
48
  "@donotdev/adv-comps": "^0.0.9",
49
49
  "@donotdev/components": "^0.0.15",
50
- "@donotdev/core": "^0.0.19",
51
- "@donotdev/crud": "^0.0.10",
50
+ "@donotdev/core": "^0.0.20",
51
+ "@donotdev/crud": "^0.0.11",
52
52
  "@donotdev/ui": "^0.0.11",
53
53
  "@hookform/resolvers": "^5.2.2",
54
54
  "html-react-parser": "^5.2.16",
@@ -56,7 +56,7 @@
56
56
  "react-hook-form": "^7.71.1"
57
57
  },
58
58
  "peerDependencies": {
59
- "@donotdev/auth": "^0.0.5",
59
+ "@donotdev/auth": "^0.0.6",
60
60
  "@donotdev/billing": "^0.0.5",
61
61
  "@donotdev/oauth": "^0.0.5",
62
62
  "lucide-react": "^0.563.0",