@asteby/metacore-auth 3.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/showcases/generic.d.ts +11 -0
- package/dist/showcases/generic.d.ts.map +1 -0
- package/dist/showcases/generic.js +9 -0
- package/dist/showcases/generic.js.map +1 -0
- package/dist/showcases/index.d.ts +4 -0
- package/dist/showcases/index.d.ts.map +1 -0
- package/dist/showcases/index.js +8 -0
- package/dist/showcases/index.js.map +1 -0
- package/dist/showcases/marketplace.d.ts +10 -0
- package/dist/showcases/marketplace.d.ts.map +1 -0
- package/dist/showcases/marketplace.js +26 -0
- package/dist/showcases/marketplace.js.map +1 -0
- package/dist/showcases/whatsapp.d.ts +10 -0
- package/dist/showcases/whatsapp.d.ts.map +1 -0
- package/dist/showcases/whatsapp.js +61 -0
- package/dist/showcases/whatsapp.js.map +1 -0
- package/package.json +26 -3
package/README.md
CHANGED
|
@@ -95,7 +95,7 @@ export function SignInRoute() {
|
|
|
95
95
|
|
|
96
96
|
## Design notes
|
|
97
97
|
|
|
98
|
-
- **Zustand store is canonical** —
|
|
98
|
+
- **Zustand store is canonical** — generic shape (user + token + reset) shared across host applications. Persists to `localStorage` keys `auth_token` / `auth_user`.
|
|
99
99
|
- **Factory, not singleton** — `createApiClient` avoids baking env vars into the library. The host app wires token / language / branch getters.
|
|
100
100
|
- **Pages are brand-less** — accept `brandName`, `logo`, `showcase`, `headerSlot`, `footerSlot` so each app supplies its own identity.
|
|
101
101
|
- **`onSubmit` delegated** — pages don't assume endpoints, toasts, or navigation. The caller owns the network layer.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type GenericShowcaseProps = {
|
|
3
|
+
/** Headline. Apps usually pass their brand name + a one-liner. */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** Subhead under the title. */
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
/** Optional slot rendered below the subtitle (CTAs, badges, signed-by, …). */
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare function GenericShowcase({ title, subtitle, footer, }?: GenericShowcaseProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=generic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../src/showcases/generic.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,oBAAoB,GAAG;IACjC,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,KAAoB,EACpB,QAA0C,EAC1C,MAAM,GACP,GAAE,oBAAyB,2CAkB3B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Brand-neutral fallback showcase for apps that don't have a custom one yet.
|
|
3
|
+
// A simple animated gradient blob with a tagline — enough to keep the auth
|
|
4
|
+
// page from looking empty without forcing any product narrative.
|
|
5
|
+
import { motion } from 'framer-motion';
|
|
6
|
+
export function GenericShowcase({ title = 'Bienvenido', subtitle = 'Inicia sesión para continuar.', footer, } = {}) {
|
|
7
|
+
return (_jsxs("div", { className: "relative w-full h-full flex items-center justify-center px-8 overflow-hidden", children: [_jsx("div", { className: "pointer-events-none absolute -top-1/4 -right-1/4 size-[480px] rounded-full bg-gradient-to-br from-primary/30 via-primary/10 to-transparent blur-3xl" }), _jsx("div", { className: "pointer-events-none absolute -bottom-1/4 -left-1/4 size-[420px] rounded-full bg-gradient-to-tr from-primary/20 to-transparent blur-3xl" }), _jsxs(motion.div, { initial: { opacity: 0, y: 16 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5 }, className: "relative z-10 text-center max-w-sm", children: [_jsx("h1", { className: "text-3xl font-bold tracking-tight mb-3", children: title }), _jsx("p", { className: "text-muted-foreground text-sm leading-relaxed", children: subtitle }), footer && _jsx("div", { className: "mt-6", children: footer })] })] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=generic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../src/showcases/generic.tsx"],"names":[],"mappings":";AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,iEAAiE;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAYtC,MAAM,UAAU,eAAe,CAAC,EAC9B,KAAK,GAAG,YAAY,EACpB,QAAQ,GAAG,+BAA+B,EAC1C,MAAM,MACkB,EAAE;IAC1B,OAAO,CACL,eAAK,SAAS,EAAC,8EAA8E,aAC3F,cAAK,SAAS,EAAC,qJAAqJ,GAAG,EACvK,cAAK,SAAS,EAAC,wIAAwI,GAAG,EAE1J,MAAC,MAAM,CAAC,GAAG,IACT,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAC9B,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAC7B,UAAU,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EAC7B,SAAS,EAAC,oCAAoC,aAE9C,aAAI,SAAS,EAAC,wCAAwC,YAAE,KAAK,GAAM,EACnE,YAAG,SAAS,EAAC,+CAA+C,YAAE,QAAQ,GAAK,EAC1E,MAAM,IAAI,cAAK,SAAS,EAAC,MAAM,YAAE,MAAM,GAAO,IACpC,IACT,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { WhatsAppShowcase, ChatMockup, type WhatsAppShowcaseProps } from './whatsapp';
|
|
2
|
+
export { MarketplaceShowcase, type MarketplaceShowcaseProps } from './marketplace';
|
|
3
|
+
export { GenericShowcase, type GenericShowcaseProps } from './generic';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/showcases/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAA;AACrF,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,eAAe,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Optional sub-path entry. Apps that want to import multiple showcases at
|
|
2
|
+
// once can `import { WhatsAppShowcase, MarketplaceShowcase } from
|
|
3
|
+
// '@asteby/metacore-auth/showcases'`. For tree-shaking-friendly single
|
|
4
|
+
// imports, prefer the deep paths (`/showcases/whatsapp` etc).
|
|
5
|
+
export { WhatsAppShowcase, ChatMockup } from './whatsapp';
|
|
6
|
+
export { MarketplaceShowcase } from './marketplace';
|
|
7
|
+
export { GenericShowcase } from './generic';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/showcases/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,kEAAkE;AAClE,uEAAuE;AACvE,8DAA8D;AAC9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAA8B,MAAM,YAAY,CAAA;AACrF,OAAO,EAAE,mBAAmB,EAAiC,MAAM,eAAe,CAAA;AAClF,OAAO,EAAE,eAAe,EAA6B,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type MarketplaceShowcaseProps = {
|
|
2
|
+
/** Headline displayed above the addon grid. */
|
|
3
|
+
title?: string;
|
|
4
|
+
/** Subheadline explaining what the marketplace is. */
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
/** Override the bottom-bar tagline. */
|
|
7
|
+
tagline?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function MarketplaceShowcase({ title, subtitle, tagline, }?: MarketplaceShowcaseProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=marketplace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../../src/showcases/marketplace.tsx"],"names":[],"mappings":"AAiBA,MAAM,MAAM,wBAAwB,GAAG;IACrC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAcD,wBAAgB,mBAAmB,CAAC,EAClC,KAAkC,EAClC,QAA6G,EAC7G,OAA0D,GAC3D,GAAE,wBAA6B,2CAoD/B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Developer-marketplace showcase. Pitch: "build, sign, ship addons that any
|
|
3
|
+
// metacore host can install in one click." Renders a hero card with a
|
|
4
|
+
// rotating set of addon tiles to convey breadth of the catalog without
|
|
5
|
+
// hardcoding any specific addon names.
|
|
6
|
+
import { motion } from 'framer-motion';
|
|
7
|
+
import { Boxes, Plug, ShieldCheck, Zap, Bot, Rocket, Sparkles, Globe, } from 'lucide-react';
|
|
8
|
+
import { cn } from '@asteby/metacore-ui/lib';
|
|
9
|
+
const addons = [
|
|
10
|
+
{ name: 'Fiscal MX', tag: 'Compliance', Icon: ShieldCheck },
|
|
11
|
+
{ name: 'WhatsApp', tag: 'Messaging', Icon: Bot },
|
|
12
|
+
{ name: 'Stripe', tag: 'Payments', Icon: Zap },
|
|
13
|
+
{ name: 'Shopify', tag: 'Ecommerce', Icon: Boxes },
|
|
14
|
+
{ name: 'Notion', tag: 'Productivity', Icon: Sparkles },
|
|
15
|
+
{ name: 'Webhook', tag: 'Integrations', Icon: Plug },
|
|
16
|
+
{ name: 'Telegram', tag: 'Messaging', Icon: Globe },
|
|
17
|
+
{ name: 'GitHub', tag: 'DevTools', Icon: Rocket },
|
|
18
|
+
{ name: 'Resend', tag: 'Email', Icon: Bot },
|
|
19
|
+
];
|
|
20
|
+
export function MarketplaceShowcase({ title = 'El marketplace de addons', subtitle = 'Construye, firma y publica integraciones que cualquier host metacore puede instalar en un click.', tagline = 'Bundles firmados · Sandbox WASM · Multi-tenant', } = {}) {
|
|
21
|
+
return (_jsxs("div", { className: "relative w-full max-w-md px-8", children: [_jsxs(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5 }, className: "text-center mb-8", children: [_jsx("h1", { className: "text-3xl font-bold tracking-tight mb-3", children: title }), _jsx("p", { className: "text-muted-foreground text-sm leading-relaxed", children: subtitle })] }), _jsx("div", { className: "grid grid-cols-3 gap-3", children: addons.map((addon, i) => {
|
|
22
|
+
const { Icon } = addon;
|
|
23
|
+
return (_jsx(motion.div, { initial: { opacity: 0, scale: 0.92 }, animate: { opacity: 1, scale: 1 }, transition: { delay: 0.1 + i * 0.05, duration: 0.35 }, className: cn('group relative rounded-xl border bg-card p-3 shadow-sm', 'hover:shadow-md hover:border-primary/30 transition-all'), children: _jsxs("div", { className: "flex flex-col items-center text-center gap-2", children: [_jsx("div", { className: "size-10 rounded-lg bg-primary/10 flex items-center justify-center group-hover:bg-primary/20 transition-colors", children: _jsx(Icon, { className: "size-5 text-primary" }) }), _jsxs("div", { children: [_jsx("div", { className: "text-xs font-semibold leading-tight", children: addon.name }), _jsx("div", { className: "text-[10px] text-muted-foreground mt-0.5", children: addon.tag })] })] }) }, addon.name));
|
|
24
|
+
}) }), _jsxs(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { delay: 0.6, duration: 0.4 }, className: "mt-8 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [_jsx(ShieldCheck, { className: "size-3.5" }), _jsx("span", { children: tagline })] })] }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=marketplace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace.js","sourceRoot":"","sources":["../../src/showcases/marketplace.tsx"],"names":[],"mappings":";AAAA,4EAA4E;AAC5E,sEAAsE;AACtE,uEAAuE;AACvE,uCAAuC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EACL,KAAK,EACL,IAAI,EACJ,WAAW,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,QAAQ,EACR,KAAK,GACN,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAA;AAW5C,MAAM,MAAM,GAA2D;IACrE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3D,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE;IACjD,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE;IAC9C,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE;IAClD,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE;IACvD,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE;IACpD,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAA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eAAK,SAAS,EAAC,8CAA8C,aAC3D,cAAK,SAAS,EAAC,+GAA+G,YAC5H,KAAC,IAAI,IAAC,SAAS,EAAC,qBAAqB,GAAG,GACpC,EACN,0BACE,cAAK,SAAS,EAAC,qCAAqC,YAAE,KAAK,CAAC,IAAI,GAAO,EACvE,cAAK,SAAS,EAAC,0CAA0C,YAAE,KAAK,CAAC,GAAG,GAAO,IACvE,IACF,IAjBD,KAAK,CAAC,IAAI,CAkBJ,CACd,CAAA;gBACH,CAAC,CAAC,GACE,EAEN,MAAC,MAAM,CAAC,GAAG,IACT,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EACvB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EACvB,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,EACzC,SAAS,EAAC,2EAA2E,aAErF,KAAC,WAAW,IAAC,SAAS,EAAC,UAAU,GAAG,EACpC,yBAAO,OAAO,GAAQ,IACX,IACT,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type WhatsAppShowcaseProps = {
|
|
2
|
+
/** Brand shown in the chat header. Defaults to a neutral "Tu Negocio". */
|
|
3
|
+
organizationName?: string;
|
|
4
|
+
/** Optional logo URL shown as the chat avatar; defaults to a Store icon. */
|
|
5
|
+
organizationLogo?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function WhatsAppShowcase({ organizationName, organizationLogo }?: WhatsAppShowcaseProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
/** Backwards-compat alias for callers that copied the original ChatMockup. */
|
|
9
|
+
export declare const ChatMockup: typeof WhatsAppShowcase;
|
|
10
|
+
//# sourceMappingURL=whatsapp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsapp.d.ts","sourceRoot":"","sources":["../../src/showcases/whatsapp.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,qBAAqB,GAAG;IAClC,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AA8BD,wBAAgB,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAE,qBAA0B,2CAwIlG;AAED,8EAA8E;AAC9E,eAAO,MAAM,UAAU,yBAAmB,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// WhatsApp-style iPhone chat mockup. Suitable for any app whose pitch is
|
|
3
|
+
// conversational AI / customer messaging. The conversation loop is generic
|
|
4
|
+
// Spanish customer-service chatter — apps that want a completely different
|
|
5
|
+
// vibe should pick a different showcase or pass their own as the `showcase`
|
|
6
|
+
// slot of `<SignUpPage />`.
|
|
7
|
+
import { useState, useEffect } from 'react';
|
|
8
|
+
import { motion, AnimatePresence } from 'framer-motion';
|
|
9
|
+
import { cn } from '@asteby/metacore-ui/lib';
|
|
10
|
+
import { Bot, User, Store } from 'lucide-react';
|
|
11
|
+
const conversations = [
|
|
12
|
+
[
|
|
13
|
+
{ id: 1, type: 'user', text: '¿Tienen el iPhone 15?', delay: 0 },
|
|
14
|
+
{ id: 2, type: 'bot', text: '¡Hola! 👋 Sí, disponible en todos los colores.', delay: 1200 },
|
|
15
|
+
{ id: 3, type: 'user', text: 'Sí, el de 256GB', delay: 2800 },
|
|
16
|
+
{ id: 4, type: 'bot', text: '$18,999 MXN con 12 MSI 🚚', delay: 4000 },
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
{ id: 1, type: 'user', text: 'Mesa para 4 personas', delay: 0 },
|
|
20
|
+
{ id: 2, type: 'bot', text: '¡Perfecto! 🍽️ ¿Qué día y hora?', delay: 1200 },
|
|
21
|
+
{ id: 3, type: 'user', text: 'Sábado 8pm', delay: 2500 },
|
|
22
|
+
{ id: 4, type: 'bot', text: '¡Reservado sábado 8PM! 🎉', delay: 3800 },
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
{ id: 1, type: 'user', text: 'Mi pedido no llega 😤', delay: 0 },
|
|
26
|
+
{ id: 2, type: 'bot', text: '¿Me das tu # de orden?', delay: 1200 },
|
|
27
|
+
{ id: 3, type: 'user', text: '#45892', delay: 2400 },
|
|
28
|
+
{ id: 4, type: 'bot', text: 'Llega hoy antes de 6PM 📦', delay: 3600 },
|
|
29
|
+
],
|
|
30
|
+
];
|
|
31
|
+
export function WhatsAppShowcase({ organizationName, organizationLogo } = {}) {
|
|
32
|
+
const [currentConversation, setCurrentConversation] = useState(0);
|
|
33
|
+
const [visibleMessages, setVisibleMessages] = useState([]);
|
|
34
|
+
const [isTyping, setIsTyping] = useState(false);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const conversation = conversations[currentConversation];
|
|
37
|
+
if (!conversation)
|
|
38
|
+
return;
|
|
39
|
+
setVisibleMessages([]);
|
|
40
|
+
const timeouts = [];
|
|
41
|
+
conversation.forEach((message) => {
|
|
42
|
+
if (message.type === 'bot') {
|
|
43
|
+
timeouts.push(setTimeout(() => setIsTyping(true), message.delay - 600));
|
|
44
|
+
}
|
|
45
|
+
timeouts.push(setTimeout(() => {
|
|
46
|
+
setIsTyping(false);
|
|
47
|
+
setVisibleMessages((prev) => [...prev, message]);
|
|
48
|
+
}, message.delay));
|
|
49
|
+
});
|
|
50
|
+
timeouts.push(setTimeout(() => {
|
|
51
|
+
setCurrentConversation((prev) => (prev + 1) % conversations.length);
|
|
52
|
+
}, 6500));
|
|
53
|
+
return () => { timeouts.forEach(clearTimeout); setIsTyping(false); };
|
|
54
|
+
}, [currentConversation]);
|
|
55
|
+
return (_jsx("div", { className: "relative", children: _jsx(motion.div, { initial: { opacity: 0, y: 40 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.6 }, className: "relative w-[340px]", children: _jsxs("div", { className: "bg-[#1a1a1a] rounded-[50px] p-3 shadow-2xl", children: [_jsx("div", { className: "absolute top-3 left-1/2 -translate-x-1/2 w-[140px] h-[22px] bg-[#1a1a1a] rounded-b-2xl z-20" }), _jsxs("div", { className: "bg-white dark:bg-zinc-900 rounded-[40px] overflow-hidden", children: [_jsxs("div", { className: "bg-primary px-4 py-3 pt-8 flex items-center gap-3", children: [_jsx("div", { className: "size-11 rounded-full bg-white/20 flex items-center justify-center overflow-hidden", children: organizationLogo ? (_jsx("img", { src: organizationLogo, alt: "Logo", className: "size-full object-cover" })) : (_jsx(Store, { className: "size-6 text-white" })) }), _jsxs("div", { className: "flex-1", children: [_jsx("h3", { className: "text-white font-semibold text-[15px]", children: organizationName || 'Tu Negocio' }), _jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "size-2 rounded-full bg-green-400 animate-pulse" }), _jsx("span", { className: "text-white/80 text-xs", children: "En l\u00EDnea" })] })] })] }), _jsxs("div", { className: "min-h-[400px] bg-gray-50 dark:bg-[#0b141a] p-4 space-y-3", children: [_jsx(AnimatePresence, { mode: "popLayout", children: visibleMessages.map((message) => (_jsxs(motion.div, { initial: { opacity: 0, y: 15, scale: 0.9 }, animate: { opacity: 1, y: 0, scale: 1 }, exit: { opacity: 0, scale: 0.9 }, transition: { type: 'spring', stiffness: 300, damping: 25 }, className: cn('flex gap-2', message.type === 'user' ? 'justify-end' : 'justify-start'), children: [message.type === 'bot' && (_jsx("div", { className: "size-8 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0", children: _jsx(Bot, { className: "size-4 text-primary" }) })), _jsx("div", { className: cn('max-w-[75%] rounded-2xl px-4 py-2.5 text-[14px] leading-snug shadow-sm', message.type === 'user'
|
|
56
|
+
? 'bg-primary text-white rounded-tr-md'
|
|
57
|
+
: 'bg-white dark:bg-[#202c33] text-gray-800 dark:text-white rounded-tl-md'), children: message.text }), message.type === 'user' && (_jsx("div", { className: "size-8 rounded-full bg-gray-200 dark:bg-zinc-700 flex items-center justify-center flex-shrink-0", children: _jsx(User, { className: "size-4 text-gray-500 dark:text-zinc-300" }) }))] }, `${currentConversation}-${message.id}`))) }), _jsx(AnimatePresence, { children: isTyping && (_jsxs(motion.div, { initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0 }, className: "flex gap-2", children: [_jsx("div", { className: "size-8 rounded-full bg-primary/10 flex items-center justify-center", children: _jsx(Bot, { className: "size-4 text-primary" }) }), _jsx("div", { className: "bg-white dark:bg-[#202c33] rounded-2xl rounded-tl-md px-4 py-3 shadow-sm", children: _jsx("div", { className: "flex gap-1", children: [0, 0.15, 0.3].map((d, i) => (_jsx(motion.span, { animate: { opacity: [0.4, 1, 0.4] }, transition: { duration: 0.8, repeat: Infinity, delay: d }, className: "size-2 rounded-full bg-gray-400" }, i))) }) })] })) })] }), _jsxs("div", { className: "bg-white dark:bg-[#0b141a] px-4 py-3 flex items-center gap-3", children: [_jsx("div", { className: "flex-1 bg-gray-100 dark:bg-[#202c33] rounded-full px-4 py-2.5 text-sm text-gray-400", children: "Mensaje..." }), _jsx("div", { className: "size-10 rounded-full bg-primary flex items-center justify-center", children: _jsx("svg", { className: "size-5 text-white ml-0.5", fill: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) }) })] }), _jsx("div", { className: "bg-white dark:bg-[#0b141a] h-7 flex items-center justify-center pb-1", children: _jsx("div", { className: "w-28 h-1 bg-gray-300 dark:bg-zinc-600 rounded-full" }) })] })] }) }) }));
|
|
58
|
+
}
|
|
59
|
+
/** Backwards-compat alias for callers that copied the original ChatMockup. */
|
|
60
|
+
export const ChatMockup = WhatsAppShowcase;
|
|
61
|
+
//# sourceMappingURL=whatsapp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsapp.js","sourceRoot":"","sources":["../../src/showcases/whatsapp.tsx"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,2EAA2E;AAC3E,2EAA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AAK,SAAS,EAAC,0BAA0B,EAAC,IAAI,EAAC,cAAc,EAAC,OAAO,EAAC,WAAW,YAC/E,eAAM,CAAC,EAAC,uCAAuC,GAAG,GAC9C,GACF,IACF,EAGN,cAAK,SAAS,EAAC,sEAAsE,YACnF,cAAK,SAAS,EAAC,oDAAoD,GAAG,GAClE,IACF,IACF,GACK,GACT,CACP,CAAA;AACH,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asteby/metacore-auth",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Metacore auth kit — Zustand store, API client factory, login/signup/forgot pages, guards for TanStack Router",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,14 +43,36 @@
|
|
|
43
43
|
"./components": {
|
|
44
44
|
"types": "./dist/components/index.d.ts",
|
|
45
45
|
"import": "./dist/components/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./showcases": {
|
|
48
|
+
"types": "./dist/showcases/index.d.ts",
|
|
49
|
+
"import": "./dist/showcases/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./showcases/whatsapp": {
|
|
52
|
+
"types": "./dist/showcases/whatsapp.d.ts",
|
|
53
|
+
"import": "./dist/showcases/whatsapp.js"
|
|
54
|
+
},
|
|
55
|
+
"./showcases/marketplace": {
|
|
56
|
+
"types": "./dist/showcases/marketplace.d.ts",
|
|
57
|
+
"import": "./dist/showcases/marketplace.js"
|
|
58
|
+
},
|
|
59
|
+
"./showcases/generic": {
|
|
60
|
+
"types": "./dist/showcases/generic.d.ts",
|
|
61
|
+
"import": "./dist/showcases/generic.js"
|
|
46
62
|
}
|
|
47
63
|
},
|
|
48
64
|
"peerDependencies": {
|
|
49
65
|
"react": ">=18",
|
|
50
66
|
"react-dom": ">=18",
|
|
51
67
|
"@tanstack/react-router": ">=1.100",
|
|
68
|
+
"framer-motion": ">=10",
|
|
52
69
|
"zustand": ">=5",
|
|
53
|
-
"@asteby/metacore-ui": "^0.
|
|
70
|
+
"@asteby/metacore-ui": "^0.6.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"framer-motion": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
54
76
|
},
|
|
55
77
|
"dependencies": {
|
|
56
78
|
"@hookform/resolvers": "^3.9.0",
|
|
@@ -63,11 +85,12 @@
|
|
|
63
85
|
"@types/react": "^19.0.0",
|
|
64
86
|
"@types/react-dom": "^19.0.0",
|
|
65
87
|
"@tanstack/react-router": "^1.168.0",
|
|
88
|
+
"framer-motion": "^11.11.0",
|
|
66
89
|
"react": "^19.2.4",
|
|
67
90
|
"react-dom": "^19.2.4",
|
|
68
91
|
"typescript": "^5.6.0",
|
|
69
92
|
"zustand": "^5.0.0",
|
|
70
|
-
"@asteby/metacore-ui": "0.
|
|
93
|
+
"@asteby/metacore-ui": "0.6.0"
|
|
71
94
|
},
|
|
72
95
|
"publishConfig": {
|
|
73
96
|
"access": "public"
|