swell-js 4.1.1 → 4.1.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/dist/api.mjs +1 -1
- package/dist/swell.cjs +1 -1
- package/dist/swell.umd.min.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +69 -23
package/dist/api.mjs
CHANGED
package/dist/swell.cjs
CHANGED
|
@@ -10172,7 +10172,7 @@ const options = {
|
|
|
10172
10172
|
};
|
|
10173
10173
|
|
|
10174
10174
|
const api = {
|
|
10175
|
-
version: '4.1.
|
|
10175
|
+
version: '4.1.2',
|
|
10176
10176
|
options,
|
|
10177
10177
|
request,
|
|
10178
10178
|
|
package/dist/swell.umd.min.js
CHANGED
|
@@ -15609,7 +15609,7 @@
|
|
|
15609
15609
|
};
|
|
15610
15610
|
|
|
15611
15611
|
const api = {
|
|
15612
|
-
version: '4.1.
|
|
15612
|
+
version: '4.1.2',
|
|
15613
15613
|
options,
|
|
15614
15614
|
request,
|
|
15615
15615
|
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
import { Settings } from './settings';
|
|
29
29
|
import { Subscription } from './subscription';
|
|
30
30
|
import { Invoice } from './invoice';
|
|
31
|
-
import { ShipmentRating } from './shipment_rating';
|
|
32
31
|
|
|
33
32
|
export * from './account';
|
|
34
33
|
export * from './attribute';
|
|
@@ -128,6 +127,19 @@ export interface ItemDiscount {
|
|
|
128
127
|
amount?: number;
|
|
129
128
|
}
|
|
130
129
|
|
|
130
|
+
export interface SwellError {
|
|
131
|
+
code: string;
|
|
132
|
+
message: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ServerError {
|
|
136
|
+
error: SwellError;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface ErrorResponse {
|
|
140
|
+
errors: Record<string, SwellError | undefined>;
|
|
141
|
+
}
|
|
142
|
+
|
|
131
143
|
export const version: string;
|
|
132
144
|
|
|
133
145
|
export function init(
|
|
@@ -137,7 +149,7 @@ export function init(
|
|
|
137
149
|
): void;
|
|
138
150
|
|
|
139
151
|
export namespace account {
|
|
140
|
-
export function create(input: Account): Promise<Account>;
|
|
152
|
+
export function create(input: Account): Promise<Account | ErrorResponse>;
|
|
141
153
|
|
|
142
154
|
export function login(
|
|
143
155
|
user: string,
|
|
@@ -145,8 +157,8 @@ export namespace account {
|
|
|
145
157
|
): Promise<Account | null>;
|
|
146
158
|
|
|
147
159
|
export function logout(): Promise<unknown>;
|
|
148
|
-
export function recover(input: object): Promise<Account>;
|
|
149
|
-
export function update(input: Account): Promise<Account>;
|
|
160
|
+
export function recover(input: object): Promise<Account | ErrorResponse>;
|
|
161
|
+
export function update(input: Account): Promise<Account | ErrorResponse>;
|
|
150
162
|
export function get(query?: object): Promise<Account | null>;
|
|
151
163
|
|
|
152
164
|
export function listAddresses(
|
|
@@ -158,16 +170,28 @@ export namespace account {
|
|
|
158
170
|
input?: object,
|
|
159
171
|
): Promise<ResultsResponse<Address>>;
|
|
160
172
|
|
|
161
|
-
export function createAddress(
|
|
162
|
-
|
|
163
|
-
|
|
173
|
+
export function createAddress(
|
|
174
|
+
input: Address,
|
|
175
|
+
): Promise<Address | ErrorResponse>;
|
|
176
|
+
|
|
177
|
+
export function updateAddress(
|
|
178
|
+
id: string,
|
|
179
|
+
input: Address,
|
|
180
|
+
): Promise<Address | ErrorResponse>;
|
|
181
|
+
|
|
182
|
+
export function deleteAddress(id: string): Promise<Address | null>;
|
|
164
183
|
|
|
165
184
|
export function listCards(query?: object): Promise<ResultsResponse<Card>>;
|
|
166
185
|
/** @deprecated use `listCards` instead */
|
|
167
186
|
export function getCards(query?: object): Promise<ResultsResponse<Card>>;
|
|
168
|
-
export function createCard(input: Card): Promise<Card>;
|
|
169
|
-
|
|
170
|
-
export function
|
|
187
|
+
export function createCard(input: Card): Promise<Card | ErrorResponse>;
|
|
188
|
+
|
|
189
|
+
export function updateCard(
|
|
190
|
+
id: string,
|
|
191
|
+
input: Card,
|
|
192
|
+
): Promise<Card | ErrorResponse>;
|
|
193
|
+
|
|
194
|
+
export function deleteCard(id: string): Promise<Card | null>;
|
|
171
195
|
|
|
172
196
|
export function listOrders(query?: object): Promise<ResultsResponse<Order>>;
|
|
173
197
|
/** @deprecated use `listOrders` instead */
|
|
@@ -189,20 +213,26 @@ export namespace card {
|
|
|
189
213
|
|
|
190
214
|
export namespace cart {
|
|
191
215
|
export function get(): Promise<Cart | null>;
|
|
192
|
-
export function update(input: object): Promise<Cart>;
|
|
216
|
+
export function update(input: object): Promise<Cart | null>;
|
|
193
217
|
export function recover(input: string): Promise<Cart>;
|
|
194
218
|
|
|
195
219
|
export function getSettings(): Promise<Settings>;
|
|
196
|
-
export function getShippingRates(): Promise<
|
|
220
|
+
export function getShippingRates(): Promise<Cart>;
|
|
197
221
|
|
|
198
|
-
export function addItem(
|
|
199
|
-
|
|
200
|
-
|
|
222
|
+
export function addItem(
|
|
223
|
+
input: Partial<CartItem>,
|
|
224
|
+
): Promise<Cart | ErrorResponse>;
|
|
225
|
+
|
|
226
|
+
export function setItems(
|
|
227
|
+
input: Partial<CartItem>[],
|
|
228
|
+
): Promise<Cart | ErrorResponse>;
|
|
229
|
+
|
|
230
|
+
export function removeItem(id: string): Promise<Cart | ErrorResponse>;
|
|
201
231
|
|
|
202
232
|
export function updateItem(
|
|
203
233
|
id: string,
|
|
204
234
|
input: Partial<CartItem>,
|
|
205
|
-
): Promise<Cart>;
|
|
235
|
+
): Promise<Cart | ErrorResponse>;
|
|
206
236
|
|
|
207
237
|
export function applyCoupon(code: string): Promise<Cart>;
|
|
208
238
|
export function removeCoupon(): Promise<Cart>;
|
|
@@ -211,7 +241,7 @@ export namespace cart {
|
|
|
211
241
|
export function removeGiftcard(id: string): Promise<Cart>;
|
|
212
242
|
|
|
213
243
|
export function submitOrder(): Promise<Order>;
|
|
214
|
-
export function getOrder(checkoutId?: string): Promise<Order
|
|
244
|
+
export function getOrder(checkoutId?: string): Promise<Order>;
|
|
215
245
|
}
|
|
216
246
|
|
|
217
247
|
export namespace categories {
|
|
@@ -276,7 +306,7 @@ export namespace payment {
|
|
|
276
306
|
klarna?: InputPaymentRedirect;
|
|
277
307
|
}): Promise<void>;
|
|
278
308
|
|
|
279
|
-
export function authenticate(id: string): Promise<object>;
|
|
309
|
+
export function authenticate(id: string): Promise<object | { error: Error }>;
|
|
280
310
|
export function resetAsyncPayment(id: string): Promise<object>;
|
|
281
311
|
|
|
282
312
|
export function createIntent(input: {
|
|
@@ -361,20 +391,36 @@ export namespace settings {
|
|
|
361
391
|
}
|
|
362
392
|
|
|
363
393
|
export namespace subscriptions {
|
|
364
|
-
export function create(input: object): Promise<Subscription>;
|
|
365
|
-
|
|
394
|
+
export function create(input: object): Promise<Subscription | ErrorResponse>;
|
|
395
|
+
|
|
396
|
+
export function update(
|
|
397
|
+
id: string,
|
|
398
|
+
input: object,
|
|
399
|
+
): Promise<Subscription | ErrorResponse>;
|
|
400
|
+
|
|
366
401
|
export function list(query?: object): Promise<ResultsResponse<Subscription>>;
|
|
367
402
|
export function get(id: string, query?: object): Promise<Subscription | null>;
|
|
368
403
|
|
|
369
|
-
export function addItem(
|
|
404
|
+
export function addItem(
|
|
405
|
+
id: string,
|
|
406
|
+
input: object,
|
|
407
|
+
): Promise<Subscription | ErrorResponse>;
|
|
408
|
+
|
|
409
|
+
export function setItems(
|
|
410
|
+
id: string,
|
|
411
|
+
input: object[],
|
|
412
|
+
): Promise<Subscription | ErrorResponse>;
|
|
370
413
|
|
|
371
414
|
export function updateItem(
|
|
372
415
|
id: string,
|
|
373
416
|
itemId: string,
|
|
374
417
|
input: object,
|
|
375
|
-
): Promise<Subscription>;
|
|
418
|
+
): Promise<Subscription | ErrorResponse>;
|
|
376
419
|
|
|
377
|
-
export function removeItem(
|
|
420
|
+
export function removeItem(
|
|
421
|
+
id: string,
|
|
422
|
+
itemId: string,
|
|
423
|
+
): Promise<Subscription | ErrorResponse>;
|
|
378
424
|
}
|
|
379
425
|
|
|
380
426
|
export namespace invoices {
|