@crystaldesign/diva-seller 26.13.0-beta.2 → 26.13.0-beta.21
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/build/esm/index.js +68 -5
- package/build/types/seller/src/components/Basket/index.d.ts.map +1 -1
- package/build/types/seller/src/components/Basket/sellerBasketInit.d.ts +32 -0
- package/build/types/seller/src/components/Basket/sellerBasketInit.d.ts.map +1 -0
- package/build/types/seller/src/components/Catalogs/index.d.ts.map +1 -1
- package/build/types/seller/src/tests/sellerBasketInit.test.d.ts +2 -0
- package/build/types/seller/src/tests/sellerBasketInit.test.d.ts.map +1 -0
- package/package.json +9 -5
package/build/esm/index.js
CHANGED
|
@@ -4295,7 +4295,9 @@ function Catalogs(_ref) {
|
|
|
4295
4295
|
if (!collectionId) {
|
|
4296
4296
|
newOptions.columns.unshift({
|
|
4297
4297
|
label: t('catalogs.header.collectionName'),
|
|
4298
|
-
accessor: 'collectionName'
|
|
4298
|
+
accessor: 'collectionName',
|
|
4299
|
+
// Data Engine models carry no supplierName, so searching a supplier finds them only via their collection
|
|
4300
|
+
globalFilterable: true
|
|
4299
4301
|
}, {
|
|
4300
4302
|
label: t('catalogs.header.collectionLogo'),
|
|
4301
4303
|
accessor: 'collectionLogo',
|
|
@@ -8037,6 +8039,37 @@ function useProduct(basket) {
|
|
|
8037
8039
|
};
|
|
8038
8040
|
}
|
|
8039
8041
|
|
|
8042
|
+
/** The basket fields the seller-basket initialization is derived from. */
|
|
8043
|
+
|
|
8044
|
+
/** Labels of the `onInitSellerBasket` business event — the catalog part of `onInitializeConfigurator`. */
|
|
8045
|
+
|
|
8046
|
+
/**
|
|
8047
|
+
* Builds the analytics payload for a basket that is opened in the seller without a configurator (archive, QR code,
|
|
8048
|
+
* deep link). Without it the configurator session would carry no catalog data, because `onInitializeConfigurator`
|
|
8049
|
+
* is only logged by the configurator. Only the first order set is used.
|
|
8050
|
+
*
|
|
8051
|
+
* @param basket the loaded basket
|
|
8052
|
+
* @param requestedDivaNr the divaNr the basket was opened with (the archive passes `DivaNr-DocumentVersion`)
|
|
8053
|
+
* @returns undefined for a basket without order sets
|
|
8054
|
+
*/
|
|
8055
|
+
function getSellerBasketInit(basket, requestedDivaNr) {
|
|
8056
|
+
var _basket$OrderSets;
|
|
8057
|
+
var orderSet = (_basket$OrderSets = basket.OrderSets) === null || _basket$OrderSets === void 0 ? void 0 : _basket$OrderSets[0];
|
|
8058
|
+
if (!orderSet) return undefined;
|
|
8059
|
+
return {
|
|
8060
|
+
basketValue: orderSet.SetPrice,
|
|
8061
|
+
labels: {
|
|
8062
|
+
catalogCodex: orderSet.CatalogCodex,
|
|
8063
|
+
catalogName: orderSet.CatalogName,
|
|
8064
|
+
accountName: orderSet.AccountName,
|
|
8065
|
+
supplierId: orderSet.AccountGUID,
|
|
8066
|
+
originalProductId: basket.MatchingProductId || basket.OrigProductId,
|
|
8067
|
+
initializationType: 'SELLER_BASKET',
|
|
8068
|
+
initializationId: requestedDivaNr || basket.DivaNr
|
|
8069
|
+
}
|
|
8070
|
+
};
|
|
8071
|
+
}
|
|
8072
|
+
|
|
8040
8073
|
function ownKeys$s(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8041
8074
|
function _objectSpread$s(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$s(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$s(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8042
8075
|
var LOG$5 = getLogger('SellerBasket', 'Basket');
|
|
@@ -8090,8 +8123,30 @@ function Basket(_ref) {
|
|
|
8090
8123
|
isLoading = _useProduct.isLoading,
|
|
8091
8124
|
resetProductSaved = _useProduct.resetProductSaved;
|
|
8092
8125
|
var statusRef = useRef(basket !== null && basket !== void 0 && basket.StatusKey ? basket === null || basket === void 0 ? void 0 : basket.StatusKey : basket !== null && basket !== void 0 && basket.Status ? basket === null || basket === void 0 ? void 0 : basket.Status : '');
|
|
8126
|
+
// Configurator session started by the basket itself, i.e. without a configurator: it still lacks the catalog data.
|
|
8127
|
+
var ownSessionIdRef = useRef();
|
|
8128
|
+
var startOwnSession = function startOwnSession() {
|
|
8129
|
+
DivaUtils$1.businessMetrics.setConfiguratorSessionId();
|
|
8130
|
+
ownSessionIdRef.current = DivaUtils$1.businessMetrics.getConfiguratorSessionId();
|
|
8131
|
+
};
|
|
8132
|
+
var logSellerBasketInit = function logSellerBasketInit(loadedBasket, requestedDivaNr, sessionIdAtOpen) {
|
|
8133
|
+
var ownSessionId = ownSessionIdRef.current;
|
|
8134
|
+
// Baskets handed over by the configurator already have its init event in their session, and a load overtaken
|
|
8135
|
+
// by a newer open belongs to an older session.
|
|
8136
|
+
if (!ownSessionId || ownSessionId !== sessionIdAtOpen || ownSessionId !== DivaUtils$1.businessMetrics.getConfiguratorSessionId()) return;
|
|
8137
|
+
if (!loadedBasket) return;
|
|
8138
|
+
var init = getSellerBasketInit(loadedBasket, requestedDivaNr);
|
|
8139
|
+
if (!init) return;
|
|
8140
|
+
// Once per session: loadBasket re-opens the seller with the loaded basket, which runs the loading effect again.
|
|
8141
|
+
ownSessionIdRef.current = undefined;
|
|
8142
|
+
LOG$5.businessEvent('onInitSellerBasket', 'SellerBasket', 'Basket opened without configurator', init.labels);
|
|
8143
|
+
LOG$5.businessEvent('onActualBasketValue', 'SellerBasket', 'Aktueller Basket Value: ' + init.basketValue, {
|
|
8144
|
+
basketValue: init.basketValue,
|
|
8145
|
+
isInit: true
|
|
8146
|
+
});
|
|
8147
|
+
};
|
|
8093
8148
|
useEffect(function () {
|
|
8094
|
-
if (!basket)
|
|
8149
|
+
if (!basket) startOwnSession();
|
|
8095
8150
|
LOG$5.startTransaction({
|
|
8096
8151
|
event: 'onOpenModule',
|
|
8097
8152
|
message: 'Open Basket',
|
|
@@ -8104,12 +8159,16 @@ function Basket(_ref) {
|
|
|
8104
8159
|
useEffect(function () {
|
|
8105
8160
|
// Wait for the seller session to be established before loading the basket.
|
|
8106
8161
|
if (!sessionGuid) return;
|
|
8107
|
-
|
|
8108
|
-
|
|
8162
|
+
// Opening from the archive starts a new session, also while the basket stays mounted.
|
|
8163
|
+
if (checkBasket === '1' || assignNewDivaNr) startOwnSession();
|
|
8164
|
+
var requestedDivaNr = divaNr;
|
|
8165
|
+
var sessionIdAtOpen = DivaUtils$1.businessMetrics.getConfiguratorSessionId();
|
|
8166
|
+
openBasket(statusRef, divaNr, checkBasket, basket, assignNewDivaNr).then(function (result) {
|
|
8109
8167
|
var _getBasketStatusArr;
|
|
8110
8168
|
LOG$5.successTransaction('ON_OPEN_MODULE_BASKET', {
|
|
8111
8169
|
divaNr: divaNr
|
|
8112
8170
|
});
|
|
8171
|
+
logSellerBasketInit(result === null || result === void 0 ? void 0 : result.basket, requestedDivaNr, sessionIdAtOpen);
|
|
8113
8172
|
if (!statusRef.current || !((_getBasketStatusArr = getBasketStatusArr()) !== null && _getBasketStatusArr !== void 0 && _getBasketStatusArr.includes(statusRef.current))) {
|
|
8114
8173
|
var _basketToUpdate, _currentBasketState$b;
|
|
8115
8174
|
var basketToUpdate = basket;
|
|
@@ -8142,11 +8201,15 @@ function Basket(_ref) {
|
|
|
8142
8201
|
setActBasketPage(currentBasketState === null || currentBasketState === void 0 ? void 0 : currentBasketState.step);
|
|
8143
8202
|
}
|
|
8144
8203
|
}, [currentBasketState === null || currentBasketState === void 0 ? void 0 : currentBasketState.step]);
|
|
8204
|
+
var hasSellerSession = !!sessionGuid;
|
|
8145
8205
|
useEffect(function () {
|
|
8206
|
+
// Until the seller session exists the configurator session id is not final yet (cold load, archive open):
|
|
8207
|
+
// a step logged now would end up in a configurator session of its own.
|
|
8208
|
+
if (!hasSellerSession) return;
|
|
8146
8209
|
LOG$5.businessEvent('onBasketStep', 'SellerBasket', "goto BasketStep '".concat(actBasketPage, "'"), {
|
|
8147
8210
|
basketStep: actBasketPage
|
|
8148
8211
|
});
|
|
8149
|
-
}, [actBasketPage]);
|
|
8212
|
+
}, [actBasketPage, hasSellerSession]);
|
|
8150
8213
|
if (!(currentBasketState !== null && currentBasketState !== void 0 && currentBasketState.basket) || loadingBasket) {
|
|
8151
8214
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
8152
8215
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Basket/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAOhD,OAAO,EAA0C,UAAU,EAAa,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Basket/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAOhD,OAAO,EAA0C,UAAU,EAAa,MAAM,0BAA0B,CAAC;AASzG,UAAU,KAAK;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,KAAK,qBA8frF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { BasketData, OrderSetData } from '@crystaldesign/diva-core';
|
|
2
|
+
/** The basket fields the seller-basket initialization is derived from. */
|
|
3
|
+
export interface SellerBasketInitSource extends Pick<BasketData, 'DivaNr' | 'MatchingProductId' | 'OrigProductId'> {
|
|
4
|
+
OrderSets?: Pick<OrderSetData, 'CatalogCodex' | 'CatalogName' | 'AccountName' | 'AccountGUID' | 'SetPrice'>[];
|
|
5
|
+
}
|
|
6
|
+
/** Labels of the `onInitSellerBasket` business event — the catalog part of `onInitializeConfigurator`. */
|
|
7
|
+
export interface SellerBasketInitLabels {
|
|
8
|
+
catalogCodex: string;
|
|
9
|
+
catalogName: string;
|
|
10
|
+
accountName: string;
|
|
11
|
+
/** The AccountGUID, logged under the same name as by the configurator. */
|
|
12
|
+
supplierId: string;
|
|
13
|
+
originalProductId?: string;
|
|
14
|
+
initializationType: 'SELLER_BASKET';
|
|
15
|
+
initializationId: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SellerBasketInit {
|
|
18
|
+
/** Price of the first set — the same meaning as the configurator's `onActualBasketValue`. */
|
|
19
|
+
basketValue: number;
|
|
20
|
+
labels: SellerBasketInitLabels;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Builds the analytics payload for a basket that is opened in the seller without a configurator (archive, QR code,
|
|
24
|
+
* deep link). Without it the configurator session would carry no catalog data, because `onInitializeConfigurator`
|
|
25
|
+
* is only logged by the configurator. Only the first order set is used.
|
|
26
|
+
*
|
|
27
|
+
* @param basket the loaded basket
|
|
28
|
+
* @param requestedDivaNr the divaNr the basket was opened with (the archive passes `DivaNr-DocumentVersion`)
|
|
29
|
+
* @returns undefined for a basket without order sets
|
|
30
|
+
*/
|
|
31
|
+
export declare function getSellerBasketInit(basket: SellerBasketInitSource, requestedDivaNr?: string): SellerBasketInit | undefined;
|
|
32
|
+
//# sourceMappingURL=sellerBasketInit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sellerBasketInit.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Basket/sellerBasketInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEzE,0EAA0E;AAC1E,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,mBAAmB,GAAG,eAAe,CAAC;IAChH,SAAS,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,GAAG,UAAU,CAAC,EAAE,CAAC;CAC/G;AAED,0GAA0G;AAC1G,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,eAAe,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,6FAA6F;IAC7F,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,sBAAsB,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,sBAAsB,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAgB1H"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Catalogs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAczE,UAAU,KAAK;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,YAAY,EAAE,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Catalogs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAczE,UAAU,KAAK;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,YAAY,EAAE,EAAE,KAAK,qBA6TvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sellerBasketInit.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/sellerBasketInit.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystaldesign/diva-seller",
|
|
3
|
-
"version": "26.13.0-beta.
|
|
3
|
+
"version": "26.13.0-beta.21",
|
|
4
4
|
"description": "Seller-facing UI section with its own state provider and services.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"react-dom": "^18.3.1"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@crystaldesign/analytics": "26.13.0-beta.
|
|
33
|
-
"@crystaldesign/products-component": "26.13.0-beta.
|
|
34
|
-
"@crystaldesign/real-time-viewer": "26.13.0-beta.
|
|
32
|
+
"@crystaldesign/analytics": "26.13.0-beta.21",
|
|
33
|
+
"@crystaldesign/products-component": "26.13.0-beta.21",
|
|
34
|
+
"@crystaldesign/real-time-viewer": "26.13.0-beta.21",
|
|
35
35
|
"@emotion/react": "^11.13.3",
|
|
36
36
|
"@emotion/styled": "^11.13.0",
|
|
37
37
|
"@mui/icons-material": "7.3.11",
|
|
@@ -42,5 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"types": "./build/types/seller/src/index.d.ts",
|
|
44
44
|
"module": "build/esm/index.js",
|
|
45
|
-
"
|
|
45
|
+
"jest-junit": {
|
|
46
|
+
"suiteName": "diva-seller",
|
|
47
|
+
"outputDirectory": "./test-reports"
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "8924c019e83cd44f3f2d2ecf41d0e26143d30128"
|
|
46
50
|
}
|