@dutchiesdk/ecommerce-extensions-sdk 0.6.0 → 0.6.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.
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ useDataBridge: ()=>useDataBridge,
28
+ DataBridgeContext: ()=>DataBridgeContext,
29
+ DataBridgeVersion: ()=>DataBridgeVersion,
30
+ useAsyncLoader: ()=>useAsyncLoader
31
+ });
32
+ const external_react_namespaceObject = require("react");
33
+ const DataBridgeVersion = '0.2';
34
+ const DataBridgeContext = (0, external_react_namespaceObject.createContext)(void 0);
35
+ const useDataBridge = ()=>{
36
+ const context = (0, external_react_namespaceObject.useContext)(DataBridgeContext);
37
+ if (void 0 === context) throw new Error('useDataBridge must be used within a DataBridgeProvider');
38
+ return context;
39
+ };
40
+ const useAsyncLoader = (fn)=>{
41
+ const [data, setData] = (0, external_react_namespaceObject.useState)(null);
42
+ (0, external_react_namespaceObject.useEffect)(()=>{
43
+ fn().then(setData);
44
+ }, [
45
+ fn
46
+ ]);
47
+ return {
48
+ data,
49
+ isLoading: null === data
50
+ };
51
+ };
52
+ exports.DataBridgeContext = __webpack_exports__.DataBridgeContext;
53
+ exports.DataBridgeVersion = __webpack_exports__.DataBridgeVersion;
54
+ exports.useAsyncLoader = __webpack_exports__.useAsyncLoader;
55
+ exports.useDataBridge = __webpack_exports__.useDataBridge;
56
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
57
+ "DataBridgeContext",
58
+ "DataBridgeVersion",
59
+ "useAsyncLoader",
60
+ "useDataBridge"
61
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
62
+ Object.defineProperty(exports, '__esModule', {
63
+ value: true
64
+ });
@@ -1,7 +1,7 @@
1
1
  import { CommerceComponentsDataInterface } from "../types/dutchie-data-bridge";
2
- export declare const DutchieDataBridgeVersion: string;
3
- export declare const DutchieDataBridgeContext: import("react").Context<CommerceComponentsDataInterface | undefined>;
4
- export declare const useDutchieDataBridge: () => CommerceComponentsDataInterface;
2
+ export declare const DataBridgeVersion = "0.2";
3
+ export declare const DataBridgeContext: import("react").Context<CommerceComponentsDataInterface | undefined>;
4
+ export declare const useDataBridge: () => CommerceComponentsDataInterface;
5
5
  export declare const useAsyncLoader: (fn: () => Promise<unknown>) => {
6
6
  data: unknown;
7
7
  isLoading: boolean;
@@ -0,0 +1,8 @@
1
+ import { CommerceComponentsDataInterface } from "../types/dutchie-data-bridge";
2
+ export declare const DataBridgeVersion = "0.2";
3
+ export declare const DataBridgeContext: import("react").Context<CommerceComponentsDataInterface | undefined>;
4
+ export declare const useDataBridge: () => CommerceComponentsDataInterface;
5
+ export declare const useAsyncLoader: (fn: () => Promise<unknown>) => {
6
+ data: unknown;
7
+ isLoading: boolean;
8
+ };
@@ -0,0 +1,21 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
2
+ const DataBridgeVersion = '0.2';
3
+ const DataBridgeContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(void 0);
4
+ const useDataBridge = ()=>{
5
+ const context = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(DataBridgeContext);
6
+ if (void 0 === context) throw new Error('useDataBridge must be used within a DataBridgeProvider');
7
+ return context;
8
+ };
9
+ const useAsyncLoader = (fn)=>{
10
+ const [data, setData] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(null);
11
+ (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
12
+ fn().then(setData);
13
+ }, [
14
+ fn
15
+ ]);
16
+ return {
17
+ data,
18
+ isLoading: null === data
19
+ };
20
+ };
21
+ export { DataBridgeContext, DataBridgeVersion, useAsyncLoader, useDataBridge };
@@ -0,0 +1,3 @@
1
+ export * from './types/dutchie-data-bridge';
2
+ export * from './types/ecommerce-extension';
3
+ export * from './context/ecommerce-data-bridge';
@@ -0,0 +1,150 @@
1
+ export type CommerceComponentsDataInterface = {
2
+ menuContext: CommerceComponentsMenuContext;
3
+ location?: Dispensary;
4
+ user?: User;
5
+ cart?: Cart;
6
+ dataLoaders: {
7
+ getAllLocations: () => Promise<Dispensary[] | []>;
8
+ locations: () => Promise<Dispensary[] | []>;
9
+ categories: () => Promise<Category[] | []>;
10
+ brands: () => Promise<Brand[] | []>;
11
+ products: () => Promise<Product[] | []>;
12
+ collections: () => Promise<Collection[] | []>;
13
+ };
14
+ actions: {
15
+ goToInfoPage: () => void;
16
+ goToStoreFront: () => void;
17
+ goToStoreLocator: () => void;
18
+ goToStoreBrowser: () => void;
19
+ goToLogin: () => void;
20
+ goToRegister: () => void;
21
+ goToProductDetails: (productId: string) => void;
22
+ goToCategory: (categoryId: string) => void;
23
+ goToBrand: (brandId: string) => void;
24
+ goToStore: (storeId?: string, storeCname?: string) => void;
25
+ goToProductList: (categoryId?: string, categoryCname?: string) => void;
26
+ goToBrandList: (brandId?: string, brandCname?: string) => void;
27
+ showCart: () => void;
28
+ hideCart: () => void;
29
+ addToCart: (productId: string, quantity: number) => void;
30
+ removeFromCart: (productId: string) => void;
31
+ updateCartItem: (productId: string, quantity: number) => void;
32
+ clearCart: () => void;
33
+ goToCheckout: () => void;
34
+ };
35
+ };
36
+ export type Category = {
37
+ id: string;
38
+ name: string;
39
+ cname: string;
40
+ };
41
+ export type Brand = {
42
+ id: string;
43
+ name: string;
44
+ cname: string;
45
+ };
46
+ export type Collection = {
47
+ id: string;
48
+ name: string;
49
+ cname: string;
50
+ };
51
+ export type Product = {
52
+ id: string;
53
+ name: string;
54
+ cname: string;
55
+ price: number;
56
+ image: string;
57
+ description: string;
58
+ };
59
+ export type HoursSettingsForOrderType = {
60
+ enabled: boolean;
61
+ effectiveHours?: {
62
+ Monday?: DayHours;
63
+ Tuesday?: DayHours;
64
+ Wednesday?: DayHours;
65
+ Thursday?: DayHours;
66
+ Friday?: DayHours;
67
+ Saturday?: DayHours;
68
+ Sunday?: DayHours;
69
+ };
70
+ };
71
+ export type DayHours = {
72
+ active?: boolean;
73
+ start?: string;
74
+ end?: string;
75
+ };
76
+ export type DispensaryHoursSettings = {
77
+ inStorePickup?: HoursSettingsForOrderType;
78
+ curbsidePickup?: HoursSettingsForOrderType;
79
+ driveThruPickup?: HoursSettingsForOrderType;
80
+ delivery?: HoursSettingsForOrderType;
81
+ };
82
+ export type OrderTypeConfig = {
83
+ enableASAPOrdering?: boolean;
84
+ enableScheduledOrdering?: boolean;
85
+ enableAfterHoursOrdering?: boolean;
86
+ };
87
+ export type OrderTypesConfigV2 = {
88
+ inStorePickup?: OrderTypeConfig;
89
+ curbsidePickup?: OrderTypeConfig;
90
+ driveThruPickup?: OrderTypeConfig;
91
+ delivery?: OrderTypeConfig;
92
+ offerAnyPickupService?: boolean;
93
+ offerDeliveryService?: boolean;
94
+ };
95
+ export type DispensaryOrderTypes = {
96
+ pickup: boolean;
97
+ inStorePickup: boolean;
98
+ curbsidePickup: boolean;
99
+ driveThruPickup: boolean;
100
+ delivery: boolean;
101
+ kiosk: boolean;
102
+ };
103
+ export type DispensaryAddress = {
104
+ street1: string;
105
+ street2: string;
106
+ city: string;
107
+ state: string;
108
+ stateAbbreviation: string;
109
+ zip: string;
110
+ };
111
+ export type Dispensary = {
112
+ id: string;
113
+ status: string;
114
+ name: string;
115
+ cname: string;
116
+ chain: string;
117
+ phone: string;
118
+ email: string;
119
+ hours: DispensaryHoursSettings;
120
+ orderTypes: DispensaryOrderTypes;
121
+ images: {
122
+ logo: string;
123
+ };
124
+ address: DispensaryAddress;
125
+ links: {
126
+ website: string;
127
+ storeFrontRoot: string;
128
+ };
129
+ orderTypesConfig: OrderTypesConfigV2;
130
+ };
131
+ export type User = {
132
+ email: string;
133
+ firstName: string;
134
+ lastName: string;
135
+ birthday: string;
136
+ };
137
+ export type CartItem = {
138
+ productId: string;
139
+ name: string;
140
+ price: number;
141
+ quantity: number;
142
+ };
143
+ export type Cart = {
144
+ items: CartItem[];
145
+ total: number;
146
+ subtotal: number;
147
+ tax: number;
148
+ discount: number;
149
+ };
150
+ export type CommerceComponentsMenuContext = 'store-front' | 'kiosk';
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export type RemoteBoundaryComponent = React.FC & {
3
+ DataBridgeVersion: string;
4
+ };
5
+ export type RoutablePageRegistryEntry = {
6
+ path: string;
7
+ component: RemoteBoundaryComponent;
8
+ };
9
+ export type RemoteModuleRegistry = {
10
+ RouteablePages?: RoutablePageRegistryEntry[];
11
+ StoreFrontHeader?: RemoteBoundaryComponent;
12
+ StoreFrontNavigation?: RemoteBoundaryComponent;
13
+ StoreFrontFooter?: RemoteBoundaryComponent;
14
+ StoreFrontHero?: RemoteBoundaryComponent;
15
+ ProductDetailsPrimary?: RemoteBoundaryComponent;
16
+ ProductDetailsSecondary?: RemoteBoundaryComponent;
17
+ };
@@ -0,0 +1 @@
1
+ import "react";
package/dist/index.cjs ADDED
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __webpack_modules__ = {
3
+ "./context/ecommerce-data-bridge": function(module) {
4
+ module.exports = require("./context/ecommerce-data-bridge.cjs");
5
+ },
6
+ "./types/dutchie-data-bridge": function(module) {
7
+ module.exports = require("./types/dutchie-data-bridge.cjs");
8
+ },
9
+ "./types/ecommerce-extension": function(module) {
10
+ module.exports = require("./types/ecommerce-extension.cjs");
11
+ }
12
+ };
13
+ var __webpack_module_cache__ = {};
14
+ function __webpack_require__(moduleId) {
15
+ var cachedModule = __webpack_module_cache__[moduleId];
16
+ if (void 0 !== cachedModule) return cachedModule.exports;
17
+ var module = __webpack_module_cache__[moduleId] = {
18
+ exports: {}
19
+ };
20
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
21
+ return module.exports;
22
+ }
23
+ (()=>{
24
+ __webpack_require__.n = (module)=>{
25
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
26
+ __webpack_require__.d(getter, {
27
+ a: getter
28
+ });
29
+ return getter;
30
+ };
31
+ })();
32
+ (()=>{
33
+ __webpack_require__.d = (exports1, definition)=>{
34
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
35
+ enumerable: true,
36
+ get: definition[key]
37
+ });
38
+ };
39
+ })();
40
+ (()=>{
41
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
42
+ })();
43
+ (()=>{
44
+ __webpack_require__.r = (exports1)=>{
45
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
46
+ value: 'Module'
47
+ });
48
+ Object.defineProperty(exports1, '__esModule', {
49
+ value: true
50
+ });
51
+ };
52
+ })();
53
+ var __webpack_exports__ = {};
54
+ (()=>{
55
+ __webpack_require__.r(__webpack_exports__);
56
+ var _types_dutchie_data_bridge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./types/dutchie-data-bridge");
57
+ var __WEBPACK_REEXPORT_OBJECT__ = {};
58
+ for(var __WEBPACK_IMPORT_KEY__ in _types_dutchie_data_bridge__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
59
+ return _types_dutchie_data_bridge__WEBPACK_IMPORTED_MODULE_0__[key];
60
+ }).bind(0, __WEBPACK_IMPORT_KEY__);
61
+ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
62
+ var _types_ecommerce_extension__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./types/ecommerce-extension");
63
+ var __WEBPACK_REEXPORT_OBJECT__ = {};
64
+ for(var __WEBPACK_IMPORT_KEY__ in _types_ecommerce_extension__WEBPACK_IMPORTED_MODULE_1__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
65
+ return _types_ecommerce_extension__WEBPACK_IMPORTED_MODULE_1__[key];
66
+ }).bind(0, __WEBPACK_IMPORT_KEY__);
67
+ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
68
+ var _context_ecommerce_data_bridge__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./context/ecommerce-data-bridge");
69
+ var __WEBPACK_REEXPORT_OBJECT__ = {};
70
+ for(var __WEBPACK_IMPORT_KEY__ in _context_ecommerce_data_bridge__WEBPACK_IMPORTED_MODULE_2__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
71
+ return _context_ecommerce_data_bridge__WEBPACK_IMPORTED_MODULE_2__[key];
72
+ }).bind(0, __WEBPACK_IMPORT_KEY__);
73
+ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
74
+ })();
75
+ for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
76
+ Object.defineProperty(exports, '__esModule', {
77
+ value: true
78
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.r = (exports1)=>{
5
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
6
+ value: 'Module'
7
+ });
8
+ Object.defineProperty(exports1, '__esModule', {
9
+ value: true
10
+ });
11
+ };
12
+ })();
13
+ var __webpack_exports__ = {};
14
+ __webpack_require__.r(__webpack_exports__);
15
+ for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
16
+ Object.defineProperty(exports, '__esModule', {
17
+ value: true
18
+ });
@@ -5,16 +5,57 @@ export type CommerceComponentsDataInterface = {
5
5
  cart?: Cart;
6
6
  dataLoaders: {
7
7
  getAllLocations: () => Promise<Dispensary[] | []>;
8
+ locations: () => Promise<Dispensary[] | []>;
9
+ categories: () => Promise<Category[] | []>;
10
+ brands: () => Promise<Brand[] | []>;
11
+ products: () => Promise<Product[] | []>;
12
+ collections: () => Promise<Collection[] | []>;
8
13
  };
9
14
  actions: {
10
15
  goToInfoPage: () => void;
11
16
  goToStoreFront: () => void;
12
17
  goToStoreLocator: () => void;
13
18
  goToStoreBrowser: () => void;
14
- openLogin: () => void;
15
- openSignUp: () => void;
19
+ goToLogin: () => void;
20
+ goToRegister: () => void;
21
+ goToProductDetails: (productId: string) => void;
22
+ goToCategory: (categoryId: string) => void;
23
+ goToBrand: (brandId: string) => void;
24
+ goToStore: (storeId?: string, storeCname?: string) => void;
25
+ goToProductList: (categoryId?: string, categoryCname?: string) => void;
26
+ goToBrandList: (brandId?: string, brandCname?: string) => void;
27
+ showCart: () => void;
28
+ hideCart: () => void;
29
+ addToCart: (productId: string, quantity: number) => void;
30
+ removeFromCart: (productId: string) => void;
31
+ updateCartItem: (productId: string, quantity: number) => void;
32
+ clearCart: () => void;
33
+ goToCheckout: () => void;
16
34
  };
17
35
  };
36
+ export type Category = {
37
+ id: string;
38
+ name: string;
39
+ cname: string;
40
+ };
41
+ export type Brand = {
42
+ id: string;
43
+ name: string;
44
+ cname: string;
45
+ };
46
+ export type Collection = {
47
+ id: string;
48
+ name: string;
49
+ cname: string;
50
+ };
51
+ export type Product = {
52
+ id: string;
53
+ name: string;
54
+ cname: string;
55
+ price: number;
56
+ image: string;
57
+ description: string;
58
+ };
18
59
  export type HoursSettingsForOrderType = {
19
60
  enabled: boolean;
20
61
  effectiveHours?: {
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ var __webpack_exports__ = {};
3
+ require("react");
4
+ for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
5
+ Object.defineProperty(exports, '__esModule', {
6
+ value: true
7
+ });
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  export type RemoteBoundaryComponent = React.FC & {
2
3
  DataBridgeVersion: string;
3
4
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.6.0",
7
+ "version": "0.6.1",
8
8
  "license": "MIT",
9
9
  "type": "module",
10
10
  "module": "./dist/esm/index.js",
@@ -1,22 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
2
- import * as __WEBPACK_EXTERNAL_MODULE__package_json_1116eba2__ from "../../package.json";
3
- const DutchieDataBridgeVersion = __WEBPACK_EXTERNAL_MODULE__package_json_1116eba2__["default"].version;
4
- const DutchieDataBridgeContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(void 0);
5
- const useDutchieDataBridge = ()=>{
6
- const context = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(DutchieDataBridgeContext);
7
- if (void 0 === context) throw new Error('useDutchieDataBridge must be used within a DutchieDataBridgeProvider');
8
- return context;
9
- };
10
- const useAsyncLoader = (fn)=>{
11
- const [data, setData] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(null);
12
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
13
- fn().then(setData);
14
- }, [
15
- fn
16
- ]);
17
- return {
18
- data,
19
- isLoading: null === data
20
- };
21
- };
22
- export { DutchieDataBridgeContext, DutchieDataBridgeVersion, useAsyncLoader, useDutchieDataBridge };
File without changes
File without changes