@shipengine/alchemy 2.0.1 → 2.1.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.
@@ -10,6 +10,7 @@ export type AlchemyContextValue = {
10
10
  brandName: BrandName;
11
11
  cdnURL: string;
12
12
  getToken: ShipEngineProps["getToken"];
13
+ locale?: string;
13
14
  onError: AlchemyErrorHandler;
14
15
  scope: string;
15
16
  theme: Theme;
@@ -32,9 +33,10 @@ export interface AlchemyProviderProps {
32
33
  cdnURL?: string;
33
34
  children: React.ReactNode;
34
35
  getToken: ShipEngineProps["getToken"];
36
+ locale?: string;
35
37
  onError?: AlchemyErrorHandler;
36
38
  scope?: string;
37
39
  }
38
- export declare const AlchemyProvider: ({ baseURL, brandName, cdnURL, children, getToken, onError, scope, }: AlchemyProviderProps) => import("@emotion/react/jsx-runtime").JSX.Element | null;
40
+ export declare const AlchemyProvider: ({ baseURL, brandName, cdnURL, children, getToken, locale, onError, scope, }: AlchemyProviderProps) => import("@emotion/react/jsx-runtime").JSX.Element | null;
39
41
  export declare const useAlchemy: () => AlchemyContextValue;
40
42
  export {};
package/index.js CHANGED
@@ -7719,7 +7719,7 @@ class RateCardsAPI {
7719
7719
  formData.append("file", file);
7720
7720
  return this.client.put(`/v1/rate_cards/${rateCardId}/rates/upload`, formData, {
7721
7721
  headers: {
7722
- ContentType: "multipart/form-data"
7722
+ "Content-Type": "multipart/form-data"
7723
7723
  }
7724
7724
  });
7725
7725
  };
@@ -7911,7 +7911,20 @@ class ShipEngineAPI {
7911
7911
  "Content-Type": "application/json"
7912
7912
  }),
7913
7913
  paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
7914
- transformRequest: [(data) => humpsExports.decamelizeKeys(data), (data) => JSON.stringify(data)],
7914
+ transformRequest: [
7915
+ (data) => {
7916
+ if (data && !(data instanceof FormData))
7917
+ return humpsExports.decamelizeKeys(data);
7918
+ else
7919
+ return data;
7920
+ },
7921
+ (data) => {
7922
+ if (data && !(data instanceof FormData))
7923
+ return JSON.stringify(data);
7924
+ else
7925
+ return data;
7926
+ }
7927
+ ],
7915
7928
  transformResponse: [
7916
7929
  (data) => {
7917
7930
  if (data && !(data instanceof Blob))
@@ -9355,7 +9368,8 @@ const useUploadRateCard = () => {
9355
9368
  const { client } = useShipEngine();
9356
9369
  return reactQuery.useMutation({
9357
9370
  mutationFn: (_0) => __async$5(void 0, [_0], function* ({ rateCardId, file }) {
9358
- return yield client.rateCards.upload(rateCardId, file);
9371
+ const result = yield client.rateCards.upload(rateCardId, file);
9372
+ return result.data;
9359
9373
  }),
9360
9374
  mutationKey: ["useUploadRateCard"],
9361
9375
  onError
@@ -9574,6 +9588,7 @@ const AlchemyProvider = ({
9574
9588
  cdnURL = "/",
9575
9589
  children,
9576
9590
  getToken,
9591
+ locale = ((_a) => (_a = navigator == null ? void 0 : navigator.language) != null ? _a : "en-US")(),
9577
9592
  onError = _default,
9578
9593
  scope = "lmnt"
9579
9594
  }) => {
@@ -9583,7 +9598,7 @@ const AlchemyProvider = ({
9583
9598
  const iconCache = React.useMemo(giger.createIconCache, []);
9584
9599
  if (!theme)
9585
9600
  return null;
9586
- const contextValue = { baseURL, brandName, cdnURL, getToken, onError, scope, theme };
9601
+ const contextValue = { baseURL, brandName, cdnURL, getToken, locale, onError, scope, theme };
9587
9602
  return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps$1(__spreadValues$2({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9588
9603
  };
9589
9604
  const useAlchemy = () => {
package/index.mjs CHANGED
@@ -7697,7 +7697,7 @@ class RateCardsAPI {
7697
7697
  formData.append("file", file);
7698
7698
  return this.client.put(`/v1/rate_cards/${rateCardId}/rates/upload`, formData, {
7699
7699
  headers: {
7700
- ContentType: "multipart/form-data"
7700
+ "Content-Type": "multipart/form-data"
7701
7701
  }
7702
7702
  });
7703
7703
  };
@@ -7889,7 +7889,20 @@ class ShipEngineAPI {
7889
7889
  "Content-Type": "application/json"
7890
7890
  }),
7891
7891
  paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
7892
- transformRequest: [(data) => humpsExports.decamelizeKeys(data), (data) => JSON.stringify(data)],
7892
+ transformRequest: [
7893
+ (data) => {
7894
+ if (data && !(data instanceof FormData))
7895
+ return humpsExports.decamelizeKeys(data);
7896
+ else
7897
+ return data;
7898
+ },
7899
+ (data) => {
7900
+ if (data && !(data instanceof FormData))
7901
+ return JSON.stringify(data);
7902
+ else
7903
+ return data;
7904
+ }
7905
+ ],
7893
7906
  transformResponse: [
7894
7907
  (data) => {
7895
7908
  if (data && !(data instanceof Blob))
@@ -9333,7 +9346,8 @@ const useUploadRateCard = () => {
9333
9346
  const { client } = useShipEngine();
9334
9347
  return useMutation({
9335
9348
  mutationFn: (_0) => __async$5(void 0, [_0], function* ({ rateCardId, file }) {
9336
- return yield client.rateCards.upload(rateCardId, file);
9349
+ const result = yield client.rateCards.upload(rateCardId, file);
9350
+ return result.data;
9337
9351
  }),
9338
9352
  mutationKey: ["useUploadRateCard"],
9339
9353
  onError
@@ -9552,6 +9566,7 @@ const AlchemyProvider = ({
9552
9566
  cdnURL = "/",
9553
9567
  children,
9554
9568
  getToken,
9569
+ locale = ((_a) => (_a = navigator == null ? void 0 : navigator.language) != null ? _a : "en-US")(),
9555
9570
  onError = _default,
9556
9571
  scope = "lmnt"
9557
9572
  }) => {
@@ -9561,7 +9576,7 @@ const AlchemyProvider = ({
9561
9576
  const iconCache = useMemo(createIconCache, []);
9562
9577
  if (!theme)
9563
9578
  return null;
9564
- const contextValue = { baseURL, brandName, cdnURL, getToken, onError, scope, theme };
9579
+ const contextValue = { baseURL, brandName, cdnURL, getToken, locale, onError, scope, theme };
9565
9580
  return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps$1(__spreadValues$2({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9566
9581
  };
9567
9582
  const useAlchemy = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/alchemy",
3
- "version": "2.0.1",
3
+ "version": "2.1.1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {