@atlaskit/editor-core 188.10.5 → 188.11.0
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/CHANGELOG.md +17 -0
- package/architecture/0003-explicit-plugin-dependencies.md +1 -1
- package/dist/cjs/labs/next/presets/universal.js +4 -3
- package/dist/cjs/messages.js +1 -2
- package/dist/cjs/plugins/index.js +0 -14
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +3 -2
- package/dist/es2019/messages.js +1 -2
- package/dist/es2019/plugins/index.js +0 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +3 -2
- package/dist/esm/messages.js +1 -2
- package/dist/esm/plugins/index.js +0 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/messages.d.ts +1 -2
- package/dist/types/plugins/index.d.ts +0 -2
- package/dist/types/plugins/insert-block/types.d.ts +2 -4
- package/dist/types/types/editor-props.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/messages.d.ts +1 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +2 -4
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ConfigPanel/FormErrorBoundary.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/package.json +7 -10
- package/report.api.md +1 -9
- package/tmp/api-report-tmp.d.ts +1 -9
- package/dist/cjs/plugins/date/actions.js +0 -105
- package/dist/cjs/plugins/date/commands.js +0 -118
- package/dist/cjs/plugins/date/index.js +0 -13
- package/dist/cjs/plugins/date/nodeviews/date.js +0 -44
- package/dist/cjs/plugins/date/nodeviews/messages.js +0 -14
- package/dist/cjs/plugins/date/plugin.js +0 -197
- package/dist/cjs/plugins/date/pm-plugins/keymap.js +0 -41
- package/dist/cjs/plugins/date/pm-plugins/main.js +0 -39
- package/dist/cjs/plugins/date/pm-plugins/plugin-key.js +0 -8
- package/dist/cjs/plugins/date/pm-plugins/types.js +0 -5
- package/dist/cjs/plugins/date/pm-plugins/utils.js +0 -70
- package/dist/cjs/plugins/date/types.js +0 -5
- package/dist/cjs/plugins/date/ui/DatePicker/date-picker-input.js +0 -244
- package/dist/cjs/plugins/date/ui/DatePicker/index.js +0 -168
- package/dist/cjs/plugins/date/utils/formatParse.js +0 -88
- package/dist/cjs/plugins/date/utils/internal.js +0 -176
- package/dist/cjs/plugins/mentions/analytics.js +0 -157
- package/dist/cjs/plugins/mentions/index.js +0 -142
- package/dist/cjs/plugins/mentions/messages.js +0 -29
- package/dist/cjs/plugins/mentions/nodeviews/mention.js +0 -117
- package/dist/cjs/plugins/mentions/pm-plugins/key.js +0 -8
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +0 -156
- package/dist/cjs/plugins/mentions/pm-plugins/utils.js +0 -23
- package/dist/cjs/plugins/mentions/type-ahead/index.js +0 -362
- package/dist/cjs/plugins/mentions/types.js +0 -5
- package/dist/cjs/plugins/mentions/ui/InviteItem/index.js +0 -76
- package/dist/cjs/plugins/mentions/ui/InviteItem/styles.js +0 -19
- package/dist/cjs/plugins/mentions/ui/Mention/index.js +0 -98
- package/dist/cjs/plugins/mentions/ui/ToolbarMention/index.js +0 -63
- package/dist/cjs/plugins/mentions/utils.js +0 -32
- package/dist/es2019/plugins/date/actions.js +0 -93
- package/dist/es2019/plugins/date/commands.js +0 -113
- package/dist/es2019/plugins/date/index.js +0 -1
- package/dist/es2019/plugins/date/nodeviews/date.js +0 -47
- package/dist/es2019/plugins/date/nodeviews/messages.js +0 -8
- package/dist/es2019/plugins/date/plugin.js +0 -183
- package/dist/es2019/plugins/date/pm-plugins/keymap.js +0 -34
- package/dist/es2019/plugins/date/pm-plugins/main.js +0 -35
- package/dist/es2019/plugins/date/pm-plugins/plugin-key.js +0 -2
- package/dist/es2019/plugins/date/pm-plugins/types.js +0 -1
- package/dist/es2019/plugins/date/pm-plugins/utils.js +0 -70
- package/dist/es2019/plugins/date/types.js +0 -1
- package/dist/es2019/plugins/date/ui/DatePicker/date-picker-input.js +0 -233
- package/dist/es2019/plugins/date/ui/DatePicker/index.js +0 -152
- package/dist/es2019/plugins/date/utils/formatParse.js +0 -83
- package/dist/es2019/plugins/date/utils/internal.js +0 -151
- package/dist/es2019/plugins/mentions/analytics.js +0 -147
- package/dist/es2019/plugins/mentions/index.js +0 -124
- package/dist/es2019/plugins/mentions/messages.js +0 -23
- package/dist/es2019/plugins/mentions/nodeviews/mention.js +0 -80
- package/dist/es2019/plugins/mentions/pm-plugins/key.js +0 -2
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +0 -143
- package/dist/es2019/plugins/mentions/pm-plugins/utils.js +0 -14
- package/dist/es2019/plugins/mentions/type-ahead/index.js +0 -338
- package/dist/es2019/plugins/mentions/types.js +0 -1
- package/dist/es2019/plugins/mentions/ui/InviteItem/index.js +0 -66
- package/dist/es2019/plugins/mentions/ui/InviteItem/styles.js +0 -47
- package/dist/es2019/plugins/mentions/ui/Mention/index.js +0 -71
- package/dist/es2019/plugins/mentions/ui/ToolbarMention/index.js +0 -33
- package/dist/es2019/plugins/mentions/utils.js +0 -20
- package/dist/esm/plugins/date/actions.js +0 -99
- package/dist/esm/plugins/date/commands.js +0 -112
- package/dist/esm/plugins/date/index.js +0 -1
- package/dist/esm/plugins/date/nodeviews/date.js +0 -37
- package/dist/esm/plugins/date/nodeviews/messages.js +0 -8
- package/dist/esm/plugins/date/plugin.js +0 -185
- package/dist/esm/plugins/date/pm-plugins/keymap.js +0 -34
- package/dist/esm/plugins/date/pm-plugins/main.js +0 -34
- package/dist/esm/plugins/date/pm-plugins/plugin-key.js +0 -2
- package/dist/esm/plugins/date/pm-plugins/types.js +0 -1
- package/dist/esm/plugins/date/pm-plugins/utils.js +0 -61
- package/dist/esm/plugins/date/types.js +0 -1
- package/dist/esm/plugins/date/ui/DatePicker/date-picker-input.js +0 -238
- package/dist/esm/plugins/date/ui/DatePicker/index.js +0 -162
- package/dist/esm/plugins/date/utils/formatParse.js +0 -79
- package/dist/esm/plugins/date/utils/internal.js +0 -165
- package/dist/esm/plugins/mentions/analytics.js +0 -150
- package/dist/esm/plugins/mentions/index.js +0 -130
- package/dist/esm/plugins/mentions/messages.js +0 -23
- package/dist/esm/plugins/mentions/nodeviews/mention.js +0 -107
- package/dist/esm/plugins/mentions/pm-plugins/key.js +0 -2
- package/dist/esm/plugins/mentions/pm-plugins/main.js +0 -148
- package/dist/esm/plugins/mentions/pm-plugins/utils.js +0 -16
- package/dist/esm/plugins/mentions/type-ahead/index.js +0 -350
- package/dist/esm/plugins/mentions/types.js +0 -1
- package/dist/esm/plugins/mentions/ui/InviteItem/index.js +0 -65
- package/dist/esm/plugins/mentions/ui/InviteItem/styles.js +0 -12
- package/dist/esm/plugins/mentions/ui/Mention/index.js +0 -91
- package/dist/esm/plugins/mentions/ui/ToolbarMention/index.js +0 -53
- package/dist/esm/plugins/mentions/utils.js +0 -26
- package/dist/types/plugins/date/actions.d.ts +0 -47
- package/dist/types/plugins/date/commands.d.ts +0 -12
- package/dist/types/plugins/date/index.d.ts +0 -1
- package/dist/types/plugins/date/nodeviews/date.d.ts +0 -3
- package/dist/types/plugins/date/nodeviews/messages.d.ts +0 -7
- package/dist/types/plugins/date/plugin.d.ts +0 -3
- package/dist/types/plugins/date/pm-plugins/keymap.d.ts +0 -3
- package/dist/types/plugins/date/pm-plugins/main.d.ts +0 -6
- package/dist/types/plugins/date/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types/plugins/date/pm-plugins/types.d.ts +0 -12
- package/dist/types/plugins/date/pm-plugins/utils.d.ts +0 -5
- package/dist/types/plugins/date/types.d.ts +0 -1
- package/dist/types/plugins/date/ui/DatePicker/date-picker-input.d.ts +0 -24
- package/dist/types/plugins/date/ui/DatePicker/index.d.ts +0 -36
- package/dist/types/plugins/date/utils/formatParse.d.ts +0 -27
- package/dist/types/plugins/date/utils/internal.d.ts +0 -33
- package/dist/types/plugins/mentions/analytics.d.ts +0 -13
- package/dist/types/plugins/mentions/index.d.ts +0 -19
- package/dist/types/plugins/mentions/messages.d.ts +0 -22
- package/dist/types/plugins/mentions/nodeviews/mention.d.ts +0 -9
- package/dist/types/plugins/mentions/pm-plugins/key.d.ts +0 -3
- package/dist/types/plugins/mentions/pm-plugins/main.d.ts +0 -6
- package/dist/types/plugins/mentions/pm-plugins/utils.d.ts +0 -4
- package/dist/types/plugins/mentions/type-ahead/index.d.ts +0 -17
- package/dist/types/plugins/mentions/types.d.ts +0 -24
- package/dist/types/plugins/mentions/ui/InviteItem/index.d.ts +0 -22
- package/dist/types/plugins/mentions/ui/InviteItem/styles.d.ts +0 -8
- package/dist/types/plugins/mentions/ui/Mention/index.d.ts +0 -19
- package/dist/types/plugins/mentions/ui/ToolbarMention/index.d.ts +0 -13
- package/dist/types/plugins/mentions/utils.d.ts +0 -8
- package/dist/types-ts4.5/plugins/date/actions.d.ts +0 -58
- package/dist/types-ts4.5/plugins/date/commands.d.ts +0 -14
- package/dist/types-ts4.5/plugins/date/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/date/nodeviews/date.d.ts +0 -3
- package/dist/types-ts4.5/plugins/date/nodeviews/messages.d.ts +0 -7
- package/dist/types-ts4.5/plugins/date/plugin.d.ts +0 -3
- package/dist/types-ts4.5/plugins/date/pm-plugins/keymap.d.ts +0 -3
- package/dist/types-ts4.5/plugins/date/pm-plugins/main.d.ts +0 -6
- package/dist/types-ts4.5/plugins/date/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/date/pm-plugins/types.d.ts +0 -12
- package/dist/types-ts4.5/plugins/date/pm-plugins/utils.d.ts +0 -5
- package/dist/types-ts4.5/plugins/date/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/date/ui/DatePicker/date-picker-input.d.ts +0 -24
- package/dist/types-ts4.5/plugins/date/ui/DatePicker/index.d.ts +0 -36
- package/dist/types-ts4.5/plugins/date/utils/formatParse.d.ts +0 -27
- package/dist/types-ts4.5/plugins/date/utils/internal.d.ts +0 -33
- package/dist/types-ts4.5/plugins/mentions/analytics.d.ts +0 -13
- package/dist/types-ts4.5/plugins/mentions/index.d.ts +0 -22
- package/dist/types-ts4.5/plugins/mentions/messages.d.ts +0 -22
- package/dist/types-ts4.5/plugins/mentions/nodeviews/mention.d.ts +0 -9
- package/dist/types-ts4.5/plugins/mentions/pm-plugins/key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/mentions/pm-plugins/main.d.ts +0 -6
- package/dist/types-ts4.5/plugins/mentions/pm-plugins/utils.d.ts +0 -4
- package/dist/types-ts4.5/plugins/mentions/type-ahead/index.d.ts +0 -17
- package/dist/types-ts4.5/plugins/mentions/types.d.ts +0 -24
- package/dist/types-ts4.5/plugins/mentions/ui/InviteItem/index.d.ts +0 -22
- package/dist/types-ts4.5/plugins/mentions/ui/InviteItem/styles.d.ts +0 -8
- package/dist/types-ts4.5/plugins/mentions/ui/Mention/index.d.ts +0 -19
- package/dist/types-ts4.5/plugins/mentions/ui/ToolbarMention/index.d.ts +0 -13
- package/dist/types-ts4.5/plugins/mentions/utils.d.ts +0 -8
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
16
|
-
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
var _react2 = require("@emotion/react");
|
|
18
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
19
|
-
var _ui = require("@atlaskit/editor-common/ui");
|
|
20
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
22
|
-
var _calendar = _interopRequireDefault(require("@atlaskit/calendar"));
|
|
23
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
24
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
25
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
26
|
-
var _reactIntlNext = require("react-intl-next");
|
|
27
|
-
var _datePickerInput = _interopRequireDefault(require("./date-picker-input"));
|
|
28
|
-
var _templateObject;
|
|
29
|
-
/** @jsx jsx */
|
|
30
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
31
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
32
|
-
var PopupWithListeners = (0, _ui.withOuterListeners)(_ui.Popup);
|
|
33
|
-
var popupContentWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding: ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n background-color: ", ";\n"])), "var(--ds-space-025, 2px)", (0, _constants.borderRadius)(), "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), "var(--ds-surface-overlay, ".concat(_colors.N0, ")"));
|
|
34
|
-
var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
35
|
-
(0, _inherits2.default)(DatePicker, _React$Component);
|
|
36
|
-
var _super = _createSuper(DatePicker);
|
|
37
|
-
function DatePicker(props) {
|
|
38
|
-
var _this;
|
|
39
|
-
(0, _classCallCheck2.default)(this, DatePicker);
|
|
40
|
-
_this = _super.call(this, props);
|
|
41
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleNewDate", function (date) {
|
|
42
|
-
_this.props.onTextChanged(date);
|
|
43
|
-
_this.setState({
|
|
44
|
-
latestValidDate: date
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyboardSubmitDate", function (date) {
|
|
48
|
-
_this.props.onSelect(date, _analytics.INPUT_METHOD.KEYBOARD);
|
|
49
|
-
});
|
|
50
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEmptySubmitDate", function () {
|
|
51
|
-
_this.props.onDelete();
|
|
52
|
-
});
|
|
53
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOnChange", function (_ref) {
|
|
54
|
-
var day = _ref.day,
|
|
55
|
-
month = _ref.month,
|
|
56
|
-
year = _ref.year;
|
|
57
|
-
var date = {
|
|
58
|
-
day: day,
|
|
59
|
-
month: month,
|
|
60
|
-
year: year
|
|
61
|
-
};
|
|
62
|
-
_this.setState({
|
|
63
|
-
latestValidDate: date
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closeDatePickerWithAnalytics", function () {
|
|
67
|
-
_this.props.closeDatePickerWithAnalytics({
|
|
68
|
-
date: _this.state.latestValidDate
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleRef", function (ref) {
|
|
72
|
-
var elm = ref && _reactDom.default.findDOMNode(ref);
|
|
73
|
-
if (elm) {
|
|
74
|
-
elm.focus();
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
var timestamp = props.element.getAttribute('timestamp');
|
|
78
|
-
if (timestamp) {
|
|
79
|
-
// Warning: The 'Date' return type of timestampToUTCDate() is not a JS date, it's more similar
|
|
80
|
-
// to the DateType type
|
|
81
|
-
var _timestampToUTCDate = (0, _utils.timestampToUTCDate)(timestamp),
|
|
82
|
-
day = _timestampToUTCDate.day,
|
|
83
|
-
month = _timestampToUTCDate.month,
|
|
84
|
-
year = _timestampToUTCDate.year;
|
|
85
|
-
var _date = {
|
|
86
|
-
day: day,
|
|
87
|
-
month: month,
|
|
88
|
-
year: year
|
|
89
|
-
};
|
|
90
|
-
_this.state = {
|
|
91
|
-
selected: [(0, _utils.timestampToIsoFormat)(timestamp)],
|
|
92
|
-
date: _date,
|
|
93
|
-
latestValidDate: _date
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return _this;
|
|
97
|
-
}
|
|
98
|
-
(0, _createClass2.default)(DatePicker, [{
|
|
99
|
-
key: "render",
|
|
100
|
-
value: function render() {
|
|
101
|
-
var _this$props = this.props,
|
|
102
|
-
element = _this$props.element,
|
|
103
|
-
_onSelect = _this$props.onSelect,
|
|
104
|
-
mountTo = _this$props.mountTo,
|
|
105
|
-
boundariesElement = _this$props.boundariesElement,
|
|
106
|
-
scrollableElement = _this$props.scrollableElement,
|
|
107
|
-
intl = _this$props.intl,
|
|
108
|
-
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent,
|
|
109
|
-
isNew = _this$props.isNew,
|
|
110
|
-
autoFocus = _this$props.autoFocus,
|
|
111
|
-
weekStartDay = _this$props.weekStartDay;
|
|
112
|
-
var timestamp = element.getAttribute('timestamp');
|
|
113
|
-
if (this.state === null) {
|
|
114
|
-
// Without this, you can blow up the page by slowing down cpu, opening date, typing after date
|
|
115
|
-
// then clicking on date lozenge and typing quickly before it opens
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
var _this$state = this.state,
|
|
119
|
-
date = _this$state.date,
|
|
120
|
-
selected = _this$state.selected,
|
|
121
|
-
latestValidDate = _this$state.latestValidDate;
|
|
122
|
-
var day = latestValidDate.day,
|
|
123
|
-
month = latestValidDate.month,
|
|
124
|
-
year = latestValidDate.year;
|
|
125
|
-
if (!timestamp) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
return (0, _react2.jsx)(PopupWithListeners, {
|
|
129
|
-
target: element,
|
|
130
|
-
offset: [0, 8],
|
|
131
|
-
fitHeight: 327,
|
|
132
|
-
fitWidth: 340,
|
|
133
|
-
handleClickOutside: this.closeDatePickerWithAnalytics,
|
|
134
|
-
handleEscapeKeydown: this.closeDatePickerWithAnalytics,
|
|
135
|
-
zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
|
|
136
|
-
mountTo: mountTo,
|
|
137
|
-
boundariesElement: boundariesElement,
|
|
138
|
-
scrollableElement: scrollableElement,
|
|
139
|
-
ariaLabel: null
|
|
140
|
-
}, (0, _react2.jsx)("div", {
|
|
141
|
-
css: popupContentWrapper
|
|
142
|
-
}, (0, _react2.jsx)(_datePickerInput.default, {
|
|
143
|
-
date: date,
|
|
144
|
-
onNewDate: this.handleNewDate,
|
|
145
|
-
onSubmitDate: this.handleKeyboardSubmitDate,
|
|
146
|
-
onEmptySubmit: this.handleEmptySubmitDate,
|
|
147
|
-
locale: intl.locale,
|
|
148
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
149
|
-
autoFocus: autoFocus,
|
|
150
|
-
autoSelectAll: isNew
|
|
151
|
-
}), (0, _react2.jsx)(_calendar.default, {
|
|
152
|
-
onChange: this.handleOnChange,
|
|
153
|
-
onSelect: function onSelect(date) {
|
|
154
|
-
return _onSelect(date, _analytics.INPUT_METHOD.PICKER);
|
|
155
|
-
},
|
|
156
|
-
day: day,
|
|
157
|
-
month: month,
|
|
158
|
-
year: year,
|
|
159
|
-
selected: selected,
|
|
160
|
-
ref: this.handleRef,
|
|
161
|
-
weekStartDay: weekStartDay,
|
|
162
|
-
testId: 'datepicker'
|
|
163
|
-
})));
|
|
164
|
-
}
|
|
165
|
-
}]);
|
|
166
|
-
return DatePicker;
|
|
167
|
-
}(_react.default.Component);
|
|
168
|
-
var _default = exports.default = (0, _reactIntlNext.injectIntl)(DatePicker);
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dateToDateType = dateToDateType;
|
|
7
|
-
exports.dateTypeToDate = dateTypeToDate;
|
|
8
|
-
exports.formatDateType = formatDateType;
|
|
9
|
-
exports.parseDateType = parseDateType;
|
|
10
|
-
var _locale = require("@atlaskit/locale");
|
|
11
|
-
/**
|
|
12
|
-
* Attempt to parse a string representing a date in a particular locale to a date object
|
|
13
|
-
* @param dateString The string representing the date in the given locale, eg '02/12/2000'
|
|
14
|
-
* @param l10n The localisation provider created by createLocalizationProvider
|
|
15
|
-
* @returns Editor DateType when can parse, null when can't parse or invalid
|
|
16
|
-
*/
|
|
17
|
-
function parseDateType(dateString, locale) {
|
|
18
|
-
try {
|
|
19
|
-
var l10n = (0, _locale.createLocalizationProvider)(locale);
|
|
20
|
-
var date = l10n.parseDate(dateString);
|
|
21
|
-
|
|
22
|
-
// If date is invalid
|
|
23
|
-
if (isNaN(date.getTime())) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
var year = date.getFullYear();
|
|
27
|
-
if (year < 1000 || year > 9999) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
var dateObj = {
|
|
31
|
-
day: date.getDate(),
|
|
32
|
-
month: date.getMonth() + 1,
|
|
33
|
-
year: year
|
|
34
|
-
};
|
|
35
|
-
return dateObj;
|
|
36
|
-
} catch (e) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Convert an EditorDateType to a date string string formatted for a particular locale
|
|
43
|
-
* @param date The date object
|
|
44
|
-
* @param locale The locale code string (eg. "en-AU")
|
|
45
|
-
* @returns Date string, eg "25/5/20"
|
|
46
|
-
*/
|
|
47
|
-
function formatDateType(date, locale) {
|
|
48
|
-
var day = date.day,
|
|
49
|
-
month = date.month,
|
|
50
|
-
year = date.year;
|
|
51
|
-
var l10n = (0, _locale.createLocalizationProvider)(locale);
|
|
52
|
-
|
|
53
|
-
// The JS Date api represents month as a number between 0-11 :)
|
|
54
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
55
|
-
var dateObj = new Date(year, month - 1, day);
|
|
56
|
-
return l10n.formatDate(dateObj);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Convert an Editor DateType to a JavaScript Date object
|
|
61
|
-
* @param date Editor DateType
|
|
62
|
-
* @returns JavaScript Date object
|
|
63
|
-
*/
|
|
64
|
-
function dateTypeToDate(date) {
|
|
65
|
-
var day = date.day,
|
|
66
|
-
month = date.month,
|
|
67
|
-
year = date.year;
|
|
68
|
-
// The JS Date api represents month as a number between 0-11 :)
|
|
69
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
70
|
-
var dateObj = new Date(year, month - 1, day);
|
|
71
|
-
return dateObj;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Convert a JavaScript Date to an editor DateType
|
|
76
|
-
* @param date JavaScript Date object
|
|
77
|
-
* @returns Editor DateType
|
|
78
|
-
*/
|
|
79
|
-
function dateToDateType(date) {
|
|
80
|
-
var dateObj = {
|
|
81
|
-
day: date.getDate(),
|
|
82
|
-
// The JS Date api represents month as a number between 0-11 :)
|
|
83
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
84
|
-
month: date.getMonth() + 1,
|
|
85
|
-
year: date.getFullYear()
|
|
86
|
-
};
|
|
87
|
-
return dateObj;
|
|
88
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.adjustDate = adjustDate;
|
|
8
|
-
exports.findDateSegmentByPosition = findDateSegmentByPosition;
|
|
9
|
-
exports.getLocaleDatePlaceholder = getLocaleDatePlaceholder;
|
|
10
|
-
exports.isDatePossiblyValid = isDatePossiblyValid;
|
|
11
|
-
exports.isToday = isToday;
|
|
12
|
-
var _formatParse = require("./formatParse");
|
|
13
|
-
var _addDays = _interopRequireDefault(require("date-fns/addDays"));
|
|
14
|
-
var _addMonths = _interopRequireDefault(require("date-fns/addMonths"));
|
|
15
|
-
var _addYears = _interopRequireDefault(require("date-fns/addYears"));
|
|
16
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
17
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
|
-
function isDigit(c) {
|
|
20
|
-
if (c === undefined) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
return c >= '0' && c <= '9';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Check if cursor is in first segment of a date.
|
|
28
|
-
* @param cursorPos Cursor pos, with 0 referring to the left of first char
|
|
29
|
-
* @param date Date string in any locale
|
|
30
|
-
*/
|
|
31
|
-
function isCursorInFirstDateSegment(cursorPos, date) {
|
|
32
|
-
var posCounter = cursorPos - 1;
|
|
33
|
-
var isAdjacent = true;
|
|
34
|
-
// The date without any non-digit characters on the end
|
|
35
|
-
var strippedDate = date.replace(/[^0-9]+$/g, '');
|
|
36
|
-
while (posCounter >= 0 && isAdjacent) {
|
|
37
|
-
var c = strippedDate[posCounter];
|
|
38
|
-
if (!isDigit(c)) {
|
|
39
|
-
isAdjacent = false;
|
|
40
|
-
}
|
|
41
|
-
posCounter -= 1;
|
|
42
|
-
}
|
|
43
|
-
return isAdjacent;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Check if cursor is in last segment of a date.
|
|
48
|
-
* @param cursorPos Cursor pos, with 0 referring to the left of first char
|
|
49
|
-
* @param date Date string in any locale
|
|
50
|
-
*/
|
|
51
|
-
function isCursorInLastDateSegment(cursorPos, date) {
|
|
52
|
-
var posCounter = cursorPos;
|
|
53
|
-
var isAdjacent = true;
|
|
54
|
-
// The date without any non-digit characters on the end
|
|
55
|
-
var strippedDate = date.replace(/[^0-9]+$/g, '');
|
|
56
|
-
while (posCounter < strippedDate.length && isAdjacent) {
|
|
57
|
-
var c = strippedDate[posCounter];
|
|
58
|
-
if (!isDigit(c)) {
|
|
59
|
-
isAdjacent = false;
|
|
60
|
-
}
|
|
61
|
-
posCounter += 1;
|
|
62
|
-
}
|
|
63
|
-
return isAdjacent;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Inconclusively check if a date string is valid - a value of false means it is definitely
|
|
68
|
-
* invalid, a value of true means it might be valid.
|
|
69
|
-
* @param date Date string to be parsed
|
|
70
|
-
*/
|
|
71
|
-
function isDatePossiblyValid(date) {
|
|
72
|
-
var _iterator = _createForOfIteratorHelper(date),
|
|
73
|
-
_step;
|
|
74
|
-
try {
|
|
75
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
76
|
-
var c = _step.value;
|
|
77
|
-
var isNumber = c >= '0' && c <= '9';
|
|
78
|
-
var isValidPunctuation = '. ,/'.indexOf(c) !== -1;
|
|
79
|
-
if (!(isNumber || isValidPunctuation)) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
} catch (err) {
|
|
84
|
-
_iterator.e(err);
|
|
85
|
-
} finally {
|
|
86
|
-
_iterator.f();
|
|
87
|
-
}
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Find the segment of a date a position refers to. Eg: pos 2 in 29/03/2020 is in
|
|
93
|
-
* the day segment.
|
|
94
|
-
* @param position Cursor position, with 0 referring to the left of the first char
|
|
95
|
-
* @param date The localised date string
|
|
96
|
-
* @param locale The language to interpret the date string in
|
|
97
|
-
*/
|
|
98
|
-
function findDateSegmentByPosition(position, date, locale) {
|
|
99
|
-
if (position > date.length) {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
var placeholder = getLocaleDatePlaceholder(locale);
|
|
103
|
-
if (!placeholder) {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// The placeholder without any non-digit characters on the end
|
|
108
|
-
var strippedPlaceholder = placeholder.replace(/[^ymd]+$/g, '');
|
|
109
|
-
var keyToSegment = {
|
|
110
|
-
d: 'day',
|
|
111
|
-
m: 'month',
|
|
112
|
-
y: 'year'
|
|
113
|
-
};
|
|
114
|
-
var firstSegment = keyToSegment[strippedPlaceholder[0]];
|
|
115
|
-
var lastSegment = keyToSegment[strippedPlaceholder[strippedPlaceholder.length - 1]];
|
|
116
|
-
var allPossibleSegments = ['day', 'month', 'year'];
|
|
117
|
-
var middleSegment = allPossibleSegments.filter(function (s) {
|
|
118
|
-
return s !== firstSegment && s !== lastSegment;
|
|
119
|
-
})[0];
|
|
120
|
-
if (isCursorInFirstDateSegment(position, date)) {
|
|
121
|
-
return firstSegment;
|
|
122
|
-
}
|
|
123
|
-
if (isCursorInLastDateSegment(position, date)) {
|
|
124
|
-
return lastSegment;
|
|
125
|
-
}
|
|
126
|
-
return middleSegment;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Generate a placeholder date string for a given locale
|
|
131
|
-
* eg: locale 'hu-HU' -> 'yyyy. mm. dd.'
|
|
132
|
-
* @param locale A locale string supported by Intl.DateTimeFormat
|
|
133
|
-
* @returns A placeholder string. d=1 or 2 digit day, dd=zero padded
|
|
134
|
-
* day, same for month but letter m, yyyy=year
|
|
135
|
-
*/
|
|
136
|
-
function getLocaleDatePlaceholder(locale) {
|
|
137
|
-
var uniqueDateType = {
|
|
138
|
-
day: 7,
|
|
139
|
-
month: 1,
|
|
140
|
-
year: 1992
|
|
141
|
-
};
|
|
142
|
-
var localisedDateString = (0, _formatParse.formatDateType)(uniqueDateType, locale);
|
|
143
|
-
var shortDateFormat = localisedDateString.replace(/\d+/g, function (str) {
|
|
144
|
-
if (!str) {
|
|
145
|
-
return '';
|
|
146
|
-
}
|
|
147
|
-
var num = parseInt(str);
|
|
148
|
-
switch (num % 100) {
|
|
149
|
-
case 92:
|
|
150
|
-
return str.replace(/.{1}/g, 'y');
|
|
151
|
-
case 1:
|
|
152
|
-
return str.length === 1 ? 'm' : 'mm';
|
|
153
|
-
case 7:
|
|
154
|
-
return str.length === 1 ? 'd' : 'dd';
|
|
155
|
-
}
|
|
156
|
-
return '';
|
|
157
|
-
});
|
|
158
|
-
return shortDateFormat;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Adjust date segment up or down. Eg. If day is the active segment and adjustment is -1,
|
|
163
|
-
* reduce the day by one.
|
|
164
|
-
* @param date Valid datetype
|
|
165
|
-
* @param activeSegment which part of the date is selected/being adjusted
|
|
166
|
-
* @param adjustment how many units the segment is being adjusted (can be pos or neg, usually 1 or -1)
|
|
167
|
-
*/
|
|
168
|
-
function adjustDate(date, activeSegment, adjustment) {
|
|
169
|
-
var originalDate = (0, _formatParse.dateTypeToDate)(date);
|
|
170
|
-
var newDate = activeSegment === 'day' ? (0, _addDays.default)(originalDate, adjustment) : activeSegment === 'month' ? (0, _addMonths.default)(originalDate, adjustment) : (0, _addYears.default)(originalDate, adjustment);
|
|
171
|
-
return (0, _formatParse.dateToDateType)(newDate);
|
|
172
|
-
}
|
|
173
|
-
function isToday(date) {
|
|
174
|
-
var today = new Date();
|
|
175
|
-
return date !== undefined && today.getDate() === date.day && date.month === today.getMonth() + 1 && date.year === today.getFullYear();
|
|
176
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.buildTypeAheadRenderedPayload = exports.buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteExposurePayload = exports.buildTypeAheadInsertedPayload = exports.buildTypeAheadCancelPayload = exports.buildAnalyticsPayload = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _analyticsGasTypes = require("@atlaskit/analytics-gas-types");
|
|
10
|
-
var _resource = require("@atlaskit/mention/resource");
|
|
11
|
-
var _utils = require("./utils");
|
|
12
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
var componentName = 'mention';
|
|
15
|
-
var buildAnalyticsPayload = exports.buildAnalyticsPayload = function buildAnalyticsPayload(actionSubject, action, eventType, sessionId) {
|
|
16
|
-
var otherAttributes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
17
|
-
var tags = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
|
|
18
|
-
return {
|
|
19
|
-
action: action,
|
|
20
|
-
actionSubject: actionSubject,
|
|
21
|
-
eventType: eventType,
|
|
22
|
-
attributes: _objectSpread({
|
|
23
|
-
componentName: componentName,
|
|
24
|
-
sessionId: sessionId
|
|
25
|
-
}, otherAttributes),
|
|
26
|
-
tags: tags
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
var emptyQueryResponse = {
|
|
30
|
-
queryLength: 0,
|
|
31
|
-
spaceInQuery: false
|
|
32
|
-
};
|
|
33
|
-
var extractAttributesFromQuery = function extractAttributesFromQuery(query) {
|
|
34
|
-
if (query) {
|
|
35
|
-
return {
|
|
36
|
-
queryLength: query.length,
|
|
37
|
-
spaceInQuery: query.indexOf(' ') !== -1
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return emptyQueryResponse;
|
|
41
|
-
};
|
|
42
|
-
var buildTypeAheadCancelPayload = exports.buildTypeAheadCancelPayload = function buildTypeAheadCancelPayload(duration, upKeyCount, downKeyCount, sessionId, query) {
|
|
43
|
-
var _extractAttributesFro = extractAttributesFromQuery(query),
|
|
44
|
-
queryLength = _extractAttributesFro.queryLength,
|
|
45
|
-
spaceInQuery = _extractAttributesFro.spaceInQuery;
|
|
46
|
-
return buildAnalyticsPayload('mentionTypeahead', 'cancelled', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
|
|
47
|
-
duration: duration,
|
|
48
|
-
downKeyCount: downKeyCount,
|
|
49
|
-
upKeyCount: upKeyCount,
|
|
50
|
-
queryLength: queryLength,
|
|
51
|
-
spaceInQuery: spaceInQuery
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
var getPosition = function getPosition(mentionList, selectedMention) {
|
|
55
|
-
if (mentionList) {
|
|
56
|
-
var index = mentionList.findIndex(function (mention) {
|
|
57
|
-
return mention.id === selectedMention.id;
|
|
58
|
-
});
|
|
59
|
-
return index === -1 ? undefined : index;
|
|
60
|
-
}
|
|
61
|
-
return;
|
|
62
|
-
};
|
|
63
|
-
var isClicked = function isClicked(insertType) {
|
|
64
|
-
return insertType === 'selected';
|
|
65
|
-
};
|
|
66
|
-
var buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInviteItemViewedPayload(sessionId, contextIdentifierProvider, userRole) {
|
|
67
|
-
var _ref = contextIdentifierProvider || {},
|
|
68
|
-
containerId = _ref.containerId,
|
|
69
|
-
objectId = _ref.objectId,
|
|
70
|
-
childObjectId = _ref.childObjectId;
|
|
71
|
-
return buildAnalyticsPayload('inviteItem', 'rendered', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
|
|
72
|
-
containerId: containerId,
|
|
73
|
-
objectId: objectId,
|
|
74
|
-
childObjectId: childObjectId,
|
|
75
|
-
userRole: userRole
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
var buildTypeAheadInviteExposurePayload = exports.buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteExposurePayload(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole) {
|
|
79
|
-
var _ref2 = contextIdentifierProvider || {},
|
|
80
|
-
containerId = _ref2.containerId,
|
|
81
|
-
objectId = _ref2.objectId,
|
|
82
|
-
childObjectId = _ref2.childObjectId;
|
|
83
|
-
return buildAnalyticsPayload('feature', 'exposed', _analyticsGasTypes.OPERATIONAL_EVENT_TYPE, sessionId, {
|
|
84
|
-
flagKey: 'confluence.frontend.invite.from.mention',
|
|
85
|
-
value: inviteExperimentCohort || 'not-enrolled',
|
|
86
|
-
containerId: containerId,
|
|
87
|
-
objectId: objectId,
|
|
88
|
-
childObjectId: childObjectId,
|
|
89
|
-
userRole: userRole
|
|
90
|
-
}, ['measurement', 'hasCustomAttributes']);
|
|
91
|
-
};
|
|
92
|
-
var buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInviteItemClickedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole) {
|
|
93
|
-
var _extractAttributesFro2 = extractAttributesFromQuery(query),
|
|
94
|
-
queryLength = _extractAttributesFro2.queryLength,
|
|
95
|
-
spaceInQuery = _extractAttributesFro2.spaceInQuery;
|
|
96
|
-
var _ref3 = contextIdentifierProvider || {},
|
|
97
|
-
containerId = _ref3.containerId,
|
|
98
|
-
objectId = _ref3.objectId,
|
|
99
|
-
childObjectId = _ref3.childObjectId;
|
|
100
|
-
return buildAnalyticsPayload('inviteItem', isClicked(insertType) ? 'clicked' : 'pressed', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
|
|
101
|
-
duration: duration,
|
|
102
|
-
queryLength: queryLength,
|
|
103
|
-
spaceInQuery: spaceInQuery,
|
|
104
|
-
upKeyCount: upKeyCount,
|
|
105
|
-
downKeyCount: downKeyCount,
|
|
106
|
-
containerId: containerId,
|
|
107
|
-
objectId: objectId,
|
|
108
|
-
childObjectId: childObjectId,
|
|
109
|
-
userRole: userRole
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
var buildTypeAheadInsertedPayload = exports.buildTypeAheadInsertedPayload = function buildTypeAheadInsertedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, mention, mentionList, query, contextIdentifierProvider) {
|
|
113
|
-
var _extractAttributesFro3 = extractAttributesFromQuery(query),
|
|
114
|
-
queryLength = _extractAttributesFro3.queryLength,
|
|
115
|
-
spaceInQuery = _extractAttributesFro3.spaceInQuery;
|
|
116
|
-
var analyticsPayload = buildAnalyticsPayload('mentionTypeahead', isClicked(insertType) ? 'clicked' : 'pressed', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
|
|
117
|
-
duration: duration,
|
|
118
|
-
position: getPosition(mentionList, mention),
|
|
119
|
-
keyboardKey: isClicked(insertType) ? undefined : insertType,
|
|
120
|
-
source: mention.source,
|
|
121
|
-
queryLength: queryLength,
|
|
122
|
-
spaceInQuery: spaceInQuery,
|
|
123
|
-
isSpecial: (0, _resource.isSpecialMention)(mention),
|
|
124
|
-
accessLevel: mention.accessLevel || '',
|
|
125
|
-
userType: mention.userType,
|
|
126
|
-
userId: mention.id,
|
|
127
|
-
upKeyCount: upKeyCount,
|
|
128
|
-
downKeyCount: downKeyCount,
|
|
129
|
-
memberCount: (0, _utils.isTeamType)(mention.userType) && mention.context ? mention.context.memberCount : null,
|
|
130
|
-
includesYou: (0, _utils.isTeamType)(mention.userType) && mention.context ? mention.context.includesYou : null
|
|
131
|
-
});
|
|
132
|
-
if (contextIdentifierProvider) {
|
|
133
|
-
analyticsPayload.containerId = contextIdentifierProvider.containerId || undefined;
|
|
134
|
-
analyticsPayload.objectId = contextIdentifierProvider.objectId || undefined;
|
|
135
|
-
analyticsPayload.childObjectId = contextIdentifierProvider.childObjectId || undefined;
|
|
136
|
-
}
|
|
137
|
-
return analyticsPayload;
|
|
138
|
-
};
|
|
139
|
-
var buildTypeAheadRenderedPayload = exports.buildTypeAheadRenderedPayload = function buildTypeAheadRenderedPayload(duration, userIds, query, teams) {
|
|
140
|
-
var _extractAttributesFro4 = extractAttributesFromQuery(query),
|
|
141
|
-
queryLength = _extractAttributesFro4.queryLength,
|
|
142
|
-
spaceInQuery = _extractAttributesFro4.spaceInQuery;
|
|
143
|
-
var actionSubject = userIds ? 'mentionTypeahead' : 'teamMentionTypeahead';
|
|
144
|
-
return {
|
|
145
|
-
action: 'rendered',
|
|
146
|
-
actionSubject: actionSubject,
|
|
147
|
-
eventType: _analyticsGasTypes.OPERATIONAL_EVENT_TYPE,
|
|
148
|
-
attributes: {
|
|
149
|
-
componentName: componentName,
|
|
150
|
-
duration: duration,
|
|
151
|
-
userIds: userIds,
|
|
152
|
-
teams: teams,
|
|
153
|
-
queryLength: queryLength,
|
|
154
|
-
spaceInQuery: spaceInQuery
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
};
|