@datlv-trustshop/shopify-inapp-components 0.1.9
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 +141 -0
- package/dist/components/AppList.d.ts +13 -0
- package/dist/components/AppList.js +64 -0
- package/dist/components/ArticleList.d.ts +20 -0
- package/dist/components/ArticleList.js +174 -0
- package/dist/components/ArticleSlide.d.ts +14 -0
- package/dist/components/ArticleSlide.js +151 -0
- package/dist/components/FooterBanner.d.ts +10 -0
- package/dist/components/FooterBanner.js +72 -0
- package/dist/components/GrowApps.d.ts +13 -0
- package/dist/components/GrowApps.js +213 -0
- package/dist/components/ImageLoading.d.ts +15 -0
- package/dist/components/ImageLoading.js +66 -0
- package/dist/components/PartnerList.d.ts +9 -0
- package/dist/components/PartnerList.js +102 -0
- package/dist/components/PopupBanner.d.ts +12 -0
- package/dist/components/PopupBanner.js +100 -0
- package/dist/components/TopBanner.d.ts +14 -0
- package/dist/components/TopBanner.js +31 -0
- package/dist/components/WhatsNew.d.ts +14 -0
- package/dist/components/WhatsNew.js +258 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.js +9 -0
- package/dist/components/inlineStyles.d.ts +110 -0
- package/dist/components/inlineStyles.js +114 -0
- package/dist/components/styles.d.ts +152 -0
- package/dist/components/styles.js +158 -0
- package/dist/core/adapter.d.ts +6 -0
- package/dist/core/adapter.js +301 -0
- package/dist/core/engine.d.ts +33 -0
- package/dist/core/engine.js +176 -0
- package/dist/core/fetcher.d.ts +4 -0
- package/dist/core/fetcher.js +72 -0
- package/dist/core/global-manager.d.ts +99 -0
- package/dist/core/global-manager.js +315 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/useApps.d.ts +3 -0
- package/dist/hooks/useApps.js +18 -0
- package/dist/hooks/useArticles.d.ts +11 -0
- package/dist/hooks/useArticles.js +49 -0
- package/dist/hooks/useBanner.d.ts +5 -0
- package/dist/hooks/useBanner.js +22 -0
- package/dist/hooks/useDashboard.d.ts +11 -0
- package/dist/hooks/useDashboard.js +13 -0
- package/dist/hooks/useGrowApps.d.ts +10 -0
- package/dist/hooks/useGrowApps.js +14 -0
- package/dist/hooks/useTranslations.d.ts +3 -0
- package/dist/hooks/useTranslations.js +9 -0
- package/dist/hooks/useWhatsNew.d.ts +11 -0
- package/dist/hooks/useWhatsNew.js +34 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +16 -0
- package/dist/provider/DashboardProvider.d.ts +36 -0
- package/dist/provider/DashboardProvider.js +184 -0
- package/dist/translations/default.d.ts +2 -0
- package/dist/translations/default.js +27 -0
- package/dist/types/app.d.ts +14 -0
- package/dist/types/app.js +1 -0
- package/dist/types/article.d.ts +14 -0
- package/dist/types/article.js +1 -0
- package/dist/types/banner.d.ts +22 -0
- package/dist/types/banner.js +1 -0
- package/dist/types/dashboard.d.ts +42 -0
- package/dist/types/dashboard.js +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +6 -0
- package/dist/types/partner.d.ts +8 -0
- package/dist/types/partner.js +1 -0
- package/dist/types/product-update.d.ts +23 -0
- package/dist/types/product-update.js +1 -0
- package/dist/types/translations.d.ts +28 -0
- package/dist/types/translations.js +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Banner, Button, Text, BlockStack, InlineStack, } from "@shopify/polaris";
|
|
4
|
+
import { ExternalIcon } from "@shopify/polaris-icons";
|
|
5
|
+
import { useTopBanner } from "../hooks/useBanner";
|
|
6
|
+
export const TopBanner = ({ className = "", onClose, onAction, closable = true, renderBanner, }) => {
|
|
7
|
+
const banner = useTopBanner();
|
|
8
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
9
|
+
const handleClose = () => {
|
|
10
|
+
setIsVisible(false);
|
|
11
|
+
onClose?.();
|
|
12
|
+
};
|
|
13
|
+
const handleAction = () => {
|
|
14
|
+
if (banner) {
|
|
15
|
+
if (banner.link) {
|
|
16
|
+
window.open(banner.link, banner.openType === "new_tab" ? "_blank" : "_self");
|
|
17
|
+
}
|
|
18
|
+
onAction?.(banner);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
if (!banner || !isVisible) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (renderBanner) {
|
|
25
|
+
return (_jsx(_Fragment, { children: renderBanner(banner, {
|
|
26
|
+
onClose: handleClose,
|
|
27
|
+
onAction: handleAction,
|
|
28
|
+
}) }));
|
|
29
|
+
}
|
|
30
|
+
return (_jsx("div", { className: className, style: { width: "100%" }, children: _jsx(Banner, { hideIcon: true, onDismiss: closable ? handleClose : undefined, children: _jsxs(InlineStack, { gap: "400", blockAlign: "center", wrap: false, children: [banner.icon && (_jsx("div", { style: { flexShrink: 0 }, children: _jsx("img", { src: banner.icon, alt: "", width: 72, height: 72, style: { borderRadius: "8px" } }) })), _jsx("div", { style: { flex: 1, minWidth: 0 }, children: _jsxs(BlockStack, { gap: "100", align: "space-between", children: [_jsxs(BlockStack, { gap: "100", children: [_jsx(Text, { variant: "headingSm", as: "h3", children: banner.title }), banner.description && (_jsx(Text, { variant: "bodyMd", tone: "subdued", as: "p", children: banner.description }))] }), banner.link && (_jsx("div", { style: { flexShrink: 0 }, children: _jsx(Button, { icon: ExternalIcon, onClick: handleAction, children: banner.linkText || "Learn More" }) }))] }) })] }) }) }));
|
|
31
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ArticleItem, ProductUpdateItem } from "../types";
|
|
3
|
+
export interface WhatsNewProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
onProductUpdateClick?: (update: ProductUpdateItem) => void;
|
|
6
|
+
onArticleClick?: (article: ArticleItem) => void;
|
|
7
|
+
onViewAllUpdates?: () => void;
|
|
8
|
+
onViewAllArticles?: () => void;
|
|
9
|
+
maxUpdates?: number;
|
|
10
|
+
showNavigation?: boolean;
|
|
11
|
+
showViewAllButton?: boolean;
|
|
12
|
+
navigate?: (url: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const WhatsNew: React.FC<WhatsNewProps>;
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
3
|
+
import { Button, Tabs, Text, BlockStack, InlineStack, Box, Card, } from "@shopify/polaris";
|
|
4
|
+
import { ExternalIcon } from "@shopify/polaris-icons";
|
|
5
|
+
import { ArticleList } from "./ArticleList";
|
|
6
|
+
import ImageLoading from "./ImageLoading";
|
|
7
|
+
import { useArticles, useWhatsNew } from "../hooks";
|
|
8
|
+
import { useTranslation } from "../hooks/useTranslations";
|
|
9
|
+
import { sdkStyles, mergeStyles } from "./styles";
|
|
10
|
+
export const WhatsNew = ({ className = "", onProductUpdateClick, onArticleClick, onViewAllUpdates, onViewAllArticles, maxUpdates = 5, showNavigation = true, showViewAllButton = true, navigate, }) => {
|
|
11
|
+
const [productUpdateIndex, setProductUpdateIndex] = useState(0);
|
|
12
|
+
const [articleIndex, setArticleIndex] = useState(0);
|
|
13
|
+
const [selectedTab, setSelectedTab] = useState(0);
|
|
14
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
15
|
+
const touchStartX = useRef(null);
|
|
16
|
+
const touchEndX = useRef(null);
|
|
17
|
+
const swiping = useRef(false);
|
|
18
|
+
const slideContainerRef = useRef(null);
|
|
19
|
+
const articles = useArticles();
|
|
20
|
+
const whatsNew = useWhatsNew();
|
|
21
|
+
const t = useTranslation('whatsNew');
|
|
22
|
+
const limitedUpdates = whatsNew.updates.slice(0, maxUpdates);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const handleResize = () => {
|
|
25
|
+
setIsMobile(window.innerWidth <= 768);
|
|
26
|
+
};
|
|
27
|
+
handleResize();
|
|
28
|
+
window.addEventListener("resize", handleResize);
|
|
29
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
30
|
+
}, []);
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (limitedUpdates.length > 0) {
|
|
33
|
+
}
|
|
34
|
+
}, [limitedUpdates]);
|
|
35
|
+
const articlesList = articles.articles;
|
|
36
|
+
const nextSlide = () => {
|
|
37
|
+
if (selectedTab === 0) {
|
|
38
|
+
setProductUpdateIndex((prevIndex) => {
|
|
39
|
+
const newIndex = Math.min(prevIndex + 1, limitedUpdates.length - 1);
|
|
40
|
+
return newIndex;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
setArticleIndex((prevIndex) => {
|
|
45
|
+
if (isMobile) {
|
|
46
|
+
const newIndex = Math.min(prevIndex + 1, articlesList.length - 1);
|
|
47
|
+
return newIndex;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const visibleItems = 3;
|
|
51
|
+
const maxIndex = Math.max(0, articlesList.length - visibleItems);
|
|
52
|
+
const newIndex = Math.min(prevIndex + 1, maxIndex);
|
|
53
|
+
return newIndex;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const prevSlide = () => {
|
|
59
|
+
if (selectedTab === 0) {
|
|
60
|
+
setProductUpdateIndex((prevIndex) => {
|
|
61
|
+
const newIndex = Math.max(prevIndex - 1, 0);
|
|
62
|
+
return newIndex;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
setArticleIndex((prevIndex) => {
|
|
67
|
+
const newIndex = Math.max(prevIndex - 1, 0);
|
|
68
|
+
return newIndex;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const handleTouchStart = (e) => {
|
|
73
|
+
touchStartX.current = e.touches[0].clientX;
|
|
74
|
+
swiping.current = true;
|
|
75
|
+
};
|
|
76
|
+
const handleTouchMove = (e) => {
|
|
77
|
+
if (!swiping.current)
|
|
78
|
+
return;
|
|
79
|
+
touchEndX.current = e.touches[0].clientX;
|
|
80
|
+
};
|
|
81
|
+
const handleTouchEnd = () => {
|
|
82
|
+
if (!swiping.current)
|
|
83
|
+
return;
|
|
84
|
+
const swipeThreshold = 50;
|
|
85
|
+
const diff = (touchStartX.current || 0) - (touchEndX.current || 0);
|
|
86
|
+
if (Math.abs(diff) > swipeThreshold) {
|
|
87
|
+
if (diff > 0) {
|
|
88
|
+
nextSlide();
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
prevSlide();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
swiping.current = false;
|
|
95
|
+
touchStartX.current = null;
|
|
96
|
+
touchEndX.current = null;
|
|
97
|
+
};
|
|
98
|
+
const handleProductUpdateClick = (update) => {
|
|
99
|
+
const tryUrl = update.button_try_url || update.link;
|
|
100
|
+
if (update.id === "feature_up_vote") {
|
|
101
|
+
window.dispatchEvent(new CustomEvent("openFeatureBoard", {
|
|
102
|
+
detail: { source: "whatsnew" },
|
|
103
|
+
}));
|
|
104
|
+
onProductUpdateClick?.(update);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (tryUrl && tryUrl !== "modal") {
|
|
108
|
+
if (tryUrl.startsWith("/")) {
|
|
109
|
+
if (navigate) {
|
|
110
|
+
navigate(tryUrl);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const currentUrl = window.location.href;
|
|
114
|
+
const shopifyAdminMatch = currentUrl.match(/https:\/\/admin\.shopify\.com\/store\/([^\/]+)\/apps\/([^\/]+)/);
|
|
115
|
+
if (shopifyAdminMatch) {
|
|
116
|
+
const [, storeName, appName] = shopifyAdminMatch;
|
|
117
|
+
const shopifyAppUrl = `https://admin.shopify.com/store/${storeName}/apps/${appName}${tryUrl}`;
|
|
118
|
+
window.location.href = shopifyAppUrl;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
window.location.href = tryUrl;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else if (tryUrl.startsWith("http://") ||
|
|
126
|
+
tryUrl.startsWith("https://")) {
|
|
127
|
+
window.open(tryUrl, "_blank");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (tryUrl === "modal") {
|
|
131
|
+
// console.log("Modal action for:", update.id);
|
|
132
|
+
}
|
|
133
|
+
onProductUpdateClick?.(update);
|
|
134
|
+
};
|
|
135
|
+
const handleArticleClick = (article) => {
|
|
136
|
+
if (article.link) {
|
|
137
|
+
window.open(article.link, "_blank");
|
|
138
|
+
}
|
|
139
|
+
onArticleClick?.(article);
|
|
140
|
+
};
|
|
141
|
+
const handleViewAllUpdates = () => {
|
|
142
|
+
if (onViewAllUpdates) {
|
|
143
|
+
onViewAllUpdates();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
window.open("https://trust1.io/updates/", "_blank");
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const handleViewAllArticles = () => {
|
|
150
|
+
if (onViewAllArticles) {
|
|
151
|
+
onViewAllArticles();
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
window.open("https://trust1.io/blog/", "_blank");
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const tabs = [
|
|
158
|
+
{ id: "product-update", content: t.tabs?.productUpdate || "Product Updates" },
|
|
159
|
+
{ id: "article", content: t.tabs?.article || "Articles" },
|
|
160
|
+
];
|
|
161
|
+
const isPrevDisabled = selectedTab === 0 ? productUpdateIndex === 0 : articleIndex === 0;
|
|
162
|
+
const isNextDisabled = selectedTab === 0
|
|
163
|
+
? productUpdateIndex === limitedUpdates.length - 1
|
|
164
|
+
: (() => {
|
|
165
|
+
if (isMobile) {
|
|
166
|
+
return articleIndex === articlesList.length - 1;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const visibleItems = 3;
|
|
170
|
+
const maxIndex = Math.max(0, articlesList.length - visibleItems);
|
|
171
|
+
return articleIndex >= maxIndex;
|
|
172
|
+
}
|
|
173
|
+
})();
|
|
174
|
+
if (limitedUpdates.length === 0 && articlesList.length === 0) {
|
|
175
|
+
return (_jsx("div", { style: mergeStyles(sdkStyles.dashboardWhatsNew), className: className, children: _jsx(Card, { children: _jsx(BlockStack, { gap: "400", children: _jsx(Text, { variant: "bodyMd", tone: "subdued", as: "p", children: t.noData || "No updates available" }) }) }) }));
|
|
176
|
+
}
|
|
177
|
+
const mobileStyles = isMobile
|
|
178
|
+
? {
|
|
179
|
+
slidesContainer: {
|
|
180
|
+
overflowX: "auto",
|
|
181
|
+
scrollSnapType: "x mandatory",
|
|
182
|
+
WebkitOverflowScrolling: "touch",
|
|
183
|
+
scrollbarWidth: "none",
|
|
184
|
+
msOverflowStyle: "none",
|
|
185
|
+
},
|
|
186
|
+
slidesWrapper: {
|
|
187
|
+
scrollSnapAlign: "start",
|
|
188
|
+
},
|
|
189
|
+
slideBox: {
|
|
190
|
+
scrollSnapAlign: "center",
|
|
191
|
+
flex: "0 0 85%",
|
|
192
|
+
maxWidth: "85%",
|
|
193
|
+
},
|
|
194
|
+
slideImage: {
|
|
195
|
+
display: "none",
|
|
196
|
+
},
|
|
197
|
+
hideScrollbar: {
|
|
198
|
+
"&::-webkit-scrollbar": {
|
|
199
|
+
display: "none",
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
}
|
|
203
|
+
: {};
|
|
204
|
+
return (_jsxs("div", { style: mergeStyles(sdkStyles.dashboardWhatsNew), className: className, children: [_jsx("style", { children: `
|
|
205
|
+
.whats-new-mobile-scrollbar::-webkit-scrollbar {
|
|
206
|
+
display: none;
|
|
207
|
+
}
|
|
208
|
+
` }), _jsx(Card, { children: _jsxs(BlockStack, { gap: "400", children: [_jsxs(BlockStack, { gap: "100", children: [_jsx("div", { style: {
|
|
209
|
+
fontSize: "16px",
|
|
210
|
+
fontWeight: "650",
|
|
211
|
+
lineHeight: "24px",
|
|
212
|
+
color: "#303030",
|
|
213
|
+
marginBottom: "8px",
|
|
214
|
+
margin: 0,
|
|
215
|
+
}, children: t.title || "What's New" }), _jsxs(InlineStack, { gap: "300", blockAlign: "center", align: "space-between", children: [_jsxs("div", { className: "custom-tabs--wrapper-dashboard", style: {
|
|
216
|
+
margin: "0",
|
|
217
|
+
padding: "0",
|
|
218
|
+
}, children: [_jsx("style", { children: `
|
|
219
|
+
.custom-tabs--wrapper-dashboard .Polaris-Box {
|
|
220
|
+
--pc-box-padding-inline-start-md: 0 !important;
|
|
221
|
+
--pc-box-padding-inline-end-md: 0 !important;
|
|
222
|
+
}
|
|
223
|
+
.custom-tabs--wrapper-dashboard .Polaris-Tabs {
|
|
224
|
+
padding: 0 !important;
|
|
225
|
+
}
|
|
226
|
+
.custom-tabs--wrapper-dashboard .Polaris-Tabs__Wrapper {
|
|
227
|
+
padding: 0 !important;
|
|
228
|
+
overflow-y: hidden;
|
|
229
|
+
}
|
|
230
|
+
` }), _jsx(Tabs, { tabs: tabs, selected: selectedTab, onSelect: setSelectedTab })] }), _jsxs(InlineStack, { gap: "200", children: [showViewAllButton && (_jsx(Button, { icon: ExternalIcon, onClick: selectedTab === 0
|
|
231
|
+
? handleViewAllUpdates
|
|
232
|
+
: handleViewAllArticles, children: selectedTab === 0
|
|
233
|
+
? (t.buttonViewAll?.productUpdate || "View all updates")
|
|
234
|
+
: (t.buttonViewAll?.article || "View all articles") })), showNavigation && !isMobile && (_jsxs("div", { style: sdkStyles.slideNavigation, children: [_jsx("button", { onClick: prevSlide, disabled: isPrevDisabled, style: mergeStyles(sdkStyles.slideButton, isPrevDisabled ? sdkStyles.slideButtonDisabled : {}, {
|
|
235
|
+
cursor: isPrevDisabled ? "not-allowed" : "pointer",
|
|
236
|
+
opacity: isPrevDisabled ? 0.5 : 1,
|
|
237
|
+
}), children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: _jsx("path", { d: "M10.5 13L5.5 8l5-5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", fill: "none" }) }) }), _jsx("button", { onClick: nextSlide, disabled: isNextDisabled, style: mergeStyles(sdkStyles.slideButton, isNextDisabled ? sdkStyles.slideButtonDisabled : {}, {
|
|
238
|
+
cursor: isNextDisabled ? "not-allowed" : "pointer",
|
|
239
|
+
opacity: isNextDisabled ? 0.5 : 1,
|
|
240
|
+
}), children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: _jsx("path", { d: "M5.5 13l5-5-5-5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", fill: "none" }) }) })] }))] })] })] }), _jsx(Box, { children: selectedTab === 0 ? (_jsx("div", { ref: slideContainerRef, style: mergeStyles(sdkStyles.slidesContainer, mobileStyles.slidesContainer, { scrollbarWidth: "none" }), className: isMobile ? "whats-new-mobile-scrollbar" : "", onTouchStart: isMobile ? handleTouchStart : undefined, onTouchMove: isMobile ? handleTouchMove : undefined, onTouchEnd: isMobile ? handleTouchEnd : undefined, children: _jsx("div", { style: mergeStyles(sdkStyles.slidesWrapper, mobileStyles.slidesWrapper, {
|
|
241
|
+
transform: isMobile
|
|
242
|
+
? "none"
|
|
243
|
+
: `translateX(-${productUpdateIndex * 90}%)`,
|
|
244
|
+
}), children: limitedUpdates.map((update) => (_jsxs("div", { style: mergeStyles(sdkStyles.slideBox, isMobile ? mobileStyles.slideBox : {}), children: [_jsxs("div", { style: sdkStyles.slideContent, children: [_jsx(Text, { variant: "headingMd", as: "h3", children: update.title }), (update.releaseDate || update.date_time) && (_jsx(Text, { variant: "bodySm", tone: "subdued", as: "p", children: update.releaseDate || update.date_time })), (update.description || update.content?.text) && (_jsx(Text, { as: "p", children: update.description || update.content?.text })), update.features && update.features.length > 0 && (_jsx("ul", { style: { paddingLeft: "20px", margin: 0 }, children: update.features.map((item, idx) => (_jsx("li", { style: {
|
|
245
|
+
fontSize: "13px",
|
|
246
|
+
lineHeight: 1.4,
|
|
247
|
+
marginBottom: "4px",
|
|
248
|
+
}, children: item }, idx))) })), _jsxs(InlineStack, { gap: "200", children: [(update.button_try_url || update.link) && (_jsx(Button, { onClick: () => handleProductUpdateClick(update), children: update.button_try_it_now || "Try it now" })), (update.button_learn_url || update.link) && (_jsx(Button, { variant: !(update.button_try_url || update.link)
|
|
249
|
+
? "secondary"
|
|
250
|
+
: "monochromePlain", onClick: () => {
|
|
251
|
+
const learnUrl = update.button_learn_url || update.link;
|
|
252
|
+
if (learnUrl && learnUrl !== "modal") {
|
|
253
|
+
window.open(learnUrl, "_blank");
|
|
254
|
+
}
|
|
255
|
+
}, children: update.button_learn_more || "Learn more" }))] })] }), _jsx("div", { style: mergeStyles(sdkStyles.slideImage, isMobile ? mobileStyles.slideImage : {}), children: _jsx(ImageLoading, { src: update.imageUrl ||
|
|
256
|
+
update.image_url ||
|
|
257
|
+
"https://asset.trustshop.io/dashboard/news-review-summary.png", alt: `what-new-${update.id}`, width: 712, height: 400, borderRadius: 12 }) })] }, update.id))) }) })) : (_jsx("div", { ref: slideContainerRef, style: mergeStyles(sdkStyles.slidesContainer, { overflow: "hidden", scrollbarWidth: "none" }, mobileStyles.slidesContainer), className: isMobile ? "whats-new-mobile-scrollbar" : "", onTouchStart: isMobile ? handleTouchStart : undefined, onTouchMove: isMobile ? handleTouchMove : undefined, onTouchEnd: isMobile ? handleTouchEnd : undefined, children: _jsx(ArticleList, { layout: "slide", onArticleClick: handleArticleClick, showThumbnail: true, showAuthor: true, showDate: true, currentIndex: articleIndex, onSlideChange: setArticleIndex, showNavigation: false }) })) })] }) })] }));
|
|
258
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./PopupBanner";
|
|
2
|
+
export * from "./TopBanner";
|
|
3
|
+
export * from "./FooterBanner";
|
|
4
|
+
export * from "./AppList";
|
|
5
|
+
export * from "./ArticleList";
|
|
6
|
+
export * from "./ArticleSlide";
|
|
7
|
+
export * from "./WhatsNew";
|
|
8
|
+
export * from "./GrowApps";
|
|
9
|
+
export * from "./PartnerList";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./PopupBanner";
|
|
2
|
+
export * from "./TopBanner";
|
|
3
|
+
export * from "./FooterBanner";
|
|
4
|
+
export * from "./AppList";
|
|
5
|
+
export * from "./ArticleList";
|
|
6
|
+
export * from "./ArticleSlide";
|
|
7
|
+
export * from "./WhatsNew";
|
|
8
|
+
export * from "./GrowApps";
|
|
9
|
+
export * from "./PartnerList";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline styles for SDK components
|
|
3
|
+
* These replace external CSS dependencies to make components self-contained
|
|
4
|
+
*/
|
|
5
|
+
import { CSSProperties } from "react";
|
|
6
|
+
export declare const slideStyles: {
|
|
7
|
+
slidesContainer: {
|
|
8
|
+
position: "relative";
|
|
9
|
+
width: string;
|
|
10
|
+
overflow: string;
|
|
11
|
+
margin: number;
|
|
12
|
+
};
|
|
13
|
+
slidesWrapper: {
|
|
14
|
+
display: string;
|
|
15
|
+
transition: string;
|
|
16
|
+
gap: string;
|
|
17
|
+
willChange: string;
|
|
18
|
+
};
|
|
19
|
+
slideNavigation: {
|
|
20
|
+
position: "relative";
|
|
21
|
+
width: string;
|
|
22
|
+
boxSizing: "content-box";
|
|
23
|
+
padding: string;
|
|
24
|
+
display: string;
|
|
25
|
+
flexDirection: "row";
|
|
26
|
+
flexWrap: "nowrap";
|
|
27
|
+
gap: string;
|
|
28
|
+
borderRadius: string;
|
|
29
|
+
backgroundColor: string;
|
|
30
|
+
};
|
|
31
|
+
slideButton: {
|
|
32
|
+
display: string;
|
|
33
|
+
alignItems: string;
|
|
34
|
+
justifyContent: string;
|
|
35
|
+
width: string;
|
|
36
|
+
height: string;
|
|
37
|
+
padding: number;
|
|
38
|
+
border: string;
|
|
39
|
+
borderRadius: string;
|
|
40
|
+
backgroundColor: string;
|
|
41
|
+
cursor: string;
|
|
42
|
+
transition: string;
|
|
43
|
+
};
|
|
44
|
+
slideButtonDisabled: {
|
|
45
|
+
cursor: string;
|
|
46
|
+
opacity: number;
|
|
47
|
+
};
|
|
48
|
+
slideItem: {
|
|
49
|
+
flex: string;
|
|
50
|
+
width: string;
|
|
51
|
+
};
|
|
52
|
+
slideItemMobile: {
|
|
53
|
+
width: string;
|
|
54
|
+
};
|
|
55
|
+
slideNav: {
|
|
56
|
+
position: "absolute";
|
|
57
|
+
top: string;
|
|
58
|
+
transform: string;
|
|
59
|
+
background: string;
|
|
60
|
+
border: string;
|
|
61
|
+
borderRadius: string;
|
|
62
|
+
width: string;
|
|
63
|
+
height: string;
|
|
64
|
+
display: string;
|
|
65
|
+
alignItems: string;
|
|
66
|
+
justifyContent: string;
|
|
67
|
+
cursor: string;
|
|
68
|
+
zIndex: number;
|
|
69
|
+
transition: string;
|
|
70
|
+
};
|
|
71
|
+
slideNavPrev: {
|
|
72
|
+
left: string;
|
|
73
|
+
};
|
|
74
|
+
slideNavNext: {
|
|
75
|
+
right: string;
|
|
76
|
+
};
|
|
77
|
+
slideDots: {
|
|
78
|
+
display: string;
|
|
79
|
+
justifyContent: string;
|
|
80
|
+
gap: string;
|
|
81
|
+
marginTop: string;
|
|
82
|
+
};
|
|
83
|
+
slideDot: {
|
|
84
|
+
width: string;
|
|
85
|
+
height: string;
|
|
86
|
+
borderRadius: string;
|
|
87
|
+
backgroundColor: string;
|
|
88
|
+
cursor: string;
|
|
89
|
+
transition: string;
|
|
90
|
+
};
|
|
91
|
+
slideDotActive: {
|
|
92
|
+
backgroundColor: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export declare const growAppsStyles: {
|
|
96
|
+
truncateText: {
|
|
97
|
+
display: string;
|
|
98
|
+
WebkitLineClamp: number;
|
|
99
|
+
WebkitBoxOrient: "vertical";
|
|
100
|
+
overflow: string;
|
|
101
|
+
textOverflow: string;
|
|
102
|
+
fontSize: string;
|
|
103
|
+
color: string;
|
|
104
|
+
lineHeight: number;
|
|
105
|
+
};
|
|
106
|
+
dashboardGrowApps: {
|
|
107
|
+
width: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
export declare const mergeStyles: (...styles: (CSSProperties | undefined)[]) => CSSProperties;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline styles for SDK components
|
|
3
|
+
* These replace external CSS dependencies to make components self-contained
|
|
4
|
+
*/
|
|
5
|
+
// Slide container and wrapper styles
|
|
6
|
+
export const slideStyles = {
|
|
7
|
+
slidesContainer: {
|
|
8
|
+
position: "relative",
|
|
9
|
+
width: "100%",
|
|
10
|
+
overflow: "hidden",
|
|
11
|
+
margin: 0,
|
|
12
|
+
},
|
|
13
|
+
slidesWrapper: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
transition: "transform 0.5s ease-in-out",
|
|
16
|
+
gap: "20px",
|
|
17
|
+
willChange: "transform",
|
|
18
|
+
},
|
|
19
|
+
slideNavigation: {
|
|
20
|
+
position: "relative",
|
|
21
|
+
width: "fit-content",
|
|
22
|
+
boxSizing: "content-box",
|
|
23
|
+
padding: "4px 6px",
|
|
24
|
+
display: "flex",
|
|
25
|
+
flexDirection: "row",
|
|
26
|
+
flexWrap: "nowrap",
|
|
27
|
+
gap: "4px",
|
|
28
|
+
borderRadius: "8px",
|
|
29
|
+
backgroundColor: "#e3e3e3",
|
|
30
|
+
},
|
|
31
|
+
slideButton: {
|
|
32
|
+
display: "flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
width: "24px",
|
|
36
|
+
height: "24px",
|
|
37
|
+
padding: 0,
|
|
38
|
+
border: "none",
|
|
39
|
+
borderRadius: "4px",
|
|
40
|
+
backgroundColor: "transparent",
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
transition: "background-color 0.2s ease",
|
|
43
|
+
},
|
|
44
|
+
slideButtonDisabled: {
|
|
45
|
+
cursor: "not-allowed",
|
|
46
|
+
opacity: 0.5,
|
|
47
|
+
},
|
|
48
|
+
slideItem: {
|
|
49
|
+
flex: "0 0 auto",
|
|
50
|
+
width: "270px",
|
|
51
|
+
},
|
|
52
|
+
slideItemMobile: {
|
|
53
|
+
width: "90%",
|
|
54
|
+
},
|
|
55
|
+
slideNav: {
|
|
56
|
+
position: "absolute",
|
|
57
|
+
top: "50%",
|
|
58
|
+
transform: "translateY(-50%)",
|
|
59
|
+
background: "rgba(255, 255, 255, 0.9)",
|
|
60
|
+
border: "1px solid #e3e3e3",
|
|
61
|
+
borderRadius: "50%",
|
|
62
|
+
width: "32px",
|
|
63
|
+
height: "32px",
|
|
64
|
+
display: "flex",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
justifyContent: "center",
|
|
67
|
+
cursor: "pointer",
|
|
68
|
+
zIndex: 10,
|
|
69
|
+
transition: "background-color 0.2s",
|
|
70
|
+
},
|
|
71
|
+
slideNavPrev: {
|
|
72
|
+
left: "10px",
|
|
73
|
+
},
|
|
74
|
+
slideNavNext: {
|
|
75
|
+
right: "10px",
|
|
76
|
+
},
|
|
77
|
+
slideDots: {
|
|
78
|
+
display: "flex",
|
|
79
|
+
justifyContent: "center",
|
|
80
|
+
gap: "8px",
|
|
81
|
+
marginTop: "16px",
|
|
82
|
+
},
|
|
83
|
+
slideDot: {
|
|
84
|
+
width: "8px",
|
|
85
|
+
height: "8px",
|
|
86
|
+
borderRadius: "50%",
|
|
87
|
+
backgroundColor: "#e3e3e3",
|
|
88
|
+
cursor: "pointer",
|
|
89
|
+
transition: "background-color 0.3s",
|
|
90
|
+
},
|
|
91
|
+
slideDotActive: {
|
|
92
|
+
backgroundColor: "#303030",
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
// GrowApps specific styles
|
|
96
|
+
export const growAppsStyles = {
|
|
97
|
+
truncateText: {
|
|
98
|
+
display: "-webkit-box",
|
|
99
|
+
WebkitLineClamp: 3,
|
|
100
|
+
WebkitBoxOrient: "vertical",
|
|
101
|
+
overflow: "hidden",
|
|
102
|
+
textOverflow: "ellipsis",
|
|
103
|
+
fontSize: "13px",
|
|
104
|
+
color: "#616161",
|
|
105
|
+
lineHeight: 1.4,
|
|
106
|
+
},
|
|
107
|
+
dashboardGrowApps: {
|
|
108
|
+
width: "100%",
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
// Helper function to merge styles
|
|
112
|
+
export const mergeStyles = (...styles) => {
|
|
113
|
+
return Object.assign({}, ...styles.filter(Boolean));
|
|
114
|
+
};
|