@aurora-studio/starter-core 0.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 +5 -0
- package/dist/components/AddToCartButton.d.ts +15 -0
- package/dist/components/AddToCartButton.d.ts.map +1 -0
- package/dist/components/AddToCartButton.js +46 -0
- package/dist/components/AddToCartFly.d.ts +8 -0
- package/dist/components/AddToCartFly.d.ts.map +1 -0
- package/dist/components/AddToCartFly.js +33 -0
- package/dist/components/AuthProvider.d.ts +23 -0
- package/dist/components/AuthProvider.d.ts.map +1 -0
- package/dist/components/AuthProvider.js +79 -0
- package/dist/components/CartLink.d.ts +2 -0
- package/dist/components/CartLink.d.ts.map +1 -0
- package/dist/components/CartLink.js +30 -0
- package/dist/components/CartProvider.d.ts +30 -0
- package/dist/components/CartProvider.d.ts.map +1 -0
- package/dist/components/CartProvider.js +125 -0
- package/dist/components/CatalogueEmptyState.d.ts +11 -0
- package/dist/components/CatalogueEmptyState.d.ts.map +1 -0
- package/dist/components/CatalogueEmptyState.js +12 -0
- package/dist/components/CatalogueFilters.d.ts +24 -0
- package/dist/components/CatalogueFilters.d.ts.map +1 -0
- package/dist/components/CatalogueFilters.js +88 -0
- package/dist/components/CheckoutButton.d.ts +2 -0
- package/dist/components/CheckoutButton.d.ts.map +1 -0
- package/dist/components/CheckoutButton.js +70 -0
- package/dist/components/ConditionalHolmesScript.d.ts +7 -0
- package/dist/components/ConditionalHolmesScript.d.ts.map +1 -0
- package/dist/components/ConditionalHolmesScript.js +17 -0
- package/dist/components/FloatingLabelInput.d.ts +7 -0
- package/dist/components/FloatingLabelInput.d.ts.map +1 -0
- package/dist/components/FloatingLabelInput.js +13 -0
- package/dist/components/HolmesHomeRefresher.d.ts +8 -0
- package/dist/components/HolmesHomeRefresher.d.ts.map +1 -0
- package/dist/components/HolmesHomeRefresher.js +19 -0
- package/dist/components/HolmesProductViewTracker.d.ts +4 -0
- package/dist/components/HolmesProductViewTracker.d.ts.map +1 -0
- package/dist/components/HolmesProductViewTracker.js +39 -0
- package/dist/components/HolmesSprinkleIcon.d.ts +8 -0
- package/dist/components/HolmesSprinkleIcon.d.ts.map +1 -0
- package/dist/components/HolmesSprinkleIcon.js +9 -0
- package/dist/components/HolmesTidbits.d.ts +13 -0
- package/dist/components/HolmesTidbits.d.ts.map +1 -0
- package/dist/components/HolmesTidbits.js +33 -0
- package/dist/components/ProductCardSkeleton.d.ts +3 -0
- package/dist/components/ProductCardSkeleton.d.ts.map +1 -0
- package/dist/components/ProductCardSkeleton.js +5 -0
- package/dist/components/ProductDetailTabs.d.ts +4 -0
- package/dist/components/ProductDetailTabs.d.ts.map +1 -0
- package/dist/components/ProductDetailTabs.js +29 -0
- package/dist/components/ProductImage.d.ts +27 -0
- package/dist/components/ProductImage.d.ts.map +1 -0
- package/dist/components/ProductImage.js +33 -0
- package/dist/components/ProductImageGallery.d.ts +6 -0
- package/dist/components/ProductImageGallery.d.ts.map +1 -0
- package/dist/components/ProductImageGallery.js +25 -0
- package/dist/components/SearchDropdown.d.ts +11 -0
- package/dist/components/SearchDropdown.d.ts.map +1 -0
- package/dist/components/SearchDropdown.js +145 -0
- package/dist/components/SmartCartPanel.d.ts +3 -0
- package/dist/components/SmartCartPanel.d.ts.map +1 -0
- package/dist/components/SmartCartPanel.js +19 -0
- package/dist/components/SortDropdown.d.ts +8 -0
- package/dist/components/SortDropdown.d.ts.map +1 -0
- package/dist/components/SortDropdown.js +25 -0
- package/dist/components/StoreConfigContext.d.ts +6 -0
- package/dist/components/StoreConfigContext.d.ts.map +1 -0
- package/dist/components/StoreConfigContext.js +26 -0
- package/dist/components/StoreContext.d.ts +25 -0
- package/dist/components/StoreContext.d.ts.map +1 -0
- package/dist/components/StoreContext.js +73 -0
- package/dist/components/StoreContextBar.d.ts +2 -0
- package/dist/components/StoreContextBar.d.ts.map +1 -0
- package/dist/components/StoreContextBar.js +12 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/lib/aurora.d.ts +119 -0
- package/dist/lib/aurora.d.ts.map +1 -0
- package/dist/lib/aurora.js +235 -0
- package/dist/lib/format-price.d.ts +10 -0
- package/dist/lib/format-price.d.ts.map +1 -0
- package/dist/lib/format-price.js +18 -0
- package/dist/lib/holmes-events.d.ts +53 -0
- package/dist/lib/holmes-events.d.ts.map +1 -0
- package/dist/lib/holmes-events.js +73 -0
- package/dist/lib/image-url.d.ts +23 -0
- package/dist/lib/image-url.d.ts.map +1 -0
- package/dist/lib/image-url.js +70 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +9 -0
- package/package.json +56 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartCartPanel.d.ts","sourceRoot":"","sources":["../../src/components/SmartCartPanel.tsx"],"names":[],"mappings":"AAUA,mEAAmE;AACnE,wBAAgB,cAAc,mDA0C7B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { useCart } from "./CartProvider";
|
|
5
|
+
import { formatPrice } from "../lib/format-price";
|
|
6
|
+
import { ShoppingBag } from "lucide-react";
|
|
7
|
+
const SHIPPING_CENTS = 250;
|
|
8
|
+
const FREE_DELIVERY_THRESHOLD_CENTS = 2500; // £25
|
|
9
|
+
/** Persistent smart cart panel - bridges browsing to conversion */
|
|
10
|
+
export function SmartCartPanel() {
|
|
11
|
+
const { items, total } = useCart();
|
|
12
|
+
const count = items.reduce((s, i) => s + i.quantity, 0);
|
|
13
|
+
const shipping = count > 0 ? SHIPPING_CENTS : 0;
|
|
14
|
+
const grandTotal = total + shipping;
|
|
15
|
+
const toFreeDelivery = Math.max(0, FREE_DELIVERY_THRESHOLD_CENTS - total);
|
|
16
|
+
if (count === 0)
|
|
17
|
+
return null;
|
|
18
|
+
return (_jsx("div", { className: "sticky bottom-0 z-40 mt-10 p-5 rounded-2xl bg-aurora-surface border border-aurora-border shadow-xl shadow-aurora-primary/5", children: _jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("span", { className: "flex items-center justify-center w-12 h-12 rounded-2xl bg-aurora-primary/15 text-aurora-primary", children: _jsx(ShoppingBag, { className: "w-6 h-6" }) }), _jsxs("div", { children: [_jsxs("p", { className: "font-semibold text-aurora-text text-lg", children: [count, " ", count === 1 ? "item" : "items", " \u00B7 ", formatPrice(grandTotal)] }), toFreeDelivery > 0 && (_jsxs("p", { className: "text-sm text-aurora-primary font-medium mt-0.5", children: ["Add ", formatPrice(toFreeDelivery), " more for free delivery"] })), toFreeDelivery <= 0 && total > 0 && (_jsx("p", { className: "text-sm text-aurora-primary font-medium mt-0.5", children: "You've unlocked free delivery" }))] })] }), _jsx(Link, { href: "/cart", className: "inline-flex items-center justify-center px-8 py-3.5 rounded-2xl bg-aurora-primary text-white font-semibold hover:bg-aurora-primary-dark transition-colors shrink-0 shadow-lg shadow-aurora-primary/25", children: "View cart \u00B7 Checkout" })] }) }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SortOption } from "./CatalogueFilters";
|
|
2
|
+
type SortDropdownProps = {
|
|
3
|
+
value: SortOption;
|
|
4
|
+
onChange: (sort: SortOption) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function SortDropdown({ value, onChange }: SortDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=SortDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortDropdown.d.ts","sourceRoot":"","sources":["../../src/components/SortDropdown.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAiDlE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect } from "react";
|
|
4
|
+
import { ChevronDown } from "lucide-react";
|
|
5
|
+
import { SORT_OPTIONS } from "./CatalogueFilters";
|
|
6
|
+
export function SortDropdown({ value, onChange }) {
|
|
7
|
+
const [open, setOpen] = useState(false);
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
const currentLabel = SORT_OPTIONS.find((o) => o.id === value)?.label ?? "Featured";
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
function handleClickOutside(e) {
|
|
12
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
13
|
+
setOpen(false);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
17
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
18
|
+
}, []);
|
|
19
|
+
return (_jsxs("div", { ref: ref, className: "relative", children: [_jsxs("button", { type: "button", onClick: () => setOpen((o) => !o), className: "flex items-center gap-1.5 px-4 py-2 rounded-xl border border-aurora-border bg-aurora-surface text-sm font-medium text-aurora-text hover:border-aurora-primary/40 transition-colors", children: [currentLabel, _jsx(ChevronDown, { className: `w-4 h-4 text-aurora-muted transition-transform ${open ? "rotate-180" : ""}` })] }), open && (_jsx("div", { className: "absolute top-full right-0 mt-1 py-1 rounded-xl bg-aurora-surface border border-aurora-border shadow-xl min-w-[180px] z-50", children: SORT_OPTIONS.map((opt) => (_jsx("button", { type: "button", onClick: () => {
|
|
20
|
+
onChange(opt.id);
|
|
21
|
+
setOpen(false);
|
|
22
|
+
}, className: `w-full text-left px-4 py-2.5 text-sm font-medium transition-colors ${value === opt.id
|
|
23
|
+
? "text-aurora-primary bg-aurora-accent/10"
|
|
24
|
+
: "text-aurora-muted hover:text-aurora-text hover:bg-aurora-surface-hover"}`, children: opt.label }, opt.id))) }))] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare function StoreConfigProvider({ children }: {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function useStoreConfigImageBase(): string | null;
|
|
6
|
+
//# sourceMappingURL=StoreConfigContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoreConfigContext.d.ts","sourceRoot":"","sources":["../../src/components/StoreConfigContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAqBxE;AAED,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAGvD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useEffect, useState, } from "react";
|
|
4
|
+
import { getStoreConfig } from "../lib/aurora";
|
|
5
|
+
const StoreConfigContext = createContext(null);
|
|
6
|
+
export function StoreConfigProvider({ children }) {
|
|
7
|
+
const [imageBaseUrl, setImageBaseUrl] = useState(null);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
let cancelled = false;
|
|
10
|
+
getStoreConfig()
|
|
11
|
+
.then((config) => {
|
|
12
|
+
if (!cancelled && config) {
|
|
13
|
+
const base = config.imageBaseUrl;
|
|
14
|
+
if (typeof base === "string")
|
|
15
|
+
setImageBaseUrl(base);
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
.catch(() => { });
|
|
19
|
+
return () => { cancelled = true; };
|
|
20
|
+
}, []);
|
|
21
|
+
return (_jsx(StoreConfigContext.Provider, { value: { imageBaseUrl }, children: children }));
|
|
22
|
+
}
|
|
23
|
+
export function useStoreConfigImageBase() {
|
|
24
|
+
const ctx = useContext(StoreConfigContext);
|
|
25
|
+
return ctx?.imageBaseUrl ?? null;
|
|
26
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface UserLocation {
|
|
3
|
+
lat: number;
|
|
4
|
+
lng: number;
|
|
5
|
+
address?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SelectedStore {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
email?: string;
|
|
11
|
+
address?: string;
|
|
12
|
+
image_url?: string;
|
|
13
|
+
}
|
|
14
|
+
interface StoreContextValue {
|
|
15
|
+
location: UserLocation | null;
|
|
16
|
+
setLocation: (loc: UserLocation) => void;
|
|
17
|
+
store: SelectedStore | null;
|
|
18
|
+
setStore: (store: SelectedStore | null) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function StoreProvider({ children }: {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function useStore(): StoreContextValue;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=StoreContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoreContext.d.ts","sourceRoot":"","sources":["../../src/components/StoreContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuCD,UAAU,iBAAiB;IACzB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC;CACjD;AAID,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAiClE;AAED,wBAAgB,QAAQ,sBAIvB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useCallback, useState, useEffect, } from "react";
|
|
4
|
+
const LOCATION_KEY = "aurora-location";
|
|
5
|
+
const STORE_KEY = "aurora-selected-store";
|
|
6
|
+
function loadLocation() {
|
|
7
|
+
if (typeof window === "undefined")
|
|
8
|
+
return null;
|
|
9
|
+
try {
|
|
10
|
+
const stored = localStorage.getItem(LOCATION_KEY);
|
|
11
|
+
return stored ? JSON.parse(stored) : null;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function saveLocation(loc) {
|
|
18
|
+
if (typeof window === "undefined")
|
|
19
|
+
return;
|
|
20
|
+
localStorage.setItem(LOCATION_KEY, JSON.stringify(loc));
|
|
21
|
+
}
|
|
22
|
+
function loadStore() {
|
|
23
|
+
if (typeof window === "undefined")
|
|
24
|
+
return null;
|
|
25
|
+
try {
|
|
26
|
+
const stored = localStorage.getItem(STORE_KEY);
|
|
27
|
+
return stored ? JSON.parse(stored) : null;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function saveStore(store) {
|
|
34
|
+
if (typeof window === "undefined")
|
|
35
|
+
return;
|
|
36
|
+
if (store) {
|
|
37
|
+
localStorage.setItem(STORE_KEY, JSON.stringify(store));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
localStorage.removeItem(STORE_KEY);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const StoreContext = createContext(null);
|
|
44
|
+
export function StoreProvider({ children }) {
|
|
45
|
+
const [location, setLocationState] = useState(null);
|
|
46
|
+
const [store, setStoreState] = useState(null);
|
|
47
|
+
const [mounted, setMounted] = useState(false);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setLocationState(loadLocation());
|
|
50
|
+
setStoreState(loadStore());
|
|
51
|
+
setMounted(true);
|
|
52
|
+
}, []);
|
|
53
|
+
const setLocation = useCallback((loc) => {
|
|
54
|
+
setLocationState(loc);
|
|
55
|
+
saveLocation(loc);
|
|
56
|
+
}, []);
|
|
57
|
+
const setStore = useCallback((s) => {
|
|
58
|
+
setStoreState(s);
|
|
59
|
+
saveStore(s);
|
|
60
|
+
}, []);
|
|
61
|
+
return (_jsx(StoreContext.Provider, { value: {
|
|
62
|
+
location: mounted ? location : null,
|
|
63
|
+
setLocation,
|
|
64
|
+
store: mounted ? store : null,
|
|
65
|
+
setStore,
|
|
66
|
+
}, children: children }));
|
|
67
|
+
}
|
|
68
|
+
export function useStore() {
|
|
69
|
+
const ctx = useContext(StoreContext);
|
|
70
|
+
if (!ctx)
|
|
71
|
+
throw new Error("useStore must be used within StoreProvider");
|
|
72
|
+
return ctx;
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoreContextBar.d.ts","sourceRoot":"","sources":["../../src/components/StoreContextBar.tsx"],"names":[],"mappings":"AAMA,wBAAgB,eAAe,4CA4C9B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { Store, MapPin } from "lucide-react";
|
|
5
|
+
import { useStore } from "./StoreContext";
|
|
6
|
+
export function StoreContextBar() {
|
|
7
|
+
const { store } = useStore();
|
|
8
|
+
if (store) {
|
|
9
|
+
return (_jsx("div", { className: "border-b border-aurora-border bg-aurora-bg px-4 py-2.5", children: _jsxs("div", { className: "max-w-6xl mx-auto flex items-center justify-between gap-4", children: [_jsxs("div", { className: "flex items-center gap-2 text-sm text-aurora-muted", children: [_jsx(Store, { className: "w-4 h-4 shrink-0" }), _jsxs("span", { children: ["Shopping from: ", store.name] }), _jsx(Link, { href: "/stores", className: "text-aurora-primary hover:underline ml-1 font-medium", children: "View Store Details" })] }), _jsx(Link, { href: "/stores", className: "text-sm font-medium text-aurora-primary hover:underline", children: "Change Store" })] }) }));
|
|
10
|
+
}
|
|
11
|
+
return (_jsx("div", { className: "border-b border-aurora-border bg-aurora-primary/10 px-4 py-3", children: _jsxs("div", { className: "max-w-6xl mx-auto flex flex-wrap items-center justify-between gap-3", children: [_jsx("p", { className: "text-sm text-aurora-text font-medium", children: "Select a store to search products and see availability." }), _jsxs(Link, { href: "/location", className: "inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-aurora-primary text-white font-semibold text-sm hover:bg-aurora-primary-dark transition-colors", children: [_jsx(MapPin, { className: "w-4 h-4 shrink-0" }), "Set location & choose store"] })] }) }));
|
|
12
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Shared libs */
|
|
2
|
+
export * from "./lib/aurora";
|
|
3
|
+
export * from "./lib/format-price";
|
|
4
|
+
export * from "./lib/image-url";
|
|
5
|
+
export * from "./lib/utils";
|
|
6
|
+
export * from "./lib/holmes-events";
|
|
7
|
+
/** Components */
|
|
8
|
+
export * from "./components/AddToCartButton";
|
|
9
|
+
export * from "./components/AddToCartFly";
|
|
10
|
+
export * from "./components/AuthProvider";
|
|
11
|
+
export * from "./components/CartLink";
|
|
12
|
+
export * from "./components/CartProvider";
|
|
13
|
+
export * from "./components/CatalogueEmptyState";
|
|
14
|
+
export * from "./components/CatalogueFilters";
|
|
15
|
+
export * from "./components/CheckoutButton";
|
|
16
|
+
export * from "./components/ConditionalHolmesScript";
|
|
17
|
+
export * from "./components/FloatingLabelInput";
|
|
18
|
+
export * from "./components/HolmesHomeRefresher";
|
|
19
|
+
export * from "./components/HolmesProductViewTracker";
|
|
20
|
+
export * from "./components/HolmesSprinkleIcon";
|
|
21
|
+
export * from "./components/HolmesTidbits";
|
|
22
|
+
export * from "./components/ProductCardSkeleton";
|
|
23
|
+
export * from "./components/ProductDetailTabs";
|
|
24
|
+
export * from "./components/ProductImage";
|
|
25
|
+
export * from "./components/ProductImageGallery";
|
|
26
|
+
export * from "./components/SearchDropdown";
|
|
27
|
+
export * from "./components/SmartCartPanel";
|
|
28
|
+
export * from "./components/SortDropdown";
|
|
29
|
+
export * from "./components/StoreConfigContext";
|
|
30
|
+
export * from "./components/StoreContext";
|
|
31
|
+
export * from "./components/StoreContextBar";
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AAEpC,iBAAiB;AACjB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Shared libs */
|
|
2
|
+
export * from "./lib/aurora";
|
|
3
|
+
export * from "./lib/format-price";
|
|
4
|
+
export * from "./lib/image-url";
|
|
5
|
+
export * from "./lib/utils";
|
|
6
|
+
export * from "./lib/holmes-events";
|
|
7
|
+
/** Components */
|
|
8
|
+
export * from "./components/AddToCartButton";
|
|
9
|
+
export * from "./components/AddToCartFly";
|
|
10
|
+
export * from "./components/AuthProvider";
|
|
11
|
+
export * from "./components/CartLink";
|
|
12
|
+
export * from "./components/CartProvider";
|
|
13
|
+
export * from "./components/CatalogueEmptyState";
|
|
14
|
+
export * from "./components/CatalogueFilters";
|
|
15
|
+
export * from "./components/CheckoutButton";
|
|
16
|
+
export * from "./components/ConditionalHolmesScript";
|
|
17
|
+
export * from "./components/FloatingLabelInput";
|
|
18
|
+
export * from "./components/HolmesHomeRefresher";
|
|
19
|
+
export * from "./components/HolmesProductViewTracker";
|
|
20
|
+
export * from "./components/HolmesSprinkleIcon";
|
|
21
|
+
export * from "./components/HolmesTidbits";
|
|
22
|
+
export * from "./components/ProductCardSkeleton";
|
|
23
|
+
export * from "./components/ProductDetailTabs";
|
|
24
|
+
export * from "./components/ProductImage";
|
|
25
|
+
export * from "./components/ProductImageGallery";
|
|
26
|
+
export * from "./components/SearchDropdown";
|
|
27
|
+
export * from "./components/SmartCartPanel";
|
|
28
|
+
export * from "./components/SortDropdown";
|
|
29
|
+
export * from "./components/StoreConfigContext";
|
|
30
|
+
export * from "./components/StoreContext";
|
|
31
|
+
export * from "./components/StoreContextBar";
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { AuroraClient, type SearchParams, type SearchResult, type SearchHit, type DeliverySlot, type StoreItem, type CheckoutLineItem, type CreateCheckoutSessionParams, type CheckoutSessionResult, type AcmeSession, type HolmesInferResult, type HolmesRecipe, type HolmesTidbit, type HolmesContextualHintResult, type HomePersonalizationResult } from "@aurora-studio/sdk";
|
|
2
|
+
export declare function createAuroraClient(): AuroraClient;
|
|
3
|
+
export declare function getApiBase(): string;
|
|
4
|
+
export declare function getTenantSlug(): string;
|
|
5
|
+
/** Store config - safe for client: fetches via /api/store/config (keeps API key server-side). */
|
|
6
|
+
export declare function getStoreConfig(): Promise<{
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
catalogTableSlug?: string;
|
|
9
|
+
categoryTableSlug?: string;
|
|
10
|
+
currency?: string;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
} | null>;
|
|
13
|
+
export type { SearchParams, SearchResult, SearchHit, DeliverySlot, StoreItem };
|
|
14
|
+
export type { CheckoutLineItem, CreateCheckoutSessionParams, CheckoutSessionResult, AcmeSession, HolmesInferResult, HolmesRecipe, HolmesTidbit, HolmesContextualHintResult, HomePersonalizationResult, };
|
|
15
|
+
/** Extended search params including dietary exclusions (for storefront filtering). */
|
|
16
|
+
export type StoreSearchParams = SearchParams & {
|
|
17
|
+
excludeDietary?: string[];
|
|
18
|
+
};
|
|
19
|
+
/** Meilisearch-powered product search. Uses API route from client (keeps API key server-side). */
|
|
20
|
+
export declare function search(params: StoreSearchParams): Promise<SearchResult>;
|
|
21
|
+
/** Fetch delivery slots for a location */
|
|
22
|
+
export declare function getDeliverySlots(lat: number, lng: number): Promise<{
|
|
23
|
+
data: DeliverySlot[];
|
|
24
|
+
}>;
|
|
25
|
+
/** List stores/vendors */
|
|
26
|
+
export declare function getStores(): Promise<{
|
|
27
|
+
data: StoreItem[];
|
|
28
|
+
}>;
|
|
29
|
+
/** Create checkout session (Stripe or ACME) */
|
|
30
|
+
export declare function createCheckoutSession(params: CreateCheckoutSessionParams): Promise<CheckoutSessionResult>;
|
|
31
|
+
/** Fetch ACME checkout session */
|
|
32
|
+
export declare function getAcmeSession(sessionId: string): Promise<AcmeSession>;
|
|
33
|
+
/** Complete ACME checkout */
|
|
34
|
+
export declare function completeAcmeCheckout(sessionId: string, shippingAddress?: {
|
|
35
|
+
line1?: string;
|
|
36
|
+
line2?: string;
|
|
37
|
+
city?: string;
|
|
38
|
+
postal_code?: string;
|
|
39
|
+
country?: string;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
redirectUrl?: string;
|
|
43
|
+
}>;
|
|
44
|
+
/** Holmes mission inference */
|
|
45
|
+
export declare function holmesInfer(sessionId: string): Promise<HolmesInferResult>;
|
|
46
|
+
/** Holmes insights: products for a recipe (paella, curry, pasta). Uses holmes_insights.recipe_ideas. */
|
|
47
|
+
export declare function holmesRecipeProducts(recipe: string, limit?: number, opts?: {
|
|
48
|
+
excludeDietary?: string[];
|
|
49
|
+
}): Promise<{
|
|
50
|
+
products: SearchHit[];
|
|
51
|
+
total: number;
|
|
52
|
+
recipe: string;
|
|
53
|
+
}>;
|
|
54
|
+
/** Holmes recent recipes from cache. Ordered by most recently updated. Optional timeOfDay filters by morning/afternoon/evening. excludeDietary filters out recipes whose ingredients match excluded types. */
|
|
55
|
+
export declare function holmesRecentRecipes(limit?: number, timeOfDay?: "morning" | "afternoon" | "evening", opts?: {
|
|
56
|
+
excludeDietary?: string[];
|
|
57
|
+
}): Promise<{
|
|
58
|
+
recipes: Array<{
|
|
59
|
+
id: string;
|
|
60
|
+
slug: string;
|
|
61
|
+
title: string;
|
|
62
|
+
description: string | null;
|
|
63
|
+
}>;
|
|
64
|
+
}>;
|
|
65
|
+
/** Holmes cached recipe. Fetches via AI on cache miss. */
|
|
66
|
+
export declare function holmesRecipe(slug: string): Promise<HolmesRecipe | null>;
|
|
67
|
+
/** Holmes tidbits for entity (recipe, ingredient, product). */
|
|
68
|
+
export declare function holmesTidbits(entity: string, entityType?: string): Promise<{
|
|
69
|
+
tidbits: HolmesTidbit[];
|
|
70
|
+
}>;
|
|
71
|
+
/** Holmes insights: products that go well with a given product. Uses holmes_insights.goes_well_with. */
|
|
72
|
+
export declare function holmesGoesWith(productId: string, limit?: number, opts?: {
|
|
73
|
+
excludeDietary?: string[];
|
|
74
|
+
}): Promise<{
|
|
75
|
+
products: SearchHit[];
|
|
76
|
+
total: number;
|
|
77
|
+
}>;
|
|
78
|
+
/** Holmes bundle/recipe options for cart. Returns 1–3 combos when cart has 2+ items. */
|
|
79
|
+
export declare function holmesCombosForCart(params: {
|
|
80
|
+
cartIds: string[];
|
|
81
|
+
cartNames?: string[];
|
|
82
|
+
limit?: number;
|
|
83
|
+
sid?: string;
|
|
84
|
+
}): Promise<{
|
|
85
|
+
combos: Array<{
|
|
86
|
+
slug: string;
|
|
87
|
+
title: string;
|
|
88
|
+
productImageUrls?: string[];
|
|
89
|
+
}>;
|
|
90
|
+
}>;
|
|
91
|
+
/** Set selected combo for session (from recipe picker). */
|
|
92
|
+
export declare function holmesSelectCombo(params: {
|
|
93
|
+
sid: string;
|
|
94
|
+
slug: string;
|
|
95
|
+
title?: string;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
ok: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
/** Holmes insights: similar products by type (what_it_is). For substitutions - same product type, not complementary. */
|
|
100
|
+
export declare function holmesSimilarProducts(productId: string, limit?: number, productName?: string, opts?: {
|
|
101
|
+
excludeDietary?: string[];
|
|
102
|
+
}): Promise<{
|
|
103
|
+
products: SearchHit[];
|
|
104
|
+
total: number;
|
|
105
|
+
}>;
|
|
106
|
+
/** Home personalization - sections for SSR fallback. sid optional (omit for default sections). excludeDietary filters products and sections by dietary preferences. */
|
|
107
|
+
export declare function getHomePersonalization(sid?: string, opts?: {
|
|
108
|
+
excludeDietary?: string[];
|
|
109
|
+
}): Promise<HomePersonalizationResult | null>;
|
|
110
|
+
/** Current user metadata and related data (e.g. addresses) when userId is provided. Uses GET /me from tenant spec. */
|
|
111
|
+
export declare function getMe(userId?: string): Promise<{
|
|
112
|
+
tenantId: string;
|
|
113
|
+
user?: {
|
|
114
|
+
id: string;
|
|
115
|
+
};
|
|
116
|
+
addresses?: unknown[];
|
|
117
|
+
[key: string]: unknown;
|
|
118
|
+
}>;
|
|
119
|
+
//# sourceMappingURL=aurora.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aurora.d.ts","sourceRoot":"","sources":["../../src/lib/aurora.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC/B,MAAM,oBAAoB,CAAC;AAe5B,wBAAgB,kBAAkB,IAAI,YAAY,CAOjD;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,iGAAiG;AACjG,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,M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