thm-p3-configurator 0.0.45 → 0.0.46
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
|
@@ -1 +1,49 @@
|
|
|
1
|
-
# thm-configurator-app
|
|
1
|
+
# thm-configurator-app
|
|
2
|
+
|
|
3
|
+
## Local Testing of Internal Pages
|
|
4
|
+
|
|
5
|
+
To set up and test internal pages locally:
|
|
6
|
+
|
|
7
|
+
1. Enable internal routes:
|
|
8
|
+
|
|
9
|
+
- Open `src/shared/App.jsx`
|
|
10
|
+
- Uncomment the following code:
|
|
11
|
+
```javascript
|
|
12
|
+
{
|
|
13
|
+
APP_CONFIG.nodeEnv === 'development' && APP_CONFIG.internal === true && (
|
|
14
|
+
<TEST_ONLY_INTERNAL_ROUTES />
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
- Add this import at the top of the file:
|
|
19
|
+
```javascript
|
|
20
|
+
import TEST_ONLY_INTERNAL_ROUTES from './__pages__/internal/__TEST_ONLY_INTERNAL_ROUTES';
|
|
21
|
+
```
|
|
22
|
+
- Run `yarn watch`
|
|
23
|
+
|
|
24
|
+
2. Set up authentication:
|
|
25
|
+
- Run the trekhaak-partner-app using `yarn watch`
|
|
26
|
+
- Log in to the partner app
|
|
27
|
+
- Open browser developer tools (F12)
|
|
28
|
+
- Navigate to Application > Local Storage
|
|
29
|
+
- Copy the `__authSession` value from trekhaak-partner-app
|
|
30
|
+
- Go to thm-configurator-app on localhost
|
|
31
|
+
- Open developer tools
|
|
32
|
+
- Navigate to Application > Local Storage
|
|
33
|
+
- Paste the copied value as `__authSession`
|
|
34
|
+
- Refresh the page
|
|
35
|
+
|
|
36
|
+
You should now be able to access the internal pages locally, you can test this by navigating to one of the internal pages in your code editor, change some text and see if it updates.
|
|
37
|
+
|
|
38
|
+
3. Reauthenticating (Optional)
|
|
39
|
+
|
|
40
|
+
- If you receive 401 or 403 errors, your auth session might have expired, you can reauthenticate by following the steps above.
|
|
41
|
+
|
|
42
|
+
## Important Note
|
|
43
|
+
|
|
44
|
+
- **Do not deploy with the internal routes uncommented.**
|
|
45
|
+
- **Only use this for testing purposes.**
|
|
46
|
+
|
|
47
|
+
## Production context
|
|
48
|
+
|
|
49
|
+
On production the internal routes are embedded via the `thm-p3-configurator` package. it automatically will share the auth session in production.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
4
4
|
require("core-js/modules/esnext.iterator.find.js");
|
|
5
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
6
|
require("core-js/modules/esnext.iterator.map.js");
|
|
6
7
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
7
8
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10,6 +11,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
11
|
exports.default = void 0;
|
|
11
12
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
12
13
|
require("core-js/modules/esnext.iterator.find.js");
|
|
14
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
13
15
|
require("core-js/modules/esnext.iterator.map.js");
|
|
14
16
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
15
17
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -72,6 +74,17 @@ const DiscountProductsSelector = () => {
|
|
|
72
74
|
if (!(discountProducts !== null && discountProducts !== void 0 && discountProducts.length)) {
|
|
73
75
|
return null;
|
|
74
76
|
}
|
|
77
|
+
if (selectedDiscountedProducts.length === 0 && discountProducts.length > 0) {
|
|
78
|
+
discountProducts.forEach(product => {
|
|
79
|
+
dispatch({
|
|
80
|
+
type: _OrderSessionContext.orderSessionActions.ADD_DISCOUNTED_PRODUCT,
|
|
81
|
+
payload: {
|
|
82
|
+
articleNumber: product === null || product === void 0 ? void 0 : product.articleNumber,
|
|
83
|
+
quantity: 1
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
75
88
|
return /*#__PURE__*/_react.default.createElement("ol", null, discountProducts === null || discountProducts === void 0 ? void 0 : discountProducts.map(product => {
|
|
76
89
|
const selectedProductAmount = selectedDiscountedProducts.find(selectedProduct => (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.articleNumber) === (product === null || product === void 0 ? void 0 : product.articleNumber));
|
|
77
90
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
@@ -95,8 +95,8 @@ const OrderSessionContext = /*#__PURE__*/(0, _react.createContext)();
|
|
|
95
95
|
OrderSessionContext.displayName = 'OrderSessionContext';
|
|
96
96
|
const INITIAL_ORDER_SESSION_STATE = {
|
|
97
97
|
isTouched: false,
|
|
98
|
-
isEditMode: false,
|
|
99
98
|
existingDossierId: null,
|
|
99
|
+
existingDossierType: null,
|
|
100
100
|
licensePlate: null,
|
|
101
101
|
buildYear: null,
|
|
102
102
|
model: null,
|