@datlv-trustshop/shopify-inapp-components 0.3.2 → 0.3.3
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/config/component-defaults.d.ts +1 -1
- package/dist/config/component-defaults.js +1 -1
- package/dist/config/component-defaults.js.map +1 -1
- package/dist/core/SDKManager.d.ts +2 -2
- package/dist/hooks/usePartnerIntegration.d.ts.map +1 -1
- package/dist/hooks/usePartnerIntegration.js +8 -3
- package/dist/hooks/usePartnerIntegration.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ export declare const COMPONENT_DEFAULTS: {
|
|
|
16
16
|
readonly enableSwipe: true;
|
|
17
17
|
};
|
|
18
18
|
readonly growApps: {
|
|
19
|
-
readonly maxItems:
|
|
19
|
+
readonly maxItems: 10;
|
|
20
20
|
readonly showDismiss: true;
|
|
21
21
|
readonly showNavigation: true;
|
|
22
22
|
readonly dismissKey: "ts-dashboard-growapps-dismissed";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-defaults.js","sourceRoot":"","sources":["../../src/config/component-defaults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,qBAAqB;IACrB,SAAS,EAAE;QACT,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,KAAK;KACd;IAED,oBAAoB;IACpB,QAAQ,EAAE;QACR,UAAU,EAAE,CAAC;QACb,WAAW,EAAE,EAAE;QACf,cAAc,EAAE,IAAI;QACpB,iBAAiB,EAAE,IAAI;QACvB,WAAW,EAAE,IAAI;KAClB;IAED,oBAAoB;IACpB,QAAQ,EAAE;QACR,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"component-defaults.js","sourceRoot":"","sources":["../../src/config/component-defaults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,q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AAEX;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAAY,EACZ,SAAmD;IAEnD,OAAO;QACL,GAAG,kBAAkB,CAAC,SAAS,CAAC;QAChC,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAI,QAAW,EAAE,UAAuB;IACvE,IAAI,CAAC,UAAU;QAAE,OAAO,QAAQ,CAAC;IAEjC,OAAO,MAAM,CAAC,OAAO,CAAC,QAAe,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,EAAE;QACzE,MAAM,SAAS,GAAI,UAAkB,CAAC,GAAG,CAAC,CAAC;QAE3C,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,GAAG,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC;QAC1B,CAAC;aAAM,IACL,OAAO,YAAY,KAAK,QAAQ;YAChC,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAC5B,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;QACvB,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAS,CAAC,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAAY;IAEZ,gEAAgE;IAChE,kCAAkC;IAClC,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/**\n * Internal component defaults\n * These values are used when props are not provided\n */\n\nexport const COMPONENT_DEFAULTS = {\n // TopBanner defaults\n topBanner: {\n open: true,\n closable: true,\n sticky: false,\n },\n\n // WhatsNew defaults\n whatsNew: {\n maxUpdates: 5,\n maxArticles: 10,\n showNavigation: true,\n showViewAllButton: true,\n enableSwipe: true,\n },\n\n // GrowApps defaults\n growApps: {\n maxItems: 10,\n showDismiss: true,\n showNavigation: true,\n dismissKey: \"ts-dashboard-growapps-dismissed\",\n dismissDuration: 7 * 24 * 60 * 60 * 1000, // 7 days\n },\n\n // PopupBanner defaults\n popupBanner: {\n autoShow: true,\n showDelay: 0,\n persistClose: true,\n storageKey: \"ts-dashboard-popup-closed\",\n },\n\n // PartnerIntegration defaults\n partnerIntegration: {\n showEmptyState: true,\n maxItems: 12,\n },\n\n // Global UI defaults\n ui: {\n animationDuration: 300,\n debounceDelay: 100,\n skeletonCount: 3,\n enableHapticFeedback: false,\n },\n\n // CLS optimization defaults\n cls: {\n reserveSpace: true,\n useSkeletons: true,\n lazyLoadImages: true,\n preventLayoutShift: true,\n },\n\n // Loading defaults\n loading: {\n retryAttempts: 3,\n retryDelay: 1000,\n loadingDelay: 200,\n showSpinner: false,\n },\n\n // Storage defaults\n storage: {\n keyPrefix: \"ts-sdk-\",\n persistenceEnabled: true,\n encryptStorage: false,\n },\n} as const;\n\n/**\n * Get component defaults with optional overrides\n */\nexport function getComponentDefaults<T extends keyof typeof COMPONENT_DEFAULTS>(\n component: T,\n overrides?: Partial<(typeof COMPONENT_DEFAULTS)[T]>,\n): (typeof COMPONENT_DEFAULTS)[T] {\n return {\n ...COMPONENT_DEFAULTS[component],\n ...overrides,\n };\n}\n\n/**\n * Merge user config with defaults\n */\nexport function mergeWithDefaults<T>(defaults: T, userConfig?: Partial<T>): T {\n if (!userConfig) return defaults;\n\n return Object.entries(defaults as any).reduce((acc, [key, defaultValue]) => {\n const userValue = (userConfig as any)[key];\n\n if (userValue === undefined) {\n acc[key] = defaultValue;\n } else if (\n typeof defaultValue === \"object\" &&\n !Array.isArray(defaultValue)\n ) {\n acc[key] = mergeWithDefaults(defaultValue, userValue);\n } else {\n acc[key] = userValue;\n }\n\n return acc;\n }, {} as any);\n}\n\n/**\n * Hook to access component defaults from context\n */\nexport function useComponentDefaults<T extends keyof typeof COMPONENT_DEFAULTS>(\n component: T,\n): (typeof COMPONENT_DEFAULTS)[T] {\n // This would typically access context for any runtime overrides\n // For now, return static defaults\n return COMPONENT_DEFAULTS[component];\n}\n"]}
|
|
@@ -114,7 +114,7 @@ declare class SDKManagerClass {
|
|
|
114
114
|
readonly enableSwipe: true;
|
|
115
115
|
};
|
|
116
116
|
readonly growApps: {
|
|
117
|
-
readonly maxItems:
|
|
117
|
+
readonly maxItems: 10;
|
|
118
118
|
readonly showDismiss: true;
|
|
119
119
|
readonly showNavigation: true;
|
|
120
120
|
readonly dismissKey: "ts-dashboard-growapps-dismissed";
|
|
@@ -202,7 +202,7 @@ export declare function useSDK(options?: UseSDKOptions): {
|
|
|
202
202
|
readonly enableSwipe: true;
|
|
203
203
|
};
|
|
204
204
|
readonly growApps: {
|
|
205
|
-
readonly maxItems:
|
|
205
|
+
readonly maxItems: 10;
|
|
206
206
|
readonly showDismiss: true;
|
|
207
207
|
readonly showNavigation: true;
|
|
208
208
|
readonly dismissKey: "ts-dashboard-growapps-dismissed";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePartnerIntegration.d.ts","sourceRoot":"","sources":["../../src/hooks/usePartnerIntegration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;GAEG;AACH,wBAAgB,sBAAsB;;
|
|
1
|
+
{"version":3,"file":"usePartnerIntegration.d.ts","sourceRoot":"","sources":["../../src/hooks/usePartnerIntegration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;GAEG;AACH,wBAAgB,sBAAsB;;aAsD3B,MAAM;eACJ,MAAM;eACN,GAAG,EAAE;;;;;EAqCjB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,GACV,eAAe,GAAG,IAAI,CAMxB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG;IACxD,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;CACtB,CAeA"}
|
|
@@ -36,12 +36,13 @@ export function usePartnerIntegrations() {
|
|
|
36
36
|
// Get translations
|
|
37
37
|
const translations = sdk.translations?.partnerIntegration || {};
|
|
38
38
|
// Define category order and translation mapping
|
|
39
|
-
|
|
39
|
+
// Temporarily hide 'developer' category
|
|
40
|
+
const categoryOrder = ['review_sources', 'post_purchase_automation', 'seo_rich_snippets']; // 'developer' temporarily removed
|
|
40
41
|
const translationMap = {
|
|
41
42
|
'review_sources': translations.reviewSourcesTitle || 'Review Sources',
|
|
42
43
|
'post_purchase_automation': translations.postPurchaseTitle || 'Post-purchase & Automation',
|
|
43
44
|
'seo_rich_snippets': translations.seoSnippetsTitle || 'SEO & Rich Snippets',
|
|
44
|
-
'developer': translations.developerTitle || 'Developer'
|
|
45
|
+
// 'developer': (translations as any).developerTitle || 'Developer' // Temporarily commented out
|
|
45
46
|
};
|
|
46
47
|
// Build groups in order
|
|
47
48
|
const allGroups = [];
|
|
@@ -56,8 +57,12 @@ export function usePartnerIntegrations() {
|
|
|
56
57
|
delete categoryGroups[categoryKey];
|
|
57
58
|
}
|
|
58
59
|
});
|
|
59
|
-
// Add any remaining categories
|
|
60
|
+
// Add any remaining categories (excluding 'developer' temporarily)
|
|
60
61
|
Object.entries(categoryGroups).forEach(([categoryKey, items]) => {
|
|
62
|
+
// Temporarily skip 'developer' category
|
|
63
|
+
if (categoryKey === 'developer') {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
61
66
|
allGroups.push({
|
|
62
67
|
key: categoryKey,
|
|
63
68
|
title: categoryTitles[categoryKey],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePartnerIntegration.js","sourceRoot":"","sources":["../../src/hooks/usePartnerIntegration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OA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IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;QACrE,CAAC;QAED,mDAAmD;QACnD,MAAM,WAAW,GAAG,GAAG,KAAK,gBAAgB,CAAC;QAC7C,MAAM,QAAQ,GAAG,GAAG,KAAK,YAAY,CAAC;QACtC,MAAM,WAAW,GAAG,CAAC,WAAW,CAAC,mBAAmB,CAAC;QAErD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;IAChD,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import { useMemo } from \"react\";\nimport { useSDK } from \"../core/SDKManager\";\nimport SDKManager from \"../core/SDKManager\";\nimport { IntegrationItem } from \"../types/integration\";\n\n/**\n * Hook to get all partner integrations from dashboard data\n */\nexport function usePartnerIntegrations() {\n const sdk = useSDK({});\n\n // Get dashboard data from SDK\n const dashboardData = SDKManager.getDashboardData();\n\n // Partner integrations are stored directly in the integrations field\n const integrations = useMemo(() => {\n if (!dashboardData?.integrations) {\n return [];\n }\n // Filter out Google Reviews\n return dashboardData.integrations.filter(\n (item: any) =>\n item.key !== \"google_reviews\" && item.title !== \"Google Reviews\",\n );\n }, [dashboardData]);\n\n // Group integrations by category using the API's category_key field\n const groups = useMemo(() => {\n if (!integrations || integrations.length === 0) {\n return [];\n }\n\n // Group by category_key from API\n const categoryGroups: Record<string, any[]> = {};\n const categoryTitles: Record<string, string> = {};\n \n integrations.forEach((item: any) => {\n const categoryKey = item.category_key || 'other';\n const categoryTitle = item.category || 'Other';\n \n if (!categoryGroups[categoryKey]) {\n categoryGroups[categoryKey] = [];\n categoryTitles[categoryKey] = categoryTitle;\n }\n categoryGroups[categoryKey].push(item);\n });\n\n // Get translations\n const translations = sdk.translations?.partnerIntegration || {};\n\n // Define category order and translation mapping\n // Temporarily hide 'developer' category\n const categoryOrder = ['review_sources', 'post_purchase_automation', 'seo_rich_snippets']; // 'developer' temporarily removed\n const translationMap: Record<string, string> = {\n 'review_sources': translations.reviewSourcesTitle || 'Review Sources',\n 'post_purchase_automation': translations.postPurchaseTitle || 'Post-purchase & Automation',\n 'seo_rich_snippets': translations.seoSnippetsTitle || 'SEO & Rich Snippets',\n // 'developer': (translations as any).developerTitle || 'Developer' // Temporarily commented out\n };\n\n // Build groups in order\n const allGroups: Array<{\n key: string;\n title: string;\n items: any[];\n }> = [];\n \n // Add categories in preferred order first\n categoryOrder.forEach(categoryKey => {\n if (categoryGroups[categoryKey]) {\n allGroups.push({\n key: categoryKey,\n title: translationMap[categoryKey] || categoryTitles[categoryKey],\n items: categoryGroups[categoryKey]\n });\n delete categoryGroups[categoryKey];\n }\n });\n \n // Add any remaining categories (excluding 'developer' temporarily)\n Object.entries(categoryGroups).forEach(([categoryKey, items]) => {\n // Temporarily skip 'developer' category\n if (categoryKey === 'developer') {\n return;\n }\n allGroups.push({\n key: categoryKey,\n title: categoryTitles[categoryKey],\n items\n });\n });\n\n return allGroups;\n }, [integrations, sdk.translations]);\n\n return {\n groups,\n loading: sdk.dashboardLoading || false,\n error: sdk.dashboardError || null,\n integrations,\n };\n}\n\n/**\n * Hook to get a specific integration by key\n */\nexport function usePartnerIntegrationByKey(\n key: string,\n): IntegrationItem | null {\n const { integrations } = usePartnerIntegrations();\n\n return useMemo(() => {\n return integrations.find((item: any) => item.key === key) || null;\n }, [integrations, key]);\n}\n\n/**\n * Hook to get integration status\n */\nexport function usePartnerIntegrationStatus(key: string): {\n isConnected: boolean;\n isActive: boolean;\n isInstalled: boolean;\n} {\n const integration = usePartnerIntegrationByKey(key);\n\n return useMemo(() => {\n if (!integration) {\n return { isConnected: false, isActive: false, isInstalled: false };\n }\n\n // Check based on integration key and button states\n const isConnected = key === \"google_reviews\";\n const isActive = key !== \"after_ship\";\n const isInstalled = !integration.button_install_text;\n\n return { isConnected, isActive, isInstalled };\n }, [integration, key]);\n}\n"]}
|