@revenexx/sdk 0.0.7 → 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 +377 -23
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +376 -24
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +377 -23
- package/package.json +1 -1
- package/src/client.ts +30 -1
- package/src/enums/fulfillment-status.ts +5 -0
- package/src/enums/order-fulfillment-status.ts +5 -0
- package/src/enums/order-status.ts +7 -0
- package/src/enums/payment-status.ts +9 -0
- package/src/enums/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 +106 -6
- 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/fulfillment-status.d.ts +5 -0
- package/types/enums/order-fulfillment-status.d.ts +5 -0
- package/types/enums/order-status.d.ts +7 -0
- package/types/enums/payment-status.d.ts +9 -0
- package/types/enums/status.d.ts +7 -0
- package/types/index.d.ts +3 -1
- package/types/services/orders.d.ts +45 -2
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,12 +16465,104 @@
|
|
|
16346
16465
|
|
|
16347
16466
|
/**
|
|
16348
16467
|
*
|
|
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).
|
|
16471
|
+
* @param {string} params.contactId - Filter to one ordering contact.
|
|
16472
|
+
* @param {string} params.organizationId - Filter to one B2B organization.
|
|
16473
|
+
* @param {string} params.channelId - Filter to one sales channel.
|
|
16474
|
+
* @param {string} params.marketId - Filter to one market.
|
|
16475
|
+
* @param {string} params.number - Filter by exact order number.
|
|
16476
|
+
* @param {number} params.limit - Page size (default 50, max 200).
|
|
16477
|
+
* @param {number} params.offset - Row offset for pagination (default 0).
|
|
16478
|
+
* @param {string} params.order - Sort as 'column.asc' | 'column.desc', e.g. 'created_at.desc'.
|
|
16479
|
+
* @throws {RevenexxException}
|
|
16480
|
+
* @returns {Promise<{}>}
|
|
16481
|
+
*/
|
|
16482
|
+
|
|
16483
|
+
/**
|
|
16484
|
+
*
|
|
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).
|
|
16488
|
+
* @param {string} contactId - Filter to one ordering contact.
|
|
16489
|
+
* @param {string} organizationId - Filter to one B2B organization.
|
|
16490
|
+
* @param {string} channelId - Filter to one sales channel.
|
|
16491
|
+
* @param {string} marketId - Filter to one market.
|
|
16492
|
+
* @param {string} number - Filter by exact order number.
|
|
16493
|
+
* @param {number} limit - Page size (default 50, max 200).
|
|
16494
|
+
* @param {number} offset - Row offset for pagination (default 0).
|
|
16495
|
+
* @param {string} order - Sort as 'column.asc' | 'column.desc', e.g. 'created_at.desc'.
|
|
16349
16496
|
* @throws {RevenexxException}
|
|
16350
16497
|
* @returns {Promise<{}>}
|
|
16498
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
16351
16499
|
*/
|
|
16352
|
-
|
|
16500
|
+
|
|
16501
|
+
ordersList(paramsOrFirst, ...rest) {
|
|
16502
|
+
let params;
|
|
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)) {
|
|
16504
|
+
params = paramsOrFirst || {};
|
|
16505
|
+
} else {
|
|
16506
|
+
params = {
|
|
16507
|
+
status: paramsOrFirst,
|
|
16508
|
+
paymentStatus: rest[0],
|
|
16509
|
+
fulfillmentStatus: rest[1],
|
|
16510
|
+
contactId: rest[2],
|
|
16511
|
+
organizationId: rest[3],
|
|
16512
|
+
channelId: rest[4],
|
|
16513
|
+
marketId: rest[5],
|
|
16514
|
+
number: rest[6],
|
|
16515
|
+
limit: rest[7],
|
|
16516
|
+
offset: rest[8],
|
|
16517
|
+
order: rest[9]
|
|
16518
|
+
};
|
|
16519
|
+
}
|
|
16520
|
+
const status = params.status;
|
|
16521
|
+
const paymentStatus = params.paymentStatus;
|
|
16522
|
+
const fulfillmentStatus = params.fulfillmentStatus;
|
|
16523
|
+
const contactId = params.contactId;
|
|
16524
|
+
const organizationId = params.organizationId;
|
|
16525
|
+
const channelId = params.channelId;
|
|
16526
|
+
const marketId = params.marketId;
|
|
16527
|
+
const number = params.number;
|
|
16528
|
+
const limit = params.limit;
|
|
16529
|
+
const offset = params.offset;
|
|
16530
|
+
const order = params.order;
|
|
16353
16531
|
const apiPath = '/v1/orders';
|
|
16354
16532
|
const apiPayload = {};
|
|
16533
|
+
if (typeof status !== 'undefined') {
|
|
16534
|
+
apiPayload['status'] = status;
|
|
16535
|
+
}
|
|
16536
|
+
if (typeof paymentStatus !== 'undefined') {
|
|
16537
|
+
apiPayload['payment_status'] = paymentStatus;
|
|
16538
|
+
}
|
|
16539
|
+
if (typeof fulfillmentStatus !== 'undefined') {
|
|
16540
|
+
apiPayload['fulfillment_status'] = fulfillmentStatus;
|
|
16541
|
+
}
|
|
16542
|
+
if (typeof contactId !== 'undefined') {
|
|
16543
|
+
apiPayload['contact_id'] = contactId;
|
|
16544
|
+
}
|
|
16545
|
+
if (typeof organizationId !== 'undefined') {
|
|
16546
|
+
apiPayload['organization_id'] = organizationId;
|
|
16547
|
+
}
|
|
16548
|
+
if (typeof channelId !== 'undefined') {
|
|
16549
|
+
apiPayload['channel_id'] = channelId;
|
|
16550
|
+
}
|
|
16551
|
+
if (typeof marketId !== 'undefined') {
|
|
16552
|
+
apiPayload['market_id'] = marketId;
|
|
16553
|
+
}
|
|
16554
|
+
if (typeof number !== 'undefined') {
|
|
16555
|
+
apiPayload['number'] = number;
|
|
16556
|
+
}
|
|
16557
|
+
if (typeof limit !== 'undefined') {
|
|
16558
|
+
apiPayload['limit'] = limit;
|
|
16559
|
+
}
|
|
16560
|
+
if (typeof offset !== 'undefined') {
|
|
16561
|
+
apiPayload['offset'] = offset;
|
|
16562
|
+
}
|
|
16563
|
+
if (typeof order !== 'undefined') {
|
|
16564
|
+
apiPayload['order'] = order;
|
|
16565
|
+
}
|
|
16355
16566
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
16356
16567
|
const apiHeaders = {};
|
|
16357
16568
|
return this.client.call('get', uri, apiHeaders, apiPayload);
|
|
@@ -16768,7 +16979,36 @@
|
|
|
16768
16979
|
apiPayload['grand_total'] = grandTotal;
|
|
16769
16980
|
}
|
|
16770
16981
|
if (typeof items !== 'undefined') {
|
|
16771
|
-
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
|
+
});
|
|
16772
17012
|
}
|
|
16773
17013
|
if (typeof marketId !== 'undefined') {
|
|
16774
17014
|
apiPayload['market_id'] = marketId;
|
|
@@ -17234,7 +17474,12 @@
|
|
|
17234
17474
|
apiPayload['cancelled_by'] = cancelledBy;
|
|
17235
17475
|
}
|
|
17236
17476
|
if (typeof positions !== 'undefined') {
|
|
17237
|
-
apiPayload['positions'] = positions
|
|
17477
|
+
apiPayload['positions'] = Client.toWireKeys(positions, {
|
|
17478
|
+
"orderItemId": {
|
|
17479
|
+
"wire": "order_item_id",
|
|
17480
|
+
"children": null
|
|
17481
|
+
}
|
|
17482
|
+
});
|
|
17238
17483
|
}
|
|
17239
17484
|
if (typeof reason !== 'undefined') {
|
|
17240
17485
|
apiPayload['reason'] = reason;
|
|
@@ -17349,7 +17594,12 @@
|
|
|
17349
17594
|
apiPayload['metadata'] = metadata;
|
|
17350
17595
|
}
|
|
17351
17596
|
if (typeof positions !== 'undefined') {
|
|
17352
|
-
apiPayload['positions'] = positions
|
|
17597
|
+
apiPayload['positions'] = Client.toWireKeys(positions, {
|
|
17598
|
+
"orderItemId": {
|
|
17599
|
+
"wire": "order_item_id",
|
|
17600
|
+
"children": null
|
|
17601
|
+
}
|
|
17602
|
+
});
|
|
17353
17603
|
}
|
|
17354
17604
|
if (typeof reason !== 'undefined') {
|
|
17355
17605
|
apiPayload['reason'] = reason;
|
|
@@ -17592,7 +17842,12 @@
|
|
|
17592
17842
|
apiPayload['number'] = number;
|
|
17593
17843
|
}
|
|
17594
17844
|
if (typeof positions !== 'undefined') {
|
|
17595
|
-
apiPayload['positions'] = positions
|
|
17845
|
+
apiPayload['positions'] = Client.toWireKeys(positions, {
|
|
17846
|
+
"orderItemId": {
|
|
17847
|
+
"wire": "order_item_id",
|
|
17848
|
+
"children": null
|
|
17849
|
+
}
|
|
17850
|
+
});
|
|
17596
17851
|
}
|
|
17597
17852
|
if (typeof shippedAt !== 'undefined') {
|
|
17598
17853
|
apiPayload['shipped_at'] = shippedAt;
|
|
@@ -21235,7 +21490,32 @@
|
|
|
21235
21490
|
const apiPath = '/v1/prices/lists/{list_id}/entries'.replace('{list_id}', listId);
|
|
21236
21491
|
const apiPayload = {};
|
|
21237
21492
|
if (typeof entries !== 'undefined') {
|
|
21238
|
-
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
|
+
});
|
|
21239
21519
|
}
|
|
21240
21520
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
21241
21521
|
const apiHeaders = {
|
|
@@ -21282,7 +21562,32 @@
|
|
|
21282
21562
|
const apiPath = '/v1/prices/lists/{list_id}/entries/bulk'.replace('{list_id}', listId);
|
|
21283
21563
|
const apiPayload = {};
|
|
21284
21564
|
if (typeof entries !== 'undefined') {
|
|
21285
|
-
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
|
+
});
|
|
21286
21591
|
}
|
|
21287
21592
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
21288
21593
|
const apiHeaders = {
|
|
@@ -21549,7 +21854,12 @@
|
|
|
21549
21854
|
apiPayload['currency'] = currency;
|
|
21550
21855
|
}
|
|
21551
21856
|
if (typeof items !== 'undefined') {
|
|
21552
|
-
apiPayload['items'] = items
|
|
21857
|
+
apiPayload['items'] = Client.toWireKeys(items, {
|
|
21858
|
+
"productId": {
|
|
21859
|
+
"wire": "product_id",
|
|
21860
|
+
"children": null
|
|
21861
|
+
}
|
|
21862
|
+
});
|
|
21553
21863
|
}
|
|
21554
21864
|
if (typeof marketId !== 'undefined') {
|
|
21555
21865
|
apiPayload['market_id'] = marketId;
|
|
@@ -25506,7 +25816,28 @@
|
|
|
25506
25816
|
const apiPath = '/v1/search/multi_search';
|
|
25507
25817
|
const apiPayload = {};
|
|
25508
25818
|
if (typeof searches !== 'undefined') {
|
|
25509
|
-
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
|
+
});
|
|
25510
25841
|
}
|
|
25511
25842
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
25512
25843
|
const apiHeaders = {
|
|
@@ -26060,7 +26391,12 @@
|
|
|
26060
26391
|
const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{method_id}', methodId);
|
|
26061
26392
|
const apiPayload = {};
|
|
26062
26393
|
if (typeof tiers !== 'undefined') {
|
|
26063
|
-
apiPayload['tiers'] = tiers
|
|
26394
|
+
apiPayload['tiers'] = Client.toWireKeys(tiers, {
|
|
26395
|
+
"fromValue": {
|
|
26396
|
+
"wire": "from_value",
|
|
26397
|
+
"children": null
|
|
26398
|
+
}
|
|
26399
|
+
});
|
|
26064
26400
|
}
|
|
26065
26401
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
26066
26402
|
const apiHeaders = {
|
|
@@ -30941,10 +31277,13 @@
|
|
|
30941
31277
|
return OrderListKind;
|
|
30942
31278
|
}({});
|
|
30943
31279
|
|
|
30944
|
-
let
|
|
30945
|
-
|
|
30946
|
-
|
|
30947
|
-
|
|
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;
|
|
30948
31287
|
}({});
|
|
30949
31288
|
|
|
30950
31289
|
let OrderPaymentStatus = /*#__PURE__*/function (OrderPaymentStatus) {
|
|
@@ -30958,6 +31297,19 @@
|
|
|
30958
31297
|
return OrderPaymentStatus;
|
|
30959
31298
|
}({});
|
|
30960
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
|
+
|
|
30961
31313
|
let PageStatus = /*#__PURE__*/function (PageStatus) {
|
|
30962
31314
|
PageStatus["Draft"] = "draft";
|
|
30963
31315
|
PageStatus["Published"] = "published";
|
|
@@ -31576,9 +31928,11 @@
|
|
|
31576
31928
|
exports.Method = Method;
|
|
31577
31929
|
exports.Operator = Operator;
|
|
31578
31930
|
exports.OrderCommentVisibility = OrderCommentVisibility;
|
|
31931
|
+
exports.OrderFulfillmentStatus = OrderFulfillmentStatus;
|
|
31579
31932
|
exports.OrderItemType = OrderItemType;
|
|
31580
31933
|
exports.OrderListKind = OrderListKind;
|
|
31581
31934
|
exports.OrderPaymentStatus = OrderPaymentStatus;
|
|
31935
|
+
exports.OrderStatus = OrderStatus;
|
|
31582
31936
|
exports.Orderlists = Orderlists;
|
|
31583
31937
|
exports.Orders = Orders;
|
|
31584
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
|
|