@licklist/design 0.69.6-dev.0 → 0.69.6-dev.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.
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
7
7
  import * as Config from '@licklist/core/dist/Config';
8
8
  import { FaEye, FaExternalLinkAlt, FaEdit, FaCopy, FaTrashAlt } from 'react-icons/fa';
9
9
  import { TipTapEditor } from '../../tiptap-editor/TipTapEditor.js';
10
- import { getStatisticInfo, formatContentWithoutTags, EVENT_DESCRIPTION_SIZE } from './utils.js';
10
+ import { getStatisticInfo, formatContent, EVENT_DESCRIPTION_SIZE } from './utils.js';
11
11
  import { ReactComponent as SvgChartBar } from '../../assets/dashboard/chartBar.svg.js';
12
12
 
13
13
  function _object_without_properties(source, excluded) {
@@ -45,7 +45,7 @@ function EventCard(param) {
45
45
  "totalViews"
46
46
  ]);
47
47
  var memoedContent = useMemo(function() {
48
- return formatContentWithoutTags(description, EVENT_DESCRIPTION_SIZE);
48
+ return formatContent(description, EVENT_DESCRIPTION_SIZE);
49
49
  }, [
50
50
  description
51
51
  ]);
@@ -1,8 +1,8 @@
1
1
  import { EventStatistic } from '@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper';
2
- export declare function formatContent(content: any, maxSymbols: any): any;
3
- export declare const formatContentWithoutTags: (content: any, maxLength?: number) => any;
4
2
  export declare const MIN_EVENT_DESCRIPTION_SIZE = 150;
5
3
  export declare const EVENT_DESCRIPTION_SIZE = 350;
4
+ export declare const EMOJI_REGEX: RegExp;
5
+ export declare const formatContent: (content: any, maxLength?: number) => any;
6
6
  /**
7
7
  * Calculate the total number of views from the given dates and event statistic.
8
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AAGjG,wBAAgB,aAAa,CAAC,OAA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BpB,CAAA"}
@@ -47,26 +47,22 @@ function _unsupported_iterable_to_array(o, minLen) {
47
47
  if (n === "Map" || n === "Set") return Array.from(n);
48
48
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
49
49
  }
50
- function formatContent(content, maxSymbols) {
51
- if (!content) return '';
52
- if (content.length > maxSymbols) return "".concat(content.slice(0, maxSymbols), "...");
53
- return content;
54
- }
55
- var formatContentWithoutTags = function(content) {
50
+ var EVENT_DESCRIPTION_SIZE = 350;
51
+ var EMOJI_REGEX = /<span data-emoji-replacer=""><img[^>]*alt="([^"]+)"[^>]*><\/span>/g;
52
+ var formatContent = function(content) {
56
53
  var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : EVENT_DESCRIPTION_SIZE;
57
54
  if (!content) return '';
58
- if (content < maxLength) return content;
59
- var text = content.replace(/<[^>]*>/g, '');
60
- var trimmedText = text.trim().replace(/&nbsp;|[^a-zA-Z0-9\s]/g, '').replace(/\s\s+/g, ' ');
61
- var words = trimmedText.slice(0, maxLength).split(' ');
62
- var contentWithMinLength = content.slice(0, MIN_EVENT_DESCRIPTION_SIZE);
63
- var index = String(content).indexOf(words[words.length - 2]);
64
- var slicedContent = content.slice(0, index);
65
- var contentWithMinSize = contentWithMinLength.length > slicedContent.length ? contentWithMinLength : slicedContent;
66
- return contentWithMinSize.concat('...');
55
+ var replacedContent = replaceEmojiImagesWithText(content);
56
+ if (replacedContent.length <= maxLength) {
57
+ return replacedContent;
58
+ }
59
+ return replacedContent.slice(0, maxLength).concat('...');
67
60
  };
68
- var MIN_EVENT_DESCRIPTION_SIZE = 150;
69
- var EVENT_DESCRIPTION_SIZE = 350;
61
+ function replaceEmojiImagesWithText(text) {
62
+ return text.replace(EMOJI_REGEX, function(_, emojiText) {
63
+ return emojiText;
64
+ });
65
+ }
70
66
  /**
71
67
  * Calculate the total number of views from the given dates and event statistic.
72
68
  *
@@ -140,4 +136,4 @@ var EVENT_DESCRIPTION_SIZE = 350;
140
136
  };
141
137
  };
142
138
 
143
- export { EVENT_DESCRIPTION_SIZE, MIN_EVENT_DESCRIPTION_SIZE, calculateTotalSoldAndAmount, calculateTotalViews, formatContent, formatContentWithoutTags, getStatisticInfo };
139
+ export { EMOJI_REGEX, EVENT_DESCRIPTION_SIZE, calculateTotalSoldAndAmount, calculateTotalViews, formatContent, getStatisticInfo };
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/product-set/control/DateInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAOzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uEAAuE,CAAA;AAG5G,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAA;AAiBrF,MAAM,WAAW,4BAA4B;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAA;CAClD;AAED,UAAU,2BAA2B;IACnC,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,4BAA4B,EAAE,OAAO,CAAA;IACrC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,SAAS,mFAKnB,2BAA2B,4CAuP7B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,WAAW,EACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBxB,CAAA"}
1
+ {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/product-set/control/DateInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAOzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uEAAuE,CAAA;AAG5G,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAA;AAiBrF,MAAM,WAAW,4BAA4B;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAA;CAClD;AAED,UAAU,2BAA2B;IACnC,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,4BAA4B,EAAE,OAAO,CAAA;IACrC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,SAAS,mFAKnB,2BAA2B,4CAyP7B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,WAAW,EACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBxB,CAAA"}
@@ -216,7 +216,7 @@ function _ts_generator(thisArg, body) {
216
216
  }
217
217
  var DateInput = function(param) {
218
218
  var isEventEditProductSet = param.isEventEditProductSet, isLoading = param.isLoading, workHours = param.workHours, providerHasBookingManagement = param.providerHasBookingManagement;
219
- var _errors_menuRecurrences__availableTimes, _errors_menuRecurrences_, _errors_menuRecurrences, _errors_menuRecurrences1;
219
+ var _errors_menuRecurrences, _errors_menuRecurrences_root, _errors_menuRecurrences1, _errors_menuRecurrences__availableTimes, _errors_menuRecurrences_, _errors_menuRecurrences2;
220
220
  var _useFormContext = useFormContext(), control = _useFormContext.control, register = _useFormContext.register, errors = _useFormContext.formState.errors, getValues = _useFormContext.getValues, setValue = _useFormContext.setValue, clearErrors = _useFormContext.clearErrors;
221
221
  var _useFieldArray = useFieldArray({
222
222
  name: 'menuRecurrences',
@@ -359,6 +359,7 @@ var DateInput = function(param) {
359
359
  }));
360
360
  }, 100);
361
361
  };
362
+ var errorMessage = ((_errors_menuRecurrences = errors.menuRecurrences) === null || _errors_menuRecurrences === void 0 ? void 0 : _errors_menuRecurrences.message) || ((_errors_menuRecurrences1 = errors.menuRecurrences) === null || _errors_menuRecurrences1 === void 0 ? void 0 : (_errors_menuRecurrences_root = _errors_menuRecurrences1.root) === null || _errors_menuRecurrences_root === void 0 ? void 0 : _errors_menuRecurrences_root.message);
362
363
  return /*#__PURE__*/ jsxs(Form.Group, {
363
364
  children: [
364
365
  /*#__PURE__*/ jsx(Form.Label, {
@@ -381,7 +382,7 @@ var DateInput = function(param) {
381
382
  isLoading: isLoading,
382
383
  ref: availableTimesFormRef,
383
384
  defaultValues: availableTimes,
384
- errorMessage: errors === null || errors === void 0 ? void 0 : (_errors_menuRecurrences = errors.menuRecurrences) === null || _errors_menuRecurrences === void 0 ? void 0 : (_errors_menuRecurrences_ = _errors_menuRecurrences["".concat(editState === null || editState === void 0 ? void 0 : editState.index)]) === null || _errors_menuRecurrences_ === void 0 ? void 0 : (_errors_menuRecurrences__availableTimes = _errors_menuRecurrences_.availableTimes) === null || _errors_menuRecurrences__availableTimes === void 0 ? void 0 : _errors_menuRecurrences__availableTimes.message,
385
+ errorMessage: errors === null || errors === void 0 ? void 0 : (_errors_menuRecurrences2 = errors.menuRecurrences) === null || _errors_menuRecurrences2 === void 0 ? void 0 : (_errors_menuRecurrences_ = _errors_menuRecurrences2["".concat(editState === null || editState === void 0 ? void 0 : editState.index)]) === null || _errors_menuRecurrences_ === void 0 ? void 0 : (_errors_menuRecurrences__availableTimes = _errors_menuRecurrences_.availableTimes) === null || _errors_menuRecurrences__availableTimes === void 0 ? void 0 : _errors_menuRecurrences__availableTimes.message,
385
386
  clearErrorMessage: function() {
386
387
  return clearErrors("menuRecurrences.".concat(editState === null || editState === void 0 ? void 0 : editState.index, ".availableTimes"));
387
388
  }
@@ -436,7 +437,7 @@ var DateInput = function(param) {
436
437
  }))),
437
438
  /*#__PURE__*/ jsx("div", {
438
439
  className: "manual-form-error",
439
- children: (_errors_menuRecurrences1 = errors.menuRecurrences) === null || _errors_menuRecurrences1 === void 0 ? void 0 : _errors_menuRecurrences1.message
440
+ children: errorMessage
440
441
  })
441
442
  ]
442
443
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.69.6-dev.0",
3
+ "version": "0.69.6-dev.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -23,7 +23,7 @@ import { Sale } from '../../types/bookings'
23
23
  import { TipTapEditor } from '../../tiptap-editor/TipTapEditor'
24
24
  import {
25
25
  EVENT_DESCRIPTION_SIZE,
26
- formatContentWithoutTags,
26
+ formatContent,
27
27
  getStatisticInfo,
28
28
  } from './utils'
29
29
  import { ReactComponent as ChartBarIcon } from '../../assets/dashboard/chartBar.svg'
@@ -66,7 +66,7 @@ export function EventCard({
66
66
  const { formatNumber, formatDate } = useIntl()
67
67
  const { totalViews, ...statistics } = getStatisticInfo(eventStatistic, date)
68
68
  const memoedContent = useMemo(
69
- () => formatContentWithoutTags(description, EVENT_DESCRIPTION_SIZE),
69
+ () => formatContent(description, EVENT_DESCRIPTION_SIZE),
70
70
  [description],
71
71
  )
72
72
 
@@ -2,34 +2,25 @@ import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from '@licklist/core/dist/Config'
2
2
  import { EventStatistic } from '@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper'
3
3
  import { DateTime } from 'luxon'
4
4
 
5
- export function formatContent(content, maxSymbols) {
6
- if (!content) return ''
7
- if (content.length > maxSymbols) return `${content.slice(0, maxSymbols)}...`
8
- return content
9
- }
5
+ export const MIN_EVENT_DESCRIPTION_SIZE = 150;
6
+ export const EVENT_DESCRIPTION_SIZE = 350;
7
+ export const EMOJI_REGEX = /<span data-emoji-replacer=""><img[^>]*alt="([^"]+)"[^>]*><\/span>/g;
10
8
 
11
- export const formatContentWithoutTags = (
12
- content,
13
- maxLength = EVENT_DESCRIPTION_SIZE,
14
- ) => {
15
- if (!content) return ''
16
- if (content < maxLength) return content
17
- const text = content.replace(/<[^>]*>/g, '')
18
- const trimmedText = text
19
- .trim()
20
- .replace(/&nbsp;|[^a-zA-Z0-9\s]/g, '')
21
- .replace(/\s\s+/g, ' ')
9
+ export const formatContent = (content, maxLength = EVENT_DESCRIPTION_SIZE) => {
10
+ if (!content) return '';
22
11
 
23
- const words = trimmedText.slice(0, maxLength).split(' ')
24
- const contentWithMinLength = content.slice(0, MIN_EVENT_DESCRIPTION_SIZE)
25
- const index = String(content).indexOf(words[words.length - 2])
26
- const slicedContent = content.slice(0, index)
27
- const contentWithMinSize = contentWithMinLength.length > slicedContent.length ? contentWithMinLength : slicedContent
28
- return contentWithMinSize.concat('...')
29
- }
12
+ const replacedContent = replaceEmojiImagesWithText(content);
13
+
14
+ if (replacedContent.length <= maxLength) {
15
+ return replacedContent;
16
+ }
30
17
 
31
- export const MIN_EVENT_DESCRIPTION_SIZE = 150
32
- export const EVENT_DESCRIPTION_SIZE = 350
18
+ return replacedContent.slice(0, maxLength).concat('...');
19
+ };
20
+
21
+ function replaceEmojiImagesWithText(text) {
22
+ return text.replace(EMOJI_REGEX, (_, emojiText) => emojiText);
23
+ }
33
24
 
34
25
  /**
35
26
  * Calculate the total number of views from the given dates and event statistic.
@@ -195,6 +195,8 @@ export const DateInput = ({
195
195
  }, 100)
196
196
  }
197
197
 
198
+ const errorMessage = errors.menuRecurrences?.message || errors.menuRecurrences?.root?.message
199
+
198
200
  return (
199
201
  <Form.Group>
200
202
  <Form.Label>
@@ -283,7 +285,7 @@ export const DateInput = ({
283
285
  />
284
286
 
285
287
  <div className='manual-form-error'>
286
- {errors.menuRecurrences?.message}
288
+ {errorMessage}
287
289
  </div>
288
290
  </div>
289
291
  </OverlayTrigger>
package/yarn.lock CHANGED
@@ -5640,11 +5640,11 @@ __metadata:
5640
5640
  linkType: hard
5641
5641
 
5642
5642
  "@types/node@npm:*":
5643
- version: 22.7.6
5644
- resolution: "@types/node@npm:22.7.6"
5643
+ version: 22.7.7
5644
+ resolution: "@types/node@npm:22.7.7"
5645
5645
  dependencies:
5646
5646
  undici-types: "npm:~6.19.2"
5647
- checksum: 10c0/d4406a63afce981c363fb1d1954aaf1759ad2d487c0833ebf667565ea4e45ff217d6fab4b5343badbdeccdf9d2e4a0841d633e0c929ceabcb33c288663dd0c73
5647
+ checksum: 10c0/07268a1e990ad9d9b1865092881317ea679a46eb6706d83a8874eec75fdddae6cfd6452e4e68b651561183e2a8f8548276f3155744bc402c2545978c19b70d65
5648
5648
  languageName: node
5649
5649
  linkType: hard
5650
5650
 
@@ -14824,13 +14824,20 @@ __metadata:
14824
14824
  languageName: node
14825
14825
  linkType: hard
14826
14826
 
14827
- "negotiator@npm:0.6.3, negotiator@npm:^0.6.3":
14827
+ "negotiator@npm:0.6.3":
14828
14828
  version: 0.6.3
14829
14829
  resolution: "negotiator@npm:0.6.3"
14830
14830
  checksum: 10c0/3ec9fd413e7bf071c937ae60d572bc67155262068ed522cf4b3be5edbe6ddf67d095ec03a3a14ebf8fc8e95f8e1d61be4869db0dbb0de696f6b837358bd43fc2
14831
14831
  languageName: node
14832
14832
  linkType: hard
14833
14833
 
14834
+ "negotiator@npm:^0.6.3":
14835
+ version: 0.6.4
14836
+ resolution: "negotiator@npm:0.6.4"
14837
+ checksum: 10c0/3e677139c7fb7628a6f36335bf11a885a62c21d5390204590a1a214a5631fcbe5ea74ef6a610b60afe84b4d975cbe0566a23f20ee17c77c73e74b80032108dea
14838
+ languageName: node
14839
+ linkType: hard
14840
+
14834
14841
  "neo-async@npm:^2.5.0, neo-async@npm:^2.6.1, neo-async@npm:^2.6.2":
14835
14842
  version: 2.6.2
14836
14843
  resolution: "neo-async@npm:2.6.2"