@bubblelab/bubble-core 0.1.11 → 0.1.12
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/bubble-bundle.d.ts +164 -121
- package/dist/bubble-factory.d.ts.map +1 -1
- package/dist/bubble-factory.js +5 -0
- package/dist/bubble-factory.js.map +1 -1
- package/dist/bubbles/service-bubble/ai-agent.d.ts +30 -30
- package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/ai-agent.js +3 -6
- package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
- package/dist/bubbles/service-bubble/apify/apify.d.ts +5 -5
- package/dist/bubbles/service-bubble/apify/apify.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/apify/apify.js +20 -8
- package/dist/bubbles/service-bubble/apify/apify.js.map +1 -1
- package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +542 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.integration.flow.d.ts +37 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.integration.flow.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.integration.flow.js +203 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.integration.flow.js.map +1 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.js +593 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.js.map +1 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.schema.d.ts +518 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.schema.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.schema.js +311 -0
- package/dist/bubbles/service-bubble/browserbase/browserbase.schema.js.map +1 -0
- package/dist/bubbles/service-bubble/browserbase/index.d.ts +3 -0
- package/dist/bubbles/service-bubble/browserbase/index.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/browserbase/index.js +3 -0
- package/dist/bubbles/service-bubble/browserbase/index.js.map +1 -0
- package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +1358 -0
- package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/crustdata/crustdata.js +219 -0
- package/dist/bubbles/service-bubble/crustdata/crustdata.js.map +1 -0
- package/dist/bubbles/service-bubble/crustdata/crustdata.schema.d.ts +1604 -0
- package/dist/bubbles/service-bubble/crustdata/crustdata.schema.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/crustdata/crustdata.schema.js +194 -0
- package/dist/bubbles/service-bubble/crustdata/crustdata.schema.js.map +1 -0
- package/dist/bubbles/service-bubble/crustdata/index.d.ts +3 -0
- package/dist/bubbles/service-bubble/crustdata/index.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/crustdata/index.js +3 -0
- package/dist/bubbles/service-bubble/crustdata/index.js.map +1 -0
- package/dist/bubbles/service-bubble/firecrawl.d.ts +4 -4
- package/dist/bubbles/service-bubble/firecrawl.js +1 -1
- package/dist/bubbles/service-bubble/firecrawl.js.map +1 -1
- package/dist/bubbles/service-bubble/github.d.ts +0 -6
- package/dist/bubbles/service-bubble/github.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/github.js +1 -7
- package/dist/bubbles/service-bubble/github.js.map +1 -1
- package/dist/bubbles/service-bubble/gmail.d.ts +84 -84
- package/dist/bubbles/service-bubble/google-drive.d.ts +32 -32
- package/dist/bubbles/service-bubble/http.d.ts +13 -1
- package/dist/bubbles/service-bubble/http.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/http.integration.flow.d.ts +49 -0
- package/dist/bubbles/service-bubble/http.integration.flow.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/http.integration.flow.js +425 -0
- package/dist/bubbles/service-bubble/http.integration.flow.js.map +1 -0
- package/dist/bubbles/service-bubble/http.js +40 -4
- package/dist/bubbles/service-bubble/http.js.map +1 -1
- package/dist/bubbles/service-bubble/resend.d.ts +4 -4
- package/dist/bubbles/service-bubble/slack.d.ts +978 -35
- package/dist/bubbles/service-bubble/slack.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/slack.js +320 -26
- package/dist/bubbles/service-bubble/slack.js.map +1 -1
- package/dist/bubbles/service-bubble/storage.d.ts +1 -1
- package/dist/bubbles/service-bubble/storage.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/storage.js +2 -2
- package/dist/bubbles/service-bubble/storage.js.map +1 -1
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +494 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.d.ts +31 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.js +100 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.js.map +1 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.js +1301 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts +473 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.js +230 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.js.map +1 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/index.d.ts +3 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/index.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/index.js +3 -0
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/index.js.map +1 -0
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +740 -0
- package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/company-enrichment-tool.js +350 -0
- package/dist/bubbles/tool-bubble/company-enrichment-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/google-maps-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/google-maps-tool.js +1 -0
- package/dist/bubbles/tool-bubble/google-maps-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/instagram-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/instagram-tool.js +2 -0
- package/dist/bubbles/tool-bubble/instagram-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +6 -6
- package/dist/bubbles/tool-bubble/linkedin-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/linkedin-tool.js +6 -4
- package/dist/bubbles/tool-bubble/linkedin-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/research-agent-tool.js +6 -1
- package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/twitter-tool.d.ts +10 -10
- package/dist/bubbles/tool-bubble/twitter-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/twitter-tool.js +3 -0
- package/dist/bubbles/tool-bubble/twitter-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +6 -6
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/web-scrape-tool.js +4 -1
- package/dist/bubbles/tool-bubble/web-scrape-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/youtube-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/youtube-tool.js +3 -0
- package/dist/bubbles/tool-bubble/youtube-tool.js.map +1 -1
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +24 -24
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +8 -8
- package/dist/bubbles.json +50 -15
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/logging/BubbleLogger.d.ts +10 -0
- package/dist/logging/BubbleLogger.d.ts.map +1 -1
- package/dist/logging/BubbleLogger.js +14 -0
- package/dist/logging/BubbleLogger.js.map +1 -1
- package/dist/logging/StreamingBubbleLogger.d.ts +8 -0
- package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -1
- package/dist/logging/StreamingBubbleLogger.js +29 -0
- package/dist/logging/StreamingBubbleLogger.js.map +1 -1
- package/dist/types/available-tools.d.ts +1 -1
- package/dist/types/available-tools.d.ts.map +1 -1
- package/dist/types/available-tools.js +6 -0
- package/dist/types/available-tools.js.map +1 -1
- package/dist/types/base-bubble-class.d.ts.map +1 -1
- package/dist/types/base-bubble-class.js +0 -8
- package/dist/types/base-bubble-class.js.map +1 -1
- package/dist/types/tool-bubble-class.d.ts.map +1 -1
- package/dist/types/tool-bubble-class.js +58 -8
- package/dist/types/tool-bubble-class.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
import { ToolBubble } from '../../../types/tool-bubble-class.js';
|
|
2
|
+
import type { BubbleContext } from '../../../types/bubble.js';
|
|
3
|
+
import { CredentialType, type BubbleName } from '@bubblelab/shared-schemas';
|
|
4
|
+
import { type AmazonShoppingToolParamsInput, type AmazonShoppingToolResult } from './amazon-shopping-tool.schema.js';
|
|
5
|
+
/**
|
|
6
|
+
* Amazon Shopping Tool
|
|
7
|
+
*
|
|
8
|
+
* A tool bubble for automating Amazon shopping operations including
|
|
9
|
+
* adding items to cart, viewing cart, and completing checkout.
|
|
10
|
+
*
|
|
11
|
+
* This tool uses the BrowserBase service bubble internally to
|
|
12
|
+
* manage browser sessions with authenticated Amazon credentials.
|
|
13
|
+
*
|
|
14
|
+
* Features:
|
|
15
|
+
* - Add products to cart by URL or ASIN
|
|
16
|
+
* - View current cart contents and totals
|
|
17
|
+
* - Complete checkout with saved payment methods
|
|
18
|
+
* - Search for products
|
|
19
|
+
* - Get detailed product information
|
|
20
|
+
*
|
|
21
|
+
* Required Credentials:
|
|
22
|
+
* - AMAZON_CRED: Browser session credential with Amazon cookies
|
|
23
|
+
*
|
|
24
|
+
* Security:
|
|
25
|
+
* - Uses BrowserBase cloud browsers (isolated)
|
|
26
|
+
* - Credentials are encrypted at rest
|
|
27
|
+
* - Session data is not persisted beyond operation
|
|
28
|
+
*/
|
|
29
|
+
export declare class AmazonShoppingTool<T extends AmazonShoppingToolParamsInput = AmazonShoppingToolParamsInput> extends ToolBubble<T, Extract<AmazonShoppingToolResult, {
|
|
30
|
+
operation: T['operation'];
|
|
31
|
+
}>> {
|
|
32
|
+
static readonly bubbleName: BubbleName;
|
|
33
|
+
static readonly schema: import("zod").ZodDiscriminatedUnion<"operation", [import("zod").ZodObject<{
|
|
34
|
+
operation: import("zod").ZodLiteral<"add_to_cart">;
|
|
35
|
+
product_url: import("zod").ZodString;
|
|
36
|
+
quantity: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
|
|
37
|
+
credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
|
|
38
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
39
|
+
operation: "add_to_cart";
|
|
40
|
+
quantity: number;
|
|
41
|
+
product_url: string;
|
|
42
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
operation: "add_to_cart";
|
|
45
|
+
product_url: string;
|
|
46
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
47
|
+
quantity?: number | undefined;
|
|
48
|
+
}>, import("zod").ZodObject<{
|
|
49
|
+
operation: import("zod").ZodLiteral<"get_cart">;
|
|
50
|
+
credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
|
|
51
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
52
|
+
operation: "get_cart";
|
|
53
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
operation: "get_cart";
|
|
56
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
57
|
+
}>, import("zod").ZodObject<{
|
|
58
|
+
operation: import("zod").ZodLiteral<"checkout">;
|
|
59
|
+
credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
|
|
60
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
61
|
+
operation: "checkout";
|
|
62
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
63
|
+
}, {
|
|
64
|
+
operation: "checkout";
|
|
65
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
66
|
+
}>, import("zod").ZodObject<{
|
|
67
|
+
operation: import("zod").ZodLiteral<"search">;
|
|
68
|
+
query: import("zod").ZodString;
|
|
69
|
+
max_results: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
|
|
70
|
+
credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
|
|
71
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
72
|
+
query: string;
|
|
73
|
+
operation: "search";
|
|
74
|
+
max_results: number;
|
|
75
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
query: string;
|
|
78
|
+
operation: "search";
|
|
79
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
80
|
+
max_results?: number | undefined;
|
|
81
|
+
}>, import("zod").ZodObject<{
|
|
82
|
+
operation: import("zod").ZodLiteral<"get_product">;
|
|
83
|
+
product_url: import("zod").ZodString;
|
|
84
|
+
credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
|
|
85
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
86
|
+
operation: "get_product";
|
|
87
|
+
product_url: string;
|
|
88
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
operation: "get_product";
|
|
91
|
+
product_url: string;
|
|
92
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
93
|
+
}>, import("zod").ZodObject<{
|
|
94
|
+
operation: import("zod").ZodLiteral<"screenshot">;
|
|
95
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
96
|
+
full_page: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
|
|
97
|
+
credentials: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodNativeEnum<typeof CredentialType>, import("zod").ZodString>>;
|
|
98
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
99
|
+
operation: "screenshot";
|
|
100
|
+
full_page: boolean;
|
|
101
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
102
|
+
url?: string | undefined;
|
|
103
|
+
}, {
|
|
104
|
+
operation: "screenshot";
|
|
105
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
106
|
+
url?: string | undefined;
|
|
107
|
+
full_page?: boolean | undefined;
|
|
108
|
+
}>]>;
|
|
109
|
+
static readonly resultSchema: import("zod").ZodDiscriminatedUnion<"operation", [import("zod").ZodObject<{
|
|
110
|
+
operation: import("zod").ZodLiteral<"add_to_cart">;
|
|
111
|
+
success: import("zod").ZodBoolean;
|
|
112
|
+
message: import("zod").ZodOptional<import("zod").ZodString>;
|
|
113
|
+
cart_count: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
114
|
+
error: import("zod").ZodString;
|
|
115
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
116
|
+
error: string;
|
|
117
|
+
success: boolean;
|
|
118
|
+
operation: "add_to_cart";
|
|
119
|
+
message?: string | undefined;
|
|
120
|
+
cart_count?: number | undefined;
|
|
121
|
+
}, {
|
|
122
|
+
error: string;
|
|
123
|
+
success: boolean;
|
|
124
|
+
operation: "add_to_cart";
|
|
125
|
+
message?: string | undefined;
|
|
126
|
+
cart_count?: number | undefined;
|
|
127
|
+
}>, import("zod").ZodObject<{
|
|
128
|
+
operation: import("zod").ZodLiteral<"get_cart">;
|
|
129
|
+
success: import("zod").ZodBoolean;
|
|
130
|
+
items: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
131
|
+
asin: import("zod").ZodString;
|
|
132
|
+
title: import("zod").ZodString;
|
|
133
|
+
price: import("zod").ZodString;
|
|
134
|
+
quantity: import("zod").ZodNumber;
|
|
135
|
+
image: import("zod").ZodOptional<import("zod").ZodString>;
|
|
136
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
137
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
138
|
+
title: string;
|
|
139
|
+
price: string;
|
|
140
|
+
asin: string;
|
|
141
|
+
quantity: number;
|
|
142
|
+
url?: string | undefined;
|
|
143
|
+
image?: string | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
title: string;
|
|
146
|
+
price: string;
|
|
147
|
+
asin: string;
|
|
148
|
+
quantity: number;
|
|
149
|
+
url?: string | undefined;
|
|
150
|
+
image?: string | undefined;
|
|
151
|
+
}>, "many">>;
|
|
152
|
+
subtotal: import("zod").ZodOptional<import("zod").ZodString>;
|
|
153
|
+
total_items: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
154
|
+
screenshot_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
155
|
+
error: import("zod").ZodString;
|
|
156
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
157
|
+
error: string;
|
|
158
|
+
success: boolean;
|
|
159
|
+
operation: "get_cart";
|
|
160
|
+
items?: {
|
|
161
|
+
title: string;
|
|
162
|
+
price: string;
|
|
163
|
+
asin: string;
|
|
164
|
+
quantity: number;
|
|
165
|
+
url?: string | undefined;
|
|
166
|
+
image?: string | undefined;
|
|
167
|
+
}[] | undefined;
|
|
168
|
+
subtotal?: string | undefined;
|
|
169
|
+
total_items?: number | undefined;
|
|
170
|
+
screenshot_url?: string | undefined;
|
|
171
|
+
}, {
|
|
172
|
+
error: string;
|
|
173
|
+
success: boolean;
|
|
174
|
+
operation: "get_cart";
|
|
175
|
+
items?: {
|
|
176
|
+
title: string;
|
|
177
|
+
price: string;
|
|
178
|
+
asin: string;
|
|
179
|
+
quantity: number;
|
|
180
|
+
url?: string | undefined;
|
|
181
|
+
image?: string | undefined;
|
|
182
|
+
}[] | undefined;
|
|
183
|
+
subtotal?: string | undefined;
|
|
184
|
+
total_items?: number | undefined;
|
|
185
|
+
screenshot_url?: string | undefined;
|
|
186
|
+
}>, import("zod").ZodObject<{
|
|
187
|
+
operation: import("zod").ZodLiteral<"checkout">;
|
|
188
|
+
success: import("zod").ZodBoolean;
|
|
189
|
+
order_number: import("zod").ZodOptional<import("zod").ZodString>;
|
|
190
|
+
estimated_delivery: import("zod").ZodOptional<import("zod").ZodString>;
|
|
191
|
+
total: import("zod").ZodOptional<import("zod").ZodString>;
|
|
192
|
+
subtotal: import("zod").ZodOptional<import("zod").ZodString>;
|
|
193
|
+
shipping_cost: import("zod").ZodOptional<import("zod").ZodString>;
|
|
194
|
+
tax: import("zod").ZodOptional<import("zod").ZodString>;
|
|
195
|
+
shipping_address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
196
|
+
payment_method: import("zod").ZodOptional<import("zod").ZodString>;
|
|
197
|
+
items: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
198
|
+
title: import("zod").ZodString;
|
|
199
|
+
quantity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
200
|
+
price: import("zod").ZodOptional<import("zod").ZodString>;
|
|
201
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
202
|
+
title: string;
|
|
203
|
+
price?: string | undefined;
|
|
204
|
+
quantity?: number | undefined;
|
|
205
|
+
}, {
|
|
206
|
+
title: string;
|
|
207
|
+
price?: string | undefined;
|
|
208
|
+
quantity?: number | undefined;
|
|
209
|
+
}>, "many">>;
|
|
210
|
+
screenshot_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
211
|
+
error: import("zod").ZodString;
|
|
212
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
213
|
+
error: string;
|
|
214
|
+
success: boolean;
|
|
215
|
+
operation: "checkout";
|
|
216
|
+
items?: {
|
|
217
|
+
title: string;
|
|
218
|
+
price?: string | undefined;
|
|
219
|
+
quantity?: number | undefined;
|
|
220
|
+
}[] | undefined;
|
|
221
|
+
total?: string | undefined;
|
|
222
|
+
subtotal?: string | undefined;
|
|
223
|
+
screenshot_url?: string | undefined;
|
|
224
|
+
order_number?: string | undefined;
|
|
225
|
+
estimated_delivery?: string | undefined;
|
|
226
|
+
shipping_cost?: string | undefined;
|
|
227
|
+
tax?: string | undefined;
|
|
228
|
+
shipping_address?: string | undefined;
|
|
229
|
+
payment_method?: string | undefined;
|
|
230
|
+
}, {
|
|
231
|
+
error: string;
|
|
232
|
+
success: boolean;
|
|
233
|
+
operation: "checkout";
|
|
234
|
+
items?: {
|
|
235
|
+
title: string;
|
|
236
|
+
price?: string | undefined;
|
|
237
|
+
quantity?: number | undefined;
|
|
238
|
+
}[] | undefined;
|
|
239
|
+
total?: string | undefined;
|
|
240
|
+
subtotal?: string | undefined;
|
|
241
|
+
screenshot_url?: string | undefined;
|
|
242
|
+
order_number?: string | undefined;
|
|
243
|
+
estimated_delivery?: string | undefined;
|
|
244
|
+
shipping_cost?: string | undefined;
|
|
245
|
+
tax?: string | undefined;
|
|
246
|
+
shipping_address?: string | undefined;
|
|
247
|
+
payment_method?: string | undefined;
|
|
248
|
+
}>, import("zod").ZodObject<{
|
|
249
|
+
operation: import("zod").ZodLiteral<"search">;
|
|
250
|
+
success: import("zod").ZodBoolean;
|
|
251
|
+
results: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
252
|
+
asin: import("zod").ZodString;
|
|
253
|
+
title: import("zod").ZodString;
|
|
254
|
+
price: import("zod").ZodOptional<import("zod").ZodString>;
|
|
255
|
+
rating: import("zod").ZodOptional<import("zod").ZodString>;
|
|
256
|
+
reviews_count: import("zod").ZodOptional<import("zod").ZodString>;
|
|
257
|
+
url: import("zod").ZodString;
|
|
258
|
+
image: import("zod").ZodOptional<import("zod").ZodString>;
|
|
259
|
+
prime: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
260
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
261
|
+
title: string;
|
|
262
|
+
url: string;
|
|
263
|
+
asin: string;
|
|
264
|
+
image?: string | undefined;
|
|
265
|
+
rating?: string | undefined;
|
|
266
|
+
price?: string | undefined;
|
|
267
|
+
reviews_count?: string | undefined;
|
|
268
|
+
prime?: boolean | undefined;
|
|
269
|
+
}, {
|
|
270
|
+
title: string;
|
|
271
|
+
url: string;
|
|
272
|
+
asin: string;
|
|
273
|
+
image?: string | undefined;
|
|
274
|
+
rating?: string | undefined;
|
|
275
|
+
price?: string | undefined;
|
|
276
|
+
reviews_count?: string | undefined;
|
|
277
|
+
prime?: boolean | undefined;
|
|
278
|
+
}>, "many">>;
|
|
279
|
+
total_results: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
280
|
+
error: import("zod").ZodString;
|
|
281
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
282
|
+
error: string;
|
|
283
|
+
success: boolean;
|
|
284
|
+
operation: "search";
|
|
285
|
+
results?: {
|
|
286
|
+
title: string;
|
|
287
|
+
url: string;
|
|
288
|
+
asin: string;
|
|
289
|
+
image?: string | undefined;
|
|
290
|
+
rating?: string | undefined;
|
|
291
|
+
price?: string | undefined;
|
|
292
|
+
reviews_count?: string | undefined;
|
|
293
|
+
prime?: boolean | undefined;
|
|
294
|
+
}[] | undefined;
|
|
295
|
+
total_results?: number | undefined;
|
|
296
|
+
}, {
|
|
297
|
+
error: string;
|
|
298
|
+
success: boolean;
|
|
299
|
+
operation: "search";
|
|
300
|
+
results?: {
|
|
301
|
+
title: string;
|
|
302
|
+
url: string;
|
|
303
|
+
asin: string;
|
|
304
|
+
image?: string | undefined;
|
|
305
|
+
rating?: string | undefined;
|
|
306
|
+
price?: string | undefined;
|
|
307
|
+
reviews_count?: string | undefined;
|
|
308
|
+
prime?: boolean | undefined;
|
|
309
|
+
}[] | undefined;
|
|
310
|
+
total_results?: number | undefined;
|
|
311
|
+
}>, import("zod").ZodObject<{
|
|
312
|
+
operation: import("zod").ZodLiteral<"get_product">;
|
|
313
|
+
success: import("zod").ZodBoolean;
|
|
314
|
+
product: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
315
|
+
asin: import("zod").ZodString;
|
|
316
|
+
title: import("zod").ZodString;
|
|
317
|
+
price: import("zod").ZodOptional<import("zod").ZodString>;
|
|
318
|
+
rating: import("zod").ZodOptional<import("zod").ZodString>;
|
|
319
|
+
reviews_count: import("zod").ZodOptional<import("zod").ZodString>;
|
|
320
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
321
|
+
features: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
322
|
+
availability: import("zod").ZodOptional<import("zod").ZodString>;
|
|
323
|
+
url: import("zod").ZodString;
|
|
324
|
+
images: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
325
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
326
|
+
title: string;
|
|
327
|
+
url: string;
|
|
328
|
+
asin: string;
|
|
329
|
+
description?: string | undefined;
|
|
330
|
+
images?: string[] | undefined;
|
|
331
|
+
rating?: string | undefined;
|
|
332
|
+
price?: string | undefined;
|
|
333
|
+
reviews_count?: string | undefined;
|
|
334
|
+
features?: string[] | undefined;
|
|
335
|
+
availability?: string | undefined;
|
|
336
|
+
}, {
|
|
337
|
+
title: string;
|
|
338
|
+
url: string;
|
|
339
|
+
asin: string;
|
|
340
|
+
description?: string | undefined;
|
|
341
|
+
images?: string[] | undefined;
|
|
342
|
+
rating?: string | undefined;
|
|
343
|
+
price?: string | undefined;
|
|
344
|
+
reviews_count?: string | undefined;
|
|
345
|
+
features?: string[] | undefined;
|
|
346
|
+
availability?: string | undefined;
|
|
347
|
+
}>>;
|
|
348
|
+
error: import("zod").ZodString;
|
|
349
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
350
|
+
error: string;
|
|
351
|
+
success: boolean;
|
|
352
|
+
operation: "get_product";
|
|
353
|
+
product?: {
|
|
354
|
+
title: string;
|
|
355
|
+
url: string;
|
|
356
|
+
asin: string;
|
|
357
|
+
description?: string | undefined;
|
|
358
|
+
images?: string[] | undefined;
|
|
359
|
+
rating?: string | undefined;
|
|
360
|
+
price?: string | undefined;
|
|
361
|
+
reviews_count?: string | undefined;
|
|
362
|
+
features?: string[] | undefined;
|
|
363
|
+
availability?: string | undefined;
|
|
364
|
+
} | undefined;
|
|
365
|
+
}, {
|
|
366
|
+
error: string;
|
|
367
|
+
success: boolean;
|
|
368
|
+
operation: "get_product";
|
|
369
|
+
product?: {
|
|
370
|
+
title: string;
|
|
371
|
+
url: string;
|
|
372
|
+
asin: string;
|
|
373
|
+
description?: string | undefined;
|
|
374
|
+
images?: string[] | undefined;
|
|
375
|
+
rating?: string | undefined;
|
|
376
|
+
price?: string | undefined;
|
|
377
|
+
reviews_count?: string | undefined;
|
|
378
|
+
features?: string[] | undefined;
|
|
379
|
+
availability?: string | undefined;
|
|
380
|
+
} | undefined;
|
|
381
|
+
}>, import("zod").ZodObject<{
|
|
382
|
+
operation: import("zod").ZodLiteral<"screenshot">;
|
|
383
|
+
success: import("zod").ZodBoolean;
|
|
384
|
+
screenshot_url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
385
|
+
error: import("zod").ZodString;
|
|
386
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
387
|
+
error: string;
|
|
388
|
+
success: boolean;
|
|
389
|
+
operation: "screenshot";
|
|
390
|
+
screenshot_url?: string | undefined;
|
|
391
|
+
}, {
|
|
392
|
+
error: string;
|
|
393
|
+
success: boolean;
|
|
394
|
+
operation: "screenshot";
|
|
395
|
+
screenshot_url?: string | undefined;
|
|
396
|
+
}>]>;
|
|
397
|
+
static readonly shortDescription = "Amazon shopping automation - add to cart, view cart, checkout, search products";
|
|
398
|
+
static readonly longDescription = "\n Amazon Shopping Tool for automating shopping operations.\n\n Features:\n - Add products to cart by URL or ASIN\n - View current cart contents and totals\n - Complete checkout with saved payment methods\n - Search for products on Amazon\n - Get detailed product information\n\n Required Credentials:\n - AMAZON_CRED: Browser session credential (authenticate via browser session)\n\n Note: Checkout requires saved payment and shipping information in Amazon account.\n The tool operates using authenticated browser sessions to ensure security.\n ";
|
|
399
|
+
static readonly alias = "amazon";
|
|
400
|
+
static readonly type = "tool";
|
|
401
|
+
private sessionId;
|
|
402
|
+
private contextId;
|
|
403
|
+
private cookies;
|
|
404
|
+
constructor(params?: T, context?: BubbleContext);
|
|
405
|
+
/**
|
|
406
|
+
* Choose the credential to use for Amazon operations
|
|
407
|
+
* Returns AMAZON_CRED which contains contextId and cookies
|
|
408
|
+
*/
|
|
409
|
+
protected chooseCredential(): string | undefined;
|
|
410
|
+
/**
|
|
411
|
+
* Parse the AMAZON_CRED to extract contextId and cookies
|
|
412
|
+
* Credential is base64-encoded JSON to avoid escaping issues
|
|
413
|
+
*/
|
|
414
|
+
private parseBrowserSessionData;
|
|
415
|
+
/**
|
|
416
|
+
* Extract ASIN from Amazon URL or return as-is if already an ASIN
|
|
417
|
+
*/
|
|
418
|
+
private extractAsin;
|
|
419
|
+
/**
|
|
420
|
+
* Build Amazon product URL from ASIN
|
|
421
|
+
*/
|
|
422
|
+
private buildProductUrl;
|
|
423
|
+
/**
|
|
424
|
+
* Start a browser session using BrowserBase
|
|
425
|
+
* Extracts contextId and cookies from AMAZON_CRED and passes them explicitly
|
|
426
|
+
*/
|
|
427
|
+
private startBrowserSession;
|
|
428
|
+
/**
|
|
429
|
+
* End the browser session
|
|
430
|
+
*/
|
|
431
|
+
private endBrowserSession;
|
|
432
|
+
/**
|
|
433
|
+
* Navigate to a URL
|
|
434
|
+
*/
|
|
435
|
+
private navigateTo;
|
|
436
|
+
/**
|
|
437
|
+
* Click an element
|
|
438
|
+
*/
|
|
439
|
+
private clickElement;
|
|
440
|
+
/**
|
|
441
|
+
* Evaluate JavaScript in page
|
|
442
|
+
*/
|
|
443
|
+
private evaluate;
|
|
444
|
+
/**
|
|
445
|
+
* Wait for selector
|
|
446
|
+
*/
|
|
447
|
+
private waitForSelector;
|
|
448
|
+
/**
|
|
449
|
+
* Wait for navigation to complete
|
|
450
|
+
*/
|
|
451
|
+
private waitForNavigation;
|
|
452
|
+
/**
|
|
453
|
+
* Take a screenshot and upload to Cloudflare R2
|
|
454
|
+
* Returns the URL of the uploaded screenshot
|
|
455
|
+
*/
|
|
456
|
+
private takeScreenshotAndUpload;
|
|
457
|
+
performAction(): Promise<Extract<AmazonShoppingToolResult, {
|
|
458
|
+
operation: T['operation'];
|
|
459
|
+
}>>;
|
|
460
|
+
/**
|
|
461
|
+
* Add a product to cart
|
|
462
|
+
*/
|
|
463
|
+
private addToCart;
|
|
464
|
+
/**
|
|
465
|
+
* Get cart contents
|
|
466
|
+
*/
|
|
467
|
+
private getCart;
|
|
468
|
+
/**
|
|
469
|
+
* Get current page URL
|
|
470
|
+
*/
|
|
471
|
+
private getCurrentUrl;
|
|
472
|
+
/**
|
|
473
|
+
* Complete checkout - uses same heuristics as amazon-cart-browserbase.ts
|
|
474
|
+
*/
|
|
475
|
+
private checkout;
|
|
476
|
+
/**
|
|
477
|
+
* Save current DOM state to file for debugging
|
|
478
|
+
* Only saves when DEBUG env var is set
|
|
479
|
+
*/
|
|
480
|
+
private saveDebugState;
|
|
481
|
+
/**
|
|
482
|
+
* Search for products
|
|
483
|
+
*/
|
|
484
|
+
private searchProducts;
|
|
485
|
+
/**
|
|
486
|
+
* Get product details
|
|
487
|
+
*/
|
|
488
|
+
private getProduct;
|
|
489
|
+
/**
|
|
490
|
+
* Take a screenshot operation - navigate to URL if provided, then capture screenshot
|
|
491
|
+
*/
|
|
492
|
+
private takeScreenshot;
|
|
493
|
+
}
|
|
494
|
+
//# sourceMappingURL=amazon-shopping-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amazon-shopping-tool.d.ts","sourceRoot":"","sources":["../../../../src/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAO5E,OAAO,EAIL,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAI9B,MAAM,kCAAkC,CAAC;AAU1C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,kBAAkB,CAC7B,CAAC,SAAS,6BAA6B,GAAG,6BAA6B,CACvE,SAAQ,UAAU,CAClB,CAAC,EACD,OAAO,CAAC,wBAAwB,EAAE;IAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC,CACjE;IACC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAA0B;IAChE,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAkC;IACxD,MAAM,CAAC,QAAQ,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;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G;YACW,OAAO;IA0DrB;;OAEG;YACW,aAAa;IAK3B;;OAEG;YACW,QAAQ;IAogBtB;;;OAGG;YACW,cAAc;IA0B5B;;OAEG;YACW,cAAc;IAiJ5B;;OAEG;YACW,UAAU;IA4DxB;;OAEG;YACW,cAAc;CAkC7B"}
|
package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BubbleFlow, type WebhookEvent } from '@bubblelab/bubble-core';
|
|
2
|
+
export interface Output {
|
|
3
|
+
testResults: {
|
|
4
|
+
operation: string;
|
|
5
|
+
success: boolean;
|
|
6
|
+
details?: string;
|
|
7
|
+
}[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Payload for the Amazon Shopping Tool Integration Test workflow.
|
|
11
|
+
*/
|
|
12
|
+
export interface AmazonShoppingTestPayload extends WebhookEvent {
|
|
13
|
+
/**
|
|
14
|
+
* Search query to test with
|
|
15
|
+
* @canBeFile false
|
|
16
|
+
*/
|
|
17
|
+
searchQuery?: string;
|
|
18
|
+
/**
|
|
19
|
+
* ASIN to test product details with
|
|
20
|
+
* @canBeFile false
|
|
21
|
+
*/
|
|
22
|
+
testAsin?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class AmazonShoppingIntegrationTest extends BubbleFlow<'webhook/http'> {
|
|
25
|
+
private searchProducts;
|
|
26
|
+
private getProductDetails;
|
|
27
|
+
private getCartContents;
|
|
28
|
+
private addToCart;
|
|
29
|
+
handle(payload: AmazonShoppingTestPayload): Promise<Output>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=amazon-shopping-tool.integration.flow.d.ts.map
|
package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amazon-shopping-tool.integration.flow.d.ts","sourceRoot":"","sources":["../../../../src/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,MAAM;IACrB,WAAW,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;CACL;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,YAAY;IAC7D;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,6BAA8B,SAAQ,UAAU,CAAC,cAAc,CAAC;YAE7D,cAAc;YAed,iBAAiB;YAcjB,eAAe;YAaf,SAAS;IAcjB,MAAM,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC;CA4DlE"}
|
package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { BubbleFlow, AmazonShoppingTool, } from '@bubblelab/bubble-core';
|
|
2
|
+
export class AmazonShoppingIntegrationTest extends BubbleFlow {
|
|
3
|
+
// Searches for products on Amazon
|
|
4
|
+
async searchProducts(query, maxResults) {
|
|
5
|
+
const result = await new AmazonShoppingTool({
|
|
6
|
+
operation: 'search',
|
|
7
|
+
query: query,
|
|
8
|
+
max_results: maxResults,
|
|
9
|
+
}).action();
|
|
10
|
+
if (!result.success || result.data?.operation !== 'search') {
|
|
11
|
+
throw new Error(`Failed to search products: ${result.error}`);
|
|
12
|
+
}
|
|
13
|
+
return result.data;
|
|
14
|
+
}
|
|
15
|
+
// Gets detailed information about a product
|
|
16
|
+
async getProductDetails(productUrl) {
|
|
17
|
+
const result = await new AmazonShoppingTool({
|
|
18
|
+
operation: 'get_product',
|
|
19
|
+
product_url: productUrl,
|
|
20
|
+
}).action();
|
|
21
|
+
if (!result.success || result.data?.operation !== 'get_product') {
|
|
22
|
+
throw new Error(`Failed to get product details: ${result.error}`);
|
|
23
|
+
}
|
|
24
|
+
return result.data;
|
|
25
|
+
}
|
|
26
|
+
// Gets current cart contents
|
|
27
|
+
async getCartContents() {
|
|
28
|
+
const result = await new AmazonShoppingTool({
|
|
29
|
+
operation: 'get_cart',
|
|
30
|
+
}).action();
|
|
31
|
+
if (!result.success || result.data?.operation !== 'get_cart') {
|
|
32
|
+
throw new Error(`Failed to get cart: ${result.error}`);
|
|
33
|
+
}
|
|
34
|
+
return result.data;
|
|
35
|
+
}
|
|
36
|
+
// Adds a product to the cart (commented out by default to avoid modifying real cart)
|
|
37
|
+
async addToCart(productUrl, quantity) {
|
|
38
|
+
const result = await new AmazonShoppingTool({
|
|
39
|
+
operation: 'add_to_cart',
|
|
40
|
+
product_url: productUrl,
|
|
41
|
+
quantity: quantity,
|
|
42
|
+
}).action();
|
|
43
|
+
if (!result.success || result.data?.operation !== 'add_to_cart') {
|
|
44
|
+
throw new Error(`Failed to add to cart: ${result.error}`);
|
|
45
|
+
}
|
|
46
|
+
return result.data;
|
|
47
|
+
}
|
|
48
|
+
async handle(payload) {
|
|
49
|
+
const { searchQuery = 'wireless mouse', testAsin = 'B08N5WRWNW', } = payload;
|
|
50
|
+
const results = [];
|
|
51
|
+
// 1. Search for products
|
|
52
|
+
const searchData = await this.searchProducts(searchQuery, 5);
|
|
53
|
+
results.push({
|
|
54
|
+
operation: 'search',
|
|
55
|
+
success: true,
|
|
56
|
+
details: `Found ${searchData.results?.length || 0} products for "${searchQuery}"`,
|
|
57
|
+
});
|
|
58
|
+
// 2. Get product details for first result or test ASIN
|
|
59
|
+
const productUrl = searchData.results?.[0]?.url || testAsin;
|
|
60
|
+
const productData = await this.getProductDetails(productUrl);
|
|
61
|
+
results.push({
|
|
62
|
+
operation: 'get_product',
|
|
63
|
+
success: true,
|
|
64
|
+
details: `Product: ${productData.product?.title?.substring(0, 50) || 'Unknown'}... (${productData.product?.asin})`,
|
|
65
|
+
});
|
|
66
|
+
// 3. Get cart contents (read-only, safe to run)
|
|
67
|
+
const cartData = await this.getCartContents();
|
|
68
|
+
results.push({
|
|
69
|
+
operation: 'get_cart',
|
|
70
|
+
success: true,
|
|
71
|
+
details: `Cart has ${cartData.items?.length || 0} items, subtotal: ${cartData.subtotal || 'N/A'}`,
|
|
72
|
+
});
|
|
73
|
+
// 4. Add to cart (UNCOMMENT ONLY FOR FULL INTEGRATION TEST)
|
|
74
|
+
// WARNING: This will modify the actual Amazon cart!
|
|
75
|
+
/*
|
|
76
|
+
const addResult = await this.addToCart(productUrl, 1);
|
|
77
|
+
results.push({
|
|
78
|
+
operation: 'add_to_cart',
|
|
79
|
+
success: true,
|
|
80
|
+
details: `Added item, cart now has ${addResult.cart_count || 'unknown'} items`,
|
|
81
|
+
});
|
|
82
|
+
*/
|
|
83
|
+
// 5. Checkout (NEVER UNCOMMENT - will complete real purchase!)
|
|
84
|
+
// This is documented for completeness but should never be run in tests
|
|
85
|
+
/*
|
|
86
|
+
const checkoutResult = await new AmazonShoppingTool({
|
|
87
|
+
operation: 'checkout',
|
|
88
|
+
}).action();
|
|
89
|
+
results.push({
|
|
90
|
+
operation: 'checkout',
|
|
91
|
+
success: checkoutResult.data?.success || false,
|
|
92
|
+
details: `Order: ${checkoutResult.data?.order_number || 'N/A'}`,
|
|
93
|
+
});
|
|
94
|
+
*/
|
|
95
|
+
return {
|
|
96
|
+
testResults: results,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=amazon-shopping-tool.integration.flow.js.map
|
package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.integration.flow.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amazon-shopping-tool.integration.flow.js","sourceRoot":"","sources":["../../../../src/bubbles/tool-bubble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