commerce-kit 0.67.1 → 0.67.2
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.d.ts +54 -0
- package/dist/uploads.js +1 -80
- package/dist/uploads.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
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 };
|
package/dist/uploads.js
CHANGED
|
@@ -1,81 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
|
|
5
|
-
// src/uploads.ts
|
|
6
|
-
import { put } from "@vercel/blob/client";
|
|
7
|
-
var LINE_ITEM_UPLOAD_ENDPOINT = "/checkout/api/line-item-uploads";
|
|
8
|
-
var MAX_LINE_ITEM_UPLOAD_BYTES = 20 * 1024 * 1024;
|
|
9
|
-
var TYPE_BY_EXTENSION = {
|
|
10
|
-
jpg: "image/jpeg",
|
|
11
|
-
jpeg: "image/jpeg",
|
|
12
|
-
png: "image/png",
|
|
13
|
-
webp: "image/webp",
|
|
14
|
-
gif: "image/gif",
|
|
15
|
-
heic: "image/heic",
|
|
16
|
-
heif: "image/heif",
|
|
17
|
-
avif: "image/avif",
|
|
18
|
-
tif: "image/tiff",
|
|
19
|
-
tiff: "image/tiff",
|
|
20
|
-
pdf: "application/pdf"
|
|
21
|
-
};
|
|
22
|
-
var ACCEPTED_LINE_ITEM_UPLOAD_TYPES = [...new Set(Object.values(TYPE_BY_EXTENSION))].join(",");
|
|
23
|
-
var LineItemUploadError = class extends Error {
|
|
24
|
-
constructor(message, status) {
|
|
25
|
-
super(message);
|
|
26
|
-
__publicField(this, "status");
|
|
27
|
-
this.name = "LineItemUploadError";
|
|
28
|
-
this.status = status;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
var contentTypeOf = (file) => file.type || TYPE_BY_EXTENSION[file.name.split(".").pop()?.toLowerCase() ?? ""] || "";
|
|
32
|
-
var isTokenResponse = (value) => typeof value === "object" && value !== null && "uploadId" in value && typeof value.uploadId === "string" && "pathname" in value && typeof value.pathname === "string" && "clientToken" in value && typeof value.clientToken === "string";
|
|
33
|
-
var errorMessageOf = (value) => typeof value === "object" && value !== null && "error" in value && typeof value.error === "string" ? value.error : null;
|
|
34
|
-
async function uploadLineItemFile(file, options) {
|
|
35
|
-
const contentType = contentTypeOf(file);
|
|
36
|
-
if (!contentType) {
|
|
37
|
-
throw new LineItemUploadError("This file type can't be uploaded.", 400);
|
|
38
|
-
}
|
|
39
|
-
if (file.size > MAX_LINE_ITEM_UPLOAD_BYTES) {
|
|
40
|
-
throw new LineItemUploadError("The file is larger than 20 MB.", 400);
|
|
41
|
-
}
|
|
42
|
-
const response = await fetch(options.endpoint ?? LINE_ITEM_UPLOAD_ENDPOINT, {
|
|
43
|
-
method: "POST",
|
|
44
|
-
headers: { "Content-Type": "application/json" },
|
|
45
|
-
credentials: "same-origin",
|
|
46
|
-
body: JSON.stringify({ variantId: options.variantId, filename: file.name, contentType, size: file.size }),
|
|
47
|
-
...options.abortSignal ? { signal: options.abortSignal } : {}
|
|
48
|
-
});
|
|
49
|
-
const body = await response.json().catch(() => null);
|
|
50
|
-
if (!response.ok || !isTokenResponse(body)) {
|
|
51
|
-
throw new LineItemUploadError(errorMessageOf(body) ?? "The upload could not start.", response.status);
|
|
52
|
-
}
|
|
53
|
-
await put(body.pathname, file, {
|
|
54
|
-
access: "private",
|
|
55
|
-
token: body.clientToken,
|
|
56
|
-
contentType,
|
|
57
|
-
multipart: file.size > 8 * 1024 * 1024,
|
|
58
|
-
...options.onUploadProgress ? { onUploadProgress: options.onUploadProgress } : {},
|
|
59
|
-
...options.abortSignal ? { abortSignal: options.abortSignal } : {}
|
|
60
|
-
});
|
|
61
|
-
return { uploadId: body.uploadId };
|
|
62
|
-
}
|
|
63
|
-
var lineItemFileProperty = ({
|
|
64
|
-
key,
|
|
65
|
-
label,
|
|
66
|
-
uploadId
|
|
67
|
-
}) => ({
|
|
68
|
-
key,
|
|
69
|
-
...label !== void 0 ? { label } : {},
|
|
70
|
-
type: "file",
|
|
71
|
-
value: uploadId
|
|
72
|
-
});
|
|
73
|
-
export {
|
|
74
|
-
ACCEPTED_LINE_ITEM_UPLOAD_TYPES,
|
|
75
|
-
LINE_ITEM_UPLOAD_ENDPOINT,
|
|
76
|
-
LineItemUploadError,
|
|
77
|
-
MAX_LINE_ITEM_UPLOAD_BYTES,
|
|
78
|
-
lineItemFileProperty,
|
|
79
|
-
uploadLineItemFile
|
|
80
|
-
};
|
|
1
|
+
import{put as s}from"@vercel/blob/client";var p="/checkout/api/line-item-uploads",g=20*1024*1024,a={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",avif:"image/avif",tif:"image/tiff",tiff:"image/tiff",pdf:"application/pdf"},f=[...new Set(Object.values(a))].join(","),o=class extends Error{status;constructor(n,t){super(n),this.name="LineItemUploadError",this.status=t}},l=e=>e.type||a[e.name.split(".").pop()?.toLowerCase()??""]||"",d=e=>typeof e=="object"&&e!==null&&"uploadId"in e&&typeof e.uploadId=="string"&&"pathname"in e&&typeof e.pathname=="string"&&"clientToken"in e&&typeof e.clientToken=="string",c=e=>typeof e=="object"&&e!==null&&"error"in e&&typeof e.error=="string"?e.error:null;async function u(e,n){let t=l(e);if(!t)throw new o("This file type can't be uploaded.",400);if(e.size>g)throw new o("The file is larger than 20 MB.",400);let r=await fetch(n.endpoint??p,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({variantId:n.variantId,filename:e.name,contentType:t,size:e.size}),...n.abortSignal?{signal:n.abortSignal}:{}}),i=await r.json().catch(()=>null);if(!r.ok||!d(i))throw new o(c(i)??"The upload could not start.",r.status);return await s(i.pathname,e,{access:"private",token:i.clientToken,contentType:t,multipart:e.size>8*1024*1024,...n.onUploadProgress?{onUploadProgress:n.onUploadProgress}:{},...n.abortSignal?{abortSignal:n.abortSignal}:{}}),{uploadId:i.uploadId}}var h=({key:e,label:n,uploadId:t})=>({key:e,...n!==void 0?{label:n}:{},type:"file",value:t});export{f as ACCEPTED_LINE_ITEM_UPLOAD_TYPES,p as LINE_ITEM_UPLOAD_ENDPOINT,o as LineItemUploadError,g as MAX_LINE_ITEM_UPLOAD_BYTES,h as lineItemFileProperty,u as uploadLineItemFile};
|
|
81
2
|
//# sourceMappingURL=uploads.js.map
|
package/dist/uploads.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/uploads.ts"],"sourcesContent":["import { put } from \"@vercel/blob/client\";\n\n/**\n * Shopper file uploads for personalised products (a photo for a portrait, a print-ready PDF).\n *\n * Browser-only. The storefront calls `uploadLineItemFile(file, { variantId })` from its product\n * page; the platform hands out a short-lived token for exactly one file (its `/checkout/api/**`\n * endpoint is already forwarded by every tenant's proxy, so the storefront needs no route of its\n * own and no API key in the browser), and the file goes straight into the store's private storage.\n * The returned `uploadId` is what a cart line's file property carries:\n *\n * ```ts\n * const { uploadId } = await uploadLineItemFile(file, { variantId });\n * await cartUpsert({ variantId, quantity: 1, properties: [lineItemFileProperty({ key: \"photo\", label: \"Photo\", uploadId })] });\n * ```\n *\n * Requires the store's Customer Uploads module. Images (JPEG, PNG, WebP, GIF, HEIC/HEIF, AVIF,\n * TIFF) and PDF, up to 20 MB.\n */\n\nexport const LINE_ITEM_UPLOAD_ENDPOINT = \"/checkout/api/line-item-uploads\";\nexport const MAX_LINE_ITEM_UPLOAD_BYTES = 20 * 1024 * 1024;\n\n/** Some browsers report HEIC/HEIF (and the occasional other image) with an empty type. */\nconst TYPE_BY_EXTENSION: Record<string, string> = {\n\tjpg: \"image/jpeg\",\n\tjpeg: \"image/jpeg\",\n\tpng: \"image/png\",\n\twebp: \"image/webp\",\n\tgif: \"image/gif\",\n\theic: \"image/heic\",\n\theif: \"image/heif\",\n\tavif: \"image/avif\",\n\ttif: \"image/tiff\",\n\ttiff: \"image/tiff\",\n\tpdf: \"application/pdf\",\n};\n\nexport const ACCEPTED_LINE_ITEM_UPLOAD_TYPES = [...new Set(Object.values(TYPE_BY_EXTENSION))].join(\",\");\n\nexport class LineItemUploadError extends Error {\n\treadonly status: number;\n\tconstructor(message: string, status: number) {\n\t\tsuper(message);\n\t\tthis.name = \"LineItemUploadError\";\n\t\tthis.status = status;\n\t}\n}\n\nconst contentTypeOf = (file: File): string =>\n\tfile.type || TYPE_BY_EXTENSION[file.name.split(\".\").pop()?.toLowerCase() ?? \"\"] || \"\";\n\nconst isTokenResponse = (\n\tvalue: unknown,\n): value is { uploadId: string; pathname: string; clientToken: string } =>\n\ttypeof value === \"object\" &&\n\tvalue !== null &&\n\t\"uploadId\" in value &&\n\ttypeof value.uploadId === \"string\" &&\n\t\"pathname\" in value &&\n\ttypeof value.pathname === \"string\" &&\n\t\"clientToken\" in value &&\n\ttypeof value.clientToken === \"string\";\n\nconst errorMessageOf = (value: unknown): string | null =>\n\ttypeof value === \"object\" && value !== null && \"error\" in value && typeof value.error === \"string\"\n\t\t? value.error\n\t\t: null;\n\n/**\n * Upload one file for a cart line. Throws `LineItemUploadError` with the platform's message and\n * HTTP status (400 unsupported file, 404 uploads off for this store, 429 too many uploads).\n */\nexport async function uploadLineItemFile(\n\tfile: File,\n\toptions: {\n\t\tvariantId: string;\n\t\t/** Defaults to the platform endpoint every tenant proxy forwards. */\n\t\tendpoint?: string;\n\t\tonUploadProgress?: (event: { loaded: number; total: number; percentage: number }) => void;\n\t\tabortSignal?: AbortSignal;\n\t},\n): Promise<{ uploadId: string }> {\n\tconst contentType = contentTypeOf(file);\n\tif (!contentType) {\n\t\tthrow new LineItemUploadError(\"This file type can't be uploaded.\", 400);\n\t}\n\tif (file.size > MAX_LINE_ITEM_UPLOAD_BYTES) {\n\t\tthrow new LineItemUploadError(\"The file is larger than 20 MB.\", 400);\n\t}\n\n\tconst response = await fetch(options.endpoint ?? LINE_ITEM_UPLOAD_ENDPOINT, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\tcredentials: \"same-origin\",\n\t\tbody: JSON.stringify({ variantId: options.variantId, filename: file.name, contentType, size: file.size }),\n\t\t...(options.abortSignal ? { signal: options.abortSignal } : {}),\n\t});\n\tconst body: unknown = await response.json().catch(() => null);\n\tif (!response.ok || !isTokenResponse(body)) {\n\t\tthrow new LineItemUploadError(errorMessageOf(body) ?? \"The upload could not start.\", response.status);\n\t}\n\n\tawait put(body.pathname, file, {\n\t\taccess: \"private\",\n\t\ttoken: body.clientToken,\n\t\tcontentType,\n\t\tmultipart: file.size > 8 * 1024 * 1024,\n\t\t...(options.onUploadProgress ? { onUploadProgress: options.onUploadProgress } : {}),\n\t\t...(options.abortSignal ? { abortSignal: options.abortSignal } : {}),\n\t});\n\treturn { uploadId: body.uploadId };\n}\n\n/** The cart line property that attaches an uploaded file. */\nexport const lineItemFileProperty = ({\n\tkey,\n\tlabel,\n\tuploadId,\n}: {\n\tkey: string;\n\tlabel?: string;\n\tuploadId: string;\n}): { key: string; label?: string; type: \"file\"; value: string } => ({\n\tkey,\n\t...(label !== undefined ? { label } : {}),\n\ttype: \"file\",\n\tvalue: uploadId,\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/uploads.ts"],"sourcesContent":["import { put } from \"@vercel/blob/client\";\n\n/**\n * Shopper file uploads for personalised products (a photo for a portrait, a print-ready PDF).\n *\n * Browser-only. The storefront calls `uploadLineItemFile(file, { variantId })` from its product\n * page; the platform hands out a short-lived token for exactly one file (its `/checkout/api/**`\n * endpoint is already forwarded by every tenant's proxy, so the storefront needs no route of its\n * own and no API key in the browser), and the file goes straight into the store's private storage.\n * The returned `uploadId` is what a cart line's file property carries:\n *\n * ```ts\n * const { uploadId } = await uploadLineItemFile(file, { variantId });\n * await cartUpsert({ variantId, quantity: 1, properties: [lineItemFileProperty({ key: \"photo\", label: \"Photo\", uploadId })] });\n * ```\n *\n * Requires the store's Customer Uploads module. Images (JPEG, PNG, WebP, GIF, HEIC/HEIF, AVIF,\n * TIFF) and PDF, up to 20 MB.\n */\n\nexport const LINE_ITEM_UPLOAD_ENDPOINT = \"/checkout/api/line-item-uploads\";\nexport const MAX_LINE_ITEM_UPLOAD_BYTES = 20 * 1024 * 1024;\n\n/** Some browsers report HEIC/HEIF (and the occasional other image) with an empty type. */\nconst TYPE_BY_EXTENSION: Record<string, string> = {\n\tjpg: \"image/jpeg\",\n\tjpeg: \"image/jpeg\",\n\tpng: \"image/png\",\n\twebp: \"image/webp\",\n\tgif: \"image/gif\",\n\theic: \"image/heic\",\n\theif: \"image/heif\",\n\tavif: \"image/avif\",\n\ttif: \"image/tiff\",\n\ttiff: \"image/tiff\",\n\tpdf: \"application/pdf\",\n};\n\nexport const ACCEPTED_LINE_ITEM_UPLOAD_TYPES = [...new Set(Object.values(TYPE_BY_EXTENSION))].join(\",\");\n\nexport class LineItemUploadError extends Error {\n\treadonly status: number;\n\tconstructor(message: string, status: number) {\n\t\tsuper(message);\n\t\tthis.name = \"LineItemUploadError\";\n\t\tthis.status = status;\n\t}\n}\n\nconst contentTypeOf = (file: File): string =>\n\tfile.type || TYPE_BY_EXTENSION[file.name.split(\".\").pop()?.toLowerCase() ?? \"\"] || \"\";\n\nconst isTokenResponse = (\n\tvalue: unknown,\n): value is { uploadId: string; pathname: string; clientToken: string } =>\n\ttypeof value === \"object\" &&\n\tvalue !== null &&\n\t\"uploadId\" in value &&\n\ttypeof value.uploadId === \"string\" &&\n\t\"pathname\" in value &&\n\ttypeof value.pathname === \"string\" &&\n\t\"clientToken\" in value &&\n\ttypeof value.clientToken === \"string\";\n\nconst errorMessageOf = (value: unknown): string | null =>\n\ttypeof value === \"object\" && value !== null && \"error\" in value && typeof value.error === \"string\"\n\t\t? value.error\n\t\t: null;\n\n/**\n * Upload one file for a cart line. Throws `LineItemUploadError` with the platform's message and\n * HTTP status (400 unsupported file, 404 uploads off for this store, 429 too many uploads).\n */\nexport async function uploadLineItemFile(\n\tfile: File,\n\toptions: {\n\t\tvariantId: string;\n\t\t/** Defaults to the platform endpoint every tenant proxy forwards. */\n\t\tendpoint?: string;\n\t\tonUploadProgress?: (event: { loaded: number; total: number; percentage: number }) => void;\n\t\tabortSignal?: AbortSignal;\n\t},\n): Promise<{ uploadId: string }> {\n\tconst contentType = contentTypeOf(file);\n\tif (!contentType) {\n\t\tthrow new LineItemUploadError(\"This file type can't be uploaded.\", 400);\n\t}\n\tif (file.size > MAX_LINE_ITEM_UPLOAD_BYTES) {\n\t\tthrow new LineItemUploadError(\"The file is larger than 20 MB.\", 400);\n\t}\n\n\tconst response = await fetch(options.endpoint ?? LINE_ITEM_UPLOAD_ENDPOINT, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\tcredentials: \"same-origin\",\n\t\tbody: JSON.stringify({ variantId: options.variantId, filename: file.name, contentType, size: file.size }),\n\t\t...(options.abortSignal ? { signal: options.abortSignal } : {}),\n\t});\n\tconst body: unknown = await response.json().catch(() => null);\n\tif (!response.ok || !isTokenResponse(body)) {\n\t\tthrow new LineItemUploadError(errorMessageOf(body) ?? \"The upload could not start.\", response.status);\n\t}\n\n\tawait put(body.pathname, file, {\n\t\taccess: \"private\",\n\t\ttoken: body.clientToken,\n\t\tcontentType,\n\t\tmultipart: file.size > 8 * 1024 * 1024,\n\t\t...(options.onUploadProgress ? { onUploadProgress: options.onUploadProgress } : {}),\n\t\t...(options.abortSignal ? { abortSignal: options.abortSignal } : {}),\n\t});\n\treturn { uploadId: body.uploadId };\n}\n\n/** The cart line property that attaches an uploaded file. */\nexport const lineItemFileProperty = ({\n\tkey,\n\tlabel,\n\tuploadId,\n}: {\n\tkey: string;\n\tlabel?: string;\n\tuploadId: string;\n}): { key: string; label?: string; type: \"file\"; value: string } => ({\n\tkey,\n\t...(label !== undefined ? { label } : {}),\n\ttype: \"file\",\n\tvalue: uploadId,\n});\n"],"mappings":"AAAA,OAAS,OAAAA,MAAW,sBAoBb,IAAMC,EAA4B,kCAC5BC,EAA6B,GAAK,KAAO,KAGhDC,EAA4C,CACjD,IAAK,aACL,KAAM,aACN,IAAK,YACL,KAAM,aACN,IAAK,YACL,KAAM,aACN,KAAM,aACN,KAAM,aACN,IAAK,aACL,KAAM,aACN,IAAK,iBACN,EAEaC,EAAkC,CAAC,GAAG,IAAI,IAAI,OAAO,OAAOD,CAAiB,CAAC,CAAC,EAAE,KAAK,GAAG,EAEzFE,EAAN,cAAkC,KAAM,CACrC,OACT,YAAYC,EAAiBC,EAAgB,CAC5C,MAAMD,CAAO,EACb,KAAK,KAAO,sBACZ,KAAK,OAASC,CACf,CACD,EAEMC,EAAiBC,GACtBA,EAAK,MAAQN,EAAkBM,EAAK,KAAK,MAAM,GAAG,EAAE,IAAI,GAAG,YAAY,GAAK,EAAE,GAAK,GAE9EC,EACLC,GAEA,OAAOA,GAAU,UACjBA,IAAU,MACV,aAAcA,GACd,OAAOA,EAAM,UAAa,UAC1B,aAAcA,GACd,OAAOA,EAAM,UAAa,UAC1B,gBAAiBA,GACjB,OAAOA,EAAM,aAAgB,SAExBC,EAAkBD,GACvB,OAAOA,GAAU,UAAYA,IAAU,MAAQ,UAAWA,GAAS,OAAOA,EAAM,OAAU,SACvFA,EAAM,MACN,KAMJ,eAAsBE,EACrBJ,EACAK,EAOgC,CAChC,IAAMC,EAAcP,EAAcC,CAAI,EACtC,GAAI,CAACM,EACJ,MAAM,IAAIV,EAAoB,oCAAqC,GAAG,EAEvE,GAAII,EAAK,KAAOP,EACf,MAAM,IAAIG,EAAoB,iCAAkC,GAAG,EAGpE,IAAMW,EAAW,MAAM,MAAMF,EAAQ,UAAYb,EAA2B,CAC3E,OAAQ,OACR,QAAS,CAAE,eAAgB,kBAAmB,EAC9C,YAAa,cACb,KAAM,KAAK,UAAU,CAAE,UAAWa,EAAQ,UAAW,SAAUL,EAAK,KAAM,YAAAM,EAAa,KAAMN,EAAK,IAAK,CAAC,EACxG,GAAIK,EAAQ,YAAc,CAAE,OAAQA,EAAQ,WAAY,EAAI,CAAC,CAC9D,CAAC,EACKG,EAAgB,MAAMD,EAAS,KAAK,EAAE,MAAM,IAAM,IAAI,EAC5D,GAAI,CAACA,EAAS,IAAM,CAACN,EAAgBO,CAAI,EACxC,MAAM,IAAIZ,EAAoBO,EAAeK,CAAI,GAAK,8BAA+BD,EAAS,MAAM,EAGrG,aAAMhB,EAAIiB,EAAK,SAAUR,EAAM,CAC9B,OAAQ,UACR,MAAOQ,EAAK,YACZ,YAAAF,EACA,UAAWN,EAAK,KAAO,EAAI,KAAO,KAClC,GAAIK,EAAQ,iBAAmB,CAAE,iBAAkBA,EAAQ,gBAAiB,EAAI,CAAC,EACjF,GAAIA,EAAQ,YAAc,CAAE,YAAaA,EAAQ,WAAY,EAAI,CAAC,CACnE,CAAC,EACM,CAAE,SAAUG,EAAK,QAAS,CAClC,CAGO,IAAMC,EAAuB,CAAC,CACpC,IAAAC,EACA,MAAAC,EACA,SAAAC,CACD,KAIqE,CACpE,IAAAF,EACA,GAAIC,IAAU,OAAY,CAAE,MAAAA,CAAM,EAAI,CAAC,EACvC,KAAM,OACN,MAAOC,CACR","names":["put","LINE_ITEM_UPLOAD_ENDPOINT","MAX_LINE_ITEM_UPLOAD_BYTES","TYPE_BY_EXTENSION","ACCEPTED_LINE_ITEM_UPLOAD_TYPES","LineItemUploadError","message","status","contentTypeOf","file","isTokenResponse","value","errorMessageOf","uploadLineItemFile","options","contentType","response","body","lineItemFileProperty","key","label","uploadId"]}
|