@smoud/playable-sdk 1.1.2 → 1.1.4

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 CHANGED
@@ -43,6 +43,10 @@ It's powerful, unified SDK that seamlessly integrates multiple ad network SDKs,
43
43
  - Adikteev
44
44
  - Bigabid
45
45
  - inMobi
46
+ - Remerge
47
+ - Tencent
48
+ - YouAppi
49
+ - Aarki
46
50
 
47
51
  ### Protocol Support
48
52
 
@@ -170,6 +174,10 @@ Supported **Ad Networks**:
170
174
  - `adikteev`
171
175
  - `bigabid`
172
176
  - `inmobi`
177
+ - `remerge`
178
+ - `tencent`
179
+ - `youappi`
180
+ - `aarki`
173
181
 
174
182
  See more details in [`GitHub repository.`](https://github.com/smoudjs/playable-scripts?tab=readme-ov-file#installation)
175
183
 
@@ -352,6 +360,7 @@ sdk.off('eventName', [callback], [context]);
352
360
  | `retry` | - | Retry/restart triggered | Reset game state |
353
361
  | `finish` | - | Playable marked as complete | Show end screen |
354
362
  | `install` | - | Install action triggered | Track conversion |
363
+ | `error` | `message, action` | Ad network protocol reported an error | Log/report failures |
355
364
 
356
365
  ### Properties
357
366
 
package/defines.d.ts CHANGED
@@ -67,7 +67,11 @@ declare const AD_NETWORK:
67
67
  | 'smadex'
68
68
  | 'adikteev'
69
69
  | 'bigabid'
70
- | 'inmobi';
70
+ | 'inmobi'
71
+ | 'remerge'
72
+ | 'tencent'
73
+ | 'youappi'
74
+ | 'aarki';
71
75
 
72
76
  declare const AD_PROTOCOL: 'mraid' | 'dapi' | 'nucleo' | 'none';
73
77
  declare const GOOGLE_PLAY_URL: string;
@@ -95,8 +99,14 @@ interface Window {
95
99
  click: Function;
96
100
  };
97
101
 
102
+ // Tencent functions
103
+ TencentGDT?: {
104
+ clickOpen?: Function;
105
+ };
106
+
98
107
  BIGABID_BIDTIMEMACROS?: Record<string, string>
99
108
  INMOBI_DSPMACROS?: Record<string, string>
109
+ REMERGE_BIDTIMEMACROS?: Record<string, string>
100
110
 
101
111
  openAppStore: Function;
102
112
  }
package/dist/esm/index.js CHANGED
@@ -128,7 +128,7 @@ function ensureProtocol() {
128
128
 
129
129
  // src/tracking.ts
130
130
  function initTrackingProtocols() {
131
- if (AD_NETWORK === "bigabid" || AD_NETWORK === "inmobi") {
131
+ if (AD_NETWORK === "bigabid" || AD_NETWORK === "inmobi" || AD_NETWORK === "remerge") {
132
132
  let trackURL2 = function(url) {
133
133
  if (url) {
134
134
  const trackingPixel = new Image();
@@ -172,6 +172,22 @@ function initTrackingProtocols() {
172
172
  setTimeout(() => trackInMobiEvent2("Spent_25_Seconds"), 25e3);
173
173
  setTimeout(() => trackInMobiEvent2("Spent_30_Seconds"), 3e4);
174
174
  });
175
+ } else if (AD_NETWORK === "remerge") {
176
+ let trackRemergeEvent2 = function(event) {
177
+ if (window.REMERGE_BIDTIMEMACROS && window.REMERGE_BIDTIMEMACROS[event])
178
+ trackURL2(window.REMERGE_BIDTIMEMACROS[event]);
179
+ };
180
+ var trackRemergeEvent = trackRemergeEvent2;
181
+ sdk.once("boot", () => trackRemergeEvent2("ready"));
182
+ sdk.once("start", () => trackRemergeEvent2("impression"));
183
+ sdk.once("interaction", () => trackRemergeEvent2("engagement"));
184
+ sdk.once("install", () => trackRemergeEvent2("click"));
185
+ sdk.on("error", (message, action) => {
186
+ if (window.REMERGE_BIDTIMEMACROS && window.REMERGE_BIDTIMEMACROS.error)
187
+ trackURL2(
188
+ window.REMERGE_BIDTIMEMACROS.error.replace(/\{DOMAIN\}/g, encodeURIComponent(action || "")).replace(/\{ERR_MSG\}/g, encodeURIComponent(message || ""))
189
+ );
190
+ });
175
191
  }
176
192
  }
177
193
  }
@@ -265,8 +281,9 @@ function startMraidProtocol() {
265
281
  }
266
282
  }
267
283
  });
268
- mraid.addEventListener("error", function(t, e) {
269
- console.log("mraid error: " + t + " action: " + e);
284
+ mraid.addEventListener("error", function(message, action) {
285
+ console.log("mraid error: " + message + " action: " + action);
286
+ emitEvent("error", message, action);
270
287
  });
271
288
  if (AD_NETWORK === "unity") {
272
289
  window.addEventListener("resize", function() {
@@ -531,7 +548,9 @@ var _sdk = class _sdk {
531
548
  isInstallClicked = false;
532
549
  }, 500);
533
550
  emitEvent("install");
534
- if ("mraid" === AD_PROTOCOL && isMraid()) {
551
+ if ("tencent" === AD_NETWORK && window.TencentGDT && window.TencentGDT.clickOpen) {
552
+ window.TencentGDT.clickOpen();
553
+ } else if ("mraid" === AD_PROTOCOL && isMraid()) {
535
554
  mraid.open(destinationUrl);
536
555
  } else if ("dapi" === AD_PROTOCOL && isDapi()) {
537
556
  dapi.openStoreUrl();
@@ -657,7 +676,7 @@ var _sdk = class _sdk {
657
676
  }
658
677
  };
659
678
  /** Current version of the SDK */
660
- _sdk.version = "1.1.2";
679
+ _sdk.version = "1.1.4";
661
680
  /** Current maximum width of the playable ad container in pixels */
662
681
  _sdk.maxWidth = Math.floor(window.innerWidth);
663
682
  /** Current maximum height of the playable ad container in pixels */
@@ -130,7 +130,7 @@
130
130
 
131
131
  // src/tracking.ts
132
132
  function initTrackingProtocols() {
133
- if (AD_NETWORK === "bigabid" || AD_NETWORK === "inmobi") {
133
+ if (AD_NETWORK === "bigabid" || AD_NETWORK === "inmobi" || AD_NETWORK === "remerge") {
134
134
  let trackURL2 = function(url) {
135
135
  if (url) {
136
136
  const trackingPixel = new Image();
@@ -174,6 +174,22 @@
174
174
  setTimeout(() => trackInMobiEvent2("Spent_25_Seconds"), 25e3);
175
175
  setTimeout(() => trackInMobiEvent2("Spent_30_Seconds"), 3e4);
176
176
  });
177
+ } else if (AD_NETWORK === "remerge") {
178
+ let trackRemergeEvent2 = function(event) {
179
+ if (window.REMERGE_BIDTIMEMACROS && window.REMERGE_BIDTIMEMACROS[event])
180
+ trackURL2(window.REMERGE_BIDTIMEMACROS[event]);
181
+ };
182
+ var trackRemergeEvent = trackRemergeEvent2;
183
+ sdk.once("boot", () => trackRemergeEvent2("ready"));
184
+ sdk.once("start", () => trackRemergeEvent2("impression"));
185
+ sdk.once("interaction", () => trackRemergeEvent2("engagement"));
186
+ sdk.once("install", () => trackRemergeEvent2("click"));
187
+ sdk.on("error", (message, action) => {
188
+ if (window.REMERGE_BIDTIMEMACROS && window.REMERGE_BIDTIMEMACROS.error)
189
+ trackURL2(
190
+ window.REMERGE_BIDTIMEMACROS.error.replace(/\{DOMAIN\}/g, encodeURIComponent(action || "")).replace(/\{ERR_MSG\}/g, encodeURIComponent(message || ""))
191
+ );
192
+ });
177
193
  }
178
194
  }
179
195
  }
@@ -267,8 +283,9 @@
267
283
  }
268
284
  }
269
285
  });
270
- mraid.addEventListener("error", function(t, e) {
271
- console.log("mraid error: " + t + " action: " + e);
286
+ mraid.addEventListener("error", function(message, action) {
287
+ console.log("mraid error: " + message + " action: " + action);
288
+ emitEvent("error", message, action);
272
289
  });
273
290
  if (AD_NETWORK === "unity") {
274
291
  window.addEventListener("resize", function() {
@@ -533,7 +550,9 @@
533
550
  isInstallClicked = false;
534
551
  }, 500);
535
552
  emitEvent("install");
536
- if ("mraid" === AD_PROTOCOL && isMraid()) {
553
+ if ("tencent" === AD_NETWORK && window.TencentGDT && window.TencentGDT.clickOpen) {
554
+ window.TencentGDT.clickOpen();
555
+ } else if ("mraid" === AD_PROTOCOL && isMraid()) {
537
556
  mraid.open(destinationUrl);
538
557
  } else if ("dapi" === AD_PROTOCOL && isDapi()) {
539
558
  dapi.openStoreUrl();
@@ -659,7 +678,7 @@
659
678
  }
660
679
  };
661
680
  /** Current version of the SDK */
662
- _sdk.version = "1.1.2";
681
+ _sdk.version = "1.1.4";
663
682
  /** Current maximum width of the playable ad container in pixels */
664
683
  _sdk.maxWidth = Math.floor(window.innerWidth);
665
684
  /** Current maximum height of the playable ad container in pixels */
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- type EventName = 'init' | 'boot' | 'ready' | 'start' | 'interaction' | 'resize' | 'pause' | 'resume' | 'volume' | 'retry' | 'finish' | 'install';
1
+ type EventName = 'init' | 'boot' | 'ready' | 'start' | 'interaction' | 'resize' | 'pause' | 'resume' | 'volume' | 'retry' | 'finish' | 'install' | 'error';
2
2
 
3
3
  type InitCallbackType = (maxWidth: number, maxHeight: number) => void;
4
4
  /**
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- type EventName = 'init' | 'boot' | 'ready' | 'start' | 'interaction' | 'resize' | 'pause' | 'resume' | 'volume' | 'retry' | 'finish' | 'install';
1
+ type EventName = 'init' | 'boot' | 'ready' | 'start' | 'interaction' | 'resize' | 'pause' | 'resume' | 'volume' | 'retry' | 'finish' | 'install' | 'error';
2
2
 
3
3
  type InitCallbackType = (maxWidth: number, maxHeight: number) => void;
4
4
  /**
package/dist/index.js CHANGED
@@ -155,7 +155,7 @@ function ensureProtocol() {
155
155
 
156
156
  // src/tracking.ts
157
157
  function initTrackingProtocols() {
158
- if (AD_NETWORK === "bigabid" || AD_NETWORK === "inmobi") {
158
+ if (AD_NETWORK === "bigabid" || AD_NETWORK === "inmobi" || AD_NETWORK === "remerge") {
159
159
  let trackURL2 = function(url) {
160
160
  if (url) {
161
161
  const trackingPixel = new Image();
@@ -199,6 +199,22 @@ function initTrackingProtocols() {
199
199
  setTimeout(() => trackInMobiEvent2("Spent_25_Seconds"), 25e3);
200
200
  setTimeout(() => trackInMobiEvent2("Spent_30_Seconds"), 3e4);
201
201
  });
202
+ } else if (AD_NETWORK === "remerge") {
203
+ let trackRemergeEvent2 = function(event) {
204
+ if (window.REMERGE_BIDTIMEMACROS && window.REMERGE_BIDTIMEMACROS[event])
205
+ trackURL2(window.REMERGE_BIDTIMEMACROS[event]);
206
+ };
207
+ var trackRemergeEvent = trackRemergeEvent2;
208
+ sdk.once("boot", () => trackRemergeEvent2("ready"));
209
+ sdk.once("start", () => trackRemergeEvent2("impression"));
210
+ sdk.once("interaction", () => trackRemergeEvent2("engagement"));
211
+ sdk.once("install", () => trackRemergeEvent2("click"));
212
+ sdk.on("error", (message, action) => {
213
+ if (window.REMERGE_BIDTIMEMACROS && window.REMERGE_BIDTIMEMACROS.error)
214
+ trackURL2(
215
+ window.REMERGE_BIDTIMEMACROS.error.replace(/\{DOMAIN\}/g, encodeURIComponent(action || "")).replace(/\{ERR_MSG\}/g, encodeURIComponent(message || ""))
216
+ );
217
+ });
202
218
  }
203
219
  }
204
220
  }
@@ -292,8 +308,9 @@ function startMraidProtocol() {
292
308
  }
293
309
  }
294
310
  });
295
- mraid.addEventListener("error", function(t, e) {
296
- console.log("mraid error: " + t + " action: " + e);
311
+ mraid.addEventListener("error", function(message, action) {
312
+ console.log("mraid error: " + message + " action: " + action);
313
+ emitEvent("error", message, action);
297
314
  });
298
315
  if (AD_NETWORK === "unity") {
299
316
  window.addEventListener("resize", function() {
@@ -558,7 +575,9 @@ var _sdk = class _sdk {
558
575
  isInstallClicked = false;
559
576
  }, 500);
560
577
  emitEvent("install");
561
- if ("mraid" === AD_PROTOCOL && isMraid()) {
578
+ if ("tencent" === AD_NETWORK && window.TencentGDT && window.TencentGDT.clickOpen) {
579
+ window.TencentGDT.clickOpen();
580
+ } else if ("mraid" === AD_PROTOCOL && isMraid()) {
562
581
  mraid.open(destinationUrl);
563
582
  } else if ("dapi" === AD_PROTOCOL && isDapi()) {
564
583
  dapi.openStoreUrl();
@@ -684,7 +703,7 @@ var _sdk = class _sdk {
684
703
  }
685
704
  };
686
705
  /** Current version of the SDK */
687
- _sdk.version = "1.1.2";
706
+ _sdk.version = "1.1.4";
688
707
  /** Current maximum width of the playable ad container in pixels */
689
708
  _sdk.maxWidth = Math.floor(window.innerWidth);
690
709
  /** 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.1.2",
3
+ "version": "1.1.4",
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",