@revenexx/sdk 0.0.9 → 0.0.10
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/cjs/sdk.js +291 -29
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +290 -30
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +291 -29
- package/package.json +1 -1
- package/src/client.ts +30 -1
- package/src/enums/order-fulfillment-status.ts +5 -0
- package/src/enums/order-status.ts +7 -0
- package/src/index.ts +3 -1
- package/src/services/carts.ts +1 -1
- package/src/services/inventories.ts +5 -5
- package/src/services/orderlists.ts +2 -2
- package/src/services/orders.ts +23 -21
- package/src/services/prices.ts +3 -3
- package/src/services/search.ts +1 -1
- package/src/services/shipping.ts +1 -1
- package/types/client.d.ts +11 -0
- package/types/enums/order-fulfillment-status.d.ts +5 -0
- package/types/enums/order-status.d.ts +7 -0
- package/types/index.d.ts +3 -1
- package/types/services/orders.d.ts +13 -11
package/dist/iife/sdk.js
CHANGED
|
@@ -4415,7 +4415,7 @@
|
|
|
4415
4415
|
'x-sdk-name': 'Revenexx Web',
|
|
4416
4416
|
'x-sdk-platform': '',
|
|
4417
4417
|
'x-sdk-language': 'web',
|
|
4418
|
-
'x-sdk-version': '0.0.
|
|
4418
|
+
'x-sdk-version': '0.0.10'
|
|
4419
4419
|
};
|
|
4420
4420
|
|
|
4421
4421
|
/**
|
|
@@ -4895,6 +4895,29 @@
|
|
|
4895
4895
|
}
|
|
4896
4896
|
return data;
|
|
4897
4897
|
}
|
|
4898
|
+
|
|
4899
|
+
/**
|
|
4900
|
+
* Recursively renames an argument's DECLARED keys to their snake_case wire
|
|
4901
|
+
* names, using a map generated from the API contract. Free-form subtrees
|
|
4902
|
+
* (metadata / user_data — keys absent from the map, with no `children`) are
|
|
4903
|
+
* passed through untouched, so user data is never mangled. For arrays the
|
|
4904
|
+
* same element map is applied to every item.
|
|
4905
|
+
*/
|
|
4906
|
+
static toWireKeys(value, map) {
|
|
4907
|
+
if (Array.isArray(value)) {
|
|
4908
|
+
return value.map(item => Client.toWireKeys(item, map));
|
|
4909
|
+
}
|
|
4910
|
+
if (value === null || typeof value !== 'object' || value instanceof File || value instanceof Blob || value instanceof Date) {
|
|
4911
|
+
return value;
|
|
4912
|
+
}
|
|
4913
|
+
const output = {};
|
|
4914
|
+
for (const [key, item] of Object.entries(value)) {
|
|
4915
|
+
const entry = map[key];
|
|
4916
|
+
const wireKey = entry ? entry.wire : key;
|
|
4917
|
+
output[wireKey] = entry && entry.children ? Client.toWireKeys(item, entry.children) : item;
|
|
4918
|
+
}
|
|
4919
|
+
return output;
|
|
4920
|
+
}
|
|
4898
4921
|
static flatten(data, prefix = '') {
|
|
4899
4922
|
let output = {};
|
|
4900
4923
|
for (const [key, value] of Object.entries(data)) {
|
|
@@ -8266,7 +8289,20 @@
|
|
|
8266
8289
|
const apiPath = '/v1/carts/{cart_id}/items'.replace('{cart_id}', cartId);
|
|
8267
8290
|
const apiPayload = {};
|
|
8268
8291
|
if (typeof items !== 'undefined') {
|
|
8269
|
-
apiPayload['items'] = items
|
|
8292
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
8293
|
+
"productId": {
|
|
8294
|
+
"wire": "product_id",
|
|
8295
|
+
"children": null
|
|
8296
|
+
},
|
|
8297
|
+
"taxRate": {
|
|
8298
|
+
"wire": "tax_rate",
|
|
8299
|
+
"children": null
|
|
8300
|
+
},
|
|
8301
|
+
"unitPrice": {
|
|
8302
|
+
"wire": "unit_price",
|
|
8303
|
+
"children": null
|
|
8304
|
+
}
|
|
8305
|
+
});
|
|
8270
8306
|
}
|
|
8271
8307
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
8272
8308
|
const apiHeaders = {
|
|
@@ -10555,7 +10591,12 @@
|
|
|
10555
10591
|
const apiPath = '/v1/inventories/adjust';
|
|
10556
10592
|
const apiPayload = {};
|
|
10557
10593
|
if (typeof items !== 'undefined') {
|
|
10558
|
-
apiPayload['items'] = items
|
|
10594
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
10595
|
+
"productId": {
|
|
10596
|
+
"wire": "product_id",
|
|
10597
|
+
"children": null
|
|
10598
|
+
}
|
|
10599
|
+
});
|
|
10559
10600
|
}
|
|
10560
10601
|
if (typeof locationCode !== 'undefined') {
|
|
10561
10602
|
apiPayload['location_code'] = locationCode;
|
|
@@ -10605,7 +10646,12 @@
|
|
|
10605
10646
|
const apiPath = '/v1/inventories/availability';
|
|
10606
10647
|
const apiPayload = {};
|
|
10607
10648
|
if (typeof items !== 'undefined') {
|
|
10608
|
-
apiPayload['items'] = items
|
|
10649
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
10650
|
+
"productId": {
|
|
10651
|
+
"wire": "product_id",
|
|
10652
|
+
"children": null
|
|
10653
|
+
}
|
|
10654
|
+
});
|
|
10609
10655
|
}
|
|
10610
10656
|
if (typeof locationCode !== 'undefined') {
|
|
10611
10657
|
apiPayload['location_code'] = locationCode;
|
|
@@ -11025,7 +11071,12 @@
|
|
|
11025
11071
|
const apiPath = '/v1/inventories/receive';
|
|
11026
11072
|
const apiPayload = {};
|
|
11027
11073
|
if (typeof items !== 'undefined') {
|
|
11028
|
-
apiPayload['items'] = items
|
|
11074
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
11075
|
+
"productId": {
|
|
11076
|
+
"wire": "product_id",
|
|
11077
|
+
"children": null
|
|
11078
|
+
}
|
|
11079
|
+
});
|
|
11029
11080
|
}
|
|
11030
11081
|
if (typeof locationCode !== 'undefined') {
|
|
11031
11082
|
apiPayload['location_code'] = locationCode;
|
|
@@ -11173,7 +11224,12 @@
|
|
|
11173
11224
|
apiPayload['expires_at'] = expiresAt;
|
|
11174
11225
|
}
|
|
11175
11226
|
if (typeof items !== 'undefined') {
|
|
11176
|
-
apiPayload['items'] = items
|
|
11227
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
11228
|
+
"productId": {
|
|
11229
|
+
"wire": "product_id",
|
|
11230
|
+
"children": null
|
|
11231
|
+
}
|
|
11232
|
+
});
|
|
11177
11233
|
}
|
|
11178
11234
|
if (typeof orderRef !== 'undefined') {
|
|
11179
11235
|
apiPayload['order_ref'] = orderRef;
|
|
@@ -11228,7 +11284,12 @@
|
|
|
11228
11284
|
const apiPath = '/v1/inventories/restock';
|
|
11229
11285
|
const apiPayload = {};
|
|
11230
11286
|
if (typeof items !== 'undefined') {
|
|
11231
|
-
apiPayload['items'] = items
|
|
11287
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
11288
|
+
"productId": {
|
|
11289
|
+
"wire": "product_id",
|
|
11290
|
+
"children": null
|
|
11291
|
+
}
|
|
11292
|
+
});
|
|
11232
11293
|
}
|
|
11233
11294
|
if (typeof locationCode !== 'undefined') {
|
|
11234
11295
|
apiPayload['location_code'] = locationCode;
|
|
@@ -15699,7 +15760,36 @@
|
|
|
15699
15760
|
const apiPath = '/v1/orderlists';
|
|
15700
15761
|
const apiPayload = {};
|
|
15701
15762
|
if (typeof items !== 'undefined') {
|
|
15702
|
-
apiPayload['items'] = items
|
|
15763
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
15764
|
+
"categorySlug": {
|
|
15765
|
+
"wire": "category_slug",
|
|
15766
|
+
"children": null
|
|
15767
|
+
},
|
|
15768
|
+
"costCenterId": {
|
|
15769
|
+
"wire": "cost_center_id",
|
|
15770
|
+
"children": null
|
|
15771
|
+
},
|
|
15772
|
+
"customSku": {
|
|
15773
|
+
"wire": "custom_sku",
|
|
15774
|
+
"children": null
|
|
15775
|
+
},
|
|
15776
|
+
"positionTexts": {
|
|
15777
|
+
"wire": "position_texts",
|
|
15778
|
+
"children": null
|
|
15779
|
+
},
|
|
15780
|
+
"productId": {
|
|
15781
|
+
"wire": "product_id",
|
|
15782
|
+
"children": null
|
|
15783
|
+
},
|
|
15784
|
+
"subcategorySlug": {
|
|
15785
|
+
"wire": "subcategory_slug",
|
|
15786
|
+
"children": null
|
|
15787
|
+
},
|
|
15788
|
+
"taxRate": {
|
|
15789
|
+
"wire": "tax_rate",
|
|
15790
|
+
"children": null
|
|
15791
|
+
}
|
|
15792
|
+
});
|
|
15703
15793
|
}
|
|
15704
15794
|
if (typeof kind !== 'undefined') {
|
|
15705
15795
|
apiPayload['kind'] = kind;
|
|
@@ -16095,7 +16185,36 @@
|
|
|
16095
16185
|
const apiPath = '/v1/orderlists/{list_id}/items'.replace('{list_id}', listId);
|
|
16096
16186
|
const apiPayload = {};
|
|
16097
16187
|
if (typeof items !== 'undefined') {
|
|
16098
|
-
apiPayload['items'] = items
|
|
16188
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
16189
|
+
"categorySlug": {
|
|
16190
|
+
"wire": "category_slug",
|
|
16191
|
+
"children": null
|
|
16192
|
+
},
|
|
16193
|
+
"costCenterId": {
|
|
16194
|
+
"wire": "cost_center_id",
|
|
16195
|
+
"children": null
|
|
16196
|
+
},
|
|
16197
|
+
"customSku": {
|
|
16198
|
+
"wire": "custom_sku",
|
|
16199
|
+
"children": null
|
|
16200
|
+
},
|
|
16201
|
+
"positionTexts": {
|
|
16202
|
+
"wire": "position_texts",
|
|
16203
|
+
"children": null
|
|
16204
|
+
},
|
|
16205
|
+
"productId": {
|
|
16206
|
+
"wire": "product_id",
|
|
16207
|
+
"children": null
|
|
16208
|
+
},
|
|
16209
|
+
"subcategorySlug": {
|
|
16210
|
+
"wire": "subcategory_slug",
|
|
16211
|
+
"children": null
|
|
16212
|
+
},
|
|
16213
|
+
"taxRate": {
|
|
16214
|
+
"wire": "tax_rate",
|
|
16215
|
+
"children": null
|
|
16216
|
+
}
|
|
16217
|
+
});
|
|
16099
16218
|
}
|
|
16100
16219
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
16101
16220
|
const apiHeaders = {
|
|
@@ -16346,9 +16465,9 @@
|
|
|
16346
16465
|
|
|
16347
16466
|
/**
|
|
16348
16467
|
*
|
|
16349
|
-
* @param {
|
|
16350
|
-
* @param {
|
|
16351
|
-
* @param {
|
|
16468
|
+
* @param {OrderStatus} params.status - Filter by order status (exact match).
|
|
16469
|
+
* @param {OrderPaymentStatus} params.paymentStatus - Filter by payment status (exact match).
|
|
16470
|
+
* @param {OrderFulfillmentStatus} params.fulfillmentStatus - Filter by fulfillment status (exact match).
|
|
16352
16471
|
* @param {string} params.contactId - Filter to one ordering contact.
|
|
16353
16472
|
* @param {string} params.organizationId - Filter to one B2B organization.
|
|
16354
16473
|
* @param {string} params.channelId - Filter to one sales channel.
|
|
@@ -16363,9 +16482,9 @@
|
|
|
16363
16482
|
|
|
16364
16483
|
/**
|
|
16365
16484
|
*
|
|
16366
|
-
* @param {
|
|
16367
|
-
* @param {
|
|
16368
|
-
* @param {
|
|
16485
|
+
* @param {OrderStatus} status - Filter by order status (exact match).
|
|
16486
|
+
* @param {OrderPaymentStatus} paymentStatus - Filter by payment status (exact match).
|
|
16487
|
+
* @param {OrderFulfillmentStatus} fulfillmentStatus - Filter by fulfillment status (exact match).
|
|
16369
16488
|
* @param {string} contactId - Filter to one ordering contact.
|
|
16370
16489
|
* @param {string} organizationId - Filter to one B2B organization.
|
|
16371
16490
|
* @param {string} channelId - Filter to one sales channel.
|
|
@@ -16381,7 +16500,7 @@
|
|
|
16381
16500
|
|
|
16382
16501
|
ordersList(paramsOrFirst, ...rest) {
|
|
16383
16502
|
let params;
|
|
16384
|
-
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
|
|
16503
|
+
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('status' in paramsOrFirst || 'paymentStatus' in paramsOrFirst || 'fulfillmentStatus' in paramsOrFirst || 'contactId' in paramsOrFirst || 'organizationId' in paramsOrFirst || 'channelId' in paramsOrFirst || 'marketId' in paramsOrFirst || 'number' in paramsOrFirst || 'limit' in paramsOrFirst || 'offset' in paramsOrFirst || 'order' in paramsOrFirst)) {
|
|
16385
16504
|
params = paramsOrFirst || {};
|
|
16386
16505
|
} else {
|
|
16387
16506
|
params = {
|
|
@@ -16860,7 +16979,36 @@
|
|
|
16860
16979
|
apiPayload['grand_total'] = grandTotal;
|
|
16861
16980
|
}
|
|
16862
16981
|
if (typeof items !== 'undefined') {
|
|
16863
|
-
apiPayload['items'] = items
|
|
16982
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
16983
|
+
"costCenter": {
|
|
16984
|
+
"wire": "cost_center",
|
|
16985
|
+
"children": null
|
|
16986
|
+
},
|
|
16987
|
+
"positionText": {
|
|
16988
|
+
"wire": "position_text",
|
|
16989
|
+
"children": null
|
|
16990
|
+
},
|
|
16991
|
+
"productId": {
|
|
16992
|
+
"wire": "product_id",
|
|
16993
|
+
"children": null
|
|
16994
|
+
},
|
|
16995
|
+
"taxAmount": {
|
|
16996
|
+
"wire": "tax_amount",
|
|
16997
|
+
"children": null
|
|
16998
|
+
},
|
|
16999
|
+
"taxRate": {
|
|
17000
|
+
"wire": "tax_rate",
|
|
17001
|
+
"children": null
|
|
17002
|
+
},
|
|
17003
|
+
"unitPrice": {
|
|
17004
|
+
"wire": "unit_price",
|
|
17005
|
+
"children": null
|
|
17006
|
+
},
|
|
17007
|
+
"userData": {
|
|
17008
|
+
"wire": "user_data",
|
|
17009
|
+
"children": null
|
|
17010
|
+
}
|
|
17011
|
+
});
|
|
16864
17012
|
}
|
|
16865
17013
|
if (typeof marketId !== 'undefined') {
|
|
16866
17014
|
apiPayload['market_id'] = marketId;
|
|
@@ -17326,7 +17474,12 @@
|
|
|
17326
17474
|
apiPayload['cancelled_by'] = cancelledBy;
|
|
17327
17475
|
}
|
|
17328
17476
|
if (typeof positions !== 'undefined') {
|
|
17329
|
-
apiPayload['positions'] = positions
|
|
17477
|
+
apiPayload['positions'] = Client.toWireKeys(positions, {
|
|
17478
|
+
"orderItemId": {
|
|
17479
|
+
"wire": "order_item_id",
|
|
17480
|
+
"children": null
|
|
17481
|
+
}
|
|
17482
|
+
});
|
|
17330
17483
|
}
|
|
17331
17484
|
if (typeof reason !== 'undefined') {
|
|
17332
17485
|
apiPayload['reason'] = reason;
|
|
@@ -17441,7 +17594,12 @@
|
|
|
17441
17594
|
apiPayload['metadata'] = metadata;
|
|
17442
17595
|
}
|
|
17443
17596
|
if (typeof positions !== 'undefined') {
|
|
17444
|
-
apiPayload['positions'] = positions
|
|
17597
|
+
apiPayload['positions'] = Client.toWireKeys(positions, {
|
|
17598
|
+
"orderItemId": {
|
|
17599
|
+
"wire": "order_item_id",
|
|
17600
|
+
"children": null
|
|
17601
|
+
}
|
|
17602
|
+
});
|
|
17445
17603
|
}
|
|
17446
17604
|
if (typeof reason !== 'undefined') {
|
|
17447
17605
|
apiPayload['reason'] = reason;
|
|
@@ -17684,7 +17842,12 @@
|
|
|
17684
17842
|
apiPayload['number'] = number;
|
|
17685
17843
|
}
|
|
17686
17844
|
if (typeof positions !== 'undefined') {
|
|
17687
|
-
apiPayload['positions'] = positions
|
|
17845
|
+
apiPayload['positions'] = Client.toWireKeys(positions, {
|
|
17846
|
+
"orderItemId": {
|
|
17847
|
+
"wire": "order_item_id",
|
|
17848
|
+
"children": null
|
|
17849
|
+
}
|
|
17850
|
+
});
|
|
17688
17851
|
}
|
|
17689
17852
|
if (typeof shippedAt !== 'undefined') {
|
|
17690
17853
|
apiPayload['shipped_at'] = shippedAt;
|
|
@@ -21327,7 +21490,32 @@
|
|
|
21327
21490
|
const apiPath = '/v1/prices/lists/{list_id}/entries'.replace('{list_id}', listId);
|
|
21328
21491
|
const apiPayload = {};
|
|
21329
21492
|
if (typeof entries !== 'undefined') {
|
|
21330
|
-
apiPayload['entries'] = entries
|
|
21493
|
+
apiPayload['entries'] = Client.toWireKeys(entries, {
|
|
21494
|
+
"priceType": {
|
|
21495
|
+
"wire": "price_type",
|
|
21496
|
+
"children": null
|
|
21497
|
+
},
|
|
21498
|
+
"productId": {
|
|
21499
|
+
"wire": "product_id",
|
|
21500
|
+
"children": null
|
|
21501
|
+
},
|
|
21502
|
+
"quantityMin": {
|
|
21503
|
+
"wire": "quantity_min",
|
|
21504
|
+
"children": null
|
|
21505
|
+
},
|
|
21506
|
+
"unitPrice": {
|
|
21507
|
+
"wire": "unit_price",
|
|
21508
|
+
"children": null
|
|
21509
|
+
},
|
|
21510
|
+
"validFrom": {
|
|
21511
|
+
"wire": "valid_from",
|
|
21512
|
+
"children": null
|
|
21513
|
+
},
|
|
21514
|
+
"validUntil": {
|
|
21515
|
+
"wire": "valid_until",
|
|
21516
|
+
"children": null
|
|
21517
|
+
}
|
|
21518
|
+
});
|
|
21331
21519
|
}
|
|
21332
21520
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
21333
21521
|
const apiHeaders = {
|
|
@@ -21374,7 +21562,32 @@
|
|
|
21374
21562
|
const apiPath = '/v1/prices/lists/{list_id}/entries/bulk'.replace('{list_id}', listId);
|
|
21375
21563
|
const apiPayload = {};
|
|
21376
21564
|
if (typeof entries !== 'undefined') {
|
|
21377
|
-
apiPayload['entries'] = entries
|
|
21565
|
+
apiPayload['entries'] = Client.toWireKeys(entries, {
|
|
21566
|
+
"priceType": {
|
|
21567
|
+
"wire": "price_type",
|
|
21568
|
+
"children": null
|
|
21569
|
+
},
|
|
21570
|
+
"productId": {
|
|
21571
|
+
"wire": "product_id",
|
|
21572
|
+
"children": null
|
|
21573
|
+
},
|
|
21574
|
+
"quantityMin": {
|
|
21575
|
+
"wire": "quantity_min",
|
|
21576
|
+
"children": null
|
|
21577
|
+
},
|
|
21578
|
+
"unitPrice": {
|
|
21579
|
+
"wire": "unit_price",
|
|
21580
|
+
"children": null
|
|
21581
|
+
},
|
|
21582
|
+
"validFrom": {
|
|
21583
|
+
"wire": "valid_from",
|
|
21584
|
+
"children": null
|
|
21585
|
+
},
|
|
21586
|
+
"validUntil": {
|
|
21587
|
+
"wire": "valid_until",
|
|
21588
|
+
"children": null
|
|
21589
|
+
}
|
|
21590
|
+
});
|
|
21378
21591
|
}
|
|
21379
21592
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
21380
21593
|
const apiHeaders = {
|
|
@@ -21641,7 +21854,12 @@
|
|
|
21641
21854
|
apiPayload['currency'] = currency;
|
|
21642
21855
|
}
|
|
21643
21856
|
if (typeof items !== 'undefined') {
|
|
21644
|
-
apiPayload['items'] = items
|
|
21857
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
21858
|
+
"productId": {
|
|
21859
|
+
"wire": "product_id",
|
|
21860
|
+
"children": null
|
|
21861
|
+
}
|
|
21862
|
+
});
|
|
21645
21863
|
}
|
|
21646
21864
|
if (typeof marketId !== 'undefined') {
|
|
21647
21865
|
apiPayload['market_id'] = marketId;
|
|
@@ -25598,7 +25816,28 @@
|
|
|
25598
25816
|
const apiPath = '/v1/search/multi_search';
|
|
25599
25817
|
const apiPayload = {};
|
|
25600
25818
|
if (typeof searches !== 'undefined') {
|
|
25601
|
-
apiPayload['searches'] = searches
|
|
25819
|
+
apiPayload['searches'] = Client.toWireKeys(searches, {
|
|
25820
|
+
"facetBy": {
|
|
25821
|
+
"wire": "facet_by",
|
|
25822
|
+
"children": null
|
|
25823
|
+
},
|
|
25824
|
+
"filterBy": {
|
|
25825
|
+
"wire": "filter_by",
|
|
25826
|
+
"children": null
|
|
25827
|
+
},
|
|
25828
|
+
"perPage": {
|
|
25829
|
+
"wire": "per_page",
|
|
25830
|
+
"children": null
|
|
25831
|
+
},
|
|
25832
|
+
"queryBy": {
|
|
25833
|
+
"wire": "query_by",
|
|
25834
|
+
"children": null
|
|
25835
|
+
},
|
|
25836
|
+
"sortBy": {
|
|
25837
|
+
"wire": "sort_by",
|
|
25838
|
+
"children": null
|
|
25839
|
+
}
|
|
25840
|
+
});
|
|
25602
25841
|
}
|
|
25603
25842
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
25604
25843
|
const apiHeaders = {
|
|
@@ -26152,7 +26391,12 @@
|
|
|
26152
26391
|
const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{method_id}', methodId);
|
|
26153
26392
|
const apiPayload = {};
|
|
26154
26393
|
if (typeof tiers !== 'undefined') {
|
|
26155
|
-
apiPayload['tiers'] = tiers
|
|
26394
|
+
apiPayload['tiers'] = Client.toWireKeys(tiers, {
|
|
26395
|
+
"fromValue": {
|
|
26396
|
+
"wire": "from_value",
|
|
26397
|
+
"children": null
|
|
26398
|
+
}
|
|
26399
|
+
});
|
|
26156
26400
|
}
|
|
26157
26401
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
26158
26402
|
const apiHeaders = {
|
|
@@ -31033,10 +31277,13 @@
|
|
|
31033
31277
|
return OrderListKind;
|
|
31034
31278
|
}({});
|
|
31035
31279
|
|
|
31036
|
-
let
|
|
31037
|
-
|
|
31038
|
-
|
|
31039
|
-
|
|
31280
|
+
let OrderStatus = /*#__PURE__*/function (OrderStatus) {
|
|
31281
|
+
OrderStatus["Pending"] = "pending";
|
|
31282
|
+
OrderStatus["Placed"] = "placed";
|
|
31283
|
+
OrderStatus["InFulfillment"] = "in_fulfillment";
|
|
31284
|
+
OrderStatus["Completed"] = "completed";
|
|
31285
|
+
OrderStatus["Cancelled"] = "cancelled";
|
|
31286
|
+
return OrderStatus;
|
|
31040
31287
|
}({});
|
|
31041
31288
|
|
|
31042
31289
|
let OrderPaymentStatus = /*#__PURE__*/function (OrderPaymentStatus) {
|
|
@@ -31050,6 +31297,19 @@
|
|
|
31050
31297
|
return OrderPaymentStatus;
|
|
31051
31298
|
}({});
|
|
31052
31299
|
|
|
31300
|
+
let OrderFulfillmentStatus = /*#__PURE__*/function (OrderFulfillmentStatus) {
|
|
31301
|
+
OrderFulfillmentStatus["Unfulfilled"] = "unfulfilled";
|
|
31302
|
+
OrderFulfillmentStatus["Partial"] = "partial";
|
|
31303
|
+
OrderFulfillmentStatus["Fulfilled"] = "fulfilled";
|
|
31304
|
+
return OrderFulfillmentStatus;
|
|
31305
|
+
}({});
|
|
31306
|
+
|
|
31307
|
+
let OrderCommentVisibility = /*#__PURE__*/function (OrderCommentVisibility) {
|
|
31308
|
+
OrderCommentVisibility["Internal"] = "internal";
|
|
31309
|
+
OrderCommentVisibility["Customer"] = "customer";
|
|
31310
|
+
return OrderCommentVisibility;
|
|
31311
|
+
}({});
|
|
31312
|
+
|
|
31053
31313
|
let PageStatus = /*#__PURE__*/function (PageStatus) {
|
|
31054
31314
|
PageStatus["Draft"] = "draft";
|
|
31055
31315
|
PageStatus["Published"] = "published";
|
|
@@ -31668,9 +31928,11 @@
|
|
|
31668
31928
|
exports.Method = Method;
|
|
31669
31929
|
exports.Operator = Operator;
|
|
31670
31930
|
exports.OrderCommentVisibility = OrderCommentVisibility;
|
|
31931
|
+
exports.OrderFulfillmentStatus = OrderFulfillmentStatus;
|
|
31671
31932
|
exports.OrderItemType = OrderItemType;
|
|
31672
31933
|
exports.OrderListKind = OrderListKind;
|
|
31673
31934
|
exports.OrderPaymentStatus = OrderPaymentStatus;
|
|
31935
|
+
exports.OrderStatus = OrderStatus;
|
|
31674
31936
|
exports.Orderlists = Orderlists;
|
|
31675
31937
|
exports.Orders = Orders;
|
|
31676
31938
|
exports.OrganizationStatus = OrganizationStatus;
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -388,7 +388,7 @@ class Client {
|
|
|
388
388
|
'x-sdk-name': 'Revenexx Web',
|
|
389
389
|
'x-sdk-platform': '',
|
|
390
390
|
'x-sdk-language': 'web',
|
|
391
|
-
'x-sdk-version': '0.0.
|
|
391
|
+
'x-sdk-version': '0.0.10',
|
|
392
392
|
};
|
|
393
393
|
|
|
394
394
|
/**
|
|
@@ -927,6 +927,35 @@ class Client {
|
|
|
927
927
|
return data;
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
+
/**
|
|
931
|
+
* Recursively renames an argument's DECLARED keys to their snake_case wire
|
|
932
|
+
* names, using a map generated from the API contract. Free-form subtrees
|
|
933
|
+
* (metadata / user_data — keys absent from the map, with no `children`) are
|
|
934
|
+
* passed through untouched, so user data is never mangled. For arrays the
|
|
935
|
+
* same element map is applied to every item.
|
|
936
|
+
*/
|
|
937
|
+
static toWireKeys(value: any, map: Record<string, { wire: string, children: any }>): any {
|
|
938
|
+
if (Array.isArray(value)) {
|
|
939
|
+
return value.map((item) => Client.toWireKeys(item, map));
|
|
940
|
+
}
|
|
941
|
+
if (
|
|
942
|
+
value === null
|
|
943
|
+
|| typeof value !== 'object'
|
|
944
|
+
|| value instanceof File
|
|
945
|
+
|| value instanceof Blob
|
|
946
|
+
|| value instanceof Date
|
|
947
|
+
) {
|
|
948
|
+
return value;
|
|
949
|
+
}
|
|
950
|
+
const output: Record<string, any> = {};
|
|
951
|
+
for (const [key, item] of Object.entries(value)) {
|
|
952
|
+
const entry = map[key];
|
|
953
|
+
const wireKey = entry ? entry.wire : key;
|
|
954
|
+
output[wireKey] = (entry && entry.children) ? Client.toWireKeys(item, entry.children) : item;
|
|
955
|
+
}
|
|
956
|
+
return output;
|
|
957
|
+
}
|
|
958
|
+
|
|
930
959
|
static flatten(data: Payload, prefix = ''): Payload {
|
|
931
960
|
let output: Payload = {};
|
|
932
961
|
|
package/src/index.ts
CHANGED
|
@@ -64,8 +64,10 @@ export { LocationType } from './enums/location-type';
|
|
|
64
64
|
export { MarketStatus } from './enums/market-status';
|
|
65
65
|
export { Priority } from './enums/priority';
|
|
66
66
|
export { OrderListKind } from './enums/order-list-kind';
|
|
67
|
-
export {
|
|
67
|
+
export { OrderStatus } from './enums/order-status';
|
|
68
68
|
export { OrderPaymentStatus } from './enums/order-payment-status';
|
|
69
|
+
export { OrderFulfillmentStatus } from './enums/order-fulfillment-status';
|
|
70
|
+
export { OrderCommentVisibility } from './enums/order-comment-visibility';
|
|
69
71
|
export { PageStatus } from './enums/page-status';
|
|
70
72
|
export { PaymentFeeType } from './enums/payment-fee-type';
|
|
71
73
|
export { PaymentMethodKind } from './enums/payment-method-kind';
|
package/src/services/carts.ts
CHANGED
|
@@ -957,7 +957,7 @@ export class Carts {
|
|
|
957
957
|
const apiPath = '/v1/carts/{cart_id}/items'.replace('{cart_id}', cartId);
|
|
958
958
|
const apiPayload: Payload = {};
|
|
959
959
|
if (typeof items !== 'undefined') {
|
|
960
|
-
apiPayload['items'] = items;
|
|
960
|
+
apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null},"taxRate":{"wire":"tax_rate","children":null},"unitPrice":{"wire":"unit_price","children":null}});
|
|
961
961
|
}
|
|
962
962
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
963
963
|
|
|
@@ -60,7 +60,7 @@ export class Inventories {
|
|
|
60
60
|
const apiPath = '/v1/inventories/adjust';
|
|
61
61
|
const apiPayload: Payload = {};
|
|
62
62
|
if (typeof items !== 'undefined') {
|
|
63
|
-
apiPayload['items'] = items;
|
|
63
|
+
apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
|
|
64
64
|
}
|
|
65
65
|
if (typeof locationCode !== 'undefined') {
|
|
66
66
|
apiPayload['location_code'] = locationCode;
|
|
@@ -124,7 +124,7 @@ export class Inventories {
|
|
|
124
124
|
const apiPath = '/v1/inventories/availability';
|
|
125
125
|
const apiPayload: Payload = {};
|
|
126
126
|
if (typeof items !== 'undefined') {
|
|
127
|
-
apiPayload['items'] = items;
|
|
127
|
+
apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
|
|
128
128
|
}
|
|
129
129
|
if (typeof locationCode !== 'undefined') {
|
|
130
130
|
apiPayload['location_code'] = locationCode;
|
|
@@ -668,7 +668,7 @@ export class Inventories {
|
|
|
668
668
|
const apiPath = '/v1/inventories/receive';
|
|
669
669
|
const apiPayload: Payload = {};
|
|
670
670
|
if (typeof items !== 'undefined') {
|
|
671
|
-
apiPayload['items'] = items;
|
|
671
|
+
apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
|
|
672
672
|
}
|
|
673
673
|
if (typeof locationCode !== 'undefined') {
|
|
674
674
|
apiPayload['location_code'] = locationCode;
|
|
@@ -866,7 +866,7 @@ export class Inventories {
|
|
|
866
866
|
apiPayload['expires_at'] = expiresAt;
|
|
867
867
|
}
|
|
868
868
|
if (typeof items !== 'undefined') {
|
|
869
|
-
apiPayload['items'] = items;
|
|
869
|
+
apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
|
|
870
870
|
}
|
|
871
871
|
if (typeof orderRef !== 'undefined') {
|
|
872
872
|
apiPayload['order_ref'] = orderRef;
|
|
@@ -935,7 +935,7 @@ export class Inventories {
|
|
|
935
935
|
const apiPath = '/v1/inventories/restock';
|
|
936
936
|
const apiPayload: Payload = {};
|
|
937
937
|
if (typeof items !== 'undefined') {
|
|
938
|
-
apiPayload['items'] = items;
|
|
938
|
+
apiPayload['items'] = Client.toWireKeys(items, {"productId":{"wire":"product_id","children":null}});
|
|
939
939
|
}
|
|
940
940
|
if (typeof locationCode !== 'undefined') {
|
|
941
941
|
apiPayload['location_code'] = locationCode;
|
|
@@ -105,7 +105,7 @@ export class Orderlists {
|
|
|
105
105
|
const apiPath = '/v1/orderlists';
|
|
106
106
|
const apiPayload: Payload = {};
|
|
107
107
|
if (typeof items !== 'undefined') {
|
|
108
|
-
apiPayload['items'] = items;
|
|
108
|
+
apiPayload['items'] = Client.toWireKeys(items, {"categorySlug":{"wire":"category_slug","children":null},"costCenterId":{"wire":"cost_center_id","children":null},"customSku":{"wire":"custom_sku","children":null},"positionTexts":{"wire":"position_texts","children":null},"productId":{"wire":"product_id","children":null},"subcategorySlug":{"wire":"subcategory_slug","children":null},"taxRate":{"wire":"tax_rate","children":null}});
|
|
109
109
|
}
|
|
110
110
|
if (typeof kind !== 'undefined') {
|
|
111
111
|
apiPayload['kind'] = kind;
|
|
@@ -594,7 +594,7 @@ export class Orderlists {
|
|
|
594
594
|
const apiPath = '/v1/orderlists/{list_id}/items'.replace('{list_id}', listId);
|
|
595
595
|
const apiPayload: Payload = {};
|
|
596
596
|
if (typeof items !== 'undefined') {
|
|
597
|
-
apiPayload['items'] = items;
|
|
597
|
+
apiPayload['items'] = Client.toWireKeys(items, {"categorySlug":{"wire":"category_slug","children":null},"costCenterId":{"wire":"cost_center_id","children":null},"customSku":{"wire":"custom_sku","children":null},"positionTexts":{"wire":"position_texts","children":null},"productId":{"wire":"product_id","children":null},"subcategorySlug":{"wire":"subcategory_slug","children":null},"taxRate":{"wire":"tax_rate","children":null}});
|
|
598
598
|
}
|
|
599
599
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
600
600
|
|