@capillarytech/blaze-ui 5.23.3-beta.5 → 5.23.3-beta.7

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 (198) hide show
  1. package/CapActionBar/types.js +1 -0
  2. package/CapAdvancedIcon/types.js +1 -0
  3. package/CapAppNotEnabled/types.js +1 -0
  4. package/CapAskAira/AudienceFilterBot/types.js +1 -0
  5. package/CapAskAira/CapAiMediaGeneration/constants.js +2 -0
  6. package/CapAskAira/CapAiMediaGeneration/index.js +4 -4
  7. package/CapAskAira/CapAiMediaGeneration/types.js +1 -0
  8. package/CapAskAira/ConfigurationBot/PromptAttachmentButton.js +33 -0
  9. package/CapAskAira/ConfigurationBot/constants.js +24 -0
  10. package/CapAskAira/ConfigurationBot/styles.module.scss.js +1 -1
  11. package/CapAskAira/ConfigurationBot/test/mockData.js +58 -0
  12. package/CapAskAira/ConfigurationBot/types.js +1 -0
  13. package/CapAskAira/ContentGenerationBot/constants.js +2 -0
  14. package/CapAskAira/ContentGenerationBot/types.js +1 -0
  15. package/CapAskAira/DocumentationBot/constants.js +2 -0
  16. package/CapAskAira/DocumentationBot/types.js +1 -0
  17. package/CapAskAira/DocumentationChatBot/constants.js +2 -0
  18. package/CapAskAira/DocumentationChatBot/index.js +4 -4
  19. package/CapAskAira/DocumentationChatBot/types.js +1 -0
  20. package/CapAskAira/RuleGenerationBot/constants.js +4 -0
  21. package/CapAskAira/RuleGenerationBot/index.js +8 -8
  22. package/CapAskAira/RuleGenerationBot/reducer.js +1 -1
  23. package/CapAskAira/RuleGenerationBot/saga.js +1 -1
  24. package/CapAskAira/RuleGenerationBot/types.js +1 -0
  25. package/CapAskAira/RuleSummarizationBot/constants.js +8 -0
  26. package/CapAskAira/RuleSummarizationBot/index.js +4 -4
  27. package/CapAskAira/RuleSummarizationBot/reducer.js +1 -1
  28. package/CapAskAira/RuleSummarizationBot/saga.js +1 -1
  29. package/CapAskAira/RuleSummarizationBot/types.js +1 -0
  30. package/CapAskAira/UtilComponents/Icons.js +4 -0
  31. package/CapAskAira/UtilComponents/Notification.js +14 -1
  32. package/CapAskAira/util.js +4 -3
  33. package/CapBanner/types.js +1 -0
  34. package/CapBlock/types.js +1 -0
  35. package/CapBorderedBox/types.js +1 -0
  36. package/CapButton/types.js +1 -0
  37. package/CapCSVFileUploader/types.js +1 -0
  38. package/CapCalendarDatePicker/types.js +1 -0
  39. package/CapCard/types.js +1 -0
  40. package/CapCardBox/types.js +1 -0
  41. package/CapCarousel/types.js +1 -0
  42. package/CapCheckbox/types.js +1 -0
  43. package/CapCollapsibleLeftNavigation/reducer.js +1 -1
  44. package/CapColorPicker/types.js +1 -0
  45. package/CapColoredTag/index.js +2 -2
  46. package/CapColoredTag/styles.js +28 -0
  47. package/CapColoredTag/types.js +1 -0
  48. package/CapColumn/types.js +1 -0
  49. package/CapCondition/constants.js +6 -0
  50. package/CapConditionPreview/constants.js +4 -0
  51. package/CapConditionPreview/types.js +1 -0
  52. package/CapCustomCard/types.js +1 -0
  53. package/CapCustomCarousel/types.js +1 -0
  54. package/CapCustomCheckboxList/types.js +1 -0
  55. package/CapCustomList/types.js +1 -0
  56. package/CapCustomSelect/types.js +1 -0
  57. package/CapDatePicker/types.js +1 -0
  58. package/CapDateRangePicker/types.js +1 -0
  59. package/CapDateTimePicker/types.js +1 -0
  60. package/CapDateTimeRangePicker/types.js +1 -0
  61. package/CapDivider/types.js +1 -0
  62. package/CapDnDGraph/constants.js +2 -0
  63. package/CapDnDGraph/mockdata.js +3371 -0
  64. package/CapDnDGraph/reportingBlock.js +1 -1
  65. package/CapDragAndDrop/constants.js +2 -0
  66. package/CapDragReorder/ItemTypes.js +6 -0
  67. package/CapDrawer/types.js +1 -0
  68. package/CapDropdown/types.js +1 -0
  69. package/CapEmptyDivWithBorder/types.js +1 -0
  70. package/CapError/types.js +1 -0
  71. package/CapErrorBoundary/types.js +1 -0
  72. package/CapErrorStateIllustration/types.js +1 -0
  73. package/CapEventCalendar/drawUtils.js +1 -1
  74. package/CapEventCalendar/utils.js +5 -1
  75. package/CapExpressionEditor/js/pickers.js +59 -0
  76. package/CapExpressionEditor/types.js +1 -0
  77. package/CapForm/types.js +1 -0
  78. package/CapFormItem/types.js +1 -0
  79. package/CapGraph/types.js +1 -0
  80. package/CapHamburgerMenu/index.js +3 -1
  81. package/CapHamburgerMenu/types.js +1 -0
  82. package/CapHeader/types.js +1 -0
  83. package/CapHeading/types.js +1 -0
  84. package/CapIcon/index.js +3 -1
  85. package/CapIcon/types.js +1 -0
  86. package/CapIllustration/types.js +1 -0
  87. package/CapImage/types.js +1 -0
  88. package/CapImportMFEComponent/types.js +1 -0
  89. package/CapInfoNote/types.js +1 -0
  90. package/CapInput/messages.js +24 -0
  91. package/CapInput/types.js +1 -0
  92. package/CapLabel/types.js +1 -0
  93. package/CapLanguageProvider/constants.js +15 -1
  94. package/CapLanguageProvider/index.js +4 -4
  95. package/CapLanguageProvider/reducer.js +24 -1
  96. package/CapLanguageProvider/saga.js +50 -0
  97. package/CapLanguageProvider/types.js +1 -0
  98. package/CapLevelGraphRenderer/types.js +1 -0
  99. package/CapLink/types.js +1 -0
  100. package/CapList/types.js +1 -0
  101. package/CapListLayout/types.js +1 -0
  102. package/CapLogin/types.js +1 -0
  103. package/CapMenu/types.js +1 -0
  104. package/CapMobileDateRangePicker/ReactMobileDatePicker.js +975 -0
  105. package/CapModal/types.js +1 -0
  106. package/CapMultiSelect/types.js +1 -0
  107. package/CapMultiSelectDatePicker/types.js +1 -0
  108. package/CapMultiplePath/constants.js +2 -0
  109. package/CapMultiplePath/index.js +2 -2
  110. package/CapMultiplePath/mockdata.js +50 -0
  111. package/CapMultiplePath/styles.js +3 -3
  112. package/CapNavigation/mockdata.js +441 -0
  113. package/CapNavigation/types.js +1 -0
  114. package/CapNotification/types.js +1 -0
  115. package/CapNotificationDropdown/types.js +1 -0
  116. package/CapPopover/types.js +1 -0
  117. package/CapPopoverTree/style.js +1 -1
  118. package/CapProductSelection/style.js +3 -2
  119. package/CapProgress/types.js +1 -0
  120. package/CapRadio/types.js +1 -0
  121. package/CapRadioButton/types.js +1 -0
  122. package/CapRadioCard/types.js +1 -0
  123. package/CapRadioGroup/types.js +1 -0
  124. package/CapReorderComponent/types.js +1 -0
  125. package/CapRoadMap/types.js +1 -0
  126. package/CapRow/types.js +1 -0
  127. package/CapSKUUploader/types.js +1 -0
  128. package/CapSecondaryTopBar/index.js +3 -1
  129. package/CapSecondaryTopBar/types.js +1 -0
  130. package/CapSelect/types.js +1 -0
  131. package/CapSelectFilter/types.js +1 -0
  132. package/CapShape/types.js +1 -0
  133. package/CapSideBar/types.js +1 -0
  134. package/CapSkeleton/types.js +1 -0
  135. package/CapSlideBox/types.js +1 -0
  136. package/CapSlider/types.js +1 -0
  137. package/CapSnackBar/types.js +1 -0
  138. package/CapSomethingWentWrong/types.js +1 -0
  139. package/CapSpin/types.js +1 -0
  140. package/CapSplit/types.js +1 -0
  141. package/CapStaticTemplates/style.js +1 -1
  142. package/CapStatisticCard/types.js +1 -0
  143. package/CapStatus/index.js +2 -2
  144. package/CapStatus/types.js +1 -0
  145. package/CapSteps/types.js +1 -0
  146. package/CapStepsAccordian/types.js +1 -0
  147. package/CapSupportVideosWrapper/types.js +1 -0
  148. package/CapSupportVideosWrapper/utils.js +17 -1
  149. package/CapSwitch/types.js +1 -0
  150. package/CapTab/types.js +1 -0
  151. package/CapTabV3/types.js +1 -0
  152. package/CapTable/loadable.js +9 -0
  153. package/CapTable/types.js +1 -0
  154. package/CapTag/types.js +1 -0
  155. package/CapTagDropdown/types.js +1 -0
  156. package/CapTimePicker/types.js +1 -0
  157. package/CapTimeline/CapTimelineCard.js +2 -2
  158. package/CapTimeline/constants.js +6 -0
  159. package/CapTimelineNested/CapTimelineNestedCard.js +2 -2
  160. package/CapTimelineNested/NestedCardParent.js +2 -2
  161. package/CapTooltip/types.js +1 -0
  162. package/CapTooltipWithInfo/types.js +1 -0
  163. package/CapTopBar/CapOrgSelectUtils.js +3 -1
  164. package/CapTopBar/index.js +3 -1
  165. package/CapTopBar/mockdata.js +441 -0
  166. package/CapTopBar/types.js +1 -0
  167. package/CapTree/types.js +1 -0
  168. package/CapTreeSelect/types.js +1 -0
  169. package/CapTruncateList/types.js +1 -0
  170. package/CapUnifiedSelect/components.js +1 -1
  171. package/CapUnifiedSelect/testData.js +126 -0
  172. package/CapUnifiedSelect/types.js +1 -0
  173. package/CapUploader/types.js +1 -0
  174. package/CapUserProfile/constants.js +22 -2
  175. package/CapUserProfile/mockData.js +540 -0
  176. package/CapUserProfile/types.js +1 -0
  177. package/CapUserProfile/utils.js +24 -4
  178. package/CapVirtualList/types.js +1 -0
  179. package/CapVirtualSelect/constants.js +8 -0
  180. package/CapVirtualSelect/index.js +2 -2
  181. package/CapVirtualSelect/reducer.js +49 -2
  182. package/CapVirtualSelect/saga.js +91 -0
  183. package/assets/HOCs/ComponentWithLabelHOC/types.js +1 -0
  184. package/assets/HOCs/index.js +4 -0
  185. package/assets/svgIcons/Icons/index.js +4 -0
  186. package/assets/svgIcons/component.js +318 -318
  187. package/assets/svgIcons/index.js +650 -0
  188. package/index.js +5 -4
  189. package/package.json +1 -1
  190. package/service/api.types.js +1 -0
  191. package/styled/variables.d.ts +2 -0
  192. package/styled/variables.d.ts.map +1 -1
  193. package/styled/variables.js +3 -1
  194. package/utils/dayjs.js +37 -2
  195. package/utils/dayjs.types.js +1 -0
  196. package/utils/index.js +1 -0
  197. package/utils/styles.js +1 -0
  198. /package/CapAskAira/ConfigurationBot/{styles.module.css → styles.css} +0 -0
@@ -7,7 +7,7 @@ import CapIcon from "../CapIcon/index.js";
7
7
  import CapLabelWithStatic from "../CapLabel/index.js";
8
8
  import CapRow from "../CapRow/index.js";
9
9
  import CapSkeleton from "../CapSkeleton/index.js";
10
- import { CAP_WHITE, CAP_YELLOW, CAP_G04, CAP_SPACE_20, CAP_SPACE_12 } from "../styles/_variables.js";
10
+ import { CAP_SPACE_20, CAP_SPACE_12, CAP_WHITE, CAP_YELLOW, CAP_G04 } from "../styles/_variables.js";
11
11
  import { SUCCESS } from "./constants.js";
12
12
  const StyledDiv = styled.div`
13
13
  outline: ${(props) => (props == null ? void 0 : props.color) ? `0.214rem solid ${props.color}` : "none"};
@@ -1,4 +1,5 @@
1
1
  const small = "size-s";
2
+ const regular = "size-r";
2
3
  const defaultMaxFileSize = 25e5;
3
4
  const defaultMinFileSize = 0;
4
5
  const defaultAcceptedFiles = {
@@ -9,5 +10,6 @@ export {
9
10
  defaultAcceptedFiles,
10
11
  defaultMaxFileSize,
11
12
  defaultMinFileSize,
13
+ regular,
12
14
  small
13
15
  };
@@ -0,0 +1,6 @@
1
+ const ItemTypes = {
2
+ CARD: "card"
3
+ };
4
+ export {
5
+ ItemTypes
6
+ };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -1,4 +1,4 @@
1
- import { CAP_WHITE, CAP_G01, CAP_G06, CAP_G11, FONT_COLOR_05 } from "../styles/_variables.js";
1
+ import { CAP_G06, CAP_WHITE, CAP_G01, CAP_G11, FONT_COLOR_05 } from "../styles/_variables.js";
2
2
  const drawHeadingText = ({ context, x, y, height, text }) => {
3
3
  context.beginPath();
4
4
  context.fillStyle = CAP_WHITE;
@@ -1,7 +1,8 @@
1
1
  import { forEach, some } from "lodash";
2
- import { TIME_UNITS, momentToDayjs } from "../utils/dayjs.js";
2
+ import { momentToDayjs, TIME_UNITS } from "../utils/dayjs.js";
3
3
  import { MONTH_LABELS, DATE_STRING_FORMAT } from "./constants.js";
4
4
  import dayjs from "dayjs";
5
+ const getQuarterForDate = (date) => dayjs(date).quarter();
5
6
  const splitMonthsArrayToQuarterChunks = (monthLabels = MONTH_LABELS) => {
6
7
  const chunkSize = 3;
7
8
  const chunks = [];
@@ -123,6 +124,7 @@ const startMonthOfQuarter = {
123
124
  3: 6,
124
125
  4: 9
125
126
  };
127
+ const getFirstDateOfQuarter = (quarter, year) => dayjs().year(year).month(startMonthOfQuarter[quarter]).startOf(TIME_UNITS.MONTH).format();
126
128
  const handleYearChange = (quarter, date, increment, referenceDate) => {
127
129
  const year = dayjs(date).year();
128
130
  const refYear = referenceDate && dayjs(referenceDate).year();
@@ -149,7 +151,9 @@ export {
149
151
  checkIfDateIsInRange,
150
152
  formatDataToSuitCanvas,
151
153
  getDaysOfMonth,
154
+ getFirstDateOfQuarter,
152
155
  getMonthsForQuarter,
156
+ getQuarterForDate,
153
157
  handleYearChange,
154
158
  isEventLong,
155
159
  splitMonthsArrayToQuarterChunks
@@ -0,0 +1,59 @@
1
+ var pickers = {};
2
+ (function() {
3
+ function makeRegex(str, atBegin, atEnd) {
4
+ try {
5
+ return new RegExp(
6
+ (atBegin ? "^" : "") + str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") + (atEnd ? "$" : ""),
7
+ "i"
8
+ );
9
+ } catch (e) {
10
+ return null;
11
+ }
12
+ }
13
+ pickers.enum = function(value, type, setValue, onKey) {
14
+ var i, l, menu = $("<div class='calltips'>"), tReg = value ? makeRegex(value, true) : false, show = false;
15
+ for (i = 0, l = type.values.length; i < l; i += 1) {
16
+ if (!tReg || tReg.test(type.values[i])) {
17
+ show = true;
18
+ $("<a class='calltip'>").html('"' + type.values[i] + '"').appendTo(menu);
19
+ }
20
+ }
21
+ return show ? menu : false;
22
+ };
23
+ pickers.interval = function(value, type, setValue, onKey) {
24
+ return $("<div>").addClass("info").html("Time interval picker will come here.");
25
+ }, pickers.enumset = function(value, type, setValue, onKey) {
26
+ pickers.enum(value, type.valueType);
27
+ return $("<div>").addClass("info").html("Multiselect box with options " + node.getType(type.valueType).values.join(", "));
28
+ }, // ----- Calltips from the current scope -----
29
+ pickers.any = function(node2, sort) {
30
+ if (typeof sort === "undefined") sort = false;
31
+ var r = [], calltipDiv, elems, scope = node2.scope, name = node2.value, i, prefix = "";
32
+ try {
33
+ name = node2.value ? makeRegex(node2.value, true) : null;
34
+ } catch (e) {
35
+ name = null;
36
+ }
37
+ calltipDiv = $("<div class='calltips'>");
38
+ while (scope && scope.idents) {
39
+ var idents = [];
40
+ for (i in scope.idents) idents.push(i.toString());
41
+ elems = sort == true ? idents.sort() : idents;
42
+ for (i in elems) {
43
+ if (!name || name.test(elems[i])) {
44
+ if (r.indexOf(elems[i]) !== -1) {
45
+ elems[i] = prefix + elems[i];
46
+ }
47
+ r.push(elems[i]);
48
+ $("<a href='#' class='calltip'>").html(elems[i]).appendTo(calltipDiv);
49
+ }
50
+ }
51
+ prefix += "outer.";
52
+ scope = scope.outer;
53
+ }
54
+ return r.length && (r.length > 1 || node2.text != r[0]) ? calltipDiv : false;
55
+ };
56
+ })();
57
+ export {
58
+ pickers as default
59
+ };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -8,6 +8,9 @@ import isEqual from "lodash/isEqual";
8
8
  import React, { useMemo, useState, useRef, useEffect } from "react";
9
9
  import { Virtuoso } from "react-virtuoso";
10
10
  import { List } from "semantic-ui-react";
11
+ import "../assets/icons/dropdownIcon.js";
12
+ import "../assets/icons/add.js";
13
+ import LogoBackground from "../assets/icons/logoBackground.js";
11
14
  import CapColumn from "../CapColumn/index.js";
12
15
  import CapDrawer from "../CapDrawer/index.js";
13
16
  import CapHeadingWithStatic from "../CapHeading/index.js";
@@ -18,7 +21,6 @@ import CapRow from "../CapRow/index.js";
18
21
  import CapSlideBox from "../CapSlideBox/index.js";
19
22
  import { CAP_G06, CAP_SPACE_08 } from "../styles/_variables.js";
20
23
  import styles from "./styles.module.scss.js";
21
- import LogoBackground from "../assets/icons/logoBackground.js";
22
24
  const capLogo = require("../assets/icons/cap-logo-mobile.svg");
23
25
  const hamburgerIcon = require("../assets/icons/hamburger.svg");
24
26
  const moreApplications = require("../assets/icons/moreApplications.svg");
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
package/CapIcon/index.js CHANGED
@@ -2,9 +2,11 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import * as AntdIcons from "@ant-design-v5/icons";
3
3
  import classNames from "classnames";
4
4
  import React from "react";
5
- import styles from "./styles.module.scss.js";
5
+ import "../assets/icons/dropdownIcon.js";
6
+ import "../assets/icons/add.js";
6
7
  import LogoBackground from "../assets/icons/logoBackground.js";
7
8
  import { getSvgComponentFromType } from "../assets/svgIcons/component.js";
9
+ import styles from "./styles.module.scss.js";
8
10
  const iconMapping = {
9
11
  add: "plus"
10
12
  };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,24 @@
1
+ import { defineMessages } from "react-intl";
2
+ const scope = "app.commonUtils.capUiLibrary.CapInput";
3
+ const messages = defineMessages({
4
+ placeholder: {
5
+ id: `${scope}.placeholder`,
6
+ defaultMessage: "Enter text..."
7
+ },
8
+ searchPlaceholder: {
9
+ id: `${scope}.searchPlaceholder`,
10
+ defaultMessage: "Search..."
11
+ },
12
+ textAreaPlaceholder: {
13
+ id: `${scope}.textAreaPlaceholder`,
14
+ defaultMessage: "Enter your text here..."
15
+ },
16
+ numberPlaceholder: {
17
+ id: `${scope}.numberPlaceholder`,
18
+ defaultMessage: "Enter number..."
19
+ }
20
+ });
21
+ export {
22
+ messages as default,
23
+ scope
24
+ };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -1,18 +1,32 @@
1
1
  const CHANGE_LOCALE = "library/LanguageToggle/CHANGE_LOCALE";
2
2
  const GET_LOCIZE_MESSAGE_REQUEST = "library/LanguageProvider/GET_LOCIZE_MESSAGE_REQUEST";
3
+ const GET_LOCIZE_MESSAGE_SUCCESS = "library/LanguageProvider/GET_LOCIZE_MESSAGE_SUCCESS";
4
+ const GET_LOCIZE_MESSAGE_FAILURE = "library/LanguageProvider/GET_LOCIZE_MESSAGE_FAILURE";
3
5
  const GET_LOCIZE_MESSAGE_SKIP = "library/LanguageProvider/GET_LOCIZE_MESSAGE_SKIP";
4
6
  const REQUEST = "REQUEST";
7
+ const COMPLETE = "COMPLETE";
5
8
  const IDLE = "IDLE";
9
+ const SUCCESS = "SUCCESS";
10
+ const FAILURE = "FAILURE";
6
11
  const DEFAULT_LOCALE = "en";
7
12
  const GET_SUPPORTED_LOCALES_REQUEST = "library/GET_SUPPORTED_LOCALES_REQUEST";
13
+ const GET_SUPPORTED_LOCALES_SUCCESS = "library/GET_SUPPORTED_LOCALES_SUCCESS";
14
+ const GET_SUPPORTED_LOCALES_FAILURE = "library/GET_SUPPORTED_LOCALES_FAILURE";
8
15
  const GET_SUPPORTED_LOCALES_SKIP = "library/LanguageProvider/GET_SUPPORTED_LOCALES_SKIP";
9
16
  export {
10
17
  CHANGE_LOCALE,
18
+ COMPLETE,
11
19
  DEFAULT_LOCALE,
20
+ FAILURE,
21
+ GET_LOCIZE_MESSAGE_FAILURE,
12
22
  GET_LOCIZE_MESSAGE_REQUEST,
13
23
  GET_LOCIZE_MESSAGE_SKIP,
24
+ GET_LOCIZE_MESSAGE_SUCCESS,
25
+ GET_SUPPORTED_LOCALES_FAILURE,
14
26
  GET_SUPPORTED_LOCALES_REQUEST,
15
27
  GET_SUPPORTED_LOCALES_SKIP,
28
+ GET_SUPPORTED_LOCALES_SUCCESS,
16
29
  IDLE,
17
- REQUEST
30
+ REQUEST,
31
+ SUCCESS
18
32
  };
@@ -10,11 +10,11 @@ import { compose, bindActionCreators } from "redux";
10
10
  import { createStructuredSelector } from "reselect";
11
11
  import "../utils/dayjs.js";
12
12
  import CapSpin from "../CapSpin/index.js";
13
- import * as actions from "./actions.js";
13
+ import * as CapLanguageProvider_actions from "./actions.js";
14
14
  import { REQUEST } from "./constants.js";
15
- import * as selector from "./selector.js";
15
+ import * as CapLanguageProvider_selector from "./selector.js";
16
16
  import dayjs from "dayjs";
17
- const { makeSelectLanguage, makeSelectSupportedLocalesDetails } = selector;
17
+ const { makeSelectLanguage, makeSelectSupportedLocalesDetails } = CapLanguageProvider_selector;
18
18
  function getAllLocales({ lang, supportedLocales }) {
19
19
  var _a, _b, _c, _d;
20
20
  const antdLocale = lang == null ? void 0 : lang.replace("-", "_");
@@ -176,7 +176,7 @@ const mapStateToProps = createStructuredSelector({
176
176
  });
177
177
  function mapDispatchToProps(dispatch) {
178
178
  return {
179
- actions: bindActionCreators(actions, dispatch)
179
+ actions: bindActionCreators(CapLanguageProvider_actions, dispatch)
180
180
  };
181
181
  }
182
182
  const withConnect = connect(mapStateToProps, mapDispatchToProps);
@@ -1,5 +1,5 @@
1
1
  import { fromJS } from "immutable";
2
- import { IDLE, DEFAULT_LOCALE } from "./constants.js";
2
+ import { IDLE, DEFAULT_LOCALE, GET_SUPPORTED_LOCALES_FAILURE, FAILURE, GET_SUPPORTED_LOCALES_SUCCESS, SUCCESS, GET_SUPPORTED_LOCALES_REQUEST, REQUEST, GET_LOCIZE_MESSAGE_SKIP, COMPLETE, GET_LOCIZE_MESSAGE_FAILURE, GET_LOCIZE_MESSAGE_SUCCESS, GET_LOCIZE_MESSAGE_REQUEST, CHANGE_LOCALE } from "./constants.js";
3
3
  const initialState = fromJS({
4
4
  locale: DEFAULT_LOCALE,
5
5
  localeLoading: IDLE,
@@ -7,6 +7,29 @@ const initialState = fromJS({
7
7
  fetchSupportedLocalesStatus: IDLE,
8
8
  supportedLocales: []
9
9
  });
10
+ const languageProviderReducer = (state = initialState, action = { type: "" }) => {
11
+ switch (action.type) {
12
+ case CHANGE_LOCALE:
13
+ return state.set("locale", action.locale || DEFAULT_LOCALE);
14
+ case GET_LOCIZE_MESSAGE_REQUEST:
15
+ return state.set("localeLoading", REQUEST);
16
+ case GET_LOCIZE_MESSAGE_SUCCESS:
17
+ return state.set("localeLoading", COMPLETE).set("messages", fromJS(action.data || {})).set("locale", action.locale || DEFAULT_LOCALE);
18
+ case GET_LOCIZE_MESSAGE_FAILURE:
19
+ return state.set("localeLoading", COMPLETE).set("messages", fromJS({}));
20
+ case GET_LOCIZE_MESSAGE_SKIP:
21
+ return state.set("localeLoading", COMPLETE);
22
+ case GET_SUPPORTED_LOCALES_REQUEST:
23
+ return state.set("fetchSupportedLocalesStatus", REQUEST).set("supportedLocales", fromJS([]));
24
+ case GET_SUPPORTED_LOCALES_SUCCESS:
25
+ return state.set("fetchSupportedLocalesStatus", SUCCESS).set("supportedLocales", fromJS(action.data || []));
26
+ case GET_SUPPORTED_LOCALES_FAILURE:
27
+ return state.set("fetchSupportedLocalesStatus", FAILURE).set("supportedLocales", fromJS([]));
28
+ default:
29
+ return state;
30
+ }
31
+ };
10
32
  export {
33
+ languageProviderReducer as default,
11
34
  initialState
12
35
  };
@@ -0,0 +1,50 @@
1
+ import { takeLatest, call, put } from "redux-saga/effects";
2
+ import { GET_LOCIZE_MESSAGE_REQUEST, GET_SUPPORTED_LOCALES_REQUEST, GET_SUPPORTED_LOCALES_FAILURE, GET_SUPPORTED_LOCALES_SUCCESS, GET_LOCIZE_MESSAGE_SUCCESS, GET_LOCIZE_MESSAGE_FAILURE } from "./constants.js";
3
+ function* getLocizeMessage({ locale, locizeApi }) {
4
+ try {
5
+ const result = yield call(locizeApi, locale);
6
+ yield put({
7
+ type: GET_LOCIZE_MESSAGE_SUCCESS,
8
+ data: result,
9
+ locale
10
+ });
11
+ } catch (error) {
12
+ yield put({
13
+ type: GET_LOCIZE_MESSAGE_FAILURE,
14
+ data: error
15
+ });
16
+ }
17
+ }
18
+ function* fetchSupportedLocales({ supportedLocalesApi }) {
19
+ try {
20
+ const result = yield call(supportedLocalesApi);
21
+ if (result instanceof Error || !Array.isArray(result)) {
22
+ yield put({
23
+ type: GET_SUPPORTED_LOCALES_FAILURE
24
+ });
25
+ } else {
26
+ yield put({
27
+ type: GET_SUPPORTED_LOCALES_SUCCESS,
28
+ data: result
29
+ });
30
+ }
31
+ } catch (_error) {
32
+ yield put({
33
+ type: GET_SUPPORTED_LOCALES_FAILURE
34
+ });
35
+ }
36
+ }
37
+ function* watchForFetchSupportedLocales() {
38
+ yield takeLatest(GET_SUPPORTED_LOCALES_REQUEST, fetchSupportedLocales);
39
+ }
40
+ function* watchGetLocizeMessage() {
41
+ yield takeLatest(GET_LOCIZE_MESSAGE_REQUEST, getLocizeMessage);
42
+ }
43
+ const saga = [watchGetLocizeMessage, watchForFetchSupportedLocales];
44
+ export {
45
+ saga as default,
46
+ fetchSupportedLocales,
47
+ getLocizeMessage,
48
+ watchForFetchSupportedLocales,
49
+ watchGetLocizeMessage
50
+ };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+