@01.software/sdk 0.26.0 → 0.28.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 +153 -4
- package/dist/analytics/react.cjs +249 -0
- package/dist/analytics/react.cjs.map +1 -0
- package/dist/analytics/react.d.cts +8 -0
- package/dist/analytics/react.d.ts +8 -0
- package/dist/analytics/react.js +228 -0
- package/dist/analytics/react.js.map +1 -0
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/{const-R3AyqOHY.d.ts → const-Cz9Ki_I7.d.cts} +6 -6
- package/dist/{const-CEiFBZMW.d.cts → const-mdQQtIOz.d.ts} +6 -6
- package/dist/{image-TT8lTsk5.d.cts → image-BDz2-AaO.d.cts} +1 -1
- package/dist/{image-TT8lTsk5.d.ts → image-BDz2-AaO.d.ts} +1 -1
- package/dist/index.cjs +97 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -10
- package/dist/index.d.ts +21 -10
- package/dist/index.js +97 -10
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-BF8VVFt6.d.cts → payload-types-BrSYb-sh.d.cts} +365 -122
- package/dist/{payload-types-BF8VVFt6.d.ts → payload-types-BrSYb-sh.d.ts} +365 -122
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js.map +1 -1
- package/dist/{server-DLdbWJVv.d.cts → server-BINWywT8.d.cts} +1 -1
- package/dist/{server-DLdbWJVv.d.ts → server-BINWywT8.d.ts} +1 -1
- package/dist/{server-CZrUwqDs.d.cts → server-C2Q9R-Lu.d.ts} +251 -9
- package/dist/{server-DULueNYi.d.ts → server-D369bCVJ.d.cts} +251 -9
- package/dist/server.cjs +79 -4
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +79 -4
- package/dist/server.js.map +1 -1
- package/dist/{types-CZ1laT6s.d.ts → types-BLUb4cYq.d.ts} +1 -1
- package/dist/{types-lPRgx_rC.d.cts → types-CW4PaIL7.d.cts} +1 -1
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.d.cts +1 -1
- package/dist/ui/canvas/server.d.ts +1 -1
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs.map +1 -1
- package/dist/ui/canvas.d.cts +3 -3
- package/dist/ui/canvas.d.ts +3 -3
- package/dist/ui/canvas.js.map +1 -1
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/image.d.cts +1 -1
- package/dist/ui/image.d.ts +1 -1
- package/dist/ui/video.d.cts +2 -2
- package/dist/ui/video.d.ts +2 -2
- package/dist/{video-DbLL8yuc.d.cts → video-WR_TFO9a.d.cts} +1 -1
- package/dist/{video-DbLL8yuc.d.ts → video-WR_TFO9a.d.ts} +1 -1
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +40 -24
package/dist/server.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import './payload-types-
|
|
1
|
+
export { E as ClientServerConfig, F as CollectionClient, o as CommunityClient, af as ModerationApi, aX as ServerClient, aY as ServerCollectionClient, a_ as ServerCommerceClient, bn as createServerClient } from './server-D369bCVJ.cjs';
|
|
2
|
+
import './payload-types-BrSYb-sh.cjs';
|
|
3
3
|
import '@tanstack/react-query';
|
|
4
4
|
import 'payload';
|
|
5
5
|
import 'next';
|
|
6
|
-
import './types-
|
|
7
|
-
import './const-
|
|
6
|
+
import './types-CW4PaIL7.cjs';
|
|
7
|
+
import './const-Cz9Ki_I7.cjs';
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import './payload-types-
|
|
1
|
+
export { E as ClientServerConfig, F as CollectionClient, o as CommunityClient, af as ModerationApi, aX as ServerClient, aY as ServerCollectionClient, a_ as ServerCommerceClient, bn as createServerClient } from './server-C2Q9R-Lu.js';
|
|
2
|
+
import './payload-types-BrSYb-sh.js';
|
|
3
3
|
import '@tanstack/react-query';
|
|
4
4
|
import 'payload';
|
|
5
5
|
import 'next';
|
|
6
|
-
import './types-
|
|
7
|
-
import './const-
|
|
6
|
+
import './types-BLUb4cYq.js';
|
|
7
|
+
import './const-mdQQtIOz.js';
|
package/dist/server.js
CHANGED
|
@@ -1342,6 +1342,32 @@ var ProductApi = class extends BaseApi {
|
|
|
1342
1342
|
params
|
|
1343
1343
|
);
|
|
1344
1344
|
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Fetch full product detail by slug or id.
|
|
1347
|
+
* Returns `null` on 404 regardless of reason (`not_found` / `not_published` /
|
|
1348
|
+
* `tenant_mismatch` / `feature_disabled`). For the reason behind a null,
|
|
1349
|
+
* inspect `client.lastRequestId` against backend logs.
|
|
1350
|
+
*/
|
|
1351
|
+
async detail(params) {
|
|
1352
|
+
try {
|
|
1353
|
+
return await this.request("/api/products/detail", params);
|
|
1354
|
+
} catch (err) {
|
|
1355
|
+
if (err instanceof NotFoundError) return null;
|
|
1356
|
+
throw err;
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Atomically create or update a product together with its options,
|
|
1361
|
+
* option-values, and variants in a single transaction. Mirrors Shopify's
|
|
1362
|
+
* `productSet` shape and is the canonical write path for the MCP
|
|
1363
|
+
* `product-upsert` tool.
|
|
1364
|
+
*/
|
|
1365
|
+
upsert(params) {
|
|
1366
|
+
return this.request(
|
|
1367
|
+
"/api/products/upsert",
|
|
1368
|
+
params
|
|
1369
|
+
);
|
|
1370
|
+
}
|
|
1345
1371
|
};
|
|
1346
1372
|
|
|
1347
1373
|
// src/core/api/discount-api.ts
|
|
@@ -1378,6 +1404,13 @@ var OrderApi = class extends BaseApi {
|
|
|
1378
1404
|
updateTransaction(params) {
|
|
1379
1405
|
return this.request("/api/transactions/update", params);
|
|
1380
1406
|
}
|
|
1407
|
+
confirmPayment(params) {
|
|
1408
|
+
return this.request(
|
|
1409
|
+
"/api/orders/confirm-payment",
|
|
1410
|
+
params,
|
|
1411
|
+
params.providerEventId ? { headers: { "X-Idempotency-Key": params.providerEventId } } : void 0
|
|
1412
|
+
);
|
|
1413
|
+
}
|
|
1381
1414
|
checkout(params) {
|
|
1382
1415
|
return this.request("/api/orders/checkout", params);
|
|
1383
1416
|
}
|
|
@@ -1427,7 +1460,9 @@ var ServerCommerceClient = class {
|
|
|
1427
1460
|
const orderApi = new OrderApi(serverOptions);
|
|
1428
1461
|
this.product = {
|
|
1429
1462
|
stockCheck: productApi.stockCheck.bind(productApi),
|
|
1430
|
-
listingGroups: productApi.listingGroups.bind(productApi)
|
|
1463
|
+
listingGroups: productApi.listingGroups.bind(productApi),
|
|
1464
|
+
detail: productApi.detail.bind(productApi),
|
|
1465
|
+
upsert: productApi.upsert.bind(productApi)
|
|
1431
1466
|
};
|
|
1432
1467
|
this.cart = {
|
|
1433
1468
|
get: cartApi.getCart.bind(cartApi),
|
|
@@ -1443,6 +1478,7 @@ var ServerCommerceClient = class {
|
|
|
1443
1478
|
create: orderApi.createOrder.bind(orderApi),
|
|
1444
1479
|
update: orderApi.updateOrder.bind(orderApi),
|
|
1445
1480
|
updateTransaction: orderApi.updateTransaction.bind(orderApi),
|
|
1481
|
+
confirmPayment: orderApi.confirmPayment.bind(orderApi),
|
|
1446
1482
|
createFulfillment: orderApi.createFulfillment.bind(orderApi),
|
|
1447
1483
|
updateFulfillment: orderApi.updateFulfillment.bind(orderApi),
|
|
1448
1484
|
bulkImportFulfillments: orderApi.bulkImportFulfillments.bind(orderApi),
|
|
@@ -1528,10 +1564,24 @@ var customerKeys = {
|
|
|
1528
1564
|
};
|
|
1529
1565
|
var productKeys = {
|
|
1530
1566
|
listingGroups: (options) => ["products", "listing-groups", "list", options],
|
|
1531
|
-
listingGroupsInfinite: (options) => ["products", "listing-groups", "infinite", options]
|
|
1567
|
+
listingGroupsInfinite: (options) => ["products", "listing-groups", "infinite", options],
|
|
1568
|
+
detail: (params) => ["products", "detail", params],
|
|
1569
|
+
detailAll: () => ["products", "detail"]
|
|
1532
1570
|
};
|
|
1533
1571
|
|
|
1534
1572
|
// src/core/query/collection-hooks.ts
|
|
1573
|
+
var PRODUCT_DETAIL_INVALIDATING_COLLECTIONS = /* @__PURE__ */ new Set([
|
|
1574
|
+
"products",
|
|
1575
|
+
"product-variants",
|
|
1576
|
+
"product-options",
|
|
1577
|
+
"product-option-values",
|
|
1578
|
+
"product-categories",
|
|
1579
|
+
"product-tags",
|
|
1580
|
+
"product-collections",
|
|
1581
|
+
"brands",
|
|
1582
|
+
"brand-logos",
|
|
1583
|
+
"images"
|
|
1584
|
+
]);
|
|
1535
1585
|
var DEFAULT_PAGE_SIZE = 20;
|
|
1536
1586
|
var CollectionHooks = class {
|
|
1537
1587
|
constructor(queryClient, collectionClient) {
|
|
@@ -1689,6 +1739,9 @@ var CollectionHooks = class {
|
|
|
1689
1739
|
this.queryClient.invalidateQueries({
|
|
1690
1740
|
queryKey: collectionKeys(collection).all
|
|
1691
1741
|
});
|
|
1742
|
+
if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
|
|
1743
|
+
this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
|
|
1744
|
+
}
|
|
1692
1745
|
options?.onSuccess?.(data);
|
|
1693
1746
|
},
|
|
1694
1747
|
onError: options?.onError,
|
|
@@ -1709,6 +1762,9 @@ var CollectionHooks = class {
|
|
|
1709
1762
|
this.queryClient.invalidateQueries({
|
|
1710
1763
|
queryKey: collectionKeys(collection).all
|
|
1711
1764
|
});
|
|
1765
|
+
if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
|
|
1766
|
+
this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
|
|
1767
|
+
}
|
|
1712
1768
|
options?.onSuccess?.(data);
|
|
1713
1769
|
},
|
|
1714
1770
|
onError: options?.onError,
|
|
@@ -1725,6 +1781,9 @@ var CollectionHooks = class {
|
|
|
1725
1781
|
this.queryClient.invalidateQueries({
|
|
1726
1782
|
queryKey: collectionKeys(collection).all
|
|
1727
1783
|
});
|
|
1784
|
+
if (PRODUCT_DETAIL_INVALIDATING_COLLECTIONS.has(collection)) {
|
|
1785
|
+
this.queryClient.invalidateQueries({ queryKey: ["products", "detail"] });
|
|
1786
|
+
}
|
|
1728
1787
|
options?.onSuccess?.(data);
|
|
1729
1788
|
},
|
|
1730
1789
|
onError: options?.onError,
|
|
@@ -1880,7 +1939,7 @@ var CustomerHooks = class {
|
|
|
1880
1939
|
|
|
1881
1940
|
// src/core/query/query-hooks.ts
|
|
1882
1941
|
var QueryHooks = class extends CollectionHooks {
|
|
1883
|
-
constructor(queryClient, collectionClient, customerAuth) {
|
|
1942
|
+
constructor(queryClient, collectionClient, customerAuth, commerceClient) {
|
|
1884
1943
|
super(queryClient, collectionClient);
|
|
1885
1944
|
// --- Customer hooks delegation ---
|
|
1886
1945
|
this.useCustomerMe = (...args) => this._customer.useCustomerMe(...args);
|
|
@@ -1897,6 +1956,7 @@ var QueryHooks = class extends CollectionHooks {
|
|
|
1897
1956
|
this.getCustomerData = () => this._customer.getCustomerData();
|
|
1898
1957
|
this.setCustomerData = (data) => this._customer.setCustomerData(data);
|
|
1899
1958
|
this._customer = new CustomerHooks(queryClient, customerAuth);
|
|
1959
|
+
this._commerce = commerceClient;
|
|
1900
1960
|
}
|
|
1901
1961
|
useProductListingGroupsQuery(params, options) {
|
|
1902
1962
|
const queryOptions = params.options;
|
|
@@ -1990,6 +2050,21 @@ var QueryHooks = class extends CollectionHooks {
|
|
|
1990
2050
|
staleTime: options?.staleTime
|
|
1991
2051
|
});
|
|
1992
2052
|
}
|
|
2053
|
+
useProductDetail(params, options) {
|
|
2054
|
+
const discriminator = "slug" in params ? params.slug : params.id;
|
|
2055
|
+
const enabled = options?.enabled !== false && Boolean(discriminator);
|
|
2056
|
+
return useQueryOriginal3({
|
|
2057
|
+
queryKey: productKeys.detail(params),
|
|
2058
|
+
queryFn: () => this._commerce.product.detail(params),
|
|
2059
|
+
enabled
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
useProductDetailBySlug(slug, options) {
|
|
2063
|
+
return this.useProductDetail({ slug }, options);
|
|
2064
|
+
}
|
|
2065
|
+
useProductDetailById(id, options) {
|
|
2066
|
+
return this.useProductDetail({ id }, options);
|
|
2067
|
+
}
|
|
1993
2068
|
};
|
|
1994
2069
|
|
|
1995
2070
|
// src/core/client/client.server.ts
|
|
@@ -2040,7 +2115,7 @@ var ServerClient = class {
|
|
|
2040
2115
|
onRequestId
|
|
2041
2116
|
);
|
|
2042
2117
|
this.queryClient = getQueryClient();
|
|
2043
|
-
this.query = new QueryHooks(this.queryClient, this.collections);
|
|
2118
|
+
this.query = new QueryHooks(this.queryClient, this.collections, void 0, this.commerce);
|
|
2044
2119
|
}
|
|
2045
2120
|
getState() {
|
|
2046
2121
|
return { ...this.state };
|