@stokr/components-library 2.3.65-beta.10 → 2.3.65-beta.11
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/dist/components/Chips/Chip.styles.js +3 -2
- package/package.json +3 -2
- package/dist/components/2FA/EnterCode.stories.js +0 -35
- package/dist/components/2FA/disable-2fa-flow.stories.js +0 -31
- package/dist/components/2FA/enable-2fa-flow.stories.js +0 -31
- package/dist/components/2FA/login-with-otp-flow.stories.js +0 -31
- package/dist/components/2FA/main-flow.stories.js +0 -162
- package/dist/components/AccountBalance/AccountBalance.stories.js +0 -83
- package/dist/components/AdminDashboard/Table/ReactTable.stories.js +0 -913
- package/dist/components/AgreementItem/AgreementItem.stories.js +0 -105
- package/dist/components/AnalyticGraphs/Analytic.js +0 -541
- package/dist/components/AnalyticGraphs/Analytic.styles.js +0 -25
- package/dist/components/BackButton/BackButton.stories.js +0 -32
- package/dist/components/Background/Background.stories.js +0 -75
- package/dist/components/BarChart/BarChart.js +0 -263
- package/dist/components/BarChart/BarChart.stories.js +0 -66
- package/dist/components/BarChart/BarChart.styles.js +0 -26
- package/dist/components/BarChartLegend/BarChartLegend.js +0 -79
- package/dist/components/BarChartLegend/BarChartLegend.styles.js +0 -21
- package/dist/components/BasicTable/BasicTable.stories.js +0 -59
- package/dist/components/BlogPost/BlogPost.stories.js +0 -160
- package/dist/components/Button/Button.stories.js +0 -146
- package/dist/components/Button/GlareButton.stories.js +0 -132
- package/dist/components/CapitalRaisedSummary/CapitalRaisedSummery.stories.js +0 -42
- package/dist/components/ChartBox/ChartBox.js +0 -41
- package/dist/components/ChartBox/ChartBox.stories.js +0 -17
- package/dist/components/ChartBox/ChartBox.styles.js +0 -27
- package/dist/components/ChartBox/ChartBoxDistribution.js +0 -27
- package/dist/components/ChartBox/ChartBoxDistribution.stories.js +0 -18
- package/dist/components/ChartLegend/ChartLegend.stories.js +0 -90
- package/dist/components/Checkbox/Checkbox.stories.js +0 -88
- package/dist/components/Checklist/ChecklistCard.stories.js +0 -102
- package/dist/components/Checklist/UserChecklist.js +0 -184
- package/dist/components/Checklist/UserChecklist.stories.js +0 -317
- package/dist/components/Chips/Chip.stories.js +0 -36
- package/dist/components/Chips/ChipsWrapper.stories.js +0 -47
- package/dist/components/ComponentScroll/ComponentScroll.stories.js +0 -111
- package/dist/components/CryptoAddress/CryptoAddress.stories.js +0 -205
- package/dist/components/CryptoAddressDetails/CryptoAddressDetails.stories.js +0 -70
- package/dist/components/DonutChart/DonutChart.stories.js +0 -54
- package/dist/components/FAQ/FAQ.stories.js +0 -76
- package/dist/components/Footer/Footer.stories.js +0 -49
- package/dist/components/Footer/FooterLayout.stories.js +0 -26
- package/dist/components/Footer/FooterMenu.stories.js +0 -113
- package/dist/components/Footer/mangopay.png +0 -0
- package/dist/components/Footer/mangopay.svg +0 -20
- package/dist/components/ForgotPasswordModal/ForgotPasswordModal.stories.js +0 -69
- package/dist/components/Form/Form.stories.js +0 -32
- package/dist/components/FullscreenCard/FullscreenCard.styles.js +0 -27
- package/dist/components/Header/Header.stories.js +0 -192
- package/dist/components/Icon/Icon.stories.js +0 -108
- package/dist/components/InfoIcon/InfoIcon.stories.js +0 -299
- package/dist/components/InfoPanel/InfoPanel.js +0 -124
- package/dist/components/Input/DatePickerInput.stories.js +0 -87
- package/dist/components/Input/Input.stories.js +0 -217
- package/dist/components/Input/InputPassword.stories.js +0 -80
- package/dist/components/Input/InputWithButton.stories.js +0 -75
- package/dist/components/Input/MultiSelect.stories.js +0 -264
- package/dist/components/Input/OtpInput.stories.js +0 -57
- package/dist/components/Input/RangeInput.stories.js +0 -58
- package/dist/components/Input/SearchInput.stories.js +0 -366
- package/dist/components/Input/Select.stories.js +0 -478
- package/dist/components/InvestCalculator/InvestCalculator.stories.js +0 -135
- package/dist/components/InvestmentStat/InvestmentStat.stories.js +0 -52
- package/dist/components/KYCFlow/BasicInfo.js +0 -448
- package/dist/components/KYCFlow/Confirmation.js +0 -46
- package/dist/components/KYCFlow/DocumentFileUpload.js +0 -263
- package/dist/components/KYCFlow/DocumentScan.js +0 -75
- package/dist/components/KYCFlow/DocumentScanUpload.js +0 -251
- package/dist/components/KYCFlow/DocumentSelect.js +0 -118
- package/dist/components/KYCFlow/DocumentSuccess.js +0 -63
- package/dist/components/KYCFlow/DocumentUpload.js +0 -53
- package/dist/components/KYCFlow/DocumentVerificationType.js +0 -131
- package/dist/components/KYCFlow/FaceScan.js +0 -54
- package/dist/components/KYCFlow/FaceScanRecognition.js +0 -61
- package/dist/components/KYCFlow/FaceScanSuccess.js +0 -56
- package/dist/components/KYCFlow/Terms.js +0 -119
- package/dist/components/KYCFlow/_styles.js +0 -111
- package/dist/components/KYCFlow/index.js +0 -97
- package/dist/components/KYCSelectBox/KYCSelectBox.styles.js +0 -29
- package/dist/components/LatestUpdate/LatestUpdate.stories.js +0 -58
- package/dist/components/Layout/Layout.stories.js +0 -60
- package/dist/components/LearnMoreCarousel/LearnMoreCarousel.stories.js +0 -66
- package/dist/components/LearnMorePage/LearnMore.stories.js +0 -48
- package/dist/components/LearnMorePage/LearnMoreItem.stories.js +0 -62
- package/dist/components/LearnMoreSection/LearnMore.stories.js +0 -30
- package/dist/components/LearnMoreSection/LearnMoreItem.stories.js +0 -59
- package/dist/components/LoginModal/LoginModal.stories.js +0 -74
- package/dist/components/MatomoConnect/Matomo.js +0 -228
- package/dist/components/MatomoConnect/Matomo_fuckup.js +0 -387
- package/dist/components/Modal/Modal.stories.js +0 -75
- package/dist/components/Modal/NewVentureModal/NewVentureModal.stories.js +0 -150
- package/dist/components/Modal/PaymentModal.stories.js +0 -57
- package/dist/components/Modal/SideModal.stories.js +0 -342
- package/dist/components/MultiProgressBar/MultiProgressBar.stories.js +0 -67
- package/dist/components/Newsletter/Newsletter.stories.js +0 -16
- package/dist/components/NotificationContext/NotificationContext.js +0 -141
- package/dist/components/Number/Number.stories.js +0 -92
- package/dist/components/Pagination/Pagination.stories.js +0 -83
- package/dist/components/Pagination/PaginationControls.stories.js +0 -112
- package/dist/components/Payment/PaymentDetailsCard.stories.js +0 -198
- package/dist/components/Payment/PaymentDisplay.stories.js +0 -302
- package/dist/components/Payment/TimerComponent.stories.js +0 -236
- package/dist/components/Process/Process.stories.js +0 -42
- package/dist/components/ProfileBadge/ProfileBadge.stories.js +0 -45
- package/dist/components/ProfileBox/ProfileBox.stories.js +0 -35
- package/dist/components/ProfileHeader/ProfileHeader.js +0 -252
- package/dist/components/ProfileHeader/ProfileHeader.styles.js +0 -65
- package/dist/components/ProfileStat/ProfileStat.stories.js +0 -66
- package/dist/components/ProofOfAddress/ProofOfAddress.styles.js +0 -53
- package/dist/components/QRCode/QRCode.stories.js +0 -104
- package/dist/components/Radio/Radio.stories.js +0 -73
- package/dist/components/RefreshButton/RefreshButton.stories.js +0 -38
- package/dist/components/RegisterAlgorand/AlgoAddressName.js +0 -138
- package/dist/components/RegisterAlgorand/AlgoAdressSelect.js +0 -443
- package/dist/components/RegisterAlgorand/AlgoConnectWallet.js +0 -47
- package/dist/components/RegisterAlgorand/AlgoSuccess.js +0 -38
- package/dist/components/RegisterAlgorand/Algorand.stories.js +0 -80
- package/dist/components/RegisterAlgorand/ChooseWallet.js +0 -97
- package/dist/components/RegisterAlgorand/SelectProject.js +0 -89
- package/dist/components/RegisterAlgorand/_styles.js +0 -28
- package/dist/components/RegisterAlgorand/flow.js +0 -409
- package/dist/components/RegisterAlgorand/flowWithMemo.js +0 -410
- package/dist/components/RegisterAlgorand/index.js +0 -48
- package/dist/components/RegisterConfirmModal/RegisterConfirmModal.stories.js +0 -41
- package/dist/components/RegisterEthereum/EthAddressLedger.js +0 -226
- package/dist/components/RegisterEthereum/EthAddressMetamask.js +0 -204
- package/dist/components/RegisterEthereum/EthAddressName.js +0 -135
- package/dist/components/RegisterEthereum/EthConnectLedger.js +0 -194
- package/dist/components/RegisterEthereum/EthConnectMetamask.js +0 -35
- package/dist/components/RegisterEthereum/EthFinish.js +0 -41
- package/dist/components/RegisterEthereum/EthIntro.js +0 -95
- package/dist/components/RegisterEthereum/_styles.js +0 -28
- package/dist/components/RegisterEthereum/index.js +0 -68
- package/dist/components/RegisterModal/RegisterModal.stories.js +0 -49
- package/dist/components/RequestDataBox/RequestDataBox.stories.js +0 -37
- package/dist/components/RiskQuestionnaire/RiskQuestionnaireContext.js +0 -185
- package/dist/components/RiskQuestionnaire/_styles.js +0 -15
- package/dist/components/SEO/SEO.stories.js +0 -60
- package/dist/components/SideLine/SideLine.stories.js +0 -28
- package/dist/components/SigningSubflow/SignSubAddressMetamask.js +0 -137
- package/dist/components/SigningSubflow/SignSubConnectLedger.js +0 -150
- package/dist/components/SigningSubflow/SignSubConnectMetamask.js +0 -137
- package/dist/components/SigningSubflow/SignSubIntro.js +0 -55
- package/dist/components/SigningSubflow/SignSubSendLedger.js +0 -150
- package/dist/components/SigningSubflow/SignSubSendMetamask.js +0 -62
- package/dist/components/SigningSubflow/SignSubTransactionLedger.js +0 -161
- package/dist/components/SigningSubflow/SignSubTransactionMetamask.js +0 -166
- package/dist/components/SigningSubflow/_styles.js +0 -34
- package/dist/components/SigningSubflow/index.js +0 -32
- package/dist/components/Slider/Slider.stories.js +0 -68
- package/dist/components/Snackbar/Snackbar.stories.js +0 -292
- package/dist/components/StatusTag/StatusTag.stories.js +0 -262
- package/dist/components/StepController/StepController.stories.js +0 -60
- package/dist/components/StepController/StepControllerProgress.stories.js +0 -49
- package/dist/components/StepsProgress/StepIndicator.stories.js +0 -153
- package/dist/components/StepsProgress/StepsProgress.stories.js +0 -49
- package/dist/components/Switch/Switch.stories.js +0 -81
- package/dist/components/Tabs/Tabs.stories.js +0 -36
- package/dist/components/TabsNav/TabNav.stories.js +0 -40
- package/dist/components/TabsNav/TabsNav.stories.js +0 -37
- package/dist/components/TeamOverview/TeamOverview.stories.js +0 -76
- package/dist/components/TermsModal/TermsModal.stories.js +0 -31
- package/dist/components/Text/Headline.stories.js +0 -48
- package/dist/components/Text/Text.stories.js +0 -70
- package/dist/components/TextLink/TextLink.stories.js +0 -35
- package/dist/components/Timeline/Timeline.stories.js +0 -393
- package/dist/components/ToDoList/ToDoList.stories.js +0 -133
- package/dist/components/ToDoList/ToDoListTask.stories.js +0 -70
- package/dist/components/TransactionDetails/TransactionDetails.stories.js +0 -55
- package/dist/components/TransactionDetails/TransactionDetailsTable.stories.js +0 -305
- package/dist/components/TransactionInfo/TransactionInfo.stories.js +0 -61
- package/dist/components/TwoFactorModal/TwoFactorModal.js +0 -100
- package/dist/components/VerifyEmailModal/VerifyEmailModal.stories.js +0 -59
- package/dist/components/headerHo/HeaderHo.stories.js +0 -35
- package/dist/components/icons/Arrow.stories.js +0 -42
- package/dist/components/icons/ArrowSimple.stories.js +0 -48
- package/dist/components/icons/Check.stories.js +0 -22
- package/dist/components/icons/Facebook.stories.js +0 -21
- package/dist/components/icons/Facebook_Logo.png +0 -0
- package/dist/components/icons/Info.stories.js +0 -16
- package/dist/components/icons/Instagram.stories.js +0 -21
- package/dist/components/icons/LI-In-Bug.png +0 -0
- package/dist/components/icons/LinkIcon.stories.js +0 -21
- package/dist/components/icons/LinkedIn.stories.js +0 -16
- package/dist/components/icons/Medium.stories.js +0 -16
- package/dist/components/icons/Reddit.stories.js +0 -21
- package/dist/components/icons/Share.stories.js +0 -16
- package/dist/components/icons/Telegram-Logo.png +0 -0
- package/dist/components/icons/Telegram.stories.js +0 -16
- package/dist/components/icons/Twitter.stories.js +0 -21
- package/dist/components/icons/X-logo-black.png +0 -0
- package/dist/components/icons/X.stories.js +0 -16
- package/dist/components/icons/Youtube.stories.js +0 -21
- package/dist/components/icons/youtube_social_circle_red.png +0 -0
- package/dist/components/logo/Logo.stories.js +0 -260
- package/dist/components/taxId/TaxId.stories.js +0 -50
- package/dist/components/video/Video.stories.js +0 -52
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.AgreementItemOverview = exports.AgreementItemExample = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _AgreementItem = _interopRequireDefault(require("./AgreementItem"));
|
|
9
|
-
var _ComponentWrapper = require("../ComponentWrapper/ComponentWrapper.styles");
|
|
10
|
-
var _global = _interopRequireDefault(require("../../styles/global"));
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
// import Checkbox, { CheckboxPropTypes } from '../Checkbox/Checkbox'
|
|
13
|
-
var _default = exports.default = {
|
|
14
|
-
title: 'Components Library/Agreement Item',
|
|
15
|
-
component: _AgreementItem.default,
|
|
16
|
-
argTypes: {
|
|
17
|
-
title: {
|
|
18
|
-
type: 'string',
|
|
19
|
-
defaultValue: ''
|
|
20
|
-
},
|
|
21
|
-
text: {
|
|
22
|
-
type: 'string',
|
|
23
|
-
defaultValue: '',
|
|
24
|
-
required: true
|
|
25
|
-
},
|
|
26
|
-
withTermsLink: {
|
|
27
|
-
type: 'boolean'
|
|
28
|
-
},
|
|
29
|
-
ventureName: {
|
|
30
|
-
type: 'string'
|
|
31
|
-
},
|
|
32
|
-
info: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
defaultValue: ''
|
|
35
|
-
},
|
|
36
|
-
checkbox: {
|
|
37
|
-
type: 'shape',
|
|
38
|
-
defaultValue: {
|
|
39
|
-
id: '',
|
|
40
|
-
name: '',
|
|
41
|
-
text: '',
|
|
42
|
-
label: '',
|
|
43
|
-
value: '',
|
|
44
|
-
checked: false,
|
|
45
|
-
large: false,
|
|
46
|
-
error: false,
|
|
47
|
-
touched: false
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
checkboxWithFileDownload: {
|
|
51
|
-
type: 'shape',
|
|
52
|
-
defaultValue: {
|
|
53
|
-
id: '',
|
|
54
|
-
name: '',
|
|
55
|
-
text: '',
|
|
56
|
-
label: '',
|
|
57
|
-
value: '',
|
|
58
|
-
checked: false,
|
|
59
|
-
large: false,
|
|
60
|
-
error: false,
|
|
61
|
-
touched: false
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const Template = args => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement(_ComponentWrapper.ComponentWrapper, null, /*#__PURE__*/_react.default.createElement(_AgreementItem.default, args)));
|
|
67
|
-
const AgreementItemOverview = exports.AgreementItemOverview = Template.bind({});
|
|
68
|
-
AgreementItemOverview.args = {
|
|
69
|
-
title: 'Agreement Item Title',
|
|
70
|
-
text: 'some Text',
|
|
71
|
-
withTermsLink: true,
|
|
72
|
-
ventureName: 'Venture Name',
|
|
73
|
-
info: 'Info'
|
|
74
|
-
};
|
|
75
|
-
const AgreementItemExample = exports.AgreementItemExample = Template.bind({});
|
|
76
|
-
AgreementItemExample.args = {
|
|
77
|
-
title: 'disclaimer',
|
|
78
|
-
text: 'Before being able to view any fund offering, you, as a prospective investor, must confirm a few things. Please read check the boxes',
|
|
79
|
-
withTermsLink: true,
|
|
80
|
-
ventureName: 'Algorand',
|
|
81
|
-
info: 'Info',
|
|
82
|
-
checkbox: {
|
|
83
|
-
checked: true
|
|
84
|
-
},
|
|
85
|
-
checkboxWithFileDownload: {
|
|
86
|
-
checked: true
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
//doublecheck:
|
|
91
|
-
// CheckboxPropTypes....
|
|
92
|
-
// events/actions not incooporated
|
|
93
|
-
// onChange: { type: 'function', action: 'onChange' },
|
|
94
|
-
// onBlur: { type: 'function', action: 'onBlur' },
|
|
95
|
-
// onFocus: { type: 'function', action: 'onFocus' },
|
|
96
|
-
|
|
97
|
-
// 'Please read check the boxes to the right.' - is bad english in Disclaimer
|
|
98
|
-
|
|
99
|
-
// change since Merge:
|
|
100
|
-
//OfferingPageLink
|
|
101
|
-
//TermsOfOfferingLink
|
|
102
|
-
//withTermsLink
|
|
103
|
-
// ventureName
|
|
104
|
-
//checkboxwithfiledownload
|
|
105
|
-
//hardcoded texts all taken out.
|
|
@@ -1,541 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.Analytic = void 0;
|
|
7
|
-
var _Matomo = _interopRequireDefault(require("../MatomoConnect/Matomo"));
|
|
8
|
-
var Moment = _interopRequireWildcard(require("moment"));
|
|
9
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (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 (const 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); }
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
13
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
|
-
const matomoConnect = new _Matomo.default();
|
|
15
|
-
const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
16
|
-
const monthsShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
17
|
-
class Analytic {
|
|
18
|
-
constructor() {
|
|
19
|
-
_defineProperty(this, "CURRENT_DATE", void 0);
|
|
20
|
-
_defineProperty(this, "START_DATE", void 0);
|
|
21
|
-
_defineProperty(this, "VISITS_SUMMARY", {});
|
|
22
|
-
_defineProperty(this, "TOTAL_SUMMARY", {});
|
|
23
|
-
this.CURRENT_DATE = new Moment();
|
|
24
|
-
this.START_DATE = this.CURRENT_DATE.clone().subtract(2, 'months');
|
|
25
|
-
this.getSummary();
|
|
26
|
-
}
|
|
27
|
-
async getSummary() {
|
|
28
|
-
this.TOTAL_SUMMARY = {
|
|
29
|
-
visits: 0,
|
|
30
|
-
bounce_count: 0,
|
|
31
|
-
visit_length: 0,
|
|
32
|
-
unique_visitors: 0,
|
|
33
|
-
avg_time_on_site: 0
|
|
34
|
-
};
|
|
35
|
-
this.VISITS_SUMMARY = await matomoConnect.init(matomoConnect.GetVisitsSummary, 'month', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
36
|
-
Object.keys(this.VISITS_SUMMARY).forEach(key => {
|
|
37
|
-
this.TOTAL_SUMMARY.visits += this.VISITS_SUMMARY[key].nb_visits || 0;
|
|
38
|
-
this.TOTAL_SUMMARY.bounce_count += this.VISITS_SUMMARY[key].bounce_count || 0;
|
|
39
|
-
this.TOTAL_SUMMARY.visit_length += this.VISITS_SUMMARY[key].sum_visit_length || 0;
|
|
40
|
-
this.TOTAL_SUMMARY.unique_visitors += this.VISITS_SUMMARY[key].nb_uniq_visitors || 0;
|
|
41
|
-
this.TOTAL_SUMMARY.avg_time_on_site += this.VISITS_SUMMARY[key].avg_time_on_site || 0;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
static async getRealTimeUsersBasicGraph() {
|
|
45
|
-
const lastMinute = await matomoConnect.init(matomoConnect.LiveGetCounters, 10, 'visitors');
|
|
46
|
-
const lastHour = await matomoConnect.init(matomoConnect.LiveGetCounters, 60, 'visitors');
|
|
47
|
-
const last2Hours = await matomoConnect.init(matomoConnect.LiveGetCounters, 120, 'visitors');
|
|
48
|
-
const increase = Analytic.getIncrease(last2Hours, lastMinute);
|
|
49
|
-
const object = {
|
|
50
|
-
id: 'realTimeUsersStat',
|
|
51
|
-
title: 'realtime users',
|
|
52
|
-
value: lastMinute.toString(),
|
|
53
|
-
percent: isNaN(increase) ? 0 : parseFloat(parseFloat(increase).toFixed(1)),
|
|
54
|
-
chart: {
|
|
55
|
-
id: 'realTimeUsersChart',
|
|
56
|
-
fill: '#e4ecf9',
|
|
57
|
-
stroke: '#0050ca',
|
|
58
|
-
data: [{
|
|
59
|
-
date: 1,
|
|
60
|
-
value: last2Hours
|
|
61
|
-
}, {
|
|
62
|
-
date: 2,
|
|
63
|
-
value: lastHour
|
|
64
|
-
}, {
|
|
65
|
-
date: 3,
|
|
66
|
-
value: lastMinute
|
|
67
|
-
}]
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
return object;
|
|
71
|
-
}
|
|
72
|
-
async getBasicGraphs() {
|
|
73
|
-
return [this.getTotalVisitsBasicGraph(), this.getBounceRateBasicGraph(), this.getVisitDurationBasicGraph()];
|
|
74
|
-
}
|
|
75
|
-
getTotalVisitsBasicGraph() {
|
|
76
|
-
const totalVisitsChartData = [];
|
|
77
|
-
Object.keys(this.VISITS_SUMMARY).forEach(key => {
|
|
78
|
-
totalVisitsChartData.push({
|
|
79
|
-
date: totalVisitsChartData.length + 1,
|
|
80
|
-
value: this.VISITS_SUMMARY[key].nb_visits ? this.VISITS_SUMMARY[key].nb_visits : 0
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
const visitsSummaryKeys = Object.keys(this.VISITS_SUMMARY);
|
|
84
|
-
const previousMonth = this.VISITS_SUMMARY[visitsSummaryKeys[visitsSummaryKeys.length - 2]];
|
|
85
|
-
const lastMonth = this.VISITS_SUMMARY[visitsSummaryKeys[visitsSummaryKeys.length - 1]];
|
|
86
|
-
const totalVisitsIncrease = Analytic.getIncrease(previousMonth && previousMonth.nb_visits ? previousMonth.nb_visits : 0, lastMonth && lastMonth.nb_visits ? lastMonth.nb_visits : 0);
|
|
87
|
-
return {
|
|
88
|
-
id: 'totalVisitsStat',
|
|
89
|
-
title: 'total visits',
|
|
90
|
-
value: this.TOTAL_SUMMARY.visits.toString(),
|
|
91
|
-
percent: isNaN(totalVisitsIncrease) ? 0 : parseFloat(parseFloat(totalVisitsIncrease).toFixed(1)),
|
|
92
|
-
chart: {
|
|
93
|
-
id: 'totalVisitsGraph',
|
|
94
|
-
fill: '#fee8e8',
|
|
95
|
-
stroke: '#ee220d',
|
|
96
|
-
data: totalVisitsChartData
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
getBounceRateBasicGraph() {
|
|
101
|
-
const bounceRateData = [];
|
|
102
|
-
Object.keys(this.VISITS_SUMMARY).forEach(key => {
|
|
103
|
-
bounceRateData.push({
|
|
104
|
-
date: bounceRateData.length + 1,
|
|
105
|
-
value: this.VISITS_SUMMARY[key].bounce_count ? this.VISITS_SUMMARY[key].bounce_count : 0
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
const visitsSummaryKeys = Object.keys(this.VISITS_SUMMARY);
|
|
109
|
-
const firstMonth = this.VISITS_SUMMARY[visitsSummaryKeys.shift()];
|
|
110
|
-
const lastMonth = this.VISITS_SUMMARY[visitsSummaryKeys[visitsSummaryKeys.length - 1]];
|
|
111
|
-
const bounceRateIncrease = Analytic.getIncrease(firstMonth && firstMonth.bounce_count ? firstMonth.bounce_count : 0, lastMonth && lastMonth.bounce_count ? lastMonth.bounce_count : 0);
|
|
112
|
-
const bounceRate = Analytic.getPercent(this.TOTAL_SUMMARY.bounce_count, this.TOTAL_SUMMARY.visits);
|
|
113
|
-
return {
|
|
114
|
-
id: 'bounceRateStat',
|
|
115
|
-
title: 'bounce rate',
|
|
116
|
-
value: "".concat(bounceRate, "%"),
|
|
117
|
-
percent: isNaN(bounceRateIncrease) ? 0 : parseFloat(parseFloat(bounceRateIncrease).toFixed(1)),
|
|
118
|
-
chart: {
|
|
119
|
-
id: 'bounceRateGraph',
|
|
120
|
-
fill: '#eff8ec',
|
|
121
|
-
stroke: '#69bd53',
|
|
122
|
-
data: bounceRateData
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
getVisitDurationBasicGraph() {
|
|
127
|
-
const visitDurationData = [];
|
|
128
|
-
Object.keys(this.VISITS_SUMMARY).forEach(key => {
|
|
129
|
-
visitDurationData.push({
|
|
130
|
-
date: visitDurationData.length + 1,
|
|
131
|
-
value: this.VISITS_SUMMARY[key].avg_time_on_site ? this.VISITS_SUMMARY[key].avg_time_on_site : 0
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
const visitsSummaryKeys = Object.keys(this.VISITS_SUMMARY);
|
|
135
|
-
const firstMonth = this.VISITS_SUMMARY[visitsSummaryKeys.shift()];
|
|
136
|
-
const lastMonth = this.VISITS_SUMMARY[visitsSummaryKeys[visitsSummaryKeys.length - 1]];
|
|
137
|
-
const visitDurationIncrease = Analytic.getIncrease(firstMonth && firstMonth.avg_time_on_site ? firstMonth.avg_time_on_site : 0, lastMonth && lastMonth.avg_time_on_site ? lastMonth.avg_time_on_site : 0);
|
|
138
|
-
const value = new Moment().startOf('day').seconds(this.TOTAL_SUMMARY.avg_time_on_site);
|
|
139
|
-
return {
|
|
140
|
-
id: 'visitDurationStat',
|
|
141
|
-
title: 'avg. visit duration',
|
|
142
|
-
value: Analytic.getTimeSpent(value),
|
|
143
|
-
percent: isNaN(visitDurationIncrease) ? 0 : parseFloat(parseFloat(visitDurationIncrease).toFixed(1)),
|
|
144
|
-
chart: {
|
|
145
|
-
id: 'visitDurationGraph',
|
|
146
|
-
fill: '#f0f0f0',
|
|
147
|
-
stroke: '#2f2f2f',
|
|
148
|
-
data: visitDurationData
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
async getCountryGraph() {
|
|
153
|
-
const graphData = [];
|
|
154
|
-
const countries = await matomoConnect.init(matomoConnect.GetCountrySummary, 'range', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
155
|
-
const countriesByMonth = await matomoConnect.init(matomoConnect.GetCountrySummary, 'month', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
156
|
-
countries.forEach((value, key) => {
|
|
157
|
-
const bounceRateData = [];
|
|
158
|
-
let bounceRate = value.bounce_count * 100 / value.nb_visits;
|
|
159
|
-
bounceRate = parseFloat(bounceRate).toFixed(2);
|
|
160
|
-
Object.keys(countriesByMonth).forEach(byMonthKey => {
|
|
161
|
-
const object = {
|
|
162
|
-
date: bounceRateData.length + 1
|
|
163
|
-
};
|
|
164
|
-
countriesByMonth[byMonthKey].forEach(cv => {
|
|
165
|
-
if (cv.code === value.code) {
|
|
166
|
-
object.value = cv && cv.bounce_count ? cv.bounce_count : 0;
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
if (!object.value) {
|
|
170
|
-
object.value = 0;
|
|
171
|
-
}
|
|
172
|
-
bounceRateData.push(object);
|
|
173
|
-
});
|
|
174
|
-
graphData.push({
|
|
175
|
-
id: key,
|
|
176
|
-
country: value.code,
|
|
177
|
-
country_name: value.label,
|
|
178
|
-
visits: value.nb_visits,
|
|
179
|
-
unique_visitors: value.sum_daily_nb_uniq_visitors,
|
|
180
|
-
flag_url: "".concat(matomoConnect.MATOMO_API_URL, "/").concat(value.logo),
|
|
181
|
-
bounce_rate: "".concat(bounceRate, "%"),
|
|
182
|
-
chart: {
|
|
183
|
-
id: "countryChart".concat(key),
|
|
184
|
-
fill: '#E4ECF9',
|
|
185
|
-
stroke: '#0050CA',
|
|
186
|
-
data: bounceRateData
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
return graphData;
|
|
191
|
-
}
|
|
192
|
-
async getSocialGraph() {
|
|
193
|
-
const graphData = [];
|
|
194
|
-
const socials = await matomoConnect.init(matomoConnect.GetSocialSummary, 'range', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
195
|
-
socials.forEach((value, key) => {
|
|
196
|
-
let progress = value.sum_daily_nb_uniq_visitors * 100 / this.TOTAL_SUMMARY.unique_visitors;
|
|
197
|
-
progress = parseFloat(progress).toFixed(2);
|
|
198
|
-
graphData.push({
|
|
199
|
-
id: key,
|
|
200
|
-
network: "".concat(value.label.charAt(0).toUpperCase()).concat(value.label.slice(1)),
|
|
201
|
-
visitors: value.sum_daily_nb_uniq_visitors,
|
|
202
|
-
progress: parseFloat(progress)
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
return graphData;
|
|
206
|
-
}
|
|
207
|
-
async getDeviceGraph() {
|
|
208
|
-
const devices = await matomoConnect.init(matomoConnect.GetDeviceOsFamilies, 'range', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
209
|
-
const browsers = await matomoConnect.init(matomoConnect.GetDeviceBrowsers, 'range', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
210
|
-
const models = await matomoConnect.init(matomoConnect.GetDeviceModels, 'range', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
211
|
-
let desktop = 0;
|
|
212
|
-
let android = 0;
|
|
213
|
-
let ios = 0;
|
|
214
|
-
let other = 0;
|
|
215
|
-
let total = 0;
|
|
216
|
-
devices.forEach((value, key) => {
|
|
217
|
-
if (value.label === 'Android') {
|
|
218
|
-
android += value.nb_visits;
|
|
219
|
-
}
|
|
220
|
-
if (value.label === 'iOS') {
|
|
221
|
-
ios += value.nb_visits;
|
|
222
|
-
}
|
|
223
|
-
if (value.label === 'Windows' || value.label === 'Mac' || value.label === 'GNU/Linux') {
|
|
224
|
-
desktop += value.nb_visits;
|
|
225
|
-
}
|
|
226
|
-
if (!['Windows', 'Mac', 'GNU/Linux', 'Android', 'iOS'].includes(value.label)) {
|
|
227
|
-
other += value.nb_visits;
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
total = android + ios + desktop + other;
|
|
231
|
-
const donutChart = [{
|
|
232
|
-
name: 'Android',
|
|
233
|
-
value: android,
|
|
234
|
-
color: '#0050CA'
|
|
235
|
-
}, {
|
|
236
|
-
name: 'Other',
|
|
237
|
-
value: other,
|
|
238
|
-
color: '#69BD53'
|
|
239
|
-
}, {
|
|
240
|
-
name: 'IOS',
|
|
241
|
-
value: ios,
|
|
242
|
-
color: '#CEDDF5'
|
|
243
|
-
}, {
|
|
244
|
-
name: 'Desktop',
|
|
245
|
-
value: desktop,
|
|
246
|
-
color: '#EE220D'
|
|
247
|
-
}];
|
|
248
|
-
const deviceData = {
|
|
249
|
-
Android: {
|
|
250
|
-
percent: Analytic.getPercent(android, total),
|
|
251
|
-
value: android
|
|
252
|
-
},
|
|
253
|
-
iOS: {
|
|
254
|
-
percent: Analytic.getPercent(ios, total),
|
|
255
|
-
value: ios
|
|
256
|
-
},
|
|
257
|
-
Desktop: {
|
|
258
|
-
percent: Analytic.getPercent(desktop, total),
|
|
259
|
-
value: desktop
|
|
260
|
-
},
|
|
261
|
-
Other: {
|
|
262
|
-
percent: Analytic.getPercent(other, total),
|
|
263
|
-
value: other
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
const desktopBrowsers = [];
|
|
267
|
-
let desktopBrowsersTotal = 0;
|
|
268
|
-
browsers.forEach((value, key) => {
|
|
269
|
-
if (['Chrome', 'Firefox', 'Safari', 'Opera', 'Internet Explorer', 'Microsoft Edge', 'Vivaldi'].includes(value.label)) {
|
|
270
|
-
desktopBrowsersTotal += value.nb_visits;
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
browsers.forEach((value, key) => {
|
|
274
|
-
if (['Chrome', 'Firefox', 'Safari', 'Opera', 'Internet Explorer', 'Microsoft Edge', 'Vivaldi'].includes(value.label)) {
|
|
275
|
-
desktopBrowsers.push({
|
|
276
|
-
label: value.label,
|
|
277
|
-
value: "".concat(value.nb_visits, " (").concat(Analytic.getPercent(value.nb_visits, desktopBrowsersTotal), "%)")
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
const iosModels = [];
|
|
282
|
-
let iosTotal = 0;
|
|
283
|
-
const androidModels = [];
|
|
284
|
-
let androidTotal = 0;
|
|
285
|
-
models.forEach((value, key) => {
|
|
286
|
-
if (!value.label.includes('Generic') && value.label.includes('Apple')) {
|
|
287
|
-
iosTotal += value.nb_visits;
|
|
288
|
-
}
|
|
289
|
-
if (!value.label.includes('Generic') && !value.label.includes('Apple')) {
|
|
290
|
-
androidTotal += value.nb_visits;
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
models.forEach((value, key) => {
|
|
294
|
-
if (!value.label.includes('Generic') && value.label.includes('Apple')) {
|
|
295
|
-
iosModels.push({
|
|
296
|
-
label: value.label,
|
|
297
|
-
value: "".concat(value.nb_visits, " (").concat(Analytic.getPercent(value.nb_visits, iosTotal), "%)")
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
if (!value.label.includes('Generic') && !value.label.includes('Apple')) {
|
|
301
|
-
androidModels.push({
|
|
302
|
-
label: value.label,
|
|
303
|
-
value: "".concat(value.nb_visits, " (").concat(Analytic.getPercent(value.nb_visits, androidTotal), "%)")
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
return {
|
|
308
|
-
donutChart,
|
|
309
|
-
deviceData,
|
|
310
|
-
desktopBrowsers,
|
|
311
|
-
iosModels,
|
|
312
|
-
androidModels
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
async getMonthSlider() {
|
|
316
|
-
const response = await matomoConnect.init(matomoConnect.GetVisitsSummary, 'day', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
317
|
-
const data = [];
|
|
318
|
-
Object.keys(response).forEach(key => {
|
|
319
|
-
const month = key.split('-');
|
|
320
|
-
let check = false;
|
|
321
|
-
data.forEach((value, k) => {
|
|
322
|
-
if (value.title === "".concat(months[parseInt(month[1], 10) - 1], " ").concat(month[0])) {
|
|
323
|
-
check = true;
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
if (!check) {
|
|
327
|
-
data.push({
|
|
328
|
-
title: "".concat(months[parseInt(month[1], 10) - 1], " ").concat(month[0]),
|
|
329
|
-
values: [],
|
|
330
|
-
total: 0
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
data.forEach((value, k) => {
|
|
334
|
-
if (value.title === "".concat(months[parseInt(month[1], 10) - 1], " ").concat(month[0])) {
|
|
335
|
-
value.values.push({
|
|
336
|
-
name: key.split('-')[2],
|
|
337
|
-
value: response[key].nb_uniq_visitors ? response[key].nb_uniq_visitors : 0
|
|
338
|
-
});
|
|
339
|
-
value.total += response[key].nb_uniq_visitors ? response[key].nb_uniq_visitors : 0;
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
return data.reverse();
|
|
344
|
-
}
|
|
345
|
-
async getYearSlider() {
|
|
346
|
-
const data = [];
|
|
347
|
-
const response = await this.getMonthSlider();
|
|
348
|
-
response && response.reverse().forEach(month => {
|
|
349
|
-
const year = month.title.split(' ');
|
|
350
|
-
let check = false;
|
|
351
|
-
data.forEach((value, k) => {
|
|
352
|
-
if (value.title === "".concat(year[1])) {
|
|
353
|
-
check = true;
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
if (!check) {
|
|
357
|
-
data.push({
|
|
358
|
-
title: "".concat(year[1]),
|
|
359
|
-
values: []
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
data.forEach((value, k) => {
|
|
363
|
-
if (value.title === "".concat(year[1])) {
|
|
364
|
-
value.values.push({
|
|
365
|
-
name: "".concat(year[0]),
|
|
366
|
-
value: month.total || 0
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
});
|
|
371
|
-
return data.reverse();
|
|
372
|
-
}
|
|
373
|
-
async getWeekSlider() {
|
|
374
|
-
const response = await matomoConnect.init(matomoConnect.GetVisitsSummary, 'day', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
375
|
-
const data = [];
|
|
376
|
-
Object.keys(response).forEach(key => {
|
|
377
|
-
const startOfWeek = Moment(key).startOf('isoWeek');
|
|
378
|
-
const endOfWeek = Moment(key).endOf('isoWeek');
|
|
379
|
-
const slicedStartOfWeek = startOfWeek.toString().slice(4, 10); //15)
|
|
380
|
-
const slicedEndOfWeek = endOfWeek.toString().slice(4, 10); //15)
|
|
381
|
-
|
|
382
|
-
const day = Moment(key).format('ddd');
|
|
383
|
-
let check = false;
|
|
384
|
-
data.forEach((value, k) => {
|
|
385
|
-
if (value.title === "".concat(slicedStartOfWeek, " - ").concat(slicedEndOfWeek)) {
|
|
386
|
-
check = true;
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
if (!check) {
|
|
390
|
-
data.push({
|
|
391
|
-
title: "".concat(slicedStartOfWeek, " - ").concat(slicedEndOfWeek),
|
|
392
|
-
values: []
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
data.forEach((value, k) => {
|
|
396
|
-
if (value.title === "".concat(slicedStartOfWeek, " - ").concat(slicedEndOfWeek)) {
|
|
397
|
-
value.values.push({
|
|
398
|
-
name: day,
|
|
399
|
-
value: response[key].nb_uniq_visitors ? response[key].nb_uniq_visitors : 0
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
return data.reverse();
|
|
405
|
-
}
|
|
406
|
-
async getHeatmap() {
|
|
407
|
-
const periods = {
|
|
408
|
-
'00': {
|
|
409
|
-
value: '12AM'
|
|
410
|
-
},
|
|
411
|
-
'01': {
|
|
412
|
-
value: '1AM'
|
|
413
|
-
},
|
|
414
|
-
'02': {
|
|
415
|
-
value: '2AM'
|
|
416
|
-
},
|
|
417
|
-
'03': {
|
|
418
|
-
value: '3AM'
|
|
419
|
-
},
|
|
420
|
-
'04': {
|
|
421
|
-
value: '4AM'
|
|
422
|
-
},
|
|
423
|
-
'05': {
|
|
424
|
-
value: '5AM'
|
|
425
|
-
},
|
|
426
|
-
'06': {
|
|
427
|
-
value: '6AM'
|
|
428
|
-
},
|
|
429
|
-
'07': {
|
|
430
|
-
value: '7AM'
|
|
431
|
-
},
|
|
432
|
-
'08': {
|
|
433
|
-
value: '8AM'
|
|
434
|
-
},
|
|
435
|
-
'09': {
|
|
436
|
-
value: '9AM'
|
|
437
|
-
},
|
|
438
|
-
10: {
|
|
439
|
-
value: '10AM'
|
|
440
|
-
},
|
|
441
|
-
11: {
|
|
442
|
-
value: '11AM'
|
|
443
|
-
},
|
|
444
|
-
12: {
|
|
445
|
-
value: '12PM'
|
|
446
|
-
},
|
|
447
|
-
13: {
|
|
448
|
-
value: '1PM'
|
|
449
|
-
},
|
|
450
|
-
14: {
|
|
451
|
-
value: '2PM'
|
|
452
|
-
},
|
|
453
|
-
15: {
|
|
454
|
-
value: '3PM'
|
|
455
|
-
},
|
|
456
|
-
16: {
|
|
457
|
-
value: '4PM'
|
|
458
|
-
},
|
|
459
|
-
17: {
|
|
460
|
-
value: '5PM'
|
|
461
|
-
},
|
|
462
|
-
18: {
|
|
463
|
-
value: '6PM'
|
|
464
|
-
},
|
|
465
|
-
19: {
|
|
466
|
-
value: '7PM'
|
|
467
|
-
},
|
|
468
|
-
20: {
|
|
469
|
-
value: '8PM'
|
|
470
|
-
},
|
|
471
|
-
21: {
|
|
472
|
-
value: '9PM'
|
|
473
|
-
},
|
|
474
|
-
22: {
|
|
475
|
-
value: '10PM'
|
|
476
|
-
},
|
|
477
|
-
23: {
|
|
478
|
-
value: '11PM'
|
|
479
|
-
},
|
|
480
|
-
24: {
|
|
481
|
-
value: '12PM'
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
const uniqueData = {};
|
|
485
|
-
const response = await matomoConnect.init(matomoConnect.GetVisitTimePerLocalTime, 'day', "".concat(this.START_DATE.format('YYYY-MM-DD'), ",").concat(this.CURRENT_DATE.format('YYYY-MM-DD')));
|
|
486
|
-
Object.keys(response).forEach(key => {
|
|
487
|
-
const time = new Moment(key);
|
|
488
|
-
response[key].forEach((hour, k) => {
|
|
489
|
-
const day = time.format('ddd').toUpperCase();
|
|
490
|
-
const uniqueId = "".concat(day, "-").concat(hour.label);
|
|
491
|
-
if (uniqueData[uniqueId] !== undefined) {
|
|
492
|
-
const datum = uniqueData[uniqueId];
|
|
493
|
-
// calculate an average value for all redundant data
|
|
494
|
-
datum.value = (datum.dataCount * datum.value + hour.nb_uniq_visitors) / (datum.dataCount + 1);
|
|
495
|
-
datum.dataCount += 1;
|
|
496
|
-
} else {
|
|
497
|
-
uniqueData[uniqueId] = {
|
|
498
|
-
group: day,
|
|
499
|
-
variable: periods[hour.label].value,
|
|
500
|
-
value: hour.nb_uniq_visitors,
|
|
501
|
-
dataCount: 1
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
});
|
|
506
|
-
const data = Object.keys(uniqueData).map(uniqueId => {
|
|
507
|
-
const datum = uniqueData[uniqueId];
|
|
508
|
-
return {
|
|
509
|
-
group: datum.group,
|
|
510
|
-
variable: datum.variable,
|
|
511
|
-
value: datum.value
|
|
512
|
-
};
|
|
513
|
-
});
|
|
514
|
-
return data;
|
|
515
|
-
}
|
|
516
|
-
static getPercent(number, total) {
|
|
517
|
-
let percent = number * 100 / total;
|
|
518
|
-
percent = parseFloat(percent).toFixed(2);
|
|
519
|
-
return isNaN(parseFloat(percent)) ? 0 : parseFloat(percent);
|
|
520
|
-
}
|
|
521
|
-
static getIncrease() {
|
|
522
|
-
let min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
523
|
-
let max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
524
|
-
let increase = max - min;
|
|
525
|
-
increase = increase / min * 100;
|
|
526
|
-
return increase === Infinity && increase > 100 ? 100 : increase;
|
|
527
|
-
}
|
|
528
|
-
static getTimeSpent(value) {
|
|
529
|
-
let hours = '';
|
|
530
|
-
let minutes = '';
|
|
531
|
-
if (value.format('H') !== 0) {
|
|
532
|
-
hours = "".concat(value.format('H'), "h ");
|
|
533
|
-
}
|
|
534
|
-
if (value.format('m') !== 0) {
|
|
535
|
-
minutes = "".concat(value.format('m'), "m ");
|
|
536
|
-
}
|
|
537
|
-
return "".concat(hours).concat(minutes).concat(value.format('s'), "s");
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
exports.Analytic = Analytic;
|
|
541
|
-
var _default = exports.default = Analytic;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.ChartContainer = void 0;
|
|
7
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
-
var _ComponentWrapper = _interopRequireDefault(require("../ComponentWrapper/ComponentWrapper.styles"));
|
|
9
|
-
var _theme = _interopRequireDefault(require("../../styles/theme"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const colorTheme = props => ({
|
|
12
|
-
blue: {
|
|
13
|
-
primary: _theme.default.cPrimary,
|
|
14
|
-
dark: _theme.default.cPrimaryDark
|
|
15
|
-
},
|
|
16
|
-
red: {
|
|
17
|
-
primary: _theme.default.cWarning,
|
|
18
|
-
dark: _theme.default.cWarningDark
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
const ChartContainer = exports.ChartContainer = (0, _styledComponents.default)(_ComponentWrapper.default).withConfig({
|
|
22
|
-
displayName: "Analyticstyles__ChartContainer",
|
|
23
|
-
componentId: "sc-wgv3ti-0"
|
|
24
|
-
})([".slick-arrow{width:64px;height:48px;background:", ";z-index:10;transition:0.3s ease background;margin-top:10px;&:hover,&:focus{background:", ";&::before{color:", " !important;}}}.slick-arrow.slick-prev{top:auto;left:auto;bottom:0;right:64px;transform:translateY(100%);}.slick-arrow.slick-next{top:auto;left:auto;bottom:0;right:0;transform:translateY(100%);border-left:1px solid ", ";}"], props => colorTheme(props)[props.colorTheme].primary, props => colorTheme(props)[props.colorTheme].dark, props => _theme.default.cWhite, props => colorTheme(props)[props.colorTheme].dark);
|
|
25
|
-
var _default = exports.default = ChartContainer;
|