@crystaldesign/diva-navigator 26.4.0-beta.13 → 26.4.0-beta.15

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.
@@ -4,14 +4,14 @@ import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructurin
4
4
  import classNames from 'classnames';
5
5
  import { useTranslation, useDivaCore, getLogger } from '@crystaldesign/diva-core';
6
6
  import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
7
- import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
8
7
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
9
- import _regeneratorRuntime from '@babel/runtime/regenerator';
10
8
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
11
9
  import Fuse from 'fuse.js';
12
10
  import Switch from 'react-switch';
13
11
  import Dropdown from 'react-dropdown';
14
12
  import { md5 } from '@crystaldesign/diva-utils';
13
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
14
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
15
15
  import { Alert, Button as Button$1, Stack, Paper, Typography, Divider, TextField, CircularProgress } from '@mui/material';
16
16
  import SearchIcon from '@mui/icons-material/Search';
17
17
  import _typeof from '@babel/runtime/helpers/typeof';
@@ -503,67 +503,24 @@ var initialState = {
503
503
  function useOrgTree(onSelect) {
504
504
  var _organization$_id;
505
505
  var _useDivaCore = useDivaCore(),
506
- organization = _useDivaCore.state.organization,
507
- organizationHandler = _useDivaCore.handler.organizationHandler;
506
+ _useDivaCore$state = _useDivaCore.state,
507
+ organization = _useDivaCore$state.organization,
508
+ organizationTree = _useDivaCore$state.organizationTree,
509
+ initializing = _useDivaCore$state.initializing;
508
510
  var _useReducer = useReducer(treeReducer, initialState),
509
511
  _useReducer2 = _slicedToArray(_useReducer, 2),
510
512
  state = _useReducer2[0],
511
513
  dispatch = _useReducer2[1];
512
514
  var organizationId = (_organization$_id = organization === null || organization === void 0 ? void 0 : organization._id) !== null && _organization$_id !== void 0 ? _organization$_id : null;
513
515
  useEffect(function () {
514
- var cancelled = false;
515
- _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
516
- var response;
517
- return _regeneratorRuntime.wrap(function _callee$(_context) {
518
- while (1) switch (_context.prev = _context.next) {
519
- case 0:
520
- _context.prev = 0;
521
- _context.next = 3;
522
- return organizationHandler.getOrganizationTree();
523
- case 3:
524
- response = _context.sent;
525
- if (!cancelled) {
526
- _context.next = 6;
527
- break;
528
- }
529
- return _context.abrupt("return");
530
- case 6:
531
- dispatch({
532
- type: 'SET_TREE',
533
- tree: response.tree,
534
- totalAccessible: response.totalAccessible,
535
- selectedId: organizationId
536
- });
537
- _context.next = 12;
538
- break;
539
- case 9:
540
- _context.prev = 9;
541
- _context.t0 = _context["catch"](0);
542
- if (!cancelled) {
543
- dispatch({
544
- type: 'SET_TREE',
545
- tree: [],
546
- totalAccessible: 0,
547
- selectedId: null
548
- });
549
- }
550
- case 12:
551
- case "end":
552
- return _context.stop();
553
- }
554
- }, _callee, null, [[0, 9]]);
555
- }))();
556
- return function () {
557
- cancelled = true;
558
- };
559
- }, []);
560
- useEffect(function () {
561
- if (state.selectedId === organizationId) return;
516
+ if (initializing) return;
562
517
  dispatch({
563
- type: 'SELECT',
564
- nodeId: organizationId
518
+ type: 'SET_TREE',
519
+ tree: organizationTree.tree,
520
+ totalAccessible: organizationTree.totalAccessible,
521
+ selectedId: organizationId
565
522
  });
566
- var path = findPathToNode(state.tree, organizationId);
523
+ var path = findPathToNode(organizationTree.tree, organizationId);
567
524
  if (path) {
568
525
  dispatch({
569
526
  type: 'SET_EXPANDED',
@@ -571,7 +528,7 @@ function useOrgTree(onSelect) {
571
528
  force: 'expand'
572
529
  });
573
530
  }
574
- }, [organizationId, state.tree, state.selectedId]);
531
+ }, [initializing, organizationId, organizationTree.totalAccessible, organizationTree.tree]);
575
532
  var toggleExpand = useCallback(function (nodeId) {
576
533
  dispatch({
577
534
  type: 'SET_EXPANDED',
@@ -849,7 +806,10 @@ function performSearch(fuse, flatItems, query) {
849
806
  var _scoreMap$get, _result$score;
850
807
  var result = _step9.value;
851
808
  var prev = (_scoreMap$get = scoreMap.get(result.item._id)) !== null && _scoreMap$get !== void 0 ? _scoreMap$get : 0;
852
- var positionBonus = getMatchPositionScore(result) * POSITION_WEIGHT;
809
+ // getMatchPositionScore returns rank (0 best -> 2 worst). Convert to boost
810
+ // so stronger positional matches receive larger score reductions.
811
+ var positionRank = getMatchPositionScore(result);
812
+ var positionBonus = Math.max(0, 2 - Math.min(positionRank, 2)) * POSITION_WEIGHT;
853
813
  scoreMap.set(result.item._id, prev + ((_result$score = result.score) !== null && _result$score !== void 0 ? _result$score : 0) - positionBonus - MATCH_COUNT_BONUS);
854
814
  if (result.matches) {
855
815
  var _iterator10 = _createForOfIteratorHelper$2(result.matches),
@@ -2158,10 +2118,11 @@ function matchProduct(_x, _x2, _x3) {
2158
2118
  }
2159
2119
 
2160
2120
  /**
2161
- * Gets the product by the given divaNr.
2121
+ * Checks if the given divaNr is a valid product.
2162
2122
  *
2163
2123
  * @param divaNr The divaNr to get the product for
2164
- * @param apiGetProductByFilter The function to get the product by filter
2124
+ * @param jwt The jwt to use for the request
2125
+ * @param catalogService The catalog service to use for the request
2165
2126
  */
2166
2127
  function _matchProduct() {
2167
2128
  _matchProduct = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, shopBaseUrl, apiGetProductByFilter) {
@@ -2272,49 +2233,58 @@ function _matchProduct() {
2272
2233
  }));
2273
2234
  return _matchProduct.apply(this, arguments);
2274
2235
  }
2275
- function getProductByDivaNr(_x4, _x5) {
2276
- return _getProductByDivaNr.apply(this, arguments);
2236
+ function checkProductByDivaNr(_x4, _x5, _x6) {
2237
+ return _checkProductByDivaNr.apply(this, arguments);
2277
2238
  }
2278
- function _getProductByDivaNr() {
2279
- _getProductByDivaNr = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(divaNr, apiGetProductByFilter) {
2280
- var filter, product, item;
2239
+ function _checkProductByDivaNr() {
2240
+ _checkProductByDivaNr = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(divaNr, jwt, catalogService) {
2241
+ var response, data, item;
2281
2242
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
2282
2243
  while (1) switch (_context2.prev = _context2.next) {
2283
2244
  case 0:
2284
- filter = [{
2285
- id: 'divaNr',
2286
- op: 'eq',
2287
- value: divaNr
2288
- }, {
2289
- id: 'baseProduct',
2290
- op: 'eq',
2291
- value: false
2292
- }];
2245
+ _context2.prev = 0;
2293
2246
  _context2.next = 3;
2294
- return apiGetProductByFilter(filter, 1, true, true);
2247
+ return fetch("".concat(catalogService, "/v1/products/").concat(divaNr, "/list"), {
2248
+ headers: {
2249
+ Authorization: "Bearer ".concat(jwt)
2250
+ }
2251
+ });
2295
2252
  case 3:
2296
- product = _context2.sent;
2297
- item = product.data[0];
2298
- if (item !== null && item !== void 0 && item._id) {
2299
- _context2.next = 7;
2253
+ response = _context2.sent;
2254
+ if (!response.ok) {
2255
+ _context2.next = 11;
2300
2256
  break;
2301
2257
  }
2302
- return _context2.abrupt("return", undefined);
2258
+ _context2.next = 7;
2259
+ return response.json();
2303
2260
  case 7:
2261
+ data = _context2.sent;
2262
+ item = data === null || data === void 0 ? void 0 : data[0];
2263
+ if (!item) {
2264
+ _context2.next = 11;
2265
+ break;
2266
+ }
2304
2267
  return _context2.abrupt("return", {
2305
2268
  id: item._id,
2306
2269
  organizationId: item.organizationId,
2307
2270
  organizationIdDisplayText: item.organizationId_displayText
2308
2271
  });
2309
- case 8:
2272
+ case 11:
2273
+ return _context2.abrupt("return", undefined);
2274
+ case 14:
2275
+ _context2.prev = 14;
2276
+ _context2.t0 = _context2["catch"](0);
2277
+ LOG$1.warn('Error getting product by divaNr or id', _context2.t0);
2278
+ return _context2.abrupt("return", undefined);
2279
+ case 18:
2310
2280
  case "end":
2311
2281
  return _context2.stop();
2312
2282
  }
2313
- }, _callee2);
2283
+ }, _callee2, null, [[0, 14]]);
2314
2284
  }));
2315
- return _getProductByDivaNr.apply(this, arguments);
2285
+ return _checkProductByDivaNr.apply(this, arguments);
2316
2286
  }
2317
- function checkConfigurationByDivaNr(_x6, _x7, _x8) {
2287
+ function checkConfigurationByDivaNr(_x7, _x8, _x9) {
2318
2288
  return _checkConfigurationByDivaNr.apply(this, arguments);
2319
2289
  }
2320
2290
  function _checkConfigurationByDivaNr() {
@@ -2342,28 +2312,17 @@ function _checkConfigurationByDivaNr() {
2342
2312
  case 8:
2343
2313
  data = _context3.sent;
2344
2314
  return _context3.abrupt("return", {
2345
- isValid: true,
2346
2315
  organizationId: data.basket.OrganizationId,
2347
2316
  organizationIdDisplayText: data.basket.OrganizationId_displayText,
2348
2317
  orderStatus: data.basket.OrderStatus
2349
2318
  });
2350
2319
  case 10:
2351
- return _context3.abrupt("return", {
2352
- isValid: false,
2353
- organizationId: undefined,
2354
- organizationIdDisplayText: undefined,
2355
- orderStatus: undefined
2356
- });
2320
+ return _context3.abrupt("return", undefined);
2357
2321
  case 13:
2358
2322
  _context3.prev = 13;
2359
2323
  _context3.t0 = _context3["catch"](1);
2360
2324
  LOG$1.warn('Error checking configuration by divaNr', _context3.t0);
2361
- return _context3.abrupt("return", {
2362
- isValid: false,
2363
- organizationId: undefined,
2364
- organizationIdDisplayText: undefined,
2365
- orderStatus: undefined
2366
- });
2325
+ return _context3.abrupt("return", undefined);
2367
2326
  case 17:
2368
2327
  case "end":
2369
2328
  return _context3.stop();
@@ -2376,7 +2335,7 @@ function _checkConfigurationByDivaNr() {
2376
2335
  * Resolves a divaNr to a FetchedResult by trying basket first, then product.
2377
2336
  * Returns null if neither is found or enabled.
2378
2337
  */
2379
- function resolveDivaNr(_x9, _x10, _x11) {
2338
+ function resolveDivaNr(_x10, _x11) {
2380
2339
  return _resolveDivaNr.apply(this, arguments);
2381
2340
  }
2382
2341
 
@@ -2384,9 +2343,9 @@ function resolveDivaNr(_x9, _x10, _x11) {
2384
2343
  * Opens the given result in the current organization.
2385
2344
  */
2386
2345
  function _resolveDivaNr() {
2387
- _resolveDivaNr = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(divaNr, options, apiGetProductByFilter) {
2346
+ _resolveDivaNr = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(divaNr, options) {
2388
2347
  var _options$qrCodeScanne, _options$qrCodeScanne2;
2389
- var basketEnabled, result, productEnabled, product;
2348
+ var basketEnabled, basket, productEnabled, product;
2390
2349
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
2391
2350
  while (1) switch (_context4.prev = _context4.next) {
2392
2351
  case 0:
@@ -2398,16 +2357,16 @@ function _resolveDivaNr() {
2398
2357
  _context4.next = 4;
2399
2358
  return checkConfigurationByDivaNr(divaNr, options.jwt, options.basketService);
2400
2359
  case 4:
2401
- result = _context4.sent;
2402
- if (!result.isValid) {
2360
+ basket = _context4.sent;
2361
+ if (!basket) {
2403
2362
  _context4.next = 7;
2404
2363
  break;
2405
2364
  }
2406
2365
  return _context4.abrupt("return", {
2407
2366
  type: 'basket',
2408
- organizationId: result.organizationId,
2409
- organizationIdDisplayText: result.organizationIdDisplayText,
2410
- orderStatus: result.orderStatus,
2367
+ organizationId: basket.organizationId,
2368
+ organizationIdDisplayText: basket.organizationIdDisplayText,
2369
+ orderStatus: basket.orderStatus,
2411
2370
  divaNr: divaNr
2412
2371
  });
2413
2372
  case 7:
@@ -2417,7 +2376,7 @@ function _resolveDivaNr() {
2417
2376
  break;
2418
2377
  }
2419
2378
  _context4.next = 11;
2420
- return getProductByDivaNr(divaNr, apiGetProductByFilter);
2379
+ return checkProductByDivaNr(divaNr, options.jwt, options.catalogService);
2421
2380
  case 11:
2422
2381
  product = _context4.sent;
2423
2382
  if (!product) {
@@ -2485,6 +2444,7 @@ function openResultInTargetOrg(result, openComponent, closeModal) {
2485
2444
 
2486
2445
  var LOG = getLogger('Framework', 'QrCoedScanner');
2487
2446
  function Scanner(_ref) {
2447
+ var _organization$type, _organization$type$to;
2488
2448
  var onResult = _ref.onResult;
2489
2449
  var qrCodeReader = useRef();
2490
2450
  var _useDivaCore = useDivaCore(),
@@ -2508,7 +2468,8 @@ function Scanner(_ref) {
2508
2468
  _React$useState2 = _slicedToArray(_React$useState, 2),
2509
2469
  error = _React$useState2[0],
2510
2470
  setError = _React$useState2[1];
2511
- var isWrapperOrg = !(organization !== null && organization !== void 0 && organization.type) && !(organization !== null && organization !== void 0 && organization.parentType);
2471
+ var organizationType = organization === null || organization === void 0 || (_organization$type = organization.type) === null || _organization$type === void 0 || (_organization$type$to = _organization$type.toUpperCase) === null || _organization$type$to === void 0 ? void 0 : _organization$type$to.call(_organization$type);
2472
+ var isWrapperOrg = !(organization !== null && organization !== void 0 && organization.type) && !(organization !== null && organization !== void 0 && organization.parentType) || organizationType === 'SUPPLIER' || organizationType === 'SUPLIER';
2512
2473
  var handleResult = function handleResult(result) {
2513
2474
  var isSameOrg = !result.organizationId || result.organizationId === organization._id;
2514
2475
  if (isSameOrg) {
@@ -2528,7 +2489,8 @@ function Scanner(_ref) {
2528
2489
  options = {
2529
2490
  qrCodeScanner: qrCodeScanner,
2530
2491
  jwt: jwt,
2531
- basketService: apiConfig.basketService
2492
+ basketService: apiConfig.basketService,
2493
+ catalogService: apiConfig.catalogService
2532
2494
  };
2533
2495
  divaNr = matchDivaNr(text);
2534
2496
  if (!divaNr) {
@@ -2537,7 +2499,7 @@ function Scanner(_ref) {
2537
2499
  }
2538
2500
  LOG.debug('Found DivaNr in QR Code: ' + divaNr);
2539
2501
  _context.next = 6;
2540
- return resolveDivaNr(divaNr, options, productHandler.apiGetProductByFilter.bind(productHandler));
2502
+ return resolveDivaNr(divaNr, options);
2541
2503
  case 6:
2542
2504
  result = _context.sent;
2543
2505
  if (!result) {
@@ -2674,12 +2636,14 @@ function OrgActionButtons(_ref) {
2674
2636
  var result = _ref.result,
2675
2637
  organizationId = _ref.organizationId,
2676
2638
  isWrapperOrg = _ref.isWrapperOrg,
2639
+ canAccessTargetOrg = _ref.canAccessTargetOrg,
2677
2640
  onOpenCurrent = _ref.onOpenCurrent,
2678
2641
  onOpenTarget = _ref.onOpenTarget;
2679
2642
  var _useTranslation = useTranslation(),
2680
2643
  t = _useTranslation.t;
2681
2644
  var isSameOrg = !result.organizationId || result.organizationId === organizationId;
2682
- if (isSameOrg) {
2645
+ var isProduct = result.type === 'product';
2646
+ if (isSameOrg || isProduct && !isWrapperOrg || !canAccessTargetOrg) {
2683
2647
  return /*#__PURE__*/jsx(Button$1, {
2684
2648
  variant: "contained",
2685
2649
  onClick: onOpenCurrent,
@@ -2712,18 +2676,20 @@ function OrgActionButtons(_ref) {
2712
2676
  });
2713
2677
  }
2714
2678
  function ScannerModalContent() {
2679
+ var _organization$type, _organization$type$to;
2715
2680
  var _useTranslation2 = useTranslation(),
2716
2681
  t = _useTranslation2.t;
2717
2682
  var _useDivaCore = useDivaCore(),
2718
2683
  _useDivaCore$actions = _useDivaCore.actions,
2719
2684
  closeModal = _useDivaCore$actions.closeModal,
2720
2685
  openComponent = _useDivaCore$actions.openComponent,
2686
+ canAccessOrganization = _useDivaCore$actions.canAccessOrganization,
2721
2687
  _useDivaCore$state = _useDivaCore.state,
2722
2688
  qrCodeScanner = _useDivaCore$state.navigationConfiguration.qrCodeScanner,
2723
2689
  jwt = _useDivaCore$state.jwt,
2724
2690
  apiConfig = _useDivaCore$state.apiConfig,
2725
- organization = _useDivaCore$state.organization,
2726
- productHandler = _useDivaCore.handler.productHandler;
2691
+ organization = _useDivaCore$state.organization;
2692
+ _useDivaCore.handler.productHandler;
2727
2693
  var _React$useState = React.useState(false),
2728
2694
  _React$useState2 = _slicedToArray(_React$useState, 2),
2729
2695
  showScanner = _React$useState2[0],
@@ -2750,7 +2716,9 @@ function ScannerModalContent() {
2750
2716
  var hasEnoughDigits = function hasEnoughDigits(value) {
2751
2717
  return /^DIVA-\d{4}/i.test(value.trim());
2752
2718
  };
2753
- var isWrapperOrg = !(organization !== null && organization !== void 0 && organization.type) && !(organization !== null && organization !== void 0 && organization.parentType);
2719
+ var organizationType = organization === null || organization === void 0 || (_organization$type = organization.type) === null || _organization$type === void 0 || (_organization$type$to = _organization$type.toUpperCase) === null || _organization$type$to === void 0 ? void 0 : _organization$type$to.call(_organization$type);
2720
+ var isWrapperOrg = !(organization !== null && organization !== void 0 && organization.type) && !(organization !== null && organization !== void 0 && organization.parentType) || organizationType === 'SUPPLIER' || organizationType === 'SUPLIER';
2721
+ var canAccessTargetOrg = (fetchedResult === null || fetchedResult === void 0 ? void 0 : fetchedResult.organizationId) != null ? canAccessOrganization(fetchedResult.organizationId) : true;
2754
2722
  React.useEffect(function () {
2755
2723
  var normalized = divaNrInput.trim().toUpperCase();
2756
2724
  if (!isValidDivaNr(normalized) || !hasEnoughDigits(normalized)) {
@@ -2771,8 +2739,9 @@ function ScannerModalContent() {
2771
2739
  return resolveDivaNr(normalized, {
2772
2740
  qrCodeScanner: qrCodeScanner,
2773
2741
  jwt: jwt,
2774
- basketService: apiConfig.basketService
2775
- }, productHandler.apiGetProductByFilter.bind(productHandler));
2742
+ basketService: apiConfig.basketService,
2743
+ catalogService: apiConfig.catalogService
2744
+ });
2776
2745
  case 5:
2777
2746
  result = _context.sent;
2778
2747
  if (!cancelled) {
@@ -2878,6 +2847,7 @@ function ScannerModalContent() {
2878
2847
  result: fetchedResult,
2879
2848
  organizationId: organization._id,
2880
2849
  isWrapperOrg: isWrapperOrg,
2850
+ canAccessTargetOrg: canAccessTargetOrg,
2881
2851
  onOpenCurrent: handleOpenCurrent,
2882
2852
  onOpenTarget: handleOpenTarget
2883
2853
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"Scanner.d.ts","sourceRoot":"","sources":["../../../../../../src/Header/QrCodeScanner/Scanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAM7D,OAAO,EAAE,aAAa,EAAiH,MAAM,SAAS,CAAC;AAIvJ,UAAU,YAAY;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,qBAqGjD"}
1
+ {"version":3,"file":"Scanner.d.ts","sourceRoot":"","sources":["../../../../../../src/Header/QrCodeScanner/Scanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAM7D,OAAO,EACL,aAAa,EAOd,MAAM,SAAS,CAAC;AAIjB,UAAU,YAAY;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,qBAgHjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Header/QrCodeScanner/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAyK1B,MAAM,CAAC,OAAO,gCAyBb"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Header/QrCodeScanner/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgL1B,MAAM,CAAC,OAAO,gCAyBb"}
@@ -49,35 +49,22 @@ export declare function matchProduct(url: string, shopBaseUrl: string, apiGetPro
49
49
  organizationIdDisplayText?: string;
50
50
  } | undefined>;
51
51
  /**
52
- * Gets the product by the given divaNr.
52
+ * Checks if the given divaNr is a valid product.
53
53
  *
54
54
  * @param divaNr The divaNr to get the product for
55
- * @param apiGetProductByFilter The function to get the product by filter
55
+ * @param jwt The jwt to use for the request
56
+ * @param catalogService The catalog service to use for the request
56
57
  */
57
- export declare function getProductByDivaNr(divaNr: string, apiGetProductByFilter: (filter: {
58
- id: string;
59
- op: string;
60
- value: string | number | boolean;
61
- }[], limit: number, useFilter?: boolean, hierarchy?: boolean) => Promise<{
62
- data: any[];
63
- }>): Promise<{
58
+ export declare function checkProductByDivaNr(divaNr: string, jwt: string, catalogService: string): Promise<{
64
59
  id: string;
65
60
  organizationId?: string;
66
61
  organizationIdDisplayText?: string;
67
62
  } | undefined>;
68
63
  export declare function checkConfigurationByDivaNr(divaNr: string, jwt: string, basketService: string): Promise<{
69
- isValid: boolean;
70
64
  organizationId: any;
71
65
  organizationIdDisplayText: any;
72
66
  orderStatus: any;
73
- }>;
74
- type ApiGetProductByFilter = (filter: {
75
- id: string;
76
- op: string;
77
- value: string | number | boolean;
78
- }[], limit: number, useFilter?: boolean, hierarchy?: boolean) => Promise<{
79
- data: any[];
80
- }>;
67
+ } | undefined>;
81
68
  export interface ResolveDivaNrOptions {
82
69
  qrCodeScanner?: boolean | {
83
70
  basket?: boolean;
@@ -85,12 +72,13 @@ export interface ResolveDivaNrOptions {
85
72
  };
86
73
  jwt: string;
87
74
  basketService: string;
75
+ catalogService: string;
88
76
  }
89
77
  /**
90
78
  * Resolves a divaNr to a FetchedResult by trying basket first, then product.
91
79
  * Returns null if neither is found or enabled.
92
80
  */
93
- export declare function resolveDivaNr(divaNr: string, options: ResolveDivaNrOptions, apiGetProductByFilter: ApiGetProductByFilter): Promise<FetchedResult | null>;
81
+ export declare function resolveDivaNr(divaNr: string, options: ResolveDivaNrOptions): Promise<FetchedResult | null>;
94
82
  /**
95
83
  * Opens the given result in the current organization.
96
84
  */
@@ -99,5 +87,4 @@ export declare function openResultInCurrentOrg(result: FetchedResult, openCompon
99
87
  * Opens the given result in the target organization (new tab).
100
88
  */
101
89
  export declare function openResultInTargetOrg(result: FetchedResult, openComponent: (data: Action) => void, closeModal: () => void): void;
102
- export {};
103
90
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/Header/QrCodeScanner/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,0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ourceRoot":"","sources":["../../../../../src/OrgTreeSelect/useOrgTree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAA0C,MAAM,SAAS,CAAC;AAiD9E,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI;;;;;;;2BAyC9C,MAAM;sBAKvC,WAAW;2BAQT,MAAM;EAoBlB"}
1
+ {"version":3,"file":"useOrgTree.d.ts","sourceRoot":"","sources":["../../../../../src/OrgTreeSelect/useOrgTree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAyB,MAAM,SAAS,CAAC;AAiD7D,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI;;;;;;;2BAsB9C,MAAM;sBAKvC,WAAW;2BAQT,MAAM;EAoBlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTreeSearch.d.ts","sourceRoot":"","sources":["../../../../../src/OrgTreeSelect/useTreeSearch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAuB,OAAO,EAAE,MAAM,SAAS,CAAC;AA+NpE,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE;;4BAKZ,MAAM;;6BAIL,OAAO;;;;;EAuDpD"}
1
+ {"version":3,"file":"useTreeSearch.d.ts","sourceRoot":"","sources":["../../../../../src/OrgTreeSelect/useTreeSearch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAuB,OAAO,EAAE,MAAM,SAAS,CAAC;AAkOpE,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE;;4BAKZ,MAAM;;6BAIL,OAAO;;;;;EAuDpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-navigator",
3
- "version": "26.4.0-beta.13",
3
+ "version": "26.4.0-beta.15",
4
4
  "license": "MIT",
5
5
  "devDependencies": {
6
6
  "@testing-library/jest-dom": "^6.5.0",
@@ -25,5 +25,5 @@
25
25
  },
26
26
  "module": "build/esm/index.js",
27
27
  "types": "./build/types/navigator/src/index.d.ts",
28
- "gitHead": "222a2a8bb08a27d4ab5c9482d7752d50e0b5f130"
28
+ "gitHead": "8e582113a0e5f0252e9d7158b422459b74406f7a"
29
29
  }