@dutchiesdk/ecommerce-extensions-sdk 0.9.0 → 0.10.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 +4 -0
- 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/actions.d.ts +19 -9
- package/dist/esm/types/ecommerce-extension.d.ts +3 -0
- package/dist/esm/types/events.d.ts +6 -0
- package/dist/esm/types/events.js +0 -0
- package/dist/index.cjs +12 -3
- package/dist/index.d.ts +1 -0
- package/dist/types/actions.d.ts +19 -9
- package/dist/types/ecommerce-extension.d.ts +3 -0
- package/dist/types/events.cjs +18 -0
- package/dist/types/events.d.ts +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -187,6 +187,10 @@ const currentLocations = await dataLoaders.locations(); // Current context locat
|
|
|
187
187
|
|
|
188
188
|
**Note:** All data loaders return empty arrays (`[]`) when no data is available.
|
|
189
189
|
|
|
190
|
+
## Events
|
|
191
|
+
|
|
192
|
+
You can register callback functions that will be triggered by certain events in the Dutchie platform in your extension's `RemoteModuleRegistry` object.
|
|
193
|
+
|
|
190
194
|
## Best Practices
|
|
191
195
|
|
|
192
196
|
### Data Loading
|
|
@@ -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.10.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.10.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
|
@@ -10,8 +10,8 @@ type AuthenticationActions = {
|
|
|
10
10
|
goToRegister: () => void;
|
|
11
11
|
};
|
|
12
12
|
type GoToIdOrCnameParameters = {
|
|
13
|
-
id?: string;
|
|
14
13
|
cname?: string;
|
|
14
|
+
id?: string;
|
|
15
15
|
};
|
|
16
16
|
type CartActions = {
|
|
17
17
|
/**
|
|
@@ -90,14 +90,21 @@ type ListPageActions = {
|
|
|
90
90
|
goToBrandList: () => void;
|
|
91
91
|
/**
|
|
92
92
|
* Navigate to product list
|
|
93
|
-
* @param categoryId - The category ID
|
|
94
|
-
* @param categoryCname - The category CNAME
|
|
95
|
-
* @param brandId - The brand ID
|
|
96
93
|
* @param brandCname - The brand CNAME
|
|
97
|
-
* @param
|
|
94
|
+
* @param brandId - The brand ID
|
|
95
|
+
* @param categoryCname - The category CNAME
|
|
96
|
+
* @param categoryId - The category ID
|
|
98
97
|
* @param collectionCname - The collection CNAME
|
|
98
|
+
* @param collectionId - The collection ID
|
|
99
99
|
*/
|
|
100
|
-
goToProductList: (
|
|
100
|
+
goToProductList: ({ brandCname, brandId, categoryCname, categoryId, collectionCname, collectionId, }: {
|
|
101
|
+
brandCname?: string;
|
|
102
|
+
brandId?: string;
|
|
103
|
+
categoryCname?: string;
|
|
104
|
+
categoryId?: string;
|
|
105
|
+
collectionCname?: string;
|
|
106
|
+
collectionId?: string;
|
|
107
|
+
}) => void;
|
|
101
108
|
};
|
|
102
109
|
type NavigationActions = {
|
|
103
110
|
/**
|
|
@@ -106,10 +113,13 @@ type NavigationActions = {
|
|
|
106
113
|
goToInfoPage: () => void;
|
|
107
114
|
/**
|
|
108
115
|
* Navigate to specific store
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
116
|
+
* @param cname - The store CNAME
|
|
117
|
+
* @param id - The store ID
|
|
111
118
|
*/
|
|
112
|
-
goToStore: (
|
|
119
|
+
goToStore: ({ cname, id }: {
|
|
120
|
+
cname?: string;
|
|
121
|
+
id?: string;
|
|
122
|
+
}) => void;
|
|
113
123
|
/**
|
|
114
124
|
* Navigate to store front
|
|
115
125
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { Events } from './events';
|
|
2
3
|
export type RemoteBoundaryComponent<P = {}> = React.FC<P> & {
|
|
3
4
|
DataBridgeVersion: string;
|
|
4
5
|
};
|
|
@@ -11,6 +12,8 @@ export type RemoteModuleRegistry = {
|
|
|
11
12
|
StoreFrontHeader?: RemoteBoundaryComponent;
|
|
12
13
|
StoreFrontNavigation?: RemoteBoundaryComponent;
|
|
13
14
|
StoreFrontFooter?: RemoteBoundaryComponent;
|
|
15
|
+
StoreFrontCarouselInterstitials?: RemoteBoundaryComponent[];
|
|
14
16
|
StoreFrontHero?: RemoteBoundaryComponent;
|
|
15
17
|
ProductDetailsPrimary?: RemoteBoundaryComponent;
|
|
18
|
+
events?: Events;
|
|
16
19
|
};
|
|
File without changes
|
package/dist/index.cjs
CHANGED
|
@@ -15,6 +15,9 @@ var __webpack_modules__ = {
|
|
|
15
15
|
"./types/ecommerce-extension": function(module) {
|
|
16
16
|
module.exports = require("./types/ecommerce-extension.cjs");
|
|
17
17
|
},
|
|
18
|
+
"./types/events": function(module) {
|
|
19
|
+
module.exports = require("./types/events.cjs");
|
|
20
|
+
},
|
|
18
21
|
"./types/interface": function(module) {
|
|
19
22
|
module.exports = require("./types/interface.cjs");
|
|
20
23
|
}
|
|
@@ -92,10 +95,16 @@ var __webpack_exports__ = {};
|
|
|
92
95
|
return _types_ecommerce_extension__WEBPACK_IMPORTED_MODULE_4__[key];
|
|
93
96
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
94
97
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
95
|
-
var
|
|
98
|
+
var _types_events__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./types/events");
|
|
99
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
100
|
+
for(var __WEBPACK_IMPORT_KEY__ in _types_events__WEBPACK_IMPORTED_MODULE_5__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
101
|
+
return _types_events__WEBPACK_IMPORTED_MODULE_5__[key];
|
|
102
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
103
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
104
|
+
var _types_interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./types/interface");
|
|
96
105
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
97
|
-
for(var __WEBPACK_IMPORT_KEY__ in
|
|
98
|
-
return
|
|
106
|
+
for(var __WEBPACK_IMPORT_KEY__ in _types_interface__WEBPACK_IMPORTED_MODULE_6__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
107
|
+
return _types_interface__WEBPACK_IMPORTED_MODULE_6__[key];
|
|
99
108
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
100
109
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
101
110
|
})();
|
package/dist/index.d.ts
CHANGED
package/dist/types/actions.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ type AuthenticationActions = {
|
|
|
10
10
|
goToRegister: () => void;
|
|
11
11
|
};
|
|
12
12
|
type GoToIdOrCnameParameters = {
|
|
13
|
-
id?: string;
|
|
14
13
|
cname?: string;
|
|
14
|
+
id?: string;
|
|
15
15
|
};
|
|
16
16
|
type CartActions = {
|
|
17
17
|
/**
|
|
@@ -90,14 +90,21 @@ type ListPageActions = {
|
|
|
90
90
|
goToBrandList: () => void;
|
|
91
91
|
/**
|
|
92
92
|
* Navigate to product list
|
|
93
|
-
* @param categoryId - The category ID
|
|
94
|
-
* @param categoryCname - The category CNAME
|
|
95
|
-
* @param brandId - The brand ID
|
|
96
93
|
* @param brandCname - The brand CNAME
|
|
97
|
-
* @param
|
|
94
|
+
* @param brandId - The brand ID
|
|
95
|
+
* @param categoryCname - The category CNAME
|
|
96
|
+
* @param categoryId - The category ID
|
|
98
97
|
* @param collectionCname - The collection CNAME
|
|
98
|
+
* @param collectionId - The collection ID
|
|
99
99
|
*/
|
|
100
|
-
goToProductList: (
|
|
100
|
+
goToProductList: ({ brandCname, brandId, categoryCname, categoryId, collectionCname, collectionId, }: {
|
|
101
|
+
brandCname?: string;
|
|
102
|
+
brandId?: string;
|
|
103
|
+
categoryCname?: string;
|
|
104
|
+
categoryId?: string;
|
|
105
|
+
collectionCname?: string;
|
|
106
|
+
collectionId?: string;
|
|
107
|
+
}) => void;
|
|
101
108
|
};
|
|
102
109
|
type NavigationActions = {
|
|
103
110
|
/**
|
|
@@ -106,10 +113,13 @@ type NavigationActions = {
|
|
|
106
113
|
goToInfoPage: () => void;
|
|
107
114
|
/**
|
|
108
115
|
* Navigate to specific store
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
116
|
+
* @param cname - The store CNAME
|
|
117
|
+
* @param id - The store ID
|
|
111
118
|
*/
|
|
112
|
-
goToStore: (
|
|
119
|
+
goToStore: ({ cname, id }: {
|
|
120
|
+
cname?: string;
|
|
121
|
+
id?: string;
|
|
122
|
+
}) => void;
|
|
113
123
|
/**
|
|
114
124
|
* Navigate to store front
|
|
115
125
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { Events } from './events';
|
|
2
3
|
export type RemoteBoundaryComponent<P = {}> = React.FC<P> & {
|
|
3
4
|
DataBridgeVersion: string;
|
|
4
5
|
};
|
|
@@ -11,6 +12,8 @@ export type RemoteModuleRegistry = {
|
|
|
11
12
|
StoreFrontHeader?: RemoteBoundaryComponent;
|
|
12
13
|
StoreFrontNavigation?: RemoteBoundaryComponent;
|
|
13
14
|
StoreFrontFooter?: RemoteBoundaryComponent;
|
|
15
|
+
StoreFrontCarouselInterstitials?: RemoteBoundaryComponent[];
|
|
14
16
|
StoreFrontHero?: RemoteBoundaryComponent;
|
|
15
17
|
ProductDetailsPrimary?: RemoteBoundaryComponent;
|
|
18
|
+
events?: Events;
|
|
16
19
|
};
|
|
@@ -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
|
+
});
|