@takeshape/purchase-order-chat 1.51.0-beta.1

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.
@@ -0,0 +1,15 @@
1
+ 'use client';
2
+ import { a, P as t, T as c, d as i, c as o, b as s, s as C } from "./purchase-order-chat-wrapper-D8d5NFc9.js";
3
+ import { MockBigCommerceClient as n, createMockBigCommerceClient as B } from "./testing.js";
4
+ export {
5
+ n as MockBigCommerceClient,
6
+ a as PurchaseOrderChat,
7
+ t as PurchaseOrderChatWidget,
8
+ c as TakeShapeConfigProvider,
9
+ i as createB2BClient,
10
+ o as createBigCommerceClient,
11
+ s as createBigCommerceEndpoint,
12
+ B as createMockBigCommerceClient,
13
+ C as stencilB2BJwt
14
+ };
15
+ //# sourceMappingURL=tailwind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwind.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,456 @@
1
+ import { ResultOf } from 'gql.tada';
2
+ import { TadaDocumentNode } from 'gql.tada';
3
+
4
+ declare interface BigCommerceConfig {
5
+ endpoint: string;
6
+ /** Storefront API token. Optional when using a proxy that handles authentication server-side. */
7
+ storefrontToken?: string;
8
+ channelId?: number;
9
+ }
10
+
11
+ declare type Cart = ResultOf<typeof CartFragment>;
12
+
13
+ declare const CartFragment: TadaDocumentNode< {
14
+ id: string;
15
+ entityId: string;
16
+ lineItems: {
17
+ physicalItems: {
18
+ entityId: string;
19
+ productEntityId: number;
20
+ variantEntityId: number | null;
21
+ quantity: number;
22
+ name: string;
23
+ sku: string | null;
24
+ originalPrice: {
25
+ value: number;
26
+ currencyCode: string;
27
+ };
28
+ listPrice: {
29
+ value: number;
30
+ currencyCode: string;
31
+ };
32
+ extendedListPrice: {
33
+ value: number;
34
+ currencyCode: string;
35
+ };
36
+ extendedSalePrice: {
37
+ value: number;
38
+ currencyCode: string;
39
+ };
40
+ imageUrl: string | null;
41
+ }[];
42
+ digitalItems: {
43
+ entityId: string;
44
+ productEntityId: number;
45
+ variantEntityId: number | null;
46
+ quantity: number;
47
+ name: string;
48
+ sku: string | null;
49
+ originalPrice: {
50
+ value: number;
51
+ currencyCode: string;
52
+ };
53
+ listPrice: {
54
+ value: number;
55
+ currencyCode: string;
56
+ };
57
+ extendedListPrice: {
58
+ value: number;
59
+ currencyCode: string;
60
+ };
61
+ extendedSalePrice: {
62
+ value: number;
63
+ currencyCode: string;
64
+ };
65
+ imageUrl: string | null;
66
+ }[];
67
+ };
68
+ amount: {
69
+ value: number;
70
+ currencyCode: string;
71
+ };
72
+ baseAmount: {
73
+ value: number;
74
+ currencyCode: string;
75
+ };
76
+ discountedAmount: {
77
+ value: number;
78
+ currencyCode: string;
79
+ };
80
+ createdAt: {
81
+ utc: string;
82
+ };
83
+ updatedAt: {
84
+ utc: string;
85
+ };
86
+ }, {}, {
87
+ fragment: "CartFields";
88
+ on: "Cart";
89
+ masked: true;
90
+ }>;
91
+
92
+ declare interface CartLineItemInput {
93
+ productEntityId: number;
94
+ variantEntityId?: number;
95
+ quantity: number;
96
+ }
97
+
98
+ declare interface CartRedirectUrls {
99
+ redirectedCheckoutUrl: string;
100
+ }
101
+
102
+ declare type Checkout = ResultOf<typeof CheckoutFragment>;
103
+
104
+ declare interface CheckoutAddress {
105
+ firstName?: string;
106
+ lastName?: string;
107
+ company?: string;
108
+ address1?: string;
109
+ address2?: string;
110
+ city?: string;
111
+ stateOrProvince?: string;
112
+ stateOrProvinceCode?: string;
113
+ countryCode: string;
114
+ postalCode?: string;
115
+ phone?: string;
116
+ email?: string;
117
+ shouldSaveAddress: boolean;
118
+ }
119
+
120
+ declare interface CheckoutConsignmentLineItem {
121
+ lineItemEntityId: string;
122
+ quantity: number;
123
+ }
124
+
125
+ declare const CheckoutFragment: TadaDocumentNode< {
126
+ entityId: string;
127
+ subtotal: {
128
+ value: number;
129
+ currencyCode: string;
130
+ } | null;
131
+ taxTotal: {
132
+ value: number;
133
+ currencyCode: string;
134
+ } | null;
135
+ grandTotal: {
136
+ value: number;
137
+ currencyCode: string;
138
+ } | null;
139
+ shippingCostTotal: {
140
+ value: number;
141
+ currencyCode: string;
142
+ } | null;
143
+ handlingCostTotal: {
144
+ value: number;
145
+ currencyCode: string;
146
+ } | null;
147
+ billingAddress: {
148
+ firstName: string | null;
149
+ lastName: string | null;
150
+ address1: string | null;
151
+ address2: string | null;
152
+ city: string | null;
153
+ stateOrProvince: string | null;
154
+ stateOrProvinceCode: string | null;
155
+ countryCode: string;
156
+ postalCode: string | null;
157
+ phone: string | null;
158
+ email: string | null;
159
+ } | null;
160
+ shippingConsignments: {
161
+ entityId: string;
162
+ address: {
163
+ firstName: string | null;
164
+ lastName: string | null;
165
+ address1: string | null;
166
+ address2: string | null;
167
+ city: string | null;
168
+ stateOrProvince: string | null;
169
+ stateOrProvinceCode: string | null;
170
+ countryCode: string;
171
+ postalCode: string | null;
172
+ phone: string | null;
173
+ email: string | null;
174
+ };
175
+ availableShippingOptions: {
176
+ entityId: string;
177
+ description: string;
178
+ type: string;
179
+ cost: {
180
+ value: number;
181
+ currencyCode: string;
182
+ };
183
+ }[] | null;
184
+ selectedShippingOption: {
185
+ entityId: string;
186
+ description: string;
187
+ type: string;
188
+ cost: {
189
+ value: number;
190
+ currencyCode: string;
191
+ };
192
+ } | null;
193
+ shippingCost: {
194
+ value: number;
195
+ currencyCode: string;
196
+ } | null;
197
+ lineItemIds: string[];
198
+ }[] | null;
199
+ }, {}, {
200
+ fragment: "CheckoutFields";
201
+ on: "Checkout";
202
+ masked: true;
203
+ }>;
204
+
205
+ /**
206
+ * Create a mock BigCommerce client instance
207
+ */
208
+ export declare function createMockBigCommerceClient(config?: BigCommerceConfig): MockBigCommerceClient;
209
+
210
+ declare interface CustomerAddress {
211
+ source: 'storefront' | 'b2b' | 'po';
212
+ id: string;
213
+ firstName: string;
214
+ lastName: string;
215
+ address1: string;
216
+ address2?: string;
217
+ city: string;
218
+ stateOrProvince?: string;
219
+ postalCode?: string;
220
+ countryCode: string;
221
+ country?: string;
222
+ phone?: string;
223
+ isShipping: boolean;
224
+ isBilling: boolean;
225
+ isDefaultShipping: boolean;
226
+ isDefaultBilling: boolean;
227
+ label?: string;
228
+ }
229
+
230
+ declare interface CustomerInfo {
231
+ entityId: number;
232
+ firstName: string;
233
+ lastName: string;
234
+ email: string;
235
+ }
236
+
237
+ export declare class MockBigCommerceClient {
238
+ private carts;
239
+ private checkouts;
240
+ private checkoutToCartId;
241
+ private nextCartId;
242
+ private nextCheckoutId;
243
+ private nextLineItemId;
244
+ private nextConsignmentId;
245
+ private nextShippingOptionId;
246
+ readonly channelId = 1;
247
+ constructor(_config?: BigCommerceConfig);
248
+ /**
249
+ * Helper: Create a Money object
250
+ */
251
+ private createMoney;
252
+ /**
253
+ * Helper: Generate cart entity ID
254
+ */
255
+ private generateCartId;
256
+ /**
257
+ * Helper: Generate checkout entity ID
258
+ */
259
+ private generateCheckoutId;
260
+ /**
261
+ * Helper: Generate line item entity ID
262
+ */
263
+ private generateLineItemId;
264
+ /**
265
+ * Helper: Generate consignment entity ID
266
+ */
267
+ private generateConsignmentId;
268
+ /**
269
+ * Helper: Generate shipping option entity ID
270
+ */
271
+ private generateShippingOptionId;
272
+ /**
273
+ * Helper: Create a cart line item from input
274
+ */
275
+ private createCartLineItem;
276
+ /**
277
+ * Helper: Calculate cart totals
278
+ */
279
+ private calculateCartTotals;
280
+ /**
281
+ * Helper: Calculate checkout totals
282
+ */
283
+ private calculateCheckoutTotals;
284
+ /**
285
+ * Get an existing cart by ID
286
+ */
287
+ getCart(cartEntityId?: string): Promise<Cart | null>;
288
+ /**
289
+ * Create a new cart with line items
290
+ */
291
+ createCart(lineItems: CartLineItemInput[]): Promise<Cart | null>;
292
+ /**
293
+ * Add line items to an existing cart
294
+ */
295
+ addCartLineItems(cartEntityId: string, lineItems: CartLineItemInput[]): Promise<Cart | null>;
296
+ /**
297
+ * Update the quantity of a cart line item
298
+ */
299
+ updateCartLineItem(cartEntityId: string, lineItemEntityId: string, quantity: number, _productEntityId: number, _variantEntityId?: number): Promise<Cart | null>;
300
+ /**
301
+ * Remove a line item from the cart
302
+ */
303
+ deleteCartLineItem(cartEntityId: string, lineItemEntityId: string): Promise<Cart | null>;
304
+ /**
305
+ * Delete an entire cart
306
+ */
307
+ deleteCart(cartEntityId: string): Promise<string | null>;
308
+ /**
309
+ * Create a cart or add to existing cart
310
+ * Convenience method that handles both cases
311
+ */
312
+ addToCart(lineItems: CartLineItemInput[], existingCartId?: string): Promise<Cart | null>;
313
+ /**
314
+ * Create single-use redirect URLs for a cart
315
+ */
316
+ createCartRedirectUrls(cartEntityId: string): Promise<CartRedirectUrls | null>;
317
+ /**
318
+ * Get checkout by entity ID
319
+ */
320
+ getCheckout(checkoutEntityId?: string): Promise<Checkout | null>;
321
+ /**
322
+ * Add shipping consignments (addresses) to a checkout
323
+ */
324
+ setCheckoutShippingAddress(checkoutEntityId: string, address: CheckoutAddress, lineItems: CheckoutConsignmentLineItem[]): Promise<Checkout | null>;
325
+ /**
326
+ * Add billing address to a checkout
327
+ */
328
+ setCheckoutBillingAddress(checkoutEntityId: string, address: CheckoutAddress): Promise<Checkout | null>;
329
+ /**
330
+ * Get customer's saved addresses and customer info
331
+ * Always returns empty for mock (simulates logged-out state)
332
+ */
333
+ getCustomerAddresses(): Promise<{
334
+ customerInfo: CustomerInfo | null;
335
+ addresses: CustomerAddress[];
336
+ }>;
337
+ /**
338
+ * Update checkout customer message (order notes)
339
+ */
340
+ updateCheckoutCustomerMessage(checkoutEntityId: string, _message: any): Promise<Checkout | null>;
341
+ /**
342
+ * Create a metafield on a cart (no-op in mock)
343
+ */
344
+ createCartMetafield(_cartEntityId: string, _key: string, _value: string): Promise<void>;
345
+ /**
346
+ * Low-level request method (not implemented in mock)
347
+ */
348
+ request<T = unknown>(_options: unknown): Promise<T>;
349
+ /**
350
+ * Get product paths for building product page URLs
351
+ * Returns a map of productEntityId to path
352
+ */
353
+ getProductPaths(productEntityIds: number[]): Promise<Map<number, string>>;
354
+ /**
355
+ * Get products for display (used by showProducts tool)
356
+ * Returns mock product names, images, prices, and variant information
357
+ */
358
+ getProductsForDisplay(productEntityIds: number[]): Promise<ProductForDisplay[]>;
359
+ /**
360
+ * Get product variant details for multiple products
361
+ * Returns mock product options and variants
362
+ */
363
+ getProductVariantDetails(productEntityIds: number[]): Promise<ProductVariantDetails[]>;
364
+ /**
365
+ * Reset all state (useful for testing)
366
+ */
367
+ reset(): void;
368
+ }
369
+
370
+ declare interface ProductForDisplay {
371
+ entityId: number;
372
+ name: string;
373
+ sku: string;
374
+ path?: string;
375
+ defaultImage?: {
376
+ urlTemplate: string;
377
+ };
378
+ variants: Array<{
379
+ entityId: number;
380
+ sku: string;
381
+ isPurchasable: boolean;
382
+ defaultImage?: {
383
+ urlTemplate: string;
384
+ };
385
+ prices?: {
386
+ price?: {
387
+ value: number;
388
+ currencyCode: string;
389
+ };
390
+ };
391
+ inventory?: {
392
+ isInStock: boolean;
393
+ aggregated?: {
394
+ availableToSell: number;
395
+ warningLevel: number;
396
+ };
397
+ };
398
+ }>;
399
+ }
400
+
401
+ declare interface ProductOption {
402
+ entityId: number;
403
+ displayName: string;
404
+ isRequired: boolean;
405
+ isVariantOption: boolean;
406
+ displayStyle?: string;
407
+ values: ProductOptionValue[];
408
+ }
409
+
410
+ declare interface ProductOptionValue {
411
+ entityId: number;
412
+ label: string;
413
+ isDefault: boolean;
414
+ }
415
+
416
+ declare interface ProductVariant {
417
+ entityId: number;
418
+ sku: string;
419
+ isPurchasable: boolean;
420
+ defaultImage?: {
421
+ urlTemplate: string;
422
+ };
423
+ prices?: {
424
+ price?: {
425
+ value: number;
426
+ currencyCode: string;
427
+ };
428
+ };
429
+ inventory?: {
430
+ isInStock?: boolean;
431
+ aggregated?: {
432
+ availableToSell: number;
433
+ warningLevel: number;
434
+ };
435
+ };
436
+ options: VariantOption[];
437
+ }
438
+
439
+ declare interface ProductVariantDetails {
440
+ entityId: number;
441
+ productOptions: ProductOption[];
442
+ variants: ProductVariant[];
443
+ }
444
+
445
+ declare interface VariantOption {
446
+ entityId: number;
447
+ displayName: string;
448
+ values: VariantOptionValue[];
449
+ }
450
+
451
+ declare interface VariantOptionValue {
452
+ entityId: number;
453
+ label: string;
454
+ }
455
+
456
+ export { }