@tapcart/mobile-components 0.8.33 → 0.8.34
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/ui/badge.js +1 -1
- package/dist/components/ui/dialog.d.ts +20 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +51 -0
- package/dist/components/ui/image.d.ts.map +1 -1
- package/dist/components/ui/image.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +34 -0
- package/package.json +3 -2
- package/dist/components/hooks/use-loyalty.d.ts +0 -22
- package/dist/components/hooks/use-loyalty.d.ts.map +0 -1
- package/dist/components/hooks/use-loyalty.js +0 -117
- package/dist/components/libs/loyalty/LoyaltyAdapter.d.ts +0 -101
- package/dist/components/libs/loyalty/LoyaltyAdapter.d.ts.map +0 -1
- package/dist/components/libs/loyalty/LoyaltyAdapter.js +0 -119
- package/dist/components/libs/loyalty/YotpoLoyalty.d.ts +0 -20
- package/dist/components/libs/loyalty/YotpoLoyalty.d.ts.map +0 -1
- package/dist/components/libs/loyalty/YotpoLoyalty.js +0 -527
|
@@ -68,7 +68,7 @@ function Badge(_a) {
|
|
|
68
68
|
var { className, icon, iconUrl, alignment, cornerRadius = "rounded", type = "icon-and-text", size = "plp-layout", backgroundColor, fontColor } = _a, props = __rest(_a, ["className", "icon", "iconUrl", "alignment", "cornerRadius", "type", "size", "backgroundColor", "fontColor"]);
|
|
69
69
|
const backgroundColorOverride = backgroundColor ? { backgroundColor } : {};
|
|
70
70
|
const BadgeText = () => (_jsx(Text, Object.assign({ type: size === "plp-layout" ? "body-primary" : "body-secondary", className: "text-productBadging-text", fontColor: fontColor }, { children: props.children })));
|
|
71
|
-
return (_jsx("div", Object.assign({ className: cn(badgeVariants({ alignment, cornerRadius }), className) }, props, { style: Object.assign(Object.assign({}, props.style), backgroundColorOverride) }, { children: type === "icon-and-text" ? (_jsxs(_Fragment, { children: [(icon || iconUrl) && (_jsx(Icon, { name: icon, url: iconUrl,
|
|
71
|
+
return (_jsx("div", Object.assign({ className: cn(badgeVariants({ alignment, cornerRadius }), className) }, props, { style: Object.assign(Object.assign({}, props.style), backgroundColorOverride) }, { children: type === "icon-and-text" ? (_jsxs(_Fragment, { children: [(icon || iconUrl) && (_jsx(Icon, { name: icon, url: iconUrl, color: fontColor, size: size === "carousels" || size === "plp-layout-small"
|
|
72
72
|
? "xs"
|
|
73
73
|
: "sm" })), _jsx(BadgeText, {})] })) : type === "icon-only" && icon ? (_jsx(Icon, { name: icon, url: iconUrl, style: fontColor ? { color: fontColor } : {}, size: size === "carousels" || size === "plp-layout-small" ? "xs" : "sm" })) : (_jsx(BadgeText, {})) })));
|
|
74
74
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
4
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
6
|
+
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const DialogHeader: {
|
|
10
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
declare const DialogFooter: {
|
|
14
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
18
|
+
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
19
|
+
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
|
|
20
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../components/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAGzD,QAAA,MAAM,MAAM,uCAAuB,CAAA;AAEnC,QAAA,MAAM,aAAa,8GAA0B,CAAA;AAE7C,QAAA,MAAM,YAAY,6CAAyB,CAAA;AAE3C,QAAA,MAAM,WAAW,4GAAwB,CAAA;AAEzC,QAAA,MAAM,aAAa,8JAYjB,CAAA;AAGF,QAAA,MAAM,aAAa,8JAiBjB,CAAA;AAGF,QAAA,MAAM,YAAY;8BAGf,MAAM,cAAc,CAAC,cAAc,CAAC;;CAQtC,CAAA;AAGD,QAAA,MAAM,YAAY;8BAGf,MAAM,cAAc,CAAC,cAAc,CAAC;;CAQtC,CAAA;AAGD,QAAA,MAAM,WAAW,oKAYf,CAAA;AAGF,QAAA,MAAM,iBAAiB,8KASrB,CAAA;AAGF,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
16
|
+
import { cn } from "../../lib/utils";
|
|
17
|
+
const Dialog = DialogPrimitive.Root;
|
|
18
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
19
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
20
|
+
const DialogClose = DialogPrimitive.Close;
|
|
21
|
+
const DialogOverlay = React.forwardRef((_a, ref) => {
|
|
22
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
23
|
+
return (_jsx(DialogPrimitive.Overlay, Object.assign({ ref: ref, className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className) }, props)));
|
|
24
|
+
});
|
|
25
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
26
|
+
const DialogContent = React.forwardRef((_a, ref) => {
|
|
27
|
+
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
28
|
+
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsx(DialogPrimitive.Content, Object.assign({ ref: ref, className: cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", className) }, props, { children: children }))] }));
|
|
29
|
+
});
|
|
30
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
31
|
+
const DialogHeader = (_a) => {
|
|
32
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
33
|
+
return (_jsx("div", Object.assign({ className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className) }, props)));
|
|
34
|
+
};
|
|
35
|
+
DialogHeader.displayName = "DialogHeader";
|
|
36
|
+
const DialogFooter = (_a) => {
|
|
37
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
38
|
+
return (_jsx("div", Object.assign({ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className) }, props)));
|
|
39
|
+
};
|
|
40
|
+
DialogFooter.displayName = "DialogFooter";
|
|
41
|
+
const DialogTitle = React.forwardRef((_a, ref) => {
|
|
42
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
43
|
+
return (_jsx(DialogPrimitive.Title, Object.assign({ ref: ref, className: cn("text-lg font-semibold leading-none tracking-tight", className) }, props)));
|
|
44
|
+
});
|
|
45
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
46
|
+
const DialogDescription = React.forwardRef((_a, ref) => {
|
|
47
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
48
|
+
return (_jsx(DialogPrimitive.Description, Object.assign({ ref: ref, className: cn("text-sm text-muted-foreground", className) }, props)));
|
|
49
|
+
});
|
|
50
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
51
|
+
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../components/ui/image.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAkC1D,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAUD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,MAAM,CAAA;AAKrD,KAAK,IAAI,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAI1D,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAChE,qBAAqB,CAAA;AAEvB,KAAK,qBAAqB,GAAG;IAC3B;;;;;;OAMG;IACH,WAAW,CAAC,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CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC,EACpE,MAAM,GAAE,MAAsB,EAC9B,WAAW,UAAQ,GAClB,MAAM,CAiBR;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,6BAA0B,EAC/B,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACpB,MAAM,EAAE,CAUV;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIzE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,EACtB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,GAAE,IAAe,GAEnB;IACE,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,IAAI,EAAE,IAAI,CAAA;CACX,EAAE,GACH,SAAS,CAUZ"}
|
|
@@ -174,6 +174,7 @@ export const Image = React.forwardRef((_a, ref) => {
|
|
|
174
174
|
}, [ref]);
|
|
175
175
|
const wrapperStyle = Object.assign({ aspectRatio: (_b = normalizedProps === null || normalizedProps === void 0 ? void 0 : normalizedProps.aspectRatio) === null || _b === void 0 ? void 0 : _b.replace(":", "/") }, imageWrapperStyles);
|
|
176
176
|
const srcSet = generateSrcSet(normalizedProps.src, generateSizes(imageWidths, normalizedProps.aspectRatio, crop), loader, normalizedProps.objectFit === "contain");
|
|
177
|
+
console.log("Image alt value:", normalizedProps.alt);
|
|
177
178
|
return (_jsxs(_Fragment, { children: [loading === "eager" && (_jsx(ImagePreload, { imgAttributes: {
|
|
178
179
|
srcSet,
|
|
179
180
|
sizes,
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export * from "./components/contexts/translation-context";
|
|
|
4
4
|
export * from "./components/hooks/use-collection";
|
|
5
5
|
export * from "./components/hooks/use-infinite-scroll";
|
|
6
6
|
export * from "./components/hooks/use-infinite-wishlist";
|
|
7
|
-
export * from "./components/hooks/use-loyalty";
|
|
8
7
|
export * from "./components/hooks/use-recommendations";
|
|
9
8
|
export * from "./components/hooks/use-products";
|
|
10
9
|
export * from "./components/hooks/use-order-details";
|
|
@@ -79,4 +78,5 @@ export * from "./components/libs/sort-filter/search-integration";
|
|
|
79
78
|
export * from "./components/ui/tap";
|
|
80
79
|
export * from "./components/ui/circular-progress";
|
|
81
80
|
export * from "./components/ui/swipeable-list-item";
|
|
81
|
+
export * from "./components/ui/dialog";
|
|
82
82
|
//# sourceMappingURL=index.d.ts.map
|
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,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,EAC5B,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,SAAS,EACT,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,aAAa,CAAA;AACpB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2CAA2C,CAAA;AACzD,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,0CAA0C,CAAA;AACxD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"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AC3D,cAAc,kDAAkD,CAAA;AAChE,cAAc,qBAAqB,CAAA;AACnC,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA;AACnD,cAAc,wBAAwB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ export * from "./components/contexts/translation-context";
|
|
|
5
5
|
export * from "./components/hooks/use-collection";
|
|
6
6
|
export * from "./components/hooks/use-infinite-scroll";
|
|
7
7
|
export * from "./components/hooks/use-infinite-wishlist";
|
|
8
|
-
export * from "./components/hooks/use-loyalty";
|
|
9
8
|
export * from "./components/hooks/use-recommendations";
|
|
10
9
|
export * from "./components/hooks/use-products";
|
|
11
10
|
export * from "./components/hooks/use-order-details";
|
|
@@ -80,3 +79,4 @@ export * from "./components/libs/sort-filter/search-integration";
|
|
|
80
79
|
export * from "./components/ui/tap";
|
|
81
80
|
export * from "./components/ui/circular-progress";
|
|
82
81
|
export * from "./components/ui/swipeable-list-item";
|
|
82
|
+
export * from "./components/ui/dialog";
|
package/dist/styles.css
CHANGED
|
@@ -742,6 +742,9 @@ video {
|
|
|
742
742
|
.left-2 {
|
|
743
743
|
left: 0.5rem;
|
|
744
744
|
}
|
|
745
|
+
.left-3 {
|
|
746
|
+
left: 0.75rem;
|
|
747
|
+
}
|
|
745
748
|
.left-4 {
|
|
746
749
|
left: 1rem;
|
|
747
750
|
}
|
|
@@ -808,6 +811,9 @@ video {
|
|
|
808
811
|
.row-start-1 {
|
|
809
812
|
grid-row-start: 1;
|
|
810
813
|
}
|
|
814
|
+
.m-0 {
|
|
815
|
+
margin: 0px;
|
|
816
|
+
}
|
|
811
817
|
.m-2 {
|
|
812
818
|
margin: 0.5rem;
|
|
813
819
|
}
|
|
@@ -1053,6 +1059,9 @@ video {
|
|
|
1053
1059
|
.max-h-\[240px\] {
|
|
1054
1060
|
max-height: 240px;
|
|
1055
1061
|
}
|
|
1062
|
+
.max-h-full {
|
|
1063
|
+
max-height: 100%;
|
|
1064
|
+
}
|
|
1056
1065
|
.max-h-screen {
|
|
1057
1066
|
max-height: 100vh;
|
|
1058
1067
|
}
|
|
@@ -1468,6 +1477,11 @@ video {
|
|
|
1468
1477
|
margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));
|
|
1469
1478
|
margin-bottom: calc(0.25rem * var(--tw-space-y-reverse));
|
|
1470
1479
|
}
|
|
1480
|
+
.space-y-1\.5 > :not([hidden]) ~ :not([hidden]) {
|
|
1481
|
+
--tw-space-y-reverse: 0;
|
|
1482
|
+
margin-top: calc(0.375rem * calc(1 - var(--tw-space-y-reverse)));
|
|
1483
|
+
margin-bottom: calc(0.375rem * var(--tw-space-y-reverse));
|
|
1484
|
+
}
|
|
1471
1485
|
.space-y-2 > :not([hidden]) ~ :not([hidden]) {
|
|
1472
1486
|
--tw-space-y-reverse: 0;
|
|
1473
1487
|
margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
@@ -1730,6 +1744,9 @@ video {
|
|
|
1730
1744
|
--tw-bg-opacity: 1;
|
|
1731
1745
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
1732
1746
|
}
|
|
1747
|
+
.bg-opacity-50 {
|
|
1748
|
+
--tw-bg-opacity: 0.5;
|
|
1749
|
+
}
|
|
1733
1750
|
.bg-opacity-70 {
|
|
1734
1751
|
--tw-bg-opacity: 0.7;
|
|
1735
1752
|
}
|
|
@@ -1739,6 +1756,20 @@ video {
|
|
|
1739
1756
|
.bg-fade-right {
|
|
1740
1757
|
background-image: linear-gradient(to left, var(--coreColors-pageColor) 0%, #ffffff00 100%);;
|
|
1741
1758
|
}
|
|
1759
|
+
.bg-gradient-to-b {
|
|
1760
|
+
background-image: linear-gradient(to bottom, var(--tw-gradient-stops));
|
|
1761
|
+
}
|
|
1762
|
+
.from-black {
|
|
1763
|
+
--tw-gradient-from: #000 var(--tw-gradient-from-position);
|
|
1764
|
+
--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);
|
|
1765
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
1766
|
+
}
|
|
1767
|
+
.from-20\% {
|
|
1768
|
+
--tw-gradient-from-position: 20%;
|
|
1769
|
+
}
|
|
1770
|
+
.to-transparent {
|
|
1771
|
+
--tw-gradient-to: transparent var(--tw-gradient-to-position);
|
|
1772
|
+
}
|
|
1742
1773
|
.bg-contain {
|
|
1743
1774
|
background-size: contain;
|
|
1744
1775
|
}
|
|
@@ -1975,6 +2006,9 @@ video {
|
|
|
1975
2006
|
.leading-none {
|
|
1976
2007
|
line-height: 1;
|
|
1977
2008
|
}
|
|
2009
|
+
.tracking-tight {
|
|
2010
|
+
letter-spacing: -0.025em;
|
|
2011
|
+
}
|
|
1978
2012
|
.text-\[\#727272\] {
|
|
1979
2013
|
--tw-text-opacity: 1;
|
|
1980
2014
|
color: rgb(114 114 114 / var(--tw-text-opacity, 1));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.34",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -81,8 +81,9 @@
|
|
|
81
81
|
"embla-carousel-autoplay": "8.5.2",
|
|
82
82
|
"embla-carousel-fade": "8.5.2",
|
|
83
83
|
"embla-carousel-react": "^8.3.0",
|
|
84
|
+
"eslint-config-next": "^15.3.0",
|
|
84
85
|
"lucide-react": "^0.488.0",
|
|
85
|
-
"next": "^
|
|
86
|
+
"next": "^15.3.0",
|
|
86
87
|
"next-themes": "^0.2.1",
|
|
87
88
|
"phone": "^3.1.58",
|
|
88
89
|
"pluralize": "^8.0.0",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { LoyaltyCustomer, LoyaltyPoints, LoyaltyReward, LoyaltyReferral, LoyaltyTier, LoyaltyActivity } from "../libs/loyalty/LoyaltyAdapter";
|
|
2
|
-
type useLoyaltyOptions = {
|
|
3
|
-
integrationProvider?: "yotpo" | "custom";
|
|
4
|
-
};
|
|
5
|
-
declare function useLoyalty({ integrationProvider }: useLoyaltyOptions): {
|
|
6
|
-
customer: LoyaltyCustomer<Record<string, any>> | null;
|
|
7
|
-
customerTier: LoyaltyTier<Record<string, any>> | null;
|
|
8
|
-
availableActivities: LoyaltyActivity<Record<string, any>>[] | null;
|
|
9
|
-
activityHistory: LoyaltyActivity<Record<string, any>>[] | null;
|
|
10
|
-
points: LoyaltyPoints<Record<string, any>> | null;
|
|
11
|
-
rewards: LoyaltyReward<Record<string, any>>[] | null;
|
|
12
|
-
referrals: LoyaltyReferral<Record<string, any>>[] | null;
|
|
13
|
-
tiers: LoyaltyTier<Record<string, any>>[] | null;
|
|
14
|
-
createCustomer: () => Promise<void>;
|
|
15
|
-
updateCustomer: () => Promise<void>;
|
|
16
|
-
addPoints: () => Promise<void>;
|
|
17
|
-
redeemReward: () => Promise<void>;
|
|
18
|
-
recordActivity: () => Promise<void>;
|
|
19
|
-
createReferral: () => Promise<void>;
|
|
20
|
-
};
|
|
21
|
-
export { useLoyalty };
|
|
22
|
-
//# sourceMappingURL=use-loyalty.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-loyalty.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-loyalty.ts"],"names":[],"mappings":"AAEA,OAAuB,EACrB,eAAe,EACf,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,eAAe,EAChB,MAAM,gCAAgC,CAAA;AAGvC,KAAK,iBAAiB,GAAG;IACvB,mBAAmB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;CACzC,CAAA;AAED,iBAAS,UAAU,CAAC,EAAE,mBAA6B,EAAE,EAAE,iBAAiB;;;;;;;;;;;;;;;EAmHvE;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
import YotpoLoyalty from "../libs/loyalty/YotpoLoyalty";
|
|
12
|
-
import { useState, useEffect, useRef } from "react";
|
|
13
|
-
function useLoyalty({ integrationProvider = "yotpo" }) {
|
|
14
|
-
const loyalty = useRef(null);
|
|
15
|
-
const [customer, setCustomer] = useState(null);
|
|
16
|
-
const [customerTier, setCustomerTier] = useState(null);
|
|
17
|
-
const [availableActivities, setAvailableActivities] = useState(null);
|
|
18
|
-
const [activityHistory, setActivityHistory] = useState(null);
|
|
19
|
-
const [points, setPoints] = useState(null);
|
|
20
|
-
const [rewards, setRewards] = useState(null);
|
|
21
|
-
const [referrals, setReferrals] = useState(null);
|
|
22
|
-
const [tiers, setTiers] = useState(null);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (!loyalty.current) {
|
|
25
|
-
// initialize loyalty adapter
|
|
26
|
-
if (integrationProvider === "yotpo") {
|
|
27
|
-
loyalty.current = new YotpoLoyalty();
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
// TODO: Implement custom loyalty adapter
|
|
31
|
-
throw new Error("Custom loyalty adapter not implemented");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}, [integrationProvider]);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const initData = () => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
if (!loyalty.current) {
|
|
38
|
-
console.error("Loyalty adapter not initialized");
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
setCustomer(yield loyalty.current.getCustomer());
|
|
42
|
-
setCustomerTier(yield loyalty.current.getCustomerTier());
|
|
43
|
-
setActivityHistory(yield loyalty.current.getActivityHistory());
|
|
44
|
-
setAvailableActivities(yield loyalty.current.getAvailableActivities());
|
|
45
|
-
setPoints(yield loyalty.current.getPointsBalance());
|
|
46
|
-
setRewards(yield loyalty.current.getRewards());
|
|
47
|
-
setReferrals(yield loyalty.current.getReferrals());
|
|
48
|
-
setTiers(yield loyalty.current.getTiers());
|
|
49
|
-
});
|
|
50
|
-
initData();
|
|
51
|
-
}, [loyalty.current]);
|
|
52
|
-
const createCustomer = () => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
if (!loyalty.current) {
|
|
54
|
-
console.error("createCustomer: Loyalty adapter not initialized");
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const newCustomer = yield loyalty.current.createCustomer();
|
|
58
|
-
setCustomer(newCustomer);
|
|
59
|
-
});
|
|
60
|
-
const updateCustomer = () => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
if (!loyalty.current) {
|
|
62
|
-
console.error("updateCustomer: Loyalty adapter not initialized");
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const updatedCustomer = yield loyalty.current.updateCustomer();
|
|
66
|
-
setCustomer(updatedCustomer);
|
|
67
|
-
});
|
|
68
|
-
const addPoints = () => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
if (!loyalty.current) {
|
|
70
|
-
console.error("addPoints: Loyalty adapter not initialized");
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const updatedPoints = yield loyalty.current.addPoints();
|
|
74
|
-
setPoints(updatedPoints);
|
|
75
|
-
});
|
|
76
|
-
const redeemReward = () => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
if (!loyalty.current) {
|
|
78
|
-
console.error("redeemReward: Loyalty adapter not initialized");
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const updatedRewards = yield loyalty.current.redeemReward();
|
|
82
|
-
setRewards(updatedRewards);
|
|
83
|
-
});
|
|
84
|
-
const recordActivity = () => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
if (!loyalty.current) {
|
|
86
|
-
console.error("recordActivity: Loyalty adapter not initialized");
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const updatedActivities = yield loyalty.current.recordActivity();
|
|
90
|
-
setActivityHistory(updatedActivities);
|
|
91
|
-
});
|
|
92
|
-
const createReferral = () => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
if (!loyalty.current) {
|
|
94
|
-
console.error("Loyalty adapter not initialized");
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
const updatedReferrals = yield loyalty.current.createReferral();
|
|
98
|
-
setReferrals(updatedReferrals);
|
|
99
|
-
});
|
|
100
|
-
return {
|
|
101
|
-
customer,
|
|
102
|
-
customerTier,
|
|
103
|
-
availableActivities,
|
|
104
|
-
activityHistory,
|
|
105
|
-
points,
|
|
106
|
-
rewards,
|
|
107
|
-
referrals,
|
|
108
|
-
tiers,
|
|
109
|
-
createCustomer,
|
|
110
|
-
updateCustomer,
|
|
111
|
-
addPoints,
|
|
112
|
-
redeemReward,
|
|
113
|
-
recordActivity,
|
|
114
|
-
createReferral,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
export { useLoyalty };
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
export interface LoyaltyCustomer<T = Record<string, any>> {
|
|
2
|
-
id: string;
|
|
3
|
-
email?: string;
|
|
4
|
-
firstName?: string;
|
|
5
|
-
lastName?: string;
|
|
6
|
-
phoneNumber?: string;
|
|
7
|
-
externalId?: string;
|
|
8
|
-
metadata?: Record<string, any>;
|
|
9
|
-
createdAt?: Date;
|
|
10
|
-
updatedAt?: Date;
|
|
11
|
-
customAttributes?: T;
|
|
12
|
-
}
|
|
13
|
-
export interface LoyaltyPoints<T = Record<string, any>> {
|
|
14
|
-
balance: number;
|
|
15
|
-
lifetimePoints?: number;
|
|
16
|
-
pendingPoints?: number;
|
|
17
|
-
expiringPoints?: {
|
|
18
|
-
amount: number;
|
|
19
|
-
expiryDate: Date;
|
|
20
|
-
}[];
|
|
21
|
-
lastUpdated?: Date;
|
|
22
|
-
customAttributes?: T;
|
|
23
|
-
}
|
|
24
|
-
export interface LoyaltyReward<T = Record<string, any>> {
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
pointsCost: number;
|
|
29
|
-
status: "redeemed" | "notRedeemed";
|
|
30
|
-
type: "discount" | "coupon" | "freeProduct" | "custom";
|
|
31
|
-
value?: number | string;
|
|
32
|
-
expiresAt?: Date;
|
|
33
|
-
isAvailable: boolean;
|
|
34
|
-
metadata?: Record<string, any>;
|
|
35
|
-
customAttributes?: T;
|
|
36
|
-
}
|
|
37
|
-
export interface LoyaltyActivity<T = Record<string, any>> {
|
|
38
|
-
id: string;
|
|
39
|
-
type: string;
|
|
40
|
-
points: number;
|
|
41
|
-
customerId: string;
|
|
42
|
-
status: "pending" | "completed" | "cancelled";
|
|
43
|
-
metadata?: Record<string, any>;
|
|
44
|
-
createdAt: Date;
|
|
45
|
-
customAttributes?: T;
|
|
46
|
-
title?: string;
|
|
47
|
-
details?: string;
|
|
48
|
-
reward_text?: string;
|
|
49
|
-
cta_text?: string;
|
|
50
|
-
icon?: string;
|
|
51
|
-
url?: string;
|
|
52
|
-
}
|
|
53
|
-
export interface LoyaltyTierRequirement {
|
|
54
|
-
type: "orders" | "points" | "referrals" | "amountSpent";
|
|
55
|
-
threshold: number;
|
|
56
|
-
progress: number;
|
|
57
|
-
}
|
|
58
|
-
export interface LoyaltyTier<T = Record<string, any>> {
|
|
59
|
-
id: string;
|
|
60
|
-
name: string;
|
|
61
|
-
level: number;
|
|
62
|
-
requirements: LoyaltyTierRequirement[];
|
|
63
|
-
benefits?: string[];
|
|
64
|
-
isActive: boolean;
|
|
65
|
-
metadata?: Record<string, any>;
|
|
66
|
-
customAttributes?: T;
|
|
67
|
-
}
|
|
68
|
-
export interface LoyaltyReferral<T = Record<string, any>> {
|
|
69
|
-
id: string;
|
|
70
|
-
referrerId: string;
|
|
71
|
-
referredEmail?: string;
|
|
72
|
-
status: "pending" | "completed" | "expired";
|
|
73
|
-
reward?: {
|
|
74
|
-
referrer: number | string;
|
|
75
|
-
referred: number | string;
|
|
76
|
-
};
|
|
77
|
-
createdAt: Date;
|
|
78
|
-
completedAt?: Date;
|
|
79
|
-
customAttributes?: T;
|
|
80
|
-
}
|
|
81
|
-
export default class LoyaltyAdapter {
|
|
82
|
-
adapter: string;
|
|
83
|
-
customer: LoyaltyCustomer | null;
|
|
84
|
-
constructor();
|
|
85
|
-
createCustomer(): Promise<LoyaltyCustomer>;
|
|
86
|
-
getCustomer(): Promise<LoyaltyCustomer | null>;
|
|
87
|
-
setCustomer(customer: LoyaltyCustomer): void;
|
|
88
|
-
updateCustomer(): Promise<LoyaltyCustomer | null>;
|
|
89
|
-
getPointsBalance(): Promise<LoyaltyPoints | null>;
|
|
90
|
-
addPoints(): Promise<LoyaltyPoints | null>;
|
|
91
|
-
getRewards(): Promise<LoyaltyReward[]>;
|
|
92
|
-
redeemReward(): Promise<LoyaltyReward[] | null>;
|
|
93
|
-
getAvailableActivities(): Promise<LoyaltyActivity[]>;
|
|
94
|
-
recordActivity(): Promise<LoyaltyActivity[] | null>;
|
|
95
|
-
getActivityHistory(): Promise<LoyaltyActivity[] | null>;
|
|
96
|
-
getCustomerTier(): Promise<LoyaltyTier | null>;
|
|
97
|
-
getTiers(): Promise<LoyaltyTier[]>;
|
|
98
|
-
createReferral(): Promise<LoyaltyReferral[] | null>;
|
|
99
|
-
getReferrals(): Promise<LoyaltyReferral[] | null>;
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=L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AsB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAUpD,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;IAUnD,kBAAkB,IAAI,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;IAUvD,eAAe,IAAI,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAU9C,QAAQ,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAMlC,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;IAUnD,YAAY,IAAI,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;CAOxD"}
|
|
@@ -1,119 +0,0 @@
|
|
|
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
|
-
export default class LoyaltyAdapter {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.adapter = "unset";
|
|
13
|
-
this.customer = null;
|
|
14
|
-
// instantiate loyalty interface, noop
|
|
15
|
-
console.log(`Instantiating loyalty interface:`);
|
|
16
|
-
}
|
|
17
|
-
createCustomer() {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
// create a customer
|
|
20
|
-
console.log(`createCustomer implementation not provided for ${this.adapter}`);
|
|
21
|
-
throw new Error(`createCustomer implementation not provided for ${this.adapter}`);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
getCustomer() {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
// get a single customer by key
|
|
27
|
-
console.log(`getCustomer implementation not provided for ${this.adapter}`);
|
|
28
|
-
throw new Error(`getCustomer implementation not provided for ${this.adapter}`);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
setCustomer(customer) {
|
|
32
|
-
// set a customer
|
|
33
|
-
this.customer = customer;
|
|
34
|
-
}
|
|
35
|
-
updateCustomer() {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
// update a customer
|
|
38
|
-
console.log(`updateCustomer implementation not provided for ${this.adapter}`);
|
|
39
|
-
throw new Error(`updateCustomer implementation not provided for ${this.adapter}`);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
getPointsBalance() {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
// get points
|
|
45
|
-
console.log(`getPointsBalance implementation not provided for ${this.adapter}`);
|
|
46
|
-
throw new Error(`getPointsBalance implementation not provided for ${this.adapter}`);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
addPoints() {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
// add points
|
|
52
|
-
console.log(`addPoints implementation not provided for ${this.adapter}`);
|
|
53
|
-
throw new Error(`addPoints implementation not provided for ${this.adapter}`);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
getRewards() {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
// get rewards
|
|
59
|
-
console.log(`getRewards implementation not provided for ${this.adapter}`);
|
|
60
|
-
throw new Error(`getRewards implementation not provided for ${this.adapter}`);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
redeemReward() {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
// redeem a reward
|
|
66
|
-
console.log(`redeemReward implementation not provided for ${this.adapter}`);
|
|
67
|
-
throw new Error(`redeemReward implementation not provided for ${this.adapter}`);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
getAvailableActivities() {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
// get available activities
|
|
73
|
-
console.log(`getAvailableActivities implementation not provided for ${this.adapter}`);
|
|
74
|
-
throw new Error(`getAvailableActivities implementation not provided for ${this.adapter}`);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
recordActivity() {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
// record activity
|
|
80
|
-
console.log(`recordActivity implementation not provided for ${this.adapter}`);
|
|
81
|
-
throw new Error(`recordActivity implementation not provided for ${this.adapter}`);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
getActivityHistory() {
|
|
85
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
// record activity
|
|
87
|
-
console.log(`getActivityHistory implementation not provided for ${this.adapter}`);
|
|
88
|
-
throw new Error(`getActivityHistory implementation not provided for ${this.adapter}`);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
getCustomerTier() {
|
|
92
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
// get customer tier
|
|
94
|
-
console.log(`getCustomerTier implementation not provided for ${this.adapter}`);
|
|
95
|
-
throw new Error(`getCustomerTier implementation not provided for ${this.adapter}`);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
getTiers() {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
// get tiers
|
|
101
|
-
console.log(`getTiers implementation not provided for ${this.adapter}`);
|
|
102
|
-
throw new Error(`getTiers implementation not provided for ${this.adapter}`);
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
createReferral() {
|
|
106
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
// create a referral
|
|
108
|
-
console.log(`createReferral implementation not provided for ${this.adapter}`);
|
|
109
|
-
throw new Error(`createReferral implementation not provided for ${this.adapter}`);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
getReferrals() {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
// get referrals
|
|
115
|
-
console.log(`getReferrals implementation not provided for ${this.adapter}`);
|
|
116
|
-
throw new Error(`getReferrals implementation not provided for ${this.adapter}`);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import LoyaltyAdapter, { LoyaltyCustomer, LoyaltyPoints, LoyaltyReward, LoyaltyActivity, LoyaltyTier, LoyaltyReferral } from "./LoyaltyAdapter";
|
|
2
|
-
export default class YotpoLoyalty extends LoyaltyAdapter {
|
|
3
|
-
adapter: string;
|
|
4
|
-
constructor();
|
|
5
|
-
createCustomer(): Promise<LoyaltyCustomer>;
|
|
6
|
-
getCustomer(): Promise<LoyaltyCustomer>;
|
|
7
|
-
updateCustomer(): Promise<LoyaltyCustomer | null>;
|
|
8
|
-
getPointsBalance(): Promise<LoyaltyPoints | null>;
|
|
9
|
-
addPoints(): Promise<LoyaltyPoints | null>;
|
|
10
|
-
getRewards(): Promise<LoyaltyReward[]>;
|
|
11
|
-
redeemReward(): Promise<LoyaltyReward[] | null>;
|
|
12
|
-
getAvailableActivities(): Promise<LoyaltyActivity[]>;
|
|
13
|
-
recordActivity(): Promise<LoyaltyActivity[] | null>;
|
|
14
|
-
getActivityHistory(): Promise<LoyaltyActivity[] | null>;
|
|
15
|
-
getCustomerTier(): Promise<LoyaltyTier | null>;
|
|
16
|
-
getTiers(): Promise<LoyaltyTier[]>;
|
|
17
|
-
createReferral(): Promise<LoyaltyReferral[] | null>;
|
|
18
|
-
getReferrals(): Promise<LoyaltyReferral[] | null>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=YotpoLoyalty.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"YotpoLoyalty.d.ts","sourceRoot":"","sources":["../../../../components/libs/loyalty/YotpoLoyalty.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,EAAE,EACrB,eAAe,EACf,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,eAAe,EAChB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,cAAc;IACtD,OAAO,EAAE,MAAM,CAAU;;IAOnB,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC;IAa1C,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;IAQvC,cAAc,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAajD,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAoBjD,SAAS,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAa1C,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAiEtC,YAAY,IAAI,OAAO,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC;IAsE/C,sBAAsB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAkFpD,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;IAyBnD,kBAAkB,IAAI,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;IAqCvD,eAAe,IAAI,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IA2B9C,QAAQ,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAsDlC,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;IAiCnD,YAAY,IAAI,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;CAqBxD"}
|
|
@@ -1,527 +0,0 @@
|
|
|
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
|
-
import LoyaltyAdapter from "./LoyaltyAdapter";
|
|
11
|
-
export default class YotpoLoyalty extends LoyaltyAdapter {
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
this.adapter = "yotpo";
|
|
15
|
-
console.log("Instantiating yotpo loyalty interface");
|
|
16
|
-
}
|
|
17
|
-
createCustomer() {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const customer = {
|
|
20
|
-
id: "yotpo-customer-1",
|
|
21
|
-
email: "customer@example.com",
|
|
22
|
-
firstName: "John",
|
|
23
|
-
lastName: "Doe",
|
|
24
|
-
createdAt: new Date(),
|
|
25
|
-
updatedAt: new Date(),
|
|
26
|
-
};
|
|
27
|
-
this.setCustomer(customer);
|
|
28
|
-
return customer;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
getCustomer() {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
if (!this.customer) {
|
|
34
|
-
return this.createCustomer();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
return this.customer;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
updateCustomer() {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
if (!this.customer) {
|
|
44
|
-
console.error("No customer found");
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
this.customer.email = "updated@example.com";
|
|
49
|
-
this.customer.firstName = "John";
|
|
50
|
-
this.customer.lastName = "Updated";
|
|
51
|
-
this.customer.updatedAt = new Date();
|
|
52
|
-
return this.customer;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
getPointsBalance() {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
if (!this.customer) {
|
|
59
|
-
console.error("No customer found");
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return {
|
|
64
|
-
balance: 500,
|
|
65
|
-
lifetimePoints: 1000,
|
|
66
|
-
pendingPoints: 50,
|
|
67
|
-
expiringPoints: [
|
|
68
|
-
{
|
|
69
|
-
amount: 100,
|
|
70
|
-
expiryDate: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000), // 30 days from now
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
lastUpdated: new Date(),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
addPoints() {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
if (!this.customer) {
|
|
81
|
-
console.error("No customer found");
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
return {
|
|
86
|
-
balance: 600,
|
|
87
|
-
lifetimePoints: 1100,
|
|
88
|
-
lastUpdated: new Date(),
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
getRewards() {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
return [
|
|
96
|
-
{
|
|
97
|
-
id: "reward-1",
|
|
98
|
-
name: "$5 Off",
|
|
99
|
-
description: "Get $5 off your next purchase",
|
|
100
|
-
pointsCost: 500,
|
|
101
|
-
type: "discount",
|
|
102
|
-
value: "code-5-off",
|
|
103
|
-
isAvailable: true,
|
|
104
|
-
status: "redeemed",
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
id: "reward-2",
|
|
108
|
-
name: "15% Off Order",
|
|
109
|
-
description: "Save 15% on your entire order",
|
|
110
|
-
pointsCost: 1000,
|
|
111
|
-
type: "discount",
|
|
112
|
-
value: "code-15-off",
|
|
113
|
-
isAvailable: true,
|
|
114
|
-
status: "notRedeemed",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
id: "reward-3",
|
|
118
|
-
name: "Free Shipping",
|
|
119
|
-
description: "Get free shipping on your next order",
|
|
120
|
-
pointsCost: 300,
|
|
121
|
-
type: "discount",
|
|
122
|
-
value: "code-free-shipping",
|
|
123
|
-
isAvailable: true,
|
|
124
|
-
status: "notRedeemed",
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
id: "reward-4",
|
|
128
|
-
name: "Free Product",
|
|
129
|
-
description: "Get a free mystery gift with your next purchase",
|
|
130
|
-
pointsCost: 750,
|
|
131
|
-
type: "freeProduct",
|
|
132
|
-
value: "mystery-gift-001",
|
|
133
|
-
isAvailable: true,
|
|
134
|
-
status: "redeemed",
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
id: "reward-5",
|
|
138
|
-
name: "Early Access",
|
|
139
|
-
description: "Get 24-hour early access to our next sale",
|
|
140
|
-
pointsCost: 1500,
|
|
141
|
-
type: "custom",
|
|
142
|
-
value: "code-early-access",
|
|
143
|
-
isAvailable: true,
|
|
144
|
-
status: "redeemed",
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
id: "reward-6",
|
|
148
|
-
name: "Birthday Double Points",
|
|
149
|
-
description: "Earn 2x points during your birthday month",
|
|
150
|
-
pointsCost: 2000,
|
|
151
|
-
type: "custom",
|
|
152
|
-
value: "code-birthday-double-points",
|
|
153
|
-
isAvailable: false,
|
|
154
|
-
status: "redeemed",
|
|
155
|
-
},
|
|
156
|
-
];
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
redeemReward() {
|
|
160
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
if (!this.customer) {
|
|
162
|
-
console.error("No customer found");
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
return [
|
|
167
|
-
{
|
|
168
|
-
id: "reward-1",
|
|
169
|
-
name: "$5 Off",
|
|
170
|
-
description: "Get $5 off your next purchase",
|
|
171
|
-
pointsCost: 500,
|
|
172
|
-
type: "discount",
|
|
173
|
-
value: "code-5-off",
|
|
174
|
-
isAvailable: false,
|
|
175
|
-
status: "redeemed",
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
id: "reward-2",
|
|
179
|
-
name: "15% Off Order",
|
|
180
|
-
description: "Save 15% on your entire order",
|
|
181
|
-
pointsCost: 1000,
|
|
182
|
-
type: "discount",
|
|
183
|
-
value: "code-15-off",
|
|
184
|
-
isAvailable: true,
|
|
185
|
-
status: "notRedeemed",
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
id: "reward-3",
|
|
189
|
-
name: "Free Shipping",
|
|
190
|
-
description: "Get free shipping on your next order",
|
|
191
|
-
pointsCost: 300,
|
|
192
|
-
type: "discount",
|
|
193
|
-
value: "code-free-shipping",
|
|
194
|
-
isAvailable: true,
|
|
195
|
-
status: "notRedeemed",
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
id: "reward-4",
|
|
199
|
-
name: "Free Product",
|
|
200
|
-
description: "Get a free mystery gift with your next purchase",
|
|
201
|
-
pointsCost: 750,
|
|
202
|
-
type: "freeProduct",
|
|
203
|
-
value: "mystery-gift-001",
|
|
204
|
-
isAvailable: true,
|
|
205
|
-
status: "redeemed",
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
id: "reward-5",
|
|
209
|
-
name: "Early Access",
|
|
210
|
-
description: "Get 24-hour early access to our next sale",
|
|
211
|
-
pointsCost: 1500,
|
|
212
|
-
type: "custom",
|
|
213
|
-
value: "code-early-access",
|
|
214
|
-
isAvailable: true,
|
|
215
|
-
status: "redeemed",
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
id: "reward-6",
|
|
219
|
-
name: "Birthday Double Points",
|
|
220
|
-
description: "Earn 2x points during your birthday month",
|
|
221
|
-
pointsCost: 2000,
|
|
222
|
-
type: "custom",
|
|
223
|
-
value: "code-birthday-double-points",
|
|
224
|
-
isAvailable: false,
|
|
225
|
-
status: "redeemed",
|
|
226
|
-
},
|
|
227
|
-
];
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
getAvailableActivities() {
|
|
232
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
-
if (!this.customer) {
|
|
234
|
-
console.error("No customer found");
|
|
235
|
-
return [];
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
return [
|
|
239
|
-
{
|
|
240
|
-
id: "act_123456",
|
|
241
|
-
type: "download_app",
|
|
242
|
-
points: 100,
|
|
243
|
-
customerId: "yotpo-customer-1",
|
|
244
|
-
status: "completed",
|
|
245
|
-
title: "Download App",
|
|
246
|
-
details: "Lorem ipsum dolor sit amet.",
|
|
247
|
-
reward_text: "100 Points",
|
|
248
|
-
cta_text: "Download",
|
|
249
|
-
icon: "https://picsum.photos/200",
|
|
250
|
-
url: "https://www.apple.com/app-store/",
|
|
251
|
-
metadata: {
|
|
252
|
-
platform: "ios",
|
|
253
|
-
appVersion: "1.0.0",
|
|
254
|
-
},
|
|
255
|
-
createdAt: new Date("2024-03-15T10:30:00Z"),
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
id: "act_234567",
|
|
259
|
-
type: "enable_push_notifications",
|
|
260
|
-
points: 100,
|
|
261
|
-
customerId: "yotpo-customer-1",
|
|
262
|
-
status: "pending",
|
|
263
|
-
title: "Enable Push Notifications",
|
|
264
|
-
details: "Lorem ipsum dolor sit amet.",
|
|
265
|
-
reward_text: "100 Points",
|
|
266
|
-
cta_text: "Enable",
|
|
267
|
-
icon: "https://assets.tapcart.com/default-icon-options/bell-exclamation.svg",
|
|
268
|
-
url: "https://www.apple.com/app-store/",
|
|
269
|
-
metadata: {
|
|
270
|
-
deviceType: "mobile",
|
|
271
|
-
permissionRequested: true,
|
|
272
|
-
},
|
|
273
|
-
createdAt: new Date("2024-03-15T10:31:00Z"),
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
id: "act_345678",
|
|
277
|
-
type: "create_account",
|
|
278
|
-
points: 100,
|
|
279
|
-
customerId: "yotpo-customer-1",
|
|
280
|
-
status: "completed",
|
|
281
|
-
title: "Create Account",
|
|
282
|
-
details: "Lorem ipsum dolor sit amet.",
|
|
283
|
-
reward_text: "100 Points",
|
|
284
|
-
cta_text: "Create",
|
|
285
|
-
icon: "https://assets.tapcart.com/default-icon-options/user.svg",
|
|
286
|
-
url: "https://www.yotpo.com",
|
|
287
|
-
metadata: {
|
|
288
|
-
registrationType: "email",
|
|
289
|
-
isVerified: true,
|
|
290
|
-
},
|
|
291
|
-
createdAt: new Date("2024-03-15T10:29:00Z"),
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
id: "act_456789",
|
|
295
|
-
type: "follow_tiktok",
|
|
296
|
-
points: 100,
|
|
297
|
-
customerId: "yotpo-customer-1",
|
|
298
|
-
status: "pending",
|
|
299
|
-
title: "Follow Tiktok",
|
|
300
|
-
details: "Lorem ipsum dolor sit amet.",
|
|
301
|
-
reward_text: "100 Points",
|
|
302
|
-
cta_text: "Follow",
|
|
303
|
-
icon: "https://assets.tapcart.com/default-icon-options/heart.svg",
|
|
304
|
-
url: "https://www.tiktok.com",
|
|
305
|
-
metadata: {
|
|
306
|
-
platform: "tiktok",
|
|
307
|
-
socialAction: "follow",
|
|
308
|
-
},
|
|
309
|
-
createdAt: new Date("2024-03-15T10:32:00Z"),
|
|
310
|
-
},
|
|
311
|
-
];
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
recordActivity() {
|
|
316
|
-
var _a;
|
|
317
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
318
|
-
if (!this.customer) {
|
|
319
|
-
console.error("No customer found");
|
|
320
|
-
return null;
|
|
321
|
-
}
|
|
322
|
-
return [
|
|
323
|
-
{
|
|
324
|
-
id: "activity-1",
|
|
325
|
-
type: "purchase",
|
|
326
|
-
points: 100,
|
|
327
|
-
customerId: this.customer.id,
|
|
328
|
-
status: "completed",
|
|
329
|
-
createdAt: new Date(),
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
id: "activity-2",
|
|
333
|
-
type: "purchase",
|
|
334
|
-
points: 100,
|
|
335
|
-
customerId: (_a = this.customer) === null || _a === void 0 ? void 0 : _a.id,
|
|
336
|
-
status: "completed",
|
|
337
|
-
createdAt: new Date(),
|
|
338
|
-
},
|
|
339
|
-
];
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
getActivityHistory() {
|
|
343
|
-
var _a, _b, _c;
|
|
344
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
345
|
-
if (!this.customer) {
|
|
346
|
-
console.error("No customer found");
|
|
347
|
-
return null;
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
return [
|
|
351
|
-
{
|
|
352
|
-
id: "activity-3",
|
|
353
|
-
title: "Made a purchase",
|
|
354
|
-
type: "purchase",
|
|
355
|
-
points: 100,
|
|
356
|
-
customerId: (_a = this.customer) === null || _a === void 0 ? void 0 : _a.id,
|
|
357
|
-
status: "completed",
|
|
358
|
-
createdAt: new Date(),
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
id: "activity-1",
|
|
362
|
-
title: "Free shipping",
|
|
363
|
-
type: "redeem",
|
|
364
|
-
points: -1500,
|
|
365
|
-
customerId: (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id,
|
|
366
|
-
status: "completed",
|
|
367
|
-
createdAt: new Date(),
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
id: "activity-2",
|
|
371
|
-
title: "Free product",
|
|
372
|
-
type: "redeem",
|
|
373
|
-
points: -1500,
|
|
374
|
-
customerId: (_c = this.customer) === null || _c === void 0 ? void 0 : _c.id,
|
|
375
|
-
status: "pending",
|
|
376
|
-
createdAt: new Date(),
|
|
377
|
-
},
|
|
378
|
-
];
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
getCustomerTier() {
|
|
383
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
384
|
-
if (!this.customer) {
|
|
385
|
-
console.error("No customer found");
|
|
386
|
-
return null;
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
return {
|
|
390
|
-
id: "tier-1",
|
|
391
|
-
name: "Bronze",
|
|
392
|
-
level: 1,
|
|
393
|
-
requirements: [
|
|
394
|
-
{
|
|
395
|
-
type: "points",
|
|
396
|
-
threshold: 0,
|
|
397
|
-
progress: 200,
|
|
398
|
-
},
|
|
399
|
-
{
|
|
400
|
-
type: "orders",
|
|
401
|
-
threshold: 1,
|
|
402
|
-
progress: 3,
|
|
403
|
-
},
|
|
404
|
-
],
|
|
405
|
-
benefits: ["Free Shipping", "Priority Support"],
|
|
406
|
-
isActive: true,
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
getTiers() {
|
|
412
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
413
|
-
return [
|
|
414
|
-
{
|
|
415
|
-
id: "tier-1",
|
|
416
|
-
name: "Bronze",
|
|
417
|
-
level: 1,
|
|
418
|
-
requirements: [
|
|
419
|
-
{
|
|
420
|
-
type: "points",
|
|
421
|
-
threshold: 1000,
|
|
422
|
-
progress: 200,
|
|
423
|
-
},
|
|
424
|
-
],
|
|
425
|
-
isActive: true,
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
id: "tier-2",
|
|
429
|
-
name: "Silver",
|
|
430
|
-
level: 2,
|
|
431
|
-
requirements: [
|
|
432
|
-
{
|
|
433
|
-
type: "orders",
|
|
434
|
-
threshold: 10,
|
|
435
|
-
progress: 3,
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
type: "referrals",
|
|
439
|
-
threshold: 5,
|
|
440
|
-
progress: 2,
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
type: "amountSpent",
|
|
444
|
-
threshold: 100,
|
|
445
|
-
progress: 50,
|
|
446
|
-
},
|
|
447
|
-
],
|
|
448
|
-
isActive: false,
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
id: "tier-3",
|
|
452
|
-
name: "Gold",
|
|
453
|
-
level: 3,
|
|
454
|
-
requirements: [
|
|
455
|
-
{
|
|
456
|
-
type: "points",
|
|
457
|
-
threshold: 5000,
|
|
458
|
-
progress: 2000,
|
|
459
|
-
},
|
|
460
|
-
],
|
|
461
|
-
isActive: false,
|
|
462
|
-
},
|
|
463
|
-
];
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
createReferral() {
|
|
467
|
-
var _a, _b;
|
|
468
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
469
|
-
if (!this.customer) {
|
|
470
|
-
console.error("No customer found");
|
|
471
|
-
return null;
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
return [
|
|
475
|
-
{
|
|
476
|
-
id: "referral-1",
|
|
477
|
-
referrerId: (_a = this.customer) === null || _a === void 0 ? void 0 : _a.id,
|
|
478
|
-
referredEmail: "friend@example.com",
|
|
479
|
-
status: "completed",
|
|
480
|
-
reward: {
|
|
481
|
-
referrer: 100,
|
|
482
|
-
referred: 50,
|
|
483
|
-
},
|
|
484
|
-
createdAt: new Date(),
|
|
485
|
-
completedAt: new Date(),
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
id: "referral-2",
|
|
489
|
-
referrerId: (_b = this.customer) === null || _b === void 0 ? void 0 : _b.id,
|
|
490
|
-
referredEmail: "friend@example.com",
|
|
491
|
-
status: "completed",
|
|
492
|
-
reward: {
|
|
493
|
-
referrer: 100,
|
|
494
|
-
referred: 50,
|
|
495
|
-
},
|
|
496
|
-
createdAt: new Date(),
|
|
497
|
-
},
|
|
498
|
-
];
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
getReferrals() {
|
|
503
|
-
var _a;
|
|
504
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
505
|
-
if (!this.customer) {
|
|
506
|
-
console.error("No customer found");
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
return [
|
|
511
|
-
{
|
|
512
|
-
id: "referral-1",
|
|
513
|
-
referrerId: (_a = this.customer) === null || _a === void 0 ? void 0 : _a.id,
|
|
514
|
-
referredEmail: "friend@example.com",
|
|
515
|
-
status: "completed",
|
|
516
|
-
reward: {
|
|
517
|
-
referrer: 100,
|
|
518
|
-
referred: 50,
|
|
519
|
-
},
|
|
520
|
-
createdAt: new Date(),
|
|
521
|
-
completedAt: new Date(),
|
|
522
|
-
},
|
|
523
|
-
];
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
}
|