@dutchiesdk/ecommerce-extensions-sdk 0.11.0 → 0.12.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.
@@ -30,19 +30,20 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  useDataBridge: ()=>useDataBridge
31
31
  });
32
32
  const external_react_namespaceObject = require("react");
33
- const DataBridgeVersion = '0.11.0';
33
+ const DataBridgeVersion = '0.12.0';
34
34
  const DataBridgeContext = (0, external_react_namespaceObject.createContext)(void 0);
35
35
  const useDataBridge = ()=>{
36
36
  const context = (0, external_react_namespaceObject.useContext)(DataBridgeContext);
37
37
  if (void 0 === context) throw new Error('useDataBridge must be used within a DataBridgeProvider');
38
38
  return context;
39
39
  };
40
- const useAsyncLoader = (fn)=>{
40
+ const useAsyncLoader = (fn, params)=>{
41
41
  const [data, setData] = (0, external_react_namespaceObject.useState)(null);
42
42
  (0, external_react_namespaceObject.useEffect)(()=>{
43
- fn().then(setData);
43
+ fn(params).then(setData);
44
44
  }, [
45
- fn
45
+ fn,
46
+ params
46
47
  ]);
47
48
  return {
48
49
  data,
@@ -23,9 +23,10 @@ export declare const useDataBridge: () => CommerceComponentsDataInterface;
23
23
  * A hook to load data asynchronously.
24
24
  *
25
25
  * @param fn - The function to load the data.
26
+ * @param params - Optional parameters to pass to the function.
26
27
  * @returns The data and a boolean indicating if the data is loading.
27
28
  */
28
- export declare const useAsyncLoader: <S>(fn: () => Promise<S>) => {
29
+ export declare const useAsyncLoader: <S, P = void>(fn: (params: P) => Promise<S>, params?: P) => {
29
30
  data: S | null;
30
31
  isLoading: boolean;
31
32
  };
@@ -23,9 +23,10 @@ export declare const useDataBridge: () => CommerceComponentsDataInterface;
23
23
  * A hook to load data asynchronously.
24
24
  *
25
25
  * @param fn - The function to load the data.
26
+ * @param params - Optional parameters to pass to the function.
26
27
  * @returns The data and a boolean indicating if the data is loading.
27
28
  */
28
- export declare const useAsyncLoader: <S>(fn: () => Promise<S>) => {
29
+ export declare const useAsyncLoader: <S, P = void>(fn: (params: P) => Promise<S>, params?: P) => {
29
30
  data: S | null;
30
31
  isLoading: boolean;
31
32
  };
@@ -1,17 +1,18 @@
1
1
  import { createContext, useContext, useEffect, useState } from "react";
2
- const DataBridgeVersion = '0.11.0';
2
+ const DataBridgeVersion = '0.12.0';
3
3
  const DataBridgeContext = createContext(void 0);
4
4
  const useDataBridge = ()=>{
5
5
  const context = useContext(DataBridgeContext);
6
6
  if (void 0 === context) throw new Error('useDataBridge must be used within a DataBridgeProvider');
7
7
  return context;
8
8
  };
9
- const useAsyncLoader = (fn)=>{
9
+ const useAsyncLoader = (fn, params)=>{
10
10
  const [data, setData] = useState(null);
11
11
  useEffect(()=>{
12
- fn().then(setData);
12
+ fn(params).then(setData);
13
13
  }, [
14
- fn
14
+ fn,
15
+ params
15
16
  ]);
16
17
  return {
17
18
  data,
@@ -51,10 +51,12 @@ export type Dispensary = {
51
51
  website: string;
52
52
  storeFrontRoot: string;
53
53
  };
54
+ medDispensary: boolean;
54
55
  name: string;
55
56
  orderTypes: DispensaryOrderTypes;
56
57
  orderTypesConfig: OrderTypesConfig;
57
58
  phone: string;
59
+ recDispensary: boolean;
58
60
  status: string;
59
61
  };
60
62
  export type DispensaryAddress = {
@@ -51,10 +51,12 @@ export type Dispensary = {
51
51
  website: string;
52
52
  storeFrontRoot: string;
53
53
  };
54
+ medDispensary: boolean;
54
55
  name: string;
55
56
  orderTypes: DispensaryOrderTypes;
56
57
  orderTypesConfig: OrderTypesConfig;
57
58
  phone: string;
59
+ recDispensary: boolean;
58
60
  status: string;
59
61
  };
60
62
  export type DispensaryAddress = {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.11.0",
7
+ "version": "0.12.0",
8
8
  "license": "MIT",
9
9
  "type": "module",
10
10
  "module": "./dist/esm/index.js",