@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.
- package/CapActionBar/types.js +1 -0
- package/CapAdvancedIcon/types.js +1 -0
- package/CapAppNotEnabled/types.js +1 -0
- package/CapAskAira/AudienceFilterBot/types.js +1 -0
- package/CapAskAira/CapAiMediaGeneration/constants.js +2 -0
- package/CapAskAira/CapAiMediaGeneration/index.js +4 -4
- package/CapAskAira/CapAiMediaGeneration/types.js +1 -0
- package/CapAskAira/ConfigurationBot/PromptAttachmentButton.js +33 -0
- package/CapAskAira/ConfigurationBot/constants.js +24 -0
- package/CapAskAira/ConfigurationBot/styles.module.scss.js +1 -1
- package/CapAskAira/ConfigurationBot/test/mockData.js +58 -0
- package/CapAskAira/ConfigurationBot/types.js +1 -0
- package/CapAskAira/ContentGenerationBot/constants.js +2 -0
- package/CapAskAira/ContentGenerationBot/types.js +1 -0
- package/CapAskAira/DocumentationBot/constants.js +2 -0
- package/CapAskAira/DocumentationBot/types.js +1 -0
- package/CapAskAira/DocumentationChatBot/constants.js +2 -0
- package/CapAskAira/DocumentationChatBot/index.js +4 -4
- package/CapAskAira/DocumentationChatBot/types.js +1 -0
- package/CapAskAira/RuleGenerationBot/constants.js +4 -0
- package/CapAskAira/RuleGenerationBot/index.js +8 -8
- package/CapAskAira/RuleGenerationBot/reducer.js +1 -1
- package/CapAskAira/RuleGenerationBot/saga.js +1 -1
- package/CapAskAira/RuleGenerationBot/types.js +1 -0
- package/CapAskAira/RuleSummarizationBot/constants.js +8 -0
- package/CapAskAira/RuleSummarizationBot/index.js +4 -4
- package/CapAskAira/RuleSummarizationBot/reducer.js +1 -1
- package/CapAskAira/RuleSummarizationBot/saga.js +1 -1
- package/CapAskAira/RuleSummarizationBot/types.js +1 -0
- package/CapAskAira/UtilComponents/Icons.js +4 -0
- package/CapAskAira/UtilComponents/Notification.js +14 -1
- package/CapAskAira/util.js +4 -3
- package/CapBanner/types.js +1 -0
- package/CapBlock/types.js +1 -0
- package/CapBorderedBox/types.js +1 -0
- package/CapButton/types.js +1 -0
- package/CapCSVFileUploader/types.js +1 -0
- package/CapCalendarDatePicker/types.js +1 -0
- package/CapCard/types.js +1 -0
- package/CapCardBox/types.js +1 -0
- package/CapCarousel/types.js +1 -0
- package/CapCheckbox/types.js +1 -0
- package/CapCollapsibleLeftNavigation/reducer.js +1 -1
- package/CapColorPicker/types.js +1 -0
- package/CapColoredTag/index.js +2 -2
- package/CapColoredTag/styles.js +28 -0
- package/CapColoredTag/types.js +1 -0
- package/CapColumn/types.js +1 -0
- package/CapCondition/constants.js +6 -0
- package/CapConditionPreview/constants.js +4 -0
- package/CapConditionPreview/types.js +1 -0
- package/CapCustomCard/types.js +1 -0
- package/CapCustomCarousel/types.js +1 -0
- package/CapCustomCheckboxList/types.js +1 -0
- package/CapCustomList/types.js +1 -0
- package/CapCustomSelect/types.js +1 -0
- package/CapDatePicker/types.js +1 -0
- package/CapDateRangePicker/types.js +1 -0
- package/CapDateTimePicker/types.js +1 -0
- package/CapDateTimeRangePicker/types.js +1 -0
- package/CapDivider/types.js +1 -0
- package/CapDnDGraph/constants.js +2 -0
- package/CapDnDGraph/mockdata.js +3371 -0
- package/CapDnDGraph/reportingBlock.js +1 -1
- package/CapDragAndDrop/constants.js +2 -0
- package/CapDragReorder/ItemTypes.js +6 -0
- package/CapDrawer/types.js +1 -0
- package/CapDropdown/types.js +1 -0
- package/CapEmptyDivWithBorder/types.js +1 -0
- package/CapError/types.js +1 -0
- package/CapErrorBoundary/types.js +1 -0
- package/CapErrorStateIllustration/types.js +1 -0
- package/CapEventCalendar/drawUtils.js +1 -1
- package/CapEventCalendar/utils.js +5 -1
- package/CapExpressionEditor/js/pickers.js +59 -0
- package/CapExpressionEditor/types.js +1 -0
- package/CapForm/types.js +1 -0
- package/CapFormItem/types.js +1 -0
- package/CapGraph/types.js +1 -0
- package/CapHamburgerMenu/index.js +3 -1
- package/CapHamburgerMenu/types.js +1 -0
- package/CapHeader/types.js +1 -0
- package/CapHeading/types.js +1 -0
- package/CapIcon/index.js +3 -1
- package/CapIcon/types.js +1 -0
- package/CapIllustration/types.js +1 -0
- package/CapImage/types.js +1 -0
- package/CapImportMFEComponent/types.js +1 -0
- package/CapInfoNote/types.js +1 -0
- package/CapInput/messages.js +24 -0
- package/CapInput/types.js +1 -0
- package/CapLabel/types.js +1 -0
- package/CapLanguageProvider/constants.js +15 -1
- package/CapLanguageProvider/index.js +4 -4
- package/CapLanguageProvider/reducer.js +24 -1
- package/CapLanguageProvider/saga.js +50 -0
- package/CapLanguageProvider/types.js +1 -0
- package/CapLevelGraphRenderer/types.js +1 -0
- package/CapLink/types.js +1 -0
- package/CapList/types.js +1 -0
- package/CapListLayout/types.js +1 -0
- package/CapLogin/types.js +1 -0
- package/CapMenu/types.js +1 -0
- package/CapMobileDateRangePicker/ReactMobileDatePicker.js +975 -0
- package/CapModal/types.js +1 -0
- package/CapMultiSelect/types.js +1 -0
- package/CapMultiSelectDatePicker/types.js +1 -0
- package/CapMultiplePath/constants.js +2 -0
- package/CapMultiplePath/index.js +2 -2
- package/CapMultiplePath/mockdata.js +50 -0
- package/CapMultiplePath/styles.js +3 -3
- package/CapNavigation/mockdata.js +441 -0
- package/CapNavigation/types.js +1 -0
- package/CapNotification/types.js +1 -0
- package/CapNotificationDropdown/types.js +1 -0
- package/CapPopover/types.js +1 -0
- package/CapPopoverTree/style.js +1 -1
- package/CapProductSelection/style.js +3 -2
- package/CapProgress/types.js +1 -0
- package/CapRadio/types.js +1 -0
- package/CapRadioButton/types.js +1 -0
- package/CapRadioCard/types.js +1 -0
- package/CapRadioGroup/types.js +1 -0
- package/CapReorderComponent/types.js +1 -0
- package/CapRoadMap/types.js +1 -0
- package/CapRow/types.js +1 -0
- package/CapSKUUploader/types.js +1 -0
- package/CapSecondaryTopBar/index.js +3 -1
- package/CapSecondaryTopBar/types.js +1 -0
- package/CapSelect/types.js +1 -0
- package/CapSelectFilter/types.js +1 -0
- package/CapShape/types.js +1 -0
- package/CapSideBar/types.js +1 -0
- package/CapSkeleton/types.js +1 -0
- package/CapSlideBox/types.js +1 -0
- package/CapSlider/types.js +1 -0
- package/CapSnackBar/types.js +1 -0
- package/CapSomethingWentWrong/types.js +1 -0
- package/CapSpin/types.js +1 -0
- package/CapSplit/types.js +1 -0
- package/CapStaticTemplates/style.js +1 -1
- package/CapStatisticCard/types.js +1 -0
- package/CapStatus/index.js +2 -2
- package/CapStatus/types.js +1 -0
- package/CapSteps/types.js +1 -0
- package/CapStepsAccordian/types.js +1 -0
- package/CapSupportVideosWrapper/types.js +1 -0
- package/CapSupportVideosWrapper/utils.js +17 -1
- package/CapSwitch/types.js +1 -0
- package/CapTab/types.js +1 -0
- package/CapTabV3/types.js +1 -0
- package/CapTable/loadable.js +9 -0
- package/CapTable/types.js +1 -0
- package/CapTag/types.js +1 -0
- package/CapTagDropdown/types.js +1 -0
- package/CapTimePicker/types.js +1 -0
- package/CapTimeline/CapTimelineCard.js +2 -2
- package/CapTimeline/constants.js +6 -0
- package/CapTimelineNested/CapTimelineNestedCard.js +2 -2
- package/CapTimelineNested/NestedCardParent.js +2 -2
- package/CapTooltip/types.js +1 -0
- package/CapTooltipWithInfo/types.js +1 -0
- package/CapTopBar/CapOrgSelectUtils.js +3 -1
- package/CapTopBar/index.js +3 -1
- package/CapTopBar/mockdata.js +441 -0
- package/CapTopBar/types.js +1 -0
- package/CapTree/types.js +1 -0
- package/CapTreeSelect/types.js +1 -0
- package/CapTruncateList/types.js +1 -0
- package/CapUnifiedSelect/components.js +1 -1
- package/CapUnifiedSelect/testData.js +126 -0
- package/CapUnifiedSelect/types.js +1 -0
- package/CapUploader/types.js +1 -0
- package/CapUserProfile/constants.js +22 -2
- package/CapUserProfile/mockData.js +540 -0
- package/CapUserProfile/types.js +1 -0
- package/CapUserProfile/utils.js +24 -4
- package/CapVirtualList/types.js +1 -0
- package/CapVirtualSelect/constants.js +8 -0
- package/CapVirtualSelect/index.js +2 -2
- package/CapVirtualSelect/reducer.js +49 -2
- package/CapVirtualSelect/saga.js +91 -0
- package/assets/HOCs/ComponentWithLabelHOC/types.js +1 -0
- package/assets/HOCs/index.js +4 -0
- package/assets/svgIcons/Icons/index.js +4 -0
- package/assets/svgIcons/component.js +318 -318
- package/assets/svgIcons/index.js +650 -0
- package/index.js +5 -4
- package/package.json +1 -1
- package/service/api.types.js +1 -0
- package/styled/variables.d.ts +2 -0
- package/styled/variables.d.ts.map +1 -1
- package/styled/variables.js +3 -1
- package/utils/dayjs.js +37 -2
- package/utils/dayjs.types.js +1 -0
- package/utils/index.js +1 -0
- package/utils/styles.js +1 -0
- /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 {
|
|
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 @@
|
|
|
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,
|
|
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 {
|
|
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
|
+
|
package/CapForm/types.js
ADDED
|
@@ -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
|
|
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
|
};
|
package/CapIcon/types.js
ADDED
|
@@ -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
|
|
13
|
+
import * as CapLanguageProvider_actions from "./actions.js";
|
|
14
14
|
import { REQUEST } from "./constants.js";
|
|
15
|
-
import * as
|
|
15
|
+
import * as CapLanguageProvider_selector from "./selector.js";
|
|
16
16
|
import dayjs from "dayjs";
|
|
17
|
-
const { makeSelectLanguage, makeSelectSupportedLocalesDetails } =
|
|
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(
|
|
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
|
+
|
package/CapLink/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/CapList/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/CapMenu/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|