@servicetitan/marketing-ui 5.9.0 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ads/ads-stat.js +21 -10
- package/dist/components/ads/ads-stat.js.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-chart.js +118 -6
- package/dist/components/charts/funnel-chart/components/funnel-chart.js.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-chart.module.less.d.ts +9 -0
- package/dist/components/charts/funnel-chart/components/funnel-svg.js +62 -12
- package/dist/components/charts/funnel-chart/components/funnel-svg.js.map +1 -1
- package/dist/components/charts/funnel-chart/index.js +1 -0
- package/dist/components/charts/funnel-chart/index.js.map +1 -1
- package/dist/components/charts/funnel-chart/utils/const.js +1 -0
- package/dist/components/charts/funnel-chart/utils/const.js.map +1 -1
- package/dist/components/charts/funnel-chart/utils/interface.js +2 -1
- package/dist/components/charts/funnel-chart/utils/interface.js.map +1 -1
- package/dist/components/charts/line-chart/components/body.js +105 -16
- package/dist/components/charts/line-chart/components/body.js.map +1 -1
- package/dist/components/charts/line-chart/components/body.module.less.d.ts +4 -0
- package/dist/components/charts/line-chart/components/container.js +12 -4
- package/dist/components/charts/line-chart/components/container.js.map +1 -1
- package/dist/components/charts/line-chart/components/hover-popover.js +56 -13
- package/dist/components/charts/line-chart/components/hover-popover.js.map +1 -1
- package/dist/components/charts/line-chart/components/hover-popover.module.less.d.ts +5 -0
- package/dist/components/charts/line-chart/components/sidebar.js +35 -5
- package/dist/components/charts/line-chart/components/sidebar.js.map +1 -1
- package/dist/components/charts/line-chart/components/sidebar.module.less.d.ts +13 -0
- package/dist/components/charts/line-chart/components/stuff.js +73 -32
- package/dist/components/charts/line-chart/components/stuff.js.map +1 -1
- package/dist/components/charts/line-chart/components/stuff.module.less.d.ts +6 -0
- package/dist/components/charts/line-chart/components/svg-bars.js +58 -26
- package/dist/components/charts/line-chart/components/svg-bars.js.map +1 -1
- package/dist/components/charts/line-chart/components/svg-body.js +52 -11
- package/dist/components/charts/line-chart/components/svg-body.js.map +1 -1
- package/dist/components/charts/line-chart/components/svg-lines.js +46 -27
- package/dist/components/charts/line-chart/components/svg-lines.js.map +1 -1
- package/dist/components/charts/line-chart/components/svg.module.less.d.ts +5 -0
- package/dist/components/charts/line-chart/index.js +1 -0
- package/dist/components/charts/line-chart/index.js.map +1 -1
- package/dist/components/charts/line-chart/stores/line-chart.store.js +98 -137
- package/dist/components/charts/line-chart/stores/line-chart.store.js.map +1 -1
- package/dist/components/charts/line-chart/stores/svg.store.js +66 -108
- package/dist/components/charts/line-chart/stores/svg.store.js.map +1 -1
- package/dist/components/charts/line-chart/utils/const.js +8 -7
- package/dist/components/charts/line-chart/utils/const.js.map +1 -1
- package/dist/components/charts/line-chart/utils/formatters.js +13 -11
- package/dist/components/charts/line-chart/utils/formatters.js.map +1 -1
- package/dist/components/charts/line-chart/utils/interfaces.js +2 -1
- package/dist/components/charts/line-chart/utils/interfaces.js.map +1 -1
- package/dist/components/charts/line-chart/utils/internal-interfaces.js +2 -1
- package/dist/components/charts/line-chart/utils/internal-interfaces.js.map +1 -1
- package/dist/components/charts/line-chart/utils/key.js +2 -1
- package/dist/components/charts/line-chart/utils/key.js.map +1 -1
- package/dist/components/charts/line-chart/utils/labels.js +50 -46
- package/dist/components/charts/line-chart/utils/labels.js.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.js +60 -6
- package/dist/components/charts/pie-chart/components/pie-chart.js.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.module.less.d.ts +3 -0
- package/dist/components/charts/pie-chart/components/pie.js +176 -39
- package/dist/components/charts/pie-chart/components/pie.js.map +1 -1
- package/dist/components/charts/pie-chart/index.js +2 -0
- package/dist/components/charts/pie-chart/index.js.map +1 -1
- package/dist/components/charts/pie-chart/utils/const.js +55 -39
- package/dist/components/charts/pie-chart/utils/const.js.map +1 -1
- package/dist/components/charts/pie-chart/utils/interface.js +2 -1
- package/dist/components/charts/pie-chart/utils/interface.js.map +1 -1
- package/dist/components/image-cropper/image-cropper.js +74 -88
- package/dist/components/image-cropper/image-cropper.js.map +1 -1
- package/dist/components/stat/stat-card.js +68 -22
- package/dist/components/stat/stat-card.js.map +1 -1
- package/dist/components/stat/stat-card.module.less.d.ts +5 -0
- package/dist/components/stat/stat-extended-card.js +76 -4
- package/dist/components/stat/stat-extended-card.js.map +1 -1
- package/dist/components/ui/action-button/action-button.js +33 -7
- package/dist/components/ui/action-button/action-button.js.map +1 -1
- package/dist/components/ui/action-button/action-button.module.less.d.ts +9 -0
- package/dist/components/ui/action-button/index.js +1 -0
- package/dist/components/ui/action-button/index.js.map +1 -1
- package/dist/components/ui/centered-spinner/centered-spinner.js +20 -2
- package/dist/components/ui/centered-spinner/centered-spinner.js.map +1 -1
- package/dist/components/ui/date-range-picker/date-range-picker.js +71 -35
- package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/ui/date-range-picker/date-range-picker.module.less.d.ts +4 -0
- package/dist/components/ui/disabled-button.js +12 -3
- package/dist/components/ui/disabled-button.js.map +1 -1
- package/dist/components/ui/label-with-hint/label-with-hint.js +23 -1
- package/dist/components/ui/label-with-hint/label-with-hint.js.map +1 -1
- package/dist/components/ui/line-text/index.js +1 -0
- package/dist/components/ui/line-text/index.js.map +1 -1
- package/dist/components/ui/line-text/line-text.js +71 -12
- package/dist/components/ui/line-text/line-text.js.map +1 -1
- package/dist/components/ui/line-text/line-text.module.less.d.ts +6 -0
- package/dist/components/ui/title-popover/index.js +1 -0
- package/dist/components/ui/title-popover/index.js.map +1 -1
- package/dist/components/ui/title-popover/title-popover.js +78 -69
- package/dist/components/ui/title-popover/title-popover.js.map +1 -1
- package/dist/components/ui/title-popover/title-popover.module.less.d.ts +3 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/ads-texts.js +2 -1
- package/dist/utils/ads-texts.js.map +1 -1
- package/dist/utils/date/date-range-picker-options.js +90 -68
- package/dist/utils/date/date-range-picker-options.js.map +1 -1
- package/dist/utils/date/date-range-picker-state.js +42 -43
- package/dist/utils/date/date-range-picker-state.js.map +1 -1
- package/dist/utils/date/date-tenant.js +4 -6
- package/dist/utils/date/date-tenant.js.map +1 -1
- package/dist/utils/date/date.js +5 -9
- package/dist/utils/date/date.js.map +1 -1
- package/dist/utils/date/index.js +1 -0
- package/dist/utils/date/index.js.map +1 -1
- package/dist/utils/format-big-numbers.js +11 -6
- package/dist/utils/format-big-numbers.js.map +1 -1
- package/dist/utils/formatters.js +8 -7
- package/dist/utils/formatters.js.map +1 -1
- package/dist/utils/helpers.js +9 -12
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/marketing-parner-handlers.js +9 -12
- package/dist/utils/marketing-parner-handlers.js.map +1 -1
- package/dist/utils/string-case.js +1 -0
- package/dist/utils/string-case.js.map +1 -1
- package/dist/utils/use-client-rect.js +19 -19
- package/dist/utils/use-client-rect.js.map +1 -1
- package/dist/utils/use-target-range-store.js +7 -6
- package/dist/utils/use-target-range-store.js.map +1 -1
- package/package.json +11 -11
- package/dist/components/charts/funnel-chart/funnel-chart.stories.js +0 -76
- package/dist/components/charts/funnel-chart/funnel-chart.stories.js.map +0 -1
- package/dist/components/charts/line-chart/line-chart.stories.js +0 -225
- package/dist/components/charts/line-chart/line-chart.stories.js.map +0 -1
- package/dist/components/charts/pie-chart/pie-chart.stories.js +0 -22
- package/dist/components/charts/pie-chart/pie-chart.stories.js.map +0 -1
- package/dist/components/image-cropper/image-cropper.stories.js +0 -39
- package/dist/components/image-cropper/image-cropper.stories.js.map +0 -1
- package/dist/components/stat/stat-cards.stories.js +0 -16
- package/dist/components/stat/stat-cards.stories.js.map +0 -1
- package/dist/components/stat/stat-extended-card.stories.js +0 -12
- package/dist/components/stat/stat-extended-card.stories.js.map +0 -1
- package/dist/components/ui/action-button/action-button.stories.js +0 -11
- package/dist/components/ui/action-button/action-button.stories.js.map +0 -1
- package/dist/components/ui/centered-spinner/centered-spinner.stories.js +0 -12
- package/dist/components/ui/centered-spinner/centered-spinner.stories.js.map +0 -1
- package/dist/components/ui/date-range-picker/date-range-picker.stories.js +0 -18
- package/dist/components/ui/date-range-picker/date-range-picker.stories.js.map +0 -1
- package/dist/components/ui/label-with-hint/label-with-hint.stories.js +0 -12
- package/dist/components/ui/label-with-hint/label-with-hint.stories.js.map +0 -1
- package/dist/components/ui/line-text/line-text-body.stories.js +0 -11
- package/dist/components/ui/line-text/line-text-body.stories.js.map +0 -1
- package/dist/components/ui/line-text/line-text-head.stories.js +0 -11
- package/dist/components/ui/line-text/line-text-head.stories.js.map +0 -1
- package/dist/components/ui/title-popover/title-popover.stories.js +0 -17
- package/dist/components/ui/title-popover/title-popover.stories.js.map +0 -1
- package/dist/utils/__tests__/format-big-numbers.test.js +0 -16
- package/dist/utils/__tests__/format-big-numbers.test.js.map +0 -1
- package/dist/utils/__tests__/formatters.test.js +0 -45
- package/dist/utils/__tests__/formatters.test.js.map +0 -1
- package/dist/utils/__tests__/helpers.test.js +0 -31
- package/dist/utils/__tests__/helpers.test.js.map +0 -1
- package/dist/utils/__tests__/string-case.test.js +0 -20
- package/dist/utils/__tests__/string-case.test.js.map +0 -1
- package/dist/utils/date/__mocks__/date-mock.js +0 -19
- package/dist/utils/date/__mocks__/date-mock.js.map +0 -1
- package/dist/utils/date/__tests__/date-range-picker.test.js +0 -93
- package/dist/utils/date/__tests__/date-range-picker.test.js.map +0 -1
- package/dist/utils/date/__tests__/date-tenant.test.js +0 -29
- package/dist/utils/date/__tests__/date-tenant.test.js.map +0 -1
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
2
15
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
16
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for
|
|
17
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
|
|
19
|
+
}
|
|
20
|
+
function _ts_metadata(k, v) {
|
|
8
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
}
|
|
22
|
+
}
|
|
10
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
24
|
import classNames from 'classnames';
|
|
12
25
|
import { observer } from 'mobx-react';
|
|
@@ -14,53 +27,7 @@ import { createRef, Component } from 'react';
|
|
|
14
27
|
import { observable, action, makeObservable } from 'mobx';
|
|
15
28
|
import { Popover, Stack, BodyText, Icon } from '@servicetitan/design-system';
|
|
16
29
|
import * as Styles from './title-popover.module.less';
|
|
17
|
-
|
|
18
|
-
constructor(props) {
|
|
19
|
-
super(props);
|
|
20
|
-
Object.defineProperty(this, "isOpen", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: false
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(this, "wrapElem", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: createRef()
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(this, "toggle", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: () => {
|
|
37
|
-
this.isOpen = !this.isOpen;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(this, "close", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
writable: true,
|
|
44
|
-
value: () => {
|
|
45
|
-
this.isOpen = false;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(this, "handleClick", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
configurable: true,
|
|
51
|
-
writable: true,
|
|
52
|
-
value: (event) => {
|
|
53
|
-
if (!this.wrapElem.current) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const isClickedInside = this.wrapElem.current.contains(event.target);
|
|
57
|
-
if (!isClickedInside) {
|
|
58
|
-
this.close();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
makeObservable(this);
|
|
63
|
-
}
|
|
30
|
+
export class TitlePopover extends Component {
|
|
64
31
|
componentDidMount() {
|
|
65
32
|
window.addEventListener('click', this.handleClick);
|
|
66
33
|
}
|
|
@@ -69,28 +36,70 @@ let TitlePopover = class TitlePopover extends Component {
|
|
|
69
36
|
}
|
|
70
37
|
render() {
|
|
71
38
|
const { text, children } = this.props;
|
|
72
|
-
return
|
|
39
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
40
|
+
ref: this.wrapElem,
|
|
41
|
+
className: "qa-title-popover",
|
|
42
|
+
children: /*#__PURE__*/ _jsx(Popover, {
|
|
43
|
+
className: classNames(Styles.popover, 'qa-title-popover'),
|
|
44
|
+
width: "xs",
|
|
45
|
+
open: this.isOpen,
|
|
46
|
+
direction: "br",
|
|
47
|
+
trigger: /*#__PURE__*/ _jsxs(Stack, {
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
className: "qa-title-popover-button cursor-pointer",
|
|
50
|
+
onClick: this.toggle,
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ _jsx(BodyText, {
|
|
53
|
+
size: "large",
|
|
54
|
+
className: "qa-title-popover-text",
|
|
55
|
+
children: text
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
58
|
+
name: "expand_more",
|
|
59
|
+
size: 20,
|
|
60
|
+
className: "m-l-1 qa-title-popover-icon"
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
}),
|
|
64
|
+
children: children
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
constructor(props){
|
|
69
|
+
super(props), _define_property(this, "isOpen", false), _define_property(this, "wrapElem", /*#__PURE__*/ createRef()), _define_property(this, "toggle", ()=>{
|
|
70
|
+
this.isOpen = !this.isOpen;
|
|
71
|
+
}), _define_property(this, "close", ()=>{
|
|
72
|
+
this.isOpen = false;
|
|
73
|
+
}), _define_property(this, "handleClick", (event)=>{
|
|
74
|
+
if (!this.wrapElem.current) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const isClickedInside = this.wrapElem.current.contains(event.target);
|
|
78
|
+
if (!isClickedInside) {
|
|
79
|
+
this.close();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
makeObservable(this);
|
|
73
83
|
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
observable
|
|
77
|
-
__metadata("design:type", Object)
|
|
84
|
+
}
|
|
85
|
+
_ts_decorate([
|
|
86
|
+
observable
|
|
78
87
|
], TitlePopover.prototype, "isOpen", void 0);
|
|
79
|
-
|
|
80
|
-
action
|
|
81
|
-
__metadata("design:type", Object)
|
|
88
|
+
_ts_decorate([
|
|
89
|
+
action
|
|
82
90
|
], TitlePopover.prototype, "toggle", void 0);
|
|
83
|
-
|
|
84
|
-
action
|
|
85
|
-
__metadata("design:type", Object)
|
|
91
|
+
_ts_decorate([
|
|
92
|
+
action
|
|
86
93
|
], TitlePopover.prototype, "close", void 0);
|
|
87
|
-
|
|
88
|
-
action
|
|
89
|
-
__metadata("design:type", Object)
|
|
94
|
+
_ts_decorate([
|
|
95
|
+
action
|
|
90
96
|
], TitlePopover.prototype, "handleClick", void 0);
|
|
91
|
-
TitlePopover =
|
|
97
|
+
TitlePopover = _ts_decorate([
|
|
92
98
|
observer,
|
|
93
|
-
|
|
99
|
+
_ts_metadata("design:type", Function),
|
|
100
|
+
_ts_metadata("design:paramtypes", [
|
|
101
|
+
typeof TitlePopoverProps === "undefined" ? Object : TitlePopoverProps
|
|
102
|
+
])
|
|
94
103
|
], TitlePopover);
|
|
95
|
-
|
|
104
|
+
|
|
96
105
|
//# sourceMappingURL=title-popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/title-popover/title-popover.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { observer } from 'mobx-react';\nimport { createRef, Component, PropsWithChildren } from 'react';\nimport { observable, action, makeObservable } from 'mobx';\nimport { Popover, Stack, BodyText, Icon } from '@servicetitan/design-system';\nimport * as Styles from './title-popover.module.less';\n\ninterface TitlePopoverProps extends PropsWithChildren<{}> {\n text?: string;\n}\n\n@observer\nexport class TitlePopover extends Component<TitlePopoverProps> {\n @observable isOpen = false;\n\n wrapElem = createRef<HTMLDivElement>();\n\n constructor(props: TitlePopoverProps) {\n super(props);\n makeObservable(this);\n }\n\n @action\n toggle = () => {\n this.isOpen = !this.isOpen;\n };\n\n @action\n close = () => {\n this.isOpen = false;\n };\n\n @action\n handleClick = (event: MouseEvent) => {\n if (!this.wrapElem.current) {\n return;\n }\n\n const isClickedInside = this.wrapElem.current.contains(event.target as Node);\n\n if (!isClickedInside) {\n this.close();\n }\n };\n\n componentDidMount() {\n window.addEventListener('click', this.handleClick);\n }\n\n componentWillUnmount() {\n window.removeEventListener('click', this.handleClick);\n }\n\n render() {\n const { text, children } = this.props;\n\n return (\n <div ref={this.wrapElem} className=\"qa-title-popover\">\n <Popover\n className={classNames(Styles.popover, 'qa-title-popover')}\n width=\"xs\"\n open={this.isOpen}\n direction=\"br\"\n trigger={\n <Stack\n alignItems=\"center\"\n className=\"qa-title-popover-button cursor-pointer\"\n onClick={this.toggle}\n >\n <BodyText size=\"large\" className=\"qa-title-popover-text\">\n {text}\n </BodyText>\n <Icon\n name=\"expand_more\"\n size={20}\n className=\"m-l-1 qa-title-popover-icon\"\n />\n </Stack>\n }\n >\n {children}\n </Popover>\n </div>\n );\n }\n}\n"],"names":["classNames","observer","createRef","Component","observable","action","makeObservable","Popover","Stack","BodyText","Icon","Styles","TitlePopover","componentDidMount","window","addEventListener","handleClick","componentWillUnmount","removeEventListener","render","text","children","props","div","ref","wrapElem","className","popover","width","open","isOpen","direction","trigger","alignItems","onClick","toggle","size","name","close","event","current","isClickedInside","contains","target"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,gBAAgB,aAAa;AACpC,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,SAAS,EAAEC,SAAS,QAA2B,QAAQ;AAChE,SAASC,UAAU,EAAEC,MAAM,EAAEC,cAAc,QAAQ,OAAO;AAC1D,SAASC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,8BAA8B;AAC7E,YAAYC,YAAY,8BAA8B;AAOtD,OAAO,MAAMC,qBAAqBT;IAiC9BU,oBAAoB;QAChBC,OAAOC,gBAAgB,CAAC,SAAS,IAAI,CAACC,WAAW;IACrD;IAEAC,uBAAuB;QACnBH,OAAOI,mBAAmB,CAAC,SAAS,IAAI,CAACF,WAAW;IACxD;IAEAG,SAAS;QACL,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAG,IAAI,CAACC,KAAK;QAErC,qBACI,KAACC;YAAIC,KAAK,IAAI,CAACC,QAAQ;YAAEC,WAAU;sBAC/B,cAAA,KAACnB;gBACGmB,WAAW1B,WAAWW,OAAOgB,OAAO,EAAE;gBACtCC,OAAM;gBACNC,MAAM,IAAI,CAACC,MAAM;gBACjBC,WAAU;gBACVC,uBACI,MAACxB;oBACGyB,YAAW;oBACXP,WAAU;oBACVQ,SAAS,IAAI,CAACC,MAAM;;sCAEpB,KAAC1B;4BAAS2B,MAAK;4BAAQV,WAAU;sCAC5BN;;sCAEL,KAACV;4BACG2B,MAAK;4BACLD,MAAM;4BACNV,WAAU;;;;0BAKrBL;;;IAIjB;IAnEA,YAAYC,KAAwB,CAAE;QAClC,KAAK,CAACA,QALV,uBAAYQ,UAAS,QAErBL,uBAAAA,0BAAWvB,cAOX,uBACAiC,UAAS;YACL,IAAI,CAACL,MAAM,GAAG,CAAC,IAAI,CAACA,MAAM;QAC9B,IAEA,uBACAQ,SAAQ;YACJ,IAAI,CAACR,MAAM,GAAG;QAClB,IAEA,uBACAd,eAAc,CAACuB;YACX,IAAI,CAAC,IAAI,CAACd,QAAQ,CAACe,OAAO,EAAE;gBACxB;YACJ;YAEA,MAAMC,kBAAkB,IAAI,CAAChB,QAAQ,CAACe,OAAO,CAACE,QAAQ,CAACH,MAAMI,MAAM;YAEnE,IAAI,CAACF,iBAAiB;gBAClB,IAAI,CAACH,KAAK;YACd;QACJ;QAxBIhC,eAAe,IAAI;IACvB;AAiEJ"}
|
package/dist/index.js
CHANGED
|
@@ -14,5 +14,7 @@ export * from './utils/use-client-rect';
|
|
|
14
14
|
export * from './utils/helpers';
|
|
15
15
|
export * from './utils/format-big-numbers';
|
|
16
16
|
export * from './utils/use-target-range-store';
|
|
17
|
-
|
|
17
|
+
import * as _marketingRedirector from './utils/marketing-parner-handlers';
|
|
18
|
+
export { _marketingRedirector as marketingRedirector };
|
|
19
|
+
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './components/stat/stat-card';\nexport * from './components/stat/stat-extended-card';\nexport * from './components/ads/ads-stat';\nexport * from './components/ui/action-button';\nexport * from './components/ui/centered-spinner/centered-spinner';\nexport * from './components/ui/label-with-hint/label-with-hint';\nexport * from './components/ui/line-text';\nexport * from './components/ui/title-popover';\nexport * from './components/image-cropper/image-cropper';\n\nexport * from './utils/ads-texts';\nexport * from './utils/formatters';\nexport * from './utils/string-case';\nexport * from './utils/use-client-rect';\nexport * from './utils/helpers';\nexport * from './utils/format-big-numbers';\nexport * from './utils/use-target-range-store';\nexport * as marketingRedirector from './utils/marketing-parner-handlers';\n"],"names":["marketingRedirector"],"mappings":"AAAA,cAAc,8BAA8B;AAC5C,cAAc,uCAAuC;AACrD,cAAc,4BAA4B;AAC1C,cAAc,gCAAgC;AAC9C,cAAc,oDAAoD;AAClE,cAAc,kDAAkD;AAChE,cAAc,4BAA4B;AAC1C,cAAc,gCAAgC;AAC9C,cAAc,2CAA2C;AAEzD,cAAc,oBAAoB;AAClC,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,0BAA0B;AACxC,cAAc,kBAAkB;AAChC,cAAc,6BAA6B;AAC3C,cAAc,iCAAiC;AAC/C,sCAAqC,oCAAoC;AAAzE,SAAO,wBAAKA,mBAAmB,GAA0C"}
|
package/dist/utils/ads-texts.js
CHANGED
|
@@ -35,6 +35,7 @@ export const adsStatDescriptions = {
|
|
|
35
35
|
newCustomerLeadRate: 'The percentage of Leads that came from someone not already part of your database. If this number is low, then you are mostly reaching your existing customers with marketing',
|
|
36
36
|
existingCustomerLeads: 'Leads that came from someone already in your database, ie. you have ran a job for them previously',
|
|
37
37
|
ranJobsFromMarketing: 'Ran Jobs with Campaigns/Categories that match the filter selected at the top of this page',
|
|
38
|
-
returnOnInvestment: 'Shown as a percentage, this is the ratio of what revenue you make from marketing versus what you spend on your marketing activity'
|
|
38
|
+
returnOnInvestment: 'Shown as a percentage, this is the ratio of what revenue you make from marketing versus what you spend on your marketing activity'
|
|
39
39
|
};
|
|
40
|
+
|
|
40
41
|
//# sourceMappingURL=ads-texts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/ads-texts.tsx"],"sourcesContent":["export type AdsStatType =\n | 'impressions'\n | 'views'\n | 'clicks'\n | 'clickRate'\n | 'conversionRate'\n | 'closeRate'\n | 'sessions'\n | 'conversions'\n | 'allConversions'\n | 'transactions'\n | 'bookedJobs'\n | 'ranJobs'\n | 'ranRate'\n | 'leads'\n | 'leadRate'\n | 'completedJobs'\n | 'soldJobs'\n | 'revenue'\n | 'marketingRevenue'\n | 'expenseToIncomeRatio'\n | 'costPerBookedJob'\n | 'costPerLead'\n | 'costPerRanJob'\n | 'costPerSoldJob'\n | 'costPerConversion'\n | 'cost'\n | 'averageCostPerClick'\n | 'averageJobValue'\n | 'roi'\n | 'bookingRate'\n | 'callBookingRate'\n | 'opportunityRate'\n | 'newCustomerLeads'\n | 'newCustomerLeadRate'\n | 'ranJobsFromMarketing'\n | 'existingCustomerLeads'\n | 'returnOnInvestment';\n\nexport const adsStatDescriptions: Record<AdsStatType, string> = {\n impressions: 'The number of times an ad was seen',\n views: 'The number of impressions where the ad was on screen for more than 1 second with more than 50% of the ad actually visible',\n clicks: 'The number of times an ad was clicked, taking a searcher to a landing page',\n sessions:\n \"The number of times your website registered a visitor. This can differ from clicks because clicks can include clicks on extensions on the ad that don't lead to the website, like call extensions. Also, some clickers immediately leave the website before the website can register a session\",\n conversions:\n 'The number of people who took a predesignated action resulting from a marketing campaign. This typically includes Phone Calls, Form Submissions, Appointments Booked, and Live Chats',\n allConversions:\n 'Every conversion reported by Google Ads, including those that are marked to NOT be included in the Conversions column',\n transactions: 'The number of completed jobs where revenue was generated',\n leads: 'Phone Calls that are longer than 60 seconds and not dismissed, plus online bookings and manual jobs',\n ranJobs:\n 'A booking where a truck was dispatched. On the marketing dashboard, we show Ran Jobs that have marketing attribution',\n ranRate:\n 'The percentage of Booked Jobs that turned into Ran Jobs. This is a measure of how many booked jobs are not cancelled or left unfulfilled',\n bookedJobs: 'Leads that were booked/scheduled for a job',\n completedJobs: 'Scheduled jobs that were actually completed',\n soldJobs:\n 'Jobs that have estimates that were closed. This is useful in determining how many of your ran jobs are turning into actual sales',\n revenue: 'The total of all invoice items from all jobs that have been completed',\n marketingRevenue:\n 'The total of all invoice items from marketing attributed jobs that have been completed',\n expenseToIncomeRatio:\n 'Shown as a percentage, this is the ratio of what you spend on marketing versus what you make from your marketing activity',\n costPerLead: 'How much it costs you to generate a lead',\n costPerBookedJob: 'How much it costs you to generate a Booked Job',\n costPerRanJob:\n 'How much it costs you to generate a Ran Job. Ran Jobs are bookings where a truck was dispatched',\n costPerSoldJob: 'How much it costs you to generate a sold estimate',\n costPerConversion: 'How much you are willing to pay to generate a conversion',\n averageCostPerClick:\n 'The amount it costs each time an ad is clicked, on average. This varies depending on keyword, region, ad position, and your set willingness to pay (Max CPC)',\n cost: 'The amount spent on marketing for the selected time range',\n\n clickRate: 'The percentage rate at which a user views and clicks on your ads',\n conversionRate:\n 'The percentage of people who visit your website and convert. This is an indicator that you are either targeting the wrong audience or that your website/landing page needs improvement',\n closeRate:\n 'A measure of how many leads are actually turning into customers. This could be low due to poor targeting (getting the wrong type of leads) or office performance (failing to close deals)',\n leadRate:\n 'The percentage of calls that can be qualified as a lead. This is a useful metric to determine the quality of lead that a campaign is generating',\n averageJobValue: 'The average income generated across all your jobs',\n roi: 'The number of dollars generated from each dollar of marketing spend. For example, and ROI of 5x means that every $1 spent on marketing leads to $5 of revenue',\n bookingRate: 'The percentage of leads that resulted in Booked Job',\n callBookingRate: 'The percentage of lead calls that resulted in Booked Jobs',\n opportunityRate: 'The percentage of Ran Jobs that resulted in an Opportunity',\n newCustomerLeads:\n 'Leads that came from someone not already part of your database, ie. you have never ran a job for them before',\n newCustomerLeadRate:\n 'The percentage of Leads that came from someone not already part of your database. If this number is low, then you are mostly reaching your existing customers with marketing',\n existingCustomerLeads:\n 'Leads that came from someone already in your database, ie. you have ran a job for them previously',\n ranJobsFromMarketing:\n 'Ran Jobs with Campaigns/Categories that match the filter selected at the top of this page',\n returnOnInvestment:\n 'Shown as a percentage, this is the ratio of what revenue you make from marketing versus what you spend on your marketing activity',\n};\n"],"names":["adsStatDescriptions","impressions","views","clicks","sessions","conversions","allConversions","transactions","leads","ranJobs","ranRate","bookedJobs","completedJobs","soldJobs","revenue","marketingRevenue","expenseToIncomeRatio","costPerLead","costPerBookedJob","costPerRanJob","costPerSoldJob","costPerConversion","averageCostPerClick","cost","clickRate","conversionRate","closeRate","leadRate","averageJobValue","roi","bookingRate","callBookingRate","opportunityRate","newCustomerLeads","newCustomerLeadRate","existingCustomerLeads","ranJobsFromMarketing","returnOnInvestment"],"mappings":"AAuCA,OAAO,MAAMA,sBAAmD;IAC5DC,aAAa;IACbC,OAAO;IACPC,QAAQ;IACRC,UACI;IACJC,aACI;IACJC,gBACI;IACJC,cAAc;IACdC,OAAO;IACPC,SACI;IACJC,SACI;IACJC,YAAY;IACZC,eAAe;IACfC,UACI;IACJC,SAAS;IACTC,kBACI;IACJC,sBACI;IACJC,aAAa;IACbC,kBAAkB;IAClBC,eACI;IACJC,gBAAgB;IAChBC,mBAAmB;IACnBC,qBACI;IACJC,MAAM;IAENC,WAAW;IACXC,gBACI;IACJC,WACI;IACJC,UACI;IACJC,iBAAiB;IACjBC,KAAK;IACLC,aAAa;IACbC,iBAAiB;IACjBC,iBAAiB;IACjBC,kBACI;IACJC,qBACI;IACJC,uBACI;IACJC,sBACI;IACJC,oBACI;AACR,EAAE"}
|
|
@@ -1,36 +1,34 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
1
14
|
import { TenantDate } from './date-tenant';
|
|
2
15
|
import { dateRangesEqual, getComparisonDateRange } from './date';
|
|
3
16
|
/**
|
|
4
17
|
* base class for predefined date range options
|
|
5
18
|
*
|
|
6
19
|
* @note start date is inclusive and end date is exclusive for each option
|
|
7
|
-
*/
|
|
8
|
-
export class DateRangePickerOptions {
|
|
9
|
-
constructor() {
|
|
10
|
-
Object.defineProperty(this, "options", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: []
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "defaultOption", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
}
|
|
20
|
+
*/ export class DateRangePickerOptions {
|
|
23
21
|
get keys() {
|
|
24
|
-
return this.options.map(o
|
|
22
|
+
return this.options.map((o)=>o.key);
|
|
25
23
|
}
|
|
26
24
|
findOption(arg) {
|
|
27
25
|
if (!arg) {
|
|
28
26
|
return undefined;
|
|
29
27
|
}
|
|
30
28
|
if (typeof arg === 'string') {
|
|
31
|
-
return this.options.find(o
|
|
29
|
+
return this.options.find((o)=>o.key === arg);
|
|
32
30
|
}
|
|
33
|
-
for (const opt of this.options)
|
|
31
|
+
for (const opt of this.options){
|
|
34
32
|
if (dateRangesEqual(arg, opt.value)) {
|
|
35
33
|
return opt;
|
|
36
34
|
}
|
|
@@ -40,8 +38,12 @@ export class DateRangePickerOptions {
|
|
|
40
38
|
getComparisonDateRange(_range) {
|
|
41
39
|
return undefined;
|
|
42
40
|
}
|
|
41
|
+
constructor(){
|
|
42
|
+
_define_property(this, "options", []);
|
|
43
|
+
_define_property(this, "defaultOption", void 0);
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
|
-
const subtractDays = (dt, days)
|
|
46
|
+
const subtractDays = (dt, days)=>new Date(dt.getTime() - days * 86400000);
|
|
45
47
|
/**
|
|
46
48
|
* options wrapper in tenant timezone that is used in ads. it contain following options:
|
|
47
49
|
* Today
|
|
@@ -52,37 +54,27 @@ const subtractDays = (dt, days) => new Date(dt.getTime() - days * 86400000);
|
|
|
52
54
|
* Last Month
|
|
53
55
|
* Last 90 Days
|
|
54
56
|
* Current Year
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
start: new Date(range.start.getFullYear(), range.start.getMonth() - 1, 1),
|
|
76
|
-
end: range.start,
|
|
77
|
-
};
|
|
78
|
-
case 'currentYear':
|
|
79
|
-
return {
|
|
80
|
-
start: new Date(range.start.getFullYear() - 1, 0, 1),
|
|
81
|
-
end: range.start,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
return getComparisonDateRange(range);
|
|
57
|
+
*/ export class DateRangePickerOptionsTenantAds extends DateRangePickerOptions {
|
|
58
|
+
static create(tz, defaultOption) {
|
|
59
|
+
return new DateRangePickerOptionsTenantAds(tz, defaultOption);
|
|
60
|
+
}
|
|
61
|
+
constructor(tz, defaultOption = 'last30'){
|
|
62
|
+
super(), _define_property(this, "options", void 0), _define_property(this, "getComparisonDateRange", (range)=>{
|
|
63
|
+
const option = this.findOption(range);
|
|
64
|
+
switch(option === null || option === void 0 ? void 0 : option.key){
|
|
65
|
+
case 'currentMonth':
|
|
66
|
+
case 'lastMonth':
|
|
67
|
+
return {
|
|
68
|
+
start: new Date(range.start.getFullYear(), range.start.getMonth() - 1, 1),
|
|
69
|
+
end: range.start
|
|
70
|
+
};
|
|
71
|
+
case 'currentYear':
|
|
72
|
+
return {
|
|
73
|
+
start: new Date(range.start.getFullYear() - 1, 0, 1),
|
|
74
|
+
end: range.start
|
|
75
|
+
};
|
|
85
76
|
}
|
|
77
|
+
return getComparisonDateRange(range);
|
|
86
78
|
});
|
|
87
79
|
const todayTenant = TenantDate.tenantDateFromLocal(tz.UtcOffset);
|
|
88
80
|
const tomTenant = new Date(todayTenant.getFullYear(), todayTenant.getMonth(), todayTenant.getDate() + 1);
|
|
@@ -91,43 +83,73 @@ export class DateRangePickerOptionsTenantAds extends DateRangePickerOptions {
|
|
|
91
83
|
const lastMonTenant = new Date(todayTenant.getFullYear(), todayTenant.getMonth() - 1, 1);
|
|
92
84
|
const yearTenant = new Date(todayTenant.getFullYear(), 0, 1);
|
|
93
85
|
this.options = [
|
|
94
|
-
{
|
|
95
|
-
|
|
86
|
+
{
|
|
87
|
+
key: 'today',
|
|
88
|
+
value: {
|
|
89
|
+
start: todayTenant,
|
|
90
|
+
end: tomTenant
|
|
91
|
+
},
|
|
92
|
+
text: 'Today'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: 'yesterday',
|
|
96
|
+
value: {
|
|
97
|
+
start: yestTenant,
|
|
98
|
+
end: todayTenant
|
|
99
|
+
},
|
|
100
|
+
text: 'Yesterday'
|
|
101
|
+
},
|
|
96
102
|
{
|
|
97
103
|
key: 'last7',
|
|
98
|
-
value: {
|
|
99
|
-
|
|
104
|
+
value: {
|
|
105
|
+
start: subtractDays(todayTenant, 6),
|
|
106
|
+
end: tomTenant
|
|
107
|
+
},
|
|
108
|
+
text: 'Last 7 Days'
|
|
100
109
|
},
|
|
101
110
|
{
|
|
102
111
|
key: 'last30',
|
|
103
|
-
value: {
|
|
104
|
-
|
|
112
|
+
value: {
|
|
113
|
+
start: subtractDays(todayTenant, 29),
|
|
114
|
+
end: tomTenant
|
|
115
|
+
},
|
|
116
|
+
text: 'Last 30 Days'
|
|
105
117
|
},
|
|
106
118
|
{
|
|
107
119
|
key: 'currentMonth',
|
|
108
|
-
value: {
|
|
109
|
-
|
|
120
|
+
value: {
|
|
121
|
+
start: monTenant,
|
|
122
|
+
end: tomTenant
|
|
123
|
+
},
|
|
124
|
+
text: 'Current Month'
|
|
110
125
|
},
|
|
111
126
|
{
|
|
112
127
|
key: 'lastMonth',
|
|
113
|
-
value: {
|
|
114
|
-
|
|
128
|
+
value: {
|
|
129
|
+
start: lastMonTenant,
|
|
130
|
+
end: monTenant
|
|
131
|
+
},
|
|
132
|
+
text: 'Last Month'
|
|
115
133
|
},
|
|
116
134
|
{
|
|
117
135
|
key: 'last90',
|
|
118
|
-
value: {
|
|
119
|
-
|
|
136
|
+
value: {
|
|
137
|
+
start: subtractDays(todayTenant, 89),
|
|
138
|
+
end: tomTenant
|
|
139
|
+
},
|
|
140
|
+
text: 'Last 90 Days'
|
|
120
141
|
},
|
|
121
142
|
{
|
|
122
143
|
key: 'currentYear',
|
|
123
|
-
value: {
|
|
124
|
-
|
|
125
|
-
|
|
144
|
+
value: {
|
|
145
|
+
start: yearTenant,
|
|
146
|
+
end: tomTenant
|
|
147
|
+
},
|
|
148
|
+
text: 'Current Year'
|
|
149
|
+
}
|
|
126
150
|
];
|
|
127
151
|
this.defaultOption = defaultOption;
|
|
128
152
|
}
|
|
129
|
-
static create(tz, defaultOption) {
|
|
130
|
-
return new DateRangePickerOptionsTenantAds(tz, defaultOption);
|
|
131
|
-
}
|
|
132
153
|
}
|
|
154
|
+
|
|
133
155
|
//# sourceMappingURL=date-range-picker-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/date/date-range-picker-options.ts"],"sourcesContent":["import { TenantDate } from './date-tenant';\nimport { DateRange, dateRangesEqual, getComparisonDateRange } from './date';\n\nexport interface DateRangePickerOption<OptionKeys extends string> {\n key: OptionKeys;\n value: DateRange;\n text: string;\n}\n\n/**\n * base class for predefined date range options\n *\n * @note start date is inclusive and end date is exclusive for each option\n */\nexport abstract class DateRangePickerOptions<OptionKeys extends string> {\n options: DateRangePickerOption<OptionKeys>[] = [];\n defaultOption?: OptionKeys;\n\n get keys(): OptionKeys[] {\n return this.options.map(o => o.key);\n }\n\n findOption(key: undefined): undefined;\n findOption(key: OptionKeys): DateRangePickerOption<OptionKeys>;\n findOption(range: DateRange): DateRangePickerOption<OptionKeys> | undefined;\n findOption(arg?: DateRange | OptionKeys): DateRangePickerOption<OptionKeys> | undefined {\n if (!arg) {\n return undefined;\n }\n\n if (typeof arg === 'string') {\n return this.options.find(o => o.key === arg);\n }\n\n for (const opt of this.options) {\n if (dateRangesEqual(arg, opt.value)) {\n return opt;\n }\n }\n\n return undefined;\n }\n\n getComparisonDateRange(_range: DateRange): DateRange | undefined {\n return undefined;\n }\n}\n\nexport interface TenantTimezone {\n UtcOffset: number;\n}\n\nconst subtractDays = (dt: Date, days: number) => new Date(dt.getTime() - days * 86400000);\n\nexport type DateRangePickerOptionsTenantAdsTypes =\n | 'today'\n | 'yesterday'\n | 'last7'\n | 'last30'\n | 'last90'\n | 'currentMonth'\n | 'lastMonth'\n | 'currentYear';\n\n/**\n * options wrapper in tenant timezone that is used in ads. it contain following options:\n * Today\n * Yesterday\n * Last 7 Days\n * Last 30 Days\n * Current Month\n * Last Month\n * Last 90 Days\n * Current Year\n */\nexport class DateRangePickerOptionsTenantAds extends DateRangePickerOptions<DateRangePickerOptionsTenantAdsTypes> {\n readonly options: DateRangePickerOption<DateRangePickerOptionsTenantAdsTypes>[];\n\n private constructor(\n tz: TenantTimezone,\n defaultOption: DateRangePickerOptionsTenantAdsTypes = 'last30'\n ) {\n super();\n\n const todayTenant = TenantDate.tenantDateFromLocal(tz.UtcOffset);\n\n const tomTenant = new Date(\n todayTenant.getFullYear(),\n todayTenant.getMonth(),\n todayTenant.getDate() + 1\n );\n\n const yestTenant = new Date(\n todayTenant.getFullYear(),\n todayTenant.getMonth(),\n todayTenant.getDate() - 1\n );\n\n const monTenant = new Date(todayTenant.getFullYear(), todayTenant.getMonth(), 1);\n const lastMonTenant = new Date(todayTenant.getFullYear(), todayTenant.getMonth() - 1, 1);\n const yearTenant = new Date(todayTenant.getFullYear(), 0, 1);\n\n this.options = [\n { key: 'today', value: { start: todayTenant, end: tomTenant }, text: 'Today' },\n { key: 'yesterday', value: { start: yestTenant, end: todayTenant }, text: 'Yesterday' },\n {\n key: 'last7',\n value: { start: subtractDays(todayTenant, 6), end: tomTenant },\n text: 'Last 7 Days',\n },\n {\n key: 'last30',\n value: { start: subtractDays(todayTenant, 29), end: tomTenant },\n text: 'Last 30 Days',\n },\n {\n key: 'currentMonth',\n value: { start: monTenant, end: tomTenant },\n text: 'Current Month',\n },\n {\n key: 'lastMonth',\n value: { start: lastMonTenant, end: monTenant },\n text: 'Last Month',\n },\n {\n key: 'last90',\n value: { start: subtractDays(todayTenant, 89), end: tomTenant },\n text: 'Last 90 Days',\n },\n {\n key: 'currentYear',\n value: { start: yearTenant, end: tomTenant },\n text: 'Current Year',\n },\n ];\n\n this.defaultOption = defaultOption;\n }\n\n static create(\n tz: TenantTimezone,\n defaultOption?: DateRangePickerOptionsTenantAdsTypes\n ): DateRangePickerOptionsTenantAds {\n return new DateRangePickerOptionsTenantAds(tz, defaultOption);\n }\n\n getComparisonDateRange = (range: DateRange) => {\n const option = this.findOption(range);\n\n switch (option?.key) {\n case 'currentMonth':\n case 'lastMonth':\n return {\n start: new Date(range.start.getFullYear(), range.start.getMonth() - 1, 1),\n end: range.start,\n };\n case 'currentYear':\n return {\n start: new Date(range.start.getFullYear() - 1, 0, 1),\n end: range.start,\n };\n }\n\n return getComparisonDateRange(range);\n };\n}\n"],"names":["TenantDate","dateRangesEqual","getComparisonDateRange","DateRangePickerOptions","keys","options","map","o","key","findOption","arg","undefined","find","opt","value","_range","defaultOption","subtractDays","dt","days","Date","getTime","DateRangePickerOptionsTenantAds","create","tz","range","option","start","getFullYear","getMonth","end","todayTenant","tenantDateFromLocal","UtcOffset","tomTenant","getDate","yestTenant","monTenant","lastMonTenant","yearTenant","text"],"mappings":"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"}
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
2
15
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
16
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for
|
|
17
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
|
|
19
|
+
}
|
|
20
|
+
function _ts_metadata(k, v) {
|
|
8
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
}
|
|
22
|
+
}
|
|
23
|
+
import { DateRange } from './date';
|
|
10
24
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
11
25
|
export class DateRangePickerState {
|
|
12
26
|
get selectedOption() {
|
|
@@ -15,55 +29,40 @@ export class DateRangePickerState {
|
|
|
15
29
|
}
|
|
16
30
|
return this.options.findOption(this.value);
|
|
17
31
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
value: void 0
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(this, "onChange", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: (val) => {
|
|
37
|
-
this.value = val;
|
|
38
|
-
}
|
|
32
|
+
static create(config) {
|
|
33
|
+
return new DateRangePickerState(config);
|
|
34
|
+
}
|
|
35
|
+
static createWithOptions(options, config) {
|
|
36
|
+
return new DateRangePickerState(config, options);
|
|
37
|
+
}
|
|
38
|
+
constructor(config, options){
|
|
39
|
+
var _this_options;
|
|
40
|
+
_define_property(this, "value", void 0);
|
|
41
|
+
_define_property(this, "options", void 0);
|
|
42
|
+
_define_property(this, "onChange", (val)=>{
|
|
43
|
+
this.value = val;
|
|
39
44
|
});
|
|
40
45
|
makeObservable(this);
|
|
41
46
|
this.options = options;
|
|
42
47
|
if (config === null || config === void 0 ? void 0 : config.defaultValue) {
|
|
43
48
|
this.value = config.defaultValue;
|
|
49
|
+
} else if ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.defaultOption) {
|
|
50
|
+
var _this_options_findOption;
|
|
51
|
+
this.value = (_this_options_findOption = this.options.findOption(this.options.defaultOption)) === null || _this_options_findOption === void 0 ? void 0 : _this_options_findOption.value;
|
|
44
52
|
}
|
|
45
|
-
else if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.defaultOption) {
|
|
46
|
-
this.value = (_b = this.options.findOption(this.options.defaultOption)) === null || _b === void 0 ? void 0 : _b.value;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
static create(config) {
|
|
50
|
-
return new DateRangePickerState(config);
|
|
51
|
-
}
|
|
52
|
-
static createWithOptions(options, config) {
|
|
53
|
-
return new DateRangePickerState(config, options);
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
|
-
|
|
55
|
+
_ts_decorate([
|
|
57
56
|
observable,
|
|
58
|
-
|
|
57
|
+
_ts_metadata("design:type", typeof DateRange === "undefined" ? Object : DateRange)
|
|
59
58
|
], DateRangePickerState.prototype, "value", void 0);
|
|
60
|
-
|
|
59
|
+
_ts_decorate([
|
|
61
60
|
computed,
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
_ts_metadata("design:type", Object),
|
|
62
|
+
_ts_metadata("design:paramtypes", [])
|
|
64
63
|
], DateRangePickerState.prototype, "selectedOption", null);
|
|
65
|
-
|
|
66
|
-
action
|
|
67
|
-
__metadata("design:type", Object)
|
|
64
|
+
_ts_decorate([
|
|
65
|
+
action
|
|
68
66
|
], DateRangePickerState.prototype, "onChange", void 0);
|
|
67
|
+
|
|
69
68
|
//# sourceMappingURL=date-range-picker-state.js.map
|