@datlv-trustshop/shopify-inapp-components 0.1.17 → 0.1.19
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.
|
@@ -10,7 +10,7 @@ export const GrowApps = ({ className = "", onAppClick, onDismiss, dismissKey = D
|
|
|
10
10
|
const slidesContainerRef = useRef(null);
|
|
11
11
|
const currentPositionRef = useRef(0);
|
|
12
12
|
const { data } = useDashboard();
|
|
13
|
-
const
|
|
13
|
+
const growAppsTranslations = useTranslation('growApps');
|
|
14
14
|
const allGrowApps = data?.grow_apps || [];
|
|
15
15
|
const displayLimit = data?.grow_apps_display_limit || maxItems;
|
|
16
16
|
const growApps = allGrowApps.slice(0, displayLimit);
|
|
@@ -134,12 +134,12 @@ export const GrowApps = ({ className = "", onAppClick, onDismiss, dismissKey = D
|
|
|
134
134
|
return null;
|
|
135
135
|
}
|
|
136
136
|
if (growApps.length === 0) {
|
|
137
|
-
return (_jsx("div", { className: className, style: { width: "100%" }, children: _jsx(Card, { children: _jsx(Box, { children: _jsx(Text, { variant: "bodyMd", tone: "subdued", as: "p", children:
|
|
137
|
+
return (_jsx("div", { className: className, style: { width: "100%" }, children: _jsx(Card, { children: _jsx(Box, { children: _jsx(Text, { variant: "bodyMd", tone: "subdued", as: "p", children: growAppsTranslations?.noData || "No apps available" }) }) }) }));
|
|
138
138
|
}
|
|
139
139
|
const activator = (_jsx(Button, { icon: MenuHorizontalIcon, variant: "tertiary", onClick: togglePopoverActive, ariaExpanded: popoverActive }));
|
|
140
|
-
return (_jsx("div", { className: className, style: { width: "100%" }, children: _jsx(Card, { children: _jsx(Box, { children: _jsxs(BlockStack, { gap: "200", children: [_jsxs(InlineStack, { align: "space-between", blockAlign: "center", wrap: false, gap: "300", children: [_jsxs(BlockStack, { gap: "100", children: [_jsx(Text, { variant: "headingMd", as: "h3", children:
|
|
140
|
+
return (_jsx("div", { className: className, style: { width: "100%" }, children: _jsx(Card, { children: _jsx(Box, { children: _jsxs(BlockStack, { gap: "200", children: [_jsxs(InlineStack, { align: "space-between", blockAlign: "center", wrap: false, gap: "300", children: [_jsxs(BlockStack, { gap: "100", children: [_jsx(Text, { variant: "headingMd", as: "h3", children: growAppsTranslations?.title || "Grow faster with apps" }), _jsx(Text, { variant: "bodyMd", tone: "subdued", as: "p", children: growAppsTranslations?.subtitle || "Discover powerful apps to enhance your store, streamline workflows, and boost sales." })] }), _jsxs(InlineStack, { gap: "100", wrap: false, children: [showDismiss && (_jsx(Box, { padding: "150", children: _jsx(Popover, { active: popoverActive, activator: activator, onClose: togglePopoverActive, ariaHaspopup: false, children: _jsx(ActionList, { actionRole: "menuitem", items: [
|
|
141
141
|
{
|
|
142
|
-
content:
|
|
142
|
+
content: growAppsTranslations?.dismiss || "Dismiss",
|
|
143
143
|
onAction: handleDismiss,
|
|
144
144
|
},
|
|
145
145
|
] }) }) })), showNavigation && growApps.length > 3 && (_jsxs("div", { style: {
|
|
@@ -189,7 +189,7 @@ export const GrowApps = ({ className = "", onAppClick, onDismiss, dismissKey = D
|
|
|
189
189
|
transform: "translateX(0px)",
|
|
190
190
|
}, children: growApps.map((app, index) => {
|
|
191
191
|
const iconUrl = app.icon_url || app.imageUrl || "";
|
|
192
|
-
const buttonText = app.button_text || app.button_get_app ||
|
|
192
|
+
const buttonText = app.button_text || app.button_get_app || growAppsTranslations?.install || "Get app";
|
|
193
193
|
return (_jsx("div", { "data-index": index, style: {
|
|
194
194
|
flexShrink: 0,
|
|
195
195
|
width: "282px",
|
|
@@ -44,13 +44,19 @@ export const PartnerIntegration = ({ className = "", onManage, onInstall, onOpen
|
|
|
44
44
|
const status = statusProvider?.(item);
|
|
45
45
|
const getBadgeInfo = () => {
|
|
46
46
|
if (status) {
|
|
47
|
-
if (status.isConnected) {
|
|
47
|
+
if (status.isConnected === true) {
|
|
48
48
|
return {
|
|
49
|
-
text: translations.partnerIntegration?.
|
|
49
|
+
text: translations.partnerIntegration?.active || "Active",
|
|
50
50
|
tone: "success",
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
if (status.
|
|
53
|
+
if (status.isConnected === false) {
|
|
54
|
+
return {
|
|
55
|
+
text: translations.partnerIntegration?.inactive || "Inactive",
|
|
56
|
+
tone: undefined,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (status.isActive === true) {
|
|
54
60
|
return {
|
|
55
61
|
text: translations.partnerIntegration?.active || "Active",
|
|
56
62
|
tone: "success",
|
|
@@ -58,7 +64,7 @@ export const PartnerIntegration = ({ className = "", onManage, onInstall, onOpen
|
|
|
58
64
|
}
|
|
59
65
|
if (status.isPending) {
|
|
60
66
|
return {
|
|
61
|
-
text: "Pending",
|
|
67
|
+
text: translations.partnerIntegration?.pending || "Pending",
|
|
62
68
|
tone: "warning",
|
|
63
69
|
};
|
|
64
70
|
}
|
|
@@ -69,18 +75,7 @@ export const PartnerIntegration = ({ className = "", onManage, onInstall, onOpen
|
|
|
69
75
|
};
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
|
-
if
|
|
73
|
-
return {
|
|
74
|
-
text: translations.partnerIntegration?.connected || "Connected",
|
|
75
|
-
tone: "success",
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
if (item.key === "after_ship") {
|
|
79
|
-
return {
|
|
80
|
-
text: translations.partnerIntegration?.inactive || "Inactive",
|
|
81
|
-
tone: undefined,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
78
|
+
// Fall back to button-based logic only if no status provider
|
|
84
79
|
if (item.button_manage_text && item.button_install_text) {
|
|
85
80
|
return {
|
|
86
81
|
text: translations.partnerIntegration?.inactive || "Inactive",
|
|
@@ -100,7 +95,7 @@ export const PartnerIntegration = ({ className = "", onManage, onInstall, onOpen
|
|
|
100
95
|
width: "40px",
|
|
101
96
|
height: "40px",
|
|
102
97
|
borderRadius: "8px",
|
|
103
|
-
} })), _jsx(Box, { children: _jsxs(BlockStack, { gap: "300", children: [_jsxs(BlockStack, { gap: "100", children: [_jsxs(InlineStack, { gap: "200", align: "start", children: [_jsx(Text, { as: "p", variant: "bodyLg", fontWeight: "bold", children: item.title }), badgeInfo && (_jsx(Badge, { tone: badgeInfo.tone, children: badgeInfo.text })), status?.showUpgradeBadge && (_jsxs("div", { onClick: () => onUpgradeClick?.(item), style: {
|
|
98
|
+
} })), _jsx(Box, { minHeight: "130px", children: _jsxs(BlockStack, { gap: "300", children: [_jsxs(BlockStack, { gap: "100", children: [_jsxs(InlineStack, { gap: "200", align: "start", children: [_jsx(Text, { as: "p", variant: "bodyLg", fontWeight: "bold", children: item.title }), badgeInfo && (_jsx(Badge, { tone: badgeInfo.tone, children: badgeInfo.text })), status?.showUpgradeBadge && (_jsxs("div", { onClick: () => onUpgradeClick?.(item), style: {
|
|
104
99
|
cursor: "pointer",
|
|
105
100
|
display: "inline-flex",
|
|
106
101
|
alignItems: "center",
|
|
@@ -118,7 +113,7 @@ export const PartnerIntegration = ({ className = "", onManage, onInstall, onOpen
|
|
|
118
113
|
}, title: status.upgradeBadgeTooltip, children: [status.upgradeBadgeIcon && (_jsx("span", { style: {
|
|
119
114
|
display: "inline-flex",
|
|
120
115
|
alignItems: "center",
|
|
121
|
-
}, children: status.upgradeBadgeIcon })), _jsx("span", { children: status.upgradeBadgeText || "Upgrade" })] }))] }), item.content && (_jsx(Text, { as: "p", variant: "bodyMd", tone: "subdued", children: item.content }))] }), _jsx(InlineStack, { gap: "200", children: status ? (_jsxs(_Fragment, { children: [item.button_install_text && (_jsx(Button, { icon: ExternalIcon, onClick: () => handleInstall(item), children: item.button_install_text })), item.button_manage_text && (_jsx(Button, { onClick: () => handleManage(item), disabled: status.
|
|
116
|
+
}, children: status.upgradeBadgeIcon })), _jsx("span", { children: status.upgradeBadgeText || translations.partnerIntegration?.upgradeBadge?.upgrade || "Upgrade" })] }))] }), item.content && (_jsx(Text, { as: "p", variant: "bodyMd", tone: "subdued", children: item.content }))] }), _jsx(InlineStack, { gap: "200", children: status ? (_jsxs(_Fragment, { children: [item.button_install_text && (_jsx(Button, { icon: ExternalIcon, onClick: () => handleInstall(item), children: item.button_install_text })), item.button_manage_text && (_jsx(Button, { onClick: () => handleManage(item), disabled: item.key === "after_ship" ? (status.isConnected === false || status.showUpgradeBadge === true) : status.showUpgradeBadge === true, children: item.button_manage_text }))] })) : (_jsxs(_Fragment, { children: [item.button_manage_text && (_jsx(Button, { onClick: () => handleManage(item), children: item.button_manage_text })), item.button_install_text && (_jsx(Button, { icon: ExternalIcon, onClick: () => handleInstall(item), children: item.button_install_text }))] })) })] }) })] }) }) }, `integration--${item.id || item.key}`));
|
|
122
117
|
};
|
|
123
118
|
// Loading state
|
|
124
119
|
if (loading) {
|
|
@@ -12,7 +12,8 @@ export function usePartnerIntegrations() {
|
|
|
12
12
|
const reviewSources = integrations.filter((item) => item.category_key === "review_sources");
|
|
13
13
|
if (reviewSources.length > 0) {
|
|
14
14
|
groupsMap.push({
|
|
15
|
-
title: translations.partnerIntegration?.reviewSourcesTitle ||
|
|
15
|
+
title: translations.partnerIntegration?.reviewSourcesTitle ||
|
|
16
|
+
"Review Sources",
|
|
16
17
|
key: "review_sources",
|
|
17
18
|
items: reviewSources.sort((a, b) => a.position - b.position),
|
|
18
19
|
});
|
|
@@ -20,7 +21,8 @@ export function usePartnerIntegrations() {
|
|
|
20
21
|
const postPurchase = integrations.filter((item) => item.category_key === "post_purchase_automation");
|
|
21
22
|
if (postPurchase.length > 0) {
|
|
22
23
|
groupsMap.push({
|
|
23
|
-
title: translations.partnerIntegration?.postPurchaseTitle ||
|
|
24
|
+
title: translations.partnerIntegration?.postPurchaseTitle ||
|
|
25
|
+
"Post-purchase & Automation",
|
|
24
26
|
key: "post_purchase_automation",
|
|
25
27
|
items: postPurchase.sort((a, b) => a.position - b.position),
|
|
26
28
|
});
|
|
@@ -28,16 +30,18 @@ export function usePartnerIntegrations() {
|
|
|
28
30
|
const seoSnippets = integrations.filter((item) => item.category_key === "seo_rich_snippets");
|
|
29
31
|
if (seoSnippets.length > 0) {
|
|
30
32
|
groupsMap.push({
|
|
31
|
-
title: translations.partnerIntegration?.seoSnippetsTitle ||
|
|
33
|
+
title: translations.partnerIntegration?.seoSnippetsTitle ||
|
|
34
|
+
"SEO & Rich Snippets",
|
|
32
35
|
key: "seo_rich_snippets",
|
|
33
36
|
items: seoSnippets.sort((a, b) => a.position - b.position),
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
return groupsMap;
|
|
37
40
|
}, [state.data?.integrations, translations]);
|
|
41
|
+
const isLoading = state.loading || (!state.data && !state.error);
|
|
38
42
|
return {
|
|
39
43
|
groups,
|
|
40
|
-
loading:
|
|
44
|
+
loading: isLoading,
|
|
41
45
|
error: state.error,
|
|
42
46
|
integrations: state.data?.integrations || [],
|
|
43
47
|
};
|
|
@@ -61,8 +65,8 @@ export function usePartnerIntegrationStatus(key) {
|
|
|
61
65
|
return { isConnected: false, isActive: false, isInstalled: false };
|
|
62
66
|
}
|
|
63
67
|
// Check based on integration key and button states
|
|
64
|
-
const isConnected = key ===
|
|
65
|
-
const isActive = key !==
|
|
68
|
+
const isConnected = key === "google_reviews";
|
|
69
|
+
const isActive = key !== "after_ship";
|
|
66
70
|
const isInstalled = !integration.button_install_text;
|
|
67
71
|
return { isConnected, isActive, isInstalled };
|
|
68
72
|
}, [integration, key]);
|
|
@@ -40,6 +40,16 @@ export const defaultTranslations = {
|
|
|
40
40
|
connect: "Connect",
|
|
41
41
|
connected: "Connected",
|
|
42
42
|
inactive: "Inactive",
|
|
43
|
-
active: "Active"
|
|
43
|
+
active: "Active",
|
|
44
|
+
pending: "Pending",
|
|
45
|
+
upgradeBadge: {
|
|
46
|
+
upgradeToBasic: "Upgrade to Basic",
|
|
47
|
+
upgradeToPro: "Upgrade to Pro",
|
|
48
|
+
upgradeToUnlimited: "Upgrade to Unlimited",
|
|
49
|
+
fromBasic: "From Basic",
|
|
50
|
+
fromPro: "From Pro",
|
|
51
|
+
fromUnlimited: "From Unlimited",
|
|
52
|
+
upgrade: "Upgrade",
|
|
53
|
+
}
|
|
44
54
|
}
|
|
45
55
|
};
|
|
@@ -41,6 +41,16 @@ export interface SDKTranslations {
|
|
|
41
41
|
connected?: string;
|
|
42
42
|
inactive?: string;
|
|
43
43
|
active?: string;
|
|
44
|
+
pending?: string;
|
|
45
|
+
upgradeBadge?: {
|
|
46
|
+
upgradeToBasic?: string;
|
|
47
|
+
upgradeToPro?: string;
|
|
48
|
+
upgradeToUnlimited?: string;
|
|
49
|
+
fromBasic?: string;
|
|
50
|
+
fromPro?: string;
|
|
51
|
+
fromUnlimited?: string;
|
|
52
|
+
upgrade?: string;
|
|
53
|
+
};
|
|
44
54
|
};
|
|
45
55
|
}
|
|
46
56
|
export type TranslationKey = keyof SDKTranslations;
|