magtool 1.0.2 → 1.0.3
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/cps.js +88 -109
- package/dist/index.js +9 -2594
- package/dist/store.js +11 -0
- package/package.json +5 -5
- package/dist/pinia.js +0 -6157
package/dist/cps.js
CHANGED
|
@@ -1,71 +1,61 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { age: o } =
|
|
3
|
-
let
|
|
1
|
+
const $ = (t) => {
|
|
2
|
+
const { age: o } = t || {};
|
|
3
|
+
let s, n;
|
|
4
4
|
if (o != null && o.included) {
|
|
5
|
-
const { minAge:
|
|
6
|
-
|
|
5
|
+
const { minAge: e, maxAge: r } = o.included[0] || {};
|
|
6
|
+
e ? s = e : s = "all", r ? n = r : n = "all";
|
|
7
7
|
}
|
|
8
|
-
return n === "all" ?
|
|
9
|
-
},
|
|
8
|
+
return n === "all" ? s === "all" ? "All" : `${s}~65+` : `${s}~${n}`;
|
|
9
|
+
}, b = (t, o) => t === "all" ? null : o === 65 ? {
|
|
10
10
|
included: [
|
|
11
11
|
{
|
|
12
|
-
minAge:
|
|
12
|
+
minAge: t
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
} : {
|
|
16
16
|
included: [
|
|
17
17
|
{
|
|
18
|
-
minAge:
|
|
18
|
+
minAge: t,
|
|
19
19
|
maxAge: o
|
|
20
20
|
}
|
|
21
21
|
]
|
|
22
|
-
},
|
|
23
|
-
const { gender: o } =
|
|
22
|
+
}, h = (t) => {
|
|
23
|
+
const { gender: o } = t || {};
|
|
24
24
|
return o != null && o.included ? o.included[0] : null;
|
|
25
|
-
},
|
|
26
|
-
__proto__: null,
|
|
27
|
-
useAgeFormat: y,
|
|
28
|
-
useAgeValue: h,
|
|
29
|
-
useGenderFormat: j
|
|
30
|
-
}, Symbol.toStringTag, { value: "Module" })), P = (e) => new Promise((o, l) => {
|
|
25
|
+
}, y = { useAgeFormat: $, useAgeValue: b, useGenderFormat: h }, P = (t) => new Promise((o, s) => {
|
|
31
26
|
const n = new Image();
|
|
32
|
-
n.src = window.$getType(
|
|
33
|
-
}), C = (
|
|
27
|
+
n.src = window.$getType(t) === "String" ? t : URL.createObjectURL(t), n.onload = () => o(n), n.onerror = () => s(new Error("Could not load image"));
|
|
28
|
+
}), C = (t) => new Promise((o, s) => {
|
|
34
29
|
const n = document.createElement("video");
|
|
35
|
-
n.preload = "metadata", window.$getType(
|
|
36
|
-
window.URL.revokeObjectURL(
|
|
30
|
+
n.preload = "metadata", window.$getType(t) === "String" ? n.src = t : n.src = URL.createObjectURL(t), n.onloadedmetadata = () => {
|
|
31
|
+
window.URL.revokeObjectURL(t), console.info([n]), o(n);
|
|
37
32
|
};
|
|
38
|
-
}),
|
|
33
|
+
}), M = ({ type: t = "csv", data: o, name: s }) => {
|
|
39
34
|
let n = document.createElement("a");
|
|
40
|
-
if (
|
|
35
|
+
if (t === "csv") {
|
|
41
36
|
const r = new Blob(["\uFEFF" + o], {
|
|
42
37
|
type: "text/csv,charset=UTF-8"
|
|
43
38
|
});
|
|
44
39
|
n.href = URL.createObjectURL(r);
|
|
45
40
|
}
|
|
46
|
-
let
|
|
47
|
-
n.download =
|
|
48
|
-
},
|
|
49
|
-
__proto__: null,
|
|
50
|
-
download: S,
|
|
51
|
-
loadImage: P,
|
|
52
|
-
loadVideo: C
|
|
53
|
-
}, Symbol.toStringTag, { value: "Module" })), O = ({ table: e, key: o, form: l, value: n, cb: t = () => {
|
|
41
|
+
let e = new MouseEvent("click");
|
|
42
|
+
n.download = s || "download", n.dispatchEvent(e), (t === "csv" || t === "video") && URL.revokeObjectURL(n.url), n = null, e = null;
|
|
43
|
+
}, R = { loadImage: P, loadVideo: C, download: M }, A = ({ table: t, key: o, form: s, value: n, cb: e = () => {
|
|
54
44
|
} }) => {
|
|
55
|
-
const r =
|
|
56
|
-
r.length > 1 ? (
|
|
57
|
-
},
|
|
58
|
-
let { sortable: o = !0, empty:
|
|
59
|
-
n && (
|
|
60
|
-
const r =
|
|
61
|
-
label:
|
|
62
|
-
prop:
|
|
63
|
-
width:
|
|
45
|
+
const r = t.getSelectionRows();
|
|
46
|
+
r.length > 1 ? (t.clearSelection(), t.toggleRowSelection(r[1], "selected"), s[n] = r[1][o]) : r.length === 1 && (s[n] = r[0][o]), e();
|
|
47
|
+
}, I = (t = {}) => {
|
|
48
|
+
let { sortable: o = !0, empty: s = !1, mmp: n = !1 } = t, e = window.$map.asa.asaMetric.all;
|
|
49
|
+
n && (e = e.concat(window.$map.asa.mmpMetric.all));
|
|
50
|
+
const r = e.map((l, u) => ({
|
|
51
|
+
label: l.label,
|
|
52
|
+
prop: l.value,
|
|
53
|
+
width: l.width,
|
|
64
54
|
sortable: o,
|
|
65
|
-
type:
|
|
66
|
-
align:
|
|
67
|
-
visible:
|
|
68
|
-
formatter:
|
|
55
|
+
type: l.type,
|
|
56
|
+
align: l.align,
|
|
57
|
+
visible: l.visible,
|
|
58
|
+
formatter: l.formatter
|
|
69
59
|
}));
|
|
70
60
|
return r.unshift({
|
|
71
61
|
label: "Currency",
|
|
@@ -73,46 +63,46 @@ const y = (e) => {
|
|
|
73
63
|
width: 80,
|
|
74
64
|
align: "right"
|
|
75
65
|
}), r;
|
|
76
|
-
},
|
|
66
|
+
}, j = () => ({
|
|
77
67
|
label: "-"
|
|
78
|
-
}),
|
|
79
|
-
if (!o.length || !
|
|
68
|
+
}), S = ({ columns: t, data: o, currency: s = "", channel: n = "" }) => {
|
|
69
|
+
if (!o.length || !t.length)
|
|
80
70
|
return [];
|
|
81
|
-
const
|
|
71
|
+
const e = {
|
|
82
72
|
spend: {
|
|
83
73
|
prop: "spend",
|
|
84
|
-
prefix:
|
|
85
|
-
format: (
|
|
74
|
+
prefix: s,
|
|
75
|
+
format: (a) => window.$fa(a, 2)
|
|
86
76
|
},
|
|
87
77
|
taps: {
|
|
88
78
|
prop: "taps",
|
|
89
|
-
format: (
|
|
79
|
+
format: (a) => window.$fa(a, 0)
|
|
90
80
|
},
|
|
91
81
|
installs: {
|
|
92
82
|
prop: "installs",
|
|
93
|
-
format: (
|
|
83
|
+
format: (a) => window.$fa(a, 0)
|
|
94
84
|
},
|
|
95
85
|
impressions: {
|
|
96
86
|
prop: "impressions",
|
|
97
|
-
format: (
|
|
87
|
+
format: (a) => window.$fa(a, 0)
|
|
98
88
|
},
|
|
99
89
|
mmpInstalls: {
|
|
100
90
|
prop: "mmpInstalls",
|
|
101
|
-
format: (
|
|
91
|
+
format: (a) => window.$fa(a, 0)
|
|
102
92
|
},
|
|
103
93
|
mmpCPI: {
|
|
104
94
|
prop: "mmpCPI",
|
|
105
|
-
format: (
|
|
95
|
+
format: (a) => window.$fa(a, 2)
|
|
106
96
|
},
|
|
107
97
|
IPM: {
|
|
108
98
|
prop: "IPM",
|
|
109
|
-
format: (
|
|
99
|
+
format: (a) => window.$fa(a, 2)
|
|
110
100
|
},
|
|
111
101
|
revenue: {
|
|
112
102
|
prop: "revenue",
|
|
113
|
-
format: (
|
|
103
|
+
format: (a) => window.$fa(a, 2)
|
|
114
104
|
}
|
|
115
|
-
}, r = [],
|
|
105
|
+
}, r = [], l = {
|
|
116
106
|
avgCPT: {},
|
|
117
107
|
avgCPA: {},
|
|
118
108
|
avgCPM: {},
|
|
@@ -122,71 +112,60 @@ const y = (e) => {
|
|
|
122
112
|
mmpInstalls: {},
|
|
123
113
|
mmpCPI: {}
|
|
124
114
|
};
|
|
125
|
-
|
|
126
|
-
a
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
|
|
115
|
+
t.forEach((a, i) => {
|
|
116
|
+
l[a.property] && (l[a.property].i = i);
|
|
117
|
+
const m = e[a.property];
|
|
118
|
+
if (m) {
|
|
119
|
+
m.i = i;
|
|
130
120
|
let c = window.$bigNumber(0);
|
|
131
|
-
o.forEach((
|
|
132
|
-
c = c.plus(
|
|
133
|
-
}), c = c.toNumber(),
|
|
121
|
+
o.forEach((v) => {
|
|
122
|
+
c = c.plus(v[a.property] || 0);
|
|
123
|
+
}), c = c.toNumber(), m.total = c, r.push(c);
|
|
134
124
|
} else
|
|
135
125
|
r.push("");
|
|
136
|
-
}), Object.keys(
|
|
137
|
-
const i =
|
|
126
|
+
}), Object.keys(e).forEach((a) => {
|
|
127
|
+
const i = e[a];
|
|
138
128
|
i.format && r[i.i] && (r[i.i] = i.format(r[i.i]));
|
|
139
129
|
});
|
|
140
|
-
const
|
|
141
|
-
r[
|
|
142
|
-
const
|
|
143
|
-
if (r[
|
|
144
|
-
const
|
|
145
|
-
r[
|
|
130
|
+
const p = e.taps.total ? window.$fa(e.spend.total / e.taps.total) : "0.00";
|
|
131
|
+
r[l.avgCPT.i] = p;
|
|
132
|
+
const d = e.installs.total ? window.$fa(e.spend.total / e.installs.total) : "0.00";
|
|
133
|
+
if (r[l.avgCPA.i] = d, l.avgCPM.i !== void 0) {
|
|
134
|
+
const a = e.impressions.total ? window.$fa(e.spend.total / (e.impressions.total / 1e3)) : "0.00";
|
|
135
|
+
r[l.avgCPM.i] = a;
|
|
146
136
|
}
|
|
147
|
-
const
|
|
148
|
-
r[
|
|
149
|
-
const
|
|
150
|
-
r[
|
|
151
|
-
const
|
|
152
|
-
return r[
|
|
153
|
-
},
|
|
137
|
+
const f = e.taps.total ? window.$fa(e.installs.total / e.taps.total * 100) : "0.00";
|
|
138
|
+
r[l.cr.i] = f;
|
|
139
|
+
const w = e.impressions.total ? window.$fa(e.taps.total / e.impressions.total * 100) : "0.00";
|
|
140
|
+
r[l.ttr.i] = w;
|
|
141
|
+
const g = e.impressions.total ? window.$fa(e.installs.total * 1e3 / e.impressions.total) : "0.00";
|
|
142
|
+
return r[l.IPM.i] = g, r;
|
|
143
|
+
}, U = (t) => {
|
|
154
144
|
const o = window.$map.asa.allMetric.obj;
|
|
155
|
-
return Object.keys(
|
|
156
|
-
const n =
|
|
157
|
-
o[
|
|
158
|
-
}),
|
|
159
|
-
}, E = ({ columns:
|
|
160
|
-
let r =
|
|
145
|
+
return Object.keys(t).forEach((s) => {
|
|
146
|
+
const n = t[s];
|
|
147
|
+
o[s] && (t[`${s}Format`] = window.$fu({ prop: s, value: n, currency: !1, obj: o }));
|
|
148
|
+
}), t;
|
|
149
|
+
}, E = ({ columns: t, data: o }, s) => t.length && o.length ? t.map((e) => {
|
|
150
|
+
let r = s[e.property] === void 0 ? "" : s[e.property];
|
|
161
151
|
if (r !== "")
|
|
162
152
|
try {
|
|
163
|
-
r = window.$fa(r, window.$map.asa.allMetric.obj[
|
|
153
|
+
r = window.$fa(r, window.$map.asa.allMetric.obj[e.property].precision);
|
|
164
154
|
} catch {
|
|
165
155
|
}
|
|
166
156
|
return r;
|
|
167
|
-
}) : [],
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
useFormat: T,
|
|
172
|
-
useRemoteSummary: E,
|
|
173
|
-
useSingleSelect: O,
|
|
174
|
-
useSummary: I
|
|
175
|
-
}, Symbol.toStringTag, { value: "Module" })), L = (e, o = 88) => {
|
|
176
|
-
const l = document.querySelector("html"), { scrollTop: n } = l, t = e.getBoundingClientRect();
|
|
177
|
-
l.scrollTo({
|
|
178
|
-
top: n + t.y - o,
|
|
157
|
+
}) : [], L = { useSingleSelect: A, useColumn: I, useEmptyColumn: j, useRemoteSummary: E, useSummary: S, useFormat: U }, T = (t, o = 88) => {
|
|
158
|
+
const s = document.querySelector("html"), { scrollTop: n } = s, e = t.getBoundingClientRect();
|
|
159
|
+
s.scrollTo({
|
|
160
|
+
top: n + e.y - o,
|
|
179
161
|
behavior: "smooth"
|
|
180
162
|
});
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
u = { ...u, ...d[e] };
|
|
188
|
-
});
|
|
189
|
-
const x = u;
|
|
163
|
+
}, O = { pageScrollTo: T }, x = {
|
|
164
|
+
...y,
|
|
165
|
+
...R,
|
|
166
|
+
...L,
|
|
167
|
+
...O
|
|
168
|
+
};
|
|
190
169
|
export {
|
|
191
170
|
x as c
|
|
192
171
|
};
|