@reponseai/sdk 0.2.0

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 ADDED
@@ -0,0 +1,158 @@
1
+ # @reponse/sdk
2
+
3
+ Official TypeScript SDK for the [Reponse](https://reponse.ai) Headless Commerce API.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @reponse/sdk
9
+ # or
10
+ pnpm add @reponse/sdk
11
+ # or
12
+ yarn add @reponse/sdk
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```typescript
18
+ import { Reponse } from '@reponse/sdk';
19
+
20
+ const reponse = new Reponse({
21
+ apiKey: 'your-api-key',
22
+ baseUrl: 'https://your-store.reponse.ai',
23
+ });
24
+ ```
25
+
26
+ ## Catalog
27
+
28
+ ```typescript
29
+ // List all products
30
+ const { data } = await reponse.catalog.listProducts();
31
+
32
+ // Search products
33
+ const { data } = await reponse.catalog.listProducts({
34
+ query: { query: 't-shirt', limit: 10 }
35
+ });
36
+
37
+ // Get by slug
38
+ const { data } = await reponse.catalog.listProducts({
39
+ query: { slug: 't-shirt-logo' }
40
+ });
41
+
42
+ // Get single product with variants
43
+ const { data: product } = await reponse.catalog.getProduct({
44
+ path: { id: 'product-uuid' }
45
+ });
46
+
47
+ console.log(product.variants); // [{ title: 'S / Red', price: 29.99, sku: '...' }]
48
+
49
+ // List collections
50
+ const { data } = await reponse.catalog.listCollections();
51
+ ```
52
+
53
+ ## Cart & Checkout
54
+
55
+ ```typescript
56
+ // Create a cart
57
+ const { data: cart } = await reponse.cart.create({
58
+ body: {
59
+ items: [{ product_id: 'uuid', variant_id: 'uuid', quantity: 1 }],
60
+ currency: 'EUR'
61
+ }
62
+ });
63
+
64
+ // Get cart (includes automatic discount calculation)
65
+ const { data: cart } = await reponse.cart.get({
66
+ path: { id: cart.id }
67
+ });
68
+
69
+ // Add items
70
+ await reponse.cart.addItem({
71
+ path: { id: cart.id },
72
+ body: { items: [{ product_id: 'uuid', variant_id: 'uuid', quantity: 2 }] }
73
+ });
74
+
75
+ // Update quantity
76
+ await reponse.cart.updateItem({
77
+ path: { id: cart.id, lineId: 'line-uuid' },
78
+ body: { quantity: 3 }
79
+ });
80
+
81
+ // Remove item
82
+ await reponse.cart.removeItem({
83
+ path: { id: cart.id, lineId: 'line-uuid' }
84
+ });
85
+
86
+ // Checkout via Stripe
87
+ const { data: checkout } = await reponse.cart.createCheckout({
88
+ body: {
89
+ cart_id: cart.id,
90
+ success_url: 'https://mystore.com/success',
91
+ cancel_url: 'https://mystore.com/cart'
92
+ }
93
+ });
94
+
95
+ // Redirect to checkout.url
96
+ window.location.href = checkout.url;
97
+ ```
98
+
99
+ ## Orders
100
+
101
+ ```typescript
102
+ // Update shipping address
103
+ await reponse.orders.updateShippingAddress({
104
+ path: { orderId: 'order-uuid' },
105
+ body: {
106
+ shipping_address: {
107
+ address1: '123 Main St',
108
+ city: 'Paris',
109
+ zip: '75001',
110
+ country: 'FR'
111
+ }
112
+ }
113
+ });
114
+
115
+ // Resend confirmation email
116
+ await reponse.orders.resendConfirmation({
117
+ path: { orderId: 'order-uuid' }
118
+ });
119
+
120
+ // Resend invoice PDF
121
+ await reponse.orders.resendInvoice({
122
+ path: { orderId: 'order-uuid' }
123
+ });
124
+
125
+ // Cancel order with refund
126
+ await reponse.orders.cancel({
127
+ path: { orderId: 'order-uuid' },
128
+ body: { reason: 'customer_changed_mind' }
129
+ });
130
+ ```
131
+
132
+ ## Features
133
+
134
+ - 🛒 **Full Cart CRUD** — Create, read, add items, update quantities, remove items
135
+ - 🏷️ **Product Variants** — Options, SKUs, compare-at pricing, inventory
136
+ - 🔍 **SEO-ready** — Slug-based routing, SEO title/description
137
+ - 💰 **Multi-discount Engine** — Automatic discounts, codes, BXGY, free shipping
138
+ - 🤖 **AI-native** — Built-in conversational support widget
139
+ - 📦 **Order Management** — Shipping updates, cancellations, invoices
140
+ - 🔄 **Shopify Migration** — One-click import of products, customers, orders
141
+
142
+ ## TypeScript
143
+
144
+ The SDK is fully typed. All request/response types are exported:
145
+
146
+ ```typescript
147
+ import type { Product, ProductVariant, Cart } from '@reponse/sdk';
148
+ ```
149
+
150
+ ## Links
151
+
152
+ - [API Documentation](https://reponse.ai/openapi.yaml)
153
+ - [Next.js Starter](https://github.com/supernebuleux/Reponse/tree/main/starters/nextjs-storefront)
154
+ - [MCP Server](https://github.com/supernebuleux/Reponse/tree/main/mcp-server)
155
+
156
+ ## License
157
+
158
+ MIT