commerce-kit 0.67.0 → 0.67.1
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/dist/uploads.js +79 -21
- package/dist/uploads.js.map +1 -1
- package/package.json +4 -2
- package/dist/uploads.d.ts +0 -54
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "commerce-kit",
|
|
4
|
-
"version": "0.67.
|
|
4
|
+
"version": "0.67.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"keywords": [
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"@types/node": "^26.4.1",
|
|
70
70
|
"@types/react": "^19.2.18",
|
|
71
71
|
"@types/react-dom": "^19.2.7",
|
|
72
|
-
"@vercel/blob": "2.8.0",
|
|
73
72
|
"husky": "9.1.7",
|
|
74
73
|
"lint-staged": "17.4.1",
|
|
75
74
|
"react": "^19.2.8",
|
|
@@ -109,5 +108,8 @@
|
|
|
109
108
|
"*": [
|
|
110
109
|
"bun biome check --write --unsafe --staged --no-errors-on-unmatched --files-ignore-unknown=true"
|
|
111
110
|
]
|
|
111
|
+
},
|
|
112
|
+
"dependencies": {
|
|
113
|
+
"@vercel/blob": "^2.8.0"
|
|
112
114
|
}
|
|
113
115
|
}
|
package/dist/uploads.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shopper file uploads for personalised products (a photo for a portrait, a print-ready PDF).
|
|
3
|
-
*
|
|
4
|
-
* Browser-only. The storefront calls `uploadLineItemFile(file, { variantId })` from its product
|
|
5
|
-
* page; the platform hands out a short-lived token for exactly one file (its `/checkout/api/**`
|
|
6
|
-
* endpoint is already forwarded by every tenant's proxy, so the storefront needs no route of its
|
|
7
|
-
* own and no API key in the browser), and the file goes straight into the store's private storage.
|
|
8
|
-
* The returned `uploadId` is what a cart line's file property carries:
|
|
9
|
-
*
|
|
10
|
-
* ```ts
|
|
11
|
-
* const { uploadId } = await uploadLineItemFile(file, { variantId });
|
|
12
|
-
* await cartUpsert({ variantId, quantity: 1, properties: [lineItemFileProperty({ key: "photo", label: "Photo", uploadId })] });
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* Requires the store's Customer Uploads module. Images (JPEG, PNG, WebP, GIF, HEIC/HEIF, AVIF,
|
|
16
|
-
* TIFF) and PDF, up to 20 MB.
|
|
17
|
-
*/
|
|
18
|
-
declare const LINE_ITEM_UPLOAD_ENDPOINT = "/checkout/api/line-item-uploads";
|
|
19
|
-
declare const MAX_LINE_ITEM_UPLOAD_BYTES: number;
|
|
20
|
-
declare const ACCEPTED_LINE_ITEM_UPLOAD_TYPES: string;
|
|
21
|
-
declare class LineItemUploadError extends Error {
|
|
22
|
-
readonly status: number;
|
|
23
|
-
constructor(message: string, status: number);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Upload one file for a cart line. Throws `LineItemUploadError` with the platform's message and
|
|
27
|
-
* HTTP status (400 unsupported file, 404 uploads off for this store, 429 too many uploads).
|
|
28
|
-
*/
|
|
29
|
-
declare function uploadLineItemFile(file: File, options: {
|
|
30
|
-
variantId: string;
|
|
31
|
-
/** Defaults to the platform endpoint every tenant proxy forwards. */
|
|
32
|
-
endpoint?: string;
|
|
33
|
-
onUploadProgress?: (event: {
|
|
34
|
-
loaded: number;
|
|
35
|
-
total: number;
|
|
36
|
-
percentage: number;
|
|
37
|
-
}) => void;
|
|
38
|
-
abortSignal?: AbortSignal;
|
|
39
|
-
}): Promise<{
|
|
40
|
-
uploadId: string;
|
|
41
|
-
}>;
|
|
42
|
-
/** The cart line property that attaches an uploaded file. */
|
|
43
|
-
declare const lineItemFileProperty: ({ key, label, uploadId, }: {
|
|
44
|
-
key: string;
|
|
45
|
-
label?: string;
|
|
46
|
-
uploadId: string;
|
|
47
|
-
}) => {
|
|
48
|
-
key: string;
|
|
49
|
-
label?: string;
|
|
50
|
-
type: "file";
|
|
51
|
-
value: string;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export { ACCEPTED_LINE_ITEM_UPLOAD_TYPES, LINE_ITEM_UPLOAD_ENDPOINT, LineItemUploadError, MAX_LINE_ITEM_UPLOAD_BYTES, lineItemFileProperty, uploadLineItemFile };
|