@datlv-trustshop/shopify-inapp-components 0.1.26 → 0.1.28
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Card, BlockStack, InlineStack, Text, Badge, Button, Box, } from "@shopify/polaris";
|
|
4
|
-
import { XIcon } from "@shopify/polaris-icons";
|
|
5
4
|
import { useCampaignTracking } from "../hooks/useCampaignTracking";
|
|
6
5
|
import { DashboardContext } from "../provider/DashboardProvider";
|
|
7
6
|
export const FloatingCard = ({ data, shopId: propsShopId, onDismiss, onPrimaryAction, onSecondaryAction, position = 'bottom-right', showCloseButton = true, }) => {
|
|
@@ -96,7 +95,7 @@ export const FloatingCard = ({ data, shopId: propsShopId, onDismiss, onPrimaryAc
|
|
|
96
95
|
right: '7px',
|
|
97
96
|
top: '7px',
|
|
98
97
|
borderRadius: '8px',
|
|
99
|
-
background: 'rgba(255, 255, 255, 0.
|
|
98
|
+
background: 'rgba(255, 255, 255, 0.10)',
|
|
100
99
|
border: 'none',
|
|
101
100
|
cursor: 'pointer',
|
|
102
101
|
transition: 'background 0.2s ease',
|
|
@@ -139,11 +138,10 @@ export const FloatingCard = ({ data, shopId: propsShopId, onDismiss, onPrimaryAc
|
|
|
139
138
|
document.head.appendChild(style);
|
|
140
139
|
}
|
|
141
140
|
}, []);
|
|
142
|
-
return (_jsx("div", { ref: tracking?.elementRef, style: floatingCardStyles, children: _jsxs(Card, { padding: "0", roundedAbove: "sm", children: [(showCloseButton && data.dismissible !== false) && (_jsx("button", { style: closeButtonStyles,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}, onClick: handleDismiss, "aria-label": "Close", children: _jsx(XIcon, { style: { width: '20px', height: '20px', color: 'rgba(255, 255, 255, 0.9)' } }) })), _jsxs(BlockStack, { gap: "0", children: [data.img_url && (_jsx("div", { style: imageContainerStyles, children: _jsx("img", { src: data.img_url, alt: data.image_alt || data.title, style: {
|
|
141
|
+
return (_jsx("div", { ref: tracking?.elementRef, style: floatingCardStyles, children: _jsxs(Card, { padding: "0", roundedAbove: "sm", children: [(showCloseButton && data.dismissible !== false) && (_jsx("button", { style: closeButtonStyles, onClick: handleDismiss, "aria-label": "Close", children: _jsx("div", { style: {
|
|
142
|
+
width: "20px",
|
|
143
|
+
height: "20ox"
|
|
144
|
+
}, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", children: _jsx("path", { d: "M6.71967 7.78033C7.01256 8.07322 7.48744 8.07322 7.78033 7.78033C8.07322 7.48744 8.07322 7.01256 7.78033 6.71967L5.06066 4L7.78033 1.28033C8.07322 0.987437 8.07322 0.512563 7.78033 0.21967C7.48744 -0.073223 7.01256 -0.073223 6.71967 0.21967L4 2.93934L1.28033 0.21967C0.987437 -0.0732233 0.512564 -0.0732233 0.21967 0.21967C-0.0732225 0.512563 -0.0732226 0.987437 0.21967 1.28033L2.93934 4L0.21967 6.71967C-0.0732233 7.01256 -0.0732233 7.48744 0.21967 7.78033C0.512563 8.07322 0.987437 8.07322 1.28033 7.78033L4 5.06066L6.71967 7.78033Z", fill: "white", "fill-opacity": "0.6" }) }) }) })), _jsxs(BlockStack, { gap: "0", children: [data.img_url && (_jsx("div", { style: imageContainerStyles, children: _jsx("img", { src: data.img_url, alt: data.image_alt || data.title, style: {
|
|
147
145
|
width: "100%",
|
|
148
146
|
height: "100%",
|
|
149
147
|
objectFit: "cover",
|
|
@@ -113,7 +113,9 @@ export const PartnerIntegration = ({ className = "", onManage, onInstall, onOpen
|
|
|
113
113
|
}, title: status.upgradeBadgeTooltip, children: [status.upgradeBadgeIcon && (_jsx("span", { style: {
|
|
114
114
|
display: "inline-flex",
|
|
115
115
|
alignItems: "center",
|
|
116
|
-
}, children: status.upgradeBadgeIcon })), _jsx("span", {
|
|
116
|
+
}, children: status.upgradeBadgeIcon })), _jsx("span", { style: {
|
|
117
|
+
fontSize: "13px",
|
|
118
|
+
}, children: status.upgradeBadgeText || translations.partnerIntegration?.upgradeBadge?.upgrade || "Upgrade" })] }))] }), item.content && (_jsx(Text, { as: "p", variant: "bodyMd", 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.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}`));
|
|
117
119
|
};
|
|
118
120
|
// Loading state
|
|
119
121
|
if (loading) {
|
|
@@ -37,8 +37,6 @@ export async function trackCampaignView(shopId, campaignId, metadata) {
|
|
|
37
37
|
// Check for deduplication
|
|
38
38
|
const lastTracked = viewTrackingMap.get(dedupKey);
|
|
39
39
|
if (lastTracked && (now - lastTracked) < VIEW_DEDUP_THRESHOLD_MS) {
|
|
40
|
-
// Skip tracking - still within dedup threshold
|
|
41
|
-
console.log(`⏭️ [Campaign Tracking] View skipped (dedup) for campaign ${campaignId} - last tracked ${now - lastTracked}ms ago`);
|
|
42
40
|
return;
|
|
43
41
|
}
|
|
44
42
|
// Update tracking map
|
|
@@ -53,10 +51,6 @@ export async function trackCampaignView(shopId, campaignId, metadata) {
|
|
|
53
51
|
},
|
|
54
52
|
};
|
|
55
53
|
const url = `${TRACKING_BASE_URL}/api/shops/${shopId}/campaigns/${campaignId}/track/view`;
|
|
56
|
-
// Log tracking attempt in development
|
|
57
|
-
console.log(`👁️ [Campaign Tracking] VIEW tracked for campaign ${campaignId}`);
|
|
58
|
-
console.log(`📍 URL: ${url}`);
|
|
59
|
-
console.log(`📦 Payload:`, payload);
|
|
60
54
|
// Fire and forget - no await, no error handling that would break UI
|
|
61
55
|
void fetch(url, {
|
|
62
56
|
method: 'POST',
|
|
@@ -79,7 +73,6 @@ export async function trackCampaignClick(shopId, campaignId, options = {}) {
|
|
|
79
73
|
const { actionType, ctaId, ctaKey, timeToAction, metadata } = options;
|
|
80
74
|
// Validate that at least one required field is present
|
|
81
75
|
if (!actionType && !ctaId && !ctaKey) {
|
|
82
|
-
console.warn('[Campaign Tracking] Click tracking requires at least one of: action_type, cta_id, cta_key');
|
|
83
76
|
return;
|
|
84
77
|
}
|
|
85
78
|
const sessionId = getSessionId();
|
|
@@ -102,11 +95,6 @@ export async function trackCampaignClick(shopId, campaignId, options = {}) {
|
|
|
102
95
|
if (timeToAction !== undefined)
|
|
103
96
|
payload.time_to_action = timeToAction;
|
|
104
97
|
const url = `${TRACKING_BASE_URL}/api/shops/${shopId}/campaigns/${campaignId}/track/click`;
|
|
105
|
-
// Log tracking attempt in development
|
|
106
|
-
console.log(`🖱️ [Campaign Tracking] CLICK tracked for campaign ${campaignId}`);
|
|
107
|
-
console.log(`📍 URL: ${url}`);
|
|
108
|
-
console.log(`📦 Payload:`, payload);
|
|
109
|
-
console.log(`⏱️ Time to action: ${timeToAction}ms`);
|
|
110
98
|
// Fire and forget - no await, no error handling that would break UI
|
|
111
99
|
void fetch(url, {
|
|
112
100
|
method: 'POST',
|