@capillarytech/blaze-ui 5.0.9 → 5.0.10

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.
Files changed (39) hide show
  1. package/.npmrc +2 -0
  2. package/CapCondition/messages.d.ts +85 -0
  3. package/CapCondition/messages.d.ts.map +1 -0
  4. package/CapConditionPreview/MIGRATION_ANALYSIS.md +70 -0
  5. package/CapConditionPreview/README.md +40 -0
  6. package/CapConditionPreview/constants.d.ts +24 -0
  7. package/CapConditionPreview/constants.d.ts.map +1 -0
  8. package/CapConditionPreview/index.d.ts +7 -0
  9. package/CapConditionPreview/index.d.ts.map +1 -0
  10. package/CapConditionPreview/index.js +132 -184
  11. package/CapConditionPreview/index.js.map +1 -1
  12. package/CapConditionPreview/tests/USE_CASES_CapConditionPreview.md +65 -0
  13. package/CapConditionPreview/types.d.ts +82 -0
  14. package/CapConditionPreview/types.d.ts.map +1 -0
  15. package/CapNavigation/index.js +24081 -45909
  16. package/CapNavigation/index.js.map +1 -1
  17. package/CapTopBar/index.js +28663 -44982
  18. package/CapTopBar/index.js.map +1 -1
  19. package/index.d.ts +2 -2
  20. package/index.d.ts.map +1 -1
  21. package/index.js +721 -1042
  22. package/index.js.map +1 -1
  23. package/package.json +1 -1
  24. package/.DS_Store +0 -0
  25. package/CapTopBar/CapOrgSelect.d.ts +0 -12
  26. package/CapTopBar/CapOrgSelect.d.ts.map +0 -1
  27. package/CapTopBar/CapOrgSelectUtils.d.ts +0 -38
  28. package/CapTopBar/CapOrgSelectUtils.d.ts.map +0 -1
  29. package/CapTopBar/README.md +0 -146
  30. package/CapTopBar/constants.d.ts +0 -2
  31. package/CapTopBar/constants.d.ts.map +0 -1
  32. package/CapTopBar/index.d.ts +0 -11
  33. package/CapTopBar/index.d.ts.map +0 -1
  34. package/CapTopBar/themeConfig.d.ts +0 -6
  35. package/CapTopBar/themeConfig.d.ts.map +0 -1
  36. package/CapTopBar/types.d.ts +0 -106
  37. package/CapTopBar/types.d.ts.map +0 -1
  38. package/CapTopBar/utils.d.ts +0 -8
  39. package/CapTopBar/utils.d.ts.map +0 -1
@@ -2731,25 +2731,6 @@ var _default = exports["default"] = SvgFacebookFilled;
2731
2731
 
2732
2732
  /***/ }),
2733
2733
 
2734
- /***/ 15799:
2735
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2736
-
2737
- "use strict";
2738
-
2739
-
2740
- exports.__esModule = true;
2741
- exports.StyledFlexWrapDiv = exports.StyledCapLabel = exports.SkuDownloadLink = void 0;
2742
- var _styledComponents = _interopRequireDefault(__webpack_require__(76480));
2743
- var _CapLabel = _interopRequireDefault(__webpack_require__(92675));
2744
- var _templateObject, _templateObject2, _templateObject3;
2745
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
2746
- function _taggedTemplateLiteralLoose(e, t) { return t || (t = e.slice(0)), e.raw = t, e; }
2747
- const StyledFlexWrapDiv = exports.StyledFlexWrapDiv = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n & > * {\n margin: 6px 4px;\n }\n"])));
2748
- const SkuDownloadLink = exports.SkuDownloadLink = _styledComponents.default.a(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-left: 8px;\n & > .cap-icon-v2-download {\n margin-right: 4px;\n }\n"])));
2749
- const StyledCapLabel = exports.StyledCapLabel = (0, _styledComponents.default)(_CapLabel.default)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n background-color: #ecece7;\n border-radius: 16px;\n height: 32px;\n padding: 9px 13px;\n"])));
2750
-
2751
- /***/ }),
2752
-
2753
2734
  /***/ 15969:
2754
2735
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2755
2736
 
@@ -14811,14 +14792,6 @@ var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js
14811
14792
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default()) && (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) ? (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) : undefined);
14812
14793
 
14813
14794
 
14814
- /***/ }),
14815
-
14816
- /***/ 76480:
14817
- /***/ ((module) => {
14818
-
14819
- "use strict";
14820
- module.exports = require("styled-components");
14821
-
14822
14795
  /***/ }),
14823
14796
 
14824
14797
  /***/ 76545:
@@ -17986,10 +17959,13 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(31601);
17986
17959
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(76314);
17987
17960
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
17988
17961
  // Module
17989
- ___CSS_LOADER_EXPORT___.push([module.id, `.cap-condition-preview-string{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}`, ""]);
17962
+ ___CSS_LOADER_EXPORT___.push([module.id, `.capConditionPreview__string{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.capConditionPreview__flexWrapDiv{display:flex;align-items:center;flex-wrap:wrap}.capConditionPreview__flexWrapDiv>*{margin:.428rem .285rem}.capConditionPreview__skuDownloadLink{display:flex;align-items:center;margin-left:.571rem}.capConditionPreview__skuDownloadLink>.cap-icon-v2-download{margin-right:.285rem}.capConditionPreview__label{background-color:#ecece7;border-radius:1.143rem;height:2.285rem;padding:.642rem .928rem}.margin-r-4{margin-right:.285rem}.margin-l-4{margin-left:.285rem}.margin-r-20{margin-right:1.428rem}`, ""]);
17990
17963
  // Exports
17991
17964
  ___CSS_LOADER_EXPORT___.locals = {
17992
- "cap-condition-preview-string": `cap-condition-preview-string`
17965
+ "capConditionPreview__string": `capConditionPreview__string`,
17966
+ "capConditionPreview__flexWrapDiv": `capConditionPreview__flexWrapDiv`,
17967
+ "capConditionPreview__skuDownloadLink": `capConditionPreview__skuDownloadLink`,
17968
+ "capConditionPreview__label": `capConditionPreview__label`
17993
17969
  };
17994
17970
  module.exports = ___CSS_LOADER_EXPORT___;
17995
17971
 
@@ -18198,7 +18174,6 @@ exports.__esModule = true;
18198
18174
  exports["default"] = void 0;
18199
18175
  var _classnames = _interopRequireDefault(__webpack_require__(46942));
18200
18176
  var _isEmpty = _interopRequireDefault(__webpack_require__(62193));
18201
- var _propTypes = _interopRequireDefault(__webpack_require__(43363));
18202
18177
  var _react = _interopRequireDefault(__webpack_require__(9206));
18203
18178
  var _reactIntl = __webpack_require__(46407);
18204
18179
  var _CapColumn = _interopRequireDefault(__webpack_require__(4757));
@@ -18210,21 +18185,21 @@ var _CapTruncateList = _interopRequireDefault(__webpack_require__(14545));
18210
18185
  var _LocaleHoc = _interopRequireDefault(__webpack_require__(39879));
18211
18186
  var _variables = __webpack_require__(56587);
18212
18187
  var _constants = __webpack_require__(41859);
18213
- var _style = __webpack_require__(15799);
18214
- __webpack_require__(29236);
18188
+ var _styles = _interopRequireDefault(__webpack_require__(29236));
18215
18189
  var _jsxRuntime = __webpack_require__(74848);
18216
18190
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18217
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } /**
18191
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
18192
+ /**
18218
18193
  * Timezone-safe date formatting helper that detects YYYY-MM-DD format
18219
18194
  * and constructs a local Date to avoid timezone shifts
18220
18195
  */
18221
18196
  function formatDateForPreview(input) {
18222
18197
  if (!input) return '';
18223
18198
  try {
18224
- // Treat YYYY-MM-DD as a local calendar date to avoid TZ shift
18225
- const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(input);
18226
- const d = m ? new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])) : new Date(input);
18227
- return Number.isNaN(d.getTime()) ? '' : d.toLocaleDateString('en-US'); // or use browser locale if desired
18199
+ const str = String(input);
18200
+ const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(str);
18201
+ const d = m ? new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])) : new Date(str);
18202
+ return Number.isNaN(d.getTime()) ? '' : d.toLocaleDateString('en-US');
18228
18203
  } catch (_unused) {
18229
18204
  return '';
18230
18205
  }
@@ -18262,7 +18237,6 @@ const CapConditionPreview = _ref => {
18262
18237
  inMsg,
18263
18238
  notInMsg,
18264
18239
  hideNumberAndProductFields = false,
18265
- // This flag is to hide some fields for Store profile, Custom fields etc in journey context.
18266
18240
  viewMoreMsg,
18267
18241
  storesMsg,
18268
18242
  uploadInProgressMsg,
@@ -18276,9 +18250,6 @@ const CapConditionPreview = _ref => {
18276
18250
  dateTypeData
18277
18251
  } = _ref;
18278
18252
  const isStoreFilter = !(0, _isEmpty.default)(additionalFields == null ? void 0 : additionalFields.STORE_FILTER);
18279
- /**
18280
- * operandsMapping, mapping for supported operands for numbers
18281
- */
18282
18253
  const operandsMapping = {
18283
18254
  EQ: {
18284
18255
  text: equalMsg,
@@ -18341,28 +18312,31 @@ const CapConditionPreview = _ref => {
18341
18312
  isList: false
18342
18313
  }
18343
18314
  };
18344
- const ValuesPrefix = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
18345
- children: !hideNumberAndProductFields && operator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18346
- type: "label18",
18347
- children: operandsMapping[operator].text
18348
- }) : null
18349
- });
18350
-
18351
- //common function to handle csv downloads
18315
+ const ValuesPrefix = () => {
18316
+ var _operandsMapping$oper;
18317
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
18318
+ children: !hideNumberAndProductFields && operator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18319
+ type: "label18",
18320
+ children: (_operandsMapping$oper = operandsMapping[operator]) == null ? void 0 : _operandsMapping$oper.text
18321
+ }) : null
18322
+ });
18323
+ };
18352
18324
  const downloadHandler = (event, data, downloadedFileName) => {
18353
- event.target.setAttribute('href', "data:text/csv;charset=utf-8," + encodeURIComponent(data));
18354
- event.target.setAttribute('download', downloadedFileName);
18325
+ const target = event.currentTarget;
18326
+ target.setAttribute('href', "data:text/csv;charset=utf-8," + encodeURIComponent(data));
18327
+ target.setAttribute('download', downloadedFileName);
18355
18328
  };
18356
18329
  const downloadSKUs = function (event, list) {
18357
18330
  if (list === void 0) {
18358
18331
  list = [];
18359
18332
  }
18360
- const csvArray = [[addedSKUsMsg]];
18333
+ const csvArray = [[addedSKUsMsg != null ? addedSKUsMsg : '']];
18361
18334
  list.forEach(sku => csvArray.push([sku]));
18362
18335
  const csvContent = csvArray.map(e => e.join(',')).join('\n');
18363
- downloadHandler(event, csvContent, skuFileName);
18336
+ downloadHandler(event, csvContent, skuFileName != null ? skuFileName : '');
18364
18337
  };
18365
18338
  const OperandValues = _ref2 => {
18339
+ var _operandsMapping$text, _operandsMapping;
18366
18340
  let {
18367
18341
  linkedFact,
18368
18342
  linkedDataType,
@@ -18371,8 +18345,9 @@ const CapConditionPreview = _ref => {
18371
18345
  let dataTypeLocal = type;
18372
18346
  let listDataLocal = listData;
18373
18347
  if (linkedFact) {
18348
+ var _linkedConditionExpre;
18374
18349
  dataTypeLocal = linkedDataType;
18375
- listDataLocal = (linkedConditionExpression == null ? void 0 : linkedConditionExpression.operand) || [];
18350
+ listDataLocal = (_linkedConditionExpre = linkedConditionExpression == null ? void 0 : linkedConditionExpression.operand) != null ? _linkedConditionExpre : [];
18376
18351
  }
18377
18352
  let hasUploadedStores = false;
18378
18353
  let StoreUploadMsg = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
@@ -18395,9 +18370,9 @@ const CapConditionPreview = _ref => {
18395
18370
  const {
18396
18371
  isStoreUploadFailed = false,
18397
18372
  isStoreUploadInvalid = false,
18398
- operand = [],
18373
+ operand: storeOperand = [],
18399
18374
  storeUploadIsInProgress = false
18400
- } = linkedConditionExpression || {};
18375
+ } = linkedConditionExpression != null ? linkedConditionExpression : {};
18401
18376
  hasUploadedStores = true;
18402
18377
  if (isStoreUploadFailed || isStoreUploadInvalid) {
18403
18378
  StoreUploadMsg = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
@@ -18410,7 +18385,7 @@ const CapConditionPreview = _ref => {
18410
18385
  color: _variables.CAP_RED
18411
18386
  },
18412
18387
  className: "margin-r-4"
18413
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default.CapLabelInline, {
18388
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18414
18389
  style: {
18415
18390
  color: _variables.CAP_RED
18416
18391
  },
@@ -18419,24 +18394,27 @@ const CapConditionPreview = _ref => {
18419
18394
  })]
18420
18395
  });
18421
18396
  } else {
18422
- StoreUploadMsg = !storeUploadIsInProgress ? (operand == null ? void 0 : operand.length) + " " + storesMsg : StoreUploadMsg;
18397
+ var _storeOperand$length;
18398
+ StoreUploadMsg = !storeUploadIsInProgress ? ((_storeOperand$length = storeOperand == null ? void 0 : storeOperand.length) != null ? _storeOperand$length : 0) + " " + storesMsg : StoreUploadMsg;
18423
18399
  }
18424
18400
  }
18425
18401
  switch (dataTypeLocal) {
18426
18402
  case _constants.MULTI_SELECT:
18427
18403
  {
18428
- var _listDataLocal, _operandsMapping$list, _listDataLocal2, _listDataLocal3;
18429
- const operandForPreview = operandsMapping != null && operandsMapping[(_listDataLocal = listDataLocal) == null ? void 0 : _listDataLocal[1]] ? operandsMapping == null || (_operandsMapping$list = operandsMapping[(_listDataLocal2 = listDataLocal) == null ? void 0 : _listDataLocal2[1]]) == null ? void 0 : _operandsMapping$list.text : (_listDataLocal3 = listDataLocal) == null || (_listDataLocal3 = _listDataLocal3[1]) == null || (_listDataLocal3 = _listDataLocal3.toLowerCase()) == null ? void 0 : _listDataLocal3.replace('_', ' ');
18430
- return [_constants.CUSTOM_FIELD, _constants.EXTENDED_FIELD].includes(linkedFact) ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18431
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_style.StyledCapLabel, {
18404
+ var _operandsMapping$list, _listArr$, _ref3;
18405
+ const listArr = Array.isArray(listDataLocal) ? listDataLocal : [];
18406
+ const operandForPreview = operandsMapping != null && operandsMapping[listArr == null ? void 0 : listArr[1]] ? (_operandsMapping$list = operandsMapping[listArr[1]]) == null ? void 0 : _operandsMapping$list.text : listArr == null || (_listArr$ = listArr[1]) == null || (_listArr$ = _listArr$.toLowerCase()) == null ? void 0 : _listArr$.replace('_', ' ');
18407
+ return [_constants.CUSTOM_FIELD, _constants.EXTENDED_FIELD].includes(linkedFact != null ? linkedFact : '') ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18408
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
18409
+ className: _styles.default.capConditionPreview__label,
18432
18410
  type: "label2",
18433
- children: listDataLocal[0]
18411
+ children: listArr[0]
18434
18412
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18435
18413
  type: "label18",
18436
18414
  children: operandForPreview
18437
18415
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18438
18416
  type: "label16",
18439
- children: listDataLocal[2]
18417
+ children: listArr[2]
18440
18418
  })]
18441
18419
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18442
18420
  children: [!linkedFact && /*#__PURE__*/(0, _jsxRuntime.jsx)(ValuesPrefix, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
@@ -18448,12 +18426,17 @@ const CapConditionPreview = _ref => {
18448
18426
  type: "attachment"
18449
18427
  }), linkedFact === _constants.SKU ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18450
18428
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTruncateList.default, {
18451
- list: listDataLocal,
18429
+ list: listArr,
18452
18430
  showNumber: 1,
18453
18431
  capLabelType: "label4",
18454
18432
  showTooltip: false
18455
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_style.SkuDownloadLink, {
18456
- onClick: e => downloadSKUs(e, listDataLocal),
18433
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
18434
+ className: _styles.default.capConditionPreview__skuDownloadLink,
18435
+ href: "#",
18436
+ onClick: e => {
18437
+ e.preventDefault();
18438
+ downloadSKUs(e, listArr);
18439
+ },
18457
18440
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18458
18441
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
18459
18442
  type: "download",
@@ -18466,15 +18449,15 @@ const CapConditionPreview = _ref => {
18466
18449
  type: "label4",
18467
18450
  className: "margin-r-20",
18468
18451
  children: StoreUploadMsg
18469
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewMoreLink, {
18452
+ }), ViewMoreLink && /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewMoreLink, {
18470
18453
  onClick: () => {
18471
- setPopoverVisible(false);
18472
- onClickConfigure(blockId);
18454
+ setPopoverVisible == null || setPopoverVisible(false);
18455
+ blockId && (onClickConfigure == null ? void 0 : onClickConfigure(blockId));
18473
18456
  },
18474
18457
  children: viewMoreMsg
18475
18458
  })]
18476
18459
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTruncateList.default, {
18477
- list: listDataLocal || dstData.couponSeriesNames,
18460
+ list: (_ref3 = listDataLocal != null ? listDataLocal : dstData == null ? void 0 : dstData.couponSeriesNames) != null ? _ref3 : [],
18478
18461
  showNumber: 1,
18479
18462
  capLabelType: "label4"
18480
18463
  })]
@@ -18493,82 +18476,89 @@ const CapConditionPreview = _ref => {
18493
18476
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18494
18477
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18495
18478
  type: "label18",
18496
- children: (operator || '').toLowerCase().replace('_', ' ')
18479
+ children: (operator != null ? operator : '').toLowerCase().replace('_', ' ')
18497
18480
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18498
18481
  type: "label16",
18499
- className: "cap-condition-preview-string",
18482
+ className: _styles.default.capConditionPreview__string,
18500
18483
  children: operand
18501
18484
  })]
18502
18485
  });
18503
18486
  }
18504
18487
  return null;
18505
18488
  case _constants.LIST:
18506
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18507
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ValuesPrefix, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18508
- type: "label16",
18509
- children: operand[0]
18510
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18511
- type: "label18",
18512
- children: andMsg
18513
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18514
- type: "label16",
18515
- children: operand[1]
18516
- })]
18517
- });
18489
+ {
18490
+ const opArr = Array.isArray(operand) ? operand : [];
18491
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18492
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ValuesPrefix, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18493
+ type: "label16",
18494
+ children: opArr[0]
18495
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18496
+ type: "label18",
18497
+ children: andMsg
18498
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18499
+ type: "label16",
18500
+ children: opArr[1]
18501
+ })]
18502
+ });
18503
+ }
18518
18504
  case _constants.ENTRY_TRIGGER_EVENT_ATTRIBUTE:
18519
18505
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18520
18506
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18521
18507
  type: "label18",
18522
- children: operandsMapping[operator] ? operandsMapping[operator].text : (operator || '').toLowerCase().replace('_', ' ')
18508
+ children: (_operandsMapping$text = (_operandsMapping = operandsMapping[operator != null ? operator : '']) == null ? void 0 : _operandsMapping.text) != null ? _operandsMapping$text : (operator != null ? operator : '').toLowerCase().replace('_', ' ')
18523
18509
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18524
18510
  type: "label16",
18525
18511
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default.entryTriggerEventAttribute))
18526
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_style.StyledCapLabel, {
18512
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
18513
+ className: _styles.default.capConditionPreview__label,
18527
18514
  type: "label2",
18528
18515
  children: entryTriggerEventAttribute
18529
18516
  })]
18530
18517
  });
18531
18518
  case _constants.STRING_LIST:
18532
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18533
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ValuesPrefix, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(CapLabelInline, {
18534
- type: "label16",
18535
- children: [operand == null ? void 0 : operand[0], (operand == null ? void 0 : operand.length) > 1 && " +" + ((operand == null ? void 0 : operand.length) - 1), ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default.more))]
18536
- })]
18537
- });
18519
+ {
18520
+ const opList = Array.isArray(operand) ? operand : [];
18521
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18522
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ValuesPrefix, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(CapLabelInline, {
18523
+ type: "label16",
18524
+ children: [opList == null ? void 0 : opList[0], (opList == null ? void 0 : opList.length) > 1 && " +" + (opList.length - 1), ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default.more))]
18525
+ })]
18526
+ });
18527
+ }
18538
18528
  case _constants.DATE_TYPE:
18539
18529
  return renderDateConditionPreview(operator, dateTypeData);
18540
18530
  default:
18541
18531
  return null;
18542
18532
  }
18543
18533
  };
18544
-
18545
- // Helper function to render date condition preview
18546
- const renderDateConditionPreview = (operator, dateTypeData) => {
18534
+ const renderDateConditionPreview = (op, dtData) => {
18547
18535
  const renderContent = () => {
18548
- var _operandsMapping$oper, _operandsMapping$oper2, _dateTypeData$context, _operandsMapping$oper3, _dateTypeData$context2;
18549
- switch (dateTypeData == null ? void 0 : dateTypeData.dateType) {
18536
+ var _operandsMapping2, _operandsMapping3, _dtData$contextData, _operandsMapping4, _dtData$contextData2;
18537
+ switch (dtData == null ? void 0 : dtData.dateType) {
18550
18538
  case _constants.DATE_TYPE_RANGE:
18551
18539
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18552
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_style.StyledCapLabel, {
18540
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
18541
+ className: _styles.default.capConditionPreview__label,
18553
18542
  type: "label2",
18554
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default[operandsMapping == null || (_operandsMapping$oper = operandsMapping[operator]) == null ? void 0 : _operandsMapping$oper.text]))
18543
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default[operandsMapping == null || (_operandsMapping2 = operandsMapping[op != null ? op : '']) == null ? void 0 : _operandsMapping2.text]))
18555
18544
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18556
18545
  type: "label18",
18557
- children: formatDateForPreview(dateTypeData == null ? void 0 : dateTypeData.startDate)
18546
+ children: formatDateForPreview(dtData == null ? void 0 : dtData.startDate)
18558
18547
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18559
18548
  type: "label18",
18560
18549
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default.andMsg))
18561
18550
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18562
18551
  type: "label18",
18563
- children: formatDateForPreview(dateTypeData == null ? void 0 : dateTypeData.endDate)
18552
+ children: formatDateForPreview(dtData == null ? void 0 : dtData.endDate)
18564
18553
  })]
18565
18554
  });
18566
18555
  case _constants.DATE_TYPE_SINGLE:
18567
18556
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18568
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_style.StyledCapLabel, {
18557
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
18558
+ className: _styles.default.capConditionPreview__label,
18569
18559
  type: "label2",
18570
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default[operandsMapping == null || (_operandsMapping$oper2 = operandsMapping[operator]) == null ? void 0 : _operandsMapping$oper2.text]))
18571
- }), dateTypeData != null && dateTypeData.contextData ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18560
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default[operandsMapping == null || (_operandsMapping3 = operandsMapping[op != null ? op : '']) == null ? void 0 : _operandsMapping3.text]))
18561
+ }), dtData != null && dtData.contextData ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18572
18562
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18573
18563
  type: "label4",
18574
18564
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default.endDate))
@@ -18579,23 +18569,24 @@ const CapConditionPreview = _ref => {
18579
18569
  type: "label4",
18580
18570
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default.profileNameMessage, {
18581
18571
  values: {
18582
- profileName: dateTypeData == null || (_dateTypeData$context = dateTypeData.contextData) == null ? void 0 : _dateTypeData$context.profileName
18572
+ profileName: dtData == null || (_dtData$contextData = dtData.contextData) == null ? void 0 : _dtData$contextData.profileName
18583
18573
  }
18584
18574
  }))
18585
18575
  })]
18586
18576
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18587
18577
  type: "label18",
18588
- children: formatDateForPreview(dateTypeData.date)
18578
+ children: formatDateForPreview(dtData == null ? void 0 : dtData.date)
18589
18579
  })]
18590
18580
  });
18591
18581
  case _constants.DATE_TYPE_DAYS_AFTER:
18592
18582
  case _constants.DATE_TYPE_DAYS_BEFORE:
18593
18583
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18594
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_style.StyledCapLabel, {
18584
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
18585
+ className: _styles.default.capConditionPreview__label,
18595
18586
  type: "label2",
18596
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default[operandsMapping == null || (_operandsMapping$oper3 = operandsMapping[operator]) == null ? void 0 : _operandsMapping$oper3.text], {
18587
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default[operandsMapping == null || (_operandsMapping4 = operandsMapping[op != null ? op : '']) == null ? void 0 : _operandsMapping4.text], {
18597
18588
  values: {
18598
- days: dateTypeData == null ? void 0 : dateTypeData.days
18589
+ days: dtData == null ? void 0 : dtData.days
18599
18590
  }
18600
18591
  }))
18601
18592
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
@@ -18608,7 +18599,7 @@ const CapConditionPreview = _ref => {
18608
18599
  type: "label4",
18609
18600
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _extends({}, _messages.default.profileNameMessage, {
18610
18601
  values: {
18611
- profileName: dateTypeData == null || (_dateTypeData$context2 = dateTypeData.contextData) == null ? void 0 : _dateTypeData$context2.profileName
18602
+ profileName: dtData == null || (_dtData$contextData2 = dtData.contextData) == null ? void 0 : _dtData$contextData2.profileName
18612
18603
  }
18613
18604
  }))
18614
18605
  })]
@@ -18619,54 +18610,53 @@ const CapConditionPreview = _ref => {
18619
18610
  };
18620
18611
  return renderContent();
18621
18612
  };
18622
- const LabelType = _ref3 => {
18613
+ const LabelType = _ref4 => {
18623
18614
  let {
18624
18615
  children
18625
- } = _ref3;
18616
+ } = _ref4;
18626
18617
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18627
18618
  type: "label18",
18628
18619
  children: children
18629
18620
  });
18630
18621
  };
18631
- const getAdditionalConditions = () => {
18632
- var _Object$values;
18633
- return ((_Object$values = Object.values(additionalFields || {})) == null ? void 0 : _Object$values.length) > 0 ? Object.values(additionalFields).map((_ref4, index) => {
18634
- var _operandsMapping$link;
18635
- let {
18636
- description: linkedDescription,
18637
- factId: linkedFact,
18638
- expression: linkedConditionExpression
18639
- } = _ref4;
18640
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
18641
- children: [!hideNumberAndProductFields && /*#__PURE__*/(0, _jsxRuntime.jsx)(LabelType, {
18642
- children: !index ? lineItemMsg : andMsg
18643
- }), !hideNumberAndProductFields && /*#__PURE__*/(0, _jsxRuntime.jsx)(_style.StyledCapLabel, {
18644
- type: "label2",
18645
- children: linkedDescription
18646
- }), !hideNumberAndProductFields && /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18647
- type: "label18",
18648
- children: (_operandsMapping$link = operandsMapping[linkedConditionExpression.operator]) == null ? void 0 : _operandsMapping$link.text
18649
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(OperandValues, {
18650
- linkedFact: linkedFact,
18651
- linkedDataType: _constants.MULTI_SELECT,
18652
- linkedConditionExpression: linkedConditionExpression
18653
- })]
18654
- });
18655
- }) : null;
18656
- };
18622
+ const getAdditionalConditions = () => Object.values(additionalFields != null ? additionalFields : {}).length > 0 ? Object.values(additionalFields != null ? additionalFields : {}).map((_ref5, index) => {
18623
+ var _operandsMapping5, _linkedConditionExpre2;
18624
+ let {
18625
+ description: linkedDescription,
18626
+ factId: linkedFact,
18627
+ expression: linkedConditionExpression
18628
+ } = _ref5;
18629
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.default.Fragment, {
18630
+ children: [!hideNumberAndProductFields && /*#__PURE__*/(0, _jsxRuntime.jsx)(LabelType, {
18631
+ children: !index ? lineItemMsg : andMsg
18632
+ }), !hideNumberAndProductFields && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
18633
+ className: _styles.default.capConditionPreview__label,
18634
+ type: "label2",
18635
+ children: linkedDescription
18636
+ }), !hideNumberAndProductFields && linkedConditionExpression && /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18637
+ type: "label18",
18638
+ children: (_operandsMapping5 = operandsMapping[(_linkedConditionExpre2 = linkedConditionExpression.operator) != null ? _linkedConditionExpre2 : '']) == null ? void 0 : _operandsMapping5.text
18639
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(OperandValues, {
18640
+ linkedFact: linkedFact,
18641
+ linkedDataType: _constants.MULTI_SELECT,
18642
+ linkedConditionExpression: linkedConditionExpression
18643
+ })]
18644
+ }, index);
18645
+ }) : null;
18657
18646
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
18658
- display: "flex",
18659
18647
  className: (0, _classnames.default)(className, 'cap-condition-wrapper'),
18660
18648
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapColumn.default, {
18661
18649
  xs: 25,
18662
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_style.StyledFlexWrapDiv, {
18650
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
18651
+ className: _styles.default.capConditionPreview__flexWrapDiv,
18663
18652
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18664
18653
  type: "label18",
18665
18654
  children: isExcluded ? excludeMsg : includeMsg
18666
18655
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
18667
18656
  type: "label18",
18668
18657
  children: whoseMsg
18669
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_style.StyledCapLabel, {
18658
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
18659
+ className: _styles.default.capConditionPreview__label,
18670
18660
  type: "label2",
18671
18661
  children: conditionName
18672
18662
  }), (type !== _constants.STRING || hideNumberAndProductFields) && /*#__PURE__*/(0, _jsxRuntime.jsx)(CapLabelInline, {
@@ -18677,48 +18667,6 @@ const CapConditionPreview = _ref => {
18677
18667
  })
18678
18668
  });
18679
18669
  };
18680
- CapConditionPreview.propTypes = {
18681
- type: _propTypes.default.string,
18682
- className: _propTypes.default.string,
18683
- conditionName: _propTypes.default.string,
18684
- operand: _propTypes.default.any,
18685
- operator: _propTypes.default.string,
18686
- isExcluded: _propTypes.default.bool,
18687
- dstData: _propTypes.default.object,
18688
- listData: _propTypes.default.array,
18689
- additionalFields: _propTypes.default.object,
18690
- /**Below fields are added in translations/en.js */
18691
- includeMsg: _propTypes.default.string,
18692
- excludeMsg: _propTypes.default.string,
18693
- whoseMsg: _propTypes.default.string,
18694
- isMsg: _propTypes.default.string,
18695
- andMsg: _propTypes.default.string,
18696
- equalMsg: _propTypes.default.string,
18697
- greaterThanMsg: _propTypes.default.string,
18698
- lessThanMsg: _propTypes.default.string,
18699
- greaterThanOrEqualMsg: _propTypes.default.string,
18700
- lessThanorEqualMsg: _propTypes.default.string,
18701
- inRangeMsg: _propTypes.default.string,
18702
- notEqualMsg: _propTypes.default.string,
18703
- lineItemMsg: _propTypes.default.string,
18704
- addedSKUsMsg: _propTypes.default.string,
18705
- skuFileName: _propTypes.default.string,
18706
- uploadedMsg: _propTypes.default.string,
18707
- inMsg: _propTypes.default.string,
18708
- notInMsg: _propTypes.default.string,
18709
- hideNumberAndProductFields: _propTypes.default.bool,
18710
- ViewMoreLink: _propTypes.default.any,
18711
- onClickConfigure: _propTypes.default.func,
18712
- blockId: _propTypes.default.string,
18713
- setPopoverVisible: _propTypes.default.func,
18714
- viewMoreMsg: _propTypes.default.string,
18715
- storesMsg: _propTypes.default.string,
18716
- uploadInProgressMsg: _propTypes.default.string,
18717
- uploadFailedErrorMsg: _propTypes.default.string,
18718
- uploadInvalidErrorMsg: _propTypes.default.string,
18719
- entryTriggerEventAttribute: _propTypes.default.string,
18720
- dateTypeData: _propTypes.default.object
18721
- };
18722
18670
  var _default = exports["default"] = (0, _LocaleHoc.default)(CapConditionPreview, {
18723
18671
  key: 'CapConditionPreview'
18724
18672
  });