@atlaskit/link-create 0.2.1 → 0.3.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.
- package/CHANGELOG.md +12 -0
- package/analytics.spec.yaml +85 -0
- package/dist/cjs/common/constants.js +10 -0
- package/dist/cjs/common/utils/analytics/analytics.codegen.js +27 -0
- package/dist/cjs/common/utils/analytics/context.js +103 -0
- package/dist/cjs/common/utils/analytics/index.js +18 -0
- package/dist/cjs/controllers/callback-context/main.js +17 -3
- package/dist/cjs/ui/create-form/main.js +29 -14
- package/dist/cjs/ui/create-form/styled.js +13 -0
- package/dist/cjs/ui/error-boundary/error-boundary-base/index.js +56 -0
- package/dist/cjs/ui/error-boundary/error-boundary-ui/error-svg/index.js +62 -0
- package/dist/cjs/ui/error-boundary/error-boundary-ui/error-svg/styled.js +13 -0
- package/dist/cjs/ui/error-boundary/error-boundary-ui/index.js +41 -0
- package/dist/cjs/ui/error-boundary/error-boundary-ui/messages.js +20 -0
- package/dist/cjs/ui/error-boundary/index.js +38 -0
- package/dist/cjs/ui/main.js +58 -14
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/constants.js +2 -0
- package/dist/es2019/common/utils/analytics/analytics.codegen.js +20 -0
- package/dist/es2019/common/utils/analytics/context.js +86 -0
- package/dist/es2019/common/utils/analytics/index.js +1 -0
- package/dist/es2019/controllers/callback-context/main.js +18 -2
- package/dist/es2019/ui/create-form/main.js +26 -9
- package/dist/es2019/ui/create-form/styled.js +7 -0
- package/dist/es2019/ui/error-boundary/error-boundary-base/index.js +32 -0
- package/dist/es2019/ui/error-boundary/error-boundary-ui/error-svg/index.js +52 -0
- package/dist/es2019/ui/error-boundary/error-boundary-ui/error-svg/styled.js +7 -0
- package/dist/es2019/ui/error-boundary/error-boundary-ui/index.js +28 -0
- package/dist/es2019/ui/error-boundary/error-boundary-ui/messages.js +13 -0
- package/dist/es2019/ui/error-boundary/index.js +29 -0
- package/dist/es2019/ui/main.js +57 -13
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/constants.js +2 -0
- package/dist/esm/common/utils/analytics/analytics.codegen.js +20 -0
- package/dist/esm/common/utils/analytics/context.js +91 -0
- package/dist/esm/common/utils/analytics/index.js +1 -0
- package/dist/esm/controllers/callback-context/main.js +16 -3
- package/dist/esm/ui/create-form/main.js +29 -13
- package/dist/esm/ui/create-form/styled.js +5 -0
- package/dist/esm/ui/error-boundary/error-boundary-base/index.js +45 -0
- package/dist/esm/ui/error-boundary/error-boundary-ui/error-svg/index.js +54 -0
- package/dist/esm/ui/error-boundary/error-boundary-ui/error-svg/styled.js +5 -0
- package/dist/esm/ui/error-boundary/error-boundary-ui/index.js +32 -0
- package/dist/esm/ui/error-boundary/error-boundary-ui/messages.js +13 -0
- package/dist/esm/ui/error-boundary/index.js +27 -0
- package/dist/esm/ui/main.js +53 -12
- package/dist/esm/version.json +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/types.d.ts +80 -0
- package/dist/types/common/utils/analytics/analytics.codegen.d.ts +48 -0
- package/dist/types/common/utils/analytics/context.d.ts +29 -0
- package/dist/types/common/utils/analytics/index.d.ts +1 -0
- package/dist/types/controllers/callback-context/main.d.ts +5 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/ui/create-form/main.d.ts +3 -1
- package/dist/types/ui/create-form/styled.d.ts +1 -0
- package/dist/types/ui/error-boundary/error-boundary-base/index.d.ts +18 -0
- package/dist/types/ui/error-boundary/error-boundary-ui/error-svg/index.d.ts +4 -0
- package/dist/types/ui/error-boundary/error-boundary-ui/error-svg/styled.d.ts +1 -0
- package/dist/types/ui/error-boundary/error-boundary-ui/index.d.ts +3 -0
- package/dist/types/ui/error-boundary/error-boundary-ui/messages.d.ts +13 -0
- package/dist/types/ui/error-boundary/index.d.ts +2 -0
- package/dist/types/ui/group-selection/types.d.ts +1 -14
- package/dist/types/ui/main.d.ts +6 -3
- package/dist/types/ui/types.d.ts +0 -61
- package/package.json +12 -5
- package/report.api.md +16 -15
- package/tmp/api-report-tmp.d.ts +14 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/link-create
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9e1c1e92771`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9e1c1e92771) - Fire analytics
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`29dfee4c540`](https://bitbucket.org/atlassian/atlassian-frontend/commits/29dfee4c540) - Adds global error boundary and fixes footer padding
|
|
14
|
+
|
|
3
15
|
## 0.2.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
common:
|
|
2
|
+
source: linkCreate
|
|
3
|
+
product: linkingPlatform
|
|
4
|
+
|
|
5
|
+
context:
|
|
6
|
+
PackageMetaData: &PackageMetaDataContext
|
|
7
|
+
packageName:
|
|
8
|
+
type: ['@atlaskit/link-create']
|
|
9
|
+
description: name of the package the event was fired from
|
|
10
|
+
packageVersion:
|
|
11
|
+
type: string
|
|
12
|
+
description: version of the package the event was fired from
|
|
13
|
+
source:
|
|
14
|
+
type: ['linkCreate']
|
|
15
|
+
description: the name of the ui source the event originated from (linkCreate)
|
|
16
|
+
componentName:
|
|
17
|
+
type: ['linkCreate']
|
|
18
|
+
description: the name of the component the event originated from (linkCreate)
|
|
19
|
+
LinkCreateAnalyticsContext: &LinkCreateAnalyticContext
|
|
20
|
+
triggeredFrom:
|
|
21
|
+
type: string
|
|
22
|
+
description: where the link create form was triggered from
|
|
23
|
+
objectName:
|
|
24
|
+
type: string
|
|
25
|
+
description: the object that the creation form is for
|
|
26
|
+
appearance:
|
|
27
|
+
type: ['modal', 'popup']
|
|
28
|
+
description: how the link create form was presented
|
|
29
|
+
|
|
30
|
+
events:
|
|
31
|
+
- linkCreateScreen viewed:
|
|
32
|
+
type: screen
|
|
33
|
+
description: fired when the link create is successfully submitted
|
|
34
|
+
attributes:
|
|
35
|
+
<<: *PackageMetaDataContext
|
|
36
|
+
<<: *LinkCreateAnalyticContext
|
|
37
|
+
|
|
38
|
+
- button clicked (create):
|
|
39
|
+
type: ui
|
|
40
|
+
description: fired when the create button is clicked
|
|
41
|
+
attributes:
|
|
42
|
+
<<: *PackageMetaDataContext
|
|
43
|
+
<<: *LinkCreateAnalyticContext
|
|
44
|
+
|
|
45
|
+
- button clicked (cancel):
|
|
46
|
+
type: ui
|
|
47
|
+
description: fired when the create button is clicked
|
|
48
|
+
attributes:
|
|
49
|
+
<<: *PackageMetaDataContext
|
|
50
|
+
<<: *LinkCreateAnalyticContext
|
|
51
|
+
|
|
52
|
+
- linkCreateScreen closed:
|
|
53
|
+
type: screen
|
|
54
|
+
description: fired when the link create component is unmounted/dismissed for any reason
|
|
55
|
+
attributes:
|
|
56
|
+
<<: *PackageMetaDataContext
|
|
57
|
+
<<: *LinkCreateAnalyticContext
|
|
58
|
+
|
|
59
|
+
- linkCreate unhandledErrorCaught:
|
|
60
|
+
type: operational
|
|
61
|
+
description: fired when the link create root error boundary catches an error
|
|
62
|
+
attributes:
|
|
63
|
+
<<: *PackageMetaDataContext
|
|
64
|
+
browserInfo:
|
|
65
|
+
type: string
|
|
66
|
+
description: the window navigator userAgent if it exists, else unknown
|
|
67
|
+
error:
|
|
68
|
+
type: string
|
|
69
|
+
description: the error that was caught by the error boundary
|
|
70
|
+
componentStack:
|
|
71
|
+
type: string
|
|
72
|
+
description: componentStack from componentDidCatch info
|
|
73
|
+
required: false
|
|
74
|
+
|
|
75
|
+
- object created (linkCreate):
|
|
76
|
+
type: track
|
|
77
|
+
description: fired when the object was successfully created
|
|
78
|
+
attributes:
|
|
79
|
+
<<: *PackageMetaDataContext
|
|
80
|
+
objectId:
|
|
81
|
+
type: string
|
|
82
|
+
description: the id of created content
|
|
83
|
+
objectType:
|
|
84
|
+
type: string
|
|
85
|
+
description: the type of created content
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.COMPONENT_NAME = exports.ANALYTICS_CHANNEL = void 0;
|
|
7
|
+
var ANALYTICS_CHANNEL = 'media';
|
|
8
|
+
exports.ANALYTICS_CHANNEL = ANALYTICS_CHANNEL;
|
|
9
|
+
var COMPONENT_NAME = 'linkCreate';
|
|
10
|
+
exports.COMPONENT_NAME = COMPONENT_NAME;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
9
|
+
*
|
|
10
|
+
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
11
|
+
*
|
|
12
|
+
* @codegen <<SignedSource::6d7803f5c035dc3cde1be03caa91eb04>>
|
|
13
|
+
* @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
function createEventPayload(eventKey, attributes) {
|
|
17
|
+
var event = eventKey.split('.');
|
|
18
|
+
return {
|
|
19
|
+
eventType: event[0],
|
|
20
|
+
actionSubject: event[1],
|
|
21
|
+
action: event[2],
|
|
22
|
+
actionSubjectId: event[3],
|
|
23
|
+
attributes: attributes
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
var _default = createEventPayload;
|
|
27
|
+
exports.default = _default;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useLinkCreateAnalytics = void 0;
|
|
9
|
+
exports.withLinkCreateAnalyticsContext = withLinkCreateAnalyticsContext;
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
14
|
+
var _constants = require("../../constants");
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
var UNKNOWN = 'unknown';
|
|
20
|
+
var DEFAULT_CONTEXT_ATTRIBUTES = {
|
|
21
|
+
triggeredFrom: UNKNOWN,
|
|
22
|
+
objectName: UNKNOWN,
|
|
23
|
+
appearance: 'modal'
|
|
24
|
+
};
|
|
25
|
+
var LinkCreateAnalyticsContext = /*#__PURE__*/_react.default.createContext({
|
|
26
|
+
trackAttribute: function trackAttribute() {},
|
|
27
|
+
trackAttributes: function trackAttributes() {},
|
|
28
|
+
getAttributes: function getAttributes() {
|
|
29
|
+
return DEFAULT_CONTEXT_ATTRIBUTES;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var LinkCreateAnalytics = function LinkCreateAnalytics(_ref) {
|
|
33
|
+
var initialContext = _ref.initialContext,
|
|
34
|
+
children = _ref.children;
|
|
35
|
+
var dataRef = (0, _react.useRef)(_objectSpread(_objectSpread({}, DEFAULT_CONTEXT_ATTRIBUTES), initialContext));
|
|
36
|
+
var methods = (0, _react.useMemo)(function () {
|
|
37
|
+
return {
|
|
38
|
+
trackAttribute: function trackAttribute(key, value) {
|
|
39
|
+
dataRef.current[key] = value;
|
|
40
|
+
},
|
|
41
|
+
trackAttributes: function trackAttributes(attributes) {
|
|
42
|
+
dataRef.current = _objectSpread(_objectSpread({}, dataRef.current), attributes);
|
|
43
|
+
},
|
|
44
|
+
getAttributes: function getAttributes() {
|
|
45
|
+
return dataRef.current;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(LinkCreateAnalyticsContext.Provider, {
|
|
50
|
+
value: methods
|
|
51
|
+
}, children);
|
|
52
|
+
};
|
|
53
|
+
var contextAttributesFromInitialProps = function contextAttributesFromInitialProps(props) {
|
|
54
|
+
return {
|
|
55
|
+
objectName: props.entityKey,
|
|
56
|
+
triggeredFrom: props.triggeredFrom
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Hook that exposes the context-level attribute getters and setters.
|
|
62
|
+
*/
|
|
63
|
+
var useLinkCreateAnalytics = function useLinkCreateAnalytics() {
|
|
64
|
+
return (0, _react.useContext)(LinkCreateAnalyticsContext);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Wrap component in "attributes" context store and initialise the initial context attributes from props.
|
|
69
|
+
*/
|
|
70
|
+
exports.useLinkCreateAnalytics = useLinkCreateAnalytics;
|
|
71
|
+
function withLinkCreateAnalytics(WrappedComponent) {
|
|
72
|
+
return function (props) {
|
|
73
|
+
var _useState = (0, _react.useState)(function () {
|
|
74
|
+
return contextAttributesFromInitialProps(props);
|
|
75
|
+
}),
|
|
76
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 1),
|
|
77
|
+
initialContext = _useState2[0];
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(LinkCreateAnalytics, {
|
|
79
|
+
initialContext: initialContext
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, props));
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Wraps a component with the analytics context + listener to update events with contextual-level attributes.
|
|
86
|
+
* Should be implemented once at the root of the link create.
|
|
87
|
+
*/
|
|
88
|
+
function withLinkCreateAnalyticsContext(WrappedComponent) {
|
|
89
|
+
return withLinkCreateAnalytics(function (props) {
|
|
90
|
+
var _useLinkCreateAnalyti = useLinkCreateAnalytics(),
|
|
91
|
+
getAttributes = _useLinkCreateAnalyti.getAttributes;
|
|
92
|
+
var onEvent = (0, _react.useCallback)(function (event) {
|
|
93
|
+
var _event$payload$attrib;
|
|
94
|
+
event.update({
|
|
95
|
+
attributes: _objectSpread(_objectSpread({}, getAttributes()), (_event$payload$attrib = event.payload.attributes) !== null && _event$payload$attrib !== void 0 ? _event$payload$attrib : {})
|
|
96
|
+
});
|
|
97
|
+
}, [getAttributes]);
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsListener, {
|
|
99
|
+
channel: _constants.ANALYTICS_CHANNEL,
|
|
100
|
+
onEvent: onEvent
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, props));
|
|
102
|
+
});
|
|
103
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "useLinkCreateAnalytics", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _context.useLinkCreateAnalytics;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "withLinkCreateAnalyticsContext", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _context.withLinkCreateAnalyticsContext;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _context = require("./context");
|
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.useLinkCreateCallback = exports.LinkCreateCallbackProvider = void 0;
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
11
|
+
var _constants = require("../../common/constants");
|
|
12
|
+
var _analytics = _interopRequireDefault(require("../../common/utils/analytics/analytics.codegen"));
|
|
9
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
15
|
var LinkCreateCallbackContext = /*#__PURE__*/_react.default.createContext({});
|
|
12
16
|
var LinkCreateCallbackProvider = function LinkCreateCallbackProvider(_ref) {
|
|
13
17
|
var children = _ref.children,
|
|
14
|
-
|
|
18
|
+
_onCreate = _ref.onCreate,
|
|
15
19
|
onFailure = _ref.onFailure,
|
|
16
20
|
onCancel = _ref.onCancel;
|
|
21
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
22
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
17
23
|
var value = (0, _react.useMemo)(function () {
|
|
18
24
|
return {
|
|
19
|
-
onCreate: onCreate
|
|
25
|
+
onCreate: function onCreate(result) {
|
|
26
|
+
var objectId = result.objectId,
|
|
27
|
+
objectType = result.objectType;
|
|
28
|
+
createAnalyticsEvent((0, _analytics.default)('track.object.created.linkCreate', {
|
|
29
|
+
objectId: objectId,
|
|
30
|
+
objectType: objectType
|
|
31
|
+
})).fire(_constants.ANALYTICS_CHANNEL);
|
|
32
|
+
_onCreate && _onCreate(result);
|
|
33
|
+
},
|
|
20
34
|
onFailure: onFailure,
|
|
21
35
|
onCancel: onCancel
|
|
22
36
|
};
|
|
23
|
-
}, [
|
|
37
|
+
}, [onFailure, onCancel, createAnalyticsEvent, _onCreate]);
|
|
24
38
|
return /*#__PURE__*/_react.default.createElement(LinkCreateCallbackContext.Provider, {
|
|
25
39
|
value: value
|
|
26
40
|
}, children);
|
|
@@ -8,18 +8,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.CreateForm = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _react =
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
12
14
|
var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
|
|
13
15
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
14
16
|
var _form = _interopRequireWildcard(require("@atlaskit/form"));
|
|
17
|
+
var _constants = require("../../common/constants");
|
|
18
|
+
var _analytics = _interopRequireDefault(require("../../common/utils/analytics/analytics.codegen"));
|
|
15
19
|
var _formContext = require("../../controllers/form-context");
|
|
20
|
+
var _styled = require("./styled");
|
|
16
21
|
var _utils = require("./utils");
|
|
17
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
24
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } /** @jsx jsx */
|
|
20
25
|
var withFormContext = function withFormContext(Component) {
|
|
21
26
|
return function (props) {
|
|
22
|
-
return
|
|
27
|
+
return (0, _react2.jsx)(_formContext.FormContextProvider, null, (0, _react2.jsx)(Component, props));
|
|
23
28
|
};
|
|
24
29
|
};
|
|
25
30
|
var CreateFormWithoutContext = function CreateFormWithoutContext(_ref) {
|
|
@@ -27,51 +32,61 @@ var CreateFormWithoutContext = function CreateFormWithoutContext(_ref) {
|
|
|
27
32
|
testId = _ref.testId,
|
|
28
33
|
onCancel = _ref.onCancel,
|
|
29
34
|
onSubmit = _ref.onSubmit;
|
|
35
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
36
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
30
37
|
var _useFormContext = (0, _formContext.useFormContext)(),
|
|
31
38
|
getValidators = _useFormContext.getValidators;
|
|
32
|
-
var handleSubmit = /*#__PURE__*/function () {
|
|
39
|
+
var handleSubmit = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
33
40
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
34
41
|
var validators, errors;
|
|
35
42
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
36
43
|
while (1) {
|
|
37
44
|
switch (_context.prev = _context.next) {
|
|
38
45
|
case 0:
|
|
46
|
+
createAnalyticsEvent((0, _analytics.default)('ui.button.clicked.create', {})).fire(_constants.ANALYTICS_CHANNEL);
|
|
39
47
|
validators = getValidators();
|
|
40
48
|
errors = (0, _utils.validateFormData)({
|
|
41
49
|
data: data,
|
|
42
50
|
validators: validators
|
|
43
51
|
});
|
|
44
52
|
if (!(Object.keys(errors).length !== 0)) {
|
|
45
|
-
_context.next =
|
|
53
|
+
_context.next = 5;
|
|
46
54
|
break;
|
|
47
55
|
}
|
|
48
56
|
return _context.abrupt("return", errors);
|
|
49
|
-
case 4:
|
|
50
|
-
onSubmit(data);
|
|
51
57
|
case 5:
|
|
58
|
+
onSubmit(data);
|
|
59
|
+
case 6:
|
|
52
60
|
case "end":
|
|
53
61
|
return _context.stop();
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
}, _callee);
|
|
57
65
|
}));
|
|
58
|
-
return function
|
|
66
|
+
return function (_x) {
|
|
59
67
|
return _ref2.apply(this, arguments);
|
|
60
68
|
};
|
|
61
|
-
}();
|
|
62
|
-
|
|
69
|
+
}(), [createAnalyticsEvent, getValidators, onSubmit]);
|
|
70
|
+
var handleCancel = (0, _react.useCallback)(function () {
|
|
71
|
+
createAnalyticsEvent((0, _analytics.default)('ui.button.clicked.cancel', {})).fire(_constants.ANALYTICS_CHANNEL);
|
|
72
|
+
onCancel && onCancel();
|
|
73
|
+
}, [createAnalyticsEvent, onCancel]);
|
|
74
|
+
return (0, _react2.jsx)(_form.default, {
|
|
63
75
|
onSubmit: handleSubmit
|
|
64
76
|
}, function (_ref3) {
|
|
65
77
|
var submitting = _ref3.submitting,
|
|
66
78
|
formProps = _ref3.formProps;
|
|
67
|
-
return
|
|
79
|
+
return (0, _react2.jsx)("form", (0, _extends2.default)({}, formProps, {
|
|
68
80
|
name: "confluence-creation-form",
|
|
69
81
|
"data-testid": testId
|
|
70
|
-
|
|
82
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
83
|
+
,
|
|
84
|
+
css: _styled.formStyles
|
|
85
|
+
}), (0, _react2.jsx)(_form.FormSection, null, children), (0, _react2.jsx)(_form.FormFooter, null, (0, _react2.jsx)(_standardButton.default, {
|
|
71
86
|
appearance: "subtle",
|
|
72
|
-
onClick:
|
|
87
|
+
onClick: handleCancel,
|
|
73
88
|
testId: 'cancel-button'
|
|
74
|
-
}, "Cancel"),
|
|
89
|
+
}, "Cancel"), (0, _react2.jsx)(_loadingButton.default, {
|
|
75
90
|
appearance: "primary",
|
|
76
91
|
type: "submit",
|
|
77
92
|
isLoading: submitting,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.formStyles = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _templateObject;
|
|
11
|
+
var CREATE_FORM_MAX_WIDTH_IN_PX = '600';
|
|
12
|
+
var formStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 auto;\n max-width: ", "px;\n padding: 0 0 ", " 0;\n"])), CREATE_FORM_MAX_WIDTH_IN_PX, "var(--ds-space-300, 24px)");
|
|
13
|
+
exports.formStyles = formStyles;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.BaseErrorBoundary = void 0;
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
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 _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
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); }; }
|
|
18
|
+
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; } }
|
|
19
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
20
|
+
var BaseErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
21
|
+
(0, _inherits2.default)(BaseErrorBoundary, _Component);
|
|
22
|
+
var _super = _createSuper(BaseErrorBoundary);
|
|
23
|
+
function BaseErrorBoundary(props) {
|
|
24
|
+
var _this;
|
|
25
|
+
(0, _classCallCheck2.default)(this, BaseErrorBoundary);
|
|
26
|
+
_this = _super.call(this, props);
|
|
27
|
+
_this.state = {
|
|
28
|
+
hasError: false
|
|
29
|
+
};
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
(0, _createClass2.default)(BaseErrorBoundary, [{
|
|
33
|
+
key: "componentDidCatch",
|
|
34
|
+
value: function componentDidCatch(error, info) {
|
|
35
|
+
var onError = this.props.onError;
|
|
36
|
+
onError && onError(error, info);
|
|
37
|
+
this.setState({
|
|
38
|
+
hasError: true
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
key: "render",
|
|
43
|
+
value: function render() {
|
|
44
|
+
var _this$props = this.props,
|
|
45
|
+
children = _this$props.children,
|
|
46
|
+
ErrorComponent = _this$props.ErrorComponent;
|
|
47
|
+
var hasError = this.state.hasError;
|
|
48
|
+
if (hasError && ErrorComponent) {
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(ErrorComponent, null);
|
|
50
|
+
}
|
|
51
|
+
return children;
|
|
52
|
+
}
|
|
53
|
+
}]);
|
|
54
|
+
return BaseErrorBoundary;
|
|
55
|
+
}(_react.Component);
|
|
56
|
+
exports.BaseErrorBoundary = BaseErrorBoundary;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _styled = require("./styled");
|
|
9
|
+
/** @jsx jsx */
|
|
10
|
+
|
|
11
|
+
var ErrorSVG = function ErrorSVG() {
|
|
12
|
+
return (0, _react.jsx)("svg", {
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
viewBox: "0 0 82 110"
|
|
15
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
16
|
+
,
|
|
17
|
+
css: _styled.errorStyles
|
|
18
|
+
}, (0, _react.jsx)("defs", null, (0, _react.jsx)("linearGradient", {
|
|
19
|
+
id: "a",
|
|
20
|
+
x1: "81.992%",
|
|
21
|
+
x2: "-1.724%",
|
|
22
|
+
y1: "43.911%",
|
|
23
|
+
y2: "87.726%"
|
|
24
|
+
}, (0, _react.jsx)("stop", {
|
|
25
|
+
offset: "0%",
|
|
26
|
+
stopColor: "#FFD740"
|
|
27
|
+
}), (0, _react.jsx)("stop", {
|
|
28
|
+
offset: "100%",
|
|
29
|
+
stopColor: "#FFAB00"
|
|
30
|
+
}))), (0, _react.jsx)("g", {
|
|
31
|
+
fill: "none",
|
|
32
|
+
fillRule: "evenodd"
|
|
33
|
+
}, (0, _react.jsx)("path", {
|
|
34
|
+
fill: "url(#a)",
|
|
35
|
+
fillRule: "nonzero",
|
|
36
|
+
d: "M47.39 40.58l33.22 57.54a7.585 7.585 0 0 1-6.57 11.38H7.6a7.585 7.585 0 0 1-6.57-11.38l33.22-57.54a7.585 7.585 0 0 1 13.14 0z"
|
|
37
|
+
}), (0, _react.jsx)("path", {
|
|
38
|
+
fill: "#253858",
|
|
39
|
+
fillRule: "nonzero",
|
|
40
|
+
d: "M43.61 82.355l1.44-22.175a4.59 4.59 0 0 0-4.58-4.89 4.59 4.59 0 0 0-4.58 4.89l1.44 22.175a3.15 3.15 0 0 0 3.14 2.945 3.15 3.15 0 0 0 3.14-2.945zM35.69 94.125a4.765 4.765 0 0 0 5.195 4.79 4.84 4.84 0 0 0-.45-9.66 4.82 4.82 0 0 0-4.745 4.87z"
|
|
41
|
+
}), (0, _react.jsx)("path", {
|
|
42
|
+
fill: "#FFC400",
|
|
43
|
+
fillRule: "nonzero",
|
|
44
|
+
d: "M45.85 14.085L42.145.725a.305.305 0 0 0-.595.025L39.22 13.3l-2.9-.54a.305.305 0 0 0-.35.38l3.705 13.36a.305.305 0 0 0 .595 0l2.33-12.55 2.9.515a.305.305 0 0 0 .35-.38z"
|
|
45
|
+
}), (0, _react.jsx)("path", {
|
|
46
|
+
fill: "#FFAB00",
|
|
47
|
+
fillRule: "nonzero",
|
|
48
|
+
d: "M32.56 21.405l-5.44-4.275a.135.135 0 0 0-.205.165L29.68 23l-1.33.655a.135.135 0 0 0 0 .225l5.435 4.275a.135.135 0 0 0 .205-.165l-2.785-5.715 1.33-.645a.135.135 0 0 0 .025-.225z"
|
|
49
|
+
}), (0, _react.jsx)("path", {
|
|
50
|
+
stroke: "#344563",
|
|
51
|
+
strokeLinecap: "round",
|
|
52
|
+
strokeWidth: "2",
|
|
53
|
+
d: "M57.575 18.8c-.585.795-5.5-2.8-6.08-2-.58.8 4.33 4.395 3.75 5.195-.58.8-5.5-2.8-6.085-2-.585.8 4.33 4.395 3.745 5.195-.585.8-5.5-2.8-6.085-2-.585.8 4.33 4.395 3.745 5.195"
|
|
54
|
+
}), (0, _react.jsx)("path", {
|
|
55
|
+
stroke: "#5E6C84",
|
|
56
|
+
strokeLinecap: "round",
|
|
57
|
+
strokeWidth: "2",
|
|
58
|
+
d: "M59.96 32.595c-.73.665-3.525-2.39-4.255-1.72-.73.67 2.065 3.725 1.335 4.39-.73.665-3.525-2.39-4.255-1.72-.34.31.08 1.135.555 2M22.4 32.5c.91.385 2.5-3.435 3.43-3.05.93.385-.695 4.2.215 4.585.91.385 2.5-3.435 3.43-3.05.425.18.305 1.095.145 2.065"
|
|
59
|
+
})));
|
|
60
|
+
};
|
|
61
|
+
var _default = ErrorSVG;
|
|
62
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.errorStyles = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _templateObject;
|
|
11
|
+
var WIDTH = 82;
|
|
12
|
+
var errorStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: ", "px;\n margin: 0 auto ", ";\n display: block;\n"])), WIDTH, "var(--ds-space-300, 24px)");
|
|
13
|
+
exports.errorStyles = errorStyles;
|