@dutchiesdk/ecommerce-extensions-sdk 0.31.1 → 0.32.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.
- package/README.md +28 -1962
- package/dist/context/ecommerce-data-bridge.cjs +1 -1
- package/dist/esm/context/ecommerce-data-bridge.js +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/types/ecommerce-extension.d.ts +4 -1
- package/dist/esm/types/events.d.ts +137 -0
- package/dist/esm/types/filter-side-panel.d.ts +82 -0
- package/dist/esm/types/filter-side-panel.js +0 -0
- package/dist/index.cjs +15 -6
- package/dist/index.d.ts +1 -0
- package/dist/types/ecommerce-extension.d.ts +4 -1
- package/dist/types/events.d.ts +137 -0
- package/dist/types/filter-side-panel.cjs +18 -0
- package/dist/types/filter-side-panel.d.ts +82 -0
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
useDataBridge: ()=>useDataBridge
|
|
31
31
|
});
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
|
-
const DataBridgeVersion = '0.
|
|
33
|
+
const DataBridgeVersion = '0.32.1';
|
|
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);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, useContext, useEffect, useState } from "react";
|
|
2
|
-
const DataBridgeVersion = '0.
|
|
2
|
+
const DataBridgeVersion = '0.32.1';
|
|
3
3
|
const DataBridgeContext = createContext(void 0);
|
|
4
4
|
const useDataBridge = ()=>{
|
|
5
5
|
const context = useContext(DataBridgeContext);
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -4,5 +4,6 @@ export * from "./types/actions.js";
|
|
|
4
4
|
export * from "./types/data.js";
|
|
5
5
|
export * from "./types/ecommerce-extension.js";
|
|
6
6
|
export * from "./types/events.js";
|
|
7
|
+
export * from "./types/filter-side-panel.js";
|
|
7
8
|
export * from "./types/interface.js";
|
|
8
9
|
export * from "./types/product-card.js";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { MenuContext } from './data';
|
|
3
3
|
import type { Events } from './events';
|
|
4
|
+
import type { FilterSidePanelProps } from './filter-side-panel';
|
|
4
5
|
import type { CommerceComponentsDataInterface } from './interface';
|
|
5
6
|
import type { ProductCardGridProps, ProductCardListItemProps } from './product-card';
|
|
6
7
|
/** Union of SDK-defined direct prop types that can be passed through the remote boundary. */
|
|
7
|
-
export type SupportedDirectProps = {} | ProductCardGridProps | ProductCardListItemProps;
|
|
8
|
+
export type SupportedDirectProps = {} | ProductCardGridProps | ProductCardListItemProps | FilterSidePanelProps;
|
|
8
9
|
export type RemoteBoundaryComponent<P = {}> = React.FC<P> & {
|
|
9
10
|
DataBridgeVersion: string;
|
|
10
11
|
};
|
|
@@ -67,6 +68,8 @@ export type RemoteModuleRegistry = {
|
|
|
67
68
|
ProductCard?: ModuleRegistryEntry;
|
|
68
69
|
/** Custom list-view product card rendered in list layout */
|
|
69
70
|
ProductCardListItem?: ModuleRegistryEntry;
|
|
71
|
+
/** Custom filter side panel rendered on desktop product-list pages. */
|
|
72
|
+
FilterSidePanel?: ModuleRegistryEntry;
|
|
70
73
|
ListPageHero?: ModuleRegistryEntry;
|
|
71
74
|
/**
|
|
72
75
|
* Function that provides meta fields for the current page.
|
|
@@ -1,6 +1,143 @@
|
|
|
1
|
+
export type EventProduct = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
category?: string;
|
|
5
|
+
subcategory?: string;
|
|
6
|
+
brandId?: string;
|
|
7
|
+
brandName?: string;
|
|
8
|
+
price: number;
|
|
9
|
+
strainType?: string;
|
|
10
|
+
option?: string;
|
|
11
|
+
};
|
|
12
|
+
export type EventDispensary = {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
16
|
+
export type EventOrder = {
|
|
17
|
+
orderId?: string | null;
|
|
18
|
+
orderStatus?: string | null;
|
|
19
|
+
};
|
|
20
|
+
export type OnAddedProductToCartData = {
|
|
21
|
+
quantity: number;
|
|
22
|
+
product: EventProduct;
|
|
23
|
+
option?: string | null;
|
|
24
|
+
};
|
|
25
|
+
export type OnRemovedProductFromCartData = {
|
|
26
|
+
quantity: number;
|
|
27
|
+
product: EventProduct;
|
|
28
|
+
};
|
|
29
|
+
export type OnCartUpdatedData = {
|
|
30
|
+
cartId?: string;
|
|
31
|
+
dispensaryId?: string;
|
|
32
|
+
dispensaryName?: string;
|
|
33
|
+
deliveryMethod?: string;
|
|
34
|
+
paymentType?: string;
|
|
35
|
+
};
|
|
36
|
+
export type OnCartViewedData = {
|
|
37
|
+
cartId: string;
|
|
38
|
+
dispensaryId: string;
|
|
39
|
+
dispensaryName: string;
|
|
40
|
+
};
|
|
41
|
+
export type OnViewedProductData = {
|
|
42
|
+
product: EventProduct;
|
|
43
|
+
};
|
|
44
|
+
export type OnProductClickedData = {
|
|
45
|
+
position: number;
|
|
46
|
+
product: EventProduct;
|
|
47
|
+
};
|
|
48
|
+
export type OnSearchedForProductData = {
|
|
49
|
+
query: string;
|
|
50
|
+
};
|
|
51
|
+
export type OnSearchResultsData = {
|
|
52
|
+
query: string;
|
|
53
|
+
hasResults: boolean;
|
|
54
|
+
};
|
|
55
|
+
export type OnCheckoutStartedData = {
|
|
56
|
+
total: number;
|
|
57
|
+
revenue: number;
|
|
58
|
+
tax: number;
|
|
59
|
+
discount?: number;
|
|
60
|
+
currency: string;
|
|
61
|
+
};
|
|
62
|
+
export type OnCheckoutSessionData = {
|
|
63
|
+
checkoutToken: string;
|
|
64
|
+
dispensaryId: string;
|
|
65
|
+
dispensaryName: string;
|
|
66
|
+
customerId: string;
|
|
67
|
+
loggedIn: boolean;
|
|
68
|
+
};
|
|
69
|
+
export type OnViewedCheckoutData = {
|
|
70
|
+
checkoutToken: string;
|
|
71
|
+
dispensaryId: string;
|
|
72
|
+
dispensaryName: string;
|
|
73
|
+
};
|
|
74
|
+
/** Fired after a successful order is placed. Superset of onAfterCheckout. */
|
|
75
|
+
export type OnPlacedOrderData = {
|
|
76
|
+
checkoutToken: string;
|
|
77
|
+
order: EventOrder;
|
|
78
|
+
};
|
|
79
|
+
/** @deprecated Use onPlacedOrder for richer order data. */
|
|
1
80
|
export type OnAfterCheckoutData = {
|
|
2
81
|
orderNumber: string;
|
|
3
82
|
};
|
|
83
|
+
export type OnAccountLoginData = {
|
|
84
|
+
customerId: string;
|
|
85
|
+
dispensaryId: string;
|
|
86
|
+
dispensaryName: string;
|
|
87
|
+
newAccount: boolean;
|
|
88
|
+
};
|
|
89
|
+
export type OnLoyaltySignupData = {
|
|
90
|
+
analyticsEventLabel: string;
|
|
91
|
+
};
|
|
92
|
+
export type OnImageBannerClickedData = {
|
|
93
|
+
dispensaryId: string;
|
|
94
|
+
dispensaryName: string;
|
|
95
|
+
};
|
|
96
|
+
export type OnDispensaryClickedData = {
|
|
97
|
+
dispensaryId: string;
|
|
98
|
+
dispensaryName: string;
|
|
99
|
+
dispensaryAddress?: string;
|
|
100
|
+
dispensaryChainName?: string;
|
|
101
|
+
source: string;
|
|
102
|
+
};
|
|
103
|
+
export type OnLoginNudgeData = {
|
|
104
|
+
action: 'clicked' | 'dismissed' | 'viewed';
|
|
105
|
+
};
|
|
106
|
+
export type OnPrivacyPreferenceUpdatedData = {
|
|
107
|
+
preference: string;
|
|
108
|
+
action: string;
|
|
109
|
+
region: string;
|
|
110
|
+
};
|
|
111
|
+
export type OnRoundupForCharityToggledData = {
|
|
112
|
+
action: 'disabled' | 'enabled';
|
|
113
|
+
};
|
|
114
|
+
export type OnGaGTMClickEventData = {
|
|
115
|
+
eventCategory: string;
|
|
116
|
+
eventAction: string;
|
|
117
|
+
eventLabel?: string;
|
|
118
|
+
};
|
|
4
119
|
export type Events = {
|
|
120
|
+
/** @deprecated Use onPlacedOrder for richer order data. */
|
|
5
121
|
onAfterCheckout?: (data: OnAfterCheckoutData) => void;
|
|
122
|
+
onAddedProductToCart?: (data: OnAddedProductToCartData) => void;
|
|
123
|
+
onRemovedProductFromCart?: (data: OnRemovedProductFromCartData) => void;
|
|
124
|
+
onCartUpdated?: (data: OnCartUpdatedData) => void;
|
|
125
|
+
onCartViewed?: (data: OnCartViewedData) => void;
|
|
126
|
+
onViewedProduct?: (data: OnViewedProductData) => void;
|
|
127
|
+
onProductClicked?: (data: OnProductClickedData) => void;
|
|
128
|
+
onSearchedForProduct?: (data: OnSearchedForProductData) => void;
|
|
129
|
+
onSearchResults?: (data: OnSearchResultsData) => void;
|
|
130
|
+
onCheckoutStarted?: (data: OnCheckoutStartedData) => void;
|
|
131
|
+
onCheckoutSession?: (data: OnCheckoutSessionData) => void;
|
|
132
|
+
onViewedCheckout?: (data: OnViewedCheckoutData) => void;
|
|
133
|
+
onPlacedOrder?: (data: OnPlacedOrderData) => void;
|
|
134
|
+
onAccountLogin?: (data: OnAccountLoginData) => void;
|
|
135
|
+
onLoyaltySignup?: (data: OnLoyaltySignupData) => void;
|
|
136
|
+
onImageBannerClicked?: (data: OnImageBannerClickedData) => void;
|
|
137
|
+
onDispensaryClicked?: (data: OnDispensaryClickedData) => void;
|
|
138
|
+
onLoginNudge?: (data: OnLoginNudgeData) => void;
|
|
139
|
+
onPrivacyPreferenceUpdated?: (data: OnPrivacyPreferenceUpdatedData) => void;
|
|
140
|
+
onRoundupForCharityViewed?: () => void;
|
|
141
|
+
onRoundupForCharityToggled?: (data: OnRoundupForCharityToggledData) => void;
|
|
142
|
+
onGaGTMClickEvent?: (data: OnGaGTMClickEventData) => void;
|
|
6
143
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** A selectable option supplied by the marketplace filter panel. */
|
|
2
|
+
export type FilterOption = {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
export type FilterBrandOption = FilterOption & {
|
|
8
|
+
imageUrl: string | null;
|
|
9
|
+
description: string | null;
|
|
10
|
+
};
|
|
11
|
+
export type FilterTerpeneOption = FilterOption & {
|
|
12
|
+
compoundId: string;
|
|
13
|
+
potencyId: string;
|
|
14
|
+
values: string[];
|
|
15
|
+
unit: string;
|
|
16
|
+
unitSymbol: string;
|
|
17
|
+
};
|
|
18
|
+
export type FilterSection = {
|
|
19
|
+
/** Whether the host would render this section in its default sidebar. */
|
|
20
|
+
available: boolean;
|
|
21
|
+
heading: string;
|
|
22
|
+
};
|
|
23
|
+
export type MultiSelectFilterSection<TOption extends FilterOption = FilterOption> = FilterSection & {
|
|
24
|
+
options: TOption[];
|
|
25
|
+
selected: string[];
|
|
26
|
+
};
|
|
27
|
+
export type SingleSelectFilterSection<TOption extends FilterOption = FilterOption> = FilterSection & {
|
|
28
|
+
options: TOption[];
|
|
29
|
+
selected: string | null;
|
|
30
|
+
};
|
|
31
|
+
export type PotencyRange = [number, number];
|
|
32
|
+
export type PotencyFilterSection = FilterSection & {
|
|
33
|
+
min: number;
|
|
34
|
+
max: number;
|
|
35
|
+
step: number;
|
|
36
|
+
unit: string;
|
|
37
|
+
selected: PotencyRange;
|
|
38
|
+
};
|
|
39
|
+
export type FilterCategoryOption = FilterOption & {
|
|
40
|
+
subcategories: FilterOption[];
|
|
41
|
+
};
|
|
42
|
+
export type CategoryFilterSection = FilterSection & {
|
|
43
|
+
categories: FilterCategoryOption[];
|
|
44
|
+
selectedCategory: string | null;
|
|
45
|
+
selectedSubcategories: string[];
|
|
46
|
+
/** Indicates whether default marketplace UI uses multi-select subcategories. */
|
|
47
|
+
allowsMultipleSubcategories: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type FilterBlockKey = 'brands' | 'effects' | 'specials' | 'strainTypes' | 'subcategories' | 'terpenes';
|
|
50
|
+
export type FilterSidePanelProps = {
|
|
51
|
+
isLoading: boolean;
|
|
52
|
+
context: {
|
|
53
|
+
route: string;
|
|
54
|
+
onBrandsPage: boolean;
|
|
55
|
+
onCollectionsPage: boolean;
|
|
56
|
+
onSearchPage: boolean;
|
|
57
|
+
};
|
|
58
|
+
filters: {
|
|
59
|
+
categories: CategoryFilterSection;
|
|
60
|
+
subcategories: MultiSelectFilterSection;
|
|
61
|
+
specials: MultiSelectFilterSection;
|
|
62
|
+
weights: SingleSelectFilterSection;
|
|
63
|
+
brands: MultiSelectFilterSection<FilterBrandOption>;
|
|
64
|
+
strainTypes: MultiSelectFilterSection;
|
|
65
|
+
effects: MultiSelectFilterSection;
|
|
66
|
+
terpenes: MultiSelectFilterSection<FilterTerpeneOption>;
|
|
67
|
+
potencyThc: PotencyFilterSection;
|
|
68
|
+
potencyCbd: PotencyFilterSection;
|
|
69
|
+
};
|
|
70
|
+
/** Toggle an option in a multi-select section and reset the product-list page. */
|
|
71
|
+
onToggleFilter: (filter: FilterBlockKey, value: string) => void;
|
|
72
|
+
/** Set or clear the single-select weight filter and reset the product-list page. */
|
|
73
|
+
onSetWeight: (value: string | null) => void;
|
|
74
|
+
/** Set a potency range and reset the product-list page. */
|
|
75
|
+
onSetPotencyRange: (filter: 'potencyCbd' | 'potencyThc', range: PotencyRange) => void;
|
|
76
|
+
/** Set or clear the selected category; clearing it also clears selected subcategories. */
|
|
77
|
+
onSetCategory: (value: string | null) => void;
|
|
78
|
+
/** Set selected subcategories. The host honors the current single/multi-select behavior. */
|
|
79
|
+
onSetSubcategories: (values: string[]) => void;
|
|
80
|
+
/** Clear all filters exposed by this panel and reset the product-list page. */
|
|
81
|
+
onClearAll: () => void;
|
|
82
|
+
};
|
|
File without changes
|
package/dist/index.cjs
CHANGED
|
@@ -18,6 +18,9 @@ var __webpack_modules__ = {
|
|
|
18
18
|
"./types/events": function(module) {
|
|
19
19
|
module.exports = require("./types/events.cjs");
|
|
20
20
|
},
|
|
21
|
+
"./types/filter-side-panel": function(module) {
|
|
22
|
+
module.exports = require("./types/filter-side-panel.cjs");
|
|
23
|
+
},
|
|
21
24
|
"./types/interface": function(module) {
|
|
22
25
|
module.exports = require("./types/interface.cjs");
|
|
23
26
|
},
|
|
@@ -104,16 +107,22 @@ var __webpack_exports__ = {};
|
|
|
104
107
|
return _types_events__WEBPACK_IMPORTED_MODULE_5__[key];
|
|
105
108
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
106
109
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
107
|
-
var
|
|
110
|
+
var _types_filter_side_panel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./types/filter-side-panel");
|
|
111
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
112
|
+
for(var __WEBPACK_IMPORT_KEY__ in _types_filter_side_panel__WEBPACK_IMPORTED_MODULE_6__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
113
|
+
return _types_filter_side_panel__WEBPACK_IMPORTED_MODULE_6__[key];
|
|
114
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
115
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
116
|
+
var _types_interface__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./types/interface");
|
|
108
117
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
109
|
-
for(var __WEBPACK_IMPORT_KEY__ in
|
|
110
|
-
return
|
|
118
|
+
for(var __WEBPACK_IMPORT_KEY__ in _types_interface__WEBPACK_IMPORTED_MODULE_7__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
119
|
+
return _types_interface__WEBPACK_IMPORTED_MODULE_7__[key];
|
|
111
120
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
112
121
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
113
|
-
var
|
|
122
|
+
var _types_product_card__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./types/product-card");
|
|
114
123
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
115
|
-
for(var __WEBPACK_IMPORT_KEY__ in
|
|
116
|
-
return
|
|
124
|
+
for(var __WEBPACK_IMPORT_KEY__ in _types_product_card__WEBPACK_IMPORTED_MODULE_8__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
125
|
+
return _types_product_card__WEBPACK_IMPORTED_MODULE_8__[key];
|
|
117
126
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
118
127
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
119
128
|
})();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { MenuContext } from './data';
|
|
3
3
|
import type { Events } from './events';
|
|
4
|
+
import type { FilterSidePanelProps } from './filter-side-panel';
|
|
4
5
|
import type { CommerceComponentsDataInterface } from './interface';
|
|
5
6
|
import type { ProductCardGridProps, ProductCardListItemProps } from './product-card';
|
|
6
7
|
/** Union of SDK-defined direct prop types that can be passed through the remote boundary. */
|
|
7
|
-
export type SupportedDirectProps = {} | ProductCardGridProps | ProductCardListItemProps;
|
|
8
|
+
export type SupportedDirectProps = {} | ProductCardGridProps | ProductCardListItemProps | FilterSidePanelProps;
|
|
8
9
|
export type RemoteBoundaryComponent<P = {}> = React.FC<P> & {
|
|
9
10
|
DataBridgeVersion: string;
|
|
10
11
|
};
|
|
@@ -67,6 +68,8 @@ export type RemoteModuleRegistry = {
|
|
|
67
68
|
ProductCard?: ModuleRegistryEntry;
|
|
68
69
|
/** Custom list-view product card rendered in list layout */
|
|
69
70
|
ProductCardListItem?: ModuleRegistryEntry;
|
|
71
|
+
/** Custom filter side panel rendered on desktop product-list pages. */
|
|
72
|
+
FilterSidePanel?: ModuleRegistryEntry;
|
|
70
73
|
ListPageHero?: ModuleRegistryEntry;
|
|
71
74
|
/**
|
|
72
75
|
* Function that provides meta fields for the current page.
|
package/dist/types/events.d.ts
CHANGED
|
@@ -1,6 +1,143 @@
|
|
|
1
|
+
export type EventProduct = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
category?: string;
|
|
5
|
+
subcategory?: string;
|
|
6
|
+
brandId?: string;
|
|
7
|
+
brandName?: string;
|
|
8
|
+
price: number;
|
|
9
|
+
strainType?: string;
|
|
10
|
+
option?: string;
|
|
11
|
+
};
|
|
12
|
+
export type EventDispensary = {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
16
|
+
export type EventOrder = {
|
|
17
|
+
orderId?: string | null;
|
|
18
|
+
orderStatus?: string | null;
|
|
19
|
+
};
|
|
20
|
+
export type OnAddedProductToCartData = {
|
|
21
|
+
quantity: number;
|
|
22
|
+
product: EventProduct;
|
|
23
|
+
option?: string | null;
|
|
24
|
+
};
|
|
25
|
+
export type OnRemovedProductFromCartData = {
|
|
26
|
+
quantity: number;
|
|
27
|
+
product: EventProduct;
|
|
28
|
+
};
|
|
29
|
+
export type OnCartUpdatedData = {
|
|
30
|
+
cartId?: string;
|
|
31
|
+
dispensaryId?: string;
|
|
32
|
+
dispensaryName?: string;
|
|
33
|
+
deliveryMethod?: string;
|
|
34
|
+
paymentType?: string;
|
|
35
|
+
};
|
|
36
|
+
export type OnCartViewedData = {
|
|
37
|
+
cartId: string;
|
|
38
|
+
dispensaryId: string;
|
|
39
|
+
dispensaryName: string;
|
|
40
|
+
};
|
|
41
|
+
export type OnViewedProductData = {
|
|
42
|
+
product: EventProduct;
|
|
43
|
+
};
|
|
44
|
+
export type OnProductClickedData = {
|
|
45
|
+
position: number;
|
|
46
|
+
product: EventProduct;
|
|
47
|
+
};
|
|
48
|
+
export type OnSearchedForProductData = {
|
|
49
|
+
query: string;
|
|
50
|
+
};
|
|
51
|
+
export type OnSearchResultsData = {
|
|
52
|
+
query: string;
|
|
53
|
+
hasResults: boolean;
|
|
54
|
+
};
|
|
55
|
+
export type OnCheckoutStartedData = {
|
|
56
|
+
total: number;
|
|
57
|
+
revenue: number;
|
|
58
|
+
tax: number;
|
|
59
|
+
discount?: number;
|
|
60
|
+
currency: string;
|
|
61
|
+
};
|
|
62
|
+
export type OnCheckoutSessionData = {
|
|
63
|
+
checkoutToken: string;
|
|
64
|
+
dispensaryId: string;
|
|
65
|
+
dispensaryName: string;
|
|
66
|
+
customerId: string;
|
|
67
|
+
loggedIn: boolean;
|
|
68
|
+
};
|
|
69
|
+
export type OnViewedCheckoutData = {
|
|
70
|
+
checkoutToken: string;
|
|
71
|
+
dispensaryId: string;
|
|
72
|
+
dispensaryName: string;
|
|
73
|
+
};
|
|
74
|
+
/** Fired after a successful order is placed. Superset of onAfterCheckout. */
|
|
75
|
+
export type OnPlacedOrderData = {
|
|
76
|
+
checkoutToken: string;
|
|
77
|
+
order: EventOrder;
|
|
78
|
+
};
|
|
79
|
+
/** @deprecated Use onPlacedOrder for richer order data. */
|
|
1
80
|
export type OnAfterCheckoutData = {
|
|
2
81
|
orderNumber: string;
|
|
3
82
|
};
|
|
83
|
+
export type OnAccountLoginData = {
|
|
84
|
+
customerId: string;
|
|
85
|
+
dispensaryId: string;
|
|
86
|
+
dispensaryName: string;
|
|
87
|
+
newAccount: boolean;
|
|
88
|
+
};
|
|
89
|
+
export type OnLoyaltySignupData = {
|
|
90
|
+
analyticsEventLabel: string;
|
|
91
|
+
};
|
|
92
|
+
export type OnImageBannerClickedData = {
|
|
93
|
+
dispensaryId: string;
|
|
94
|
+
dispensaryName: string;
|
|
95
|
+
};
|
|
96
|
+
export type OnDispensaryClickedData = {
|
|
97
|
+
dispensaryId: string;
|
|
98
|
+
dispensaryName: string;
|
|
99
|
+
dispensaryAddress?: string;
|
|
100
|
+
dispensaryChainName?: string;
|
|
101
|
+
source: string;
|
|
102
|
+
};
|
|
103
|
+
export type OnLoginNudgeData = {
|
|
104
|
+
action: 'clicked' | 'dismissed' | 'viewed';
|
|
105
|
+
};
|
|
106
|
+
export type OnPrivacyPreferenceUpdatedData = {
|
|
107
|
+
preference: string;
|
|
108
|
+
action: string;
|
|
109
|
+
region: string;
|
|
110
|
+
};
|
|
111
|
+
export type OnRoundupForCharityToggledData = {
|
|
112
|
+
action: 'disabled' | 'enabled';
|
|
113
|
+
};
|
|
114
|
+
export type OnGaGTMClickEventData = {
|
|
115
|
+
eventCategory: string;
|
|
116
|
+
eventAction: string;
|
|
117
|
+
eventLabel?: string;
|
|
118
|
+
};
|
|
4
119
|
export type Events = {
|
|
120
|
+
/** @deprecated Use onPlacedOrder for richer order data. */
|
|
5
121
|
onAfterCheckout?: (data: OnAfterCheckoutData) => void;
|
|
122
|
+
onAddedProductToCart?: (data: OnAddedProductToCartData) => void;
|
|
123
|
+
onRemovedProductFromCart?: (data: OnRemovedProductFromCartData) => void;
|
|
124
|
+
onCartUpdated?: (data: OnCartUpdatedData) => void;
|
|
125
|
+
onCartViewed?: (data: OnCartViewedData) => void;
|
|
126
|
+
onViewedProduct?: (data: OnViewedProductData) => void;
|
|
127
|
+
onProductClicked?: (data: OnProductClickedData) => void;
|
|
128
|
+
onSearchedForProduct?: (data: OnSearchedForProductData) => void;
|
|
129
|
+
onSearchResults?: (data: OnSearchResultsData) => void;
|
|
130
|
+
onCheckoutStarted?: (data: OnCheckoutStartedData) => void;
|
|
131
|
+
onCheckoutSession?: (data: OnCheckoutSessionData) => void;
|
|
132
|
+
onViewedCheckout?: (data: OnViewedCheckoutData) => void;
|
|
133
|
+
onPlacedOrder?: (data: OnPlacedOrderData) => void;
|
|
134
|
+
onAccountLogin?: (data: OnAccountLoginData) => void;
|
|
135
|
+
onLoyaltySignup?: (data: OnLoyaltySignupData) => void;
|
|
136
|
+
onImageBannerClicked?: (data: OnImageBannerClickedData) => void;
|
|
137
|
+
onDispensaryClicked?: (data: OnDispensaryClickedData) => void;
|
|
138
|
+
onLoginNudge?: (data: OnLoginNudgeData) => void;
|
|
139
|
+
onPrivacyPreferenceUpdated?: (data: OnPrivacyPreferenceUpdatedData) => void;
|
|
140
|
+
onRoundupForCharityViewed?: () => void;
|
|
141
|
+
onRoundupForCharityToggled?: (data: OnRoundupForCharityToggledData) => void;
|
|
142
|
+
onGaGTMClickEvent?: (data: OnGaGTMClickEventData) => void;
|
|
6
143
|
};
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** A selectable option supplied by the marketplace filter panel. */
|
|
2
|
+
export type FilterOption = {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
export type FilterBrandOption = FilterOption & {
|
|
8
|
+
imageUrl: string | null;
|
|
9
|
+
description: string | null;
|
|
10
|
+
};
|
|
11
|
+
export type FilterTerpeneOption = FilterOption & {
|
|
12
|
+
compoundId: string;
|
|
13
|
+
potencyId: string;
|
|
14
|
+
values: string[];
|
|
15
|
+
unit: string;
|
|
16
|
+
unitSymbol: string;
|
|
17
|
+
};
|
|
18
|
+
export type FilterSection = {
|
|
19
|
+
/** Whether the host would render this section in its default sidebar. */
|
|
20
|
+
available: boolean;
|
|
21
|
+
heading: string;
|
|
22
|
+
};
|
|
23
|
+
export type MultiSelectFilterSection<TOption extends FilterOption = FilterOption> = FilterSection & {
|
|
24
|
+
options: TOption[];
|
|
25
|
+
selected: string[];
|
|
26
|
+
};
|
|
27
|
+
export type SingleSelectFilterSection<TOption extends FilterOption = FilterOption> = FilterSection & {
|
|
28
|
+
options: TOption[];
|
|
29
|
+
selected: string | null;
|
|
30
|
+
};
|
|
31
|
+
export type PotencyRange = [number, number];
|
|
32
|
+
export type PotencyFilterSection = FilterSection & {
|
|
33
|
+
min: number;
|
|
34
|
+
max: number;
|
|
35
|
+
step: number;
|
|
36
|
+
unit: string;
|
|
37
|
+
selected: PotencyRange;
|
|
38
|
+
};
|
|
39
|
+
export type FilterCategoryOption = FilterOption & {
|
|
40
|
+
subcategories: FilterOption[];
|
|
41
|
+
};
|
|
42
|
+
export type CategoryFilterSection = FilterSection & {
|
|
43
|
+
categories: FilterCategoryOption[];
|
|
44
|
+
selectedCategory: string | null;
|
|
45
|
+
selectedSubcategories: string[];
|
|
46
|
+
/** Indicates whether default marketplace UI uses multi-select subcategories. */
|
|
47
|
+
allowsMultipleSubcategories: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type FilterBlockKey = 'brands' | 'effects' | 'specials' | 'strainTypes' | 'subcategories' | 'terpenes';
|
|
50
|
+
export type FilterSidePanelProps = {
|
|
51
|
+
isLoading: boolean;
|
|
52
|
+
context: {
|
|
53
|
+
route: string;
|
|
54
|
+
onBrandsPage: boolean;
|
|
55
|
+
onCollectionsPage: boolean;
|
|
56
|
+
onSearchPage: boolean;
|
|
57
|
+
};
|
|
58
|
+
filters: {
|
|
59
|
+
categories: CategoryFilterSection;
|
|
60
|
+
subcategories: MultiSelectFilterSection;
|
|
61
|
+
specials: MultiSelectFilterSection;
|
|
62
|
+
weights: SingleSelectFilterSection;
|
|
63
|
+
brands: MultiSelectFilterSection<FilterBrandOption>;
|
|
64
|
+
strainTypes: MultiSelectFilterSection;
|
|
65
|
+
effects: MultiSelectFilterSection;
|
|
66
|
+
terpenes: MultiSelectFilterSection<FilterTerpeneOption>;
|
|
67
|
+
potencyThc: PotencyFilterSection;
|
|
68
|
+
potencyCbd: PotencyFilterSection;
|
|
69
|
+
};
|
|
70
|
+
/** Toggle an option in a multi-select section and reset the product-list page. */
|
|
71
|
+
onToggleFilter: (filter: FilterBlockKey, value: string) => void;
|
|
72
|
+
/** Set or clear the single-select weight filter and reset the product-list page. */
|
|
73
|
+
onSetWeight: (value: string | null) => void;
|
|
74
|
+
/** Set a potency range and reset the product-list page. */
|
|
75
|
+
onSetPotencyRange: (filter: 'potencyCbd' | 'potencyThc', range: PotencyRange) => void;
|
|
76
|
+
/** Set or clear the selected category; clearing it also clears selected subcategories. */
|
|
77
|
+
onSetCategory: (value: string | null) => void;
|
|
78
|
+
/** Set selected subcategories. The host honors the current single/multi-select behavior. */
|
|
79
|
+
onSetSubcategories: (values: string[]) => void;
|
|
80
|
+
/** Clear all filters exposed by this panel and reset the product-list page. */
|
|
81
|
+
onClearAll: () => void;
|
|
82
|
+
};
|
package/package.json
CHANGED