@omni-commerce/sdk 0.17.0 → 0.19.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 +80 -0
- package/dist/index.cjs +313 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2890 -837
- package/dist/index.d.ts +2890 -837
- package/dist/index.js +313 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,6 +124,71 @@ console.log(completed.result?.success, completed.result?.results);
|
|
|
124
124
|
|
|
125
125
|
Omit `gl` to compare all recorded listing markets; `gl: "sg"` restricts research to Singapore. Global Zalora prices stay separate by country/currency. An India Shopify store selling in SGD is researched in Singapore. Read each product's `markets` array for its price evidence, research, comparison, and errors. Missing published price evidence is an explicit failure; a catalog fallback is never a verified listing price. Client timeouts leave the durable job running. [Full comparison guide](https://docs.omnicommerce.sg/sdk/typescript#market-price-comparison).
|
|
126
126
|
|
|
127
|
+
## Order fulfillment and picking lists
|
|
128
|
+
|
|
129
|
+
Available in SDK 0.18.0. Check choices for an exact batch, submit the reviewed operations, then inspect every returned job. Use `ship`, `cancel`, `labels`, or `update_tracking`; one operation per order is allowed in a batch (1–50). Reading choices and submitting require `orders:write`; job status and picking lists require `orders:read`.
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
const options = await client.orders.listBatchActionOptions({
|
|
133
|
+
orderIds,
|
|
134
|
+
action: "ship",
|
|
135
|
+
});
|
|
136
|
+
// Review options.data.results, choose payloads, and supply required fields.
|
|
137
|
+
// reviewedOperations: [{ orderId, action: "ship", payload: chosenPayload }]
|
|
138
|
+
const queued = await client.orders.processActions({
|
|
139
|
+
requestId: crypto.randomUUID(),
|
|
140
|
+
operations: reviewedOperations,
|
|
141
|
+
});
|
|
142
|
+
if (!queued.data) throw new Error("Missing order job results");
|
|
143
|
+
const progress = await client.orders.getActionJobs({
|
|
144
|
+
jobIds: queued.data.jobIds,
|
|
145
|
+
});
|
|
146
|
+
for (const job of progress.data?.results ?? []) {
|
|
147
|
+
for (const label of job.labels) console.log(label.url);
|
|
148
|
+
}
|
|
149
|
+
const picking = await client.orders.createPickingList(
|
|
150
|
+
{ orderIds, timeZone: "Asia/Singapore" },
|
|
151
|
+
{ timeoutInSeconds: 120 },
|
|
152
|
+
);
|
|
153
|
+
console.log(picking.data?.downloadUrl, picking.data?.expiresAt);
|
|
154
|
+
const returnRequests = await client.returns.listForOrders({ orderIds });
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Use a `labels` operation after shipment completes when the marketplace requires it. Label jobs provide files to download and print; no local printer is controlled. Poll all returned job IDs with backoff while `pendingCount` is positive. Submission success means accepted; job `data.success` means every requested job succeeded. Preserve requestId and unchanged operations for retries. Unsupported marketplace actions remain explicit per-order failures. Picking lists accept up to 500 orders and return a private PDF link valid for five minutes. Missing or inaccessible orders fail the entire picking list. See [Order fulfillment](https://docs.omnicommerce.sg/guides/order-fulfillment).
|
|
158
|
+
|
|
159
|
+
## Return processing
|
|
160
|
+
|
|
161
|
+
Available in SDK 0.18.0. Use one submission for a single return or up to 50 reviewed decisions. Checking and submitting require `orders:write`; job status requires `orders:read`.
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
// returnIds are OmniCommerce return UUIDs, not order IDs.
|
|
165
|
+
const checked = await client.returns.listActions({ returnIds });
|
|
166
|
+
// selectedDecisions comes from your review UI: [{ returnId, actionId }].
|
|
167
|
+
const operations = selectedDecisions.map((selected) => {
|
|
168
|
+
const result = checked.data?.results.find(
|
|
169
|
+
(item) => item.returnId === selected.returnId,
|
|
170
|
+
);
|
|
171
|
+
if (
|
|
172
|
+
!result?.success ||
|
|
173
|
+
!result.actions.some((a) => a.id === selected.actionId)
|
|
174
|
+
) {
|
|
175
|
+
throw new Error("Refresh and review this return before processing it");
|
|
176
|
+
}
|
|
177
|
+
return { ...selected, version: result.version };
|
|
178
|
+
});
|
|
179
|
+
const queued = await client.returns.process({
|
|
180
|
+
requestId: crypto.randomUUID(), // retain this key for safe retries
|
|
181
|
+
operations,
|
|
182
|
+
});
|
|
183
|
+
if (!queued.data) throw new Error("Missing return job results");
|
|
184
|
+
const progress = await client.returns.getActionJobs({
|
|
185
|
+
jobIds: queued.data.jobIds,
|
|
186
|
+
});
|
|
187
|
+
console.log(progress.data);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
An empty actions array means no current seller decision, including completed or cancelled returns. Read `limitation` for unsupported marketplace operations. Keep the same request key and operations after a transport failure. Check **every** returned job ID with backoff until `pendingCount` is zero; only `data.success: true` confirms all selected decisions succeeded. `needs_review` requires checking marketplace state before another decision. A processed decision may still leave later steps in the buyer return lifecycle. See [Return processing](https://docs.omnicommerce.sg/guides/return-processing).
|
|
191
|
+
|
|
127
192
|
## Batch publish, delist, and update
|
|
128
193
|
|
|
129
194
|
```ts
|
|
@@ -252,3 +317,18 @@ yarn sdk:generate
|
|
|
252
317
|
That refreshes `docs/openapi.json`, the OpenAPI TypeScript types, and `src/generated/resources.ts`.
|
|
253
318
|
|
|
254
319
|
With SDK 0.8.1, website widgets load saved Storefront appearance by deployment ID. Install the generated deployment-only snippet once; saving an agent or design change updates the next website load. Explicit appearance options override saved values. The `ready` promise resolves after configuration loads, or rejects on an error reported to `onError`.
|
|
320
|
+
|
|
321
|
+
## Commerce jobs and verification
|
|
322
|
+
|
|
323
|
+
SDK 0.19.0 adds the shared waiter and fresh marketplace state verifier. Pass every correlation returned by order/return submissions. Catalog jobs can join the wait batch; product state verification uses productIds/expected or per-product targets.
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
const correlations = submitted.data.correlations;
|
|
327
|
+
const progress = await client.commerce.awaitJobs({
|
|
328
|
+
correlations,
|
|
329
|
+
timeoutMs: 30000,
|
|
330
|
+
});
|
|
331
|
+
const verified = await client.commerce.verifyState({ correlations });
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Inspect every result and pending/failed counts. Acceptance alone does not establish marketplace state; uncertain outcomes must not be automatically resubmitted. See [Commerce verification](https://docs.omnicommerce.sg/guides/commerce-verification).
|
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.19.0";
|
|
39
39
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
40
40
|
|
|
41
41
|
// src/environments.ts
|
|
@@ -1278,6 +1278,86 @@ var AopClient = class {
|
|
|
1278
1278
|
});
|
|
1279
1279
|
}
|
|
1280
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
|
+
};
|
|
1281
1361
|
var BrandKitsClient = class {
|
|
1282
1362
|
constructor(_http) {
|
|
1283
1363
|
__publicField(this, "_http", _http);
|
|
@@ -1657,7 +1737,7 @@ var CheckoutSessionsClient = class {
|
|
|
1657
1737
|
/**
|
|
1658
1738
|
* Complete Agentic Checkout Session
|
|
1659
1739
|
*
|
|
1660
|
-
* 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.
|
|
1661
1741
|
*
|
|
1662
1742
|
* `POST /api/v1/checkout-sessions/{sessionId}/complete`
|
|
1663
1743
|
*/
|
|
@@ -1672,6 +1752,45 @@ var CheckoutSessionsClient = class {
|
|
|
1672
1752
|
});
|
|
1673
1753
|
}
|
|
1674
1754
|
};
|
|
1755
|
+
var CommerceClient = class {
|
|
1756
|
+
constructor(_http) {
|
|
1757
|
+
__publicField(this, "_http", _http);
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Await Commerce Jobs
|
|
1761
|
+
*
|
|
1762
|
+
* Wait for a mixed batch of returned commerce correlations: inventory_job, price_event, publish_job, delist_batch, store_switch, omni_delete, zalora_import, enrichment_batch, order_action and return_action. Maximum 50000 entries; IDs are trimmed and duplicates collapse by kind/id in first-requested order. timeoutMs=0 reads once; bounded waits allow up to 120000ms. Catalog jobs require catalog:read; order/return jobs require orders:read; mixed batches require both. Session callers include organizationId. Every job retains its target identity, status, errors and available label artifacts. Missing or inaccessible fulfillment jobs fail explicitly. needs_review is an uncertain outcome, never automatic success or authorization to resubmit. data.success describes completion; use state verification
|
|
1763
|
+
*
|
|
1764
|
+
* `POST /api/v1/commerce/jobs/await`
|
|
1765
|
+
*/
|
|
1766
|
+
awaitJobs(request, requestOptions) {
|
|
1767
|
+
const { ...body } = request ?? {};
|
|
1768
|
+
return this._http.request({
|
|
1769
|
+
method: "POST",
|
|
1770
|
+
path: "/api/v1/commerce/jobs/await",
|
|
1771
|
+
query: void 0,
|
|
1772
|
+
body,
|
|
1773
|
+
...mergeRequestOptions(requestOptions)
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* Verify Commerce State
|
|
1778
|
+
*
|
|
1779
|
+
* Perform fresh marketplace verification using the canonical services for every supported marketplace. For products provide productIds plus expected, or targets[{productId,expected}] for mixed values. For order and return operations provide their returned order_action/return_action correlations; product and fulfillment checks may share one request. Maximum 50000 entries per target array, with bounded concurrency. Catalog verification requires catalog:read; fulfillment verification requires orders:read; mixed batches require both. Session callers include organizationId. Missing, unauthorized, unsupported and unconfirmed targets fail explicitly. A return decision can be confirmed while later lifecycle steps remain pending. Labels confirm generated artifacts, not physical printing. Provider acc
|
|
1780
|
+
*
|
|
1781
|
+
* `POST /api/v1/commerce/state/verify`
|
|
1782
|
+
*/
|
|
1783
|
+
verifyState(request, requestOptions) {
|
|
1784
|
+
const { ...body } = request ?? {};
|
|
1785
|
+
return this._http.request({
|
|
1786
|
+
method: "POST",
|
|
1787
|
+
path: "/api/v1/commerce/state/verify",
|
|
1788
|
+
query: void 0,
|
|
1789
|
+
body,
|
|
1790
|
+
...mergeRequestOptions(requestOptions)
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
};
|
|
1675
1794
|
var CompareClient = class {
|
|
1676
1795
|
constructor(_http) {
|
|
1677
1796
|
__publicField(this, "_http", _http);
|
|
@@ -2376,6 +2495,104 @@ var OrdersClient = class {
|
|
|
2376
2495
|
...mergeRequestOptions(requestOptions)
|
|
2377
2496
|
});
|
|
2378
2497
|
}
|
|
2498
|
+
/**
|
|
2499
|
+
* Check Order Action Options
|
|
2500
|
+
*
|
|
2501
|
+
* ### Authorization
|
|
2502
|
+
|
|
2503
|
+
Requires orders:write.
|
|
2504
|
+
|
|
2505
|
+
### Choices
|
|
2506
|
+
|
|
2507
|
+
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.
|
|
2508
|
+
*
|
|
2509
|
+
* `GET /api/v1/orders/actions`
|
|
2510
|
+
*/
|
|
2511
|
+
listBatchActionOptions(request, requestOptions) {
|
|
2512
|
+
const { orderIds, action, organizationId } = request ?? {};
|
|
2513
|
+
return this._http.request({
|
|
2514
|
+
method: "GET",
|
|
2515
|
+
path: "/api/v1/orders/actions",
|
|
2516
|
+
query: { orderIds, action, organizationId },
|
|
2517
|
+
body: void 0,
|
|
2518
|
+
...mergeRequestOptions(requestOptions)
|
|
2519
|
+
});
|
|
2520
|
+
}
|
|
2521
|
+
/**
|
|
2522
|
+
* Process Order Actions
|
|
2523
|
+
*
|
|
2524
|
+
* ### Authorization
|
|
2525
|
+
|
|
2526
|
+
Requires orders:write.
|
|
2527
|
+
|
|
2528
|
+
### Batch submission
|
|
2529
|
+
|
|
2530
|
+
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.
|
|
2531
|
+
|
|
2532
|
+
### Recovery and completion
|
|
2533
|
+
|
|
2534
|
+
Retain requestId and unchanged operations for retr
|
|
2535
|
+
*
|
|
2536
|
+
* `POST /api/v1/orders/actions`
|
|
2537
|
+
*/
|
|
2538
|
+
processActions(request, requestOptions) {
|
|
2539
|
+
const { ...body } = request ?? {};
|
|
2540
|
+
return this._http.request({
|
|
2541
|
+
method: "POST",
|
|
2542
|
+
path: "/api/v1/orders/actions",
|
|
2543
|
+
query: void 0,
|
|
2544
|
+
body,
|
|
2545
|
+
...mergeRequestOptions(requestOptions)
|
|
2546
|
+
});
|
|
2547
|
+
}
|
|
2548
|
+
/**
|
|
2549
|
+
* Get Order Action Jobs
|
|
2550
|
+
*
|
|
2551
|
+
* ### Authorization
|
|
2552
|
+
|
|
2553
|
+
Requires orders:read.
|
|
2554
|
+
|
|
2555
|
+
### Outcomes and labels
|
|
2556
|
+
|
|
2557
|
+
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.
|
|
2558
|
+
*
|
|
2559
|
+
* `GET /api/v1/orders/actions/jobs`
|
|
2560
|
+
*/
|
|
2561
|
+
getActionJobs(request, requestOptions) {
|
|
2562
|
+
const { jobIds, organizationId } = request ?? {};
|
|
2563
|
+
return this._http.request({
|
|
2564
|
+
method: "GET",
|
|
2565
|
+
path: "/api/v1/orders/actions/jobs",
|
|
2566
|
+
query: { jobIds, organizationId },
|
|
2567
|
+
body: void 0,
|
|
2568
|
+
...mergeRequestOptions(requestOptions)
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
/**
|
|
2572
|
+
* Create Picking List
|
|
2573
|
+
*
|
|
2574
|
+
* ### Authorization
|
|
2575
|
+
|
|
2576
|
+
Requires orders:read. API keys resolve organization scope from their credential; session callers include organizationId.
|
|
2577
|
+
|
|
2578
|
+
### PDF output
|
|
2579
|
+
|
|
2580
|
+
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.
|
|
2581
|
+
|
|
2582
|
+
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
|
|
2583
|
+
*
|
|
2584
|
+
* `POST /api/v1/orders/picking-list`
|
|
2585
|
+
*/
|
|
2586
|
+
createPickingList(request, requestOptions) {
|
|
2587
|
+
const { ...body } = request ?? {};
|
|
2588
|
+
return this._http.request({
|
|
2589
|
+
method: "POST",
|
|
2590
|
+
path: "/api/v1/orders/picking-list",
|
|
2591
|
+
query: void 0,
|
|
2592
|
+
body,
|
|
2593
|
+
...mergeRequestOptions(requestOptions)
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2379
2596
|
};
|
|
2380
2597
|
var OrganizationsClient = class {
|
|
2381
2598
|
constructor(_http) {
|
|
@@ -3336,6 +3553,96 @@ var ReturnsClient = class {
|
|
|
3336
3553
|
...mergeRequestOptions(requestOptions)
|
|
3337
3554
|
});
|
|
3338
3555
|
}
|
|
3556
|
+
/**
|
|
3557
|
+
* Check Return Actions
|
|
3558
|
+
*
|
|
3559
|
+
* ### Authorization
|
|
3560
|
+
|
|
3561
|
+
Requires orders:write.
|
|
3562
|
+
|
|
3563
|
+
### Eligibility
|
|
3564
|
+
|
|
3565
|
+
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,
|
|
3566
|
+
*
|
|
3567
|
+
* `GET /api/v1/returns/actions`
|
|
3568
|
+
*/
|
|
3569
|
+
listActions(request, requestOptions) {
|
|
3570
|
+
const { returnIds, organizationId } = request ?? {};
|
|
3571
|
+
return this._http.request({
|
|
3572
|
+
method: "GET",
|
|
3573
|
+
path: "/api/v1/returns/actions",
|
|
3574
|
+
query: { returnIds, organizationId },
|
|
3575
|
+
body: void 0,
|
|
3576
|
+
...mergeRequestOptions(requestOptions)
|
|
3577
|
+
});
|
|
3578
|
+
}
|
|
3579
|
+
/**
|
|
3580
|
+
* Process Returns
|
|
3581
|
+
*
|
|
3582
|
+
* ### Authorization
|
|
3583
|
+
|
|
3584
|
+
Requires orders:write.
|
|
3585
|
+
|
|
3586
|
+
### Submit decisions
|
|
3587
|
+
|
|
3588
|
+
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
|
|
3589
|
+
*
|
|
3590
|
+
* `POST /api/v1/returns/actions`
|
|
3591
|
+
*/
|
|
3592
|
+
process(request, requestOptions) {
|
|
3593
|
+
const { ...body } = request ?? {};
|
|
3594
|
+
return this._http.request({
|
|
3595
|
+
method: "POST",
|
|
3596
|
+
path: "/api/v1/returns/actions",
|
|
3597
|
+
query: void 0,
|
|
3598
|
+
body,
|
|
3599
|
+
...mergeRequestOptions(requestOptions)
|
|
3600
|
+
});
|
|
3601
|
+
}
|
|
3602
|
+
/**
|
|
3603
|
+
* Get Return Action Jobs
|
|
3604
|
+
*
|
|
3605
|
+
* ### Authorization
|
|
3606
|
+
|
|
3607
|
+
Requires orders:read.
|
|
3608
|
+
|
|
3609
|
+
### Job outcomes
|
|
3610
|
+
|
|
3611
|
+
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.
|
|
3612
|
+
*
|
|
3613
|
+
* `GET /api/v1/returns/actions/jobs`
|
|
3614
|
+
*/
|
|
3615
|
+
getActionJobs(request, requestOptions) {
|
|
3616
|
+
const { jobIds, organizationId } = request ?? {};
|
|
3617
|
+
return this._http.request({
|
|
3618
|
+
method: "GET",
|
|
3619
|
+
path: "/api/v1/returns/actions/jobs",
|
|
3620
|
+
query: { jobIds, organizationId },
|
|
3621
|
+
body: void 0,
|
|
3622
|
+
...mergeRequestOptions(requestOptions)
|
|
3623
|
+
});
|
|
3624
|
+
}
|
|
3625
|
+
/**
|
|
3626
|
+
* Get Order Returns
|
|
3627
|
+
*
|
|
3628
|
+
* Requires orders:read. Read stored return requests for 1–50 order UUIDs using repeated orderIds query parameters.
|
|
3629
|
+
|
|
3630
|
+
### Return identity
|
|
3631
|
+
|
|
3632
|
+
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.
|
|
3633
|
+
*
|
|
3634
|
+
* `GET /api/v1/returns/orders`
|
|
3635
|
+
*/
|
|
3636
|
+
listForOrders(request, requestOptions) {
|
|
3637
|
+
const { orderIds, organizationId } = request ?? {};
|
|
3638
|
+
return this._http.request({
|
|
3639
|
+
method: "GET",
|
|
3640
|
+
path: "/api/v1/returns/orders",
|
|
3641
|
+
query: { orderIds, organizationId },
|
|
3642
|
+
body: void 0,
|
|
3643
|
+
...mergeRequestOptions(requestOptions)
|
|
3644
|
+
});
|
|
3645
|
+
}
|
|
3339
3646
|
};
|
|
3340
3647
|
var ReviewsClient = class {
|
|
3341
3648
|
constructor(_http) {
|
|
@@ -3930,11 +4237,13 @@ var OmniGeneratedClient = class {
|
|
|
3930
4237
|
__publicField(this, "agents");
|
|
3931
4238
|
__publicField(this, "analytics");
|
|
3932
4239
|
__publicField(this, "aop");
|
|
4240
|
+
__publicField(this, "api");
|
|
3933
4241
|
__publicField(this, "brandKits");
|
|
3934
4242
|
__publicField(this, "brandsgateway");
|
|
3935
4243
|
__publicField(this, "campaigns");
|
|
3936
4244
|
__publicField(this, "catalog");
|
|
3937
4245
|
__publicField(this, "checkoutSessions");
|
|
4246
|
+
__publicField(this, "commerce");
|
|
3938
4247
|
__publicField(this, "compare");
|
|
3939
4248
|
__publicField(this, "directory");
|
|
3940
4249
|
__publicField(this, "documents");
|
|
@@ -3967,11 +4276,13 @@ var OmniGeneratedClient = class {
|
|
|
3967
4276
|
this.agents = new AgentsClient(this._http);
|
|
3968
4277
|
this.analytics = new AnalyticsClient(this._http);
|
|
3969
4278
|
this.aop = new AopClient(this._http);
|
|
4279
|
+
this.api = new ApiClient(this._http);
|
|
3970
4280
|
this.brandKits = new BrandKitsClient(this._http);
|
|
3971
4281
|
this.brandsgateway = new BrandsgatewayClient(this._http);
|
|
3972
4282
|
this.campaigns = new CampaignsClient(this._http);
|
|
3973
4283
|
this.catalog = new CatalogClient(this._http);
|
|
3974
4284
|
this.checkoutSessions = new CheckoutSessionsClient(this._http);
|
|
4285
|
+
this.commerce = new CommerceClient(this._http);
|
|
3975
4286
|
this.compare = new CompareClient(this._http);
|
|
3976
4287
|
this.directory = new DirectoryClient(this._http);
|
|
3977
4288
|
this.documents = new DocumentsClient(this._http);
|