react-shopwave-connect 0.3.0 → 0.4.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.
@@ -709,5 +709,485 @@ function buildConsumerMap(consumers) {
709
709
  }
710
710
 
711
711
  //#endregion
712
- export { DEFAULT_BASKET_FILTERS, DEFAULT_PAGINATION, PromotionRuleSet, SHOPWAVE_ENTITIES, ShopwaveApiError, apiDelete, apiGet, apiRequest, apiSend, assertNoApiErrors, authorizationFor, buildBasketReportQuery, buildConsumerMap, collectConsumerIds, collectProductIds, combineBasketRows, computeBasketSummary, deleteCategory, deleteEmployee, deleteEntity, deleteEntityById, deleteProduct, deletePromotion, deleteStore, fetchCategories, fetchCategory, fetchConsumer, fetchConsumers, fetchEmployee, fetchEmployees, fetchEntityById, fetchProduct, fetchProducts, fetchProductsMap, fetchPromotion, fetchPromotions, fetchReport, fetchSession, fetchStore, fetchStores, formatDateForQuery, getApiErrorMap, getApiErrors, loginPath, logout, logoutPath, parseBasketReportData, rolesById, saveCategory, saveEmployee, saveEntities, saveEntity, saveProduct, savePromotion, saveStore, submitEntity, toShopwaveApiError, withToken };
712
+ //#region src/core/resources.ts
713
+ /**
714
+ * - merchant: `GET /merchant`; `POST /merchant` with `{ merchant: { id, … } }`
715
+ * updates it (without an `id` the API would create a second merchant, so the
716
+ * route requires one).
717
+ * - user: `GET /user` (read-only here; the API's `POST /user` invites users and
718
+ * needs the admin scope).
719
+ */
720
+ const SHOPWAVE_RESOURCES = Object.freeze({
721
+ merchant: {
722
+ route: "merchant",
723
+ key: "merchant",
724
+ upstream: "merchant",
725
+ writable: true
726
+ },
727
+ user: {
728
+ route: "user",
729
+ key: "user",
730
+ upstream: "user",
731
+ writable: false
732
+ }
733
+ });
734
+ /** `UploadKind` → the API's `contentType` value. */
735
+ const UPLOAD_KINDS = Object.freeze({
736
+ merchant: "merchant",
737
+ merchantFeature: "merchantFeature",
738
+ product: "product",
739
+ user: "user",
740
+ applicationLogo: "applicaionLogo",
741
+ applicationImages: "applicaionImages"
742
+ });
743
+ /** How uploads are addressed (app route and Shopwave uploader). */
744
+ const SHOPWAVE_UPLOAD = Object.freeze({
745
+ route: "upload",
746
+ upstream: "uploader",
747
+ kindHeader: "contentType",
748
+ fileField: "file",
749
+ kindField: "kind"
750
+ });
751
+ function isUploadKind(value) {
752
+ return typeof value === "string" && Object.prototype.hasOwnProperty.call(UPLOAD_KINDS, value);
753
+ }
754
+
755
+ //#endregion
756
+ //#region src/core/imageFit.ts
757
+ /**
758
+ * The centred part of a `srcWidth × srcHeight` image with the aspect ratio of
759
+ * `dstWidth × dstHeight` (like CSS `object-fit: cover`).
760
+ */
761
+ function coverCrop(srcWidth, srcHeight, dstWidth, dstHeight) {
762
+ if (![
763
+ srcWidth,
764
+ srcHeight,
765
+ dstWidth,
766
+ dstHeight
767
+ ].every((n) => Number.isFinite(n) && n > 0)) throw new Error("coverCrop: sizes must be positive numbers");
768
+ const srcRatio = srcWidth / srcHeight;
769
+ const dstRatio = dstWidth / dstHeight;
770
+ if (srcRatio > dstRatio) {
771
+ const sw = Math.round(srcHeight * dstRatio);
772
+ return {
773
+ sx: Math.round((srcWidth - sw) / 2),
774
+ sy: 0,
775
+ sw,
776
+ sh: srcHeight
777
+ };
778
+ }
779
+ const sh = Math.round(srcWidth / dstRatio);
780
+ return {
781
+ sx: 0,
782
+ sy: Math.round((srcHeight - sh) / 2),
783
+ sw: srcWidth,
784
+ sh
785
+ };
786
+ }
787
+ function requireBrowserImages(fn) {
788
+ if (typeof createImageBitmap !== "function") throw new Error(`${fn} needs a browser (createImageBitmap is not available)`);
789
+ }
790
+ /** Reads an image file's pixel size (browser only). */
791
+ async function readImageSize(file) {
792
+ requireBrowserImages("readImageSize");
793
+ const bitmap = await createImageBitmap(file);
794
+ try {
795
+ return {
796
+ width: bitmap.width,
797
+ height: bitmap.height
798
+ };
799
+ } finally {
800
+ bitmap.close?.();
801
+ }
802
+ }
803
+ /**
804
+ * Returns the image at exactly `width × height`: scaled and centre-cropped
805
+ * (never stretched). Browser only. The result is a `File` named like the
806
+ * input, with the output type's extension.
807
+ */
808
+ async function fitImageToSize(file, width, height, options = {}) {
809
+ requireBrowserImages("fitImageToSize");
810
+ const { type = "image/png", quality, keepIfExact = true } = options;
811
+ const name = file.name || "image";
812
+ const ext = type === "image/jpeg" ? "jpg" : type.split("/")[1];
813
+ const outName = `${name.replace(/\.[^.]+$/, "")}.${ext}`;
814
+ const bitmap = await createImageBitmap(file);
815
+ try {
816
+ if (keepIfExact && bitmap.width === width && bitmap.height === height && file.type === type) return file instanceof File ? file : new File([file], outName, { type });
817
+ const { sx, sy, sw, sh } = coverCrop(bitmap.width, bitmap.height, width, height);
818
+ let blob;
819
+ if (typeof OffscreenCanvas === "function") {
820
+ const canvas = new OffscreenCanvas(width, height);
821
+ const ctx = canvas.getContext("2d");
822
+ if (!ctx) throw new Error("fitImageToSize: no 2D canvas context");
823
+ ctx.imageSmoothingQuality = "high";
824
+ ctx.drawImage(bitmap, sx, sy, sw, sh, 0, 0, width, height);
825
+ blob = await canvas.convertToBlob({
826
+ type,
827
+ quality
828
+ });
829
+ } else {
830
+ const canvas = document.createElement("canvas");
831
+ canvas.width = width;
832
+ canvas.height = height;
833
+ const ctx = canvas.getContext("2d");
834
+ if (!ctx) throw new Error("fitImageToSize: no 2D canvas context");
835
+ ctx.imageSmoothingQuality = "high";
836
+ ctx.drawImage(bitmap, sx, sy, sw, sh, 0, 0, width, height);
837
+ blob = await new Promise((resolve, reject) => canvas.toBlob((b) => b ? resolve(b) : reject(/* @__PURE__ */ new Error("fitImageToSize: encoding failed")), type, quality));
838
+ }
839
+ return new File([blob], outName, { type });
840
+ } finally {
841
+ bitmap.close?.();
842
+ }
843
+ }
844
+
845
+ //#endregion
846
+ //#region src/core/upload.ts
847
+ /**
848
+ * HTTPS host that serves the Shopwave CDN's images. The API returns
849
+ * `http://static.merchantstack.com/images/…`, which has no HTTPS endpoint
850
+ * (checked Sep 2026), so pages served over HTTPS can't show it.
851
+ */
852
+ const SHOPWAVE_IMAGE_BASE_URL = "https://s3-eu-west-1.amazonaws.com/static.merchantstack.com/images";
853
+ const STATIC_HOST = /^https?:\/\/static\.merchantstack\.com\/images\//i;
854
+ /**
855
+ * Turns an image path from the API into a URL a page can load over HTTPS:
856
+ * `http://static.merchantstack.com/images/x.png` → `<base>/x.png`, and a
857
+ * relative path (`merchant/5644/logo/x.png`) → `<base>/merchant/5644/logo/x.png`.
858
+ * Other absolute URLs are returned unchanged; empty input gives `""`.
859
+ */
860
+ function getImageUrl(path, base = SHOPWAVE_IMAGE_BASE_URL) {
861
+ if (!path) return "";
862
+ const root = base.replace(/\/+$/, "");
863
+ if (STATIC_HOST.test(path)) return `${root}/${path.replace(STATIC_HOST, "")}`;
864
+ if (/^[a-z][a-z0-9+.-]*:/i.test(path) || path.startsWith("//")) return path;
865
+ return `${root}/${path.replace(/^\/+/, "")}`;
866
+ }
867
+ /**
868
+ * Uploads one image to the Shopwave CDN through the app's `/api/upload` route
869
+ * (`createShopwaveApi(...).upload()`), and returns its id and URL.
870
+ *
871
+ * The file only lands on the CDN (under `…/images/<kind>/<merchantId>/…`); a
872
+ * record has to point at it to use it. Live API (Sep 2026): the upload answers
873
+ * 201 `{ fileName, path }`.
874
+ */
875
+ async function uploadImage(file, params, options = {}) {
876
+ if (!file || typeof file.size !== "number") throw new Error("uploadImage: file must be a File or Blob");
877
+ if (!isUploadKind(params?.kind)) throw new Error(`uploadImage: unknown kind "${params?.kind}"`);
878
+ const name = params.fileName ?? file.name ?? "upload";
879
+ const form = new FormData();
880
+ form.append(SHOPWAVE_UPLOAD.fileField, file, name);
881
+ form.append(SHOPWAVE_UPLOAD.kindField, params.kind);
882
+ const { status, body: raw } = await apiRequest(`/api/${SHOPWAVE_UPLOAD.route}`, {
883
+ method: "POST",
884
+ body: form
885
+ }, options);
886
+ const body = raw;
887
+ assertNoApiErrors(body, status);
888
+ const id = typeof body?.fileName === "string" ? body.fileName : "";
889
+ const path = typeof body?.path === "string" ? body.path : "";
890
+ if (!id) throw new ShopwaveApiError(status, `Shopwave API error (${status}): the upload response has no fileName`, { body });
891
+ return {
892
+ id,
893
+ url: getImageUrl(path),
894
+ path
895
+ };
896
+ }
897
+
898
+ //#endregion
899
+ //#region src/core/merchantImages.ts
900
+ /** The three image slots on the merchant settings page. */
901
+ const MERCHANT_IMAGE_SLOT_KEYS = [
902
+ "receipt",
903
+ "square",
904
+ "featured"
905
+ ];
906
+ /**
907
+ * Where each slot lives, its upload kind and its exact size (from adminV1's
908
+ * merchant settings page).
909
+ */
910
+ const MERCHANT_IMAGE_SLOTS = Object.freeze({
911
+ receipt: {
912
+ field: "logo.receipt",
913
+ uploadKind: "merchant",
914
+ width: 576,
915
+ height: 325
916
+ },
917
+ square: {
918
+ field: "logo.square",
919
+ uploadKind: "merchant",
920
+ width: 1e3,
921
+ height: 1e3
922
+ },
923
+ featured: {
924
+ field: "feature[0]",
925
+ uploadKind: "merchantFeature",
926
+ width: 1200,
927
+ height: 600
928
+ }
929
+ });
930
+ /**
931
+ * The file name in an image value: `"http://…/logo/abc.png"` → `"abc.png"`,
932
+ * `"abc.png"` → `"abc.png"`. Query strings and fragments are ignored.
933
+ * Returns `null` for empty or non-string values.
934
+ */
935
+ function imageFileName(value) {
936
+ if (typeof value !== "string") return null;
937
+ const last = value.trim().replace(/[?#].*$/, "").split("/").pop() ?? "";
938
+ return last ? decodeURIComponent(last) : null;
939
+ }
940
+ /** The stored value for a slot (a URL when read from the API; a file name right after an upload). */
941
+ function getMerchantImage(imageIds, slot) {
942
+ if (!imageIds || typeof imageIds !== "object") return null;
943
+ let value;
944
+ if (slot === "featured") value = Array.isArray(imageIds.feature) ? imageIds.feature[0] : void 0;
945
+ else {
946
+ const logo = imageIds.logo;
947
+ value = logo && typeof logo === "object" ? logo[slot] : void 0;
948
+ }
949
+ return typeof value === "string" && value.trim() ? value.trim() : null;
950
+ }
951
+ /**
952
+ * An HTTPS URL for a slot's stored image, or `""` when the slot is empty or
953
+ * holds only a file name (a fresh upload not yet saved; use the upload's `url`).
954
+ */
955
+ function getMerchantImageUrl(imageIds, slot, base) {
956
+ const value = getMerchantImage(imageIds, slot);
957
+ if (!value || !value.includes("/")) return "";
958
+ return getImageUrl(value, base);
959
+ }
960
+ /**
961
+ * Returns a copy of `imageIds` with one slot set to `fileName` (or cleared
962
+ * with `null`). Other slots and unknown keys are kept; an empty `logo` or
963
+ * `feature` is removed.
964
+ */
965
+ function setMerchantImage(imageIds, slot, fileName) {
966
+ const next = { ...imageIds && typeof imageIds === "object" ? imageIds : {} };
967
+ if (slot === "featured") {
968
+ const rest = Array.isArray(next.feature) ? next.feature.slice(1) : [];
969
+ const feature = fileName ? [fileName, ...rest] : rest;
970
+ if (feature.length > 0) next.feature = feature;
971
+ else delete next.feature;
972
+ } else {
973
+ const logo = { ...next.logo && typeof next.logo === "object" ? next.logo : {} };
974
+ if (fileName) logo[slot] = fileName;
975
+ else delete logo[slot];
976
+ if (Object.keys(logo).length > 0) next.logo = logo;
977
+ else delete next.logo;
978
+ }
979
+ return next;
980
+ }
981
+ function toStored(value) {
982
+ if (typeof value === "string") return imageFileName(value) ?? void 0;
983
+ if (Array.isArray(value)) {
984
+ const items = value.map(toStored).filter((v) => v !== void 0 && v !== null && v !== "");
985
+ return items.length > 0 ? items : void 0;
986
+ }
987
+ if (value && typeof value === "object") {
988
+ const out = {};
989
+ for (const [k, v] of Object.entries(value)) {
990
+ const stored = toStored(v);
991
+ if (stored !== void 0 && stored !== null && stored !== "") out[k] = stored;
992
+ }
993
+ return Object.keys(out).length > 0 ? out : void 0;
994
+ }
995
+ }
996
+ /**
997
+ * The `imageIds` to send on a save: every URL is turned back into its file
998
+ * name (what adminV1 does with images you didn't change) and empty values
999
+ * are dropped. No images gives `{}`.
1000
+ */
1001
+ function toStoredImageIds(imageIds) {
1002
+ return toStored(imageIds) ?? {};
1003
+ }
1004
+ /**
1005
+ * Uploads an image for a merchant slot: fits it to the slot's size, uploads
1006
+ * it with the slot's kind, and returns `{ id, url, path }`. Put `id` into
1007
+ * `imageIds` with {@link setMerchantImage} and save with `updateMerchant`.
1008
+ */
1009
+ async function uploadMerchantImage(file, slot, options = {}) {
1010
+ const def = MERCHANT_IMAGE_SLOTS[slot];
1011
+ if (!def) throw new Error(`uploadMerchantImage: unknown slot "${slot}"`);
1012
+ const { fit = true, fitOptions,...requestOptions } = options;
1013
+ return uploadImage(fit ? await fitImageToSize(file, def.width, def.height, fitOptions) : file, { kind: def.uploadKind }, requestOptions);
1014
+ }
1015
+
1016
+ //#endregion
1017
+ //#region src/core/merchant.ts
1018
+ const MERCHANT_PATH = `/api/${SHOPWAVE_RESOURCES.merchant.route}`;
1019
+ /** Colour keys inside `colours.primary`, in display order. */
1020
+ const MERCHANT_COLOUR_KEYS = [
1021
+ "main",
1022
+ "highlight",
1023
+ "contrast"
1024
+ ];
1025
+ /** Flat link fields a form edits, in display order. */
1026
+ const MERCHANT_LINK_KEYS = [
1027
+ "website",
1028
+ "twitter",
1029
+ "facebook",
1030
+ "instagram"
1031
+ ];
1032
+ /** Where each flat link field lives in `merchant.links`. */
1033
+ const MERCHANT_LINK_PATHS = Object.freeze({
1034
+ website: ["website", "home"],
1035
+ twitter: ["social", "twitter"],
1036
+ facebook: ["social", "facebook"],
1037
+ instagram: ["social", "instagram"]
1038
+ });
1039
+ function trimmed(value) {
1040
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
1041
+ }
1042
+ /**
1043
+ * Reads `merchant.links` as flat fields (`{ website, twitter, facebook,
1044
+ * instagram }`), whatever shape it was saved in:
1045
+ * - the nested shape adminV1 saves (`{ website: { home }, social: { … } }`);
1046
+ * - flat keys (`{ website: "…" }`, what SDK 0.4.0 pre-releases sent);
1047
+ * - an array in {@link MERCHANT_LINK_KEYS} order (older AdminUI versions).
1048
+ * Empty values are dropped.
1049
+ */
1050
+ function merchantLinksToForm(links) {
1051
+ const out = {};
1052
+ if (Array.isArray(links)) {
1053
+ links.forEach((value, i) => {
1054
+ const key = MERCHANT_LINK_KEYS[i];
1055
+ const v = trimmed(value);
1056
+ if (key && v) out[key] = v;
1057
+ });
1058
+ return out;
1059
+ }
1060
+ if (!links || typeof links !== "object") return out;
1061
+ const obj = links;
1062
+ for (const key of MERCHANT_LINK_KEYS) {
1063
+ const [group, field] = MERCHANT_LINK_PATHS[key];
1064
+ const nested = obj[group];
1065
+ const v = nested && typeof nested === "object" && !Array.isArray(nested) ? trimmed(nested[field]) : trimmed(obj[key]);
1066
+ if (v) out[key] = v;
1067
+ }
1068
+ return out;
1069
+ }
1070
+ /**
1071
+ * Builds the stored `links` object from flat fields. Empty values are left
1072
+ * out, and so is a group with nothing in it; no links gives `{}`.
1073
+ */
1074
+ function merchantLinksFromForm(form) {
1075
+ const out = {};
1076
+ for (const key of MERCHANT_LINK_KEYS) {
1077
+ const v = trimmed(form[key]);
1078
+ if (!v) continue;
1079
+ const [group, field] = MERCHANT_LINK_PATHS[key];
1080
+ (out[group] ??= {})[field] = v;
1081
+ }
1082
+ return out;
1083
+ }
1084
+ /** Reads any stored or older `links` value into the nested shape adminV1 saves. */
1085
+ function normalizeMerchantLinks(links) {
1086
+ return merchantLinksFromForm(merchantLinksToForm(links));
1087
+ }
1088
+ /**
1089
+ * Object fields of the merchant. The API keeps one you leave out, and
1090
+ * replaces it as a whole when you send it.
1091
+ */
1092
+ const MERCHANT_OBJECT_FIELDS = [
1093
+ "colours",
1094
+ "links",
1095
+ "imageIds"
1096
+ ];
1097
+ /** Fields the API sets itself; `updateMerchant` never sends them back. */
1098
+ const MERCHANT_READ_ONLY_FIELDS = ["createdDate", "modifiedDate"];
1099
+ /**
1100
+ * Longest values the API stores. Longer values are cut off silently
1101
+ * (live API, Sep 2026), so `updateMerchant` rejects them instead.
1102
+ * `vatNumber` fits a UK VAT number without the `GB` prefix.
1103
+ */
1104
+ const MERCHANT_FIELD_MAX_LENGTH = Object.freeze({
1105
+ companyNumber: 11,
1106
+ vatNumber: 9
1107
+ });
1108
+ /** Returns `"<field> is longer than <n> characters"` messages for over-long fields. */
1109
+ function validateMerchant(merchant) {
1110
+ const problems = [];
1111
+ for (const [field, max] of Object.entries(MERCHANT_FIELD_MAX_LENGTH)) {
1112
+ const value = merchant[field];
1113
+ if (typeof value === "string" && value.length > max) problems.push(`${field} is longer than ${max} characters`);
1114
+ }
1115
+ return problems;
1116
+ }
1117
+ /**
1118
+ * Reads the logged-in user's merchant (a user has exactly one), or `null`
1119
+ * when the API returns none.
1120
+ */
1121
+ async function fetchMerchant(options = {}) {
1122
+ const json = await apiGet(MERCHANT_PATH, {}, options);
1123
+ assertNoApiErrors(json, 200);
1124
+ return json?.merchant ?? null;
1125
+ }
1126
+ /**
1127
+ * Updates the merchant and returns it as stored.
1128
+ *
1129
+ * Shopwave's `POST /merchant` replaces the whole record: a scalar field you
1130
+ * leave out (`companyNumber`, `vatNumber`, `note`, …) is set to null, while
1131
+ * an object field you leave out (`colours`, `links`, `imageIds`) is kept and
1132
+ * one you send replaces the stored one; sending `{}` clears it (live API,
1133
+ * Sep 2026). So by default the
1134
+ * current merchant is read first and the patch is merged over it.
1135
+ *
1136
+ * `imageIds` is always sent as file names ({@link toStoredImageIds}), so you
1137
+ * can pass back what you read. See `MerchantImageIds` for the shape.
1138
+ *
1139
+ * The API answers 205 with an empty body, so the merchant is read again after
1140
+ * the save and that is what's returned (it shows exactly what was kept).
1141
+ * Throws before sending when a value is longer than the API stores
1142
+ * ({@link MERCHANT_FIELD_MAX_LENGTH}).
1143
+ */
1144
+ async function updateMerchant(patch, options = {}) {
1145
+ const { merge = true,...requestOptions } = options;
1146
+ let merchant = { ...patch };
1147
+ if (merge) {
1148
+ const current = await fetchMerchant(requestOptions);
1149
+ if (!current) throw new ShopwaveApiError(404, "Shopwave API error (404): no merchant to update");
1150
+ if (patch.id != null && String(patch.id) !== String(current.id)) throw new Error(`Merchant id ${patch.id} is not the logged-in merchant (${current.id})`);
1151
+ merchant = {
1152
+ ...current,
1153
+ ...patch,
1154
+ id: current.id
1155
+ };
1156
+ for (const field of MERCHANT_OBJECT_FIELDS) if (!(field in patch)) delete merchant[field];
1157
+ }
1158
+ if (merchant.imageIds && typeof merchant.imageIds === "object") merchant.imageIds = toStoredImageIds(merchant.imageIds);
1159
+ if (merchant.id == null || merchant.id === "") throw new Error("merchant id is missing");
1160
+ for (const field of MERCHANT_READ_ONLY_FIELDS) delete merchant[field];
1161
+ const problems = validateMerchant(merchant);
1162
+ if (problems.length > 0) throw new Error(`Invalid merchant: ${problems.join("; ")}`);
1163
+ const { status, body: raw } = await apiRequest(MERCHANT_PATH, {
1164
+ method: "PUT",
1165
+ headers: { "Content-Type": "application/json" },
1166
+ body: JSON.stringify({ merchant })
1167
+ }, requestOptions);
1168
+ const body = raw;
1169
+ assertNoApiErrors(body, status);
1170
+ const echoed = body?.merchant && typeof body.merchant === "object" ? body.merchant : null;
1171
+ if (echoed) return {
1172
+ ...merchant,
1173
+ ...echoed,
1174
+ id: Number(echoed.id ?? merchant.id)
1175
+ };
1176
+ return await fetchMerchant(requestOptions) ?? {
1177
+ ...merchant,
1178
+ id: Number(merchant.id)
1179
+ };
1180
+ }
1181
+
1182
+ //#endregion
1183
+ //#region src/core/user.ts
1184
+ /** Reads the logged-in user, or `null` when the API returns none. */
1185
+ async function fetchUser(options = {}) {
1186
+ const json = await apiGet(`/api/${SHOPWAVE_RESOURCES.user.route}`, {}, options);
1187
+ assertNoApiErrors(json, 200);
1188
+ return json?.user ?? null;
1189
+ }
1190
+
1191
+ //#endregion
1192
+ export { DEFAULT_BASKET_FILTERS, DEFAULT_PAGINATION, MERCHANT_COLOUR_KEYS, MERCHANT_FIELD_MAX_LENGTH, MERCHANT_IMAGE_SLOTS, MERCHANT_IMAGE_SLOT_KEYS, MERCHANT_LINK_KEYS, MERCHANT_LINK_PATHS, MERCHANT_OBJECT_FIELDS, MERCHANT_READ_ONLY_FIELDS, PromotionRuleSet, SHOPWAVE_ENTITIES, SHOPWAVE_IMAGE_BASE_URL, SHOPWAVE_RESOURCES, SHOPWAVE_UPLOAD, ShopwaveApiError, UPLOAD_KINDS, apiDelete, apiGet, apiRequest, apiSend, assertNoApiErrors, authorizationFor, buildBasketReportQuery, buildConsumerMap, collectConsumerIds, collectProductIds, combineBasketRows, computeBasketSummary, coverCrop, deleteCategory, deleteEmployee, deleteEntity, deleteEntityById, deleteProduct, deletePromotion, deleteStore, fetchCategories, fetchCategory, fetchConsumer, fetchConsumers, fetchEmployee, fetchEmployees, fetchEntityById, fetchMerchant, fetchProduct, fetchProducts, fetchProductsMap, fetchPromotion, fetchPromotions, fetchReport, fetchSession, fetchStore, fetchStores, fetchUser, fitImageToSize, formatDateForQuery, getApiErrorMap, getApiErrors, getImageUrl, getMerchantImage, getMerchantImageUrl, imageFileName, isUploadKind, loginPath, logout, logoutPath, merchantLinksFromForm, merchantLinksToForm, normalizeMerchantLinks, parseBasketReportData, readImageSize, rolesById, saveCategory, saveEmployee, saveEntities, saveEntity, saveProduct, savePromotion, saveStore, setMerchantImage, submitEntity, toShopwaveApiError, toStoredImageIds, updateMerchant, uploadImage, uploadMerchantImage, validateMerchant, withToken };
713
1193
  //# sourceMappingURL=index.js.map