@omni-commerce/sdk 0.13.0 → 0.18.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 +159 -12
- package/dist/embed.cjs +7 -1
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.d.cts +5 -0
- package/dist/embed.d.ts +5 -0
- package/dist/embed.global.js +4 -4
- package/dist/embed.global.js.map +1 -1
- package/dist/embed.js +7 -1
- package/dist/embed.js.map +1 -1
- package/dist/index.cjs +768 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5156 -1262
- package/dist/index.d.ts +5156 -1262
- package/dist/index.js +768 -22
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +34 -6
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +34 -6
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ function normalizeClientOptions(options = {}) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// src/version.ts
|
|
38
|
-
var SDK_VERSION = "0.
|
|
38
|
+
var SDK_VERSION = "0.18.0";
|
|
39
39
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
40
40
|
|
|
41
41
|
// src/environments.ts
|
|
@@ -71,9 +71,9 @@ function defaultErrorMessage(statusCode, body) {
|
|
|
71
71
|
function extractErrorMessage(body) {
|
|
72
72
|
if (typeof body === "string" && body.trim()) return body;
|
|
73
73
|
if (!body || typeof body !== "object") return void 0;
|
|
74
|
-
const
|
|
74
|
+
const record2 = body;
|
|
75
75
|
for (const key of ["error", "message", "detail"]) {
|
|
76
|
-
const value =
|
|
76
|
+
const value = record2[key];
|
|
77
77
|
if (typeof value === "string" && value.trim()) return value;
|
|
78
78
|
}
|
|
79
79
|
return void 0;
|
|
@@ -461,6 +461,177 @@ function encodePathParam(name, value) {
|
|
|
461
461
|
return encodeURIComponent(value);
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
+
// src/products.ts
|
|
465
|
+
var ProductScanError = class extends Error {
|
|
466
|
+
constructor(partial, cause) {
|
|
467
|
+
super(
|
|
468
|
+
"Product scan failed. Resume from partial.next after saving partial.items."
|
|
469
|
+
);
|
|
470
|
+
__publicField(this, "partial", partial);
|
|
471
|
+
__publicField(this, "cause", cause);
|
|
472
|
+
this.name = "ProductScanError";
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
async function scanProducts(list, request, options = {}) {
|
|
476
|
+
const { maxPages = 1, onProgress, ...requestOptions } = options;
|
|
477
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 100)
|
|
478
|
+
throw new RangeError("maxPages must be an integer between 1 and 100.");
|
|
479
|
+
if ("queryParams" in requestOptions)
|
|
480
|
+
throw new TypeError("Pass scan filters in the request, not queryParams.");
|
|
481
|
+
let next = { limit: 50, offset: 0, ...request };
|
|
482
|
+
const items = [];
|
|
483
|
+
let pagesRead = 0;
|
|
484
|
+
const progress = () => ({
|
|
485
|
+
pagesRead,
|
|
486
|
+
itemsRead: items.length,
|
|
487
|
+
complete: next === null,
|
|
488
|
+
next: next ? { ...next } : null
|
|
489
|
+
});
|
|
490
|
+
try {
|
|
491
|
+
while (next && pagesRead < maxPages) {
|
|
492
|
+
requestOptions.abortSignal?.throwIfAborted();
|
|
493
|
+
const current = next;
|
|
494
|
+
const page = await list(
|
|
495
|
+
{ ...current, includeSummary: false },
|
|
496
|
+
requestOptions
|
|
497
|
+
);
|
|
498
|
+
const pagination = page.pagination;
|
|
499
|
+
if (!Array.isArray(page.items) || typeof pagination?.hasMore !== "boolean")
|
|
500
|
+
throw new Error("Invalid product page response.");
|
|
501
|
+
if (pagination.hasMore) {
|
|
502
|
+
if (!page.items.length || !Number.isInteger(pagination.nextOffset) || pagination.nextOffset <= (current.offset ?? 0) || pagination.nextCursor != null && (typeof pagination.nextCursor !== "string" || !pagination.nextCursor || pagination.nextCursor === current.cursor))
|
|
503
|
+
throw new Error("Product pagination did not advance.");
|
|
504
|
+
const continuation = {
|
|
505
|
+
...current,
|
|
506
|
+
offset: pagination.nextOffset
|
|
507
|
+
};
|
|
508
|
+
if (pagination.nextCursor) continuation.cursor = pagination.nextCursor;
|
|
509
|
+
else delete continuation.cursor;
|
|
510
|
+
next = continuation;
|
|
511
|
+
} else next = null;
|
|
512
|
+
items.push(...page.items);
|
|
513
|
+
pagesRead++;
|
|
514
|
+
await onProgress?.(progress(), [...page.items]);
|
|
515
|
+
}
|
|
516
|
+
return { ...progress(), items };
|
|
517
|
+
} catch (cause) {
|
|
518
|
+
throw new ProductScanError({ ...progress(), items }, cause);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// src/product-batches.ts
|
|
523
|
+
function validateItems(items) {
|
|
524
|
+
if (!Array.isArray(items) || items.length < 1 || items.length > 100)
|
|
525
|
+
throw new RangeError("Provide between 1 and 100 products per batch.");
|
|
526
|
+
}
|
|
527
|
+
function normalizeProductId(value) {
|
|
528
|
+
if (typeof value !== "string" || !value.trim() || value.trim().length > 160)
|
|
529
|
+
throw new TypeError(
|
|
530
|
+
"Each product ID must be a nonempty string of at most 160 characters."
|
|
531
|
+
);
|
|
532
|
+
return value.trim();
|
|
533
|
+
}
|
|
534
|
+
function requestsForIds(request) {
|
|
535
|
+
if ("productId" in request)
|
|
536
|
+
throw new TypeError("Use productIds, not productId, for a batch.");
|
|
537
|
+
const { productIds, ...shared } = request;
|
|
538
|
+
validateItems(productIds);
|
|
539
|
+
return [...new Set(Array.from(productIds, normalizeProductId))].map(
|
|
540
|
+
(productId) => ({
|
|
541
|
+
...shared,
|
|
542
|
+
productId
|
|
543
|
+
})
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
var record = (value) => value !== null && typeof value === "object" ? value : {};
|
|
547
|
+
function jobIdsFrom(value) {
|
|
548
|
+
const response = record(value);
|
|
549
|
+
const data = record(response.data);
|
|
550
|
+
const targets = Array.isArray(data.results) ? data.results.map(record) : [];
|
|
551
|
+
return [
|
|
552
|
+
...new Set(
|
|
553
|
+
[
|
|
554
|
+
response.jobId,
|
|
555
|
+
data.jobBatchId,
|
|
556
|
+
...targets.flatMap((target) => [
|
|
557
|
+
target.jobId,
|
|
558
|
+
...Array.isArray(target.correlations) ? target.correlations.map((correlation) => record(correlation).id) : []
|
|
559
|
+
])
|
|
560
|
+
].filter((id) => typeof id === "string" && id.length > 0)
|
|
561
|
+
)
|
|
562
|
+
];
|
|
563
|
+
}
|
|
564
|
+
async function runProductBatch(operation, requests, successKey, options = {}) {
|
|
565
|
+
const { concurrency = 3, ...requestOptions } = options;
|
|
566
|
+
if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 10)
|
|
567
|
+
throw new RangeError("concurrency must be an integer between 1 and 10.");
|
|
568
|
+
const results = new Array(requests.length);
|
|
569
|
+
let next = 0;
|
|
570
|
+
const worker = async () => {
|
|
571
|
+
while (next < requests.length) {
|
|
572
|
+
const index = next++;
|
|
573
|
+
const request = requests[index];
|
|
574
|
+
let attempted = false;
|
|
575
|
+
try {
|
|
576
|
+
requestOptions.abortSignal?.throwIfAborted();
|
|
577
|
+
attempted = true;
|
|
578
|
+
const data = await operation(request, requestOptions);
|
|
579
|
+
const success = record(data)[successKey] === true;
|
|
580
|
+
results[index] = {
|
|
581
|
+
productId: request.productId,
|
|
582
|
+
success,
|
|
583
|
+
attempted,
|
|
584
|
+
data,
|
|
585
|
+
jobIds: jobIdsFrom(data),
|
|
586
|
+
...success ? {} : { error: new OmniError({ body: data }) }
|
|
587
|
+
};
|
|
588
|
+
} catch (error) {
|
|
589
|
+
results[index] = {
|
|
590
|
+
productId: request.productId,
|
|
591
|
+
success: false,
|
|
592
|
+
attempted,
|
|
593
|
+
error,
|
|
594
|
+
jobIds: jobIdsFrom(
|
|
595
|
+
error instanceof OmniError ? error.body : void 0
|
|
596
|
+
)
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
await Promise.all(
|
|
602
|
+
Array.from({ length: Math.min(concurrency, requests.length) }, worker)
|
|
603
|
+
);
|
|
604
|
+
const succeededCount = results.filter((result) => result.success).length;
|
|
605
|
+
return {
|
|
606
|
+
success: succeededCount === requests.length,
|
|
607
|
+
productIds: requests.map((request) => request.productId),
|
|
608
|
+
succeededCount,
|
|
609
|
+
failedCount: requests.length - succeededCount,
|
|
610
|
+
results,
|
|
611
|
+
jobIds: [...new Set(results.flatMap((result) => result.jobIds))]
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
function batchPublishProducts(publish, request, options) {
|
|
615
|
+
return runProductBatch(publish, requestsForIds(request), "ok", options);
|
|
616
|
+
}
|
|
617
|
+
function batchDelistProducts(delist, request, options) {
|
|
618
|
+
return runProductBatch(delist, requestsForIds(request), "ok", options);
|
|
619
|
+
}
|
|
620
|
+
function batchUpdateProducts(update, request, options) {
|
|
621
|
+
if ("productId" in request || "productIds" in request)
|
|
622
|
+
throw new TypeError("Use updates for a batch of catalog edits.");
|
|
623
|
+
validateItems(request.updates);
|
|
624
|
+
const seen = /* @__PURE__ */ new Set();
|
|
625
|
+
const updates = Array.from(request.updates, (update2) => {
|
|
626
|
+
const productId = normalizeProductId(update2?.productId);
|
|
627
|
+
if (seen.has(productId))
|
|
628
|
+
throw new TypeError("Provide only one update per product ID.");
|
|
629
|
+
seen.add(productId);
|
|
630
|
+
return { ...update2, productId };
|
|
631
|
+
});
|
|
632
|
+
return runProductBatch(update, updates, "success", options);
|
|
633
|
+
}
|
|
634
|
+
|
|
464
635
|
// src/jobs.ts
|
|
465
636
|
var SUCCESS_STATUSES = /* @__PURE__ */ new Set([
|
|
466
637
|
"completed",
|
|
@@ -488,16 +659,16 @@ var JobFailedError = class extends OmniError {
|
|
|
488
659
|
};
|
|
489
660
|
function readJobStatus(payload) {
|
|
490
661
|
if (!payload || typeof payload !== "object") return void 0;
|
|
491
|
-
const
|
|
492
|
-
const nested =
|
|
662
|
+
const record2 = payload;
|
|
663
|
+
const nested = record2.data;
|
|
493
664
|
if (nested && typeof nested === "object") {
|
|
494
665
|
const nestedStatus = nested.status;
|
|
495
666
|
if (typeof nestedStatus === "string" && nestedStatus.trim()) {
|
|
496
667
|
return nestedStatus;
|
|
497
668
|
}
|
|
498
669
|
}
|
|
499
|
-
if (typeof
|
|
500
|
-
return
|
|
670
|
+
if (typeof record2.status === "string" && record2.status.trim()) {
|
|
671
|
+
return record2.status;
|
|
501
672
|
}
|
|
502
673
|
return void 0;
|
|
503
674
|
}
|
|
@@ -1107,6 +1278,180 @@ var AopClient = class {
|
|
|
1107
1278
|
});
|
|
1108
1279
|
}
|
|
1109
1280
|
};
|
|
1281
|
+
var ApiClient = class {
|
|
1282
|
+
constructor(_http) {
|
|
1283
|
+
__publicField(this, "_http", _http);
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Discover a published merchant agent
|
|
1287
|
+
*
|
|
1288
|
+
* A2A 1.0 Agent Card for any configured agent published to a customer deployment. Private model settings, prompts and publisher identity are excluded.
|
|
1289
|
+
*
|
|
1290
|
+
* `GET /api/embed/{deploymentId}/.well-known/agent-card.json`
|
|
1291
|
+
*/
|
|
1292
|
+
getEmbedwellKnownagentCardJson(request, requestOptions) {
|
|
1293
|
+
const { deploymentId } = request ?? {};
|
|
1294
|
+
return this._http.request({
|
|
1295
|
+
method: "GET",
|
|
1296
|
+
path: `/api/embed/${encodePathParam("deploymentId", deploymentId)}/.well-known/agent-card.json`,
|
|
1297
|
+
query: void 0,
|
|
1298
|
+
body: void 0,
|
|
1299
|
+
...mergeRequestOptions(requestOptions)
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Call a merchant agent using A2A
|
|
1304
|
+
*
|
|
1305
|
+
* Official A2A 1.0 JSON-RPC SendMessage, GetTask and CancelTask.
|
|
1306
|
+
|
|
1307
|
+
### Authentication
|
|
1308
|
+
|
|
1309
|
+
Uses the existing customer JWT from /api/embed/{deploymentId}/session; send the same Origin when creating and using the session.
|
|
1310
|
+
|
|
1311
|
+
### Messages
|
|
1312
|
+
|
|
1313
|
+
SendMessage accepts text user messages with a UUID messageId and up to 4000 characters. For asynchronous execution set configuration.returnImmediately=true and retrieve the task. Every task is bound to the customer session.
|
|
1314
|
+
|
|
1315
|
+
Bot verification and storefront protection apply. Payment proofs belong in the checkout completion endpoint, outside model messages.
|
|
1316
|
+
|
|
1317
|
+
### Signed offers and buyer agents
|
|
1318
|
+
|
|
1319
|
+
Payable offers in purchase-offers artifacts include checkoutJwt when the platform signing key is configured. Requests may carry a Web Bot Auth signature; the verified agent orig
|
|
1320
|
+
*
|
|
1321
|
+
* `POST /api/embed/{deploymentId}/a2a`
|
|
1322
|
+
*/
|
|
1323
|
+
embeda2a(request, requestOptions) {
|
|
1324
|
+
const { deploymentId, ...body } = request ?? {};
|
|
1325
|
+
return this._http.request({
|
|
1326
|
+
method: "POST",
|
|
1327
|
+
path: `/api/embed/${encodePathParam("deploymentId", deploymentId)}/a2a`,
|
|
1328
|
+
query: void 0,
|
|
1329
|
+
body,
|
|
1330
|
+
...mergeRequestOptions(requestOptions)
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Manage customer-owned purchase offers
|
|
1335
|
+
*
|
|
1336
|
+
* ### Operations
|
|
1337
|
+
|
|
1338
|
+
create: offers[] (1–5), with stable requestId, exact purchasable product/variant IDs, quantities, shipping country and optional unitAmount proposals. get/cancel: sessionIds[] (1–20). complete: sessionId, paymentProof, and buyer approval of cartVersion, totalAmount and currency. pay: sessionId and the same exact approval; returns checkoutUrl for Stripe-hosted card entry.
|
|
1339
|
+
|
|
1340
|
+
### Results and safeguards
|
|
1341
|
+
|
|
1342
|
+
Batches return ordered per-target results, succeededCount and failedCount. At most ten unpaid offers may be held per customer. Merchant-approved currency, countries, shipping and tax terms are required. Shopify-listed products return the supported Shopify checkout handoff.
|
|
1343
|
+
|
|
1344
|
+
### Payment
|
|
1345
|
+
|
|
1346
|
+
Completion reuses the existing Stripe ACP or x402 rail. Hosted card checkout requires this org
|
|
1347
|
+
*
|
|
1348
|
+
* `POST /api/embed/{deploymentId}/checkout-sessions/{operation}`
|
|
1349
|
+
*/
|
|
1350
|
+
embedcheckoutSessions(request, requestOptions) {
|
|
1351
|
+
const { deploymentId, operation, ...body } = request ?? {};
|
|
1352
|
+
return this._http.request({
|
|
1353
|
+
method: "POST",
|
|
1354
|
+
path: `/api/embed/${encodePathParam("deploymentId", deploymentId)}/checkout-sessions/${encodePathParam("operation", operation)}`,
|
|
1355
|
+
query: void 0,
|
|
1356
|
+
body,
|
|
1357
|
+
...mergeRequestOptions(requestOptions)
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
var BrandKitsClient = class {
|
|
1362
|
+
constructor(_http) {
|
|
1363
|
+
__publicField(this, "_http", _http);
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* List Brand Kits
|
|
1367
|
+
*
|
|
1368
|
+
* List full brand kits and canonical image-source websites. Requires branding:read. Supports q, limit (1–1000), and offset. Bearer credentials resolve the organization; sessions supply organizationId.
|
|
1369
|
+
*
|
|
1370
|
+
* `GET /api/v1/brand-kits`
|
|
1371
|
+
*/
|
|
1372
|
+
list(request = {}, requestOptions) {
|
|
1373
|
+
const { organizationId, q, limit, offset } = request ?? {};
|
|
1374
|
+
return this._http.request({
|
|
1375
|
+
method: "GET",
|
|
1376
|
+
path: "/api/v1/brand-kits",
|
|
1377
|
+
query: { organizationId, q, limit, offset },
|
|
1378
|
+
body: void 0,
|
|
1379
|
+
...mergeRequestOptions(requestOptions)
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Create Brand Kit
|
|
1384
|
+
*
|
|
1385
|
+
* Create a full brand kit with optional imageSourceUrls. Requires branding:write. All brandKit fields are supported; omitted fields receive canonical defaults.
|
|
1386
|
+
|
|
1387
|
+
Source websites accept HTTP(S) URLs or domain/path scopes and return normalized host/path values. The kit and sources save atomically. Use public HTTP(S) URLs for logo/icons; embedded images are rejected.
|
|
1388
|
+
*
|
|
1389
|
+
* `POST /api/v1/brand-kits`
|
|
1390
|
+
*/
|
|
1391
|
+
create(request, requestOptions) {
|
|
1392
|
+
const { ...body } = request ?? {};
|
|
1393
|
+
return this._http.request({
|
|
1394
|
+
method: "POST",
|
|
1395
|
+
path: "/api/v1/brand-kits",
|
|
1396
|
+
query: void 0,
|
|
1397
|
+
body,
|
|
1398
|
+
...mergeRequestOptions(requestOptions)
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Delete Brand Kit
|
|
1403
|
+
*
|
|
1404
|
+
* Delete the organization-owned kit and its saved brand image-source websites. Requires branding:write. Historical job snapshots are preserved.
|
|
1405
|
+
*
|
|
1406
|
+
* `DELETE /api/v1/brand-kits/{brandKitId}`
|
|
1407
|
+
*/
|
|
1408
|
+
delete(request, requestOptions) {
|
|
1409
|
+
const { brandKitId, organizationId } = request ?? {};
|
|
1410
|
+
return this._http.request({
|
|
1411
|
+
method: "DELETE",
|
|
1412
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1413
|
+
query: { organizationId },
|
|
1414
|
+
body: void 0,
|
|
1415
|
+
...mergeRequestOptions(requestOptions)
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Get Brand Kit
|
|
1420
|
+
*
|
|
1421
|
+
* Read the complete kit and imageSourceUrls. Requires branding:read.
|
|
1422
|
+
*
|
|
1423
|
+
* `GET /api/v1/brand-kits/{brandKitId}`
|
|
1424
|
+
*/
|
|
1425
|
+
get(request, requestOptions) {
|
|
1426
|
+
const { brandKitId, organizationId } = request ?? {};
|
|
1427
|
+
return this._http.request({
|
|
1428
|
+
method: "GET",
|
|
1429
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1430
|
+
query: { organizationId },
|
|
1431
|
+
body: void 0,
|
|
1432
|
+
...mergeRequestOptions(requestOptions)
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Update Brand Kit
|
|
1437
|
+
*
|
|
1438
|
+
* Edit name, any nested brandKit fields, and imageSourceUrls. Requires branding:write. Nested objects merge and arrays replace; omitted fields are preserved.
|
|
1439
|
+
|
|
1440
|
+
imageSourceUrls: [] clears websites. Renaming keeps source websites attached. Parent kit IDs must belong to this organization. Existing running jobs keep their frozen source snapshot until explicitly retried with brandKitIds.
|
|
1441
|
+
*
|
|
1442
|
+
* `PATCH /api/v1/brand-kits/{brandKitId}`
|
|
1443
|
+
*/
|
|
1444
|
+
update(request, requestOptions) {
|
|
1445
|
+
const { brandKitId, ...body } = request ?? {};
|
|
1446
|
+
return this._http.request({
|
|
1447
|
+
method: "PATCH",
|
|
1448
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1449
|
+
query: void 0,
|
|
1450
|
+
body,
|
|
1451
|
+
...mergeRequestOptions(requestOptions)
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1110
1455
|
var BrandsgatewayClient = class {
|
|
1111
1456
|
constructor(_http) {
|
|
1112
1457
|
__publicField(this, "_http", _http);
|
|
@@ -1392,7 +1737,7 @@ var CheckoutSessionsClient = class {
|
|
|
1392
1737
|
/**
|
|
1393
1738
|
* Complete Agentic Checkout Session
|
|
1394
1739
|
*
|
|
1395
|
-
* Settle the selected rail and create a native `agentic` order.
|
|
1740
|
+
* Settle the selected rail and create a native `agentic` order. Definitive settlement failures return 402. Pending confirmation locks the offer in `payment_pending`; durable recovery resumes the same attempt.
|
|
1396
1741
|
*
|
|
1397
1742
|
* `POST /api/v1/checkout-sessions/{sessionId}/complete`
|
|
1398
1743
|
*/
|
|
@@ -1557,6 +1902,56 @@ var ImagesClient = class {
|
|
|
1557
1902
|
});
|
|
1558
1903
|
}
|
|
1559
1904
|
};
|
|
1905
|
+
var InventoryClient = class {
|
|
1906
|
+
constructor(_http) {
|
|
1907
|
+
__publicField(this, "_http", _http);
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* List Inventory Groups
|
|
1911
|
+
*
|
|
1912
|
+
* Read active inventory using the same canonical quantities, filters and grouping as the inventory assistant. Requires catalog:read and inventory.read permission. Organization scope comes only from the credential.
|
|
1913
|
+
|
|
1914
|
+
### Stock and listing absence
|
|
1915
|
+
|
|
1916
|
+
status=in_stock means positive available stock (on hand minus locked), with variants rolled up for product groups. unlistedMarketplaces checks every organization store and the entire saved catalog, including product/variant identities, exact catalog SKUs, and historical listings. Source marketplace/country/storeIds filters do not restrict absence evidence. All supported marketplaces are accepted.
|
|
1917
|
+
|
|
1918
|
+
listingPresence reports saved-catalog evidence and unknown missing-SKU families. It does not establish fresh live marketplace absence. Stock quantities fro
|
|
1919
|
+
*
|
|
1920
|
+
* `GET /api/v1/inventory`
|
|
1921
|
+
*/
|
|
1922
|
+
list(request = {}, requestOptions) {
|
|
1923
|
+
const {
|
|
1924
|
+
productIds,
|
|
1925
|
+
query,
|
|
1926
|
+
marketplace,
|
|
1927
|
+
country,
|
|
1928
|
+
storeIds,
|
|
1929
|
+
unlistedMarketplaces,
|
|
1930
|
+
groupBy,
|
|
1931
|
+
status,
|
|
1932
|
+
offset,
|
|
1933
|
+
limit
|
|
1934
|
+
} = request ?? {};
|
|
1935
|
+
return this._http.request({
|
|
1936
|
+
method: "GET",
|
|
1937
|
+
path: "/api/v1/inventory",
|
|
1938
|
+
query: {
|
|
1939
|
+
productIds,
|
|
1940
|
+
query,
|
|
1941
|
+
marketplace,
|
|
1942
|
+
country,
|
|
1943
|
+
storeIds,
|
|
1944
|
+
unlistedMarketplaces,
|
|
1945
|
+
groupBy,
|
|
1946
|
+
status,
|
|
1947
|
+
offset,
|
|
1948
|
+
limit
|
|
1949
|
+
},
|
|
1950
|
+
body: void 0,
|
|
1951
|
+
...mergeRequestOptions(requestOptions)
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
};
|
|
1560
1955
|
var JobsClient = class {
|
|
1561
1956
|
constructor(_http) {
|
|
1562
1957
|
__publicField(this, "_http", _http);
|
|
@@ -2061,6 +2456,104 @@ var OrdersClient = class {
|
|
|
2061
2456
|
...mergeRequestOptions(requestOptions)
|
|
2062
2457
|
});
|
|
2063
2458
|
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Check Order Action Options
|
|
2461
|
+
*
|
|
2462
|
+
* ### Authorization
|
|
2463
|
+
|
|
2464
|
+
Requires orders:write.
|
|
2465
|
+
|
|
2466
|
+
### Choices
|
|
2467
|
+
|
|
2468
|
+
Read current marketplace choices for ship, cancel, labels or update_tracking for 1–50 order UUIDs using repeated orderIds query parameters. The shared order service checks status, store connection and marketplace capability. Results preserve first-requested order, with explicit per-order errors. Use the exact choice payload and supply any fields marked requiresInput. An unsupported marketplace operation is an explicit failure, not a silently skipped order. Ship arranges shipment; labels generates printable files. Fulfillment behavior is identical to the existing single-order API and workspace UI.
|
|
2469
|
+
*
|
|
2470
|
+
* `GET /api/v1/orders/actions`
|
|
2471
|
+
*/
|
|
2472
|
+
listBatchActionOptions(request, requestOptions) {
|
|
2473
|
+
const { orderIds, action, organizationId } = request ?? {};
|
|
2474
|
+
return this._http.request({
|
|
2475
|
+
method: "GET",
|
|
2476
|
+
path: "/api/v1/orders/actions",
|
|
2477
|
+
query: { orderIds, action, organizationId },
|
|
2478
|
+
body: void 0,
|
|
2479
|
+
...mergeRequestOptions(requestOptions)
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
/**
|
|
2483
|
+
* Process Order Actions
|
|
2484
|
+
*
|
|
2485
|
+
* ### Authorization
|
|
2486
|
+
|
|
2487
|
+
Requires orders:write.
|
|
2488
|
+
|
|
2489
|
+
### Batch submission
|
|
2490
|
+
|
|
2491
|
+
Queue 1–50 distinct order operations with a UUID requestId. Each operation has orderId, action (ship, cancel, labels or update_tracking), and optional payload. Use exact marketplace choices from GET /api/v1/orders/actions and supply required carrier, tracking, pickup/drop-off or cancellation details. One operation per order is allowed in a batch; later stages such as labels after shipment require another submission. All targets are authorized before any enqueue. Per-order failures are isolated; results retain request order and include every accepted jobId. data.success means all submissions were accepted, not that marketplace processing finished.
|
|
2492
|
+
|
|
2493
|
+
### Recovery and completion
|
|
2494
|
+
|
|
2495
|
+
Retain requestId and unchanged operations for retr
|
|
2496
|
+
*
|
|
2497
|
+
* `POST /api/v1/orders/actions`
|
|
2498
|
+
*/
|
|
2499
|
+
processActions(request, requestOptions) {
|
|
2500
|
+
const { ...body } = request ?? {};
|
|
2501
|
+
return this._http.request({
|
|
2502
|
+
method: "POST",
|
|
2503
|
+
path: "/api/v1/orders/actions",
|
|
2504
|
+
query: void 0,
|
|
2505
|
+
body,
|
|
2506
|
+
...mergeRequestOptions(requestOptions)
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
/**
|
|
2510
|
+
* Get Order Action Jobs
|
|
2511
|
+
*
|
|
2512
|
+
* ### Authorization
|
|
2513
|
+
|
|
2514
|
+
Requires orders:read.
|
|
2515
|
+
|
|
2516
|
+
### Outcomes and labels
|
|
2517
|
+
|
|
2518
|
+
Read every requested order action job in one batch of 1–50 UUIDs using repeated jobIds parameters. Results preserve first-requested order. data.success is true only when every requested job succeeded; failedCount includes failed and not_supported, while pendingCount includes queued and running. Successful label jobs contain downloadable files in labels[]. A missing or cross-organization job returns 404; current store restrictions apply to all targets. The top-level completed status describes the lookup, not job completion. No raw provider acknowledgements are exposed.
|
|
2519
|
+
*
|
|
2520
|
+
* `GET /api/v1/orders/actions/jobs`
|
|
2521
|
+
*/
|
|
2522
|
+
getActionJobs(request, requestOptions) {
|
|
2523
|
+
const { jobIds, organizationId } = request ?? {};
|
|
2524
|
+
return this._http.request({
|
|
2525
|
+
method: "GET",
|
|
2526
|
+
path: "/api/v1/orders/actions/jobs",
|
|
2527
|
+
query: { jobIds, organizationId },
|
|
2528
|
+
body: void 0,
|
|
2529
|
+
...mergeRequestOptions(requestOptions)
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
2532
|
+
/**
|
|
2533
|
+
* Create Picking List
|
|
2534
|
+
*
|
|
2535
|
+
* ### Authorization
|
|
2536
|
+
|
|
2537
|
+
Requires orders:read. API keys resolve organization scope from their credential; session callers include organizationId.
|
|
2538
|
+
|
|
2539
|
+
### PDF output
|
|
2540
|
+
|
|
2541
|
+
Create a private PDF picking list for 1–500 order UUIDs, trimmed and deduplicated in first-requested order. Missing or inaccessible orders fail the complete selection without creating a partial document. The same grouping, product quantities, SKU/variation and currency-labeled prices as the workspace Orders page are used. timeZone accepts an IANA time zone; omitted API requests use UTC. This does not arrange shipment or change orders.
|
|
2542
|
+
|
|
2543
|
+
The result contains structured list data, every orderId, a saved documentId and a signed HTTPS downloadUrl valid until expiresAt (five minutes). Generate a fresh list for a new download URL. Download the
|
|
2544
|
+
*
|
|
2545
|
+
* `POST /api/v1/orders/picking-list`
|
|
2546
|
+
*/
|
|
2547
|
+
createPickingList(request, requestOptions) {
|
|
2548
|
+
const { ...body } = request ?? {};
|
|
2549
|
+
return this._http.request({
|
|
2550
|
+
method: "POST",
|
|
2551
|
+
path: "/api/v1/orders/picking-list",
|
|
2552
|
+
query: void 0,
|
|
2553
|
+
body,
|
|
2554
|
+
...mergeRequestOptions(requestOptions)
|
|
2555
|
+
});
|
|
2556
|
+
}
|
|
2064
2557
|
};
|
|
2065
2558
|
var OrganizationsClient = class {
|
|
2066
2559
|
constructor(_http) {
|
|
@@ -2241,7 +2734,19 @@ var ProductsClient = class {
|
|
|
2241
2734
|
maxPrice,
|
|
2242
2735
|
sortBy,
|
|
2243
2736
|
limit,
|
|
2244
|
-
offset
|
|
2737
|
+
offset,
|
|
2738
|
+
store,
|
|
2739
|
+
storeKeys,
|
|
2740
|
+
brands,
|
|
2741
|
+
bundleType,
|
|
2742
|
+
language,
|
|
2743
|
+
hasImage,
|
|
2744
|
+
stock,
|
|
2745
|
+
publishedFrom,
|
|
2746
|
+
publishedTo,
|
|
2747
|
+
publishedTimeZone,
|
|
2748
|
+
cursor,
|
|
2749
|
+
includeSummary
|
|
2245
2750
|
} = request ?? {};
|
|
2246
2751
|
return this._http.request({
|
|
2247
2752
|
method: "GET",
|
|
@@ -2256,7 +2761,19 @@ var ProductsClient = class {
|
|
|
2256
2761
|
maxPrice,
|
|
2257
2762
|
sortBy,
|
|
2258
2763
|
limit,
|
|
2259
|
-
offset
|
|
2764
|
+
offset,
|
|
2765
|
+
store,
|
|
2766
|
+
storeKeys,
|
|
2767
|
+
brands,
|
|
2768
|
+
bundleType,
|
|
2769
|
+
language,
|
|
2770
|
+
hasImage,
|
|
2771
|
+
stock,
|
|
2772
|
+
publishedFrom,
|
|
2773
|
+
publishedTo,
|
|
2774
|
+
publishedTimeZone,
|
|
2775
|
+
cursor,
|
|
2776
|
+
includeSummary
|
|
2260
2777
|
},
|
|
2261
2778
|
body: void 0,
|
|
2262
2779
|
...mergeRequestOptions(requestOptions)
|
|
@@ -2510,18 +3027,14 @@ var ProductsClient = class {
|
|
|
2510
3027
|
*
|
|
2511
3028
|
* Queue a bulk product import for the authenticated organization.
|
|
2512
3029
|
|
|
3030
|
+
Supply explicit SKU options in each row's `variationAttributes` and native marketplace attributes in `marketplaceAttributes`. Enrichment never infers SKU options. At Zalora publish time, a missing required Size defaults to One Size only when valid for the selected category and supplied size system. Supplied sizes are preserved; missing or incompatible size systems and other required options block publishing. Each row remains a standalone product; no child variants are created for the default.
|
|
3031
|
+
|
|
2513
3032
|
### Input options
|
|
2514
3033
|
|
|
2515
3034
|
- Upload a CSV (2 MiB) or JSON products file (8 MiB) using `multipart/form-data`.
|
|
2516
3035
|
- Send JSON with a `products` array of 1–5,000 flat product objects (8 MiB request maximum).
|
|
2517
3036
|
- Send JSON with inline `csvText`.
|
|
2518
|
-
- Send
|
|
2519
|
-
|
|
2520
|
-
### Asynchronous result
|
|
2521
|
-
|
|
2522
|
-
The API creates import rows, then queues draft creation and AI Review through Inngest. Completed import jobs expose `reviewBatchIds`, `reviewUrls`, and `reviewWarnings`; generated changes require Review approval. Poll the returned `bulk_...` job with `GET /api/v1/jobs/{jobId}`.
|
|
2523
|
-
|
|
2524
|
-
Cancel an in-flight import with `POST /api/v1/jobs/{jobId}/cancel`.
|
|
3037
|
+
- Send
|
|
2525
3038
|
*
|
|
2526
3039
|
* `POST /api/v1/products/bulk-import`
|
|
2527
3040
|
*/
|
|
@@ -2535,6 +3048,54 @@ var ProductsClient = class {
|
|
|
2535
3048
|
...mergeRequestOptions(requestOptions)
|
|
2536
3049
|
});
|
|
2537
3050
|
}
|
|
3051
|
+
/**
|
|
3052
|
+
* Get Import Retry Progress
|
|
3053
|
+
*
|
|
3054
|
+
* Read actual row and review generation progress using an importretry_... handle. Requires catalog:read. success is null while running, true only for successful completion, and false for missing targets, dispatch failure, or stage failures.
|
|
3055
|
+
|
|
3056
|
+
Row IDs, review request IDs, errors, and per-stage counts remain available. The same handle works with GET /api/v1/jobs/{jobId} and SDK jobs.wait.
|
|
3057
|
+
*
|
|
3058
|
+
* `GET /api/v1/products/bulk-import/retries/{retryJobId}`
|
|
3059
|
+
*/
|
|
3060
|
+
getBulkImportRetry(request, requestOptions) {
|
|
3061
|
+
const { retryJobId, organizationId } = request ?? {};
|
|
3062
|
+
return this._http.request({
|
|
3063
|
+
method: "GET",
|
|
3064
|
+
path: `/api/v1/products/bulk-import/retries/${encodePathParam("retryJobId", retryJobId)}`,
|
|
3065
|
+
query: { organizationId },
|
|
3066
|
+
body: void 0,
|
|
3067
|
+
...mergeRequestOptions(requestOptions)
|
|
3068
|
+
});
|
|
3069
|
+
}
|
|
3070
|
+
/**
|
|
3071
|
+
* Retry Failed Import or Review Jobs
|
|
3072
|
+
*
|
|
3073
|
+
* Retry 1–20 jobs with durable background execution. Requires catalog:write.
|
|
3074
|
+
|
|
3075
|
+
### Targets
|
|
3076
|
+
|
|
3077
|
+
jobIds accepts import UUIDs, bulk_... developer job handles, or review_<batch UUID> for a Review job (including jobs created in the app). Inputs are trimmed, bounded, and deduplicated in first-requested order.
|
|
3078
|
+
|
|
3079
|
+
### Retry scope
|
|
3080
|
+
|
|
3081
|
+
stages=all retries failed source rows and linked review stages; stages=images retries failed review images only. Completed work, applied products, cancelled stages, and active work are preserved. Optional brandKitIds replaces image-source selection using the kits' current organization-owned websites. Omit it to keep frozen sources. To resume interrupted dispatch, pass an importretry_... handle without overrides; the saved target plan is reused.
|
|
3082
|
+
|
|
3083
|
+
### Results
|
|
3084
|
+
|
|
3085
|
+
Use the returned ord
|
|
3086
|
+
*
|
|
3087
|
+
* `POST /api/v1/products/bulk-import/retry`
|
|
3088
|
+
*/
|
|
3089
|
+
retryBulkImport(request, requestOptions) {
|
|
3090
|
+
const { ...body } = request ?? {};
|
|
3091
|
+
return this._http.request({
|
|
3092
|
+
method: "POST",
|
|
3093
|
+
path: "/api/v1/products/bulk-import/retry",
|
|
3094
|
+
query: void 0,
|
|
3095
|
+
body,
|
|
3096
|
+
...mergeRequestOptions(requestOptions)
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
2538
3099
|
/**
|
|
2539
3100
|
* Compare Product Market Prices
|
|
2540
3101
|
*
|
|
@@ -2606,6 +3167,63 @@ var ProductsClient = class {
|
|
|
2606
3167
|
...mergeRequestOptions(requestOptions)
|
|
2607
3168
|
});
|
|
2608
3169
|
}
|
|
3170
|
+
/**
|
|
3171
|
+
* Count Products
|
|
3172
|
+
*
|
|
3173
|
+
* Count matching catalog parent products using the Products page's canonical filters and authorization, without loading rows, pricing, or location data.
|
|
3174
|
+
|
|
3175
|
+
Products are counted once even when multiple listings match. This does not count variants or verify live marketplace status. status is the catalog lifecycle/derived view. All marketplaces are supported. Use storeKeys for exact marketplace/country/account identity.
|
|
3176
|
+
|
|
3177
|
+
Authenticate with a read-only catalog credential; organization comes only from that credential.
|
|
3178
|
+
*
|
|
3179
|
+
* `GET /api/v1/products/count`
|
|
3180
|
+
*/
|
|
3181
|
+
count(request = {}, requestOptions) {
|
|
3182
|
+
const {
|
|
3183
|
+
status,
|
|
3184
|
+
marketplace,
|
|
3185
|
+
country,
|
|
3186
|
+
q,
|
|
3187
|
+
sku,
|
|
3188
|
+
minPrice,
|
|
3189
|
+
maxPrice,
|
|
3190
|
+
store,
|
|
3191
|
+
storeKeys,
|
|
3192
|
+
brands,
|
|
3193
|
+
bundleType,
|
|
3194
|
+
language,
|
|
3195
|
+
hasImage,
|
|
3196
|
+
stock,
|
|
3197
|
+
publishedFrom,
|
|
3198
|
+
publishedTo,
|
|
3199
|
+
publishedTimeZone
|
|
3200
|
+
} = request ?? {};
|
|
3201
|
+
return this._http.request({
|
|
3202
|
+
method: "GET",
|
|
3203
|
+
path: "/api/v1/products/count",
|
|
3204
|
+
query: {
|
|
3205
|
+
status,
|
|
3206
|
+
marketplace,
|
|
3207
|
+
country,
|
|
3208
|
+
q,
|
|
3209
|
+
sku,
|
|
3210
|
+
minPrice,
|
|
3211
|
+
maxPrice,
|
|
3212
|
+
store,
|
|
3213
|
+
storeKeys,
|
|
3214
|
+
brands,
|
|
3215
|
+
bundleType,
|
|
3216
|
+
language,
|
|
3217
|
+
hasImage,
|
|
3218
|
+
stock,
|
|
3219
|
+
publishedFrom,
|
|
3220
|
+
publishedTo,
|
|
3221
|
+
publishedTimeZone
|
|
3222
|
+
},
|
|
3223
|
+
body: void 0,
|
|
3224
|
+
...mergeRequestOptions(requestOptions)
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
2609
3227
|
/**
|
|
2610
3228
|
* Queue Product Enrichment
|
|
2611
3229
|
*
|
|
@@ -2613,9 +3231,9 @@ var ProductsClient = class {
|
|
|
2613
3231
|
|
|
2614
3232
|
### Enrichment options
|
|
2615
3233
|
|
|
2616
|
-
Fields, instructions and auto-apply settings use the canonical enrichment service. Exclude name from selectedFields to preserve titles. Weight and dimensions are always included;
|
|
3234
|
+
Fields, instructions and auto-apply settings use the canonical enrichment service. Exclude name from selectedFields to preserve titles. Weight and dimensions are always included; images are not queued here. Optional marketplaceStoreSelections maps each marketplace to an array of connected store IDs. Multiple stores on one marketplace get independent category and attribute reviews in the same review group. Set includeListingCopy=false for taxonomy only. Store countries come from the authenticated organization connections.
|
|
2617
3235
|
|
|
2618
|
-
autoApplyHighConfidence defaults to false.
|
|
3236
|
+
autoApplyHighConfidence defaults to false.
|
|
2619
3237
|
*
|
|
2620
3238
|
* `POST /api/v1/products/enrich`
|
|
2621
3239
|
*/
|
|
@@ -2629,6 +3247,38 @@ var ProductsClient = class {
|
|
|
2629
3247
|
...mergeRequestOptions(requestOptions)
|
|
2630
3248
|
});
|
|
2631
3249
|
}
|
|
3250
|
+
/** Read a bounded chunk without summary classification; persist progress to resume. */
|
|
3251
|
+
scan(request = {}, options) {
|
|
3252
|
+
return scanProducts(
|
|
3253
|
+
(page, requestOptions) => this.list(page, requestOptions),
|
|
3254
|
+
request,
|
|
3255
|
+
options
|
|
3256
|
+
);
|
|
3257
|
+
}
|
|
3258
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3259
|
+
batchPublish(request, options) {
|
|
3260
|
+
return batchPublishProducts(
|
|
3261
|
+
(item, requestOptions) => this.publish(item, requestOptions),
|
|
3262
|
+
request,
|
|
3263
|
+
options
|
|
3264
|
+
);
|
|
3265
|
+
}
|
|
3266
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3267
|
+
batchDelist(request, options) {
|
|
3268
|
+
return batchDelistProducts(
|
|
3269
|
+
(item, requestOptions) => this.delist(item, requestOptions),
|
|
3270
|
+
request,
|
|
3271
|
+
options
|
|
3272
|
+
);
|
|
3273
|
+
}
|
|
3274
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3275
|
+
batchUpdate(request, options) {
|
|
3276
|
+
return batchUpdateProducts(
|
|
3277
|
+
(item, requestOptions) => this.update(item, requestOptions),
|
|
3278
|
+
request,
|
|
3279
|
+
options
|
|
3280
|
+
);
|
|
3281
|
+
}
|
|
2632
3282
|
};
|
|
2633
3283
|
var PromotionsClient = class {
|
|
2634
3284
|
constructor(_http) {
|
|
@@ -2864,6 +3514,96 @@ var ReturnsClient = class {
|
|
|
2864
3514
|
...mergeRequestOptions(requestOptions)
|
|
2865
3515
|
});
|
|
2866
3516
|
}
|
|
3517
|
+
/**
|
|
3518
|
+
* Check Return Actions
|
|
3519
|
+
*
|
|
3520
|
+
* ### Authorization
|
|
3521
|
+
|
|
3522
|
+
Requires orders:write.
|
|
3523
|
+
|
|
3524
|
+
### Eligibility
|
|
3525
|
+
|
|
3526
|
+
Read live marketplace decisions for 1–50 OmniCommerce return UUIDs using repeated returnIds query parameters. Refreshes the saved return state through the same service as the order UI. All targets are organization- and store-scoped before marketplace access. Results preserve first-requested order; one provider failure does not block another store. data.success describes eligibility checks, not whether an action is available. Completed, cancelled and other terminal returns have no actions. Check actions.length and limitation; never infer eligibility from status alone. Amazon and WhatsApp currently return explicit processing limitations. Other marketplaces expose only decisions supported by their current API state. No buyer remarks,
|
|
3527
|
+
*
|
|
3528
|
+
* `GET /api/v1/returns/actions`
|
|
3529
|
+
*/
|
|
3530
|
+
listActions(request, requestOptions) {
|
|
3531
|
+
const { returnIds, organizationId } = request ?? {};
|
|
3532
|
+
return this._http.request({
|
|
3533
|
+
method: "GET",
|
|
3534
|
+
path: "/api/v1/returns/actions",
|
|
3535
|
+
query: { returnIds, organizationId },
|
|
3536
|
+
body: void 0,
|
|
3537
|
+
...mergeRequestOptions(requestOptions)
|
|
3538
|
+
});
|
|
3539
|
+
}
|
|
3540
|
+
/**
|
|
3541
|
+
* Process Returns
|
|
3542
|
+
*
|
|
3543
|
+
* ### Authorization
|
|
3544
|
+
|
|
3545
|
+
Requires orders:write.
|
|
3546
|
+
|
|
3547
|
+
### Submit decisions
|
|
3548
|
+
|
|
3549
|
+
Queue 1–50 selected return decisions, including a one-element batch for a single return. Use only actionId/version pairs from a fresh eligibility check. Identical duplicate return operations are deduplicated in first-requested order; conflicting duplicates are rejected. requestId is a UUID idempotency key: retry the same key and unchanged operations after a transport failure. An active matching decision is reused; conflicting active decisions return 409. Returns HTTP 202 with every returnId and jobId. The durable worker rechecks current permissions, store identity, eligibility and version immediately before writing, then verifies the marketplace result. Follow links.poll or GET /api/v1/returns/actions/jobs with every jobIds e
|
|
3550
|
+
*
|
|
3551
|
+
* `POST /api/v1/returns/actions`
|
|
3552
|
+
*/
|
|
3553
|
+
process(request, requestOptions) {
|
|
3554
|
+
const { ...body } = request ?? {};
|
|
3555
|
+
return this._http.request({
|
|
3556
|
+
method: "POST",
|
|
3557
|
+
path: "/api/v1/returns/actions",
|
|
3558
|
+
query: void 0,
|
|
3559
|
+
body,
|
|
3560
|
+
...mergeRequestOptions(requestOptions)
|
|
3561
|
+
});
|
|
3562
|
+
}
|
|
3563
|
+
/**
|
|
3564
|
+
* Get Return Action Jobs
|
|
3565
|
+
*
|
|
3566
|
+
* ### Authorization
|
|
3567
|
+
|
|
3568
|
+
Requires orders:read.
|
|
3569
|
+
|
|
3570
|
+
### Job outcomes
|
|
3571
|
+
|
|
3572
|
+
Read the current state of 1–50 return-processing job UUIDs in one request using repeated jobIds parameters. Use every job ID returned by submission. Results preserve first-requested order. pendingCount counts queued, running and submitting; succeededCount counts succeeded; failedCount includes failed and needs_review. data.success is true only if every requested job succeeded. The top-level completed status refers to this lookup, not to the jobs. Missing or cross-organization jobs return 404; jobs outside assigned stores are forbidden. Evidence contains accepted/verified flags and before/after marketplace statuses, without raw provider payloads.
|
|
3573
|
+
*
|
|
3574
|
+
* `GET /api/v1/returns/actions/jobs`
|
|
3575
|
+
*/
|
|
3576
|
+
getActionJobs(request, requestOptions) {
|
|
3577
|
+
const { jobIds, organizationId } = request ?? {};
|
|
3578
|
+
return this._http.request({
|
|
3579
|
+
method: "GET",
|
|
3580
|
+
path: "/api/v1/returns/actions/jobs",
|
|
3581
|
+
query: { jobIds, organizationId },
|
|
3582
|
+
body: void 0,
|
|
3583
|
+
...mergeRequestOptions(requestOptions)
|
|
3584
|
+
});
|
|
3585
|
+
}
|
|
3586
|
+
/**
|
|
3587
|
+
* Get Order Returns
|
|
3588
|
+
*
|
|
3589
|
+
* Requires orders:read. Read stored return requests for 1–50 order UUIDs using repeated orderIds query parameters.
|
|
3590
|
+
|
|
3591
|
+
### Return identity
|
|
3592
|
+
|
|
3593
|
+
Results preserve first-requested order and include distinct active and historical return requests. processingEligible is a local candidate flag, not live eligibility. Pass returnId values to GET /api/v1/returns/actions before choosing a decision. Every order is authorized before reading returns, including store restrictions; no buyer data is exposed.
|
|
3594
|
+
*
|
|
3595
|
+
* `GET /api/v1/returns/orders`
|
|
3596
|
+
*/
|
|
3597
|
+
listForOrders(request, requestOptions) {
|
|
3598
|
+
const { orderIds, organizationId } = request ?? {};
|
|
3599
|
+
return this._http.request({
|
|
3600
|
+
method: "GET",
|
|
3601
|
+
path: "/api/v1/returns/orders",
|
|
3602
|
+
query: { orderIds, organizationId },
|
|
3603
|
+
body: void 0,
|
|
3604
|
+
...mergeRequestOptions(requestOptions)
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
2867
3607
|
};
|
|
2868
3608
|
var ReviewsClient = class {
|
|
2869
3609
|
constructor(_http) {
|
|
@@ -3458,6 +4198,8 @@ var OmniGeneratedClient = class {
|
|
|
3458
4198
|
__publicField(this, "agents");
|
|
3459
4199
|
__publicField(this, "analytics");
|
|
3460
4200
|
__publicField(this, "aop");
|
|
4201
|
+
__publicField(this, "api");
|
|
4202
|
+
__publicField(this, "brandKits");
|
|
3461
4203
|
__publicField(this, "brandsgateway");
|
|
3462
4204
|
__publicField(this, "campaigns");
|
|
3463
4205
|
__publicField(this, "catalog");
|
|
@@ -3468,6 +4210,7 @@ var OmniGeneratedClient = class {
|
|
|
3468
4210
|
__publicField(this, "evaluate");
|
|
3469
4211
|
__publicField(this, "feed");
|
|
3470
4212
|
__publicField(this, "images");
|
|
4213
|
+
__publicField(this, "inventory");
|
|
3471
4214
|
__publicField(this, "jobs");
|
|
3472
4215
|
__publicField(this, "looks");
|
|
3473
4216
|
__publicField(this, "marketplaces");
|
|
@@ -3493,6 +4236,8 @@ var OmniGeneratedClient = class {
|
|
|
3493
4236
|
this.agents = new AgentsClient(this._http);
|
|
3494
4237
|
this.analytics = new AnalyticsClient(this._http);
|
|
3495
4238
|
this.aop = new AopClient(this._http);
|
|
4239
|
+
this.api = new ApiClient(this._http);
|
|
4240
|
+
this.brandKits = new BrandKitsClient(this._http);
|
|
3496
4241
|
this.brandsgateway = new BrandsgatewayClient(this._http);
|
|
3497
4242
|
this.campaigns = new CampaignsClient(this._http);
|
|
3498
4243
|
this.catalog = new CatalogClient(this._http);
|
|
@@ -3503,6 +4248,7 @@ var OmniGeneratedClient = class {
|
|
|
3503
4248
|
this.evaluate = new EvaluateClient(this._http);
|
|
3504
4249
|
this.feed = new FeedClient(this._http);
|
|
3505
4250
|
this.images = new ImagesClient(this._http);
|
|
4251
|
+
this.inventory = new InventoryClient(this._http);
|
|
3506
4252
|
this.jobs = new JobsClient(this._http);
|
|
3507
4253
|
this.looks = new LooksClient(this._http);
|
|
3508
4254
|
this.marketplaces = new MarketplacesClient(this._http);
|
|
@@ -3548,8 +4294,8 @@ function headerValue(headers, name) {
|
|
|
3548
4294
|
if (typeof Headers !== "undefined" && headers instanceof Headers) {
|
|
3549
4295
|
return headers.get(name) ?? headers.get(name.toLowerCase()) ?? void 0;
|
|
3550
4296
|
}
|
|
3551
|
-
const
|
|
3552
|
-
const direct =
|
|
4297
|
+
const record2 = headers;
|
|
4298
|
+
const direct = record2[name] ?? record2[name.toLowerCase()];
|
|
3553
4299
|
if (Array.isArray(direct)) return direct[0];
|
|
3554
4300
|
return direct ?? void 0;
|
|
3555
4301
|
}
|
|
@@ -3649,6 +4395,7 @@ exports.OmniClient = OmniClient;
|
|
|
3649
4395
|
exports.OmniEnvironment = OmniEnvironment;
|
|
3650
4396
|
exports.OmniError = OmniError;
|
|
3651
4397
|
exports.OmniTimeoutError = OmniTimeoutError;
|
|
4398
|
+
exports.ProductScanError = ProductScanError;
|
|
3652
4399
|
exports.SDK_VERSION = SDK_VERSION;
|
|
3653
4400
|
exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
3654
4401
|
exports.TooManyRequestsError = TooManyRequestsError;
|