@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.js
CHANGED
|
@@ -33,7 +33,7 @@ function normalizeClientOptions(options = {}) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// src/version.ts
|
|
36
|
-
var SDK_VERSION = "0.
|
|
36
|
+
var SDK_VERSION = "0.18.0";
|
|
37
37
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
38
38
|
|
|
39
39
|
// src/environments.ts
|
|
@@ -69,9 +69,9 @@ function defaultErrorMessage(statusCode, body) {
|
|
|
69
69
|
function extractErrorMessage(body) {
|
|
70
70
|
if (typeof body === "string" && body.trim()) return body;
|
|
71
71
|
if (!body || typeof body !== "object") return void 0;
|
|
72
|
-
const
|
|
72
|
+
const record2 = body;
|
|
73
73
|
for (const key of ["error", "message", "detail"]) {
|
|
74
|
-
const value =
|
|
74
|
+
const value = record2[key];
|
|
75
75
|
if (typeof value === "string" && value.trim()) return value;
|
|
76
76
|
}
|
|
77
77
|
return void 0;
|
|
@@ -459,6 +459,177 @@ function encodePathParam(name, value) {
|
|
|
459
459
|
return encodeURIComponent(value);
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
+
// src/products.ts
|
|
463
|
+
var ProductScanError = class extends Error {
|
|
464
|
+
constructor(partial, cause) {
|
|
465
|
+
super(
|
|
466
|
+
"Product scan failed. Resume from partial.next after saving partial.items."
|
|
467
|
+
);
|
|
468
|
+
__publicField(this, "partial", partial);
|
|
469
|
+
__publicField(this, "cause", cause);
|
|
470
|
+
this.name = "ProductScanError";
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
async function scanProducts(list, request, options = {}) {
|
|
474
|
+
const { maxPages = 1, onProgress, ...requestOptions } = options;
|
|
475
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 100)
|
|
476
|
+
throw new RangeError("maxPages must be an integer between 1 and 100.");
|
|
477
|
+
if ("queryParams" in requestOptions)
|
|
478
|
+
throw new TypeError("Pass scan filters in the request, not queryParams.");
|
|
479
|
+
let next = { limit: 50, offset: 0, ...request };
|
|
480
|
+
const items = [];
|
|
481
|
+
let pagesRead = 0;
|
|
482
|
+
const progress = () => ({
|
|
483
|
+
pagesRead,
|
|
484
|
+
itemsRead: items.length,
|
|
485
|
+
complete: next === null,
|
|
486
|
+
next: next ? { ...next } : null
|
|
487
|
+
});
|
|
488
|
+
try {
|
|
489
|
+
while (next && pagesRead < maxPages) {
|
|
490
|
+
requestOptions.abortSignal?.throwIfAborted();
|
|
491
|
+
const current = next;
|
|
492
|
+
const page = await list(
|
|
493
|
+
{ ...current, includeSummary: false },
|
|
494
|
+
requestOptions
|
|
495
|
+
);
|
|
496
|
+
const pagination = page.pagination;
|
|
497
|
+
if (!Array.isArray(page.items) || typeof pagination?.hasMore !== "boolean")
|
|
498
|
+
throw new Error("Invalid product page response.");
|
|
499
|
+
if (pagination.hasMore) {
|
|
500
|
+
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))
|
|
501
|
+
throw new Error("Product pagination did not advance.");
|
|
502
|
+
const continuation = {
|
|
503
|
+
...current,
|
|
504
|
+
offset: pagination.nextOffset
|
|
505
|
+
};
|
|
506
|
+
if (pagination.nextCursor) continuation.cursor = pagination.nextCursor;
|
|
507
|
+
else delete continuation.cursor;
|
|
508
|
+
next = continuation;
|
|
509
|
+
} else next = null;
|
|
510
|
+
items.push(...page.items);
|
|
511
|
+
pagesRead++;
|
|
512
|
+
await onProgress?.(progress(), [...page.items]);
|
|
513
|
+
}
|
|
514
|
+
return { ...progress(), items };
|
|
515
|
+
} catch (cause) {
|
|
516
|
+
throw new ProductScanError({ ...progress(), items }, cause);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// src/product-batches.ts
|
|
521
|
+
function validateItems(items) {
|
|
522
|
+
if (!Array.isArray(items) || items.length < 1 || items.length > 100)
|
|
523
|
+
throw new RangeError("Provide between 1 and 100 products per batch.");
|
|
524
|
+
}
|
|
525
|
+
function normalizeProductId(value) {
|
|
526
|
+
if (typeof value !== "string" || !value.trim() || value.trim().length > 160)
|
|
527
|
+
throw new TypeError(
|
|
528
|
+
"Each product ID must be a nonempty string of at most 160 characters."
|
|
529
|
+
);
|
|
530
|
+
return value.trim();
|
|
531
|
+
}
|
|
532
|
+
function requestsForIds(request) {
|
|
533
|
+
if ("productId" in request)
|
|
534
|
+
throw new TypeError("Use productIds, not productId, for a batch.");
|
|
535
|
+
const { productIds, ...shared } = request;
|
|
536
|
+
validateItems(productIds);
|
|
537
|
+
return [...new Set(Array.from(productIds, normalizeProductId))].map(
|
|
538
|
+
(productId) => ({
|
|
539
|
+
...shared,
|
|
540
|
+
productId
|
|
541
|
+
})
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
var record = (value) => value !== null && typeof value === "object" ? value : {};
|
|
545
|
+
function jobIdsFrom(value) {
|
|
546
|
+
const response = record(value);
|
|
547
|
+
const data = record(response.data);
|
|
548
|
+
const targets = Array.isArray(data.results) ? data.results.map(record) : [];
|
|
549
|
+
return [
|
|
550
|
+
...new Set(
|
|
551
|
+
[
|
|
552
|
+
response.jobId,
|
|
553
|
+
data.jobBatchId,
|
|
554
|
+
...targets.flatMap((target) => [
|
|
555
|
+
target.jobId,
|
|
556
|
+
...Array.isArray(target.correlations) ? target.correlations.map((correlation) => record(correlation).id) : []
|
|
557
|
+
])
|
|
558
|
+
].filter((id) => typeof id === "string" && id.length > 0)
|
|
559
|
+
)
|
|
560
|
+
];
|
|
561
|
+
}
|
|
562
|
+
async function runProductBatch(operation, requests, successKey, options = {}) {
|
|
563
|
+
const { concurrency = 3, ...requestOptions } = options;
|
|
564
|
+
if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 10)
|
|
565
|
+
throw new RangeError("concurrency must be an integer between 1 and 10.");
|
|
566
|
+
const results = new Array(requests.length);
|
|
567
|
+
let next = 0;
|
|
568
|
+
const worker = async () => {
|
|
569
|
+
while (next < requests.length) {
|
|
570
|
+
const index = next++;
|
|
571
|
+
const request = requests[index];
|
|
572
|
+
let attempted = false;
|
|
573
|
+
try {
|
|
574
|
+
requestOptions.abortSignal?.throwIfAborted();
|
|
575
|
+
attempted = true;
|
|
576
|
+
const data = await operation(request, requestOptions);
|
|
577
|
+
const success = record(data)[successKey] === true;
|
|
578
|
+
results[index] = {
|
|
579
|
+
productId: request.productId,
|
|
580
|
+
success,
|
|
581
|
+
attempted,
|
|
582
|
+
data,
|
|
583
|
+
jobIds: jobIdsFrom(data),
|
|
584
|
+
...success ? {} : { error: new OmniError({ body: data }) }
|
|
585
|
+
};
|
|
586
|
+
} catch (error) {
|
|
587
|
+
results[index] = {
|
|
588
|
+
productId: request.productId,
|
|
589
|
+
success: false,
|
|
590
|
+
attempted,
|
|
591
|
+
error,
|
|
592
|
+
jobIds: jobIdsFrom(
|
|
593
|
+
error instanceof OmniError ? error.body : void 0
|
|
594
|
+
)
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
await Promise.all(
|
|
600
|
+
Array.from({ length: Math.min(concurrency, requests.length) }, worker)
|
|
601
|
+
);
|
|
602
|
+
const succeededCount = results.filter((result) => result.success).length;
|
|
603
|
+
return {
|
|
604
|
+
success: succeededCount === requests.length,
|
|
605
|
+
productIds: requests.map((request) => request.productId),
|
|
606
|
+
succeededCount,
|
|
607
|
+
failedCount: requests.length - succeededCount,
|
|
608
|
+
results,
|
|
609
|
+
jobIds: [...new Set(results.flatMap((result) => result.jobIds))]
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
function batchPublishProducts(publish, request, options) {
|
|
613
|
+
return runProductBatch(publish, requestsForIds(request), "ok", options);
|
|
614
|
+
}
|
|
615
|
+
function batchDelistProducts(delist, request, options) {
|
|
616
|
+
return runProductBatch(delist, requestsForIds(request), "ok", options);
|
|
617
|
+
}
|
|
618
|
+
function batchUpdateProducts(update, request, options) {
|
|
619
|
+
if ("productId" in request || "productIds" in request)
|
|
620
|
+
throw new TypeError("Use updates for a batch of catalog edits.");
|
|
621
|
+
validateItems(request.updates);
|
|
622
|
+
const seen = /* @__PURE__ */ new Set();
|
|
623
|
+
const updates = Array.from(request.updates, (update2) => {
|
|
624
|
+
const productId = normalizeProductId(update2?.productId);
|
|
625
|
+
if (seen.has(productId))
|
|
626
|
+
throw new TypeError("Provide only one update per product ID.");
|
|
627
|
+
seen.add(productId);
|
|
628
|
+
return { ...update2, productId };
|
|
629
|
+
});
|
|
630
|
+
return runProductBatch(update, updates, "success", options);
|
|
631
|
+
}
|
|
632
|
+
|
|
462
633
|
// src/jobs.ts
|
|
463
634
|
var SUCCESS_STATUSES = /* @__PURE__ */ new Set([
|
|
464
635
|
"completed",
|
|
@@ -486,16 +657,16 @@ var JobFailedError = class extends OmniError {
|
|
|
486
657
|
};
|
|
487
658
|
function readJobStatus(payload) {
|
|
488
659
|
if (!payload || typeof payload !== "object") return void 0;
|
|
489
|
-
const
|
|
490
|
-
const nested =
|
|
660
|
+
const record2 = payload;
|
|
661
|
+
const nested = record2.data;
|
|
491
662
|
if (nested && typeof nested === "object") {
|
|
492
663
|
const nestedStatus = nested.status;
|
|
493
664
|
if (typeof nestedStatus === "string" && nestedStatus.trim()) {
|
|
494
665
|
return nestedStatus;
|
|
495
666
|
}
|
|
496
667
|
}
|
|
497
|
-
if (typeof
|
|
498
|
-
return
|
|
668
|
+
if (typeof record2.status === "string" && record2.status.trim()) {
|
|
669
|
+
return record2.status;
|
|
499
670
|
}
|
|
500
671
|
return void 0;
|
|
501
672
|
}
|
|
@@ -1105,6 +1276,180 @@ var AopClient = class {
|
|
|
1105
1276
|
});
|
|
1106
1277
|
}
|
|
1107
1278
|
};
|
|
1279
|
+
var ApiClient = class {
|
|
1280
|
+
constructor(_http) {
|
|
1281
|
+
__publicField(this, "_http", _http);
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Discover a published merchant agent
|
|
1285
|
+
*
|
|
1286
|
+
* A2A 1.0 Agent Card for any configured agent published to a customer deployment. Private model settings, prompts and publisher identity are excluded.
|
|
1287
|
+
*
|
|
1288
|
+
* `GET /api/embed/{deploymentId}/.well-known/agent-card.json`
|
|
1289
|
+
*/
|
|
1290
|
+
getEmbedwellKnownagentCardJson(request, requestOptions) {
|
|
1291
|
+
const { deploymentId } = request ?? {};
|
|
1292
|
+
return this._http.request({
|
|
1293
|
+
method: "GET",
|
|
1294
|
+
path: `/api/embed/${encodePathParam("deploymentId", deploymentId)}/.well-known/agent-card.json`,
|
|
1295
|
+
query: void 0,
|
|
1296
|
+
body: void 0,
|
|
1297
|
+
...mergeRequestOptions(requestOptions)
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Call a merchant agent using A2A
|
|
1302
|
+
*
|
|
1303
|
+
* Official A2A 1.0 JSON-RPC SendMessage, GetTask and CancelTask.
|
|
1304
|
+
|
|
1305
|
+
### Authentication
|
|
1306
|
+
|
|
1307
|
+
Uses the existing customer JWT from /api/embed/{deploymentId}/session; send the same Origin when creating and using the session.
|
|
1308
|
+
|
|
1309
|
+
### Messages
|
|
1310
|
+
|
|
1311
|
+
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.
|
|
1312
|
+
|
|
1313
|
+
Bot verification and storefront protection apply. Payment proofs belong in the checkout completion endpoint, outside model messages.
|
|
1314
|
+
|
|
1315
|
+
### Signed offers and buyer agents
|
|
1316
|
+
|
|
1317
|
+
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
|
|
1318
|
+
*
|
|
1319
|
+
* `POST /api/embed/{deploymentId}/a2a`
|
|
1320
|
+
*/
|
|
1321
|
+
embeda2a(request, requestOptions) {
|
|
1322
|
+
const { deploymentId, ...body } = request ?? {};
|
|
1323
|
+
return this._http.request({
|
|
1324
|
+
method: "POST",
|
|
1325
|
+
path: `/api/embed/${encodePathParam("deploymentId", deploymentId)}/a2a`,
|
|
1326
|
+
query: void 0,
|
|
1327
|
+
body,
|
|
1328
|
+
...mergeRequestOptions(requestOptions)
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Manage customer-owned purchase offers
|
|
1333
|
+
*
|
|
1334
|
+
* ### Operations
|
|
1335
|
+
|
|
1336
|
+
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.
|
|
1337
|
+
|
|
1338
|
+
### Results and safeguards
|
|
1339
|
+
|
|
1340
|
+
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.
|
|
1341
|
+
|
|
1342
|
+
### Payment
|
|
1343
|
+
|
|
1344
|
+
Completion reuses the existing Stripe ACP or x402 rail. Hosted card checkout requires this org
|
|
1345
|
+
*
|
|
1346
|
+
* `POST /api/embed/{deploymentId}/checkout-sessions/{operation}`
|
|
1347
|
+
*/
|
|
1348
|
+
embedcheckoutSessions(request, requestOptions) {
|
|
1349
|
+
const { deploymentId, operation, ...body } = request ?? {};
|
|
1350
|
+
return this._http.request({
|
|
1351
|
+
method: "POST",
|
|
1352
|
+
path: `/api/embed/${encodePathParam("deploymentId", deploymentId)}/checkout-sessions/${encodePathParam("operation", operation)}`,
|
|
1353
|
+
query: void 0,
|
|
1354
|
+
body,
|
|
1355
|
+
...mergeRequestOptions(requestOptions)
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
var BrandKitsClient = class {
|
|
1360
|
+
constructor(_http) {
|
|
1361
|
+
__publicField(this, "_http", _http);
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* List Brand Kits
|
|
1365
|
+
*
|
|
1366
|
+
* 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.
|
|
1367
|
+
*
|
|
1368
|
+
* `GET /api/v1/brand-kits`
|
|
1369
|
+
*/
|
|
1370
|
+
list(request = {}, requestOptions) {
|
|
1371
|
+
const { organizationId, q, limit, offset } = request ?? {};
|
|
1372
|
+
return this._http.request({
|
|
1373
|
+
method: "GET",
|
|
1374
|
+
path: "/api/v1/brand-kits",
|
|
1375
|
+
query: { organizationId, q, limit, offset },
|
|
1376
|
+
body: void 0,
|
|
1377
|
+
...mergeRequestOptions(requestOptions)
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Create Brand Kit
|
|
1382
|
+
*
|
|
1383
|
+
* Create a full brand kit with optional imageSourceUrls. Requires branding:write. All brandKit fields are supported; omitted fields receive canonical defaults.
|
|
1384
|
+
|
|
1385
|
+
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.
|
|
1386
|
+
*
|
|
1387
|
+
* `POST /api/v1/brand-kits`
|
|
1388
|
+
*/
|
|
1389
|
+
create(request, requestOptions) {
|
|
1390
|
+
const { ...body } = request ?? {};
|
|
1391
|
+
return this._http.request({
|
|
1392
|
+
method: "POST",
|
|
1393
|
+
path: "/api/v1/brand-kits",
|
|
1394
|
+
query: void 0,
|
|
1395
|
+
body,
|
|
1396
|
+
...mergeRequestOptions(requestOptions)
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Delete Brand Kit
|
|
1401
|
+
*
|
|
1402
|
+
* Delete the organization-owned kit and its saved brand image-source websites. Requires branding:write. Historical job snapshots are preserved.
|
|
1403
|
+
*
|
|
1404
|
+
* `DELETE /api/v1/brand-kits/{brandKitId}`
|
|
1405
|
+
*/
|
|
1406
|
+
delete(request, requestOptions) {
|
|
1407
|
+
const { brandKitId, organizationId } = request ?? {};
|
|
1408
|
+
return this._http.request({
|
|
1409
|
+
method: "DELETE",
|
|
1410
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1411
|
+
query: { organizationId },
|
|
1412
|
+
body: void 0,
|
|
1413
|
+
...mergeRequestOptions(requestOptions)
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Get Brand Kit
|
|
1418
|
+
*
|
|
1419
|
+
* Read the complete kit and imageSourceUrls. Requires branding:read.
|
|
1420
|
+
*
|
|
1421
|
+
* `GET /api/v1/brand-kits/{brandKitId}`
|
|
1422
|
+
*/
|
|
1423
|
+
get(request, requestOptions) {
|
|
1424
|
+
const { brandKitId, organizationId } = request ?? {};
|
|
1425
|
+
return this._http.request({
|
|
1426
|
+
method: "GET",
|
|
1427
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1428
|
+
query: { organizationId },
|
|
1429
|
+
body: void 0,
|
|
1430
|
+
...mergeRequestOptions(requestOptions)
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
/**
|
|
1434
|
+
* Update Brand Kit
|
|
1435
|
+
*
|
|
1436
|
+
* Edit name, any nested brandKit fields, and imageSourceUrls. Requires branding:write. Nested objects merge and arrays replace; omitted fields are preserved.
|
|
1437
|
+
|
|
1438
|
+
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.
|
|
1439
|
+
*
|
|
1440
|
+
* `PATCH /api/v1/brand-kits/{brandKitId}`
|
|
1441
|
+
*/
|
|
1442
|
+
update(request, requestOptions) {
|
|
1443
|
+
const { brandKitId, ...body } = request ?? {};
|
|
1444
|
+
return this._http.request({
|
|
1445
|
+
method: "PATCH",
|
|
1446
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1447
|
+
query: void 0,
|
|
1448
|
+
body,
|
|
1449
|
+
...mergeRequestOptions(requestOptions)
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1108
1453
|
var BrandsgatewayClient = class {
|
|
1109
1454
|
constructor(_http) {
|
|
1110
1455
|
__publicField(this, "_http", _http);
|
|
@@ -1390,7 +1735,7 @@ var CheckoutSessionsClient = class {
|
|
|
1390
1735
|
/**
|
|
1391
1736
|
* Complete Agentic Checkout Session
|
|
1392
1737
|
*
|
|
1393
|
-
* Settle the selected rail and create a native `agentic` order.
|
|
1738
|
+
* 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.
|
|
1394
1739
|
*
|
|
1395
1740
|
* `POST /api/v1/checkout-sessions/{sessionId}/complete`
|
|
1396
1741
|
*/
|
|
@@ -1555,6 +1900,56 @@ var ImagesClient = class {
|
|
|
1555
1900
|
});
|
|
1556
1901
|
}
|
|
1557
1902
|
};
|
|
1903
|
+
var InventoryClient = class {
|
|
1904
|
+
constructor(_http) {
|
|
1905
|
+
__publicField(this, "_http", _http);
|
|
1906
|
+
}
|
|
1907
|
+
/**
|
|
1908
|
+
* List Inventory Groups
|
|
1909
|
+
*
|
|
1910
|
+
* 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.
|
|
1911
|
+
|
|
1912
|
+
### Stock and listing absence
|
|
1913
|
+
|
|
1914
|
+
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.
|
|
1915
|
+
|
|
1916
|
+
listingPresence reports saved-catalog evidence and unknown missing-SKU families. It does not establish fresh live marketplace absence. Stock quantities fro
|
|
1917
|
+
*
|
|
1918
|
+
* `GET /api/v1/inventory`
|
|
1919
|
+
*/
|
|
1920
|
+
list(request = {}, requestOptions) {
|
|
1921
|
+
const {
|
|
1922
|
+
productIds,
|
|
1923
|
+
query,
|
|
1924
|
+
marketplace,
|
|
1925
|
+
country,
|
|
1926
|
+
storeIds,
|
|
1927
|
+
unlistedMarketplaces,
|
|
1928
|
+
groupBy,
|
|
1929
|
+
status,
|
|
1930
|
+
offset,
|
|
1931
|
+
limit
|
|
1932
|
+
} = request ?? {};
|
|
1933
|
+
return this._http.request({
|
|
1934
|
+
method: "GET",
|
|
1935
|
+
path: "/api/v1/inventory",
|
|
1936
|
+
query: {
|
|
1937
|
+
productIds,
|
|
1938
|
+
query,
|
|
1939
|
+
marketplace,
|
|
1940
|
+
country,
|
|
1941
|
+
storeIds,
|
|
1942
|
+
unlistedMarketplaces,
|
|
1943
|
+
groupBy,
|
|
1944
|
+
status,
|
|
1945
|
+
offset,
|
|
1946
|
+
limit
|
|
1947
|
+
},
|
|
1948
|
+
body: void 0,
|
|
1949
|
+
...mergeRequestOptions(requestOptions)
|
|
1950
|
+
});
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1558
1953
|
var JobsClient = class {
|
|
1559
1954
|
constructor(_http) {
|
|
1560
1955
|
__publicField(this, "_http", _http);
|
|
@@ -2059,6 +2454,104 @@ var OrdersClient = class {
|
|
|
2059
2454
|
...mergeRequestOptions(requestOptions)
|
|
2060
2455
|
});
|
|
2061
2456
|
}
|
|
2457
|
+
/**
|
|
2458
|
+
* Check Order Action Options
|
|
2459
|
+
*
|
|
2460
|
+
* ### Authorization
|
|
2461
|
+
|
|
2462
|
+
Requires orders:write.
|
|
2463
|
+
|
|
2464
|
+
### Choices
|
|
2465
|
+
|
|
2466
|
+
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.
|
|
2467
|
+
*
|
|
2468
|
+
* `GET /api/v1/orders/actions`
|
|
2469
|
+
*/
|
|
2470
|
+
listBatchActionOptions(request, requestOptions) {
|
|
2471
|
+
const { orderIds, action, organizationId } = request ?? {};
|
|
2472
|
+
return this._http.request({
|
|
2473
|
+
method: "GET",
|
|
2474
|
+
path: "/api/v1/orders/actions",
|
|
2475
|
+
query: { orderIds, action, organizationId },
|
|
2476
|
+
body: void 0,
|
|
2477
|
+
...mergeRequestOptions(requestOptions)
|
|
2478
|
+
});
|
|
2479
|
+
}
|
|
2480
|
+
/**
|
|
2481
|
+
* Process Order Actions
|
|
2482
|
+
*
|
|
2483
|
+
* ### Authorization
|
|
2484
|
+
|
|
2485
|
+
Requires orders:write.
|
|
2486
|
+
|
|
2487
|
+
### Batch submission
|
|
2488
|
+
|
|
2489
|
+
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.
|
|
2490
|
+
|
|
2491
|
+
### Recovery and completion
|
|
2492
|
+
|
|
2493
|
+
Retain requestId and unchanged operations for retr
|
|
2494
|
+
*
|
|
2495
|
+
* `POST /api/v1/orders/actions`
|
|
2496
|
+
*/
|
|
2497
|
+
processActions(request, requestOptions) {
|
|
2498
|
+
const { ...body } = request ?? {};
|
|
2499
|
+
return this._http.request({
|
|
2500
|
+
method: "POST",
|
|
2501
|
+
path: "/api/v1/orders/actions",
|
|
2502
|
+
query: void 0,
|
|
2503
|
+
body,
|
|
2504
|
+
...mergeRequestOptions(requestOptions)
|
|
2505
|
+
});
|
|
2506
|
+
}
|
|
2507
|
+
/**
|
|
2508
|
+
* Get Order Action Jobs
|
|
2509
|
+
*
|
|
2510
|
+
* ### Authorization
|
|
2511
|
+
|
|
2512
|
+
Requires orders:read.
|
|
2513
|
+
|
|
2514
|
+
### Outcomes and labels
|
|
2515
|
+
|
|
2516
|
+
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.
|
|
2517
|
+
*
|
|
2518
|
+
* `GET /api/v1/orders/actions/jobs`
|
|
2519
|
+
*/
|
|
2520
|
+
getActionJobs(request, requestOptions) {
|
|
2521
|
+
const { jobIds, organizationId } = request ?? {};
|
|
2522
|
+
return this._http.request({
|
|
2523
|
+
method: "GET",
|
|
2524
|
+
path: "/api/v1/orders/actions/jobs",
|
|
2525
|
+
query: { jobIds, organizationId },
|
|
2526
|
+
body: void 0,
|
|
2527
|
+
...mergeRequestOptions(requestOptions)
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
/**
|
|
2531
|
+
* Create Picking List
|
|
2532
|
+
*
|
|
2533
|
+
* ### Authorization
|
|
2534
|
+
|
|
2535
|
+
Requires orders:read. API keys resolve organization scope from their credential; session callers include organizationId.
|
|
2536
|
+
|
|
2537
|
+
### PDF output
|
|
2538
|
+
|
|
2539
|
+
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.
|
|
2540
|
+
|
|
2541
|
+
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
|
|
2542
|
+
*
|
|
2543
|
+
* `POST /api/v1/orders/picking-list`
|
|
2544
|
+
*/
|
|
2545
|
+
createPickingList(request, requestOptions) {
|
|
2546
|
+
const { ...body } = request ?? {};
|
|
2547
|
+
return this._http.request({
|
|
2548
|
+
method: "POST",
|
|
2549
|
+
path: "/api/v1/orders/picking-list",
|
|
2550
|
+
query: void 0,
|
|
2551
|
+
body,
|
|
2552
|
+
...mergeRequestOptions(requestOptions)
|
|
2553
|
+
});
|
|
2554
|
+
}
|
|
2062
2555
|
};
|
|
2063
2556
|
var OrganizationsClient = class {
|
|
2064
2557
|
constructor(_http) {
|
|
@@ -2239,7 +2732,19 @@ var ProductsClient = class {
|
|
|
2239
2732
|
maxPrice,
|
|
2240
2733
|
sortBy,
|
|
2241
2734
|
limit,
|
|
2242
|
-
offset
|
|
2735
|
+
offset,
|
|
2736
|
+
store,
|
|
2737
|
+
storeKeys,
|
|
2738
|
+
brands,
|
|
2739
|
+
bundleType,
|
|
2740
|
+
language,
|
|
2741
|
+
hasImage,
|
|
2742
|
+
stock,
|
|
2743
|
+
publishedFrom,
|
|
2744
|
+
publishedTo,
|
|
2745
|
+
publishedTimeZone,
|
|
2746
|
+
cursor,
|
|
2747
|
+
includeSummary
|
|
2243
2748
|
} = request ?? {};
|
|
2244
2749
|
return this._http.request({
|
|
2245
2750
|
method: "GET",
|
|
@@ -2254,7 +2759,19 @@ var ProductsClient = class {
|
|
|
2254
2759
|
maxPrice,
|
|
2255
2760
|
sortBy,
|
|
2256
2761
|
limit,
|
|
2257
|
-
offset
|
|
2762
|
+
offset,
|
|
2763
|
+
store,
|
|
2764
|
+
storeKeys,
|
|
2765
|
+
brands,
|
|
2766
|
+
bundleType,
|
|
2767
|
+
language,
|
|
2768
|
+
hasImage,
|
|
2769
|
+
stock,
|
|
2770
|
+
publishedFrom,
|
|
2771
|
+
publishedTo,
|
|
2772
|
+
publishedTimeZone,
|
|
2773
|
+
cursor,
|
|
2774
|
+
includeSummary
|
|
2258
2775
|
},
|
|
2259
2776
|
body: void 0,
|
|
2260
2777
|
...mergeRequestOptions(requestOptions)
|
|
@@ -2508,18 +3025,14 @@ var ProductsClient = class {
|
|
|
2508
3025
|
*
|
|
2509
3026
|
* Queue a bulk product import for the authenticated organization.
|
|
2510
3027
|
|
|
3028
|
+
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.
|
|
3029
|
+
|
|
2511
3030
|
### Input options
|
|
2512
3031
|
|
|
2513
3032
|
- Upload a CSV (2 MiB) or JSON products file (8 MiB) using `multipart/form-data`.
|
|
2514
3033
|
- Send JSON with a `products` array of 1–5,000 flat product objects (8 MiB request maximum).
|
|
2515
3034
|
- Send JSON with inline `csvText`.
|
|
2516
|
-
- Send
|
|
2517
|
-
|
|
2518
|
-
### Asynchronous result
|
|
2519
|
-
|
|
2520
|
-
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}`.
|
|
2521
|
-
|
|
2522
|
-
Cancel an in-flight import with `POST /api/v1/jobs/{jobId}/cancel`.
|
|
3035
|
+
- Send
|
|
2523
3036
|
*
|
|
2524
3037
|
* `POST /api/v1/products/bulk-import`
|
|
2525
3038
|
*/
|
|
@@ -2533,6 +3046,54 @@ var ProductsClient = class {
|
|
|
2533
3046
|
...mergeRequestOptions(requestOptions)
|
|
2534
3047
|
});
|
|
2535
3048
|
}
|
|
3049
|
+
/**
|
|
3050
|
+
* Get Import Retry Progress
|
|
3051
|
+
*
|
|
3052
|
+
* 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.
|
|
3053
|
+
|
|
3054
|
+
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.
|
|
3055
|
+
*
|
|
3056
|
+
* `GET /api/v1/products/bulk-import/retries/{retryJobId}`
|
|
3057
|
+
*/
|
|
3058
|
+
getBulkImportRetry(request, requestOptions) {
|
|
3059
|
+
const { retryJobId, organizationId } = request ?? {};
|
|
3060
|
+
return this._http.request({
|
|
3061
|
+
method: "GET",
|
|
3062
|
+
path: `/api/v1/products/bulk-import/retries/${encodePathParam("retryJobId", retryJobId)}`,
|
|
3063
|
+
query: { organizationId },
|
|
3064
|
+
body: void 0,
|
|
3065
|
+
...mergeRequestOptions(requestOptions)
|
|
3066
|
+
});
|
|
3067
|
+
}
|
|
3068
|
+
/**
|
|
3069
|
+
* Retry Failed Import or Review Jobs
|
|
3070
|
+
*
|
|
3071
|
+
* Retry 1–20 jobs with durable background execution. Requires catalog:write.
|
|
3072
|
+
|
|
3073
|
+
### Targets
|
|
3074
|
+
|
|
3075
|
+
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.
|
|
3076
|
+
|
|
3077
|
+
### Retry scope
|
|
3078
|
+
|
|
3079
|
+
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.
|
|
3080
|
+
|
|
3081
|
+
### Results
|
|
3082
|
+
|
|
3083
|
+
Use the returned ord
|
|
3084
|
+
*
|
|
3085
|
+
* `POST /api/v1/products/bulk-import/retry`
|
|
3086
|
+
*/
|
|
3087
|
+
retryBulkImport(request, requestOptions) {
|
|
3088
|
+
const { ...body } = request ?? {};
|
|
3089
|
+
return this._http.request({
|
|
3090
|
+
method: "POST",
|
|
3091
|
+
path: "/api/v1/products/bulk-import/retry",
|
|
3092
|
+
query: void 0,
|
|
3093
|
+
body,
|
|
3094
|
+
...mergeRequestOptions(requestOptions)
|
|
3095
|
+
});
|
|
3096
|
+
}
|
|
2536
3097
|
/**
|
|
2537
3098
|
* Compare Product Market Prices
|
|
2538
3099
|
*
|
|
@@ -2604,6 +3165,63 @@ var ProductsClient = class {
|
|
|
2604
3165
|
...mergeRequestOptions(requestOptions)
|
|
2605
3166
|
});
|
|
2606
3167
|
}
|
|
3168
|
+
/**
|
|
3169
|
+
* Count Products
|
|
3170
|
+
*
|
|
3171
|
+
* Count matching catalog parent products using the Products page's canonical filters and authorization, without loading rows, pricing, or location data.
|
|
3172
|
+
|
|
3173
|
+
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.
|
|
3174
|
+
|
|
3175
|
+
Authenticate with a read-only catalog credential; organization comes only from that credential.
|
|
3176
|
+
*
|
|
3177
|
+
* `GET /api/v1/products/count`
|
|
3178
|
+
*/
|
|
3179
|
+
count(request = {}, requestOptions) {
|
|
3180
|
+
const {
|
|
3181
|
+
status,
|
|
3182
|
+
marketplace,
|
|
3183
|
+
country,
|
|
3184
|
+
q,
|
|
3185
|
+
sku,
|
|
3186
|
+
minPrice,
|
|
3187
|
+
maxPrice,
|
|
3188
|
+
store,
|
|
3189
|
+
storeKeys,
|
|
3190
|
+
brands,
|
|
3191
|
+
bundleType,
|
|
3192
|
+
language,
|
|
3193
|
+
hasImage,
|
|
3194
|
+
stock,
|
|
3195
|
+
publishedFrom,
|
|
3196
|
+
publishedTo,
|
|
3197
|
+
publishedTimeZone
|
|
3198
|
+
} = request ?? {};
|
|
3199
|
+
return this._http.request({
|
|
3200
|
+
method: "GET",
|
|
3201
|
+
path: "/api/v1/products/count",
|
|
3202
|
+
query: {
|
|
3203
|
+
status,
|
|
3204
|
+
marketplace,
|
|
3205
|
+
country,
|
|
3206
|
+
q,
|
|
3207
|
+
sku,
|
|
3208
|
+
minPrice,
|
|
3209
|
+
maxPrice,
|
|
3210
|
+
store,
|
|
3211
|
+
storeKeys,
|
|
3212
|
+
brands,
|
|
3213
|
+
bundleType,
|
|
3214
|
+
language,
|
|
3215
|
+
hasImage,
|
|
3216
|
+
stock,
|
|
3217
|
+
publishedFrom,
|
|
3218
|
+
publishedTo,
|
|
3219
|
+
publishedTimeZone
|
|
3220
|
+
},
|
|
3221
|
+
body: void 0,
|
|
3222
|
+
...mergeRequestOptions(requestOptions)
|
|
3223
|
+
});
|
|
3224
|
+
}
|
|
2607
3225
|
/**
|
|
2608
3226
|
* Queue Product Enrichment
|
|
2609
3227
|
*
|
|
@@ -2611,9 +3229,9 @@ var ProductsClient = class {
|
|
|
2611
3229
|
|
|
2612
3230
|
### Enrichment options
|
|
2613
3231
|
|
|
2614
|
-
Fields, instructions and auto-apply settings use the canonical enrichment service. Exclude name from selectedFields to preserve titles. Weight and dimensions are always included;
|
|
3232
|
+
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.
|
|
2615
3233
|
|
|
2616
|
-
autoApplyHighConfidence defaults to false.
|
|
3234
|
+
autoApplyHighConfidence defaults to false.
|
|
2617
3235
|
*
|
|
2618
3236
|
* `POST /api/v1/products/enrich`
|
|
2619
3237
|
*/
|
|
@@ -2627,6 +3245,38 @@ var ProductsClient = class {
|
|
|
2627
3245
|
...mergeRequestOptions(requestOptions)
|
|
2628
3246
|
});
|
|
2629
3247
|
}
|
|
3248
|
+
/** Read a bounded chunk without summary classification; persist progress to resume. */
|
|
3249
|
+
scan(request = {}, options) {
|
|
3250
|
+
return scanProducts(
|
|
3251
|
+
(page, requestOptions) => this.list(page, requestOptions),
|
|
3252
|
+
request,
|
|
3253
|
+
options
|
|
3254
|
+
);
|
|
3255
|
+
}
|
|
3256
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3257
|
+
batchPublish(request, options) {
|
|
3258
|
+
return batchPublishProducts(
|
|
3259
|
+
(item, requestOptions) => this.publish(item, requestOptions),
|
|
3260
|
+
request,
|
|
3261
|
+
options
|
|
3262
|
+
);
|
|
3263
|
+
}
|
|
3264
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3265
|
+
batchDelist(request, options) {
|
|
3266
|
+
return batchDelistProducts(
|
|
3267
|
+
(item, requestOptions) => this.delist(item, requestOptions),
|
|
3268
|
+
request,
|
|
3269
|
+
options
|
|
3270
|
+
);
|
|
3271
|
+
}
|
|
3272
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3273
|
+
batchUpdate(request, options) {
|
|
3274
|
+
return batchUpdateProducts(
|
|
3275
|
+
(item, requestOptions) => this.update(item, requestOptions),
|
|
3276
|
+
request,
|
|
3277
|
+
options
|
|
3278
|
+
);
|
|
3279
|
+
}
|
|
2630
3280
|
};
|
|
2631
3281
|
var PromotionsClient = class {
|
|
2632
3282
|
constructor(_http) {
|
|
@@ -2862,6 +3512,96 @@ var ReturnsClient = class {
|
|
|
2862
3512
|
...mergeRequestOptions(requestOptions)
|
|
2863
3513
|
});
|
|
2864
3514
|
}
|
|
3515
|
+
/**
|
|
3516
|
+
* Check Return Actions
|
|
3517
|
+
*
|
|
3518
|
+
* ### Authorization
|
|
3519
|
+
|
|
3520
|
+
Requires orders:write.
|
|
3521
|
+
|
|
3522
|
+
### Eligibility
|
|
3523
|
+
|
|
3524
|
+
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,
|
|
3525
|
+
*
|
|
3526
|
+
* `GET /api/v1/returns/actions`
|
|
3527
|
+
*/
|
|
3528
|
+
listActions(request, requestOptions) {
|
|
3529
|
+
const { returnIds, organizationId } = request ?? {};
|
|
3530
|
+
return this._http.request({
|
|
3531
|
+
method: "GET",
|
|
3532
|
+
path: "/api/v1/returns/actions",
|
|
3533
|
+
query: { returnIds, organizationId },
|
|
3534
|
+
body: void 0,
|
|
3535
|
+
...mergeRequestOptions(requestOptions)
|
|
3536
|
+
});
|
|
3537
|
+
}
|
|
3538
|
+
/**
|
|
3539
|
+
* Process Returns
|
|
3540
|
+
*
|
|
3541
|
+
* ### Authorization
|
|
3542
|
+
|
|
3543
|
+
Requires orders:write.
|
|
3544
|
+
|
|
3545
|
+
### Submit decisions
|
|
3546
|
+
|
|
3547
|
+
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
|
|
3548
|
+
*
|
|
3549
|
+
* `POST /api/v1/returns/actions`
|
|
3550
|
+
*/
|
|
3551
|
+
process(request, requestOptions) {
|
|
3552
|
+
const { ...body } = request ?? {};
|
|
3553
|
+
return this._http.request({
|
|
3554
|
+
method: "POST",
|
|
3555
|
+
path: "/api/v1/returns/actions",
|
|
3556
|
+
query: void 0,
|
|
3557
|
+
body,
|
|
3558
|
+
...mergeRequestOptions(requestOptions)
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
/**
|
|
3562
|
+
* Get Return Action Jobs
|
|
3563
|
+
*
|
|
3564
|
+
* ### Authorization
|
|
3565
|
+
|
|
3566
|
+
Requires orders:read.
|
|
3567
|
+
|
|
3568
|
+
### Job outcomes
|
|
3569
|
+
|
|
3570
|
+
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.
|
|
3571
|
+
*
|
|
3572
|
+
* `GET /api/v1/returns/actions/jobs`
|
|
3573
|
+
*/
|
|
3574
|
+
getActionJobs(request, requestOptions) {
|
|
3575
|
+
const { jobIds, organizationId } = request ?? {};
|
|
3576
|
+
return this._http.request({
|
|
3577
|
+
method: "GET",
|
|
3578
|
+
path: "/api/v1/returns/actions/jobs",
|
|
3579
|
+
query: { jobIds, organizationId },
|
|
3580
|
+
body: void 0,
|
|
3581
|
+
...mergeRequestOptions(requestOptions)
|
|
3582
|
+
});
|
|
3583
|
+
}
|
|
3584
|
+
/**
|
|
3585
|
+
* Get Order Returns
|
|
3586
|
+
*
|
|
3587
|
+
* Requires orders:read. Read stored return requests for 1–50 order UUIDs using repeated orderIds query parameters.
|
|
3588
|
+
|
|
3589
|
+
### Return identity
|
|
3590
|
+
|
|
3591
|
+
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.
|
|
3592
|
+
*
|
|
3593
|
+
* `GET /api/v1/returns/orders`
|
|
3594
|
+
*/
|
|
3595
|
+
listForOrders(request, requestOptions) {
|
|
3596
|
+
const { orderIds, organizationId } = request ?? {};
|
|
3597
|
+
return this._http.request({
|
|
3598
|
+
method: "GET",
|
|
3599
|
+
path: "/api/v1/returns/orders",
|
|
3600
|
+
query: { orderIds, organizationId },
|
|
3601
|
+
body: void 0,
|
|
3602
|
+
...mergeRequestOptions(requestOptions)
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
2865
3605
|
};
|
|
2866
3606
|
var ReviewsClient = class {
|
|
2867
3607
|
constructor(_http) {
|
|
@@ -3456,6 +4196,8 @@ var OmniGeneratedClient = class {
|
|
|
3456
4196
|
__publicField(this, "agents");
|
|
3457
4197
|
__publicField(this, "analytics");
|
|
3458
4198
|
__publicField(this, "aop");
|
|
4199
|
+
__publicField(this, "api");
|
|
4200
|
+
__publicField(this, "brandKits");
|
|
3459
4201
|
__publicField(this, "brandsgateway");
|
|
3460
4202
|
__publicField(this, "campaigns");
|
|
3461
4203
|
__publicField(this, "catalog");
|
|
@@ -3466,6 +4208,7 @@ var OmniGeneratedClient = class {
|
|
|
3466
4208
|
__publicField(this, "evaluate");
|
|
3467
4209
|
__publicField(this, "feed");
|
|
3468
4210
|
__publicField(this, "images");
|
|
4211
|
+
__publicField(this, "inventory");
|
|
3469
4212
|
__publicField(this, "jobs");
|
|
3470
4213
|
__publicField(this, "looks");
|
|
3471
4214
|
__publicField(this, "marketplaces");
|
|
@@ -3491,6 +4234,8 @@ var OmniGeneratedClient = class {
|
|
|
3491
4234
|
this.agents = new AgentsClient(this._http);
|
|
3492
4235
|
this.analytics = new AnalyticsClient(this._http);
|
|
3493
4236
|
this.aop = new AopClient(this._http);
|
|
4237
|
+
this.api = new ApiClient(this._http);
|
|
4238
|
+
this.brandKits = new BrandKitsClient(this._http);
|
|
3494
4239
|
this.brandsgateway = new BrandsgatewayClient(this._http);
|
|
3495
4240
|
this.campaigns = new CampaignsClient(this._http);
|
|
3496
4241
|
this.catalog = new CatalogClient(this._http);
|
|
@@ -3501,6 +4246,7 @@ var OmniGeneratedClient = class {
|
|
|
3501
4246
|
this.evaluate = new EvaluateClient(this._http);
|
|
3502
4247
|
this.feed = new FeedClient(this._http);
|
|
3503
4248
|
this.images = new ImagesClient(this._http);
|
|
4249
|
+
this.inventory = new InventoryClient(this._http);
|
|
3504
4250
|
this.jobs = new JobsClient(this._http);
|
|
3505
4251
|
this.looks = new LooksClient(this._http);
|
|
3506
4252
|
this.marketplaces = new MarketplacesClient(this._http);
|
|
@@ -3546,8 +4292,8 @@ function headerValue(headers, name) {
|
|
|
3546
4292
|
if (typeof Headers !== "undefined" && headers instanceof Headers) {
|
|
3547
4293
|
return headers.get(name) ?? headers.get(name.toLowerCase()) ?? void 0;
|
|
3548
4294
|
}
|
|
3549
|
-
const
|
|
3550
|
-
const direct =
|
|
4295
|
+
const record2 = headers;
|
|
4296
|
+
const direct = record2[name] ?? record2[name.toLowerCase()];
|
|
3551
4297
|
if (Array.isArray(direct)) return direct[0];
|
|
3552
4298
|
return direct ?? void 0;
|
|
3553
4299
|
}
|
|
@@ -3635,6 +4381,6 @@ __export(api_exports, {
|
|
|
3635
4381
|
OmniGeneratedClient: () => OmniGeneratedClient
|
|
3636
4382
|
});
|
|
3637
4383
|
|
|
3638
|
-
export { BadGatewayError, BadRequestError, ForbiddenError, HttpResponsePromise, InternalServerError, JobFailedError, NotFoundError, api_exports as Omni, OmniClient, OmniEnvironment, OmniError, OmniTimeoutError, SDK_VERSION, ServiceUnavailableError, TooManyRequestsError, UnauthorizedError, UnprocessableEntityError, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, constructEvent, signWebhookPayload, verifyWebhookSignature };
|
|
4384
|
+
export { BadGatewayError, BadRequestError, ForbiddenError, HttpResponsePromise, InternalServerError, JobFailedError, NotFoundError, api_exports as Omni, OmniClient, OmniEnvironment, OmniError, OmniTimeoutError, ProductScanError, SDK_VERSION, ServiceUnavailableError, TooManyRequestsError, UnauthorizedError, UnprocessableEntityError, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, constructEvent, signWebhookPayload, verifyWebhookSignature };
|
|
3639
4385
|
//# sourceMappingURL=index.js.map
|
|
3640
4386
|
//# sourceMappingURL=index.js.map
|