@apify/actors-mcp-server 0.9.20-beta.4 → 0.9.20-beta.6

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.
Files changed (54) hide show
  1. package/dist/mcp/server.js +2 -2
  2. package/dist/mcp/server.js.map +1 -1
  3. package/dist/tools/core/call_actor_common.d.ts +45 -0
  4. package/dist/tools/core/call_actor_common.d.ts.map +1 -1
  5. package/dist/tools/core/call_actor_common.js +148 -13
  6. package/dist/tools/core/call_actor_common.js.map +1 -1
  7. package/dist/tools/core/fetch_actor_details_common.d.ts.map +1 -1
  8. package/dist/tools/core/fetch_actor_details_common.js +11 -4
  9. package/dist/tools/core/fetch_actor_details_common.js.map +1 -1
  10. package/dist/tools/core/search_actors_common.d.ts +2 -1
  11. package/dist/tools/core/search_actors_common.d.ts.map +1 -1
  12. package/dist/tools/core/search_actors_common.js +5 -4
  13. package/dist/tools/core/search_actors_common.js.map +1 -1
  14. package/dist/tools/default/call_actor.d.ts.map +1 -1
  15. package/dist/tools/default/call_actor.js +19 -50
  16. package/dist/tools/default/call_actor.js.map +1 -1
  17. package/dist/tools/default/search_actors.d.ts.map +1 -1
  18. package/dist/tools/default/search_actors.js +16 -10
  19. package/dist/tools/default/search_actors.js.map +1 -1
  20. package/dist/tools/openai/call_actor.d.ts.map +1 -1
  21. package/dist/tools/openai/call_actor.js +18 -62
  22. package/dist/tools/openai/call_actor.js.map +1 -1
  23. package/dist/tools/openai/fetch_actor_details.d.ts.map +1 -1
  24. package/dist/tools/openai/fetch_actor_details.js +9 -3
  25. package/dist/tools/openai/fetch_actor_details.js.map +1 -1
  26. package/dist/tools/openai/search_actors.d.ts.map +1 -1
  27. package/dist/tools/openai/search_actors.js +18 -12
  28. package/dist/tools/openai/search_actors.js.map +1 -1
  29. package/dist/tools/structured_output_schemas.d.ts +56 -4
  30. package/dist/tools/structured_output_schemas.d.ts.map +1 -1
  31. package/dist/tools/structured_output_schemas.js +27 -4
  32. package/dist/tools/structured_output_schemas.js.map +1 -1
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/dist/types.d.ts +8 -1
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/utils/actor_card.d.ts +7 -2
  37. package/dist/utils/actor_card.d.ts.map +1 -1
  38. package/dist/utils/actor_card.js +19 -8
  39. package/dist/utils/actor_card.js.map +1 -1
  40. package/dist/utils/actor_details.d.ts +3 -1
  41. package/dist/utils/actor_details.d.ts.map +1 -1
  42. package/dist/utils/actor_details.js +3 -2
  43. package/dist/utils/actor_details.js.map +1 -1
  44. package/dist/utils/pricing_info.d.ts +71 -20
  45. package/dist/utils/pricing_info.d.ts.map +1 -1
  46. package/dist/utils/pricing_info.js +362 -129
  47. package/dist/utils/pricing_info.js.map +1 -1
  48. package/dist/utils/userid_cache.d.ts +12 -4
  49. package/dist/utils/userid_cache.d.ts.map +1 -1
  50. package/dist/utils/userid_cache.js +41 -14
  51. package/dist/utils/userid_cache.js.map +1 -1
  52. package/dist/web/dist/actor-detail-widget.js +2 -2
  53. package/dist/web/dist/search-actors-widget.js +2 -2
  54. package/package.json +1 -1
@@ -1,160 +1,393 @@
1
- import { ACTOR_PRICING_MODEL } from '../const.js';
2
1
  /**
3
- * Returns the most recent valid pricing information from a list of pricing infos,
4
- * based on the provided current date.
2
+ * Pricing output contract for Actor cards.
3
+ *
4
+ * Text callers:
5
+ * - `pricingInfoToString`: complete mode for `fetch-actor-details`
6
+ * - `pricingInfoToSimplifiedString`: simplified mode for `search-actors`
7
+ *
8
+ * Structured callers:
9
+ * - `pricingInfoToStructured`: complete mode
10
+ * - `pricingInfoToSimplifiedStructured`: simplified mode
11
+ *
12
+ * Structured output shape is mostly the same in both modes:
13
+ * {
14
+ * model: string,
15
+ * userTier?: PricingTier,
16
+ * pricePerUnit?: number,
17
+ * unitName?: string,
18
+ * trialMinutes?: number,
19
+ * tieredPricing?: [{ tier: string, pricePerUnit: number }],
20
+ * events?: [{
21
+ * title: string,
22
+ * description?: string,
23
+ * priceUsd?: number,
24
+ * tieredPricing?: [{ tier: string, priceUsd: number }],
25
+ * }],
26
+ * pricingNote?: string,
27
+ * eventDescriptionsOmitted?: boolean,
28
+ * eventDescriptionsNote?: string,
29
+ * }
30
+ *
31
+ * Complete mode keeps full tier matrices and never sets `pricingNote`.
32
+ *
33
+ * Simplified mode picks a single tier from each tiered map
34
+ * (requested tier -> FREE -> first entry) and emits `pricingNote` only when
35
+ * the Actor actually has multiple tiers *and* they resolve consistently. The
36
+ * note is omitted for single-tier Actors (the note's "higher tiers may offer
37
+ * lower prices" promise is vacuous) and when PAY_PER_EVENT events resolve
38
+ * to different tiers (no truthful single label).
5
39
  *
6
- * Filters out pricing infos that have a `startedAt` date in the future or missing,
7
- * then sorts the remaining infos by `startedAt` in descending order (most recent first).
8
- * Returns the most recent valid pricing info, or `null` if none are valid.
40
+ * Simplified `PAY_PER_EVENT` also trims long event lists:
41
+ * - `events.length <= 5`: keep event descriptions
42
+ * - `events.length > 5`: omit event descriptions and set
43
+ * `eventDescriptionsOmitted` / `eventDescriptionsNote`
44
+ *
45
+ * Single-tier buckets stay as 1-element `tieredPricing` arrays in both modes.
46
+ * `FREE` or `null` input returns the free text / structured shape.
47
+ *
48
+ * Full examples and contract details are documented inline in this module.
9
49
  */
50
+ import { ACTOR_PRICING_MODEL } from '../const.js';
51
+ export const PRICING_TIERS = ['FREE', 'BRONZE', 'SILVER', 'GOLD', 'PLATINUM', 'DIAMOND'];
52
+ const FREE_ACTOR_TEXT = 'This Actor is free to use. You are only charged for Apify platform usage.';
53
+ const UNKNOWN_PRICING_TEXT = 'Pricing information is not available.';
54
+ const EVENTS_UNAVAILABLE_TEXT = 'Pricing information for events is not available.';
55
+ const EVENT_DESCRIPTION_LIMIT = 5;
56
+ const EVENT_DESCRIPTIONS_OMITTED_NOTE = 'Event descriptions were omitted because this actor has many pricing events. '
57
+ + 'Use fetch-actor-details for full pricing details.';
58
+ function resolveTier(map, userTier) {
59
+ if (map[userTier])
60
+ return { tier: userTier, value: map[userTier] };
61
+ if (map.FREE)
62
+ return { tier: 'FREE', value: map.FREE };
63
+ // Pathological fallback: actor provides neither the user's tier nor FREE.
64
+ // `Object.entries` order is spec-guaranteed to be insertion order for string keys,
65
+ // so we pick whichever tier the API serialised first. Rarely fires — virtually every
66
+ // actor defines FREE.
67
+ const [firstTier, firstValue] = Object.entries(map)[0];
68
+ return { tier: firstTier, value: firstValue };
69
+ }
70
+ /**
71
+ * Builds the simplified-mode pricing note, or returns null when no note should be shown.
72
+ * DIAMOND is the top tier — "higher tiers may offer lower prices" is vacuous, so we skip
73
+ * the note for DIAMOND users.
74
+ */
75
+ function buildPricingNote(resolvedTier) {
76
+ if (resolvedTier === 'DIAMOND')
77
+ return null;
78
+ return `Prices shown are for ${resolvedTier} tier. `
79
+ + `Higher tiers may offer lower prices — use fetch-actor-details to see the full pricing table.`;
80
+ }
81
+ function getSingleResolvedTier(resolvedTiers) {
82
+ var _a;
83
+ if (resolvedTiers.size !== 1)
84
+ return null;
85
+ return (_a = resolvedTiers.values().next().value) !== null && _a !== void 0 ? _a : null;
86
+ }
87
+ function isFreeActor(info) {
88
+ return !info || info.pricingModel === ACTOR_PRICING_MODEL.FREE;
89
+ }
90
+ function hasTiers(map) {
91
+ return !!map && Object.keys(map).length > 0;
92
+ }
93
+ function hasMultipleTiers(map) {
94
+ return !!map && Object.keys(map).length > 1;
95
+ }
96
+ function shouldOmitEventDescriptions(eventCount) {
97
+ return eventCount > EVENT_DESCRIPTION_LIMIT;
98
+ }
99
+ function convertMinutesToGreatestUnit(minutes) {
100
+ if (minutes < 60)
101
+ return { value: minutes, unit: 'minutes' };
102
+ if (minutes < 60 * 24)
103
+ return { value: Math.floor(minutes / 60), unit: 'hours' };
104
+ return { value: Math.floor(minutes / (60 * 24)), unit: 'days' };
105
+ }
10
106
  export function getCurrentPricingInfo(pricingInfos, now) {
11
- // Filter out all future dates and those without a startedAt date
107
+ var _a;
12
108
  const validPricingInfos = pricingInfos.filter((info) => {
13
109
  if (!info.startedAt)
14
110
  return false;
15
- const startedAt = new Date(info.startedAt);
16
- return startedAt <= now;
111
+ return new Date(info.startedAt) <= now;
17
112
  });
18
- // Sort and return the most recent pricing info
19
113
  validPricingInfos.sort((a, b) => {
20
114
  const aDate = new Date(a.startedAt || 0);
21
115
  const bDate = new Date(b.startedAt || 0);
22
- return bDate.getTime() - aDate.getTime(); // Sort descending
116
+ return bDate.getTime() - aDate.getTime();
23
117
  });
24
- if (validPricingInfos.length > 0) {
25
- return validPricingInfos[0]; // Return the most recent pricing info
118
+ return (_a = validPricingInfos[0]) !== null && _a !== void 0 ? _a : null;
119
+ }
120
+ /** Complete text contract used by `fetch-actor-details`. */
121
+ export function pricingInfoToString(pricingInfo) {
122
+ if (isFreeActor(pricingInfo))
123
+ return FREE_ACTOR_TEXT;
124
+ switch (pricingInfo.pricingModel) {
125
+ case ACTOR_PRICING_MODEL.PRICE_PER_DATASET_ITEM:
126
+ return formatDatasetItemComplete(pricingInfo);
127
+ case ACTOR_PRICING_MODEL.FLAT_PRICE_PER_MONTH:
128
+ return formatRentalComplete(pricingInfo);
129
+ case ACTOR_PRICING_MODEL.PAY_PER_EVENT:
130
+ return formatPayPerEventComplete(pricingInfo.pricingPerEvent);
131
+ default:
132
+ return UNKNOWN_PRICING_TEXT;
26
133
  }
27
- return null;
28
134
  }
29
- function convertMinutesToGreatestUnit(minutes) {
30
- if (minutes < 60) {
31
- return { value: minutes, unit: 'minutes' };
135
+ function formatDatasetItemComplete(info) {
136
+ var _a;
137
+ const unitLabel = info.unitName ? `${info.unitName}s` : 'results';
138
+ const tierEntries = info.tieredPricing ? Object.entries(info.tieredPricing) : [];
139
+ if (tierEntries.length > 1) {
140
+ const tierList = tierEntries
141
+ .map(([tier, obj]) => `${tier}: $${obj.tieredPricePerUnitUsd * 1000}`)
142
+ .join(', ');
143
+ return `This Actor has tiered pricing per 1000 ${unitLabel}: ${tierList}.`;
32
144
  }
33
- if (minutes < 60 * 24) { // Less than 24 hours
34
- return { value: Math.floor(minutes / 60), unit: 'hours' };
35
- } // 24 hours or more
36
- return { value: Math.floor(minutes / (60 * 24)), unit: 'days' };
145
+ const price = tierEntries.length === 1
146
+ ? tierEntries[0][1].tieredPricePerUnitUsd
147
+ : ((_a = info.pricePerUnitUsd) !== null && _a !== void 0 ? _a : 0);
148
+ return `This Actor costs $${price * 1000} per 1000 ${unitLabel}.`;
37
149
  }
38
- /**
39
- * Formats the pay-per-event pricing information into a human-readable string.
40
- *
41
- * Example:
42
- * This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for the following events:
43
- * - Event title: Event description (Flat price: $X per event)
44
- * - MCP server startup: Initial fee for starting the Kiwi MCP Server Actor (Flat price: $0.1 per event)
45
- * - Flight search: Fee for searching flights using the Kiwi.com flight search engine (Flat price: $0.001 per event)
46
- *
47
- * For tiered pricing, the output is more complicated and the question is whether we want to simplify it in the future.
48
- * @param pricingPerEvent
49
- */
50
- function payPerEventPricingToString(pricingPerEvent) {
51
- if (!pricingPerEvent || !pricingPerEvent.actorChargeEvents)
52
- return 'Pricing information for events is not available.';
53
- const eventStrings = [];
54
- for (const event of Object.values(pricingPerEvent.actorChargeEvents)) {
55
- let eventStr = `\t- **${event.eventTitle}**: ${event.eventDescription} `;
56
- if (typeof event.eventPriceUsd === 'number') {
57
- eventStr += `(Flat price: $${event.eventPriceUsd} per event)`;
58
- }
59
- else if (event.eventTieredPricingUsd) {
60
- const tiers = Object.entries(event.eventTieredPricingUsd)
61
- .map(([tier, price]) => `${tier}: $${price.tieredEventPriceUsd}`)
62
- .join(', ');
63
- eventStr += `(Tiered pricing: ${tiers} per event)`;
64
- }
65
- else {
66
- eventStr += '(No price info)';
67
- }
68
- eventStrings.push(eventStr);
150
+ function formatRentalComplete(info) {
151
+ var _a;
152
+ const { value, unit } = convertMinutesToGreatestUnit(info.trialMinutes || 0);
153
+ const tierEntries = info.tieredPricing ? Object.entries(info.tieredPricing) : [];
154
+ if (tierEntries.length > 1) {
155
+ const tierList = tierEntries
156
+ .map(([tier, obj]) => `${tier}: $${obj.tieredPricePerUnitUsd}`)
157
+ .join(', ');
158
+ return `This Actor is rental and has tiered pricing per month: ${tierList}, `
159
+ + `with a trial period of ${value} ${unit}.`;
69
160
  }
70
- return `This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for the following events:\n${eventStrings.join('\n')}`;
161
+ const price = tierEntries.length === 1
162
+ ? tierEntries[0][1].tieredPricePerUnitUsd
163
+ : ((_a = info.pricePerUnitUsd) !== null && _a !== void 0 ? _a : 0);
164
+ return `This Actor is rental and costs $${price} per month, with a trial period of ${value} ${unit}.`;
71
165
  }
72
- export function pricingInfoToString(pricingInfo) {
73
- // If there is no pricing infos entries the Actor is free to use
74
- // based on https://github.com/apify/apify-core/blob/058044945f242387dde2422b8f1bef395110a1bf/src/packages/actor/src/paid_actors/paid_actors_common.ts#L691
75
- if (pricingInfo === null || pricingInfo.pricingModel === ACTOR_PRICING_MODEL.FREE) {
76
- return 'This Actor is free to use. You are only charged for Apify platform usage.';
166
+ function formatPayPerEventComplete(pricingPerEvent) {
167
+ if (!(pricingPerEvent === null || pricingPerEvent === void 0 ? void 0 : pricingPerEvent.actorChargeEvents))
168
+ return EVENTS_UNAVAILABLE_TEXT;
169
+ const eventLines = Object.values(pricingPerEvent.actorChargeEvents).map((event) => {
170
+ var _a;
171
+ const detail = formatCompleteEventDetail(event);
172
+ return `\t- **${event.eventTitle}**: ${(_a = event.eventDescription) !== null && _a !== void 0 ? _a : ''} (${detail})`;
173
+ });
174
+ return `This Actor is paid per event:\n${eventLines.join('\n')}`;
175
+ }
176
+ function formatCompleteEventDetail(event) {
177
+ if (typeof event.eventPriceUsd === 'number')
178
+ return `$${event.eventPriceUsd} per event`;
179
+ const tiered = event.eventTieredPricingUsd;
180
+ if (!hasTiers(tiered))
181
+ return 'No price info';
182
+ if (hasMultipleTiers(tiered)) {
183
+ return `${Object.entries(tiered)
184
+ .map(([tier, price]) => `${tier}: $${price.tieredEventPriceUsd}`)
185
+ .join(', ')} per event`;
77
186
  }
78
- if (pricingInfo.pricingModel === ACTOR_PRICING_MODEL.PRICE_PER_DATASET_ITEM) {
79
- const customUnitName = pricingInfo.unitName !== 'result' ? pricingInfo.unitName : '';
80
- // Handle tiered pricing if present
81
- if (pricingInfo.tieredPricing && Object.keys(pricingInfo.tieredPricing).length > 0) {
82
- const tiers = Object.entries(pricingInfo.tieredPricing)
83
- .map(([tier, obj]) => `${tier}: $${obj.tieredPricePerUnitUsd * 1000} per 1000 ${customUnitName || 'results'}`)
84
- .join(', ');
85
- return `This Actor charges per results${customUnitName ? ` (in this case named ${customUnitName})` : ''}; tiered pricing per 1000 ${customUnitName || 'results'}: ${tiers}.`;
86
- }
87
- return `This Actor charges per results${customUnitName ? ` (in this case named ${customUnitName})` : ''}; the price per 1000 ${customUnitName || 'results'} is ${pricingInfo.pricePerUnitUsd * 1000} USD.`;
187
+ const [price] = Object.values(tiered);
188
+ return `$${price.tieredEventPriceUsd} per event`;
189
+ }
190
+ /** Complete structured contract used by `fetch-actor-details`. */
191
+ export function pricingInfoToStructured(pricingInfo, userTier) {
192
+ const base = createStructuredBase(pricingInfo, userTier);
193
+ if (isFreeActor(pricingInfo))
194
+ return base;
195
+ switch (pricingInfo.pricingModel) {
196
+ case ACTOR_PRICING_MODEL.PRICE_PER_DATASET_ITEM:
197
+ return { ...base, unitName: pricingInfo.unitName || 'result', ...structureTieredUnitComplete(pricingInfo) };
198
+ case ACTOR_PRICING_MODEL.FLAT_PRICE_PER_MONTH:
199
+ return { ...base, trialMinutes: pricingInfo.trialMinutes, ...structureTieredUnitComplete(pricingInfo) };
200
+ case ACTOR_PRICING_MODEL.PAY_PER_EVENT:
201
+ return { ...base, ...structurePayPerEventComplete(pricingInfo.pricingPerEvent) };
202
+ default:
203
+ return base;
88
204
  }
89
- if (pricingInfo.pricingModel === ACTOR_PRICING_MODEL.FLAT_PRICE_PER_MONTH) {
90
- const { value, unit } = convertMinutesToGreatestUnit(pricingInfo.trialMinutes || 0);
91
- // Handle tiered pricing if present
92
- if (pricingInfo.tieredPricing && Object.keys(pricingInfo.tieredPricing).length > 0) {
93
- const tiers = Object.entries(pricingInfo.tieredPricing)
94
- .map(([tier, obj]) => `${tier}: $${obj.tieredPricePerUnitUsd} per month`)
95
- .join(', ');
96
- return `This Actor is rental and has tiered pricing per month: ${tiers}, with a trial period of ${value} ${unit}.`;
97
- }
98
- return `This Actor is rental and has a flat price of ${pricingInfo.pricePerUnitUsd} USD per month, with a trial period of ${value} ${unit}.`;
205
+ }
206
+ function createStructuredBase(pricingInfo, userTier) {
207
+ return {
208
+ model: (pricingInfo === null || pricingInfo === void 0 ? void 0 : pricingInfo.pricingModel) || ACTOR_PRICING_MODEL.FREE,
209
+ userTier,
210
+ };
211
+ }
212
+ function structureTieredUnitComplete(info) {
213
+ var _a;
214
+ const patch = { pricePerUnit: (_a = info.pricePerUnitUsd) !== null && _a !== void 0 ? _a : 0 };
215
+ if (hasTiers(info.tieredPricing)) {
216
+ patch.tieredPricing = Object.entries(info.tieredPricing).map(([tier, obj]) => ({
217
+ tier,
218
+ pricePerUnit: obj.tieredPricePerUnitUsd,
219
+ }));
99
220
  }
100
- if (pricingInfo.pricingModel === ACTOR_PRICING_MODEL.PAY_PER_EVENT) {
101
- return payPerEventPricingToString(pricingInfo.pricingPerEvent);
221
+ return patch;
222
+ }
223
+ function structurePayPerEventComplete(pricingPerEvent) {
224
+ if (!(pricingPerEvent === null || pricingPerEvent === void 0 ? void 0 : pricingPerEvent.actorChargeEvents))
225
+ return {};
226
+ return {
227
+ events: Object.values(pricingPerEvent.actorChargeEvents).map((event) => ({
228
+ title: event.eventTitle,
229
+ description: event.eventDescription || '',
230
+ priceUsd: typeof event.eventPriceUsd === 'number' ? event.eventPriceUsd : undefined,
231
+ tieredPricing: event.eventTieredPricingUsd
232
+ ? Object.entries(event.eventTieredPricingUsd)
233
+ .map(([tier, price]) => ({ tier, priceUsd: price.tieredEventPriceUsd }))
234
+ : undefined,
235
+ })),
236
+ };
237
+ }
238
+ /** Simplified text contract used by `search-actors`. */
239
+ export function pricingInfoToSimplifiedString(pricingInfo, userTier) {
240
+ if (isFreeActor(pricingInfo))
241
+ return FREE_ACTOR_TEXT;
242
+ switch (pricingInfo.pricingModel) {
243
+ case ACTOR_PRICING_MODEL.PRICE_PER_DATASET_ITEM:
244
+ return formatDatasetItemSimplified(pricingInfo, userTier);
245
+ case ACTOR_PRICING_MODEL.FLAT_PRICE_PER_MONTH:
246
+ return formatRentalSimplified(pricingInfo, userTier);
247
+ case ACTOR_PRICING_MODEL.PAY_PER_EVENT:
248
+ return formatPayPerEventSimplified(pricingInfo.pricingPerEvent, userTier);
249
+ default:
250
+ return UNKNOWN_PRICING_TEXT;
102
251
  }
103
- return 'Pricing information is not available.';
104
252
  }
105
- /**
106
- * Transform and normalize API response to match unstructured text output format
107
- * instead of just dumping raw API data - ensures consistency across structured & unstructured modes.
108
- */
109
- export function pricingInfoToStructured(pricingInfo) {
253
+ function formatDatasetItemSimplified(info, userTier) {
110
254
  var _a;
111
- const structuredPricing = {
112
- model: (pricingInfo === null || pricingInfo === void 0 ? void 0 : pricingInfo.pricingModel) || ACTOR_PRICING_MODEL.FREE,
113
- isFree: !pricingInfo || pricingInfo.pricingModel === ACTOR_PRICING_MODEL.FREE,
114
- };
115
- if (!pricingInfo || pricingInfo.pricingModel === ACTOR_PRICING_MODEL.FREE) {
116
- return structuredPricing;
255
+ const unitLabel = info.unitName ? `${info.unitName}s` : 'results';
256
+ if (hasTiers(info.tieredPricing)) {
257
+ const { tier, value } = resolveTier(info.tieredPricing, userTier);
258
+ const base = `This Actor costs $${value.tieredPricePerUnitUsd * 1000} per 1000 ${unitLabel}.`;
259
+ const note = hasMultipleTiers(info.tieredPricing) ? buildPricingNote(tier) : null;
260
+ return note ? `${base} ${note}` : base;
117
261
  }
118
- if (pricingInfo.pricingModel === ACTOR_PRICING_MODEL.PRICE_PER_DATASET_ITEM) {
119
- structuredPricing.pricePerUnit = pricingInfo.pricePerUnitUsd || 0;
120
- structuredPricing.unitName = pricingInfo.unitName || 'result';
121
- if (pricingInfo.tieredPricing && Object.keys(pricingInfo.tieredPricing).length > 0) {
122
- structuredPricing.tieredPricing = Object.entries(pricingInfo.tieredPricing).map(([tier, obj]) => ({
123
- tier,
124
- pricePerUnit: obj.tieredPricePerUnitUsd,
125
- }));
126
- }
262
+ return `This Actor costs $${((_a = info.pricePerUnitUsd) !== null && _a !== void 0 ? _a : 0) * 1000} per 1000 ${unitLabel}.`;
263
+ }
264
+ function formatRentalSimplified(info, userTier) {
265
+ var _a;
266
+ const { value, unit } = convertMinutesToGreatestUnit(info.trialMinutes || 0);
267
+ if (hasTiers(info.tieredPricing)) {
268
+ const { tier, value: entry } = resolveTier(info.tieredPricing, userTier);
269
+ const base = `This Actor is rental and costs $${entry.tieredPricePerUnitUsd} per month, `
270
+ + `with a trial period of ${value} ${unit}.`;
271
+ const note = hasMultipleTiers(info.tieredPricing) ? buildPricingNote(tier) : null;
272
+ return note ? `${base} ${note}` : base;
127
273
  }
128
- else if (pricingInfo.pricingModel === ACTOR_PRICING_MODEL.FLAT_PRICE_PER_MONTH) {
129
- structuredPricing.pricePerUnit = pricingInfo.pricePerUnitUsd;
130
- structuredPricing.trialMinutes = pricingInfo.trialMinutes;
131
- if (pricingInfo.tieredPricing && Object.keys(pricingInfo.tieredPricing).length > 0) {
132
- structuredPricing.tieredPricing = Object.entries(pricingInfo.tieredPricing).map(([tier, obj]) => ({
133
- tier,
134
- pricePerUnit: obj.tieredPricePerUnitUsd,
135
- }));
274
+ return `This Actor is rental and costs $${(_a = info.pricePerUnitUsd) !== null && _a !== void 0 ? _a : 0} per month, with a trial period of ${value} ${unit}.`;
275
+ }
276
+ function formatPayPerEventSimplified(pricingPerEvent, userTier) {
277
+ if (!(pricingPerEvent === null || pricingPerEvent === void 0 ? void 0 : pricingPerEvent.actorChargeEvents))
278
+ return EVENTS_UNAVAILABLE_TEXT;
279
+ const events = Object.values(pricingPerEvent.actorChargeEvents);
280
+ const omitDescriptions = shouldOmitEventDescriptions(events.length);
281
+ const resolvedTiers = new Set();
282
+ const eventLines = events.map((event) => {
283
+ var _a;
284
+ let price;
285
+ if (typeof event.eventPriceUsd === 'number') {
286
+ price = event.eventPriceUsd;
136
287
  }
137
- }
138
- else if (pricingInfo.pricingModel === ACTOR_PRICING_MODEL.PAY_PER_EVENT) {
139
- if ((_a = pricingInfo.pricingPerEvent) === null || _a === void 0 ? void 0 : _a.actorChargeEvents) {
140
- const { actorChargeEvents } = pricingInfo.pricingPerEvent;
141
- structuredPricing.events = Object.entries(actorChargeEvents).map(([, event]) => {
142
- const actorEvent = event;
143
- return {
144
- title: actorEvent.eventTitle,
145
- description: actorEvent.eventDescription || '',
146
- priceUsd: typeof actorEvent.eventPriceUsd === 'number' ? actorEvent.eventPriceUsd : undefined,
147
- tieredPricing: actorEvent.eventTieredPricingUsd
148
- ? Object.entries(actorEvent.eventTieredPricingUsd)
149
- .map(([tier, price]) => ({
150
- tier,
151
- priceUsd: price.tieredEventPriceUsd,
152
- }))
153
- : undefined,
154
- };
155
- });
288
+ else if (event.eventTieredPricingUsd) {
289
+ const tieredMap = event.eventTieredPricingUsd;
290
+ if (hasTiers(tieredMap)) {
291
+ const { tier, value } = resolveTier(tieredMap, userTier);
292
+ resolvedTiers.add(tier);
293
+ price = value.tieredEventPriceUsd;
294
+ }
295
+ }
296
+ const detail = typeof price === 'number' ? `$${price} per event` : 'No price info';
297
+ if (omitDescriptions)
298
+ return `\t- **${event.eventTitle}**: ${detail}`;
299
+ return `\t- **${event.eventTitle}**: ${(_a = event.eventDescription) !== null && _a !== void 0 ? _a : ''} (${detail})`;
300
+ });
301
+ const body = `This Actor is paid per event:\n${eventLines.join('\n')}`;
302
+ const anyMultiTier = events.some((event) => hasMultipleTiers(event.eventTieredPricingUsd));
303
+ const noteTier = anyMultiTier ? getSingleResolvedTier(resolvedTiers) : null;
304
+ const pricingNote = noteTier ? buildPricingNote(noteTier) : null;
305
+ const tail = [pricingNote, omitDescriptions ? EVENT_DESCRIPTIONS_OMITTED_NOTE : null]
306
+ .filter((n) => !!n)
307
+ .join('\n');
308
+ return tail ? `${body}\n${tail}` : body;
309
+ }
310
+ /** Simplified structured contract used by `search-actors`. */
311
+ export function pricingInfoToSimplifiedStructured(pricingInfo, userTier) {
312
+ const base = createStructuredBase(pricingInfo, userTier);
313
+ if (isFreeActor(pricingInfo))
314
+ return base;
315
+ const { patch, noteTier } = resolveSimplifiedPatch(pricingInfo, userTier);
316
+ const pricingNote = noteTier ? buildPricingNote(noteTier) : null;
317
+ return {
318
+ ...base,
319
+ ...patch,
320
+ ...(pricingNote ? { pricingNote } : {}),
321
+ };
322
+ }
323
+ function resolveSimplifiedPatch(pricingInfo, userTier) {
324
+ switch (pricingInfo.pricingModel) {
325
+ case ACTOR_PRICING_MODEL.PRICE_PER_DATASET_ITEM: {
326
+ const r = structureTieredUnitSimplified(pricingInfo, userTier);
327
+ return { patch: { unitName: pricingInfo.unitName || 'result', ...r.patch }, noteTier: r.noteTier };
328
+ }
329
+ case ACTOR_PRICING_MODEL.FLAT_PRICE_PER_MONTH: {
330
+ const r = structureTieredUnitSimplified(pricingInfo, userTier);
331
+ return { patch: { trialMinutes: pricingInfo.trialMinutes, ...r.patch }, noteTier: r.noteTier };
156
332
  }
333
+ case ACTOR_PRICING_MODEL.PAY_PER_EVENT:
334
+ return structurePayPerEventSimplified(pricingInfo.pricingPerEvent, userTier);
335
+ default:
336
+ return { patch: {}, noteTier: null };
337
+ }
338
+ }
339
+ function structureTieredUnitSimplified(info, userTier) {
340
+ var _a;
341
+ const patch = { pricePerUnit: (_a = info.pricePerUnitUsd) !== null && _a !== void 0 ? _a : 0 };
342
+ if (hasTiers(info.tieredPricing)) {
343
+ const { tier, value } = resolveTier(info.tieredPricing, userTier);
344
+ patch.tieredPricing = [{ tier, pricePerUnit: value.tieredPricePerUnitUsd }];
345
+ patch.pricePerUnit = value.tieredPricePerUnitUsd;
346
+ return { patch, noteTier: hasMultipleTiers(info.tieredPricing) ? tier : null };
157
347
  }
158
- return structuredPricing;
348
+ return { patch, noteTier: null };
349
+ }
350
+ function structurePayPerEventSimplified(pricingPerEvent, userTier) {
351
+ if (!(pricingPerEvent === null || pricingPerEvent === void 0 ? void 0 : pricingPerEvent.actorChargeEvents))
352
+ return { patch: {}, noteTier: null };
353
+ const rawEvents = Object.values(pricingPerEvent.actorChargeEvents);
354
+ const omitDescriptions = shouldOmitEventDescriptions(rawEvents.length);
355
+ const resolvedTiers = new Set();
356
+ const events = rawEvents.map((event) => {
357
+ const baseEvent = {
358
+ title: event.eventTitle,
359
+ ...(omitDescriptions ? {} : { description: event.eventDescription || '' }),
360
+ };
361
+ if (typeof event.eventPriceUsd === 'number') {
362
+ return { ...baseEvent, priceUsd: event.eventPriceUsd };
363
+ }
364
+ const tieredMap = event.eventTieredPricingUsd;
365
+ if (!hasTiers(tieredMap))
366
+ return baseEvent;
367
+ const { tier, value } = resolveTier(tieredMap, userTier);
368
+ resolvedTiers.add(tier);
369
+ // `priceUsd` is set in addition to `tieredPricing` so the widget's FREE-tier
370
+ // fallback (src/web/src/utils/formatting.ts) can render a concrete price for
371
+ // FREE-tier users instead of the generic "Pay per event" fallback.
372
+ return {
373
+ ...baseEvent,
374
+ priceUsd: value.tieredEventPriceUsd,
375
+ tieredPricing: [{ tier, priceUsd: value.tieredEventPriceUsd }],
376
+ };
377
+ });
378
+ const anyMultiTier = rawEvents.some((event) => hasMultipleTiers(event.eventTieredPricingUsd));
379
+ const noteTier = anyMultiTier ? getSingleResolvedTier(resolvedTiers) : null;
380
+ return {
381
+ patch: {
382
+ events,
383
+ ...(omitDescriptions
384
+ ? {
385
+ eventDescriptionsOmitted: true,
386
+ eventDescriptionsNote: EVENT_DESCRIPTIONS_OMITTED_NOTE,
387
+ }
388
+ : {}),
389
+ },
390
+ noteTier,
391
+ };
159
392
  }
160
393
  //# sourceMappingURL=pricing_info.js.map
@@ -1 +1 @@
1
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Y,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC9F,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5E,OAAO;QACH,KAAK,EAAE;YACH,MAAM;YACN,GAAG,CAAC,gBAAgB;gBAChB,CAAC,CAAC;oBACE,wBAAwB,EAAE,IAAI;oBAC9B,qBAAqB,EAAE,+BAA+B;iBACzD;gBACD,CAAC,CAAC,EAAE,CAAC;SACZ;QACD,QAAQ;KACX,CAAC;AACN,CAAC"}
@@ -1,8 +1,16 @@
1
1
  import type { ApifyClient } from '../apify_client.js';
2
+ import { type PricingTier } from './pricing_info.js';
3
+ export type CachedUserInfo = {
4
+ userId: string | null;
5
+ userPlanTier: PricingTier;
6
+ };
2
7
  /**
3
- * Gets user ID from token, using cache to avoid repeated API calls
4
- * Token is hashed before caching to avoid storing raw tokens
5
- * Returns userId or null if not found
8
+ * Gets user info (id + plan tier) from token, using cache to avoid repeated API calls.
9
+ * Token is hashed before caching to avoid storing raw tokens.
10
+ *
11
+ * Defensive defaults: returns `{ userId: null, userPlanTier: 'FREE' }` when the token is
12
+ * missing/empty, the API call fails, or the plan is unrecognized. Failed lookups are NOT
13
+ * cached so the next call retries.
6
14
  */
7
- export declare function getUserIdFromTokenCached(token: string, apifyClient: ApifyClient): Promise<string | null>;
15
+ export declare function getUserInfoCached(token: string | undefined, apifyClient: ApifyClient): Promise<CachedUserInfo>;
8
16
  //# sourceMappingURL=userid_cache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"userid_cache.d.ts","sourceRoot":"","sources":["../../src/utils/userid_cache.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOtD;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC1C,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,WAAW,GACzB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAexB"}
1
+ {"version":3,"file":"userid_cache.d.ts","sourceRoot":"","sources":["../../src/utils/userid_cache.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGpE,MAAM,MAAM,cAAc,GAAG;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,WAAW,CAAC;CAC7B,CAAC;AAiBF;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACnC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,WAAW,EAAE,WAAW,GACzB,OAAO,CAAC,cAAc,CAAC,CAuBzB"}