@smoud/playable-sdk 1.0.18 → 1.0.20
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 +6 -0
- package/defines.d.ts +5 -1
- package/dist/esm/index.js +27 -27
- package/dist/iife/index.js +27 -27
- package/dist/index.js +27 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,6 +39,8 @@ It's powerful, unified SDK that seamlessly integrates multiple ad network SDKs,
|
|
|
39
39
|
- Chartboost
|
|
40
40
|
- AdColony
|
|
41
41
|
- MyTarget
|
|
42
|
+
- Smadex
|
|
43
|
+
- Adikteev
|
|
42
44
|
|
|
43
45
|
### Protocol Support
|
|
44
46
|
|
|
@@ -162,6 +164,8 @@ Supported **Ad Networks**:
|
|
|
162
164
|
- `pangle`
|
|
163
165
|
- `mytarget`
|
|
164
166
|
- `liftoff`
|
|
167
|
+
- `smadex`
|
|
168
|
+
- `adikteev`
|
|
165
169
|
|
|
166
170
|
See more details in [`GitHub repository.`](https://github.com/smoudjs/playable-scripts?tab=readme-ov-file#installation)
|
|
167
171
|
|
|
@@ -382,11 +386,13 @@ Get started quickly with our template projects:
|
|
|
382
386
|
- [IronSource - DAPI requirements](https://developers.is.com/ironsource-mobile/general/dapi-requirements/#step-1)
|
|
383
387
|
- [Unity Ads Documentation](https://docs.unity.com/acquire/en-us/manual/playable-ads-specifications)
|
|
384
388
|
- [Chartboost Integration](https://docs.chartboost.com/en/advertising/creatives/creative-assets/)
|
|
389
|
+
- [Adikteev specifications for external creatives](https://help.adikteev.com/hc/en-us/articles/10549028250130-Specifications-for-external-creatives)
|
|
385
390
|
|
|
386
391
|
#### Proprietary Networks
|
|
387
392
|
|
|
388
393
|
- [Google HTML5 / Playable Ads](https://support.google.com/google-ads/answer/9981650?hl=en)
|
|
389
394
|
- [Meta (Facebook) Playable Ads](https://www.facebook.com/business/help/412951382532338)
|
|
395
|
+
- [Moloco Requirements](https://help.moloco.com/hc/en-us/articles/24124525963799-Playable-and-Interactive-End-Card-IEC-creative-guide)
|
|
390
396
|
- [Mintegral Integration](https://www.playturbo.com/review/doc)
|
|
391
397
|
|
|
392
398
|
### Testing Tools
|
package/defines.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ declare const NUC: {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
declare const FbPlayableAd: { onCTAClick: () => void };
|
|
44
|
+
declare const smxTracking: { redirect: () => void };
|
|
44
45
|
declare const ExitApi: { exit: () => void };
|
|
45
46
|
|
|
46
47
|
declare const AD_NETWORK:
|
|
@@ -61,7 +62,10 @@ declare const AD_NETWORK:
|
|
|
61
62
|
| 'chartboost'
|
|
62
63
|
| 'pangle'
|
|
63
64
|
| 'mytarget'
|
|
64
|
-
| 'liftoff'
|
|
65
|
+
| 'liftoff'
|
|
66
|
+
| 'smadex'
|
|
67
|
+
| 'adikteev';
|
|
68
|
+
|
|
65
69
|
declare const AD_PROTOCOL: 'mraid' | 'dapi' | 'nucleo' | 'none';
|
|
66
70
|
declare const GOOGLE_PLAY_URL: string;
|
|
67
71
|
declare const APP_STORE_URL: string;
|
package/dist/esm/index.js
CHANGED
|
@@ -3,52 +3,41 @@ var registeredEvents = {};
|
|
|
3
3
|
function onEvent(event, fn, context, once) {
|
|
4
4
|
let listeners = registeredEvents[event];
|
|
5
5
|
if (!listeners) {
|
|
6
|
-
listeners = registeredEvents[event] =
|
|
7
|
-
list: []
|
|
8
|
-
};
|
|
6
|
+
listeners = registeredEvents[event] = [];
|
|
9
7
|
}
|
|
10
|
-
listeners.
|
|
8
|
+
listeners.push(fn, context || null, once || false);
|
|
11
9
|
}
|
|
12
10
|
function offEvent(event, fn, context) {
|
|
13
11
|
const listeners = registeredEvents[event];
|
|
14
12
|
if (!listeners) return;
|
|
15
|
-
const fnArray = listeners.list;
|
|
16
13
|
if (!fn) {
|
|
17
|
-
|
|
14
|
+
delete registeredEvents[event];
|
|
18
15
|
} else {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
i
|
|
22
|
-
|
|
23
|
-
fnArray.splice(i, 3);
|
|
16
|
+
const events = [];
|
|
17
|
+
for (let i = 0; i < listeners.length; i += 3) {
|
|
18
|
+
if (listeners[i] !== fn || context !== void 0 && listeners[i + 1] !== context) {
|
|
19
|
+
events.push(listeners[i], listeners[i + 1], listeners[i + 2]);
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
delete registeredEvents[event];
|
|
22
|
+
if (events.length === 0) delete registeredEvents[event];
|
|
23
|
+
else registeredEvents[event] = events;
|
|
29
24
|
}
|
|
30
25
|
}
|
|
31
26
|
function emitEvent(event, a1, a2, a3) {
|
|
32
27
|
const listeners = registeredEvents[event];
|
|
33
|
-
if (!listeners) return;
|
|
34
|
-
const fnArray = listeners.list;
|
|
28
|
+
if (!listeners || listeners.length === 0) return;
|
|
35
29
|
const len = arguments.length;
|
|
30
|
+
const listenersLen = listeners.length;
|
|
36
31
|
let fn, ctx;
|
|
37
|
-
for (let i = 0; i <
|
|
38
|
-
fn =
|
|
39
|
-
ctx =
|
|
40
|
-
if (
|
|
41
|
-
fnArray.splice(i, 3);
|
|
42
|
-
i -= 3;
|
|
43
|
-
}
|
|
32
|
+
for (let i = 0; i < listenersLen; i += 3) {
|
|
33
|
+
fn = listeners[i];
|
|
34
|
+
ctx = listeners[i + 1];
|
|
35
|
+
if (listeners[i + 2]) offEvent(event, fn, ctx);
|
|
44
36
|
if (len <= 1) fn.call(ctx);
|
|
45
37
|
else if (len == 2) fn.call(ctx, a1);
|
|
46
38
|
else if (len == 3) fn.call(ctx, a1, a2);
|
|
47
39
|
else fn.call(ctx, a1, a2, a3);
|
|
48
40
|
}
|
|
49
|
-
if (fnArray.length == 0) {
|
|
50
|
-
delete registeredEvents[event];
|
|
51
|
-
}
|
|
52
41
|
}
|
|
53
42
|
|
|
54
43
|
// src/protocols.ts
|
|
@@ -62,6 +51,7 @@ var GOOGLE = uid++;
|
|
|
62
51
|
var MINTEGRAL = uid++;
|
|
63
52
|
var TAPJOY = uid++;
|
|
64
53
|
var TIKTOK = uid++;
|
|
54
|
+
var SMADEX = uid++;
|
|
65
55
|
var actualProtocol = NONE;
|
|
66
56
|
function isMraid() {
|
|
67
57
|
return actualProtocol === MRAID;
|
|
@@ -75,6 +65,9 @@ function isNucleo() {
|
|
|
75
65
|
function isFacebook() {
|
|
76
66
|
return actualProtocol === FACEBOOK;
|
|
77
67
|
}
|
|
68
|
+
function isSmadex() {
|
|
69
|
+
return actualProtocol === SMADEX;
|
|
70
|
+
}
|
|
78
71
|
function isGoogle() {
|
|
79
72
|
return actualProtocol === GOOGLE;
|
|
80
73
|
}
|
|
@@ -116,6 +109,11 @@ function ensureProtocol() {
|
|
|
116
109
|
if (window.TJ_API) actualProtocol = TAPJOY;
|
|
117
110
|
} else if ("tiktok" === AD_NETWORK) {
|
|
118
111
|
if (window.openAppStore) actualProtocol = TIKTOK;
|
|
112
|
+
} else if ("smadex" === AD_NETWORK) {
|
|
113
|
+
try {
|
|
114
|
+
if (smxTracking) actualProtocol = SMADEX;
|
|
115
|
+
} catch (error) {
|
|
116
|
+
}
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
|
|
@@ -477,6 +475,8 @@ var _sdk = class _sdk {
|
|
|
477
475
|
NUC.trigger.convert(destinationUrl);
|
|
478
476
|
} else if ("facebook" == AD_NETWORK && isFacebook()) {
|
|
479
477
|
FbPlayableAd.onCTAClick();
|
|
478
|
+
} else if ("smadex" == AD_NETWORK && isSmadex()) {
|
|
479
|
+
smxTracking.redirect();
|
|
480
480
|
} else if ("vungle" == AD_NETWORK) {
|
|
481
481
|
parent.postMessage("download", "*");
|
|
482
482
|
} else if ("google" == AD_NETWORK && isGoogle()) {
|
|
@@ -591,7 +591,7 @@ var _sdk = class _sdk {
|
|
|
591
591
|
}
|
|
592
592
|
};
|
|
593
593
|
/** Current version of the SDK */
|
|
594
|
-
_sdk.version = "1.0.
|
|
594
|
+
_sdk.version = "1.0.20";
|
|
595
595
|
/** Current maximum width of the playable ad container in pixels */
|
|
596
596
|
_sdk.maxWidth = Math.floor(window.innerWidth);
|
|
597
597
|
/** Current maximum height of the playable ad container in pixels */
|
package/dist/iife/index.js
CHANGED
|
@@ -5,52 +5,41 @@
|
|
|
5
5
|
function onEvent(event, fn, context, once) {
|
|
6
6
|
let listeners = registeredEvents[event];
|
|
7
7
|
if (!listeners) {
|
|
8
|
-
listeners = registeredEvents[event] =
|
|
9
|
-
list: []
|
|
10
|
-
};
|
|
8
|
+
listeners = registeredEvents[event] = [];
|
|
11
9
|
}
|
|
12
|
-
listeners.
|
|
10
|
+
listeners.push(fn, context || null, once || false);
|
|
13
11
|
}
|
|
14
12
|
function offEvent(event, fn, context) {
|
|
15
13
|
const listeners = registeredEvents[event];
|
|
16
14
|
if (!listeners) return;
|
|
17
|
-
const fnArray = listeners.list;
|
|
18
15
|
if (!fn) {
|
|
19
|
-
|
|
16
|
+
delete registeredEvents[event];
|
|
20
17
|
} else {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
i
|
|
24
|
-
|
|
25
|
-
fnArray.splice(i, 3);
|
|
18
|
+
const events = [];
|
|
19
|
+
for (let i = 0; i < listeners.length; i += 3) {
|
|
20
|
+
if (listeners[i] !== fn || context !== void 0 && listeners[i + 1] !== context) {
|
|
21
|
+
events.push(listeners[i], listeners[i + 1], listeners[i + 2]);
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
delete registeredEvents[event];
|
|
24
|
+
if (events.length === 0) delete registeredEvents[event];
|
|
25
|
+
else registeredEvents[event] = events;
|
|
31
26
|
}
|
|
32
27
|
}
|
|
33
28
|
function emitEvent(event, a1, a2, a3) {
|
|
34
29
|
const listeners = registeredEvents[event];
|
|
35
|
-
if (!listeners) return;
|
|
36
|
-
const fnArray = listeners.list;
|
|
30
|
+
if (!listeners || listeners.length === 0) return;
|
|
37
31
|
const len = arguments.length;
|
|
32
|
+
const listenersLen = listeners.length;
|
|
38
33
|
let fn, ctx;
|
|
39
|
-
for (let i = 0; i <
|
|
40
|
-
fn =
|
|
41
|
-
ctx =
|
|
42
|
-
if (
|
|
43
|
-
fnArray.splice(i, 3);
|
|
44
|
-
i -= 3;
|
|
45
|
-
}
|
|
34
|
+
for (let i = 0; i < listenersLen; i += 3) {
|
|
35
|
+
fn = listeners[i];
|
|
36
|
+
ctx = listeners[i + 1];
|
|
37
|
+
if (listeners[i + 2]) offEvent(event, fn, ctx);
|
|
46
38
|
if (len <= 1) fn.call(ctx);
|
|
47
39
|
else if (len == 2) fn.call(ctx, a1);
|
|
48
40
|
else if (len == 3) fn.call(ctx, a1, a2);
|
|
49
41
|
else fn.call(ctx, a1, a2, a3);
|
|
50
42
|
}
|
|
51
|
-
if (fnArray.length == 0) {
|
|
52
|
-
delete registeredEvents[event];
|
|
53
|
-
}
|
|
54
43
|
}
|
|
55
44
|
|
|
56
45
|
// src/protocols.ts
|
|
@@ -64,6 +53,7 @@
|
|
|
64
53
|
var MINTEGRAL = uid++;
|
|
65
54
|
var TAPJOY = uid++;
|
|
66
55
|
var TIKTOK = uid++;
|
|
56
|
+
var SMADEX = uid++;
|
|
67
57
|
var actualProtocol = NONE;
|
|
68
58
|
function isMraid() {
|
|
69
59
|
return actualProtocol === MRAID;
|
|
@@ -77,6 +67,9 @@
|
|
|
77
67
|
function isFacebook() {
|
|
78
68
|
return actualProtocol === FACEBOOK;
|
|
79
69
|
}
|
|
70
|
+
function isSmadex() {
|
|
71
|
+
return actualProtocol === SMADEX;
|
|
72
|
+
}
|
|
80
73
|
function isGoogle() {
|
|
81
74
|
return actualProtocol === GOOGLE;
|
|
82
75
|
}
|
|
@@ -118,6 +111,11 @@
|
|
|
118
111
|
if (window.TJ_API) actualProtocol = TAPJOY;
|
|
119
112
|
} else if ("tiktok" === AD_NETWORK) {
|
|
120
113
|
if (window.openAppStore) actualProtocol = TIKTOK;
|
|
114
|
+
} else if ("smadex" === AD_NETWORK) {
|
|
115
|
+
try {
|
|
116
|
+
if (smxTracking) actualProtocol = SMADEX;
|
|
117
|
+
} catch (error) {
|
|
118
|
+
}
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
121
|
|
|
@@ -479,6 +477,8 @@
|
|
|
479
477
|
NUC.trigger.convert(destinationUrl);
|
|
480
478
|
} else if ("facebook" == AD_NETWORK && isFacebook()) {
|
|
481
479
|
FbPlayableAd.onCTAClick();
|
|
480
|
+
} else if ("smadex" == AD_NETWORK && isSmadex()) {
|
|
481
|
+
smxTracking.redirect();
|
|
482
482
|
} else if ("vungle" == AD_NETWORK) {
|
|
483
483
|
parent.postMessage("download", "*");
|
|
484
484
|
} else if ("google" == AD_NETWORK && isGoogle()) {
|
|
@@ -593,7 +593,7 @@
|
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
595
|
/** Current version of the SDK */
|
|
596
|
-
_sdk.version = "1.0.
|
|
596
|
+
_sdk.version = "1.0.20";
|
|
597
597
|
/** Current maximum width of the playable ad container in pixels */
|
|
598
598
|
_sdk.maxWidth = Math.floor(window.innerWidth);
|
|
599
599
|
/** Current maximum height of the playable ad container in pixels */
|
package/dist/index.js
CHANGED
|
@@ -30,52 +30,41 @@ var registeredEvents = {};
|
|
|
30
30
|
function onEvent(event, fn, context, once) {
|
|
31
31
|
let listeners = registeredEvents[event];
|
|
32
32
|
if (!listeners) {
|
|
33
|
-
listeners = registeredEvents[event] =
|
|
34
|
-
list: []
|
|
35
|
-
};
|
|
33
|
+
listeners = registeredEvents[event] = [];
|
|
36
34
|
}
|
|
37
|
-
listeners.
|
|
35
|
+
listeners.push(fn, context || null, once || false);
|
|
38
36
|
}
|
|
39
37
|
function offEvent(event, fn, context) {
|
|
40
38
|
const listeners = registeredEvents[event];
|
|
41
39
|
if (!listeners) return;
|
|
42
|
-
const fnArray = listeners.list;
|
|
43
40
|
if (!fn) {
|
|
44
|
-
|
|
41
|
+
delete registeredEvents[event];
|
|
45
42
|
} else {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
i
|
|
49
|
-
|
|
50
|
-
fnArray.splice(i, 3);
|
|
43
|
+
const events = [];
|
|
44
|
+
for (let i = 0; i < listeners.length; i += 3) {
|
|
45
|
+
if (listeners[i] !== fn || context !== void 0 && listeners[i + 1] !== context) {
|
|
46
|
+
events.push(listeners[i], listeners[i + 1], listeners[i + 2]);
|
|
51
47
|
}
|
|
52
48
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
delete registeredEvents[event];
|
|
49
|
+
if (events.length === 0) delete registeredEvents[event];
|
|
50
|
+
else registeredEvents[event] = events;
|
|
56
51
|
}
|
|
57
52
|
}
|
|
58
53
|
function emitEvent(event, a1, a2, a3) {
|
|
59
54
|
const listeners = registeredEvents[event];
|
|
60
|
-
if (!listeners) return;
|
|
61
|
-
const fnArray = listeners.list;
|
|
55
|
+
if (!listeners || listeners.length === 0) return;
|
|
62
56
|
const len = arguments.length;
|
|
57
|
+
const listenersLen = listeners.length;
|
|
63
58
|
let fn, ctx;
|
|
64
|
-
for (let i = 0; i <
|
|
65
|
-
fn =
|
|
66
|
-
ctx =
|
|
67
|
-
if (
|
|
68
|
-
fnArray.splice(i, 3);
|
|
69
|
-
i -= 3;
|
|
70
|
-
}
|
|
59
|
+
for (let i = 0; i < listenersLen; i += 3) {
|
|
60
|
+
fn = listeners[i];
|
|
61
|
+
ctx = listeners[i + 1];
|
|
62
|
+
if (listeners[i + 2]) offEvent(event, fn, ctx);
|
|
71
63
|
if (len <= 1) fn.call(ctx);
|
|
72
64
|
else if (len == 2) fn.call(ctx, a1);
|
|
73
65
|
else if (len == 3) fn.call(ctx, a1, a2);
|
|
74
66
|
else fn.call(ctx, a1, a2, a3);
|
|
75
67
|
}
|
|
76
|
-
if (fnArray.length == 0) {
|
|
77
|
-
delete registeredEvents[event];
|
|
78
|
-
}
|
|
79
68
|
}
|
|
80
69
|
|
|
81
70
|
// src/protocols.ts
|
|
@@ -89,6 +78,7 @@ var GOOGLE = uid++;
|
|
|
89
78
|
var MINTEGRAL = uid++;
|
|
90
79
|
var TAPJOY = uid++;
|
|
91
80
|
var TIKTOK = uid++;
|
|
81
|
+
var SMADEX = uid++;
|
|
92
82
|
var actualProtocol = NONE;
|
|
93
83
|
function isMraid() {
|
|
94
84
|
return actualProtocol === MRAID;
|
|
@@ -102,6 +92,9 @@ function isNucleo() {
|
|
|
102
92
|
function isFacebook() {
|
|
103
93
|
return actualProtocol === FACEBOOK;
|
|
104
94
|
}
|
|
95
|
+
function isSmadex() {
|
|
96
|
+
return actualProtocol === SMADEX;
|
|
97
|
+
}
|
|
105
98
|
function isGoogle() {
|
|
106
99
|
return actualProtocol === GOOGLE;
|
|
107
100
|
}
|
|
@@ -143,6 +136,11 @@ function ensureProtocol() {
|
|
|
143
136
|
if (window.TJ_API) actualProtocol = TAPJOY;
|
|
144
137
|
} else if ("tiktok" === AD_NETWORK) {
|
|
145
138
|
if (window.openAppStore) actualProtocol = TIKTOK;
|
|
139
|
+
} else if ("smadex" === AD_NETWORK) {
|
|
140
|
+
try {
|
|
141
|
+
if (smxTracking) actualProtocol = SMADEX;
|
|
142
|
+
} catch (error) {
|
|
143
|
+
}
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
|
|
@@ -504,6 +502,8 @@ var _sdk = class _sdk {
|
|
|
504
502
|
NUC.trigger.convert(destinationUrl);
|
|
505
503
|
} else if ("facebook" == AD_NETWORK && isFacebook()) {
|
|
506
504
|
FbPlayableAd.onCTAClick();
|
|
505
|
+
} else if ("smadex" == AD_NETWORK && isSmadex()) {
|
|
506
|
+
smxTracking.redirect();
|
|
507
507
|
} else if ("vungle" == AD_NETWORK) {
|
|
508
508
|
parent.postMessage("download", "*");
|
|
509
509
|
} else if ("google" == AD_NETWORK && isGoogle()) {
|
|
@@ -618,7 +618,7 @@ var _sdk = class _sdk {
|
|
|
618
618
|
}
|
|
619
619
|
};
|
|
620
620
|
/** Current version of the SDK */
|
|
621
|
-
_sdk.version = "1.0.
|
|
621
|
+
_sdk.version = "1.0.20";
|
|
622
622
|
/** Current maximum width of the playable ad container in pixels */
|
|
623
623
|
_sdk.maxWidth = Math.floor(window.innerWidth);
|
|
624
624
|
/** Current maximum height of the playable ad container in pixels */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smoud/playable-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "It's unified Playable SDK that supports MRAID, Google, Facebook, Vungle, and many more Ad Networks, simplifying playable ad development with a standardized interface for seamless cross-network compatibility.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|