@01.software/sdk 0.1.9 → 0.2.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 +1 -1
- package/dist/{auth-Cxfq94pG.d.ts → auth-BC0CWHt_.d.ts} +1 -1
- package/dist/{auth-BnCTXZG0.d.cts → auth-BE80zCjC.d.cts} +1 -1
- package/dist/auth.d.cts +2 -2
- package/dist/auth.d.ts +2 -2
- package/dist/index.cjs +37 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -7
- package/dist/index.d.ts +44 -7
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.cts +1 -1
- package/dist/metadata.d.ts +1 -1
- package/dist/{payload-types-DcOQUD4x.d.cts → payload-types-BWJZhklJ.d.cts} +242 -176
- package/dist/{payload-types-DcOQUD4x.d.ts → payload-types-BWJZhklJ.d.ts} +242 -176
- package/dist/{webhook-xdgxEN8s.d.ts → webhook-CcdyGpCb.d.ts} +2 -2
- package/dist/{webhook-E1YlE_k1.d.cts → webhook-DMxUpnQD.d.cts} +2 -2
- package/dist/webhook.d.cts +2 -2
- package/dist/webhook.d.ts +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -371,7 +371,7 @@ const handler = createTypedWebhookHandler('orders', async (event) => {
|
|
|
371
371
|
| Carts | `carts`, `cart-items` |
|
|
372
372
|
| Commerce | `discounts`, `shipping-policies` |
|
|
373
373
|
| Content | `posts`, `post-categories`, `post-tags`, `post-images`, `documents`, `document-categories`, `document-images` |
|
|
374
|
-
| Media | `playlists`, `playlist-images`, `musics`, `
|
|
374
|
+
| Media | `playlists`, `playlist-images`, `musics`, `media` |
|
|
375
375
|
| Forms | `forms`, `form-submissions` |
|
|
376
376
|
|
|
377
377
|
## Utilities
|
package/dist/auth.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { J as JwtPayload, q as createApiKey, o as createServerToken, p as decodeServerToken, r as parseApiKey, v as verifyServerToken } from './auth-
|
|
1
|
+
export { J as JwtPayload, q as createApiKey, o as createServerToken, p as decodeServerToken, r as parseApiKey, v as verifyServerToken } from './auth-BE80zCjC.cjs';
|
|
2
2
|
import 'payload';
|
|
3
|
-
import './payload-types-
|
|
3
|
+
import './payload-types-BWJZhklJ.cjs';
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { J as JwtPayload, q as createApiKey, o as createServerToken, p as decodeServerToken, r as parseApiKey, v as verifyServerToken } from './auth-
|
|
1
|
+
export { J as JwtPayload, q as createApiKey, o as createServerToken, p as decodeServerToken, r as parseApiKey, v as verifyServerToken } from './auth-BC0CWHt_.js';
|
|
2
2
|
import 'payload';
|
|
3
|
-
import './payload-types-
|
|
3
|
+
import './payload-types-BWJZhklJ.js';
|
package/dist/index.cjs
CHANGED
|
@@ -88,6 +88,7 @@ __export(src_exports, {
|
|
|
88
88
|
CollectionQueryBuilder: () => CollectionQueryBuilder,
|
|
89
89
|
ConfigError: () => ConfigError,
|
|
90
90
|
CustomerAuth: () => CustomerAuth,
|
|
91
|
+
IMAGE_SIZES: () => IMAGE_SIZES,
|
|
91
92
|
NetworkError: () => NetworkError,
|
|
92
93
|
OrderApi: () => OrderApi,
|
|
93
94
|
ProductApi: () => ProductApi,
|
|
@@ -107,6 +108,8 @@ __export(src_exports, {
|
|
|
107
108
|
decodeServerToken: () => decodeServerToken,
|
|
108
109
|
formatOrderName: () => formatOrderName,
|
|
109
110
|
generateOrderNumber: () => generateOrderNumber,
|
|
111
|
+
getImageSrcSet: () => getImageSrcSet,
|
|
112
|
+
getImageUrl: () => getImageUrl,
|
|
110
113
|
getQueryClient: () => getQueryClient,
|
|
111
114
|
handleWebhook: () => handleWebhook,
|
|
112
115
|
isApiError: () => isApiError,
|
|
@@ -1111,6 +1114,7 @@ var COLLECTIONS = [
|
|
|
1111
1114
|
"product-categories",
|
|
1112
1115
|
"product-tags",
|
|
1113
1116
|
"product-images",
|
|
1117
|
+
"product-collections",
|
|
1114
1118
|
"brands",
|
|
1115
1119
|
"brand-logos",
|
|
1116
1120
|
"orders",
|
|
@@ -1140,8 +1144,6 @@ var COLLECTIONS = [
|
|
|
1140
1144
|
"playlists",
|
|
1141
1145
|
"playlist-images",
|
|
1142
1146
|
"musics",
|
|
1143
|
-
"galleries",
|
|
1144
|
-
"gallery-images",
|
|
1145
1147
|
"forms",
|
|
1146
1148
|
"form-submissions",
|
|
1147
1149
|
"media"
|
|
@@ -1882,6 +1884,39 @@ function createTypedWebhookHandler(collection, handler) {
|
|
|
1882
1884
|
});
|
|
1883
1885
|
}
|
|
1884
1886
|
|
|
1887
|
+
// src/utils/image.ts
|
|
1888
|
+
var IMAGE_SIZES = [384, 768, 1536];
|
|
1889
|
+
function getImageUrl(image, displayWidth, dpr = 1) {
|
|
1890
|
+
var _a;
|
|
1891
|
+
const target = displayWidth * dpr;
|
|
1892
|
+
const sizes = image.sizes;
|
|
1893
|
+
if (sizes) {
|
|
1894
|
+
for (const size of IMAGE_SIZES) {
|
|
1895
|
+
if (size >= target) {
|
|
1896
|
+
const entry = sizes[String(size)];
|
|
1897
|
+
if (entry == null ? void 0 : entry.url) return entry.url;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
return (_a = image.url) != null ? _a : "";
|
|
1902
|
+
}
|
|
1903
|
+
function getImageSrcSet(image) {
|
|
1904
|
+
const parts = [];
|
|
1905
|
+
const sizes = image.sizes;
|
|
1906
|
+
if (sizes) {
|
|
1907
|
+
for (const size of IMAGE_SIZES) {
|
|
1908
|
+
const entry = sizes[String(size)];
|
|
1909
|
+
if ((entry == null ? void 0 : entry.url) && entry.width) {
|
|
1910
|
+
parts.push(`${entry.url} ${entry.width}w`);
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
if (image.url && image.width) {
|
|
1915
|
+
parts.push(`${image.url} ${image.width}w`);
|
|
1916
|
+
}
|
|
1917
|
+
return parts.join(", ");
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1885
1920
|
// src/utils/order/generateOrderNumber.ts
|
|
1886
1921
|
var generateOrderNumber = () => {
|
|
1887
1922
|
var _a;
|