@tapcart/mobile-components 0.7.20 → 0.7.21
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/dist/components/contexts/translationContext.d.ts +9 -0
- package/dist/components/contexts/translationContext.d.ts.map +1 -0
- package/dist/components/contexts/translationContext.js +5 -0
- package/dist/components/hooks/use-destination.d.ts +23 -0
- package/dist/components/hooks/use-destination.d.ts.map +1 -0
- package/dist/components/hooks/use-destination.js +13 -0
- package/dist/components/hooks/use-mock-products.d.ts +17 -0
- package/dist/components/hooks/use-mock-products.d.ts.map +1 -0
- package/dist/components/hooks/use-mock-products.js +37 -0
- package/dist/components/hooks/use-products.js +1 -1
- package/dist/components/ui/use-tap.d.ts +8 -0
- package/dist/components/ui/use-tap.d.ts.map +1 -0
- package/dist/components/ui/use-tap.js +100 -0
- package/dist/components/ui/video copy.d.ts +18 -0
- package/dist/components/ui/video copy.d.ts.map +1 -0
- package/dist/components/ui/video copy.js +70 -0
- package/dist/components/ui/video.v2.d.ts +18 -0
- package/dist/components/ui/video.v2.d.ts.map +1 -0
- package/dist/components/ui/video.v2.js +70 -0
- package/dist/index copy.d.ts +59 -0
- package/dist/index copy.d.ts.map +1 -0
- package/dist/index copy.js +59 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/utils/destination.d.ts +17 -0
- package/dist/lib/utils/destination.d.ts.map +1 -0
- package/dist/lib/utils/destination.js +15 -0
- package/dist/lib/utils/id.d.ts +5 -0
- package/dist/lib/utils/id.d.ts.map +1 -0
- package/dist/lib/utils/id.js +29 -0
- package/dist/lib/utils/index.d.ts +18 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +55 -0
- package/dist/lib/utils/misc.d.ts +1 -0
- package/dist/lib/utils/misc.d.ts.map +1 -0
- package/dist/lib/utils/misc.js +1 -0
- package/dist/lib/utils/style.d.ts +154 -0
- package/dist/lib/utils/style.d.ts.map +1 -0
- package/dist/lib/utils/style.js +148 -0
- package/dist/lib/utils.deprecated.d.ts +181 -0
- package/dist/lib/utils.deprecated.d.ts.map +1 -0
- package/dist/lib/utils.deprecated.js +222 -0
- package/dist/styles.css +0 -3
- package/dist/v2.d.ts +59 -0
- package/dist/v2.d.ts.map +1 -0
- package/dist/v2.js +59 -0
- package/package.json +18 -18
- package/dist/components/ui/input.d.ts +0 -17
- package/dist/components/ui/input.d.ts.map +0 -1
- package/dist/components/ui/input.js +0 -35
- package/dist/components/ui/product-grid.d.ts +0 -15
- package/dist/components/ui/product-grid.d.ts.map +0 -1
- package/dist/components/ui/product-grid.js +0 -22
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type TranslationMap = Record<string, string>;
|
|
3
|
+
export declare const TranslationProvider: ({ translations, children, }: {
|
|
4
|
+
translations: TranslationMap;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const useTranslation: () => TranslationMap;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=translationContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translationContext.d.ts","sourceRoot":"","sources":["../../../components/contexts/translationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAA;AAExD,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAI5C,eAAO,MAAM,mBAAmB;kBAIhB,cAAc;cAClB,MAAM,SAAS;6CAK1B,CAAA;AAED,eAAO,MAAM,cAAc,sBAAuC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const TranslationContext = createContext({});
|
|
4
|
+
export const TranslationProvider = ({ translations, children, }) => (_jsx(TranslationContext.Provider, Object.assign({ value: translations }, { children: children })));
|
|
5
|
+
export const useTranslation = () => useContext(TranslationContext);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type OpenProductFn = (arg: {
|
|
2
|
+
productId: string;
|
|
3
|
+
}) => void;
|
|
4
|
+
type OpenCollectionFn = (arg: {
|
|
5
|
+
collectionId: string;
|
|
6
|
+
}) => void;
|
|
7
|
+
type OpenScreenFn = (arg: {
|
|
8
|
+
destination: {
|
|
9
|
+
type: "internal" | "web";
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
}) => void;
|
|
13
|
+
type DestinationType = "product" | "collection" | "url" | "app-screen";
|
|
14
|
+
interface UseDestinationProps {
|
|
15
|
+
openProduct: OpenProductFn;
|
|
16
|
+
openCollection: OpenCollectionFn;
|
|
17
|
+
openScreen: OpenScreenFn;
|
|
18
|
+
type: DestinationType;
|
|
19
|
+
location: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const useDestination: ({ openProduct, openCollection, openScreen, type, location, }: UseDestinationProps) => (() => void);
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=use-destination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-destination.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-destination.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,GAAG,CAAC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,CAAA;AACzD,KAAK,gBAAgB,GAAG,CAAC,GAAG,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,CAAA;AAC/D,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE;IACxB,WAAW,EAAE;QAAE,IAAI,EAAE,UAAU,GAAG,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CACvD,KAAK,IAAI,CAAA;AAEV,KAAK,eAAe,GAAG,SAAS,GAAG,YAAY,GAAG,KAAK,GAAG,YAAY,CAAA;AAEtE,UAAU,mBAAmB;IAC3B,WAAW,EAAE,aAAa,CAAA;IAC1B,cAAc,EAAE,gBAAgB,CAAA;IAChC,UAAU,EAAE,YAAY,CAAA;IACxB,IAAI,EAAE,eAAe,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,cAAc,iEAMxB,mBAAmB,KAAG,CAAC,MAAM,IAAI,CAYnC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export const useDestination = ({ openProduct, openCollection, openScreen, type, location, }) => {
|
|
3
|
+
switch (type) {
|
|
4
|
+
case "product":
|
|
5
|
+
return () => openProduct({ productId: location });
|
|
6
|
+
case "collection":
|
|
7
|
+
return () => openCollection({ collectionId: location });
|
|
8
|
+
case "url":
|
|
9
|
+
return () => openScreen({ destination: { type: "web", url: location } });
|
|
10
|
+
case "app-screen":
|
|
11
|
+
return () => openScreen({ destination: { type: "internal", url: location } });
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Product } from "app-studio-types";
|
|
2
|
+
type UseProductMockParams = {
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
appId: string;
|
|
5
|
+
language: string;
|
|
6
|
+
country: string;
|
|
7
|
+
limit?: number;
|
|
8
|
+
onlyAvailableProducts?: boolean;
|
|
9
|
+
mock?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function useMockProducts({ apiUrl, appId, language, country, limit, onlyAvailableProducts, mock, }: UseProductMockParams): {
|
|
12
|
+
products: Product[];
|
|
13
|
+
error: any;
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=use-mock-products.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mock-products.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-mock-products.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAI1C,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,KAAS,EACT,qBAA6B,EAC7B,IAAY,GACb,EAAE,oBAAoB;;;;EAkCtB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCollection } from "./use-collection";
|
|
3
|
+
import { useProducts } from "./use-products";
|
|
4
|
+
export function useMockProducts({ apiUrl, appId, language, country, limit = 4, onlyAvailableProducts = false, mock = false, }) {
|
|
5
|
+
var _a;
|
|
6
|
+
const { collections } = useCollection({
|
|
7
|
+
apiUrl,
|
|
8
|
+
appId,
|
|
9
|
+
language,
|
|
10
|
+
collectionId: undefined,
|
|
11
|
+
getCollections: mock,
|
|
12
|
+
limit: 1,
|
|
13
|
+
});
|
|
14
|
+
const collectionToFetchID = (_a = collections[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
15
|
+
const { products, error, isLoading } = useProducts({
|
|
16
|
+
productIds: [],
|
|
17
|
+
productHandles: [],
|
|
18
|
+
baseURL: apiUrl,
|
|
19
|
+
collection: collectionToFetchID,
|
|
20
|
+
queryVariables: {
|
|
21
|
+
collectionId: collectionToFetchID,
|
|
22
|
+
appId,
|
|
23
|
+
language,
|
|
24
|
+
country,
|
|
25
|
+
limit,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
products: products === null || products === void 0 ? void 0 : products.filter((p) => {
|
|
30
|
+
if (!onlyAvailableProducts)
|
|
31
|
+
return true;
|
|
32
|
+
return p.availableForSale;
|
|
33
|
+
}),
|
|
34
|
+
error,
|
|
35
|
+
isLoading,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -41,7 +41,7 @@ export function useProducts(props) {
|
|
|
41
41
|
const fetcher = (props === null || props === void 0 ? void 0 : props.fetcher) || defaultFetcher;
|
|
42
42
|
const { data, error } = useSWR(url ? [url, body] : null, ([url, body]) => fetcher(url, body));
|
|
43
43
|
return {
|
|
44
|
-
products: data || [],
|
|
44
|
+
products: (data === null || data === void 0 ? void 0 : data.products) ? data.products : data || [],
|
|
45
45
|
error,
|
|
46
46
|
isLoading: !data && !error,
|
|
47
47
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const useTap: (tapThreshold?: number) => {
|
|
3
|
+
onTap: (handler: (event: any) => void) => (event: any) => void;
|
|
4
|
+
isPressed: boolean;
|
|
5
|
+
ref: React.MutableRefObject<null>;
|
|
6
|
+
};
|
|
7
|
+
export { useTap };
|
|
8
|
+
//# sourceMappingURL=use-tap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tap.d.ts","sourceRoot":"","sources":["../../../components/ui/use-tap.ts"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAuFvE,QAAA,MAAM,MAAM;6BAuBkC,GAAG,KAAK,IAAI,aACvC,GAAG;;;CAerB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useEffect, useCallback, useRef } from "react";
|
|
3
|
+
// Shared manager for all instances of the hook
|
|
4
|
+
const tapManager = (() => {
|
|
5
|
+
const elements = new Map();
|
|
6
|
+
let isListening = false;
|
|
7
|
+
const startListening = () => {
|
|
8
|
+
if (isListening)
|
|
9
|
+
return;
|
|
10
|
+
const handleTouchStart = (e) => {
|
|
11
|
+
const touch = e.touches[0];
|
|
12
|
+
elements.forEach((data, el) => {
|
|
13
|
+
if (el.contains(touch.target)) {
|
|
14
|
+
data.touchStarted = true;
|
|
15
|
+
data.touchMoved = false;
|
|
16
|
+
data.startPosition = { x: touch.clientX, y: touch.clientY };
|
|
17
|
+
// Don't set isPressed here, wait to determine if it's a tap or drag
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const handleTouchMove = (e) => {
|
|
22
|
+
const touch = e.touches[0];
|
|
23
|
+
elements.forEach((data, el) => {
|
|
24
|
+
if (data.touchStarted) {
|
|
25
|
+
const deltaX = Math.abs(touch.clientX - data.startPosition.x);
|
|
26
|
+
const deltaY = Math.abs(touch.clientY - data.startPosition.y);
|
|
27
|
+
if (deltaX > data.tapThreshold || deltaY > data.tapThreshold) {
|
|
28
|
+
data.touchMoved = true;
|
|
29
|
+
data.setIsPressed(false);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const handleTouchEnd = () => {
|
|
35
|
+
elements.forEach((data) => {
|
|
36
|
+
if (data.touchStarted) {
|
|
37
|
+
data.touchStarted = false;
|
|
38
|
+
if (!data.touchMoved) {
|
|
39
|
+
// It's a tap, set isPressed briefly
|
|
40
|
+
data.setIsPressed(true);
|
|
41
|
+
setTimeout(() => data.setIsPressed(false), 100);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
document.addEventListener("touchstart", (e) => handleTouchStart(e), { passive: true });
|
|
47
|
+
document.addEventListener("touchmove", (e) => handleTouchMove(e), { passive: true });
|
|
48
|
+
document.addEventListener("touchend", () => handleTouchEnd(), {
|
|
49
|
+
passive: true,
|
|
50
|
+
});
|
|
51
|
+
isListening = true;
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
register: (el, data) => {
|
|
55
|
+
elements.set(el, data);
|
|
56
|
+
startListening();
|
|
57
|
+
},
|
|
58
|
+
unregister: (el) => {
|
|
59
|
+
elements.delete(el);
|
|
60
|
+
},
|
|
61
|
+
elements,
|
|
62
|
+
};
|
|
63
|
+
})();
|
|
64
|
+
const useTap = (tapThreshold = 10) => {
|
|
65
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
66
|
+
const elementRef = useRef(null);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const element = elementRef.current;
|
|
69
|
+
if (!element)
|
|
70
|
+
return;
|
|
71
|
+
const data = {
|
|
72
|
+
touchStarted: false,
|
|
73
|
+
touchMoved: false,
|
|
74
|
+
startPosition: { x: 0, y: 0 },
|
|
75
|
+
setIsPressed,
|
|
76
|
+
tapThreshold,
|
|
77
|
+
};
|
|
78
|
+
tapManager.register(element, data);
|
|
79
|
+
return () => {
|
|
80
|
+
tapManager.unregister(element);
|
|
81
|
+
};
|
|
82
|
+
}, [tapThreshold]);
|
|
83
|
+
const onTap = useCallback((handler) => {
|
|
84
|
+
return (event) => {
|
|
85
|
+
const data = tapManager.elements.get(elementRef.current);
|
|
86
|
+
if (!data)
|
|
87
|
+
return;
|
|
88
|
+
if (event.type === "touchend" && !data.touchMoved) {
|
|
89
|
+
handler(event);
|
|
90
|
+
}
|
|
91
|
+
else if (event.type === "click" && !data.touchStarted) {
|
|
92
|
+
handler(event);
|
|
93
|
+
setIsPressed(true);
|
|
94
|
+
setTimeout(() => setIsPressed(false), 100);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}, []);
|
|
98
|
+
return { onTap, isPressed, ref: elementRef };
|
|
99
|
+
};
|
|
100
|
+
export { useTap };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type VideoAttributes = {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
aspectRatio: string;
|
|
5
|
+
videoFit: "fill" | "fit";
|
|
6
|
+
overlayOpacity: number;
|
|
7
|
+
autoplay: boolean;
|
|
8
|
+
videoSound: boolean;
|
|
9
|
+
};
|
|
10
|
+
interface VideoProps extends React.VideoHTMLAttributes<HTMLVideoElement> {
|
|
11
|
+
src: string;
|
|
12
|
+
videoAttributes: VideoAttributes;
|
|
13
|
+
naturalAspectRatio?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const Video: ({ src, videoAttributes, naturalAspectRatio, className, ...props }: VideoProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export { Video };
|
|
18
|
+
//# sourceMappingURL=video%20copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video copy.d.ts","sourceRoot":"","sources":["../../../components/ui/video copy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,UAAU,UAAW,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACtE,GAAG,EAAE,MAAM,CAAA;IACX,eAAe,EAAE,eAAe,CAAA;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,KAAK,sEAMR,UAAU,4CA0DZ,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import * as React from "react";
|
|
23
|
+
import { cn } from "../../lib/utils";
|
|
24
|
+
const videoVariants = {
|
|
25
|
+
base: "w-full",
|
|
26
|
+
fit: {
|
|
27
|
+
cover: "object-cover",
|
|
28
|
+
contain: "object-contain",
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const Video = (_a) => {
|
|
32
|
+
var { src, videoAttributes, naturalAspectRatio = "1/1", className } = _a, props = __rest(_a, ["src", "videoAttributes", "naturalAspectRatio", "className"]);
|
|
33
|
+
const videoRef = React.useRef(null);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
const video = videoRef.current;
|
|
36
|
+
if (!video)
|
|
37
|
+
return;
|
|
38
|
+
// Handle autoplay with sound restrictions
|
|
39
|
+
const setupVideo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
try {
|
|
41
|
+
if (videoAttributes.autoplay) {
|
|
42
|
+
// Always start muted to ensure autoplay works
|
|
43
|
+
video.muted = true;
|
|
44
|
+
yield video.play();
|
|
45
|
+
// If sound is enabled, unmute after autoplay starts
|
|
46
|
+
if (videoAttributes.videoSound) {
|
|
47
|
+
video.muted = false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error("Error setting up video:", error);
|
|
53
|
+
// Fallback to showing controls if autoplay fails
|
|
54
|
+
if (video) {
|
|
55
|
+
video.controls = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
setupVideo();
|
|
60
|
+
}, [videoAttributes.autoplay, videoAttributes.videoSound]);
|
|
61
|
+
const videoStyle = {
|
|
62
|
+
aspectRatio: videoAttributes.enabled && videoAttributes.aspectRatio !== "auto"
|
|
63
|
+
? videoAttributes.aspectRatio.replace(":", "/")
|
|
64
|
+
: naturalAspectRatio.replace(":", "/"),
|
|
65
|
+
};
|
|
66
|
+
return (_jsx("video", Object.assign({ ref: videoRef, className: cn(videoVariants.base, videoAttributes.videoFit === "fill"
|
|
67
|
+
? videoVariants.fit.cover
|
|
68
|
+
: videoVariants.fit.contain, className), style: videoStyle, preload: "metadata", playsInline: true, loop: videoAttributes.enabled, controls: videoAttributes.enabled && !videoAttributes.autoplay, src: src }, props)));
|
|
69
|
+
};
|
|
70
|
+
export { Video };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type VideoAttributes = {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
aspectRatio: string;
|
|
5
|
+
videoFit: "fill" | "fit";
|
|
6
|
+
overlayOpacity: number;
|
|
7
|
+
autoplay: boolean;
|
|
8
|
+
videoSound: boolean;
|
|
9
|
+
};
|
|
10
|
+
interface VideoProps extends React.VideoHTMLAttributes<HTMLVideoElement> {
|
|
11
|
+
src: string;
|
|
12
|
+
videoAttributes: VideoAttributes;
|
|
13
|
+
naturalAspectRatio?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const Video: ({ src, videoAttributes, naturalAspectRatio, className, ...props }: VideoProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export { Video as VideoV2 };
|
|
18
|
+
//# sourceMappingURL=video.v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.v2.d.ts","sourceRoot":"","sources":["../../../components/ui/video.v2.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,UAAU,UAAW,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACtE,GAAG,EAAE,MAAM,CAAA;IACX,eAAe,EAAE,eAAe,CAAA;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,KAAK,sEAMR,UAAU,4CA0DZ,CAAA;AAED,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import * as React from "react";
|
|
23
|
+
import { cn } from "../../lib/utils";
|
|
24
|
+
const videoVariants = {
|
|
25
|
+
base: "w-full",
|
|
26
|
+
fit: {
|
|
27
|
+
cover: "object-cover",
|
|
28
|
+
contain: "object-contain",
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const Video = (_a) => {
|
|
32
|
+
var { src, videoAttributes, naturalAspectRatio = "1/1", className } = _a, props = __rest(_a, ["src", "videoAttributes", "naturalAspectRatio", "className"]);
|
|
33
|
+
const videoRef = React.useRef(null);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
const video = videoRef.current;
|
|
36
|
+
if (!video)
|
|
37
|
+
return;
|
|
38
|
+
// Handle autoplay with sound restrictions
|
|
39
|
+
const setupVideo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
try {
|
|
41
|
+
if (videoAttributes.autoplay) {
|
|
42
|
+
// Always start muted to ensure autoplay works
|
|
43
|
+
video.muted = true;
|
|
44
|
+
yield video.play();
|
|
45
|
+
// If sound is enabled, unmute after autoplay starts
|
|
46
|
+
if (videoAttributes.videoSound) {
|
|
47
|
+
video.muted = false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error("Error setting up video:", error);
|
|
53
|
+
// Fallback to showing controls if autoplay fails
|
|
54
|
+
if (video) {
|
|
55
|
+
video.controls = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
setupVideo();
|
|
60
|
+
}, [videoAttributes.autoplay, videoAttributes.videoSound]);
|
|
61
|
+
const videoStyle = {
|
|
62
|
+
aspectRatio: videoAttributes.enabled && videoAttributes.aspectRatio !== "auto"
|
|
63
|
+
? videoAttributes.aspectRatio.replace(":", "/")
|
|
64
|
+
: naturalAspectRatio.replace(":", "/"),
|
|
65
|
+
};
|
|
66
|
+
return (_jsx("video", Object.assign({ ref: videoRef, className: cn(videoVariants.base, videoAttributes.videoFit === "fill"
|
|
67
|
+
? videoVariants.fit.cover
|
|
68
|
+
: videoVariants.fit.contain, className), style: videoStyle, preload: "metadata", playsInline: true, loop: videoAttributes.enabled, controls: videoAttributes.enabled && !videoAttributes.autoplay, src: src }, props)));
|
|
69
|
+
};
|
|
70
|
+
export { Video as VideoV2 };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, getDestinationHandler, createCollectionImageMap, } from "./lib/utils";
|
|
2
|
+
export * from "./components/hooks/use-collection";
|
|
3
|
+
export * from "./components/hooks/use-infinite-scroll";
|
|
4
|
+
export * from "./components/hooks/use-recommendations";
|
|
5
|
+
export * from "./components/hooks/use-products";
|
|
6
|
+
export * from "./components/hooks/use-scroll-direction";
|
|
7
|
+
export * from "./components/hooks/use-sort-filter";
|
|
8
|
+
export * from "./components/hooks/use-product-options";
|
|
9
|
+
export * from "./components/hooks/use-shop";
|
|
10
|
+
export * from "./components/hooks/use-tap";
|
|
11
|
+
export * from "./components/ui/accordion";
|
|
12
|
+
export * from "./components/ui/aspect-ratio";
|
|
13
|
+
export * from "./components/ui/badge";
|
|
14
|
+
export * from "./components/ui/button";
|
|
15
|
+
export * from "./components/ui/carousel";
|
|
16
|
+
export * from "./components/ui/checkbox";
|
|
17
|
+
export * from "./components/ui/chip";
|
|
18
|
+
export * from "./components/ui/color-swatch";
|
|
19
|
+
export * from "./components/ui/container";
|
|
20
|
+
export * from "./components/ui/drawer";
|
|
21
|
+
export * from "./components/ui/dropdown";
|
|
22
|
+
export * from "./components/ui/empty-message";
|
|
23
|
+
export * from "./components/ui/favorite";
|
|
24
|
+
export * from "./components/ui/grid";
|
|
25
|
+
export * from "./components/ui/icon";
|
|
26
|
+
export * from "./components/ui/image";
|
|
27
|
+
export * from "./components/ui/Input/input";
|
|
28
|
+
export * from "./components/ui/label";
|
|
29
|
+
export * from "./components/ui/line-item-text-icons";
|
|
30
|
+
export * from "./components/ui/money";
|
|
31
|
+
export * from "./components/ui/price";
|
|
32
|
+
export * from "./components/ui/product-card";
|
|
33
|
+
export * from "./components/ui/quantity-picker";
|
|
34
|
+
export * from "./components/ui/radio-group";
|
|
35
|
+
export * from "./components/ui/scroll-area";
|
|
36
|
+
export * from "./components/ui/selectors";
|
|
37
|
+
export * from "./components/ui/separator";
|
|
38
|
+
export * from "./components/ui/skeleton";
|
|
39
|
+
export * from "./components/ui/slider";
|
|
40
|
+
export * from "./components/ui/subscription";
|
|
41
|
+
export * from "./components/ui/switch";
|
|
42
|
+
export * from "./components/ui/tabs";
|
|
43
|
+
export * from "./components/ui/text";
|
|
44
|
+
export * from "./components/ui/textarea";
|
|
45
|
+
export * from "./components/ui/toast";
|
|
46
|
+
export * from "./components/ui/toaster";
|
|
47
|
+
export * from "./components/ui/toggle-group";
|
|
48
|
+
export * from "./components/ui/toggle";
|
|
49
|
+
export * from "./components/ui/use-toast";
|
|
50
|
+
export * from "./components/ui/video";
|
|
51
|
+
export * from "./components/ui/video.v2";
|
|
52
|
+
export * from "./components/ui/wishlist";
|
|
53
|
+
export * from "./components/ui/wishlist-select";
|
|
54
|
+
export * from "./components/hooks/use-shop";
|
|
55
|
+
export * from "./components/libs/sort-filter/search-integration";
|
|
56
|
+
export * from "./components/hooks/use-reviews";
|
|
57
|
+
export * from "./components/ui/subcollection-tabs";
|
|
58
|
+
export * from "./components/libs/sort-filter/search-integration";
|
|
59
|
+
//# sourceMappingURL=index%20copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index copy.d.ts","sourceRoot":"","sources":["../index copy.ts"],"names":[],"mappings":"AACA,OAAO,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EACR,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAA;AACpB,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,wCAAwC,CAAA;AACtD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AACvD,cAAc,oCAAoC,CAAA;AAClD,cAAc,wCAAwC,CAAA;AACtD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sCAAsC,CAAA;AACpD,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kDAAkD,CAAA;AAChE,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,kDAAkD,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// component exports
|
|
2
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, getDestinationHandler, createCollectionImageMap, } from "./lib/utils";
|
|
3
|
+
export * from "./components/hooks/use-collection";
|
|
4
|
+
export * from "./components/hooks/use-infinite-scroll";
|
|
5
|
+
export * from "./components/hooks/use-recommendations";
|
|
6
|
+
export * from "./components/hooks/use-products";
|
|
7
|
+
export * from "./components/hooks/use-scroll-direction";
|
|
8
|
+
export * from "./components/hooks/use-sort-filter";
|
|
9
|
+
export * from "./components/hooks/use-product-options";
|
|
10
|
+
export * from "./components/hooks/use-shop";
|
|
11
|
+
export * from "./components/hooks/use-tap";
|
|
12
|
+
export * from "./components/ui/accordion";
|
|
13
|
+
export * from "./components/ui/aspect-ratio";
|
|
14
|
+
export * from "./components/ui/badge";
|
|
15
|
+
export * from "./components/ui/button";
|
|
16
|
+
export * from "./components/ui/carousel";
|
|
17
|
+
export * from "./components/ui/checkbox";
|
|
18
|
+
export * from "./components/ui/chip";
|
|
19
|
+
export * from "./components/ui/color-swatch";
|
|
20
|
+
export * from "./components/ui/container";
|
|
21
|
+
export * from "./components/ui/drawer";
|
|
22
|
+
export * from "./components/ui/dropdown";
|
|
23
|
+
export * from "./components/ui/empty-message";
|
|
24
|
+
export * from "./components/ui/favorite";
|
|
25
|
+
export * from "./components/ui/grid";
|
|
26
|
+
export * from "./components/ui/icon";
|
|
27
|
+
export * from "./components/ui/image";
|
|
28
|
+
export * from "./components/ui/Input/input";
|
|
29
|
+
export * from "./components/ui/label";
|
|
30
|
+
export * from "./components/ui/line-item-text-icons";
|
|
31
|
+
export * from "./components/ui/money";
|
|
32
|
+
export * from "./components/ui/price";
|
|
33
|
+
export * from "./components/ui/product-card";
|
|
34
|
+
export * from "./components/ui/quantity-picker";
|
|
35
|
+
export * from "./components/ui/radio-group";
|
|
36
|
+
export * from "./components/ui/scroll-area";
|
|
37
|
+
export * from "./components/ui/selectors";
|
|
38
|
+
export * from "./components/ui/separator";
|
|
39
|
+
export * from "./components/ui/skeleton";
|
|
40
|
+
export * from "./components/ui/slider";
|
|
41
|
+
export * from "./components/ui/subscription";
|
|
42
|
+
export * from "./components/ui/switch";
|
|
43
|
+
export * from "./components/ui/tabs";
|
|
44
|
+
export * from "./components/ui/text";
|
|
45
|
+
export * from "./components/ui/textarea";
|
|
46
|
+
export * from "./components/ui/toast";
|
|
47
|
+
export * from "./components/ui/toaster";
|
|
48
|
+
export * from "./components/ui/toggle-group";
|
|
49
|
+
export * from "./components/ui/toggle";
|
|
50
|
+
export * from "./components/ui/use-toast";
|
|
51
|
+
export * from "./components/ui/video";
|
|
52
|
+
export * from "./components/ui/video.v2";
|
|
53
|
+
export * from "./components/ui/wishlist";
|
|
54
|
+
export * from "./components/ui/wishlist-select";
|
|
55
|
+
export * from "./components/hooks/use-shop";
|
|
56
|
+
export * from "./components/libs/sort-filter/search-integration";
|
|
57
|
+
export * from "./components/hooks/use-reviews";
|
|
58
|
+
export * from "./components/ui/subcollection-tabs";
|
|
59
|
+
export * from "./components/libs/sort-filter/search-integration";
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./components/hooks/use-scroll-direction";
|
|
|
8
8
|
export * from "./components/hooks/use-sort-filter";
|
|
9
9
|
export * from "./components/hooks/use-product-options";
|
|
10
10
|
export * from "./components/hooks/use-shop";
|
|
11
|
+
export * from "./components/hooks/use-mock-products";
|
|
11
12
|
export * from "./components/ui/accordion";
|
|
12
13
|
export * from "./components/ui/aspect-ratio";
|
|
13
14
|
export * from "./components/ui/badge";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EACR,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,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gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kDAAkD,CAAA;AAChE,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,6CAA6C,CAAA;AAC3D,cAAc,kDAAkD,CAAA;AAChE,cAAc,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./components/hooks/use-scroll-direction";
|
|
|
9
9
|
export * from "./components/hooks/use-sort-filter";
|
|
10
10
|
export * from "./components/hooks/use-product-options";
|
|
11
11
|
export * from "./components/hooks/use-shop";
|
|
12
|
+
export * from "./components/hooks/use-mock-products";
|
|
12
13
|
export * from "./components/ui/accordion";
|
|
13
14
|
export * from "./components/ui/aspect-ratio";
|
|
14
15
|
export * from "./components/ui/badge";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type DestinationActions = {
|
|
2
|
+
openScreen: (arg: {
|
|
3
|
+
destination: {
|
|
4
|
+
type: "internal" | "web";
|
|
5
|
+
url: string;
|
|
6
|
+
};
|
|
7
|
+
}) => void;
|
|
8
|
+
openProduct: (arg: {
|
|
9
|
+
productId: string;
|
|
10
|
+
}) => void;
|
|
11
|
+
openCollection: (arg: {
|
|
12
|
+
collectionId: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const getDestinationHandler: (type: "app-screen" | "url" | "product" | "collection" | "none") => ((location: string, actions: DestinationActions) => void) | ((location: string, actions: DestinationActions) => void) | ((location: string, actions: DestinationActions) => void) | ((location: string, actions: DestinationActions) => void) | (() => void);
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=destination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../../../lib/utils/destination.ts"],"names":[],"mappings":"AAAA,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,CAAC,GAAG,EAAE;QAChB,WAAW,EAAE;YAAE,IAAI,EAAE,UAAU,GAAG,KAAK,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAA;KACvD,KAAK,IAAI,CAAA;IACV,WAAW,EAAE,CAAC,GAAG,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACjD,cAAc,EAAE,CAAC,GAAG,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACxD,CAAA;AAmBD,eAAO,MAAM,qBAAqB,SAC1B,YAAY,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,iBAjBrC,MAAM,WAAW,kBAAkB,yBAE5C,MAAM,WAAW,kBAAkB,yBAO/B,MAAM,WAAW,kBAAkB,yBAEhC,MAAM,WAAW,kBAAkB,yBAS3D,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const DESTINATION_HANDLERS = {
|
|
2
|
+
"app-screen": (location, actions) => actions.openScreen({ destination: { type: "internal", url: location } }),
|
|
3
|
+
url: (location, actions) => actions.openScreen({
|
|
4
|
+
destination: {
|
|
5
|
+
type: "web",
|
|
6
|
+
url: location.includes("https://") ? location : `https://${location}`,
|
|
7
|
+
},
|
|
8
|
+
}),
|
|
9
|
+
product: (location, actions) => actions.openProduct({ productId: location }),
|
|
10
|
+
collection: (location, actions) => actions.openCollection({ collectionId: location }),
|
|
11
|
+
none: () => { },
|
|
12
|
+
};
|
|
13
|
+
export const getDestinationHandler = (type) => {
|
|
14
|
+
return DESTINATION_HANDLERS[type];
|
|
15
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getIdFromGid(gid: string | undefined): string;
|
|
2
|
+
export declare function productGidFromId(id: string | null | undefined): string | null;
|
|
3
|
+
export declare function variantGidFromId(id: string | null | undefined): string | null;
|
|
4
|
+
export declare function getProductGidsFromIds(ids: string[]): string[];
|
|
5
|
+
//# sourceMappingURL=id.d.ts.map
|