@dutchiesdk/ecommerce-extensions-sdk 0.19.3 → 0.20.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.
package/README.md
CHANGED
|
@@ -380,6 +380,8 @@ import type {
|
|
|
380
380
|
// Component types
|
|
381
381
|
RemoteBoundaryComponent,
|
|
382
382
|
RemoteModuleRegistry,
|
|
383
|
+
ListPageEntry,
|
|
384
|
+
ListPageCategory,
|
|
383
385
|
|
|
384
386
|
// Data types
|
|
385
387
|
Actions,
|
|
@@ -951,6 +953,11 @@ type RemoteModuleRegistry = {
|
|
|
951
953
|
StoreFrontHero?: ModuleRegistryEntry;
|
|
952
954
|
StoreFrontCarouselInterstitials?: ModuleRegistryEntry[];
|
|
953
955
|
ProductDetailsPrimary?: ModuleRegistryEntry;
|
|
956
|
+
ListPageHero?: ModuleRegistryEntry;
|
|
957
|
+
|
|
958
|
+
// Category page components (indexed by pagination page number)
|
|
959
|
+
CategoryPageInterstitials?: ListPageEntry[];
|
|
960
|
+
CategoryPageSlots?: ListPageEntry[];
|
|
954
961
|
|
|
955
962
|
// Custom routable pages
|
|
956
963
|
RouteablePages?: RoutablePageRegistryEntry[];
|
|
@@ -979,6 +986,27 @@ type RoutablePageRegistryEntry = {
|
|
|
979
986
|
path: string;
|
|
980
987
|
component: RemoteBoundaryComponent;
|
|
981
988
|
};
|
|
989
|
+
|
|
990
|
+
type ListPageCategory =
|
|
991
|
+
| "accessories"
|
|
992
|
+
| "apparel"
|
|
993
|
+
| "cbd"
|
|
994
|
+
| "clones"
|
|
995
|
+
| "concentrates"
|
|
996
|
+
| "edibles"
|
|
997
|
+
| "flower"
|
|
998
|
+
| "orals"
|
|
999
|
+
| "pre-rolls"
|
|
1000
|
+
| "seeds"
|
|
1001
|
+
| "tinctures"
|
|
1002
|
+
| "topicals"
|
|
1003
|
+
| "vaporizers"
|
|
1004
|
+
| string;
|
|
1005
|
+
|
|
1006
|
+
type ListPageEntry = {
|
|
1007
|
+
category?: ListPageCategory;
|
|
1008
|
+
components: RemoteBoundaryComponent[];
|
|
1009
|
+
};
|
|
982
1010
|
```
|
|
983
1011
|
|
|
984
1012
|
**Basic Registry:**
|
|
@@ -1038,6 +1066,119 @@ export default {
|
|
|
1038
1066
|
} satisfies RemoteModuleRegistry;
|
|
1039
1067
|
```
|
|
1040
1068
|
|
|
1069
|
+
#### Category Page Components
|
|
1070
|
+
|
|
1071
|
+
The `CategoryPageInterstitials` and `CategoryPageSlots` registry entries allow you to inject custom components into category listing pages. Both use the same configuration structure but appear in different locations on the page.
|
|
1072
|
+
|
|
1073
|
+
**Type:**
|
|
1074
|
+
|
|
1075
|
+
```typescript
|
|
1076
|
+
type ListPageCategory =
|
|
1077
|
+
| "accessories"
|
|
1078
|
+
| "apparel"
|
|
1079
|
+
| "cbd"
|
|
1080
|
+
| "clones"
|
|
1081
|
+
| "concentrates"
|
|
1082
|
+
| "edibles"
|
|
1083
|
+
| "flower"
|
|
1084
|
+
| "orals"
|
|
1085
|
+
| "pre-rolls"
|
|
1086
|
+
| "seeds"
|
|
1087
|
+
| "tinctures"
|
|
1088
|
+
| "topicals"
|
|
1089
|
+
| "vaporizers"
|
|
1090
|
+
| string; // Custom category names are also supported
|
|
1091
|
+
|
|
1092
|
+
type ListPageEntry = {
|
|
1093
|
+
category?: ListPageCategory; // Category to match, or undefined for fallback
|
|
1094
|
+
components: RemoteBoundaryComponent[]; // Components indexed by page number
|
|
1095
|
+
};
|
|
1096
|
+
```
|
|
1097
|
+
|
|
1098
|
+
**Category Matching:**
|
|
1099
|
+
|
|
1100
|
+
- **Predefined category**: When `category` matches a built-in category (e.g., `"edibles"`, `"flower"`), the components display on that category's listing page
|
|
1101
|
+
- **Custom category string**: When `category` is a string that doesn't match a predefined category, it matches a custom category with that name
|
|
1102
|
+
- **Fallback (undefined)**: When `category` is omitted, the entry serves as a fallback used when no other category-specific entries match
|
|
1103
|
+
|
|
1104
|
+
**Page-Based Component Selection:**
|
|
1105
|
+
|
|
1106
|
+
The `components` array is indexed by the current pagination page number:
|
|
1107
|
+
|
|
1108
|
+
- `components[0]` displays on page 1
|
|
1109
|
+
- `components[1]` displays on page 2
|
|
1110
|
+
- And so on...
|
|
1111
|
+
|
|
1112
|
+
If the current page number exceeds the array length, no component is displayed for that page.
|
|
1113
|
+
|
|
1114
|
+
**Example:**
|
|
1115
|
+
|
|
1116
|
+
```tsx
|
|
1117
|
+
import type { RemoteModuleRegistry } from "@dutchiesdk/ecommerce-extensions-sdk";
|
|
1118
|
+
import { createLazyRemoteBoundaryComponent } from "@dutchiesdk/ecommerce-extensions-sdk";
|
|
1119
|
+
|
|
1120
|
+
export default {
|
|
1121
|
+
CategoryPageInterstitials: [
|
|
1122
|
+
// Components for the "edibles" category
|
|
1123
|
+
{
|
|
1124
|
+
category: "edibles",
|
|
1125
|
+
components: [
|
|
1126
|
+
createLazyRemoteBoundaryComponent(
|
|
1127
|
+
() => import("./interstitials/EdiblesPage1")
|
|
1128
|
+
),
|
|
1129
|
+
createLazyRemoteBoundaryComponent(
|
|
1130
|
+
() => import("./interstitials/EdiblesPage2")
|
|
1131
|
+
),
|
|
1132
|
+
],
|
|
1133
|
+
},
|
|
1134
|
+
// Components for a custom category
|
|
1135
|
+
{
|
|
1136
|
+
category: "limited-edition",
|
|
1137
|
+
components: [
|
|
1138
|
+
createLazyRemoteBoundaryComponent(
|
|
1139
|
+
() => import("./interstitials/LimitedEditionPromo")
|
|
1140
|
+
),
|
|
1141
|
+
],
|
|
1142
|
+
},
|
|
1143
|
+
// Fallback for all other categories
|
|
1144
|
+
{
|
|
1145
|
+
// No category specified - this is the fallback
|
|
1146
|
+
components: [
|
|
1147
|
+
createLazyRemoteBoundaryComponent(
|
|
1148
|
+
() => import("./interstitials/DefaultPage1")
|
|
1149
|
+
),
|
|
1150
|
+
createLazyRemoteBoundaryComponent(
|
|
1151
|
+
() => import("./interstitials/DefaultPage2")
|
|
1152
|
+
),
|
|
1153
|
+
createLazyRemoteBoundaryComponent(
|
|
1154
|
+
() => import("./interstitials/DefaultPage3")
|
|
1155
|
+
),
|
|
1156
|
+
],
|
|
1157
|
+
},
|
|
1158
|
+
],
|
|
1159
|
+
|
|
1160
|
+
CategoryPageSlots: [
|
|
1161
|
+
// Slots specific to flower category
|
|
1162
|
+
{
|
|
1163
|
+
category: "flower",
|
|
1164
|
+
components: [
|
|
1165
|
+
createLazyRemoteBoundaryComponent(
|
|
1166
|
+
() => import("./slots/FlowerFeatured")
|
|
1167
|
+
),
|
|
1168
|
+
],
|
|
1169
|
+
},
|
|
1170
|
+
// Fallback slots for all other categories
|
|
1171
|
+
{
|
|
1172
|
+
components: [
|
|
1173
|
+
createLazyRemoteBoundaryComponent(
|
|
1174
|
+
() => import("./slots/GenericPromo")
|
|
1175
|
+
),
|
|
1176
|
+
],
|
|
1177
|
+
},
|
|
1178
|
+
],
|
|
1179
|
+
} satisfies RemoteModuleRegistry;
|
|
1180
|
+
```
|
|
1181
|
+
|
|
1041
1182
|
### Meta Fields & SEO
|
|
1042
1183
|
|
|
1043
1184
|
The `getStoreFrontMetaFields` function allows you to dynamically generate page metadata (title, description, Open Graph tags, structured data) based on the current page and available data.
|
|
@@ -1553,6 +1694,11 @@ export default {
|
|
|
1553
1694
|
() => import("./components/Hero")
|
|
1554
1695
|
),
|
|
1555
1696
|
|
|
1697
|
+
// Hero on Product List pages
|
|
1698
|
+
ListPageHero: createLazyRemoteBoundaryComponent(
|
|
1699
|
+
() => import("./store-front/list-page-hero")
|
|
1700
|
+
),
|
|
1701
|
+
|
|
1556
1702
|
// Custom product page
|
|
1557
1703
|
ProductDetailsPrimary: createLazyRemoteBoundaryComponent(
|
|
1558
1704
|
() => import("./components/ProductDetails")
|
|
@@ -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.20.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);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, useContext, useEffect, useState } from "react";
|
|
2
|
-
const DataBridgeVersion = '0.
|
|
2
|
+
const DataBridgeVersion = '0.20.0';
|
|
3
3
|
const DataBridgeContext = createContext(void 0);
|
|
4
4
|
const useDataBridge = ()=>{
|
|
5
5
|
const context = useContext(DataBridgeContext);
|
|
@@ -58,6 +58,7 @@ export type RemoteModuleRegistry = {
|
|
|
58
58
|
StoreFrontCarouselInterstitials?: ModuleRegistryEntry[];
|
|
59
59
|
StoreFrontHero?: ModuleRegistryEntry;
|
|
60
60
|
ProductDetailsPrimary?: ModuleRegistryEntry;
|
|
61
|
+
ListPageHero?: ModuleRegistryEntry;
|
|
61
62
|
/**
|
|
62
63
|
* Function that provides meta fields for the current page.
|
|
63
64
|
* Replaces the StoreFrontMeta component approach.
|
|
@@ -58,6 +58,7 @@ export type RemoteModuleRegistry = {
|
|
|
58
58
|
StoreFrontCarouselInterstitials?: ModuleRegistryEntry[];
|
|
59
59
|
StoreFrontHero?: ModuleRegistryEntry;
|
|
60
60
|
ProductDetailsPrimary?: ModuleRegistryEntry;
|
|
61
|
+
ListPageHero?: ModuleRegistryEntry;
|
|
61
62
|
/**
|
|
62
63
|
* Function that provides meta fields for the current page.
|
|
63
64
|
* Replaces the StoreFrontMeta component approach.
|