magtool 1.0.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/README.md +1 -0
- package/dist/magtool.mjs +320 -0
- package/dist/magtool.umd.js +1 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# magtool
|
package/dist/magtool.mjs
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
const v = (t) => {
|
|
2
|
+
const { age: r } = t || {};
|
|
3
|
+
let a, s;
|
|
4
|
+
if (r != null && r.included) {
|
|
5
|
+
const { minAge: n, maxAge: i } = r.included[0] || {};
|
|
6
|
+
n ? a = n : a = "all", i ? s = i : s = "all";
|
|
7
|
+
}
|
|
8
|
+
return s === "all" ? a === "all" ? "All" : `${a}~65+` : `${a}~${s}`;
|
|
9
|
+
}, I = (t, r) => t === "all" ? null : r === 65 ? {
|
|
10
|
+
included: [
|
|
11
|
+
{
|
|
12
|
+
minAge: t
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
} : {
|
|
16
|
+
included: [
|
|
17
|
+
{
|
|
18
|
+
minAge: t,
|
|
19
|
+
maxAge: r
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}, A = (t) => {
|
|
23
|
+
const { gender: r } = t || {};
|
|
24
|
+
return r != null && r.included ? r.included[0] : null;
|
|
25
|
+
}, E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
26
|
+
__proto__: null,
|
|
27
|
+
useAgeFormat: v,
|
|
28
|
+
useAgeValue: I,
|
|
29
|
+
useGenderFormat: A
|
|
30
|
+
}, Symbol.toStringTag, { value: "Module" })), R = (t) => new Promise((r, a) => {
|
|
31
|
+
const s = new Image();
|
|
32
|
+
s.src = window.$getType(t) === "String" ? t : URL.createObjectURL(t), s.onload = () => r(s), s.onerror = () => a(new Error("Could not load image"));
|
|
33
|
+
}), U = (t) => new Promise((r, a) => {
|
|
34
|
+
const s = document.createElement("video");
|
|
35
|
+
s.preload = "metadata", window.$getType(t) === "String" ? s.src = t : s.src = URL.createObjectURL(t), s.onloadedmetadata = () => {
|
|
36
|
+
window.URL.revokeObjectURL(t), console.info([s]), r(s);
|
|
37
|
+
};
|
|
38
|
+
}), L = ({ type: t = "csv", data: r, name: a }) => {
|
|
39
|
+
let s = document.createElement("a");
|
|
40
|
+
if (t === "csv") {
|
|
41
|
+
const i = new Blob(["\uFEFF" + r], {
|
|
42
|
+
type: "text/csv,charset=UTF-8"
|
|
43
|
+
});
|
|
44
|
+
s.href = URL.createObjectURL(i);
|
|
45
|
+
}
|
|
46
|
+
let n = new MouseEvent("click");
|
|
47
|
+
s.download = a || "download", s.dispatchEvent(n), (t === "csv" || t === "video") && URL.revokeObjectURL(s.url), s = null, n = null;
|
|
48
|
+
}, N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
49
|
+
__proto__: null,
|
|
50
|
+
download: L,
|
|
51
|
+
loadImage: R,
|
|
52
|
+
loadVideo: U
|
|
53
|
+
}, Symbol.toStringTag, { value: "Module" })), x = ({ table: t, key: r, form: a, value: s, cb: n = () => {
|
|
54
|
+
} }) => {
|
|
55
|
+
const i = t.getSelectionRows();
|
|
56
|
+
i.length > 1 ? (t.clearSelection(), t.toggleRowSelection(i[1], "selected"), a[s] = i[1][r]) : i.length === 1 && (a[s] = i[0][r]), n();
|
|
57
|
+
}, k = (t = {}) => {
|
|
58
|
+
let { sortable: r = !0, empty: a = !1, mmp: s = !1 } = t, n = window.$map.asa.asaMetric.all;
|
|
59
|
+
s && (n = n.concat(window.$map.asa.mmpMetric.all));
|
|
60
|
+
const i = n.map((m, $) => ({
|
|
61
|
+
label: m.label,
|
|
62
|
+
prop: m.value,
|
|
63
|
+
width: m.width,
|
|
64
|
+
sortable: r,
|
|
65
|
+
type: m.type,
|
|
66
|
+
align: m.align,
|
|
67
|
+
visible: m.visible,
|
|
68
|
+
formatter: m.formatter
|
|
69
|
+
}));
|
|
70
|
+
return i.unshift({
|
|
71
|
+
label: "Currency",
|
|
72
|
+
prop: "currency",
|
|
73
|
+
width: 80,
|
|
74
|
+
align: "right"
|
|
75
|
+
}), i;
|
|
76
|
+
}, F = () => ({
|
|
77
|
+
label: "-"
|
|
78
|
+
}), z = ({ columns: t, data: r, currency: a = "", channel: s = "" }) => {
|
|
79
|
+
if (!r.length || !t.length)
|
|
80
|
+
return [];
|
|
81
|
+
const n = {
|
|
82
|
+
spend: {
|
|
83
|
+
prop: "spend",
|
|
84
|
+
prefix: a,
|
|
85
|
+
format: (p) => window.$fa(p, 2)
|
|
86
|
+
},
|
|
87
|
+
taps: {
|
|
88
|
+
prop: "taps",
|
|
89
|
+
format: (p) => window.$fa(p, 0)
|
|
90
|
+
},
|
|
91
|
+
installs: {
|
|
92
|
+
prop: "installs",
|
|
93
|
+
format: (p) => window.$fa(p, 0)
|
|
94
|
+
},
|
|
95
|
+
impressions: {
|
|
96
|
+
prop: "impressions",
|
|
97
|
+
format: (p) => window.$fa(p, 0)
|
|
98
|
+
},
|
|
99
|
+
mmpInstalls: {
|
|
100
|
+
prop: "mmpInstalls",
|
|
101
|
+
format: (p) => window.$fa(p, 0)
|
|
102
|
+
},
|
|
103
|
+
mmpCPI: {
|
|
104
|
+
prop: "mmpCPI",
|
|
105
|
+
format: (p) => window.$fa(p, 2)
|
|
106
|
+
},
|
|
107
|
+
IPM: {
|
|
108
|
+
prop: "IPM",
|
|
109
|
+
format: (p) => window.$fa(p, 2)
|
|
110
|
+
},
|
|
111
|
+
revenue: {
|
|
112
|
+
prop: "revenue",
|
|
113
|
+
format: (p) => window.$fa(p, 2)
|
|
114
|
+
}
|
|
115
|
+
}, i = [], m = {
|
|
116
|
+
avgCPT: {},
|
|
117
|
+
avgCPA: {},
|
|
118
|
+
avgCPM: {},
|
|
119
|
+
cr: {},
|
|
120
|
+
ttr: {},
|
|
121
|
+
IPM: {},
|
|
122
|
+
mmpInstalls: {},
|
|
123
|
+
mmpCPI: {}
|
|
124
|
+
};
|
|
125
|
+
t.forEach((p, d) => {
|
|
126
|
+
m[p.property] && (m[p.property].i = d);
|
|
127
|
+
const e = n[p.property];
|
|
128
|
+
if (e) {
|
|
129
|
+
e.i = d;
|
|
130
|
+
let o = window.$bigNumber(0);
|
|
131
|
+
r.forEach((l) => {
|
|
132
|
+
o = o.plus(l[p.property] || 0);
|
|
133
|
+
}), o = o.toNumber(), e.total = o, i.push(o);
|
|
134
|
+
} else
|
|
135
|
+
i.push("");
|
|
136
|
+
}), Object.keys(n).forEach((p) => {
|
|
137
|
+
const d = n[p];
|
|
138
|
+
d.format && i[d.i] && (i[d.i] = d.format(i[d.i]));
|
|
139
|
+
});
|
|
140
|
+
const g = n.taps.total ? window.$fa(n.spend.total / n.taps.total) : "0.00";
|
|
141
|
+
i[m.avgCPT.i] = g;
|
|
142
|
+
const b = n.installs.total ? window.$fa(n.spend.total / n.installs.total) : "0.00";
|
|
143
|
+
if (i[m.avgCPA.i] = b, m.avgCPM.i !== void 0) {
|
|
144
|
+
const p = n.impressions.total ? window.$fa(n.spend.total / (n.impressions.total / 1e3)) : "0.00";
|
|
145
|
+
i[m.avgCPM.i] = p;
|
|
146
|
+
}
|
|
147
|
+
const y = n.taps.total ? window.$fa(n.installs.total / n.taps.total * 100) : "0.00";
|
|
148
|
+
i[m.cr.i] = y;
|
|
149
|
+
const f = n.impressions.total ? window.$fa(n.taps.total / n.impressions.total * 100) : "0.00";
|
|
150
|
+
i[m.ttr.i] = f;
|
|
151
|
+
const h = n.impressions.total ? window.$fa(n.installs.total * 1e3 / n.impressions.total) : "0.00";
|
|
152
|
+
return i[m.IPM.i] = h, i;
|
|
153
|
+
}, B = (t) => {
|
|
154
|
+
const r = window.$map.asa.allMetric.obj;
|
|
155
|
+
return Object.keys(t).forEach((a) => {
|
|
156
|
+
const s = t[a];
|
|
157
|
+
r[a] && (t[`${a}Format`] = window.$fu({ prop: a, value: s, currency: !1, obj: r }));
|
|
158
|
+
}), t;
|
|
159
|
+
}, q = ({ columns: t, data: r }, a) => t.length && r.length ? t.map((n) => {
|
|
160
|
+
let i = a[n.property] === void 0 ? "" : a[n.property];
|
|
161
|
+
if (i !== "")
|
|
162
|
+
try {
|
|
163
|
+
i = window.$fa(i, window.$map.asa.allMetric.obj[n.property].precision);
|
|
164
|
+
} catch {
|
|
165
|
+
}
|
|
166
|
+
return i;
|
|
167
|
+
}) : [], G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
168
|
+
__proto__: null,
|
|
169
|
+
useColumn: k,
|
|
170
|
+
useEmptyColumn: F,
|
|
171
|
+
useFormat: B,
|
|
172
|
+
useRemoteSummary: q,
|
|
173
|
+
useSingleSelect: x,
|
|
174
|
+
useSummary: z
|
|
175
|
+
}, Symbol.toStringTag, { value: "Module" })), K = (t, r = 88) => {
|
|
176
|
+
const a = document.querySelector("html"), { scrollTop: s } = a, n = t.getBoundingClientRect();
|
|
177
|
+
a.scrollTo({
|
|
178
|
+
top: s + n.y - r,
|
|
179
|
+
behavior: "smooth"
|
|
180
|
+
});
|
|
181
|
+
}, V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
182
|
+
__proto__: null,
|
|
183
|
+
pageScrollTo: K
|
|
184
|
+
}, Symbol.toStringTag, { value: "Module" })), T = /* @__PURE__ */ Object.assign({ "./composition/ads.js": E, "./composition/media.js": N, "./composition/table.js": G, "./composition/tool.js": V });
|
|
185
|
+
let C = {};
|
|
186
|
+
Object.keys(T).forEach((t) => {
|
|
187
|
+
C = { ...C, ...T[t] };
|
|
188
|
+
});
|
|
189
|
+
const S = C, M = (t) => {
|
|
190
|
+
const r = (e) => new URL((/* @__PURE__ */ Object.assign({}))[`/src/assets/img/${e}`], import.meta.url).href;
|
|
191
|
+
t.config.globalProperties.$getImg = r, window.$getImg = r;
|
|
192
|
+
const a = (e, o = 0) => {
|
|
193
|
+
let l = parseInt(Math.random() * e);
|
|
194
|
+
return l += o, l;
|
|
195
|
+
};
|
|
196
|
+
window.$rn = a;
|
|
197
|
+
const s = (e, o) => {
|
|
198
|
+
let l = [];
|
|
199
|
+
for (let c = 0; c < e; c++)
|
|
200
|
+
l.push(o(c));
|
|
201
|
+
return l;
|
|
202
|
+
};
|
|
203
|
+
window.$fd = s, t.config.globalProperties.$setTimeout = function(e = () => {
|
|
204
|
+
}, o) {
|
|
205
|
+
this.timer && (clearTimeout(this.timer), this.timer = null), this.timer = setTimeout(() => {
|
|
206
|
+
e(), clearTimeout(this.timer);
|
|
207
|
+
}, o);
|
|
208
|
+
};
|
|
209
|
+
const n = (e) => e.substr(0, 1).toUpperCase() + e.substr(1, e.length).toLowerCase();
|
|
210
|
+
window.$toUpperCamel = n;
|
|
211
|
+
const i = (e, o = 2) => {
|
|
212
|
+
const l = window.$getType(e);
|
|
213
|
+
let c;
|
|
214
|
+
l === "Number" ? (e = e.toFixed(o), c = String(e), e = String(Math.abs(e))) : l === "String" && (c = e, e = String(Math.abs(Number(e))));
|
|
215
|
+
const u = e.split(".");
|
|
216
|
+
let _ = u[0].split("");
|
|
217
|
+
_ = _.reverse();
|
|
218
|
+
let P = [];
|
|
219
|
+
_.forEach((O, j) => {
|
|
220
|
+
j !== 0 && j % 3 === 0 && P.push(","), P.push(O);
|
|
221
|
+
});
|
|
222
|
+
let w = P.reverse().join("");
|
|
223
|
+
return window.$getType(o) === "Number" && o > 0 && (w += ".", u[1] ? w += u[1].padEnd(o, 0).substr(0, o) : w += "0".padEnd(o, "0")), Number(c) !== Number(e) ? `-${w}` : w;
|
|
224
|
+
};
|
|
225
|
+
window.$fa = i, t.config.globalProperties.$fa = i;
|
|
226
|
+
const m = ({ prop: e, currency: o, value: l, obj: c = window.$map.asa.asaMetric.allObj }) => {
|
|
227
|
+
const u = c[e];
|
|
228
|
+
return u.unit === "currency" ? o ? `${o} ${window.$fa(l, u == null ? void 0 : u.precision)}` : window.$fa(l, u == null ? void 0 : u.precision) : u.unit === "%" ? `${window.$fa(l, u == null ? void 0 : u.precision)}%` : window.$fa(l, u == null ? void 0 : u.precision);
|
|
229
|
+
};
|
|
230
|
+
window.$fu = m, t.config.globalProperties.$fu = m;
|
|
231
|
+
const $ = (e = () => {
|
|
232
|
+
}, o = 2) => {
|
|
233
|
+
let l = null;
|
|
234
|
+
return new Promise((c, u) => {
|
|
235
|
+
l = setTimeout(() => {
|
|
236
|
+
e(c, u), clearTimeout(l), c(!0);
|
|
237
|
+
}, o * 100);
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
window.$pm = $;
|
|
241
|
+
const g = (e = () => {
|
|
242
|
+
}, o = 500) => {
|
|
243
|
+
let l;
|
|
244
|
+
return function(...c) {
|
|
245
|
+
l && clearTimeout(l), l = setTimeout(() => {
|
|
246
|
+
e.apply(this, c);
|
|
247
|
+
}, o);
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
window.$db = g, Number.prototype.toFixedNumber = function(e) {
|
|
251
|
+
return Number(this.toFixed(e));
|
|
252
|
+
}, Array.prototype.filter1 = function(e) {
|
|
253
|
+
if (!e || typeof e != "function")
|
|
254
|
+
throw new Error(e + " is not a function");
|
|
255
|
+
let o, l;
|
|
256
|
+
for (let c = 0; c < this.length; c++)
|
|
257
|
+
if (e(this[c], c, this)) {
|
|
258
|
+
l = c, o = this[c];
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
index: l,
|
|
263
|
+
data: o
|
|
264
|
+
};
|
|
265
|
+
}, window.$getType = (e) => Object.prototype.toString.call(e).slice(8, -1);
|
|
266
|
+
const b = (e, o) => {
|
|
267
|
+
if (!e) {
|
|
268
|
+
console.info("No Value");
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const l = window.$l("Copied");
|
|
272
|
+
let c;
|
|
273
|
+
if (o ? window.$getType(o) !== "Boolean" ? c = `${l} ${o}: ${e}` : c = `${l}: ${e}` : c = l, navigator.clipboard && window.isSecureContext)
|
|
274
|
+
navigator.clipboard.writeText(e).then(() => {
|
|
275
|
+
t.config.globalProperties.$message.success({
|
|
276
|
+
message: c,
|
|
277
|
+
// grouping: true,
|
|
278
|
+
center: !0,
|
|
279
|
+
duration: 0
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
else {
|
|
283
|
+
let u = document.createElement("textarea");
|
|
284
|
+
u.value = e, u.style.position = "fixed", u.style.opacity = 0, document.body.appendChild(u), u.select(), document.execCommand("Copy"), u.remove(), t.config.globalProperties.$message.success({
|
|
285
|
+
message: c,
|
|
286
|
+
// grouping: true,
|
|
287
|
+
center: !0,
|
|
288
|
+
duration: 0
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
window.$copy = b, t.config.globalProperties.$copy = b;
|
|
293
|
+
const y = (e) => e < 1e3 ? e : e < 1e6 ? parseInt(e / 1e3) + "K" : parseInt(e / 1e6) + "M";
|
|
294
|
+
window.$sc = y;
|
|
295
|
+
const f = {
|
|
296
|
+
cpa: "avgCPA",
|
|
297
|
+
cpt: "avgCPT"
|
|
298
|
+
}, h = (e) => {
|
|
299
|
+
const o = f[e.name];
|
|
300
|
+
o && (e.name = o);
|
|
301
|
+
};
|
|
302
|
+
window.$nr = h;
|
|
303
|
+
const p = (e) => (Object.keys(e).forEach((o) => {
|
|
304
|
+
f[o] && (e[f[o]] = e[o], delete e[o]);
|
|
305
|
+
}), e);
|
|
306
|
+
window.$nro = p;
|
|
307
|
+
const d = (e) => {
|
|
308
|
+
let o = 0;
|
|
309
|
+
return Object.keys(e).forEach((l) => {
|
|
310
|
+
(window.$getType(e[l]) === "Array" && e[l].length !== 0 || e[l]) && o++;
|
|
311
|
+
}), o;
|
|
312
|
+
};
|
|
313
|
+
window.$pc = d;
|
|
314
|
+
}, H = (t, r) => (t.use(S).use(M), {
|
|
315
|
+
composition: S,
|
|
316
|
+
data: M
|
|
317
|
+
});
|
|
318
|
+
export {
|
|
319
|
+
H as default
|
|
320
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(f,b){typeof exports=="object"&&typeof module<"u"?module.exports=b():typeof define=="function"&&define.amd?define(b):(f=typeof globalThis<"u"?globalThis:f||self,f.magtool=b())})(this,function(){"use strict";var f=typeof document<"u"?document.currentScript:null;const j=Object.assign({"./composition/ads.js":Object.freeze(Object.defineProperty({__proto__:null,useAgeFormat:t=>{const{age:r}=t||{};let a,s;if(r!=null&&r.included){const{minAge:n,maxAge:i}=r.included[0]||{};n?a=n:a="all",i?s=i:s="all"}return s==="all"?a==="all"?"All":`${a}~65+`:`${a}~${s}`},useAgeValue:(t,r)=>t==="all"?null:r===65?{included:[{minAge:t}]}:{included:[{minAge:t,maxAge:r}]},useGenderFormat:t=>{const{gender:r}=t||{};return r!=null&&r.included?r.included[0]:null}},Symbol.toStringTag,{value:"Module"})),"./composition/media.js":Object.freeze(Object.defineProperty({__proto__:null,download:({type:t="csv",data:r,name:a})=>{let s=document.createElement("a");if(t==="csv"){const i=new Blob(["\uFEFF"+r],{type:"text/csv,charset=UTF-8"});s.href=URL.createObjectURL(i)}let n=new MouseEvent("click");s.download=a||"download",s.dispatchEvent(n),(t==="csv"||t==="video")&&URL.revokeObjectURL(s.url),s=null,n=null},loadImage:t=>new Promise((r,a)=>{const s=new Image;s.src=window.$getType(t)==="String"?t:URL.createObjectURL(t),s.onload=()=>r(s),s.onerror=()=>a(new Error("Could not load image"))}),loadVideo:t=>new Promise((r,a)=>{const s=document.createElement("video");s.preload="metadata",window.$getType(t)==="String"?s.src=t:s.src=URL.createObjectURL(t),s.onloadedmetadata=()=>{window.URL.revokeObjectURL(t),console.info([s]),r(s)}})},Symbol.toStringTag,{value:"Module"})),"./composition/table.js":Object.freeze(Object.defineProperty({__proto__:null,useColumn:(t={})=>{let{sortable:r=!0,empty:a=!1,mmp:s=!1}=t,n=window.$map.asa.asaMetric.all;s&&(n=n.concat(window.$map.asa.mmpMetric.all));const i=n.map((m,h)=>({label:m.label,prop:m.value,width:m.width,sortable:r,type:m.type,align:m.align,visible:m.visible,formatter:m.formatter}));return i.unshift({label:"Currency",prop:"currency",width:80,align:"right"}),i},useEmptyColumn:()=>({label:"-"}),useFormat:t=>{const r=window.$map.asa.allMetric.obj;return Object.keys(t).forEach(a=>{const s=t[a];r[a]&&(t[`${a}Format`]=window.$fu({prop:a,value:s,currency:!1,obj:r}))}),t},useRemoteSummary:({columns:t,data:r},a)=>t.length&&r.length?t.map(n=>{let i=a[n.property]===void 0?"":a[n.property];if(i!=="")try{i=window.$fa(i,window.$map.asa.allMetric.obj[n.property].precision)}catch{}return i}):[],useSingleSelect:({table:t,key:r,form:a,value:s,cb:n=()=>{}})=>{const i=t.getSelectionRows();i.length>1?(t.clearSelection(),t.toggleRowSelection(i[1],"selected"),a[s]=i[1][r]):i.length===1&&(a[s]=i[0][r]),n()},useSummary:({columns:t,data:r,currency:a="",channel:s=""})=>{if(!r.length||!t.length)return[];const n={spend:{prop:"spend",prefix:a,format:d=>window.$fa(d,2)},taps:{prop:"taps",format:d=>window.$fa(d,0)},installs:{prop:"installs",format:d=>window.$fa(d,0)},impressions:{prop:"impressions",format:d=>window.$fa(d,0)},mmpInstalls:{prop:"mmpInstalls",format:d=>window.$fa(d,0)},mmpCPI:{prop:"mmpCPI",format:d=>window.$fa(d,2)},IPM:{prop:"IPM",format:d=>window.$fa(d,2)},revenue:{prop:"revenue",format:d=>window.$fa(d,2)}},i=[],m={avgCPT:{},avgCPA:{},avgCPM:{},cr:{},ttr:{},IPM:{},mmpInstalls:{},mmpCPI:{}};t.forEach((d,p)=>{m[d.property]&&(m[d.property].i=p);const e=n[d.property];if(e){e.i=p;let o=window.$bigNumber(0);r.forEach(l=>{o=o.plus(l[d.property]||0)}),o=o.toNumber(),e.total=o,i.push(o)}else i.push("")}),Object.keys(n).forEach(d=>{const p=n[d];p.format&&i[p.i]&&(i[p.i]=p.format(i[p.i]))});const $=n.taps.total?window.$fa(n.spend.total/n.taps.total):"0.00";i[m.avgCPT.i]=$;const y=n.installs.total?window.$fa(n.spend.total/n.installs.total):"0.00";if(i[m.avgCPA.i]=y,m.avgCPM.i!==void 0){const d=n.impressions.total?window.$fa(n.spend.total/(n.impressions.total/1e3)):"0.00";i[m.avgCPM.i]=d}const C=n.taps.total?window.$fa(n.installs.total/n.taps.total*100):"0.00";i[m.cr.i]=C;const w=n.impressions.total?window.$fa(n.taps.total/n.impressions.total*100):"0.00";i[m.ttr.i]=w;const P=n.impressions.total?window.$fa(n.installs.total*1e3/n.impressions.total):"0.00";return i[m.IPM.i]=P,i}},Symbol.toStringTag,{value:"Module"})),"./composition/tool.js":Object.freeze(Object.defineProperty({__proto__:null,pageScrollTo:(t,r=88)=>{const a=document.querySelector("html"),{scrollTop:s}=a,n=t.getBoundingClientRect();a.scrollTo({top:s+n.y-r,behavior:"smooth"})}},Symbol.toStringTag,{value:"Module"}))});let _={};Object.keys(j).forEach(t=>{_={..._,...j[t]}});const v=_,M=t=>{const r=e=>new URL(Object.assign({})[`/src/assets/img/${e}`],typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:f&&f.tagName.toUpperCase()==="SCRIPT"&&f.src||new URL("magtool.umd.js",document.baseURI).href).href;t.config.globalProperties.$getImg=r,window.$getImg=r;const a=(e,o=0)=>{let l=parseInt(Math.random()*e);return l+=o,l};window.$rn=a;const s=(e,o)=>{let l=[];for(let c=0;c<e;c++)l.push(o(c));return l};window.$fd=s,t.config.globalProperties.$setTimeout=function(e=()=>{},o){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{e(),clearTimeout(this.timer)},o)};const n=e=>e.substr(0,1).toUpperCase()+e.substr(1,e.length).toLowerCase();window.$toUpperCamel=n;const i=(e,o=2)=>{const l=window.$getType(e);let c;l==="Number"?(e=e.toFixed(o),c=String(e),e=String(Math.abs(e))):l==="String"&&(c=e,e=String(Math.abs(Number(e))));const u=e.split(".");let S=u[0].split("");S=S.reverse();let T=[];S.forEach((I,O)=>{O!==0&&O%3===0&&T.push(","),T.push(I)});let g=T.reverse().join("");return window.$getType(o)==="Number"&&o>0&&(g+=".",u[1]?g+=u[1].padEnd(o,0).substr(0,o):g+="0".padEnd(o,"0")),Number(c)!==Number(e)?`-${g}`:g};window.$fa=i,t.config.globalProperties.$fa=i;const m=({prop:e,currency:o,value:l,obj:c=window.$map.asa.asaMetric.allObj})=>{const u=c[e];return u.unit==="currency"?o?`${o} ${window.$fa(l,u==null?void 0:u.precision)}`:window.$fa(l,u==null?void 0:u.precision):u.unit==="%"?`${window.$fa(l,u==null?void 0:u.precision)}%`:window.$fa(l,u==null?void 0:u.precision)};window.$fu=m,t.config.globalProperties.$fu=m;const h=(e=()=>{},o=2)=>{let l=null;return new Promise((c,u)=>{l=setTimeout(()=>{e(c,u),clearTimeout(l),c(!0)},o*100)})};window.$pm=h;const $=(e=()=>{},o=500)=>{let l;return function(...c){l&&clearTimeout(l),l=setTimeout(()=>{e.apply(this,c)},o)}};window.$db=$,Number.prototype.toFixedNumber=function(e){return Number(this.toFixed(e))},Array.prototype.filter1=function(e){if(!e||typeof e!="function")throw new Error(e+" is not a function");let o,l;for(let c=0;c<this.length;c++)if(e(this[c],c,this)){l=c,o=this[c];break}return{index:l,data:o}},window.$getType=e=>Object.prototype.toString.call(e).slice(8,-1);const y=(e,o)=>{if(!e){console.info("No Value");return}const l=window.$l("Copied");let c;if(o?window.$getType(o)!=="Boolean"?c=`${l} ${o}: ${e}`:c=`${l}: ${e}`:c=l,navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(e).then(()=>{t.config.globalProperties.$message.success({message:c,center:!0,duration:0})});else{let u=document.createElement("textarea");u.value=e,u.style.position="fixed",u.style.opacity=0,document.body.appendChild(u),u.select(),document.execCommand("Copy"),u.remove(),t.config.globalProperties.$message.success({message:c,center:!0,duration:0})}};window.$copy=y,t.config.globalProperties.$copy=y;const C=e=>e<1e3?e:e<1e6?parseInt(e/1e3)+"K":parseInt(e/1e6)+"M";window.$sc=C;const w={cpa:"avgCPA",cpt:"avgCPT"},P=e=>{const o=w[e.name];o&&(e.name=o)};window.$nr=P;const d=e=>(Object.keys(e).forEach(o=>{w[o]&&(e[w[o]]=e[o],delete e[o])}),e);window.$nro=d;const p=e=>{let o=0;return Object.keys(e).forEach(l=>{(window.$getType(e[l])==="Array"&&e[l].length!==0||e[l])&&o++}),o};window.$pc=p};return(t,r)=>(t.use(v).use(M),{composition:v,data:M})});
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "magtool",
|
|
3
|
+
"packageManager": "yarn@4.4.1",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"author": "magxl",
|
|
6
|
+
"main": "./dist/index.mjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.mjs"
|
|
12
|
+
},
|
|
13
|
+
"./cps": {
|
|
14
|
+
"import": "./dist/composition.mjs",
|
|
15
|
+
"require": "./dist/composition.mjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "vite",
|
|
20
|
+
"build": "vite build"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/*"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"momentjs": "^2.0.0",
|
|
27
|
+
"vue": "^3.3.4"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
31
|
+
"imstar-version": "^1.0.5",
|
|
32
|
+
"vite": "^6.0.5"
|
|
33
|
+
},
|
|
34
|
+
"description": "",
|
|
35
|
+
"license": "ISC"
|
|
36
|
+
}
|