-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathindex.js
833 lines (704 loc) · 26.2 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
'use strict';
import {
NativeEventEmitter,
NativeModules,
Platform,
} from 'react-native';
const module_adjust = NativeModules.Adjust;
let module_adjust_emitter = null;
if (Platform.OS === "android") {
module_adjust_emitter = new NativeEventEmitter(NativeModules.Adjust);
} else if (Platform.OS === "ios") {
module_adjust_emitter = new NativeEventEmitter(NativeModules.AdjustEventEmitter);
}
// Adjust
var Adjust = {};
Adjust.initSdk = function(adjustConfig) {
module_adjust.initSdk(adjustConfig);
};
Adjust.enable = function() {
module_adjust.enable();
};
Adjust.disable = function() {
module_adjust.disable();
};
Adjust.isEnabled = function(callback) {
module_adjust.isEnabled(callback);
};
Adjust.switchToOfflineMode = function() {
module_adjust.switchToOfflineMode();
};
Adjust.switchBackToOnlineMode = function() {
module_adjust.switchBackToOnlineMode();
};
Adjust.trackEvent = function(adjustEvent) {
module_adjust.trackEvent(adjustEvent);
};
Adjust.trackAdRevenue = function(adjustAdrevenue) {
module_adjust.trackAdRevenue(adjustAdrevenue);
};
Adjust.setPushToken = function(token) {
if (typeof token !== 'string') {
console.log("[Adjust] Push token is not of type string");
return;
}
module_adjust.setPushToken(token);
};
Adjust.processDeeplink = function(adjustDeeplink) {
module_adjust.processDeeplink(adjustDeeplink);
};
Adjust.trackAppStoreSubscription = function(adjustAppStoreSubscription) {
if (Platform.OS === "ios") {
module_adjust.trackAppStoreSubscription(adjustAppStoreSubscription);
}
};
Adjust.trackPlayStoreSubscription = function(adjustPlayStoreSubscription) {
if (Platform.OS === "android") {
module_adjust.trackPlayStoreSubscription(adjustPlayStoreSubscription);
}
};
Adjust.addGlobalCallbackParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] Global callback parameter key or value is not of type string");
return;
}
module_adjust.addGlobalCallbackParameter(key, value);
};
Adjust.addGlobalPartnerParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] Global partner parameter key or value is not of type string");
return;
}
module_adjust.addGlobalPartnerParameter(key, value);
};
Adjust.removeGlobalCallbackParameter = function(key) {
if (typeof key !== 'string') {
console.log("[Adjust] Global callback parameter key is not of type string");
return;
}
module_adjust.removeGlobalCallbackParameter(key);
};
Adjust.removeGlobalPartnerParameter = function(key) {
if (typeof key !== 'string') {
console.log("[Adjust] Global partner parameter key is not of type string");
return;
}
module_adjust.removeGlobalPartnerParameter(key);
};
Adjust.removeGlobalCallbackParameters = function() {
module_adjust.removeGlobalCallbackParameters();
};
Adjust.removeGlobalPartnerParameters = function() {
module_adjust.removeGlobalPartnerParameters();
};
Adjust.gdprForgetMe = function() {
module_adjust.gdprForgetMe();
};
Adjust.getIdfa = function(callback) {
if (Platform.OS === "ios") {
module_adjust.getIdfa(callback);
}
};
Adjust.getIdfv = function(callback) {
if (Platform.OS === "ios") {
module_adjust.getIdfv(callback);
}
};
Adjust.getGoogleAdId = function(callback) {
if (Platform.OS === "android") {
module_adjust.getGoogleAdId(callback);
}
};
Adjust.getAdid = function(callback) {
module_adjust.getAdid(callback);
};
Adjust.getAttribution = function(callback) {
module_adjust.getAttribution(callback);
};
Adjust.getAmazonAdId = function(callback) {
if (Platform.OS === "android") {
module_adjust.getAmazonAdId(callback);
}
};
Adjust.getSdkVersion = function(callback) {
module_adjust.getSdkVersion("react-native5.0.4", callback);
};
Adjust.requestAppTrackingAuthorization = function(callback) {
if (Platform.OS === "ios") {
module_adjust.requestAppTrackingAuthorization(callback);
}
};
Adjust.updateSkanConversionValue = function(conversionValue, coarseValue, lockWindow, callback) {
if (Platform.OS === "ios") {
if (!Number.isInteger(conversionValue) ||
typeof coarseValue !== 'string' ||
typeof lockWindow !== 'boolean') {
console.log("[Adjust] SKAN parameters are not of a proper data types");
return;
}
module_adjust.updateSkanConversionValue(conversionValue, coarseValue, lockWindow, callback);
}
};
Adjust.getAppTrackingAuthorizationStatus = function(callback) {
if (Platform.OS === "ios") {
module_adjust.getAppTrackingAuthorizationStatus(callback);
}
};
Adjust.trackThirdPartySharing = function(adjustThirdPartySharing) {
module_adjust.trackThirdPartySharing(adjustThirdPartySharing);
};
Adjust.trackMeasurementConsent = function(measurementConsent) {
if (typeof measurementConsent !== 'boolean') {
console.log("[Adjust] Measurement consent is not of type boolean");
return;
}
module_adjust.trackMeasurementConsent(measurementConsent);
};
Adjust.getLastDeeplink = function(callback) {
module_adjust.getLastDeeplink(callback);
};
Adjust.verifyAppStorePurchase = function(adjustAppStorePurchase, callback) {
if (Platform.OS === "ios") {
module_adjust.verifyAppStorePurchase(adjustAppStorePurchase, callback);
}
};
Adjust.verifyAndTrackAppStorePurchase = function(adjustEvent, callback) {
if (Platform.OS === "ios") {
module_adjust.verifyAndTrackAppStorePurchase(adjustEvent, callback);
}
};
Adjust.verifyPlayStorePurchase = function(adjustPlayStorePurchase, callback) {
if (Platform.OS === "android") {
module_adjust.verifyPlayStorePurchase(adjustPlayStorePurchase, callback);
}
};
Adjust.verifyAndTrackPlayStorePurchase = function(adjustEvent, callback) {
if (Platform.OS === "android") {
module_adjust.verifyAndTrackPlayStorePurchase(adjustEvent, callback);
}
};
Adjust.processAndResolveDeeplink = function(adjustDeeplink, callback) {
module_adjust.processAndResolveDeeplink(adjustDeeplink, callback);
};
Adjust.componentWillUnmount = function() {
if (AdjustConfig.AttributionCallback != null) {
AdjustConfig.AttributionCallback.remove();
AdjustConfig.AttributionCallback = null;
}
if (AdjustConfig.EventTrackingSucceededCallback != null) {
AdjustConfig.EventTrackingSucceededCallback.remove();
AdjustConfig.EventTrackingSucceededCallback = null;
}
if (AdjustConfig.EventTrackingFailedCallback != null) {
AdjustConfig.EventTrackingFailedCallback.remove();
AdjustConfig.EventTrackingFailedCallback = null;
}
if (AdjustConfig.SessionTrackingSucceededCallback != null) {
AdjustConfig.SessionTrackingSucceededCallback.remove();
AdjustConfig.SessionTrackingSucceededCallback = null;
}
if (AdjustConfig.SessionTrackingFailedCallback != null) {
AdjustConfig.SessionTrackingFailedCallback.remove();
AdjustConfig.SessionTrackingFailedCallback = null;
}
if (AdjustConfig.DeferredDeeplinkCallback != null) {
AdjustConfig.DeferredDeeplinkCallback.remove();
AdjustConfig.DeferredDeeplinkCallback = null;
}
if (AdjustConfig.SkanUpdatedCallback != null) {
AdjustConfig.SkanUpdatedCallback.remove();
AdjustConfig.SkanUpdatedCallback = null;
}
};
// =========================================== //
// Adjust methods used for SDK testing only. //
// Do NOT use any of these in production code. //
// =========================================== //
Adjust.teardown = function(testParam) {
if (testParam === null || testParam === undefined || testParam !== 'test') {
return;
}
Adjust.componentWillUnmount();
module_adjust.teardown();
};
Adjust.setTestOptions = function(testOptions) {
module_adjust.setTestOptions(testOptions);
};
Adjust.onResume = function(testParam) {
if (testParam === null || testParam === undefined || testParam !== 'test') {
return;
}
module_adjust.onResume();
};
Adjust.onPause = function(testParam) {
if (testParam === null || testParam === undefined || testParam !== 'test') {
return;
}
module_adjust.onPause();
};
// AdjustConfig
var AdjustConfig = function(appToken, environment) {
this.sdkPrefix = "react-native5.0.4";
this.appToken = appToken;
this.environment = environment;
this.logLevel = null;
this.isDeferredDeeplinkOpeningEnabled = null;
this.isSendingInBackgroundEnabled = null;
this.isCostDataInAttributionEnabled = null;
this.defaultTracker = null;
this.externalDeviceId = null;
this.isDeviceIdsReadingOnceEnabled = null;
this.isCoppaComplianceEnabled = null;
this.eventDeduplicationIdsMaxSize = null;
this.isDataResidency = null;
this.urlStrategyDomains = null;
this.useSubdomains = null;
// Android only
this.processName = null;
this.isPreinstallTrackingEnabled = null;
this.preinstallFilePath = null;
this.isPlayStoreKidsComplianceEnabled = null;
this.fbAppId;
// iOS only
this.isAdServicesEnabled = null;
this.isIdfaReadingAllowed = null;
this.isIdfvReadingAllowed = null;
this.isSkanAttributionEnabled = null;
this.attConsentWaitingInterval = null;
this.isLinkMeEnabled = null;
};
AdjustConfig.EnvironmentSandbox = "sandbox";
AdjustConfig.EnvironmentProduction = "production";
AdjustConfig.LogLevelVerbose = "VERBOSE";
AdjustConfig.LogLevelDebug = "DEBUG";
AdjustConfig.LogLevelInfo = "INFO";
AdjustConfig.LogLevelWarn = "WARN";
AdjustConfig.LogLevelError = "ERROR";
AdjustConfig.LogLevelAssert = "ASSERT";
AdjustConfig.LogLevelSuppress = "SUPPRESS";
AdjustConfig.AttributionCallback = null;
AdjustConfig.EventTrackingSucceededCallback = null;
AdjustConfig.EventTrackingFailedCallback = null;
AdjustConfig.SessionTrackingSucceededCallback = null;
AdjustConfig.SessionTrackingFailedCallback = null;
AdjustConfig.DeferredDeeplinkCallback = null;
AdjustConfig.SkanUpdatedCallback = null
AdjustConfig.prototype.setSdkPrefix = function(sdkPrefix) {
if (typeof sdkPrefix !== 'string') {
console.log("[Adjust] SDK prefix is not of type string");
return;
}
this.sdkPrefix = sdkPrefix;
};
AdjustConfig.prototype.setLogLevel = function(logLevel) {
if (typeof logLevel !== 'string') {
console.log("[Adjust] Log level is not of type string");
return;
}
this.logLevel = logLevel;
};
AdjustConfig.prototype.disableDeferredDeeplinkOpening = function() {
this.isDeferredDeeplinkOpeningEnabled = false;
};
AdjustConfig.prototype.enableSendingInBackground = function() {
this.isSendingInBackgroundEnabled = true;
};
AdjustConfig.prototype.setDefaultTracker = function(defaultTracker) {
if (typeof defaultTracker !== 'string') {
console.log("[Adjust] Default tracker is not of type string");
return;
}
this.defaultTracker = defaultTracker;
};
AdjustConfig.prototype.setExternalDeviceId = function(externalDeviceId) {
if (typeof externalDeviceId !== 'string') {
console.log("[Adjust] External device ID is not of type string");
return;
}
this.externalDeviceId = externalDeviceId;
};
AdjustConfig.prototype.enableDeviceIdsReadingOnce = function() {
this.isDeviceIdsReadingOnceEnabled = true;
};
AdjustConfig.prototype.enableCoppaCompliance = function() {
this.isCoppaComplianceEnabled = true;
};
AdjustConfig.prototype.enableCostDataInAttribution = function() {
this.isCostDataInAttributionEnabled = true;
};
AdjustConfig.prototype.enablePreinstallTracking = function() {
this.isPreinstallTrackingEnabled = true;
};
AdjustConfig.prototype.setPreinstallFilePath = function(preinstallFilePath) {
if (typeof preinstallFilePath !== 'string') {
console.log("[Adjust] Preinstall file path is not of type string");
return;
}
this.preinstallFilePath = preinstallFilePath;
};
AdjustConfig.prototype.enablePlayStoreKidsCompliance = function() {
this.isPlayStoreKidsComplianceEnabled = true;
};
AdjustConfig.prototype.setFbAppId = function(fbAppId) {
if (typeof fbAppId !== 'string') {
console.log("[Adjust] FB app ID is not of type string");
return;
}
this.fbAppId = fbAppId;
};
AdjustConfig.prototype.disableAdServices = function() {
this.isAdServicesEnabled = false;
};
AdjustConfig.prototype.disableIdfaReading = function() {
this.isIdfaReadingAllowed = false;
};
AdjustConfig.prototype.disableIdfvReading = function() {
this.isIdfvReadingAllowed = false;
};
AdjustConfig.prototype.disableSkanAttribution = function() {
this.isSkanAttributionEnabled = false;
};
AdjustConfig.prototype.enableLinkMe = function() {
this.isLinkMeEnabled = true;
};
AdjustConfig.prototype.setAttConsentWaitingInterval = function(attConsentWaitingInterval) {
if (!Number.isInteger(attConsentWaitingInterval)) {
console.log("[Adjust] ATT consent waiting interval is not of type integer");
return;
}
this.attConsentWaitingInterval = attConsentWaitingInterval;
};
AdjustConfig.prototype.setEventDeduplicationIdsMaxSize = function(eventDeduplicationIdsMaxSize) {
if (!Number.isInteger(eventDeduplicationIdsMaxSize)) {
console.log("[Adjust] Maximum number of event deduplication IDs is not of type integer");
return;
}
this.eventDeduplicationIdsMaxSize = eventDeduplicationIdsMaxSize;
};
AdjustConfig.prototype.setUrlStrategy = function(urlStrategyDomains, useSubdomains, isDataResidency) {
if (!Array.isArray(urlStrategyDomains) ||
typeof useSubdomains !== 'boolean' ||
typeof isDataResidency !== 'boolean') {
console.log("[Adjust] URL strategy parameters are not of a proper data types");
return;
}
this.urlStrategyDomains = urlStrategyDomains;
this.useSubdomains = useSubdomains;
this.isDataResidency = isDataResidency;
};
AdjustConfig.prototype.setAttributionCallback = function(attributionCallback) {
if (null == AdjustConfig.AttributionCallback) {
module_adjust.setAttributionCallbackImplemented();
AdjustConfig.AttributionCallback = module_adjust_emitter.addListener(
'adjust_attributionChanged', attributionCallback
);
}
};
AdjustConfig.prototype.setEventTrackingSucceededCallback = function(eventTrackingSucceededCallback) {
if (null == AdjustConfig.EventTrackingSucceededCallback) {
module_adjust.setEventTrackingSucceededCallbackImplemented();
AdjustConfig.EventTrackingSucceededCallback = module_adjust_emitter.addListener(
'adjust_eventTrackingSucceeded', eventTrackingSucceededCallback
);
}
};
AdjustConfig.prototype.setEventTrackingFailedCallback = function(eventTrackingFailedCallback) {
if (null == AdjustConfig.EventTrackingFailedCallback) {
module_adjust.setEventTrackingFailedCallbackImplemented();
AdjustConfig.EventTrackingFailedCallback = module_adjust_emitter.addListener(
'adjust_eventTrackingFailed', eventTrackingFailedCallback
);
}
};
AdjustConfig.prototype.setSessionTrackingSucceededCallback = function(sessionTrackingSucceededCallback) {
if (null == AdjustConfig.SessionTrackingSucceededCallback) {
module_adjust.setSessionTrackingSucceededCallbackImplemented();
AdjustConfig.SessionTrackingSucceededCallback = module_adjust_emitter.addListener(
'adjust_sessionTrackingSucceeded', sessionTrackingSucceededCallback
);
}
};
AdjustConfig.prototype.setSessionTrackingFailedCallback = function(sessionTrackingFailedCallback) {
if (null == AdjustConfig.SessionTrackingFailedCallback) {
module_adjust.setSessionTrackingFailedCallbackImplemented();
AdjustConfig.SessionTrackingFailedCallback = module_adjust_emitter.addListener(
'adjust_sessionTrackingFailed', sessionTrackingFailedCallback
);
}
};
AdjustConfig.prototype.setDeferredDeeplinkCallback = function(deferredDeeplinkCallback) {
if (null == AdjustConfig.DeferredDeeplinkCallback) {
module_adjust.setDeferredDeeplinkCallbackImplemented();
AdjustConfig.DeferredDeeplinkCallback = module_adjust_emitter.addListener(
'adjust_deferredDeeplinkReceived', deferredDeeplinkCallback
);
}
};
AdjustConfig.prototype.setSkanUpdatedCallback = function(skanUpdatedCallback) {
if (Platform.OS === "ios") {
if (null == AdjustConfig.SkanUpdatedCallback) {
module_adjust.setSkanUpdatedCallbackImplemented();
AdjustConfig.SkanUpdatedCallback = module_adjust_emitter.addListener(
'adjust_skanUpdated', skanUpdatedCallback
);
}
}
};
// AdjustEvent
var AdjustEvent = function(eventToken) {
this.eventToken = eventToken;
this.revenue = null;
this.currency = null;
this.deduplicationId = null;
this.productId = null;
this.transactionId = null;
this.purchaseToken = null;
this.callbackId = null;
this.callbackParameters = [];
this.partnerParameters = [];
};
AdjustEvent.prototype.setRevenue = function(revenue, currency) {
if (typeof revenue !== 'number' || typeof currency !== 'string') {
console.log("[Adjust] Event revenue or currency is not of a proper data type");
}
this.revenue = revenue;
this.currency = currency;
};
AdjustEvent.prototype.addCallbackParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] Event callback parameter key or value is not of type string");
return;
}
this.callbackParameters.push(key);
this.callbackParameters.push(value);
};
AdjustEvent.prototype.addPartnerParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] Event partner parameter key or value is not of type string");
return;
}
this.partnerParameters.push(key);
this.partnerParameters.push(value);
};
AdjustEvent.prototype.setProductId = function(productId) {
if (typeof productId !== 'string') {
console.log("[Adjust] Event product ID is not of type string");
return;
}
this.productId = productId;
};
AdjustEvent.prototype.setTransactionId = function(transactionId) {
if (typeof transactionId !== 'string') {
console.log("[Adjust] Event transaction ID is not of type string");
return;
}
this.transactionId = transactionId;
};
AdjustEvent.prototype.setPurchaseToken = function(purchaseToken) {
if (typeof purchaseToken !== 'string') {
console.log("[Adjust] Event purchase token is not of type string");
return;
}
this.purchaseToken = purchaseToken;
};
AdjustEvent.prototype.setDeduplicationId = function(deduplicationId) {
if (typeof deduplicationId !== 'string') {
console.log("[Adjust] Event deduplication ID is not of type string");
return;
}
this.deduplicationId = deduplicationId;
};
AdjustEvent.prototype.setCallbackId = function(callbackId) {
if (typeof callbackId !== 'string') {
console.log("[Adjust] Event callback ID is not of type string");
return;
}
this.callbackId = callbackId;
};
// AdjustAppStoreSubscription
var AdjustAppStoreSubscription = function(price, currency, transactionId) {
this.price = price;
this.currency = currency;
this.transactionId = transactionId;
this.transactionDate = null;
this.salesRegion = null;
this.callbackParameters = [];
this.partnerParameters = [];
};
AdjustAppStoreSubscription.prototype.setTransactionDate = function(transactionDate) {
if (typeof transactionDate !== 'string') {
console.log("[Adjust] App Store subscription transaction date is not of type string");
return;
}
this.transactionDate = transactionDate;
};
AdjustAppStoreSubscription.prototype.setSalesRegion = function(salesRegion) {
if (typeof salesRegion !== 'string') {
console.log("[Adjust] App Store subscription sales region is not of type string");
return;
}
this.salesRegion = salesRegion;
};
AdjustAppStoreSubscription.prototype.addCallbackParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] App Store subscription callback parameter key or value is not of type string");
return;
}
this.callbackParameters.push(key);
this.callbackParameters.push(value);
};
AdjustAppStoreSubscription.prototype.addPartnerParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] App Store subscription partner parameter key or value is not of type string");
return;
}
this.partnerParameters.push(key);
this.partnerParameters.push(value);
};
// AdjustPlayStoreSubscription
var AdjustPlayStoreSubscription = function(price, currency, sku, orderId, signature, purchaseToken) {
this.price = price;
this.currency = currency;
this.sku = sku;
this.orderId = orderId;
this.signature = signature;
this.purchaseToken = purchaseToken;
this.purchaseTime = null;
this.callbackParameters = [];
this.partnerParameters = [];
};
AdjustPlayStoreSubscription.prototype.setPurchaseTime = function(purchaseTime) {
if (!Number.isInteger(purchaseTime)) {
console.log("[Adjust] Play Store subscription purchase time is not of type integer");
return;
}
this.purchaseTime = purchaseTime;
};
AdjustPlayStoreSubscription.prototype.addCallbackParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] Play Store subscription callback parameter key or value is not of type string");
return;
}
this.callbackParameters.push(key);
this.callbackParameters.push(value);
};
AdjustPlayStoreSubscription.prototype.addPartnerParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] Play Store subscription partner parameter key or value is not of type string");
return;
}
this.partnerParameters.push(key);
this.partnerParameters.push(value);
};
var AdjustThirdPartySharing = function(isEnabled) {
this.isEnabled = isEnabled;
this.granularOptions = [];
this.partnerSharingSettings = [];
};
AdjustThirdPartySharing.prototype.addGranularOption = function(partnerName, key, value) {
if (typeof partnerName !== 'string' || typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] Granular option parameterName, key or value is not of a type string");
return;
}
this.granularOptions.push(partnerName);
this.granularOptions.push(key);
this.granularOptions.push(value);
};
AdjustThirdPartySharing.prototype.addPartnerSharingSetting = function(partnerName, key, value) {
if (typeof partnerName !== 'string' || typeof key !== 'string' || typeof value !== 'boolean') {
console.log("[Adjust] Partner sharing setting parameters are not of a proper data type");
return;
}
this.partnerSharingSettings.push(partnerName);
this.partnerSharingSettings.push(key);
this.partnerSharingSettings.push(value);
};
// AdjustAdRevenue
var AdjustAdRevenue = function(source) {
this.source = source;
this.revenue = null;
this.currency = null;
this.adImpressionsCount = null;
this.adRevenueNetwork = null;
this.adRevenueUnit = null;
this.adRevenuePlacement = null;
this.callbackParameters = [];
this.partnerParameters = [];
};
AdjustAdRevenue.prototype.setRevenue = function(revenue, currency) {
if (typeof revenue !== 'number' || typeof currency !== 'string') {
console.log("[Adjust] Ad revenue or currency is not of a proper data type");
}
this.revenue = revenue;
this.currency = currency;
};
AdjustAdRevenue.prototype.setAdImpressionsCount = function(adImpressionsCount) {
if (!Number.isInteger(adImpressionsCount)) {
console.log("[Adjust] Ad impressions count is not of type integer");
return;
}
this.adImpressionsCount = adImpressionsCount;
};
AdjustAdRevenue.prototype.setAdRevenueNetwork = function(adRevenueNetwork) {
if (typeof adRevenueNetwork !== 'string') {
console.log("[Adjust] Ad revenue network is not of type string");
return;
}
this.adRevenueNetwork = adRevenueNetwork;
};
AdjustAdRevenue.prototype.setAdRevenueUnit = function(adRevenueUnit) {
if (typeof adRevenueUnit !== 'string') {
console.log("[Adjust] Ad revenue unit is not of type string");
return;
}
this.adRevenueUnit = adRevenueUnit;
};
AdjustAdRevenue.prototype.setAdRevenuePlacement = function(adRevenuePlacement) {
if (typeof adRevenuePlacement !== 'string') {
console.log("[Adjust] Ad revenue placement is not of type string");
return;
}
this.adRevenuePlacement = adRevenuePlacement;
};
AdjustAdRevenue.prototype.addCallbackParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] Ad revenue callback parameter key or value is not of type string");
return;
}
this.callbackParameters.push(key);
this.callbackParameters.push(value);
};
AdjustAdRevenue.prototype.addPartnerParameter = function(key, value) {
if (typeof key !== 'string' || typeof value !== 'string') {
console.log("[Adjust] Ad revenue partner parameter key or value is not of type string");
return;
}
this.partnerParameters.push(key);
this.partnerParameters.push(value);
};
// AdjustAppStorePurchase
var AdjustAppStorePurchase = function(productId, transactionId) {
this.productId = productId;
this.transactionId = transactionId;
};
// AdjustPlayStorePurchase
var AdjustPlayStorePurchase = function(productId, purchaseToken) {
this.productId = productId;
this.purchaseToken = purchaseToken;
};
// AdjustDeeplink
var AdjustDeeplink = function(deeplink) {
this.deeplink = deeplink;
};
module.exports = {
Adjust,
AdjustConfig,
AdjustEvent,
AdjustAdRevenue,
AdjustThirdPartySharing,
AdjustAppStoreSubscription,
AdjustPlayStoreSubscription,
AdjustAppStorePurchase,
AdjustPlayStorePurchase,
AdjustDeeplink
}