@blotoutio/providers-app-lovin-sdk 1.63.3 → 1.64.1

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/index.cjs.js CHANGED
@@ -45,6 +45,8 @@ const init = ({ manifest }) => {
45
45
  window['axon']('init');
46
46
  };
47
47
 
48
+ const keyPrefix = `_worker`;
49
+
48
50
  const canLog = () => {
49
51
  try {
50
52
  return localStorage.getItem('edgeTagDebug') === '1';
@@ -77,6 +79,48 @@ const logger = {
77
79
  },
78
80
  };
79
81
 
82
+ const initKey = `${keyPrefix}StoreMultiple`;
83
+ const getData = (destination, persistType, key = initKey) => {
84
+ let data;
85
+ if (persistType === 'session') {
86
+ data = getSession(key);
87
+ }
88
+ else {
89
+ data = getLocal(key);
90
+ }
91
+ return (data === null || data === void 0 ? void 0 : data[destination]) || {};
92
+ };
93
+ const getLocal = (key) => {
94
+ try {
95
+ if (!localStorage) {
96
+ return {};
97
+ }
98
+ const data = localStorage.getItem(key);
99
+ if (!data) {
100
+ return {};
101
+ }
102
+ return JSON.parse(data) || {};
103
+ }
104
+ catch {
105
+ return {};
106
+ }
107
+ };
108
+ const getSession = (key) => {
109
+ try {
110
+ if (!sessionStorage) {
111
+ return {};
112
+ }
113
+ const data = sessionStorage.getItem(key);
114
+ if (!data) {
115
+ return {};
116
+ }
117
+ return JSON.parse(data) || {};
118
+ }
119
+ catch {
120
+ return {};
121
+ }
122
+ };
123
+
80
124
  /**
81
125
  * Known ad-network click ID query parameters and the human-readable provider
82
126
  * label each one maps to. Used by the CDN worker to resolve `inSessionTouch`
@@ -496,7 +540,31 @@ const usStates = new Map([
496
540
  ['US-UM', 'United States Minor Outlying Islands'],
497
541
  ['US-VI', 'Virgin Islands, U.S.'],
498
542
  ]);
499
- new Set([...isoCountries.keys(), ...usStates.keys()]);
543
+ /**
544
+ * ISO 3166-2:CA province and territory codes, keyed `CA-XX` to mirror
545
+ * `usStates`. Used by the consent banner's Canada region to offer province
546
+ * selection (Québec is treated specially by the regional consent config).
547
+ */
548
+ const caProvinces = new Map([
549
+ ['CA-AB', 'Alberta'],
550
+ ['CA-BC', 'British Columbia'],
551
+ ['CA-MB', 'Manitoba'],
552
+ ['CA-NB', 'New Brunswick'],
553
+ ['CA-NL', 'Newfoundland and Labrador'],
554
+ ['CA-NS', 'Nova Scotia'],
555
+ ['CA-NT', 'Northwest Territories'],
556
+ ['CA-NU', 'Nunavut'],
557
+ ['CA-ON', 'Ontario'],
558
+ ['CA-PE', 'Prince Edward Island'],
559
+ ['CA-QC', 'Quebec'],
560
+ ['CA-SK', 'Saskatchewan'],
561
+ ['CA-YT', 'Yukon'],
562
+ ]);
563
+ new Set([
564
+ ...isoCountries.keys(),
565
+ ...usStates.keys(),
566
+ ...caProvinces.keys(),
567
+ ]);
500
568
 
501
569
  /**
502
570
  * Exact utm_source normalization (lowercase key → canonical name).
@@ -832,20 +900,25 @@ const getEventData = ({ eventName, userData, data, defaultCategory, categoryMapp
832
900
  }
833
901
  };
834
902
 
835
- const tag = ({ data, eventName, eventId, manifestVariables, userId, }) => {
903
+ const tag = ({ data, eventName, eventId, manifestVariables, userId, destination, }) => {
836
904
  const payload = {
837
- sdkVersion: "1.63.3" ,
905
+ sdkVersion: "1.64.1" ,
838
906
  };
839
907
  if (window.axon && manifestVariables['enableBrowser'] === '1') {
840
908
  try {
841
909
  const defaultCategory = manifestVariables['defaultCategory'];
842
910
  const categoryMapping = manifestVariables['categoryMapping'];
911
+ // email/phone usually arrive via the data API (stored in session KV),
912
+ // not on the event payload itself.
913
+ const kv = getData(destination, 'session')['kv'];
843
914
  const userData = { user_id: userId };
844
- if (data === null || data === void 0 ? void 0 : data['email']) {
845
- userData.email = data['email'];
915
+ const email = (data === null || data === void 0 ? void 0 : data['email']) || (kv === null || kv === void 0 ? void 0 : kv['email']);
916
+ if (email && typeof email === 'string') {
917
+ userData.email = email;
846
918
  }
847
- if (data === null || data === void 0 ? void 0 : data['phone']) {
848
- userData.phone = data['phone'];
919
+ const phone = (data === null || data === void 0 ? void 0 : data['phone']) || (kv === null || kv === void 0 ? void 0 : kv['phone']);
920
+ if (phone && typeof phone === 'string') {
921
+ userData.phone = phone;
849
922
  }
850
923
  const event = getEventData({
851
924
  eventName,
package/index.js CHANGED
@@ -46,6 +46,8 @@ var ProvidersAppLovinSdk = (function () {
46
46
  window['axon']('init');
47
47
  };
48
48
 
49
+ const keyPrefix = `_worker`;
50
+
49
51
  const canLog = () => {
50
52
  try {
51
53
  return localStorage.getItem('edgeTagDebug') === '1';
@@ -78,6 +80,48 @@ var ProvidersAppLovinSdk = (function () {
78
80
  },
79
81
  };
80
82
 
83
+ const initKey = `${keyPrefix}StoreMultiple`;
84
+ const getData = (destination, persistType, key = initKey) => {
85
+ let data;
86
+ if (persistType === 'session') {
87
+ data = getSession(key);
88
+ }
89
+ else {
90
+ data = getLocal(key);
91
+ }
92
+ return (data === null || data === void 0 ? void 0 : data[destination]) || {};
93
+ };
94
+ const getLocal = (key) => {
95
+ try {
96
+ if (!localStorage) {
97
+ return {};
98
+ }
99
+ const data = localStorage.getItem(key);
100
+ if (!data) {
101
+ return {};
102
+ }
103
+ return JSON.parse(data) || {};
104
+ }
105
+ catch {
106
+ return {};
107
+ }
108
+ };
109
+ const getSession = (key) => {
110
+ try {
111
+ if (!sessionStorage) {
112
+ return {};
113
+ }
114
+ const data = sessionStorage.getItem(key);
115
+ if (!data) {
116
+ return {};
117
+ }
118
+ return JSON.parse(data) || {};
119
+ }
120
+ catch {
121
+ return {};
122
+ }
123
+ };
124
+
81
125
  /**
82
126
  * Known ad-network click ID query parameters and the human-readable provider
83
127
  * label each one maps to. Used by the CDN worker to resolve `inSessionTouch`
@@ -497,7 +541,31 @@ var ProvidersAppLovinSdk = (function () {
497
541
  ['US-UM', 'United States Minor Outlying Islands'],
498
542
  ['US-VI', 'Virgin Islands, U.S.'],
499
543
  ]);
500
- new Set([...isoCountries.keys(), ...usStates.keys()]);
544
+ /**
545
+ * ISO 3166-2:CA province and territory codes, keyed `CA-XX` to mirror
546
+ * `usStates`. Used by the consent banner's Canada region to offer province
547
+ * selection (Québec is treated specially by the regional consent config).
548
+ */
549
+ const caProvinces = new Map([
550
+ ['CA-AB', 'Alberta'],
551
+ ['CA-BC', 'British Columbia'],
552
+ ['CA-MB', 'Manitoba'],
553
+ ['CA-NB', 'New Brunswick'],
554
+ ['CA-NL', 'Newfoundland and Labrador'],
555
+ ['CA-NS', 'Nova Scotia'],
556
+ ['CA-NT', 'Northwest Territories'],
557
+ ['CA-NU', 'Nunavut'],
558
+ ['CA-ON', 'Ontario'],
559
+ ['CA-PE', 'Prince Edward Island'],
560
+ ['CA-QC', 'Quebec'],
561
+ ['CA-SK', 'Saskatchewan'],
562
+ ['CA-YT', 'Yukon'],
563
+ ]);
564
+ new Set([
565
+ ...isoCountries.keys(),
566
+ ...usStates.keys(),
567
+ ...caProvinces.keys(),
568
+ ]);
501
569
 
502
570
  /**
503
571
  * Exact utm_source normalization (lowercase key → canonical name).
@@ -833,20 +901,25 @@ var ProvidersAppLovinSdk = (function () {
833
901
  }
834
902
  };
835
903
 
836
- const tag = ({ data, eventName, eventId, manifestVariables, userId, }) => {
904
+ const tag = ({ data, eventName, eventId, manifestVariables, userId, destination, }) => {
837
905
  const payload = {
838
- sdkVersion: "1.63.3" ,
906
+ sdkVersion: "1.64.1" ,
839
907
  };
840
908
  if (window.axon && manifestVariables['enableBrowser'] === '1') {
841
909
  try {
842
910
  const defaultCategory = manifestVariables['defaultCategory'];
843
911
  const categoryMapping = manifestVariables['categoryMapping'];
912
+ // email/phone usually arrive via the data API (stored in session KV),
913
+ // not on the event payload itself.
914
+ const kv = getData(destination, 'session')['kv'];
844
915
  const userData = { user_id: userId };
845
- if (data === null || data === void 0 ? void 0 : data['email']) {
846
- userData.email = data['email'];
916
+ const email = (data === null || data === void 0 ? void 0 : data['email']) || (kv === null || kv === void 0 ? void 0 : kv['email']);
917
+ if (email && typeof email === 'string') {
918
+ userData.email = email;
847
919
  }
848
- if (data === null || data === void 0 ? void 0 : data['phone']) {
849
- userData.phone = data['phone'];
920
+ const phone = (data === null || data === void 0 ? void 0 : data['phone']) || (kv === null || kv === void 0 ? void 0 : kv['phone']);
921
+ if (phone && typeof phone === 'string') {
922
+ userData.phone = phone;
850
923
  }
851
924
  const event = getEventData({
852
925
  eventName,
package/index.mjs CHANGED
@@ -43,6 +43,8 @@ const init = ({ manifest }) => {
43
43
  window['axon']('init');
44
44
  };
45
45
 
46
+ const keyPrefix = `_worker`;
47
+
46
48
  const canLog = () => {
47
49
  try {
48
50
  return localStorage.getItem('edgeTagDebug') === '1';
@@ -75,6 +77,48 @@ const logger = {
75
77
  },
76
78
  };
77
79
 
80
+ const initKey = `${keyPrefix}StoreMultiple`;
81
+ const getData = (destination, persistType, key = initKey) => {
82
+ let data;
83
+ if (persistType === 'session') {
84
+ data = getSession(key);
85
+ }
86
+ else {
87
+ data = getLocal(key);
88
+ }
89
+ return (data === null || data === void 0 ? void 0 : data[destination]) || {};
90
+ };
91
+ const getLocal = (key) => {
92
+ try {
93
+ if (!localStorage) {
94
+ return {};
95
+ }
96
+ const data = localStorage.getItem(key);
97
+ if (!data) {
98
+ return {};
99
+ }
100
+ return JSON.parse(data) || {};
101
+ }
102
+ catch {
103
+ return {};
104
+ }
105
+ };
106
+ const getSession = (key) => {
107
+ try {
108
+ if (!sessionStorage) {
109
+ return {};
110
+ }
111
+ const data = sessionStorage.getItem(key);
112
+ if (!data) {
113
+ return {};
114
+ }
115
+ return JSON.parse(data) || {};
116
+ }
117
+ catch {
118
+ return {};
119
+ }
120
+ };
121
+
78
122
  /**
79
123
  * Known ad-network click ID query parameters and the human-readable provider
80
124
  * label each one maps to. Used by the CDN worker to resolve `inSessionTouch`
@@ -494,7 +538,31 @@ const usStates = new Map([
494
538
  ['US-UM', 'United States Minor Outlying Islands'],
495
539
  ['US-VI', 'Virgin Islands, U.S.'],
496
540
  ]);
497
- new Set([...isoCountries.keys(), ...usStates.keys()]);
541
+ /**
542
+ * ISO 3166-2:CA province and territory codes, keyed `CA-XX` to mirror
543
+ * `usStates`. Used by the consent banner's Canada region to offer province
544
+ * selection (Québec is treated specially by the regional consent config).
545
+ */
546
+ const caProvinces = new Map([
547
+ ['CA-AB', 'Alberta'],
548
+ ['CA-BC', 'British Columbia'],
549
+ ['CA-MB', 'Manitoba'],
550
+ ['CA-NB', 'New Brunswick'],
551
+ ['CA-NL', 'Newfoundland and Labrador'],
552
+ ['CA-NS', 'Nova Scotia'],
553
+ ['CA-NT', 'Northwest Territories'],
554
+ ['CA-NU', 'Nunavut'],
555
+ ['CA-ON', 'Ontario'],
556
+ ['CA-PE', 'Prince Edward Island'],
557
+ ['CA-QC', 'Quebec'],
558
+ ['CA-SK', 'Saskatchewan'],
559
+ ['CA-YT', 'Yukon'],
560
+ ]);
561
+ new Set([
562
+ ...isoCountries.keys(),
563
+ ...usStates.keys(),
564
+ ...caProvinces.keys(),
565
+ ]);
498
566
 
499
567
  /**
500
568
  * Exact utm_source normalization (lowercase key → canonical name).
@@ -830,20 +898,25 @@ const getEventData = ({ eventName, userData, data, defaultCategory, categoryMapp
830
898
  }
831
899
  };
832
900
 
833
- const tag = ({ data, eventName, eventId, manifestVariables, userId, }) => {
901
+ const tag = ({ data, eventName, eventId, manifestVariables, userId, destination, }) => {
834
902
  const payload = {
835
- sdkVersion: "1.63.3" ,
903
+ sdkVersion: "1.64.1" ,
836
904
  };
837
905
  if (window.axon && manifestVariables['enableBrowser'] === '1') {
838
906
  try {
839
907
  const defaultCategory = manifestVariables['defaultCategory'];
840
908
  const categoryMapping = manifestVariables['categoryMapping'];
909
+ // email/phone usually arrive via the data API (stored in session KV),
910
+ // not on the event payload itself.
911
+ const kv = getData(destination, 'session')['kv'];
841
912
  const userData = { user_id: userId };
842
- if (data === null || data === void 0 ? void 0 : data['email']) {
843
- userData.email = data['email'];
913
+ const email = (data === null || data === void 0 ? void 0 : data['email']) || (kv === null || kv === void 0 ? void 0 : kv['email']);
914
+ if (email && typeof email === 'string') {
915
+ userData.email = email;
844
916
  }
845
- if (data === null || data === void 0 ? void 0 : data['phone']) {
846
- userData.phone = data['phone'];
917
+ const phone = (data === null || data === void 0 ? void 0 : data['phone']) || (kv === null || kv === void 0 ? void 0 : kv['phone']);
918
+ if (phone && typeof phone === 'string') {
919
+ userData.phone = phone;
847
920
  }
848
921
  const event = getEventData({
849
922
  eventName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-app-lovin-sdk",
3
- "version": "1.63.3",
3
+ "version": "1.64.1",
4
4
  "description": "App Lovin Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",