@atlaskit/analytics-next 11.1.3 → 11.1.4
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 +7 -20
- package/afm-cc/tsconfig.json +3 -2
- package/afm-jira/tsconfig.json +4 -3
- package/{afm-adminhub → afm-products}/tsconfig.json +5 -4
- package/dist/cjs/components/AnalyticsContext/LegacyAnalyticsContext.js +71 -0
- package/dist/cjs/components/AnalyticsContext/index.js +9 -1
- package/dist/cjs/components/AnalyticsErrorBoundary.js +16 -2
- package/dist/cjs/components/AnalyticsListener/LegacyAnalyticsListener.js +79 -0
- package/dist/cjs/components/AnalyticsListener/index.js +9 -1
- package/dist/cjs/utils/isModernContextEnabledEnv.js +9 -0
- package/dist/es2019/components/AnalyticsContext/LegacyAnalyticsContext.js +49 -0
- package/dist/es2019/components/AnalyticsContext/index.js +9 -1
- package/dist/es2019/components/AnalyticsErrorBoundary.js +16 -2
- package/dist/es2019/components/AnalyticsListener/LegacyAnalyticsListener.js +56 -0
- package/dist/es2019/components/AnalyticsListener/index.js +9 -1
- package/dist/es2019/utils/isModernContextEnabledEnv.js +3 -0
- package/dist/esm/components/AnalyticsContext/LegacyAnalyticsContext.js +62 -0
- package/dist/esm/components/AnalyticsContext/index.js +9 -1
- package/dist/esm/components/AnalyticsErrorBoundary.js +16 -2
- package/dist/esm/components/AnalyticsListener/LegacyAnalyticsListener.js +70 -0
- package/dist/esm/components/AnalyticsListener/index.js +9 -1
- package/dist/esm/utils/isModernContextEnabledEnv.js +3 -0
- package/dist/types/components/AnalyticsContext/LegacyAnalyticsContext.d.ts +30 -0
- package/dist/types/components/AnalyticsContext/index.d.ts +3 -2
- package/dist/types/components/AnalyticsListener/LegacyAnalyticsListener.d.ts +34 -0
- package/dist/types/components/AnalyticsListener/index.d.ts +3 -2
- package/dist/types/utils/createAndFireEvent.d.ts +2 -1
- package/dist/types/utils/isModernContextEnabledEnv.d.ts +2 -0
- package/dist/types-ts4.5/components/AnalyticsContext/LegacyAnalyticsContext.d.ts +30 -0
- package/dist/types-ts4.5/components/AnalyticsContext/index.d.ts +3 -2
- package/dist/types-ts4.5/components/AnalyticsListener/LegacyAnalyticsListener.d.ts +34 -0
- package/dist/types-ts4.5/components/AnalyticsListener/index.d.ts +3 -2
- package/dist/types-ts4.5/utils/createAndFireEvent.d.ts +2 -1
- package/dist/types-ts4.5/utils/isModernContextEnabledEnv.d.ts +2 -0
- package/docs/0-intro.tsx +2 -1
- package/docs/10-concepts.tsx +2 -1
- package/docs/20-usage-with-presentational-components.tsx +2 -1
- package/docs/30-usage-for-container-components.tsx +2 -1
- package/docs/40-listeners.tsx +2 -1
- package/docs/50-error-boundary.tsx +2 -1
- package/docs/60-events.tsx +2 -1
- package/docs/70-advanced-usage.tsx +2 -1
- package/docs/80-upgrade-guide.tsx +2 -1
- package/package.json +9 -5
- package/afm-dev-agents/tsconfig.json +0 -32
- package/afm-passionfruit/tsconfig.json +0 -32
- package/afm-post-office/tsconfig.json +0 -32
- package/afm-rovo-extension/tsconfig.json +0 -32
- package/afm-townsquare/tsconfig.json +0 -32
- package/afm-volt/tsconfig.json +0 -32
- package/build/tsconfig.json +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/analytics-next
|
|
2
2
|
|
|
3
|
+
## 11.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0ca7d810bc817`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0ca7d810bc817) -
|
|
8
|
+
Re-implement legacy analytics context and listener behind a feature gate
|
|
9
|
+
|
|
3
10
|
## 11.1.3
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -394,11 +401,9 @@
|
|
|
394
401
|
- [#4749](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/4749)
|
|
395
402
|
[`0e2a914932`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0e2a914932) - ###
|
|
396
403
|
Additions
|
|
397
|
-
|
|
398
404
|
- Added a new hook `useAnalyticsEventHandler` for sole use in Atlaskit components
|
|
399
405
|
|
|
400
406
|
### Removals
|
|
401
|
-
|
|
402
407
|
- Removed some entry points that were unintentionally exposed
|
|
403
408
|
- `AnalyticsContextConsumer`
|
|
404
409
|
- `withAnalyticsHook`
|
|
@@ -408,7 +413,6 @@
|
|
|
408
413
|
- `AnalyticsEventMap`
|
|
409
414
|
|
|
410
415
|
### Improvements
|
|
411
|
-
|
|
412
416
|
- Optimization of components to prevent unnecessary re-renders via inline callbacks or jsons
|
|
413
417
|
- Conversion to Function Components where possible
|
|
414
418
|
- Preparation for dropping legacy React context in a future major release (see note below)
|
|
@@ -515,7 +519,6 @@
|
|
|
515
519
|
|
|
516
520
|
Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies
|
|
517
521
|
[6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
|
|
518
|
-
|
|
519
522
|
- @atlaskit/docs@8.3.2
|
|
520
523
|
- @atlaskit/button@13.3.7
|
|
521
524
|
- @atlaskit/textfield@3.1.6
|
|
@@ -540,7 +543,6 @@
|
|
|
540
543
|
|
|
541
544
|
Fixes data type to Object- Updated dependencies
|
|
542
545
|
[24865cfaff](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/24865cfaff):
|
|
543
|
-
|
|
544
546
|
- @atlaskit/field-text@9.0.14
|
|
545
547
|
|
|
546
548
|
## 6.3.2
|
|
@@ -574,7 +576,6 @@
|
|
|
574
576
|
### Minor Changes
|
|
575
577
|
|
|
576
578
|
- [minor][42fd897e16](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/42fd897e16):
|
|
577
|
-
|
|
578
579
|
- Introduces a new custom React hook, `useAnalyticsEvents_experimental`, for creating analytics
|
|
579
580
|
events within functional components. This hook replaces the need for the `withAnalyticsEvents`
|
|
580
581
|
HOC. See the
|
|
@@ -627,12 +628,10 @@
|
|
|
627
628
|
safety. Flow types are no longer provided. No behavioural changes.
|
|
628
629
|
|
|
629
630
|
**Breaking changes**
|
|
630
|
-
|
|
631
631
|
- `withAnalyticsForSumTypeProps` alias has been removed, please use `withAnalyticsEvents`
|
|
632
632
|
- `AnalyticsContextWrappedComp` alias has been removed, please use `withAnalyticsContext`
|
|
633
633
|
|
|
634
634
|
**Breaking changes to TypeScript annotations**
|
|
635
|
-
|
|
636
635
|
- `withAnalyticsEvents` now infers proptypes automatically, consumers no longer need to provide
|
|
637
636
|
props as a generic type.
|
|
638
637
|
- `withAnalyticsContext` now infers proptypes automatically, consumers no longer need to provide
|
|
@@ -663,7 +662,6 @@
|
|
|
663
662
|
### Minor Changes
|
|
664
663
|
|
|
665
664
|
- [minor][e1f8aaf33b](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/e1f8aaf33b):
|
|
666
|
-
|
|
667
665
|
- Adding entry point for `AnalyticsErrorBoundary` package
|
|
668
666
|
|
|
669
667
|
```
|
|
@@ -700,7 +698,6 @@
|
|
|
700
698
|
```
|
|
701
699
|
|
|
702
700
|
Notes on new API:
|
|
703
|
-
|
|
704
701
|
- Plug-and-play component. As soon and it's wrapping a component it's fully integrated.
|
|
705
702
|
- It has Analytics context and events integrated already. Keep in mind it requires
|
|
706
703
|
`AnalyticsListener` as a top level component to work properly, otherwise it won't trigger
|
|
@@ -790,27 +787,23 @@
|
|
|
790
787
|
### Patch Changes
|
|
791
788
|
|
|
792
789
|
- [patch][47acb57783](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/47acb57783):
|
|
793
|
-
|
|
794
790
|
- Avoid unnecessary re-renders on components that use withAnalytics
|
|
795
791
|
|
|
796
792
|
## 5.0.0
|
|
797
793
|
|
|
798
794
|
- [major][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
|
|
799
|
-
|
|
800
795
|
- Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use
|
|
801
796
|
this package, please ensure you use at least this version of react and react-dom.
|
|
802
797
|
|
|
803
798
|
## 4.0.5
|
|
804
799
|
|
|
805
800
|
- [patch][3f28e6443c](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/3f28e6443c):
|
|
806
|
-
|
|
807
801
|
- @atlaskit/analytics-next-types is deprecated. Now you can use types for @atlaskit/analytics-next
|
|
808
802
|
supplied from itself.
|
|
809
803
|
|
|
810
804
|
## 4.0.4
|
|
811
805
|
|
|
812
806
|
- [patch][9321da655d](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9321da655d):
|
|
813
|
-
|
|
814
807
|
- Update AnalyticsEventMap, as per major inline edit rewrite
|
|
815
808
|
|
|
816
809
|
## 4.0.3
|
|
@@ -824,7 +817,6 @@
|
|
|
824
817
|
## 4.0.2
|
|
825
818
|
|
|
826
819
|
- [patch][98e11001ff](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/98e11001ff):
|
|
827
|
-
|
|
828
820
|
- Removes duplicate babel-runtime dependency
|
|
829
821
|
|
|
830
822
|
## 4.0.1
|
|
@@ -838,7 +830,6 @@
|
|
|
838
830
|
## 4.0.0
|
|
839
831
|
|
|
840
832
|
- [major][76299208e6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/76299208e6):
|
|
841
|
-
|
|
842
833
|
- Drop ES5 from all the flow modules
|
|
843
834
|
|
|
844
835
|
### Dropping CJS support in all @atlaskit packages
|
|
@@ -883,13 +874,11 @@
|
|
|
883
874
|
## 3.2.1
|
|
884
875
|
|
|
885
876
|
- [patch][8de4c3f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/8de4c3f):
|
|
886
|
-
|
|
887
877
|
- Added missing export
|
|
888
878
|
|
|
889
879
|
## 3.2.0
|
|
890
880
|
|
|
891
881
|
- [minor][c3fa0b6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/c3fa0b6):
|
|
892
|
-
|
|
893
882
|
- Added support for props of Sum type
|
|
894
883
|
|
|
895
884
|
## 3.1.2
|
|
@@ -909,7 +898,6 @@
|
|
|
909
898
|
## 3.1.0
|
|
910
899
|
|
|
911
900
|
- [minor][cffeed0](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/cffeed0):
|
|
912
|
-
|
|
913
901
|
- Type `withAnalyticsEvents` and `withAnalyticsContext` HOCs so that they do not lose flow types
|
|
914
902
|
of the components they wrap when chained together.
|
|
915
903
|
|
|
@@ -925,7 +913,6 @@
|
|
|
925
913
|
## 3.0.11
|
|
926
914
|
|
|
927
915
|
- [patch][d903ab5](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/d903ab5):
|
|
928
|
-
|
|
929
916
|
- Updates list of instrumented components
|
|
930
917
|
|
|
931
918
|
## 3.0.10
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../../tsconfig.
|
|
2
|
+
"extends": "../../../../tsconfig.local-consumption.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
6
|
"outDir": "../../../../../confluence/tsDist/@atlaskit__analytics-next",
|
|
7
7
|
"rootDir": "../",
|
|
8
|
-
"composite": true
|
|
8
|
+
"composite": true,
|
|
9
|
+
"noCheck": true
|
|
9
10
|
},
|
|
10
11
|
"include": [
|
|
11
12
|
"../src/**/*.ts",
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../../tsconfig.
|
|
2
|
+
"extends": "../../../../tsconfig.local-consumption.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
|
-
"outDir": "../../../../../tsDist/@atlaskit__analytics-next/app",
|
|
6
|
+
"outDir": "../../../../../jira/tsDist/@atlaskit__analytics-next/app",
|
|
7
7
|
"rootDir": "../",
|
|
8
|
-
"composite": true
|
|
8
|
+
"composite": true,
|
|
9
|
+
"noCheck": true
|
|
9
10
|
},
|
|
10
11
|
"include": [
|
|
11
12
|
"../src/**/*.ts",
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../../tsconfig.
|
|
2
|
+
"extends": "../../../../tsconfig.local-consumption.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
|
-
"outDir": "../../../../../
|
|
6
|
+
"outDir": "../../../../../tsDist/@atlaskit__analytics-next/app",
|
|
7
7
|
"rootDir": "../",
|
|
8
|
-
"composite": true
|
|
8
|
+
"composite": true,
|
|
9
|
+
"noCheck": true
|
|
9
10
|
},
|
|
10
11
|
"include": [
|
|
11
12
|
"../src/**/*.ts",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
],
|
|
27
28
|
"references": [
|
|
28
29
|
{
|
|
29
|
-
"path": "../../../platform/feature-flags/afm-
|
|
30
|
+
"path": "../../../platform/feature-flags/afm-products/tsconfig.json"
|
|
30
31
|
}
|
|
31
32
|
]
|
|
32
33
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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.default = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
var _analyticsNextStableReactContext = _interopRequireDefault(require("@atlaskit/analytics-next-stable-react-context"));
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
var ContextTypes = {
|
|
23
|
+
getAtlaskitAnalyticsContext: _propTypes.default.func,
|
|
24
|
+
getAtlaskitAnalyticsEventHandlers: _propTypes.default.func
|
|
25
|
+
};
|
|
26
|
+
var noop = function noop() {
|
|
27
|
+
return [];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
31
|
+
var AnalyticsContext = /*#__PURE__*/function (_Component) {
|
|
32
|
+
function AnalyticsContext(props) {
|
|
33
|
+
var _this;
|
|
34
|
+
(0, _classCallCheck2.default)(this, AnalyticsContext);
|
|
35
|
+
_this = _callSuper(this, AnalyticsContext, [props]);
|
|
36
|
+
(0, _defineProperty2.default)(_this, "getChildContext", function () {
|
|
37
|
+
return {
|
|
38
|
+
getAtlaskitAnalyticsContext: _this.getAnalyticsContext
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
(0, _defineProperty2.default)(_this, "getAnalyticsContext", function () {
|
|
42
|
+
var data = _this.props.data;
|
|
43
|
+
var _this$context$getAtla = _this.context.getAtlaskitAnalyticsContext,
|
|
44
|
+
getAtlaskitAnalyticsContext = _this$context$getAtla === void 0 ? noop : _this$context$getAtla;
|
|
45
|
+
return [].concat((0, _toConsumableArray2.default)(getAtlaskitAnalyticsContext()), [data]);
|
|
46
|
+
});
|
|
47
|
+
(0, _defineProperty2.default)(_this, "getAnalyticsEventHandlers", function () {
|
|
48
|
+
var _this$context$getAtla2 = _this.context.getAtlaskitAnalyticsEventHandlers,
|
|
49
|
+
getAtlaskitAnalyticsEventHandlers = _this$context$getAtla2 === void 0 ? noop : _this$context$getAtla2;
|
|
50
|
+
return getAtlaskitAnalyticsEventHandlers();
|
|
51
|
+
});
|
|
52
|
+
_this.contextValue = {
|
|
53
|
+
getAtlaskitAnalyticsContext: _this.getAnalyticsContext,
|
|
54
|
+
getAtlaskitAnalyticsEventHandlers: _this.getAnalyticsEventHandlers
|
|
55
|
+
};
|
|
56
|
+
return _this;
|
|
57
|
+
}
|
|
58
|
+
(0, _inherits2.default)(AnalyticsContext, _Component);
|
|
59
|
+
return (0, _createClass2.default)(AnalyticsContext, [{
|
|
60
|
+
key: "render",
|
|
61
|
+
value: function render() {
|
|
62
|
+
var children = this.props.children;
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(_analyticsNextStableReactContext.default.Provider, {
|
|
64
|
+
value: this.contextValue
|
|
65
|
+
}, children);
|
|
66
|
+
}
|
|
67
|
+
}]);
|
|
68
|
+
}(_react.Component);
|
|
69
|
+
(0, _defineProperty2.default)(AnalyticsContext, "contextTypes", ContextTypes);
|
|
70
|
+
(0, _defineProperty2.default)(AnalyticsContext, "childContextTypes", ContextTypes);
|
|
71
|
+
var _default = exports.default = AnalyticsContext;
|
|
@@ -5,5 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
var _isModernContextEnabledEnv = _interopRequireDefault(require("../../utils/isModernContextEnabledEnv"));
|
|
11
|
+
var _LegacyAnalyticsContext = _interopRequireDefault(require("./LegacyAnalyticsContext"));
|
|
8
12
|
var _ModernAnalyticsContext = _interopRequireDefault(require("./ModernAnalyticsContext"));
|
|
9
|
-
var
|
|
13
|
+
var AnalyticsContext = function AnalyticsContext(props) {
|
|
14
|
+
var isModernContext = _isModernContextEnabledEnv.default || (0, _platformFeatureFlags.fg)('analytics-next-use-legacy-context') === false;
|
|
15
|
+
return isModernContext ? /*#__PURE__*/_react.default.createElement(_ModernAnalyticsContext.default, props) : /*#__PURE__*/_react.default.createElement(_LegacyAnalyticsContext.default, props);
|
|
16
|
+
};
|
|
17
|
+
var _default = exports.default = AnalyticsContext;
|
|
@@ -12,6 +12,9 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _isModernContextEnabledEnv = _interopRequireDefault(require("../utils/isModernContextEnabledEnv"));
|
|
17
|
+
var _LegacyAnalyticsContext = _interopRequireDefault(require("./AnalyticsContext/LegacyAnalyticsContext"));
|
|
15
18
|
var _ModernAnalyticsContext = _interopRequireDefault(require("./AnalyticsContext/ModernAnalyticsContext"));
|
|
16
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
20
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
@@ -49,15 +52,26 @@ var AnalyticsErrorBoundary = exports.default = /*#__PURE__*/function (_Component
|
|
|
49
52
|
children = _this$props.children,
|
|
50
53
|
ErrorComponent = _this$props.ErrorComponent;
|
|
51
54
|
var hasError = this.state.hasError;
|
|
55
|
+
var isModernContext = _isModernContextEnabledEnv.default || (0, _platformFeatureFlags.fg)('analytics-next-use-legacy-context') === false;
|
|
52
56
|
if (hasError) {
|
|
53
57
|
if (ErrorComponent) {
|
|
54
|
-
|
|
58
|
+
if (isModernContext) {
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_ModernAnalyticsContext.default, {
|
|
60
|
+
data: data
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(ErrorComponent, null));
|
|
62
|
+
}
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(_LegacyAnalyticsContext.default, {
|
|
55
64
|
data: data
|
|
56
65
|
}, /*#__PURE__*/_react.default.createElement(ErrorComponent, null));
|
|
57
66
|
}
|
|
58
67
|
return null;
|
|
59
68
|
}
|
|
60
|
-
|
|
69
|
+
if (isModernContext) {
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_ModernAnalyticsContext.default, {
|
|
71
|
+
data: data
|
|
72
|
+
}, children);
|
|
73
|
+
}
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(_LegacyAnalyticsContext.default, {
|
|
61
75
|
data: data
|
|
62
76
|
}, children);
|
|
63
77
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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.default = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
var _analyticsNextStableReactContext = _interopRequireDefault(require("@atlaskit/analytics-next-stable-react-context"));
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
var ContextTypes = {
|
|
23
|
+
getAtlaskitAnalyticsEventHandlers: _propTypes.default.func,
|
|
24
|
+
getAtlaskitAnalyticsContext: _propTypes.default.func
|
|
25
|
+
};
|
|
26
|
+
var noop = function noop() {
|
|
27
|
+
return [];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
31
|
+
var AnalyticsListener = /*#__PURE__*/function (_Component) {
|
|
32
|
+
function AnalyticsListener(props) {
|
|
33
|
+
var _this;
|
|
34
|
+
(0, _classCallCheck2.default)(this, AnalyticsListener);
|
|
35
|
+
_this = _callSuper(this, AnalyticsListener, [props]);
|
|
36
|
+
(0, _defineProperty2.default)(_this, "getChildContext", function () {
|
|
37
|
+
return {
|
|
38
|
+
getAtlaskitAnalyticsEventHandlers: _this.getAnalyticsEventHandlers,
|
|
39
|
+
getAtlaskitAnalyticsContext: _this.getAtlaskitAnalyticsContext
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
(0, _defineProperty2.default)(_this, "getAnalyticsEventHandlers", function () {
|
|
43
|
+
var _this$props = _this.props,
|
|
44
|
+
channel = _this$props.channel,
|
|
45
|
+
onEvent = _this$props.onEvent;
|
|
46
|
+
var _this$context$getAtla = _this.context.getAtlaskitAnalyticsEventHandlers,
|
|
47
|
+
getAtlaskitAnalyticsEventHandlers = _this$context$getAtla === void 0 ? noop : _this$context$getAtla;
|
|
48
|
+
var handler = function handler(event, eventChannel) {
|
|
49
|
+
if (channel === '*' || channel === eventChannel) {
|
|
50
|
+
onEvent(event, eventChannel);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return [handler].concat((0, _toConsumableArray2.default)(getAtlaskitAnalyticsEventHandlers()));
|
|
54
|
+
});
|
|
55
|
+
(0, _defineProperty2.default)(_this, "getAtlaskitAnalyticsContext", function () {
|
|
56
|
+
var _this$context$getAtla2 = _this.context.getAtlaskitAnalyticsContext,
|
|
57
|
+
getAtlaskitAnalyticsContext = _this$context$getAtla2 === void 0 ? noop : _this$context$getAtla2;
|
|
58
|
+
return getAtlaskitAnalyticsContext();
|
|
59
|
+
});
|
|
60
|
+
_this.contextValue = {
|
|
61
|
+
getAtlaskitAnalyticsContext: _this.getAtlaskitAnalyticsContext,
|
|
62
|
+
getAtlaskitAnalyticsEventHandlers: _this.getAnalyticsEventHandlers
|
|
63
|
+
};
|
|
64
|
+
return _this;
|
|
65
|
+
}
|
|
66
|
+
(0, _inherits2.default)(AnalyticsListener, _Component);
|
|
67
|
+
return (0, _createClass2.default)(AnalyticsListener, [{
|
|
68
|
+
key: "render",
|
|
69
|
+
value: function render() {
|
|
70
|
+
var children = this.props.children;
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_analyticsNextStableReactContext.default.Provider, {
|
|
72
|
+
value: this.contextValue
|
|
73
|
+
}, children);
|
|
74
|
+
}
|
|
75
|
+
}]);
|
|
76
|
+
}(_react.Component);
|
|
77
|
+
(0, _defineProperty2.default)(AnalyticsListener, "contextTypes", ContextTypes);
|
|
78
|
+
(0, _defineProperty2.default)(AnalyticsListener, "childContextTypes", ContextTypes);
|
|
79
|
+
var _default = exports.default = AnalyticsListener;
|
|
@@ -5,5 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
var _isModernContextEnabledEnv = _interopRequireDefault(require("../../utils/isModernContextEnabledEnv"));
|
|
11
|
+
var _LegacyAnalyticsListener = _interopRequireDefault(require("./LegacyAnalyticsListener"));
|
|
8
12
|
var _ModernAnalyticsListener = _interopRequireDefault(require("./ModernAnalyticsListener"));
|
|
9
|
-
var
|
|
13
|
+
var AnalyticsListener = function AnalyticsListener(props) {
|
|
14
|
+
var isModernContext = _isModernContextEnabledEnv.default || (0, _platformFeatureFlags.fg)('analytics-next-use-legacy-context') === false;
|
|
15
|
+
return isModernContext ? /*#__PURE__*/_react.default.createElement(_ModernAnalyticsListener.default, props) : /*#__PURE__*/_react.default.createElement(_LegacyAnalyticsListener.default, props);
|
|
16
|
+
};
|
|
17
|
+
var _default = exports.default = AnalyticsListener;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _process$env;
|
|
8
|
+
/// <reference types="node" />
|
|
9
|
+
var _default = exports.default = typeof process !== 'undefined' && process !== null && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env['ANALYTICS_NEXT_MODERN_CONTEXT']);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
|
|
5
|
+
const ContextTypes = {
|
|
6
|
+
getAtlaskitAnalyticsContext: PropTypes.func,
|
|
7
|
+
getAtlaskitAnalyticsEventHandlers: PropTypes.func
|
|
8
|
+
};
|
|
9
|
+
const noop = () => [];
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
12
|
+
class AnalyticsContext extends Component {
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
_defineProperty(this, "getChildContext", () => ({
|
|
16
|
+
getAtlaskitAnalyticsContext: this.getAnalyticsContext
|
|
17
|
+
}));
|
|
18
|
+
_defineProperty(this, "getAnalyticsContext", () => {
|
|
19
|
+
const {
|
|
20
|
+
data
|
|
21
|
+
} = this.props;
|
|
22
|
+
const {
|
|
23
|
+
getAtlaskitAnalyticsContext = noop
|
|
24
|
+
} = this.context;
|
|
25
|
+
return [...getAtlaskitAnalyticsContext(), data];
|
|
26
|
+
});
|
|
27
|
+
_defineProperty(this, "getAnalyticsEventHandlers", () => {
|
|
28
|
+
const {
|
|
29
|
+
getAtlaskitAnalyticsEventHandlers = noop
|
|
30
|
+
} = this.context;
|
|
31
|
+
return getAtlaskitAnalyticsEventHandlers();
|
|
32
|
+
});
|
|
33
|
+
this.contextValue = {
|
|
34
|
+
getAtlaskitAnalyticsContext: this.getAnalyticsContext,
|
|
35
|
+
getAtlaskitAnalyticsEventHandlers: this.getAnalyticsEventHandlers
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
const {
|
|
40
|
+
children
|
|
41
|
+
} = this.props;
|
|
42
|
+
return /*#__PURE__*/React.createElement(AnalyticsReactContext.Provider, {
|
|
43
|
+
value: this.contextValue
|
|
44
|
+
}, children);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
_defineProperty(AnalyticsContext, "contextTypes", ContextTypes);
|
|
48
|
+
_defineProperty(AnalyticsContext, "childContextTypes", ContextTypes);
|
|
49
|
+
export default AnalyticsContext;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import isModernContextEnabledEnv from '../../utils/isModernContextEnabledEnv';
|
|
4
|
+
import LegacyAnalyticsContext from './LegacyAnalyticsContext';
|
|
1
5
|
import ModernAnalyticsContext from './ModernAnalyticsContext';
|
|
2
|
-
|
|
6
|
+
const AnalyticsContext = props => {
|
|
7
|
+
const isModernContext = isModernContextEnabledEnv || fg('analytics-next-use-legacy-context') === false;
|
|
8
|
+
return isModernContext ? /*#__PURE__*/React.createElement(ModernAnalyticsContext, props) : /*#__PURE__*/React.createElement(LegacyAnalyticsContext, props);
|
|
9
|
+
};
|
|
10
|
+
export default AnalyticsContext;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import isModernContextEnabledEnv from '../utils/isModernContextEnabledEnv';
|
|
4
|
+
import LegacyAnalyticsContext from './AnalyticsContext/LegacyAnalyticsContext';
|
|
2
5
|
import ModernAnalyticsContext from './AnalyticsContext/ModernAnalyticsContext';
|
|
3
6
|
/**
|
|
4
7
|
* @private https://product-fabric.atlassian.net/browse/AFO-815
|
|
@@ -30,15 +33,26 @@ export default class AnalyticsErrorBoundary extends Component {
|
|
|
30
33
|
const {
|
|
31
34
|
hasError
|
|
32
35
|
} = this.state;
|
|
36
|
+
const isModernContext = isModernContextEnabledEnv || fg('analytics-next-use-legacy-context') === false;
|
|
33
37
|
if (hasError) {
|
|
34
38
|
if (ErrorComponent) {
|
|
35
|
-
|
|
39
|
+
if (isModernContext) {
|
|
40
|
+
return /*#__PURE__*/React.createElement(ModernAnalyticsContext, {
|
|
41
|
+
data: data
|
|
42
|
+
}, /*#__PURE__*/React.createElement(ErrorComponent, null));
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/React.createElement(LegacyAnalyticsContext, {
|
|
36
45
|
data: data
|
|
37
46
|
}, /*#__PURE__*/React.createElement(ErrorComponent, null));
|
|
38
47
|
}
|
|
39
48
|
return null;
|
|
40
49
|
}
|
|
41
|
-
|
|
50
|
+
if (isModernContext) {
|
|
51
|
+
return /*#__PURE__*/React.createElement(ModernAnalyticsContext, {
|
|
52
|
+
data: data
|
|
53
|
+
}, children);
|
|
54
|
+
}
|
|
55
|
+
return /*#__PURE__*/React.createElement(LegacyAnalyticsContext, {
|
|
42
56
|
data: data
|
|
43
57
|
}, children);
|
|
44
58
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
|
|
5
|
+
const ContextTypes = {
|
|
6
|
+
getAtlaskitAnalyticsEventHandlers: PropTypes.func,
|
|
7
|
+
getAtlaskitAnalyticsContext: PropTypes.func
|
|
8
|
+
};
|
|
9
|
+
const noop = () => [];
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
12
|
+
class AnalyticsListener extends Component {
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
_defineProperty(this, "getChildContext", () => ({
|
|
16
|
+
getAtlaskitAnalyticsEventHandlers: this.getAnalyticsEventHandlers,
|
|
17
|
+
getAtlaskitAnalyticsContext: this.getAtlaskitAnalyticsContext
|
|
18
|
+
}));
|
|
19
|
+
_defineProperty(this, "getAnalyticsEventHandlers", () => {
|
|
20
|
+
const {
|
|
21
|
+
channel,
|
|
22
|
+
onEvent
|
|
23
|
+
} = this.props;
|
|
24
|
+
const {
|
|
25
|
+
getAtlaskitAnalyticsEventHandlers = noop
|
|
26
|
+
} = this.context;
|
|
27
|
+
const handler = (event, eventChannel) => {
|
|
28
|
+
if (channel === '*' || channel === eventChannel) {
|
|
29
|
+
onEvent(event, eventChannel);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return [handler, ...getAtlaskitAnalyticsEventHandlers()];
|
|
33
|
+
});
|
|
34
|
+
_defineProperty(this, "getAtlaskitAnalyticsContext", () => {
|
|
35
|
+
const {
|
|
36
|
+
getAtlaskitAnalyticsContext = noop
|
|
37
|
+
} = this.context;
|
|
38
|
+
return getAtlaskitAnalyticsContext();
|
|
39
|
+
});
|
|
40
|
+
this.contextValue = {
|
|
41
|
+
getAtlaskitAnalyticsContext: this.getAtlaskitAnalyticsContext,
|
|
42
|
+
getAtlaskitAnalyticsEventHandlers: this.getAnalyticsEventHandlers
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
const {
|
|
47
|
+
children
|
|
48
|
+
} = this.props;
|
|
49
|
+
return /*#__PURE__*/React.createElement(AnalyticsReactContext.Provider, {
|
|
50
|
+
value: this.contextValue
|
|
51
|
+
}, children);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_defineProperty(AnalyticsListener, "contextTypes", ContextTypes);
|
|
55
|
+
_defineProperty(AnalyticsListener, "childContextTypes", ContextTypes);
|
|
56
|
+
export default AnalyticsListener;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import isModernContextEnabledEnv from '../../utils/isModernContextEnabledEnv';
|
|
4
|
+
import LegacyAnalyticsListener from './LegacyAnalyticsListener';
|
|
1
5
|
import ModernAnalyticsListener from './ModernAnalyticsListener';
|
|
2
|
-
|
|
6
|
+
const AnalyticsListener = props => {
|
|
7
|
+
const isModernContext = isModernContextEnabledEnv || fg('analytics-next-use-legacy-context') === false;
|
|
8
|
+
return isModernContext ? /*#__PURE__*/React.createElement(ModernAnalyticsListener, props) : /*#__PURE__*/React.createElement(LegacyAnalyticsListener, props);
|
|
9
|
+
};
|
|
10
|
+
export default AnalyticsListener;
|