@smoud/playable-sdk 1.1.1 → 1.1.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/README.md CHANGED
@@ -43,6 +43,7 @@ It's powerful, unified SDK that seamlessly integrates multiple ad network SDKs,
43
43
  - Adikteev
44
44
  - Bigabid
45
45
  - inMobi
46
+ - Remerge
46
47
 
47
48
  ### Protocol Support
48
49
 
@@ -170,6 +171,7 @@ Supported **Ad Networks**:
170
171
  - `adikteev`
171
172
  - `bigabid`
172
173
  - `inmobi`
174
+ - `remerge`
173
175
 
174
176
  See more details in [`GitHub repository.`](https://github.com/smoudjs/playable-scripts?tab=readme-ov-file#installation)
175
177
 
@@ -352,6 +354,7 @@ sdk.off('eventName', [callback], [context]);
352
354
  | `retry` | - | Retry/restart triggered | Reset game state |
353
355
  | `finish` | - | Playable marked as complete | Show end screen |
354
356
  | `install` | - | Install action triggered | Track conversion |
357
+ | `error` | `message, action` | Ad network protocol reported an error | Log/report failures |
355
358
 
356
359
  ### Properties
357
360
 
package/defines.d.ts CHANGED
@@ -67,7 +67,8 @@ declare const AD_NETWORK:
67
67
  | 'smadex'
68
68
  | 'adikteev'
69
69
  | 'bigabid'
70
- | 'inmobi';
70
+ | 'inmobi'
71
+ | 'remerge';
71
72
 
72
73
  declare const AD_PROTOCOL: 'mraid' | 'dapi' | 'nucleo' | 'none';
73
74
  declare const GOOGLE_PLAY_URL: string;
@@ -97,6 +98,7 @@ interface Window {
97
98
 
98
99
  BIGABID_BIDTIMEMACROS?: Record<string, string>
99
100
  INMOBI_DSPMACROS?: Record<string, string>
101
+ REMERGE_BIDTIMEMACROS?: Record<string, string>
100
102
 
101
103
  openAppStore: Function;
102
104
  }
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() {
@@ -476,6 +493,7 @@ var _sdk = class _sdk {
476
493
  * @fires finish When the playable ad is marked as finished
477
494
  */
478
495
  static finish() {
496
+ if ("vungle" === AD_NETWORK && _sdk.isFinished) return;
479
497
  _sdk.isFinished = true;
480
498
  if ("tapjoy" === AD_NETWORK && isTapjoy()) {
481
499
  finishTapjoy();
@@ -515,7 +533,7 @@ var _sdk = class _sdk {
515
533
  * @fires install When the install action is triggered
516
534
  */
517
535
  static install() {
518
- if (!_sdk.isFinished) {
536
+ if (!_sdk.isFinished && "vungle" !== AD_NETWORK) {
519
537
  let timeout = 0;
520
538
  if ("tapjoy" === AD_NETWORK) timeout = 300;
521
539
  _sdk.finish();
@@ -656,7 +674,7 @@ var _sdk = class _sdk {
656
674
  }
657
675
  };
658
676
  /** Current version of the SDK */
659
- _sdk.version = "1.1.1";
677
+ _sdk.version = "1.1.3";
660
678
  /** Current maximum width of the playable ad container in pixels */
661
679
  _sdk.maxWidth = Math.floor(window.innerWidth);
662
680
  /** 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() {
@@ -478,6 +495,7 @@
478
495
  * @fires finish When the playable ad is marked as finished
479
496
  */
480
497
  static finish() {
498
+ if ("vungle" === AD_NETWORK && _sdk.isFinished) return;
481
499
  _sdk.isFinished = true;
482
500
  if ("tapjoy" === AD_NETWORK && isTapjoy()) {
483
501
  finishTapjoy();
@@ -517,7 +535,7 @@
517
535
  * @fires install When the install action is triggered
518
536
  */
519
537
  static install() {
520
- if (!_sdk.isFinished) {
538
+ if (!_sdk.isFinished && "vungle" !== AD_NETWORK) {
521
539
  let timeout = 0;
522
540
  if ("tapjoy" === AD_NETWORK) timeout = 300;
523
541
  _sdk.finish();
@@ -658,7 +676,7 @@
658
676
  }
659
677
  };
660
678
  /** Current version of the SDK */
661
- _sdk.version = "1.1.1";
679
+ _sdk.version = "1.1.3";
662
680
  /** Current maximum width of the playable ad container in pixels */
663
681
  _sdk.maxWidth = Math.floor(window.innerWidth);
664
682
  /** 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() {
@@ -503,6 +520,7 @@ var _sdk = class _sdk {
503
520
  * @fires finish When the playable ad is marked as finished
504
521
  */
505
522
  static finish() {
523
+ if ("vungle" === AD_NETWORK && _sdk.isFinished) return;
506
524
  _sdk.isFinished = true;
507
525
  if ("tapjoy" === AD_NETWORK && isTapjoy()) {
508
526
  finishTapjoy();
@@ -542,7 +560,7 @@ var _sdk = class _sdk {
542
560
  * @fires install When the install action is triggered
543
561
  */
544
562
  static install() {
545
- if (!_sdk.isFinished) {
563
+ if (!_sdk.isFinished && "vungle" !== AD_NETWORK) {
546
564
  let timeout = 0;
547
565
  if ("tapjoy" === AD_NETWORK) timeout = 300;
548
566
  _sdk.finish();
@@ -683,7 +701,7 @@ var _sdk = class _sdk {
683
701
  }
684
702
  };
685
703
  /** Current version of the SDK */
686
- _sdk.version = "1.1.1";
704
+ _sdk.version = "1.1.3";
687
705
  /** Current maximum width of the playable ad container in pixels */
688
706
  _sdk.maxWidth = Math.floor(window.innerWidth);
689
707
  /** 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.1",
3
+ "version": "1.1.3",
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",