@progus/connector 0.5.0 → 0.5.2

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 CHANGED
@@ -1,7 +1,6 @@
1
1
  # @progus/connector
2
2
 
3
- Headless connector for Progus partner/affiliate tracking, partner ID assignment,
4
- and cross-sell offers.
3
+ Headless connector for Progus partner/affiliate tracking and partner ID assignment.
5
4
 
6
5
  ## Installation
7
6
 
@@ -51,19 +50,6 @@ if (result.success) {
51
50
  }
52
51
  ```
53
52
 
54
- ## Cross-sell offers (remote catalog)
55
-
56
- ```ts
57
- import { getCrossSellOffersFromApi } from "@progus/connector/browser";
58
-
59
- const offers = await getCrossSellOffersFromApi({
60
- appName: "progus_store_locator",
61
- installedAppKeys: ["progus_cod"],
62
- appsCatalogUrl: "https://appsdata.progus.workers.dev/recommendations",
63
- limit: 3,
64
- });
65
- ```
66
-
67
53
  ## Optional signing helper
68
54
 
69
55
  ```ts
@@ -72,11 +58,9 @@ import { signPayload } from "@progus/connector";
72
58
  const signature = signPayload(JSON.stringify({ test: true }), process.env.PARTNERS_SECRET_KEY!);
73
59
  ```
74
60
 
75
- ## UI components (browser-safe)
61
+ ## UI components and cross-sell
76
62
 
77
- ```tsx
78
- import { Recommendations, PartnerIdCard } from "@progus/connector/ui";
79
- ```
63
+ Use `@progus/connector-ui` for browser-safe helpers and UI components.
80
64
 
81
65
  ## Environment variables
82
66
 
package/dist/index.cjs CHANGED
@@ -21,9 +21,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  createProgusConnector: () => createProgusConnector,
24
- fetchAppsCatalog: () => fetchAppsCatalog,
25
- getCrossSellOffers: () => getCrossSellOffers,
26
- getCrossSellOffersFromApi: () => getCrossSellOffersFromApi,
27
24
  normalizePartnerId: () => normalizePartnerId,
28
25
  signPayload: () => signPayload
29
26
  });
@@ -165,7 +162,7 @@ function createProgusConnector(config) {
165
162
  if (!apiBaseUrl || !config.signingSecret) {
166
163
  return { success: false, message: "Partners API configuration not set", status: 500 };
167
164
  }
168
- const requestBody = JSON.stringify({ shop: payload.shopDomain });
165
+ const requestBody = JSON.stringify({ shop: payload.shopDomain, appName: config.appKey });
169
166
  const headers = {
170
167
  "Content-Type": "application/json",
171
168
  "x-progus-hmac-sha256": signPayload(requestBody, config.signingSecret)
@@ -209,58 +206,9 @@ function createProgusConnector(config) {
209
206
  checkPartnerId
210
207
  };
211
208
  }
212
-
213
- // src/crossSell.ts
214
- function getCrossSellOffers(options = {}) {
215
- const appsCatalog = options.appsCatalog ?? [];
216
- const installedKeys = new Set(
217
- [options.appName, ...options.installedAppKeys ?? []].filter(
218
- (key) => Boolean(key)
219
- )
220
- );
221
- const locale = options.locale;
222
- return appsCatalog.filter((app) => app.enabled !== false).filter((app) => locale ? !app.locales || app.locales.includes(locale) : true).filter((app) => !installedKeys.has(app.key)).sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
223
- }
224
- var DEFAULT_APPS_CATALOG_URL = "https://appsdata.progus.workers.dev/recommendations";
225
- async function fetchAppsCatalog(options = {}) {
226
- const fetchImpl = options.fetch ?? globalThis.fetch;
227
- const logger = options.logger ?? console;
228
- const appName = options.appName;
229
- const baseUrl = stripTrailingSlash(options.appsCatalogUrl ?? DEFAULT_APPS_CATALOG_URL);
230
- const limit = typeof options.limit === "number" ? options.limit : 3;
231
- const params = new URLSearchParams();
232
- if (appName) params.set("appName", appName);
233
- if (limit > 0) params.set("limit", String(limit));
234
- const url = params.toString() ? `${baseUrl}?${params.toString()}` : baseUrl;
235
- if (!fetchImpl) {
236
- throw new Error("Fetch implementation is required");
237
- }
238
- try {
239
- const response = await fetchImpl(url);
240
- const text = await response.text();
241
- const parsed = safeJsonParse(text);
242
- if (!response.ok || !parsed) {
243
- logger?.error?.("Failed to fetch apps catalog", { status: response.status });
244
- return [];
245
- }
246
- return parsed;
247
- } catch (error) {
248
- logger?.error?.("Failed to fetch apps catalog", {
249
- error: error instanceof Error ? error.message : String(error)
250
- });
251
- return [];
252
- }
253
- }
254
- async function getCrossSellOffersFromApi(options = {}) {
255
- const appsCatalog = options.appsCatalog ?? await fetchAppsCatalog(options);
256
- return getCrossSellOffers({ ...options, appsCatalog });
257
- }
258
209
  // Annotate the CommonJS export names for ESM import in node:
259
210
  0 && (module.exports = {
260
211
  createProgusConnector,
261
- fetchAppsCatalog,
262
- getCrossSellOffers,
263
- getCrossSellOffersFromApi,
264
212
  normalizePartnerId,
265
213
  signPayload
266
214
  });
package/dist/index.d.cts CHANGED
@@ -1,6 +1,49 @@
1
- import { C as ConnectorConfig, T as TrackEventParams, a as TrackResult, S as SubscriptionEventData, A as AssignPartnerIdInput, b as CheckPartnerIdResult } from './types-B6Duba-V.cjs';
2
- export { c as AppsCatalogEntry, d as CrossSellFetchOptions, e as CrossSellOptions, L as Logger, f as TrackEventName } from './types-B6Duba-V.cjs';
3
- export { fetchAppsCatalog, getCrossSellOffers, getCrossSellOffersFromApi, normalizePartnerId } from './browser/index.cjs';
1
+ type Logger = {
2
+ info?: (message: string, meta?: Record<string, unknown>) => void;
3
+ warn?: (message: string, meta?: Record<string, unknown>) => void;
4
+ error?: (message: string, meta?: Record<string, unknown>) => void;
5
+ };
6
+ type FetchLike = typeof fetch;
7
+ type ConnectorConfig = {
8
+ appKey: string;
9
+ apiBaseUrl: string;
10
+ apiKey?: string;
11
+ signingSecret?: string;
12
+ fetch?: FetchLike;
13
+ logger?: Logger;
14
+ enableIdempotency?: boolean;
15
+ };
16
+ type TrackEventName = "installation" | "uninstallation" | "subscription";
17
+ type TrackEventParams<TData = Record<string, unknown>> = {
18
+ eventName: TrackEventName | (string & {});
19
+ shopDomain: string;
20
+ partnerId?: string | null;
21
+ data?: TData;
22
+ externalId?: string;
23
+ };
24
+ type TrackResult<TData = Record<string, unknown>> = {
25
+ success: boolean;
26
+ message?: string;
27
+ status?: number;
28
+ data?: TData;
29
+ };
30
+ type CheckPartnerIdResult = {
31
+ success: boolean;
32
+ partnerId?: string;
33
+ message?: string;
34
+ status?: number;
35
+ };
36
+ type AssignPartnerIdInput = {
37
+ shopDomain: string;
38
+ partnerId: string;
39
+ };
40
+ type SubscriptionEventData = {
41
+ subscriptionStatus?: string;
42
+ subscriptionName?: string;
43
+ subscriptionId?: string;
44
+ subscriptionPrice?: number;
45
+ subscriptionPeriod?: string;
46
+ };
4
47
 
5
48
  type Connector = {
6
49
  track: (eventName: TrackEventParams["eventName"], payload: Omit<TrackEventParams, "eventName">) => Promise<TrackResult>;
@@ -34,4 +77,6 @@ declare function createProgusConnector(config: ConnectorConfig): Connector;
34
77
 
35
78
  declare function signPayload(body: string, secret: string): string;
36
79
 
37
- export { AssignPartnerIdInput, CheckPartnerIdResult, ConnectorConfig, SubscriptionEventData, TrackEventParams, TrackResult, createProgusConnector, signPayload };
80
+ declare function normalizePartnerId(value?: string | null): string | null;
81
+
82
+ export { type AssignPartnerIdInput, type CheckPartnerIdResult, type ConnectorConfig, type Logger, type SubscriptionEventData, type TrackEventName, type TrackEventParams, type TrackResult, createProgusConnector, normalizePartnerId, signPayload };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,49 @@
1
- import { C as ConnectorConfig, T as TrackEventParams, a as TrackResult, S as SubscriptionEventData, A as AssignPartnerIdInput, b as CheckPartnerIdResult } from './types-B6Duba-V.js';
2
- export { c as AppsCatalogEntry, d as CrossSellFetchOptions, e as CrossSellOptions, L as Logger, f as TrackEventName } from './types-B6Duba-V.js';
3
- export { fetchAppsCatalog, getCrossSellOffers, getCrossSellOffersFromApi, normalizePartnerId } from './browser/index.js';
1
+ type Logger = {
2
+ info?: (message: string, meta?: Record<string, unknown>) => void;
3
+ warn?: (message: string, meta?: Record<string, unknown>) => void;
4
+ error?: (message: string, meta?: Record<string, unknown>) => void;
5
+ };
6
+ type FetchLike = typeof fetch;
7
+ type ConnectorConfig = {
8
+ appKey: string;
9
+ apiBaseUrl: string;
10
+ apiKey?: string;
11
+ signingSecret?: string;
12
+ fetch?: FetchLike;
13
+ logger?: Logger;
14
+ enableIdempotency?: boolean;
15
+ };
16
+ type TrackEventName = "installation" | "uninstallation" | "subscription";
17
+ type TrackEventParams<TData = Record<string, unknown>> = {
18
+ eventName: TrackEventName | (string & {});
19
+ shopDomain: string;
20
+ partnerId?: string | null;
21
+ data?: TData;
22
+ externalId?: string;
23
+ };
24
+ type TrackResult<TData = Record<string, unknown>> = {
25
+ success: boolean;
26
+ message?: string;
27
+ status?: number;
28
+ data?: TData;
29
+ };
30
+ type CheckPartnerIdResult = {
31
+ success: boolean;
32
+ partnerId?: string;
33
+ message?: string;
34
+ status?: number;
35
+ };
36
+ type AssignPartnerIdInput = {
37
+ shopDomain: string;
38
+ partnerId: string;
39
+ };
40
+ type SubscriptionEventData = {
41
+ subscriptionStatus?: string;
42
+ subscriptionName?: string;
43
+ subscriptionId?: string;
44
+ subscriptionPrice?: number;
45
+ subscriptionPeriod?: string;
46
+ };
4
47
 
5
48
  type Connector = {
6
49
  track: (eventName: TrackEventParams["eventName"], payload: Omit<TrackEventParams, "eventName">) => Promise<TrackResult>;
@@ -34,4 +77,6 @@ declare function createProgusConnector(config: ConnectorConfig): Connector;
34
77
 
35
78
  declare function signPayload(body: string, secret: string): string;
36
79
 
37
- export { AssignPartnerIdInput, CheckPartnerIdResult, ConnectorConfig, SubscriptionEventData, TrackEventParams, TrackResult, createProgusConnector, signPayload };
80
+ declare function normalizePartnerId(value?: string | null): string | null;
81
+
82
+ export { type AssignPartnerIdInput, type CheckPartnerIdResult, type ConnectorConfig, type Logger, type SubscriptionEventData, type TrackEventName, type TrackEventParams, type TrackResult, createProgusConnector, normalizePartnerId, signPayload };
package/dist/index.js CHANGED
@@ -1,19 +1,30 @@
1
- import {
2
- buildEventId,
3
- fetchAppsCatalog,
4
- getCrossSellOffers,
5
- getCrossSellOffersFromApi,
6
- normalizePartnerId,
7
- safeJsonParse,
8
- stripTrailingSlash
9
- } from "./chunk-ITDLIOZL.js";
10
-
11
1
  // src/signing.ts
12
2
  import { createHmac } from "crypto";
13
3
  function signPayload(body, secret) {
14
4
  return createHmac("sha256", secret).update(body).digest("hex");
15
5
  }
16
6
 
7
+ // src/utils.ts
8
+ function normalizePartnerId(value) {
9
+ if (!value) return null;
10
+ const trimmed = value.trim();
11
+ return trimmed.length > 0 ? trimmed : null;
12
+ }
13
+ function buildEventId(shopDomain, eventName, externalId) {
14
+ if (!externalId) return void 0;
15
+ return `${shopDomain}:${eventName}:${externalId}`;
16
+ }
17
+ function stripTrailingSlash(value) {
18
+ return value.replace(/\/+$/, "");
19
+ }
20
+ function safeJsonParse(text) {
21
+ try {
22
+ return JSON.parse(text);
23
+ } catch {
24
+ return null;
25
+ }
26
+ }
27
+
17
28
  // src/connector.ts
18
29
  function createProgusConnector(config) {
19
30
  const apiBaseUrl = config.apiBaseUrl ? stripTrailingSlash(config.apiBaseUrl) : "";
@@ -123,7 +134,7 @@ function createProgusConnector(config) {
123
134
  if (!apiBaseUrl || !config.signingSecret) {
124
135
  return { success: false, message: "Partners API configuration not set", status: 500 };
125
136
  }
126
- const requestBody = JSON.stringify({ shop: payload.shopDomain });
137
+ const requestBody = JSON.stringify({ shop: payload.shopDomain, appName: config.appKey });
127
138
  const headers = {
128
139
  "Content-Type": "application/json",
129
140
  "x-progus-hmac-sha256": signPayload(requestBody, config.signingSecret)
@@ -169,9 +180,6 @@ function createProgusConnector(config) {
169
180
  }
170
181
  export {
171
182
  createProgusConnector,
172
- fetchAppsCatalog,
173
- getCrossSellOffers,
174
- getCrossSellOffersFromApi,
175
183
  normalizePartnerId,
176
184
  signPayload
177
185
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progus/connector",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Progus partner/affiliate connector helpers",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,16 +12,6 @@
12
12
  "types": "./dist/index.d.ts",
13
13
  "import": "./dist/index.js",
14
14
  "require": "./dist/index.cjs"
15
- },
16
- "./browser": {
17
- "types": "./dist/browser/index.d.ts",
18
- "import": "./dist/browser/index.js",
19
- "require": "./dist/browser/index.cjs"
20
- },
21
- "./ui": {
22
- "types": "./dist/ui/index.d.ts",
23
- "import": "./dist/ui/index.js",
24
- "require": "./dist/ui/index.cjs"
25
15
  }
26
16
  },
27
17
  "files": [
@@ -36,21 +26,12 @@
36
26
  "access": "public"
37
27
  },
38
28
  "scripts": {
39
- "build": "tsup src/index.ts src/ui/index.ts src/browser/index.ts --format esm,cjs --dts --clean --target node18 --external react --external react-dom --external @shopify/polaris --external @shopify/polaris-icons",
40
- "dev": "tsup src/index.ts src/ui/index.ts src/browser/index.ts --format esm,cjs --dts --watch --target node18 --external react --external react-dom --external @shopify/polaris --external @shopify/polaris-icons",
41
- "prepare": "npm run build",
29
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean --target node18",
30
+ "dev": "tsup src/index.ts --format esm,cjs --dts --watch --target node18",
42
31
  "smoke": "tsx scripts/smoke.ts"
43
32
  },
44
- "peerDependencies": {
45
- "@shopify/polaris": ">=13",
46
- "@shopify/polaris-icons": ">=8",
47
- "react": ">=18",
48
- "react-dom": ">=18"
49
- },
50
33
  "devDependencies": {
51
34
  "@types/node": "^20.11.30",
52
- "@types/react": "^18.2.66",
53
- "@types/react-dom": "^18.2.22",
54
35
  "tsup": "^8.0.1",
55
36
  "tsx": "^4.7.1",
56
37
  "typescript": "^5.4.5"
@@ -1,98 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/browser/index.ts
21
- var browser_exports = {};
22
- __export(browser_exports, {
23
- fetchAppsCatalog: () => fetchAppsCatalog,
24
- getCrossSellOffers: () => getCrossSellOffers,
25
- getCrossSellOffersFromApi: () => getCrossSellOffersFromApi,
26
- normalizePartnerId: () => normalizePartnerId
27
- });
28
- module.exports = __toCommonJS(browser_exports);
29
-
30
- // src/utils.ts
31
- function normalizePartnerId(value) {
32
- if (!value) return null;
33
- const trimmed = value.trim();
34
- return trimmed.length > 0 ? trimmed : null;
35
- }
36
- function stripTrailingSlash(value) {
37
- return value.replace(/\/+$/, "");
38
- }
39
- function safeJsonParse(text) {
40
- try {
41
- return JSON.parse(text);
42
- } catch {
43
- return null;
44
- }
45
- }
46
-
47
- // src/crossSell.ts
48
- function getCrossSellOffers(options = {}) {
49
- const appsCatalog = options.appsCatalog ?? [];
50
- const installedKeys = new Set(
51
- [options.appName, ...options.installedAppKeys ?? []].filter(
52
- (key) => Boolean(key)
53
- )
54
- );
55
- const locale = options.locale;
56
- return appsCatalog.filter((app) => app.enabled !== false).filter((app) => locale ? !app.locales || app.locales.includes(locale) : true).filter((app) => !installedKeys.has(app.key)).sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
57
- }
58
- var DEFAULT_APPS_CATALOG_URL = "https://appsdata.progus.workers.dev/recommendations";
59
- async function fetchAppsCatalog(options = {}) {
60
- const fetchImpl = options.fetch ?? globalThis.fetch;
61
- const logger = options.logger ?? console;
62
- const appName = options.appName;
63
- const baseUrl = stripTrailingSlash(options.appsCatalogUrl ?? DEFAULT_APPS_CATALOG_URL);
64
- const limit = typeof options.limit === "number" ? options.limit : 3;
65
- const params = new URLSearchParams();
66
- if (appName) params.set("appName", appName);
67
- if (limit > 0) params.set("limit", String(limit));
68
- const url = params.toString() ? `${baseUrl}?${params.toString()}` : baseUrl;
69
- if (!fetchImpl) {
70
- throw new Error("Fetch implementation is required");
71
- }
72
- try {
73
- const response = await fetchImpl(url);
74
- const text = await response.text();
75
- const parsed = safeJsonParse(text);
76
- if (!response.ok || !parsed) {
77
- logger?.error?.("Failed to fetch apps catalog", { status: response.status });
78
- return [];
79
- }
80
- return parsed;
81
- } catch (error) {
82
- logger?.error?.("Failed to fetch apps catalog", {
83
- error: error instanceof Error ? error.message : String(error)
84
- });
85
- return [];
86
- }
87
- }
88
- async function getCrossSellOffersFromApi(options = {}) {
89
- const appsCatalog = options.appsCatalog ?? await fetchAppsCatalog(options);
90
- return getCrossSellOffers({ ...options, appsCatalog });
91
- }
92
- // Annotate the CommonJS export names for ESM import in node:
93
- 0 && (module.exports = {
94
- fetchAppsCatalog,
95
- getCrossSellOffers,
96
- getCrossSellOffersFromApi,
97
- normalizePartnerId
98
- });
@@ -1,9 +0,0 @@
1
- import { d as CrossSellFetchOptions, c as AppsCatalogEntry, e as CrossSellOptions } from '../types-B6Duba-V.cjs';
2
-
3
- declare function getCrossSellOffers(options?: CrossSellOptions): AppsCatalogEntry[];
4
- declare function fetchAppsCatalog(options?: CrossSellFetchOptions): Promise<AppsCatalogEntry[]>;
5
- declare function getCrossSellOffersFromApi(options?: CrossSellFetchOptions): Promise<AppsCatalogEntry[]>;
6
-
7
- declare function normalizePartnerId(value?: string | null): string | null;
8
-
9
- export { AppsCatalogEntry, CrossSellFetchOptions, CrossSellOptions, fetchAppsCatalog, getCrossSellOffers, getCrossSellOffersFromApi, normalizePartnerId };
@@ -1,9 +0,0 @@
1
- import { d as CrossSellFetchOptions, c as AppsCatalogEntry, e as CrossSellOptions } from '../types-B6Duba-V.js';
2
-
3
- declare function getCrossSellOffers(options?: CrossSellOptions): AppsCatalogEntry[];
4
- declare function fetchAppsCatalog(options?: CrossSellFetchOptions): Promise<AppsCatalogEntry[]>;
5
- declare function getCrossSellOffersFromApi(options?: CrossSellFetchOptions): Promise<AppsCatalogEntry[]>;
6
-
7
- declare function normalizePartnerId(value?: string | null): string | null;
8
-
9
- export { AppsCatalogEntry, CrossSellFetchOptions, CrossSellOptions, fetchAppsCatalog, getCrossSellOffers, getCrossSellOffersFromApi, normalizePartnerId };
@@ -1,12 +0,0 @@
1
- import {
2
- fetchAppsCatalog,
3
- getCrossSellOffers,
4
- getCrossSellOffersFromApi,
5
- normalizePartnerId
6
- } from "../chunk-ITDLIOZL.js";
7
- export {
8
- fetchAppsCatalog,
9
- getCrossSellOffers,
10
- getCrossSellOffersFromApi,
11
- normalizePartnerId
12
- };
@@ -1,76 +0,0 @@
1
- // src/utils.ts
2
- function normalizePartnerId(value) {
3
- if (!value) return null;
4
- const trimmed = value.trim();
5
- return trimmed.length > 0 ? trimmed : null;
6
- }
7
- function buildEventId(shopDomain, eventName, externalId) {
8
- if (!externalId) return void 0;
9
- return `${shopDomain}:${eventName}:${externalId}`;
10
- }
11
- function stripTrailingSlash(value) {
12
- return value.replace(/\/+$/, "");
13
- }
14
- function safeJsonParse(text) {
15
- try {
16
- return JSON.parse(text);
17
- } catch {
18
- return null;
19
- }
20
- }
21
-
22
- // src/crossSell.ts
23
- function getCrossSellOffers(options = {}) {
24
- const appsCatalog = options.appsCatalog ?? [];
25
- const installedKeys = new Set(
26
- [options.appName, ...options.installedAppKeys ?? []].filter(
27
- (key) => Boolean(key)
28
- )
29
- );
30
- const locale = options.locale;
31
- return appsCatalog.filter((app) => app.enabled !== false).filter((app) => locale ? !app.locales || app.locales.includes(locale) : true).filter((app) => !installedKeys.has(app.key)).sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
32
- }
33
- var DEFAULT_APPS_CATALOG_URL = "https://appsdata.progus.workers.dev/recommendations";
34
- async function fetchAppsCatalog(options = {}) {
35
- const fetchImpl = options.fetch ?? globalThis.fetch;
36
- const logger = options.logger ?? console;
37
- const appName = options.appName;
38
- const baseUrl = stripTrailingSlash(options.appsCatalogUrl ?? DEFAULT_APPS_CATALOG_URL);
39
- const limit = typeof options.limit === "number" ? options.limit : 3;
40
- const params = new URLSearchParams();
41
- if (appName) params.set("appName", appName);
42
- if (limit > 0) params.set("limit", String(limit));
43
- const url = params.toString() ? `${baseUrl}?${params.toString()}` : baseUrl;
44
- if (!fetchImpl) {
45
- throw new Error("Fetch implementation is required");
46
- }
47
- try {
48
- const response = await fetchImpl(url);
49
- const text = await response.text();
50
- const parsed = safeJsonParse(text);
51
- if (!response.ok || !parsed) {
52
- logger?.error?.("Failed to fetch apps catalog", { status: response.status });
53
- return [];
54
- }
55
- return parsed;
56
- } catch (error) {
57
- logger?.error?.("Failed to fetch apps catalog", {
58
- error: error instanceof Error ? error.message : String(error)
59
- });
60
- return [];
61
- }
62
- }
63
- async function getCrossSellOffersFromApi(options = {}) {
64
- const appsCatalog = options.appsCatalog ?? await fetchAppsCatalog(options);
65
- return getCrossSellOffers({ ...options, appsCatalog });
66
- }
67
-
68
- export {
69
- normalizePartnerId,
70
- buildEventId,
71
- stripTrailingSlash,
72
- safeJsonParse,
73
- getCrossSellOffers,
74
- fetchAppsCatalog,
75
- getCrossSellOffersFromApi
76
- };
@@ -1,75 +0,0 @@
1
- type FetchLike = typeof fetch;
2
- type Logger = {
3
- info?: (message: string, meta?: Record<string, unknown>) => void;
4
- warn?: (message: string, meta?: Record<string, unknown>) => void;
5
- error?: (message: string, meta?: Record<string, unknown>) => void;
6
- };
7
- type AppsCatalogEntry = {
8
- key: string;
9
- type: string;
10
- title: string;
11
- company?: string;
12
- companyUrl?: string;
13
- desc?: string;
14
- url: string;
15
- icon?: string;
16
- enabled?: boolean;
17
- priority?: number;
18
- locales?: string[];
19
- };
20
- type CrossSellOptions = {
21
- appName?: string;
22
- installedAppKeys?: string[];
23
- locale?: string;
24
- shopPlan?: string;
25
- appsCatalog?: AppsCatalogEntry[];
26
- };
27
- type CrossSellFetchOptions = CrossSellOptions & {
28
- appsCatalogUrl?: string;
29
- limit?: number;
30
- fetch?: FetchLike;
31
- logger?: Logger;
32
- };
33
- type ConnectorConfig = {
34
- appKey: string;
35
- apiBaseUrl: string;
36
- apiKey?: string;
37
- signingSecret?: string;
38
- appsCatalog?: AppsCatalogEntry[];
39
- fetch?: FetchLike;
40
- logger?: Logger;
41
- enableIdempotency?: boolean;
42
- };
43
- type TrackEventName = "installation" | "uninstallation" | "subscription";
44
- type TrackEventParams<TData = Record<string, unknown>> = {
45
- eventName: TrackEventName | (string & {});
46
- shopDomain: string;
47
- partnerId?: string | null;
48
- data?: TData;
49
- externalId?: string;
50
- };
51
- type TrackResult<TData = Record<string, unknown>> = {
52
- success: boolean;
53
- message?: string;
54
- status?: number;
55
- data?: TData;
56
- };
57
- type CheckPartnerIdResult = {
58
- success: boolean;
59
- partnerId?: string;
60
- message?: string;
61
- status?: number;
62
- };
63
- type AssignPartnerIdInput = {
64
- shopDomain: string;
65
- partnerId: string;
66
- };
67
- type SubscriptionEventData = {
68
- subscriptionStatus?: string;
69
- subscriptionName?: string;
70
- subscriptionId?: string;
71
- subscriptionPrice?: number;
72
- subscriptionPeriod?: string;
73
- };
74
-
75
- export type { AssignPartnerIdInput as A, ConnectorConfig as C, Logger as L, SubscriptionEventData as S, TrackEventParams as T, TrackResult as a, CheckPartnerIdResult as b, AppsCatalogEntry as c, CrossSellFetchOptions as d, CrossSellOptions as e, TrackEventName as f };
@@ -1,75 +0,0 @@
1
- type FetchLike = typeof fetch;
2
- type Logger = {
3
- info?: (message: string, meta?: Record<string, unknown>) => void;
4
- warn?: (message: string, meta?: Record<string, unknown>) => void;
5
- error?: (message: string, meta?: Record<string, unknown>) => void;
6
- };
7
- type AppsCatalogEntry = {
8
- key: string;
9
- type: string;
10
- title: string;
11
- company?: string;
12
- companyUrl?: string;
13
- desc?: string;
14
- url: string;
15
- icon?: string;
16
- enabled?: boolean;
17
- priority?: number;
18
- locales?: string[];
19
- };
20
- type CrossSellOptions = {
21
- appName?: string;
22
- installedAppKeys?: string[];
23
- locale?: string;
24
- shopPlan?: string;
25
- appsCatalog?: AppsCatalogEntry[];
26
- };
27
- type CrossSellFetchOptions = CrossSellOptions & {
28
- appsCatalogUrl?: string;
29
- limit?: number;
30
- fetch?: FetchLike;
31
- logger?: Logger;
32
- };
33
- type ConnectorConfig = {
34
- appKey: string;
35
- apiBaseUrl: string;
36
- apiKey?: string;
37
- signingSecret?: string;
38
- appsCatalog?: AppsCatalogEntry[];
39
- fetch?: FetchLike;
40
- logger?: Logger;
41
- enableIdempotency?: boolean;
42
- };
43
- type TrackEventName = "installation" | "uninstallation" | "subscription";
44
- type TrackEventParams<TData = Record<string, unknown>> = {
45
- eventName: TrackEventName | (string & {});
46
- shopDomain: string;
47
- partnerId?: string | null;
48
- data?: TData;
49
- externalId?: string;
50
- };
51
- type TrackResult<TData = Record<string, unknown>> = {
52
- success: boolean;
53
- message?: string;
54
- status?: number;
55
- data?: TData;
56
- };
57
- type CheckPartnerIdResult = {
58
- success: boolean;
59
- partnerId?: string;
60
- message?: string;
61
- status?: number;
62
- };
63
- type AssignPartnerIdInput = {
64
- shopDomain: string;
65
- partnerId: string;
66
- };
67
- type SubscriptionEventData = {
68
- subscriptionStatus?: string;
69
- subscriptionName?: string;
70
- subscriptionId?: string;
71
- subscriptionPrice?: number;
72
- subscriptionPeriod?: string;
73
- };
74
-
75
- export type { AssignPartnerIdInput as A, ConnectorConfig as C, Logger as L, SubscriptionEventData as S, TrackEventParams as T, TrackResult as a, CheckPartnerIdResult as b, AppsCatalogEntry as c, CrossSellFetchOptions as d, CrossSellOptions as e, TrackEventName as f };
package/dist/ui/index.cjs DELETED
@@ -1,200 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/ui/index.ts
21
- var ui_exports = {};
22
- __export(ui_exports, {
23
- PartnerIdCard: () => PartnerIdCard,
24
- Recommendations: () => Recommendations
25
- });
26
- module.exports = __toCommonJS(ui_exports);
27
-
28
- // src/ui/PartnerIdCard.tsx
29
- var import_polaris = require("@shopify/polaris");
30
- var import_jsx_runtime = require("react/jsx-runtime");
31
- function PartnerIdCard({
32
- partnerId,
33
- onPartnerIdChange,
34
- onSave,
35
- saveLabel,
36
- loading,
37
- saving,
38
- locked,
39
- error,
40
- label,
41
- placeholder,
42
- helpText,
43
- saveDisabled
44
- }) {
45
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
46
- import_polaris.LegacyCard,
47
- {
48
- sectioned: true,
49
- primaryFooterAction: {
50
- content: saveLabel,
51
- loading: Boolean(saving),
52
- onAction: onSave,
53
- disabled: Boolean(saveDisabled)
54
- },
55
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_polaris.SkeletonBodyText, { lines: 1 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_polaris.FormLayout, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
- import_polaris.TextField,
57
- {
58
- error,
59
- label,
60
- value: partnerId,
61
- onChange: onPartnerIdChange,
62
- placeholder,
63
- helpText,
64
- autoComplete: "off",
65
- disabled: Boolean(locked || loading)
66
- }
67
- ) })
68
- }
69
- );
70
- }
71
-
72
- // src/ui/Recommendations.tsx
73
- var import_polaris2 = require("@shopify/polaris");
74
- var import_polaris_icons = require("@shopify/polaris-icons");
75
- var import_react = require("react");
76
- var import_jsx_runtime2 = require("react/jsx-runtime");
77
- function Recommendations({
78
- recommendations,
79
- loading,
80
- title,
81
- dismissLabel,
82
- installLabel,
83
- freePlanLabel,
84
- newBadgeLabel,
85
- onDismiss,
86
- openUrl,
87
- getDescription
88
- }) {
89
- const [menuActive, setMenuActive] = (0, import_react.useState)(false);
90
- if (!recommendations || recommendations.length === 0) {
91
- return null;
92
- }
93
- const handleOpenUrl = (url) => {
94
- if (openUrl) return openUrl(url);
95
- if (typeof window !== "undefined") {
96
- window.open(url, "_blank", "noopener,noreferrer");
97
- }
98
- };
99
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
100
- import_polaris2.LegacyCard,
101
- {
102
- sectioned: true,
103
- title: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
104
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_polaris2.Text, { variant: "headingSm", as: "h3", children: title }),
105
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
106
- import_polaris2.Popover,
107
- {
108
- active: menuActive,
109
- activator: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
110
- import_polaris2.Button,
111
- {
112
- onClick: () => setMenuActive(!menuActive),
113
- icon: import_polaris_icons.MenuHorizontalIcon,
114
- variant: "plain",
115
- accessibilityLabel: "Menu"
116
- }
117
- ),
118
- onClose: () => setMenuActive(false),
119
- preferredAlignment: "right",
120
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
121
- import_polaris2.ActionList,
122
- {
123
- actionRole: "menuitem",
124
- items: [
125
- {
126
- content: dismissLabel,
127
- onAction: () => {
128
- setMenuActive(false);
129
- onDismiss();
130
- }
131
- }
132
- ]
133
- }
134
- )
135
- }
136
- ) })
137
- ] }),
138
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_polaris2.Layout, { children: recommendations.map((rec, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_polaris2.Layout.Section, { variant: "oneThird", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_polaris2.LegacyCard, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_polaris2.LegacyCard.Section, { children: [
139
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: "16px", position: "relative" }, children: [
140
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
141
- "div",
142
- {
143
- style: {
144
- flexShrink: 0,
145
- width: "48px",
146
- height: "48px",
147
- borderRadius: "12px",
148
- overflow: "hidden",
149
- backgroundColor: "#f6f6f7",
150
- display: "flex",
151
- alignItems: "center",
152
- justifyContent: "center"
153
- },
154
- children: rec.icon ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
155
- "img",
156
- {
157
- src: rec.icon,
158
- alt: rec.title,
159
- style: { width: "48px", height: "48px", objectFit: "cover" }
160
- }
161
- ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
162
- "div",
163
- {
164
- style: {
165
- width: "48px",
166
- height: "48px",
167
- backgroundColor: "#e1e1e1",
168
- borderRadius: "12px"
169
- }
170
- }
171
- )
172
- }
173
- ),
174
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { position: "relative" }, children: [
175
- rec.newBadge && newBadgeLabel && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", right: "-8px", top: "-8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_polaris2.Badge, { tone: "info", children: newBadgeLabel }) }),
176
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_polaris2.Text, { variant: "headingSm", as: "h3", truncate: true, children: rec.title }),
177
- freePlanLabel && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { marginTop: "6px" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_polaris2.Badge, { tone: "info", children: freePlanLabel }) })
178
- ] }) })
179
- ] }),
180
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { marginTop: "12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_polaris2.Text, { variant: "bodySm", tone: "subdued", as: "p", children: getDescription ? getDescription(rec) : rec.desc }) }),
181
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { marginTop: "12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
182
- import_polaris2.Button,
183
- {
184
- disabled: loading,
185
- size: "micro",
186
- variant: "plain",
187
- onClick: () => handleOpenUrl(rec.url),
188
- icon: import_polaris_icons.ExternalIcon,
189
- children: installLabel
190
- }
191
- ) })
192
- ] }) }) }, `${rec.key}-${index}`)) })
193
- }
194
- );
195
- }
196
- // Annotate the CommonJS export names for ESM import in node:
197
- 0 && (module.exports = {
198
- PartnerIdCard,
199
- Recommendations
200
- });
@@ -1,38 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { TextFieldProps } from '@shopify/polaris';
3
- import { c as AppsCatalogEntry } from '../types-B6Duba-V.cjs';
4
-
5
- type PartnerIdCardProps = {
6
- partnerId: string;
7
- onPartnerIdChange: (value: string) => void;
8
- onSave: () => void;
9
- saveLabel: string;
10
- loading?: boolean;
11
- saving?: boolean;
12
- locked?: boolean;
13
- error?: string | TextFieldProps["error"];
14
- label: string;
15
- placeholder?: string;
16
- helpText?: string;
17
- saveDisabled?: boolean;
18
- };
19
- declare function PartnerIdCard({ partnerId, onPartnerIdChange, onSave, saveLabel, loading, saving, locked, error, label, placeholder, helpText, saveDisabled, }: PartnerIdCardProps): react_jsx_runtime.JSX.Element;
20
-
21
- type RecommendationItem = AppsCatalogEntry & {
22
- newBadge?: boolean;
23
- };
24
- type RecommendationsProps = {
25
- recommendations: RecommendationItem[];
26
- loading?: boolean;
27
- title: string;
28
- dismissLabel: string;
29
- installLabel: string;
30
- freePlanLabel?: string;
31
- newBadgeLabel?: string;
32
- onDismiss: () => void;
33
- openUrl?: (url: string) => void;
34
- getDescription?: (item: RecommendationItem) => string;
35
- };
36
- declare function Recommendations({ recommendations, loading, title, dismissLabel, installLabel, freePlanLabel, newBadgeLabel, onDismiss, openUrl, getDescription, }: RecommendationsProps): react_jsx_runtime.JSX.Element | null;
37
-
38
- export { PartnerIdCard, type PartnerIdCardProps, type RecommendationItem, Recommendations, type RecommendationsProps };
@@ -1,38 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { TextFieldProps } from '@shopify/polaris';
3
- import { c as AppsCatalogEntry } from '../types-B6Duba-V.js';
4
-
5
- type PartnerIdCardProps = {
6
- partnerId: string;
7
- onPartnerIdChange: (value: string) => void;
8
- onSave: () => void;
9
- saveLabel: string;
10
- loading?: boolean;
11
- saving?: boolean;
12
- locked?: boolean;
13
- error?: string | TextFieldProps["error"];
14
- label: string;
15
- placeholder?: string;
16
- helpText?: string;
17
- saveDisabled?: boolean;
18
- };
19
- declare function PartnerIdCard({ partnerId, onPartnerIdChange, onSave, saveLabel, loading, saving, locked, error, label, placeholder, helpText, saveDisabled, }: PartnerIdCardProps): react_jsx_runtime.JSX.Element;
20
-
21
- type RecommendationItem = AppsCatalogEntry & {
22
- newBadge?: boolean;
23
- };
24
- type RecommendationsProps = {
25
- recommendations: RecommendationItem[];
26
- loading?: boolean;
27
- title: string;
28
- dismissLabel: string;
29
- installLabel: string;
30
- freePlanLabel?: string;
31
- newBadgeLabel?: string;
32
- onDismiss: () => void;
33
- openUrl?: (url: string) => void;
34
- getDescription?: (item: RecommendationItem) => string;
35
- };
36
- declare function Recommendations({ recommendations, loading, title, dismissLabel, installLabel, freePlanLabel, newBadgeLabel, onDismiss, openUrl, getDescription, }: RecommendationsProps): react_jsx_runtime.JSX.Element | null;
37
-
38
- export { PartnerIdCard, type PartnerIdCardProps, type RecommendationItem, Recommendations, type RecommendationsProps };
package/dist/ui/index.js DELETED
@@ -1,172 +0,0 @@
1
- // src/ui/PartnerIdCard.tsx
2
- import { FormLayout, LegacyCard, SkeletonBodyText, TextField } from "@shopify/polaris";
3
- import { jsx } from "react/jsx-runtime";
4
- function PartnerIdCard({
5
- partnerId,
6
- onPartnerIdChange,
7
- onSave,
8
- saveLabel,
9
- loading,
10
- saving,
11
- locked,
12
- error,
13
- label,
14
- placeholder,
15
- helpText,
16
- saveDisabled
17
- }) {
18
- return /* @__PURE__ */ jsx(
19
- LegacyCard,
20
- {
21
- sectioned: true,
22
- primaryFooterAction: {
23
- content: saveLabel,
24
- loading: Boolean(saving),
25
- onAction: onSave,
26
- disabled: Boolean(saveDisabled)
27
- },
28
- children: loading ? /* @__PURE__ */ jsx(SkeletonBodyText, { lines: 1 }) : /* @__PURE__ */ jsx(FormLayout, { children: /* @__PURE__ */ jsx(
29
- TextField,
30
- {
31
- error,
32
- label,
33
- value: partnerId,
34
- onChange: onPartnerIdChange,
35
- placeholder,
36
- helpText,
37
- autoComplete: "off",
38
- disabled: Boolean(locked || loading)
39
- }
40
- ) })
41
- }
42
- );
43
- }
44
-
45
- // src/ui/Recommendations.tsx
46
- import { ActionList, Badge, Button, Layout, LegacyCard as LegacyCard2, Popover, Text } from "@shopify/polaris";
47
- import { ExternalIcon, MenuHorizontalIcon } from "@shopify/polaris-icons";
48
- import { useState } from "react";
49
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
50
- function Recommendations({
51
- recommendations,
52
- loading,
53
- title,
54
- dismissLabel,
55
- installLabel,
56
- freePlanLabel,
57
- newBadgeLabel,
58
- onDismiss,
59
- openUrl,
60
- getDescription
61
- }) {
62
- const [menuActive, setMenuActive] = useState(false);
63
- if (!recommendations || recommendations.length === 0) {
64
- return null;
65
- }
66
- const handleOpenUrl = (url) => {
67
- if (openUrl) return openUrl(url);
68
- if (typeof window !== "undefined") {
69
- window.open(url, "_blank", "noopener,noreferrer");
70
- }
71
- };
72
- return /* @__PURE__ */ jsx2(
73
- LegacyCard2,
74
- {
75
- sectioned: true,
76
- title: /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
77
- /* @__PURE__ */ jsx2(Text, { variant: "headingSm", as: "h3", children: title }),
78
- /* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2(
79
- Popover,
80
- {
81
- active: menuActive,
82
- activator: /* @__PURE__ */ jsx2(
83
- Button,
84
- {
85
- onClick: () => setMenuActive(!menuActive),
86
- icon: MenuHorizontalIcon,
87
- variant: "plain",
88
- accessibilityLabel: "Menu"
89
- }
90
- ),
91
- onClose: () => setMenuActive(false),
92
- preferredAlignment: "right",
93
- children: /* @__PURE__ */ jsx2(
94
- ActionList,
95
- {
96
- actionRole: "menuitem",
97
- items: [
98
- {
99
- content: dismissLabel,
100
- onAction: () => {
101
- setMenuActive(false);
102
- onDismiss();
103
- }
104
- }
105
- ]
106
- }
107
- )
108
- }
109
- ) })
110
- ] }),
111
- children: /* @__PURE__ */ jsx2(Layout, { children: recommendations.map((rec, index) => /* @__PURE__ */ jsx2(Layout.Section, { variant: "oneThird", children: /* @__PURE__ */ jsx2(LegacyCard2, { children: /* @__PURE__ */ jsxs(LegacyCard2.Section, { children: [
112
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-start", gap: "16px", position: "relative" }, children: [
113
- /* @__PURE__ */ jsx2(
114
- "div",
115
- {
116
- style: {
117
- flexShrink: 0,
118
- width: "48px",
119
- height: "48px",
120
- borderRadius: "12px",
121
- overflow: "hidden",
122
- backgroundColor: "#f6f6f7",
123
- display: "flex",
124
- alignItems: "center",
125
- justifyContent: "center"
126
- },
127
- children: rec.icon ? /* @__PURE__ */ jsx2(
128
- "img",
129
- {
130
- src: rec.icon,
131
- alt: rec.title,
132
- style: { width: "48px", height: "48px", objectFit: "cover" }
133
- }
134
- ) : /* @__PURE__ */ jsx2(
135
- "div",
136
- {
137
- style: {
138
- width: "48px",
139
- height: "48px",
140
- backgroundColor: "#e1e1e1",
141
- borderRadius: "12px"
142
- }
143
- }
144
- )
145
- }
146
- ),
147
- /* @__PURE__ */ jsx2("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
148
- rec.newBadge && newBadgeLabel && /* @__PURE__ */ jsx2("div", { style: { position: "absolute", right: "-8px", top: "-8px" }, children: /* @__PURE__ */ jsx2(Badge, { tone: "info", children: newBadgeLabel }) }),
149
- /* @__PURE__ */ jsx2(Text, { variant: "headingSm", as: "h3", truncate: true, children: rec.title }),
150
- freePlanLabel && /* @__PURE__ */ jsx2("div", { style: { marginTop: "6px" }, children: /* @__PURE__ */ jsx2(Badge, { tone: "info", children: freePlanLabel }) })
151
- ] }) })
152
- ] }),
153
- /* @__PURE__ */ jsx2("div", { style: { marginTop: "12px" }, children: /* @__PURE__ */ jsx2(Text, { variant: "bodySm", tone: "subdued", as: "p", children: getDescription ? getDescription(rec) : rec.desc }) }),
154
- /* @__PURE__ */ jsx2("div", { style: { marginTop: "12px" }, children: /* @__PURE__ */ jsx2(
155
- Button,
156
- {
157
- disabled: loading,
158
- size: "micro",
159
- variant: "plain",
160
- onClick: () => handleOpenUrl(rec.url),
161
- icon: ExternalIcon,
162
- children: installLabel
163
- }
164
- ) })
165
- ] }) }) }, `${rec.key}-${index}`)) })
166
- }
167
- );
168
- }
169
- export {
170
- PartnerIdCard,
171
- Recommendations
172
- };