@latte-macchiat-io/latte-payload 1.0.3 → 1.0.4

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.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const ClientSpaceButton: React.FC;
3
+ export default ClientSpaceButton;
4
+ //# sourceMappingURL=client-space-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-space-button.d.ts","sourceRoot":"","sources":["../../../../src/components/admin/client-space-button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EA6CrC,CAAC;AAGF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,26 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Banner, Button } from '@payloadcms/ui';
4
+ const isDev = process.env.NODE_ENV === 'development';
5
+ const dashboardUrl = process.env.CLIENT_DASHBOARD_URL;
6
+ export const ClientSpaceButton = () => {
7
+ // Hide in production if URL is not set
8
+ if (!dashboardUrl && !isDev) {
9
+ return null;
10
+ }
11
+ const handleClick = () => {
12
+ if (dashboardUrl) {
13
+ window.open(dashboardUrl, '_blank', 'noopener,noreferrer');
14
+ }
15
+ };
16
+ const showWarning = !dashboardUrl && isDev;
17
+ return (_jsxs("div", { style: { marginBottom: '1.5rem' }, children: [_jsxs("div", { style: {
18
+ padding: '1.5rem',
19
+ backgroundColor: 'var(--theme-elevation-50)',
20
+ borderRadius: 'var(--border-radius-m)',
21
+ border: '1px solid var(--theme-elevation-200)',
22
+ }, children: [_jsx("div", { style: { marginBottom: '0.75rem', fontSize: '1rem', fontWeight: 600 }, children: "Latte Macchiat.io Dashboard" }), _jsx("div", { style: { marginBottom: '1rem', fontSize: '0.9rem', color: 'var(--theme-elevation-800)', lineHeight: '1.5' }, children: "Question, new feature, issue? Access your Latte dashboard." }), _jsx(Button, { buttonStyle: showWarning ? 'secondary' : 'primary', disabled: !dashboardUrl, onClick: handleClick, size: "medium", "aria-label": showWarning ? 'Dashboard URL not configured' : 'Open Latte Dashboard in new tab', children: showWarning ? '⚠️ Dashboard URL not set' : 'Open Latte Dashboard' })] }), showWarning && (_jsx("div", { style: { marginTop: '1rem' }, children: _jsxs(Banner, { type: "error", children: ["Set ", _jsx("code", { children: "CLIENT_DASHBOARD_URL" }), " in your environment variables"] }) }))] }));
23
+ };
24
+ // Default export for Payload dashboard widget
25
+ export default ClientSpaceButton;
26
+ //# sourceMappingURL=client-space-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-space-button.js","sourceRoot":"","sources":["../../../../src/components/admin/client-space-button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGhD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AACrD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAa,GAAG,EAAE;IAC9C,uCAAuC;IACvC,IAAI,CAAC,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,YAAY,IAAI,KAAK,CAAC;IAE3C,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,aACpC,eACE,KAAK,EAAE;oBACL,OAAO,EAAE,QAAQ;oBACjB,eAAe,EAAE,2BAA2B;oBAC5C,YAAY,EAAE,wBAAwB;oBACtC,MAAM,EAAE,sCAAsC;iBAC/C,aACD,cAAK,KAAK,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,4CAAmC,EAC7G,cAAK,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,4BAA4B,EAAE,UAAU,EAAE,KAAK,EAAE,2EAE1G,EACN,KAAC,MAAM,IACL,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAClD,QAAQ,EAAE,CAAC,YAAY,EACvB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAC,QAAQ,gBACD,WAAW,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,iCAAiC,YAC3F,WAAW,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,sBAAsB,GAC3D,IACL,EACL,WAAW,IAAI,CACd,cAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,YAC/B,MAAC,MAAM,IAAC,IAAI,EAAC,OAAO,qBACd,kDAAiC,sCAC9B,GACL,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,8CAA8C;AAC9C,eAAe,iBAAiB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { HTMLViewer } from '../collections/QueuedEmails/components/HtmlViewer';
2
2
  export { RetryEmailButtons } from '../collections/QueuedEmails/components/RetryEmailButtons';
3
+ export { ClientSpaceButton } from './admin/client-space-button';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAC;AAG7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,4 +1,6 @@
1
1
  // Re-export components from collections for backward compatibility
2
2
  export { HTMLViewer } from '../collections/QueuedEmails/components/HtmlViewer';
3
3
  export { RetryEmailButtons } from '../collections/QueuedEmails/components/RetryEmailButtons';
4
+ // Export admin components
5
+ export { ClientSpaceButton } from './admin/client-space-button';
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAC;AAE7F,0BAA0B;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latte-macchiat-io/latte-payload",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Reusable Payload CMS collections, utilities, and components for Latte projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,57 @@
1
+ 'use client';
2
+
3
+ import { Banner, Button } from '@payloadcms/ui';
4
+ import React from 'react';
5
+
6
+ const isDev = process.env.NODE_ENV === 'development';
7
+ const dashboardUrl = process.env.CLIENT_DASHBOARD_URL;
8
+
9
+ export const ClientSpaceButton: React.FC = () => {
10
+ // Hide in production if URL is not set
11
+ if (!dashboardUrl && !isDev) {
12
+ return null;
13
+ }
14
+
15
+ const handleClick = () => {
16
+ if (dashboardUrl) {
17
+ window.open(dashboardUrl, '_blank', 'noopener,noreferrer');
18
+ }
19
+ };
20
+
21
+ const showWarning = !dashboardUrl && isDev;
22
+
23
+ return (
24
+ <div style={{ marginBottom: '1.5rem' }}>
25
+ <div
26
+ style={{
27
+ padding: '1.5rem',
28
+ backgroundColor: 'var(--theme-elevation-50)',
29
+ borderRadius: 'var(--border-radius-m)',
30
+ border: '1px solid var(--theme-elevation-200)',
31
+ }}>
32
+ <div style={{ marginBottom: '0.75rem', fontSize: '1rem', fontWeight: 600 }}>Latte Macchiat.io Dashboard</div>
33
+ <div style={{ marginBottom: '1rem', fontSize: '0.9rem', color: 'var(--theme-elevation-800)', lineHeight: '1.5' }}>
34
+ Question, new feature, issue? Access your Latte dashboard.
35
+ </div>
36
+ <Button
37
+ buttonStyle={showWarning ? 'secondary' : 'primary'}
38
+ disabled={!dashboardUrl}
39
+ onClick={handleClick}
40
+ size="medium"
41
+ aria-label={showWarning ? 'Dashboard URL not configured' : 'Open Latte Dashboard in new tab'}>
42
+ {showWarning ? '⚠️ Dashboard URL not set' : 'Open Latte Dashboard'}
43
+ </Button>
44
+ </div>
45
+ {showWarning && (
46
+ <div style={{ marginTop: '1rem' }}>
47
+ <Banner type="error">
48
+ Set <code>CLIENT_DASHBOARD_URL</code> in your environment variables
49
+ </Banner>
50
+ </div>
51
+ )}
52
+ </div>
53
+ );
54
+ };
55
+
56
+ // Default export for Payload dashboard widget
57
+ export default ClientSpaceButton;
@@ -1,3 +1,6 @@
1
1
  // Re-export components from collections for backward compatibility
2
2
  export { HTMLViewer } from '../collections/QueuedEmails/components/HtmlViewer';
3
3
  export { RetryEmailButtons } from '../collections/QueuedEmails/components/RetryEmailButtons';
4
+
5
+ // Export admin components
6
+ export { ClientSpaceButton } from './admin/client-space-button';