@dutchiesdk/ecommerce-extensions-sdk 0.19.3 → 0.19.4
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,
|
|
@@ -952,6 +954,10 @@ type RemoteModuleRegistry = {
|
|
|
952
954
|
StoreFrontCarouselInterstitials?: ModuleRegistryEntry[];
|
|
953
955
|
ProductDetailsPrimary?: ModuleRegistryEntry;
|
|
954
956
|
|
|
957
|
+
// Category page components (indexed by pagination page number)
|
|
958
|
+
CategoryPageInterstitials?: ListPageEntry[];
|
|
959
|
+
CategoryPageSlots?: ListPageEntry[];
|
|
960
|
+
|
|
955
961
|
// Custom routable pages
|
|
956
962
|
RouteablePages?: RoutablePageRegistryEntry[];
|
|
957
963
|
|
|
@@ -979,6 +985,27 @@ type RoutablePageRegistryEntry = {
|
|
|
979
985
|
path: string;
|
|
980
986
|
component: RemoteBoundaryComponent;
|
|
981
987
|
};
|
|
988
|
+
|
|
989
|
+
type ListPageCategory =
|
|
990
|
+
| "accessories"
|
|
991
|
+
| "apparel"
|
|
992
|
+
| "cbd"
|
|
993
|
+
| "clones"
|
|
994
|
+
| "concentrates"
|
|
995
|
+
| "edibles"
|
|
996
|
+
| "flower"
|
|
997
|
+
| "orals"
|
|
998
|
+
| "pre-rolls"
|
|
999
|
+
| "seeds"
|
|
1000
|
+
| "tinctures"
|
|
1001
|
+
| "topicals"
|
|
1002
|
+
| "vaporizers"
|
|
1003
|
+
| string;
|
|
1004
|
+
|
|
1005
|
+
type ListPageEntry = {
|
|
1006
|
+
category?: ListPageCategory;
|
|
1007
|
+
components: RemoteBoundaryComponent[];
|
|
1008
|
+
};
|
|
982
1009
|
```
|
|
983
1010
|
|
|
984
1011
|
**Basic Registry:**
|
|
@@ -1038,6 +1065,119 @@ export default {
|
|
|
1038
1065
|
} satisfies RemoteModuleRegistry;
|
|
1039
1066
|
```
|
|
1040
1067
|
|
|
1068
|
+
#### Category Page Components
|
|
1069
|
+
|
|
1070
|
+
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.
|
|
1071
|
+
|
|
1072
|
+
**Type:**
|
|
1073
|
+
|
|
1074
|
+
```typescript
|
|
1075
|
+
type ListPageCategory =
|
|
1076
|
+
| "accessories"
|
|
1077
|
+
| "apparel"
|
|
1078
|
+
| "cbd"
|
|
1079
|
+
| "clones"
|
|
1080
|
+
| "concentrates"
|
|
1081
|
+
| "edibles"
|
|
1082
|
+
| "flower"
|
|
1083
|
+
| "orals"
|
|
1084
|
+
| "pre-rolls"
|
|
1085
|
+
| "seeds"
|
|
1086
|
+
| "tinctures"
|
|
1087
|
+
| "topicals"
|
|
1088
|
+
| "vaporizers"
|
|
1089
|
+
| string; // Custom category names are also supported
|
|
1090
|
+
|
|
1091
|
+
type ListPageEntry = {
|
|
1092
|
+
category?: ListPageCategory; // Category to match, or undefined for fallback
|
|
1093
|
+
components: RemoteBoundaryComponent[]; // Components indexed by page number
|
|
1094
|
+
};
|
|
1095
|
+
```
|
|
1096
|
+
|
|
1097
|
+
**Category Matching:**
|
|
1098
|
+
|
|
1099
|
+
- **Predefined category**: When `category` matches a built-in category (e.g., `"edibles"`, `"flower"`), the components display on that category's listing page
|
|
1100
|
+
- **Custom category string**: When `category` is a string that doesn't match a predefined category, it matches a custom category with that name
|
|
1101
|
+
- **Fallback (undefined)**: When `category` is omitted, the entry serves as a fallback used when no other category-specific entries match
|
|
1102
|
+
|
|
1103
|
+
**Page-Based Component Selection:**
|
|
1104
|
+
|
|
1105
|
+
The `components` array is indexed by the current pagination page number:
|
|
1106
|
+
|
|
1107
|
+
- `components[0]` displays on page 1
|
|
1108
|
+
- `components[1]` displays on page 2
|
|
1109
|
+
- And so on...
|
|
1110
|
+
|
|
1111
|
+
If the current page number exceeds the array length, no component is displayed for that page.
|
|
1112
|
+
|
|
1113
|
+
**Example:**
|
|
1114
|
+
|
|
1115
|
+
```tsx
|
|
1116
|
+
import type { RemoteModuleRegistry } from "@dutchiesdk/ecommerce-extensions-sdk";
|
|
1117
|
+
import { createLazyRemoteBoundaryComponent } from "@dutchiesdk/ecommerce-extensions-sdk";
|
|
1118
|
+
|
|
1119
|
+
export default {
|
|
1120
|
+
CategoryPageInterstitials: [
|
|
1121
|
+
// Components for the "edibles" category
|
|
1122
|
+
{
|
|
1123
|
+
category: "edibles",
|
|
1124
|
+
components: [
|
|
1125
|
+
createLazyRemoteBoundaryComponent(
|
|
1126
|
+
() => import("./interstitials/EdiblesPage1")
|
|
1127
|
+
),
|
|
1128
|
+
createLazyRemoteBoundaryComponent(
|
|
1129
|
+
() => import("./interstitials/EdiblesPage2")
|
|
1130
|
+
),
|
|
1131
|
+
],
|
|
1132
|
+
},
|
|
1133
|
+
// Components for a custom category
|
|
1134
|
+
{
|
|
1135
|
+
category: "limited-edition",
|
|
1136
|
+
components: [
|
|
1137
|
+
createLazyRemoteBoundaryComponent(
|
|
1138
|
+
() => import("./interstitials/LimitedEditionPromo")
|
|
1139
|
+
),
|
|
1140
|
+
],
|
|
1141
|
+
},
|
|
1142
|
+
// Fallback for all other categories
|
|
1143
|
+
{
|
|
1144
|
+
// No category specified - this is the fallback
|
|
1145
|
+
components: [
|
|
1146
|
+
createLazyRemoteBoundaryComponent(
|
|
1147
|
+
() => import("./interstitials/DefaultPage1")
|
|
1148
|
+
),
|
|
1149
|
+
createLazyRemoteBoundaryComponent(
|
|
1150
|
+
() => import("./interstitials/DefaultPage2")
|
|
1151
|
+
),
|
|
1152
|
+
createLazyRemoteBoundaryComponent(
|
|
1153
|
+
() => import("./interstitials/DefaultPage3")
|
|
1154
|
+
),
|
|
1155
|
+
],
|
|
1156
|
+
},
|
|
1157
|
+
],
|
|
1158
|
+
|
|
1159
|
+
CategoryPageSlots: [
|
|
1160
|
+
// Slots specific to flower category
|
|
1161
|
+
{
|
|
1162
|
+
category: "flower",
|
|
1163
|
+
components: [
|
|
1164
|
+
createLazyRemoteBoundaryComponent(
|
|
1165
|
+
() => import("./slots/FlowerFeatured")
|
|
1166
|
+
),
|
|
1167
|
+
],
|
|
1168
|
+
},
|
|
1169
|
+
// Fallback slots for all other categories
|
|
1170
|
+
{
|
|
1171
|
+
components: [
|
|
1172
|
+
createLazyRemoteBoundaryComponent(
|
|
1173
|
+
() => import("./slots/GenericPromo")
|
|
1174
|
+
),
|
|
1175
|
+
],
|
|
1176
|
+
},
|
|
1177
|
+
],
|
|
1178
|
+
} satisfies RemoteModuleRegistry;
|
|
1179
|
+
```
|
|
1180
|
+
|
|
1041
1181
|
### Meta Fields & SEO
|
|
1042
1182
|
|
|
1043
1183
|
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.
|
|
@@ -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.19.
|
|
33
|
+
const DataBridgeVersion = '0.19.4';
|
|
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.19.
|
|
2
|
+
const DataBridgeVersion = '0.19.4';
|
|
3
3
|
const DataBridgeContext = createContext(void 0);
|
|
4
4
|
const useDataBridge = ()=>{
|
|
5
5
|
const context = useContext(DataBridgeContext);
|