@magicpixel/rn-mp-client-sdk 1.13.0 → 1.13.21
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 +163 -14
- package/lib/commonjs/common/app-types.js.map +1 -1
- package/lib/commonjs/common/constants.js +11 -2
- package/lib/commonjs/common/constants.js.map +1 -1
- package/lib/commonjs/common/data-store.js +13 -30
- package/lib/commonjs/common/data-store.js.map +1 -1
- package/lib/commonjs/common/deeplink-helper.js +174 -0
- package/lib/commonjs/common/deeplink-helper.js.map +1 -0
- package/lib/commonjs/common/device-info-helper.js +168 -0
- package/lib/commonjs/common/device-info-helper.js.map +1 -0
- package/lib/commonjs/common/event-bus.js +39 -0
- package/lib/commonjs/common/event-bus.js.map +1 -1
- package/lib/commonjs/common/network-service.js +119 -15
- package/lib/commonjs/common/network-service.js.map +1 -1
- package/lib/commonjs/common/reporter.js +75 -14
- package/lib/commonjs/common/reporter.js.map +1 -1
- package/lib/commonjs/common/storage-helper.js +227 -0
- package/lib/commonjs/common/storage-helper.js.map +1 -0
- package/lib/commonjs/common/utils.js +62 -2
- package/lib/commonjs/common/utils.js.map +1 -1
- package/lib/commonjs/eedl/eedl.js +198 -44
- package/lib/commonjs/eedl/eedl.js.map +1 -1
- package/lib/commonjs/index.js +301 -54
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/mp-client-sdk.js +17 -10
- package/lib/commonjs/models/mp-client-sdk.js.map +1 -1
- package/lib/commonjs/processors/data-element.processor.js +51 -7
- package/lib/commonjs/processors/data-element.processor.js.map +1 -1
- package/lib/commonjs/processors/visit-id.processor.js +78 -15
- package/lib/commonjs/processors/visit-id.processor.js.map +1 -1
- package/lib/module/common/app-types.js.map +1 -1
- package/lib/module/common/constants.js +11 -2
- package/lib/module/common/constants.js.map +1 -1
- package/lib/module/common/data-store.js +13 -30
- package/lib/module/common/data-store.js.map +1 -1
- package/lib/module/common/deeplink-helper.js +168 -0
- package/lib/module/common/deeplink-helper.js.map +1 -0
- package/lib/module/common/device-info-helper.js +161 -0
- package/lib/module/common/device-info-helper.js.map +1 -0
- package/lib/module/common/event-bus.js +39 -0
- package/lib/module/common/event-bus.js.map +1 -1
- package/lib/module/common/network-service.js +119 -15
- package/lib/module/common/network-service.js.map +1 -1
- package/lib/module/common/reporter.js +76 -14
- package/lib/module/common/reporter.js.map +1 -1
- package/lib/module/common/storage-helper.js +221 -0
- package/lib/module/common/storage-helper.js.map +1 -0
- package/lib/module/common/utils.js +63 -2
- package/lib/module/common/utils.js.map +1 -1
- package/lib/module/eedl/eedl.js +198 -44
- package/lib/module/eedl/eedl.js.map +1 -1
- package/lib/module/index.js +290 -53
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/mp-client-sdk.js +16 -9
- package/lib/module/models/mp-client-sdk.js.map +1 -1
- package/lib/module/processors/data-element.processor.js +51 -7
- package/lib/module/processors/data-element.processor.js.map +1 -1
- package/lib/module/processors/visit-id.processor.js +78 -15
- package/lib/module/processors/visit-id.processor.js.map +1 -1
- package/lib/typescript/{common → src/common}/app-types.d.ts +30 -9
- package/lib/typescript/{common → src/common}/constants.d.ts +0 -1
- package/lib/typescript/{common → src/common}/data-store.d.ts +3 -8
- package/lib/typescript/src/common/deeplink-helper.d.ts +60 -0
- package/lib/typescript/src/common/device-info-helper.d.ts +54 -0
- package/lib/typescript/src/common/event-bus.d.ts +21 -0
- package/lib/typescript/src/common/network-service.d.ts +32 -0
- package/lib/typescript/{common → src/common}/reporter.d.ts +2 -1
- package/lib/typescript/src/common/storage-helper.d.ts +47 -0
- package/lib/typescript/{common → src/common}/utils.d.ts +25 -0
- package/lib/typescript/{eedl → src/eedl}/eedl.d.ts +43 -1
- package/lib/typescript/{index.d.ts → src/index.d.ts} +39 -5
- package/lib/typescript/{models → src/models}/mp-client-sdk.d.ts +7 -0
- package/lib/typescript/src/processors/visit-id.processor.d.ts +23 -0
- package/package.json +25 -36
- package/src/common/app-types.ts +33 -10
- package/src/common/constants.ts +0 -6
- package/src/common/data-store.ts +8 -30
- package/src/common/deeplink-helper.ts +181 -0
- package/src/common/device-info-helper.ts +190 -0
- package/src/common/event-bus.ts +39 -0
- package/src/common/network-service.ts +154 -21
- package/src/common/reporter.ts +97 -16
- package/src/common/storage-helper.ts +260 -0
- package/src/common/utils.ts +63 -2
- package/src/eedl/eedl.ts +225 -51
- package/src/index.tsx +346 -73
- package/src/models/mp-client-sdk.ts +8 -0
- package/src/processors/data-element.processor.ts +85 -7
- package/src/processors/visit-id.processor.ts +92 -22
- package/lib/commonjs/processors/trans-function.processor.js +0 -73
- package/lib/commonjs/processors/trans-function.processor.js.map +0 -1
- package/lib/module/processors/trans-function.processor.js +0 -66
- package/lib/module/processors/trans-function.processor.js.map +0 -1
- package/lib/typescript/common/event-bus.d.ts +0 -6
- package/lib/typescript/common/network-service.d.ts +0 -8
- package/lib/typescript/processors/trans-function.processor.d.ts +0 -12
- package/lib/typescript/processors/visit-id.processor.d.ts +0 -9
- package/src/processors/trans-function.processor.ts +0 -85
- /package/lib/typescript/{common → src/common}/logger.d.ts +0 -0
- /package/lib/typescript/{models → src/models}/geo-api-response.d.ts +0 -0
- /package/lib/typescript/{processors → src/processors}/data-element.processor.d.ts +0 -0
- /package/lib/typescript/{processors → src/processors}/geo-location.processor.d.ts +0 -0
- /package/lib/typescript/{processors → src/processors}/qc.processor.d.ts +0 -0
- /package/lib/typescript/{processors → src/processors}/tag.processor.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Logger","DataStore","Constants","Reporter","NetworkService","Utils","VisitIdProcessor","init","orgId","initDebugId","setOrResetVisitorId","setOrResetVisitInfo","isFirstOpenAfterInstall","firstOpenFlag","getDataFromStorage","KEY_FIRST_OPEN","storeData","err","logError","getFacebookFBP","fbp","KEY_FBP","Date","now","addCommonCookie","debugId","KEY_MP_DEBUG_ID","indexOf","undefined","getSimpleDebugId","setDebugId","incrementDepth","visitInfo","KEY_MP_IDL_VISIT_ID_INFO","visitId","getUniqueID","visitCt","visitDepth","visitTs","visitVer","_visitInfo","setVisitInfo","visitInfoToString","reportError","incrementVisitDepth","_visitorInfoData","visitorInfoData","KEY_MP_IDL_VISITOR_ID_INFO","mId","logDbg","fetchIdlInfo","getIdlUrl","setVisitorInfo","cookieValue","encodeURIComponent","JSON","stringify","dId"],"sources":["visit-id.processor.ts"],"sourcesContent":["import { Logger } from '../common/logger';\nimport { DataStore } from '../common/data-store';\nimport { Constants } from '../common/constants';\nimport { Reporter } from '../common/reporter';\nimport { NetworkService } from '../common/network-service';\nimport type { VisitInfo, VisitorInfo } from '../common/app-types';\nimport { Utils } from '../common/utils';\n\nexport class VisitIdProcessor {\n static async init(orgId: string): Promise<void> {\n await this.initDebugId(orgId);\n await this.setOrResetVisitorId();\n await this.setOrResetVisitInfo(false);\n }\n\n static async isFirstOpenAfterInstall(): Promise<boolean> {\n try {\n const firstOpenFlag = await DataStore.getDataFromStorage<string>(\n Constants.KEY_FIRST_OPEN\n );\n\n if (!firstOpenFlag) {\n await DataStore.storeData(Constants.KEY_FIRST_OPEN, 'No');\n return true;\n }\n } catch (err) {\n Logger.logError('Unable to determine first open after install flag', err);\n }\n return false;\n }\n\n static async getFacebookFBP(): Promise<string> {\n try {\n let fbp = await DataStore.getDataFromStorage<string>(Constants.KEY_FBP);\n\n if (!fbp) {\n fbp = `fb.1.${Date.now()}.${Date.now()}`;\n }\n\n await DataStore.storeData(Constants.KEY_FBP, fbp);\n\n DataStore.addCommonCookie('x-fbp', fbp);\n\n return fbp;\n } catch (err) {\n Logger.logError('Error initializing debug id.', err);\n }\n return '';\n }\n\n static async initDebugId(orgId: string): Promise<void> {\n try {\n let debugId = await DataStore.getDataFromStorage<string>(\n Constants.KEY_MP_DEBUG_ID\n );\n\n if (debugId && debugId.indexOf(orgId) !== 0) {\n // re-generate debug id if it is not of the simple variety\n debugId = undefined;\n }\n\n if (!debugId) {\n debugId = Utils.getSimpleDebugId(orgId);\n }\n\n await DataStore.storeData(Constants.KEY_MP_DEBUG_ID, debugId);\n DataStore.setDebugId(debugId);\n } catch (err) {\n Logger.logError('Error initializing debug id.', err);\n }\n }\n\n static async setOrResetVisitInfo(incrementDepth: boolean): Promise<void> {\n try {\n let visitInfo: VisitInfo = await DataStore.getDataFromStorage(\n Constants.KEY_MP_IDL_VISIT_ID_INFO\n );\n\n if (!visitInfo) {\n // may be first time visit, set up a new visit info object and return\n visitInfo = {\n visitId: Utils.getUniqueID(),\n visitCt: 1,\n visitDepth: 0,\n visitTs: Date.now(),\n visitVer: 1,\n };\n } else {\n // reset visit id anyway, but retain the visitCt and depth setting\n visitInfo.visitId = Utils.getUniqueID();\n if (incrementDepth) {\n visitInfo.visitDepth = (visitInfo?.visitDepth ?? 0) + 1;\n } else {\n visitInfo.visitCt = visitInfo.visitCt + 1;\n visitInfo.visitDepth = 0;\n }\n visitInfo.visitTs = Date.now();\n visitInfo.visitVer = 1;\n }\n\n DataStore.setVisitInfo(visitInfo);\n await DataStore.storeData(Constants.KEY_MP_IDL_VISIT_ID_INFO, visitInfo);\n DataStore.addCommonCookie('x-mp-vid', DataStore.visitInfoToString());\n } catch (err) {\n Logger.logError(err);\n DataStore.setVisitInfo(null);\n Reporter.reportError('setOrResetVisitInfo', err);\n }\n }\n\n static async incrementVisitDepth(): Promise<void> {\n return this.setOrResetVisitInfo(true);\n }\n\n static async setOrResetVisitorId(): Promise<void> {\n try {\n let visitorInfoData: VisitorInfo = await DataStore.getDataFromStorage(\n Constants.KEY_MP_IDL_VISITOR_ID_INFO\n );\n\n if (\n !visitorInfoData ||\n (visitorInfoData && visitorInfoData?.mId.indexOf('-') === -1)\n ) {\n Logger.logDbg('VisitorInfo not found. Refreshing from server');\n // get a new visit id and device id from server and store it in storage\n visitorInfoData = await NetworkService.fetchIdlInfo(\n DataStore.getIdlUrl()\n );\n }\n\n if (!visitorInfoData) {\n return;\n } else {\n DataStore.setVisitorInfo(visitorInfoData);\n // store to db as well\n await DataStore.storeData(\n Constants.KEY_MP_IDL_VISITOR_ID_INFO,\n visitorInfoData\n );\n\n const cookieValue = encodeURIComponent(JSON.stringify(visitorInfoData));\n DataStore.addCommonCookie('x-mplidl', cookieValue);\n DataStore.addCommonCookie('x-mpidl', cookieValue);\n DataStore.addCommonCookie('x-lmid', visitorInfoData.mId);\n DataStore.addCommonCookie('x-ldid', visitorInfoData.dId);\n }\n } catch (err) {\n Logger.logError(err);\n DataStore.setVisitorInfo(null);\n Reporter.reportError('setOrResetVisitorId', err);\n }\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,kBAAkB;AACzC,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,cAAc,QAAQ,2BAA2B;AAE1D,SAASC,KAAK,QAAQ,iBAAiB;AAEvC,OAAO,MAAMC,gBAAgB,CAAC;EAC5B,aAAaC,IAAIA,CAACC,KAAa,EAAiB;IAC9C,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC7B,MAAM,IAAI,CAACE,mBAAmB,CAAC,CAAC;IAChC,MAAM,IAAI,CAACC,mBAAmB,CAAC,KAAK,CAAC;EACvC;EAEA,aAAaC,uBAAuBA,CAAA,EAAqB;IACvD,IAAI;MACF,MAAMC,aAAa,GAAG,MAAMZ,SAAS,CAACa,kBAAkB,CACtDZ,SAAS,CAACa,cACZ,CAAC;MAED,IAAI,CAACF,aAAa,EAAE;QAClB,MAAMZ,SAAS,CAACe,SAAS,CAACd,SAAS,CAACa,cAAc,EAAE,IAAI,CAAC;QACzD,OAAO,IAAI;MACb;IACF,CAAC,CAAC,OAAOE,GAAG,EAAE;MACZjB,MAAM,CAACkB,QAAQ,CAAC,mDAAmD,EAAED,GAAG,CAAC;IAC3E;IACA,OAAO,KAAK;EACd;EAEA,aAAaE,cAAcA,CAAA,EAAoB;IAC7C,IAAI;MACF,IAAIC,GAAG,GAAG,MAAMnB,SAAS,C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1
|
+
{"version":3,"names":["Logger","DataStore","Constants","Reporter","NetworkService","Utils","VisitIdProcessor","init","orgId","initDebugId","setOrResetVisitorId","setOrResetVisitInfo","retryVisitorIdIfNeeded","visitorIdFetchFailed","logDbg","hasVisitorId","getVisitorInfo","isFirstOpenAfterInstall","firstOpenFlag","getDataFromStorage","KEY_FIRST_OPEN","storeData","err","logError","getFacebookFBP","fbp","KEY_FBP","Date","now","addCommonCookie","debugId","KEY_MP_DEBUG_ID","indexOf","undefined","getSimpleDebugId","setDebugId","incrementDepth","visitInfo","KEY_MP_IDL_VISIT_ID_INFO","visitId","getUniqueID","visitCt","visitDepth","visitTs","visitVer","_visitInfo","setVisitInfo","visitInfoToString","reportError","incrementVisitDepth","getVisitInfo","catch","_visitorInfoData","visitorInfoData","KEY_MP_IDL_VISITOR_ID_INFO","mId","fetchIdlInfoWithRetry","getIdlUrl","setVisitorInfo","cookieValue","encodeURIComponent","JSON","stringify","dId","_defineProperty"],"sources":["visit-id.processor.ts"],"sourcesContent":["import { Logger } from '../common/logger';\nimport { DataStore } from '../common/data-store';\nimport { Constants } from '../common/constants';\nimport { Reporter } from '../common/reporter';\nimport { NetworkService } from '../common/network-service';\nimport type { VisitInfo, VisitorInfo } from '../common/app-types';\nimport { Utils } from '../common/utils';\n\nexport class VisitIdProcessor {\n // Track if visitor ID fetch failed so we can retry on page_load\n private static visitorIdFetchFailed = false;\n\n static async init(orgId: string): Promise<void> {\n await this.initDebugId(orgId);\n await this.setOrResetVisitorId();\n await this.setOrResetVisitInfo(false);\n }\n\n /**\n * Check if visitor ID needs to be retried\n * Called on each page_load to retry if initial fetch failed\n */\n static async retryVisitorIdIfNeeded(): Promise<void> {\n if (!this.visitorIdFetchFailed) {\n return; // No retry needed\n }\n\n Logger.logDbg('Retrying visitor ID fetch on page_load...');\n await this.setOrResetVisitorId();\n }\n\n /**\n * Check if visitor ID is available\n */\n static hasVisitorId(): boolean {\n return !this.visitorIdFetchFailed && DataStore.getVisitorInfo() !== null;\n }\n\n static async isFirstOpenAfterInstall(): Promise<boolean> {\n try {\n const firstOpenFlag = await DataStore.getDataFromStorage<string>(\n Constants.KEY_FIRST_OPEN\n );\n\n if (!firstOpenFlag) {\n await DataStore.storeData(Constants.KEY_FIRST_OPEN, 'No');\n return true;\n }\n } catch (err) {\n Logger.logError('Unable to determine first open after install flag', err);\n }\n return false;\n }\n\n static async getFacebookFBP(): Promise<string> {\n try {\n let fbp = await DataStore.getDataFromStorage<string>(Constants.KEY_FBP);\n\n if (!fbp) {\n fbp = `fb.1.${Date.now()}.${Date.now()}`;\n }\n\n await DataStore.storeData(Constants.KEY_FBP, fbp);\n\n DataStore.addCommonCookie('x-fbp', fbp);\n\n return fbp;\n } catch (err) {\n Logger.logError('Error initializing debug id.', err);\n }\n return '';\n }\n\n static async initDebugId(orgId: string): Promise<void> {\n try {\n let debugId = await DataStore.getDataFromStorage<string>(\n Constants.KEY_MP_DEBUG_ID\n );\n\n if (debugId && debugId.indexOf(orgId) !== 0) {\n // re-generate debug id if it is not of the simple variety\n debugId = undefined;\n }\n\n if (!debugId) {\n debugId = Utils.getSimpleDebugId(orgId);\n }\n\n await DataStore.storeData(Constants.KEY_MP_DEBUG_ID, debugId);\n DataStore.setDebugId(debugId);\n } catch (err) {\n Logger.logError('Error initializing debug id.', err);\n }\n }\n\n static async setOrResetVisitInfo(incrementDepth: boolean): Promise<void> {\n try {\n let visitInfo: VisitInfo = await DataStore.getDataFromStorage(\n Constants.KEY_MP_IDL_VISIT_ID_INFO\n );\n\n if (!visitInfo) {\n // may be first time visit, set up a new visit info object and return\n // Initialize visitDepth to 0, will be incremented to 1 on first page_load\n visitInfo = {\n visitId: Utils.getUniqueID(),\n visitCt: 1,\n visitDepth: 0,\n visitTs: Date.now(),\n visitVer: 1,\n };\n } else {\n // reset visit id anyway, but retain the visitCt and depth setting\n visitInfo.visitId = Utils.getUniqueID();\n if (incrementDepth) {\n visitInfo.visitDepth = (visitInfo?.visitDepth ?? 0) + 1;\n } else {\n visitInfo.visitCt = visitInfo.visitCt + 1;\n visitInfo.visitDepth = 0; // Reset to 0, will be incremented to 1 on first page_load of new session\n }\n visitInfo.visitTs = Date.now();\n visitInfo.visitVer = 1;\n }\n\n DataStore.setVisitInfo(visitInfo);\n await DataStore.storeData(Constants.KEY_MP_IDL_VISIT_ID_INFO, visitInfo);\n DataStore.addCommonCookie('x-mp-vid', DataStore.visitInfoToString());\n } catch (err) {\n Logger.logError(err);\n DataStore.setVisitInfo(null);\n Reporter.reportError('setOrResetVisitInfo', err);\n }\n }\n\n /**\n * Synchronously increment visit depth in memory, persist to storage in background\n * This prevents race conditions when multiple page_load events fire quickly\n */\n static incrementVisitDepth(): void {\n try {\n // Read from in-memory cache (synchronous)\n const visitInfo: VisitInfo = DataStore.getVisitInfo();\n\n if (!visitInfo) {\n Logger.logError('Visit info not initialized. Cannot increment depth.');\n return;\n }\n\n // Increment depth synchronously in memory\n visitInfo.visitDepth = (visitInfo.visitDepth ?? 0) + 1;\n visitInfo.visitTs = Date.now();\n\n // Update in-memory cache immediately (synchronous)\n DataStore.setVisitInfo(visitInfo);\n DataStore.addCommonCookie('x-mp-vid', DataStore.visitInfoToString());\n\n Logger.logDbg('Visit depth incremented to:', visitInfo.visitDepth);\n\n // Persist to AsyncStorage in background (fire and forget)\n DataStore.storeData(Constants.KEY_MP_IDL_VISIT_ID_INFO, visitInfo).catch(\n (err) => {\n Logger.logError('Error persisting visit depth to storage:', err);\n Reporter.reportError('incrementVisitDepth::persist', err);\n }\n );\n } catch (err) {\n Logger.logError('Error incrementing visit depth:', err);\n Reporter.reportError('incrementVisitDepth', err);\n }\n }\n\n static async setOrResetVisitorId(): Promise<void> {\n try {\n let visitorInfoData: VisitorInfo | null =\n await DataStore.getDataFromStorage(\n Constants.KEY_MP_IDL_VISITOR_ID_INFO\n );\n\n if (\n !visitorInfoData ||\n (visitorInfoData && visitorInfoData?.mId.indexOf('-') === -1)\n ) {\n Logger.logDbg('VisitorInfo not found. Fetching from server with retry');\n // get a new visit id and device id from server and store it in storage\n // Use retry method for better reliability\n visitorInfoData = await NetworkService.fetchIdlInfoWithRetry(\n DataStore.getIdlUrl()\n );\n }\n\n if (!visitorInfoData) {\n // Mark as failed so we can retry on page_load\n this.visitorIdFetchFailed = true;\n Logger.logError(\n 'Failed to fetch visitor ID after retries. Will retry on next page_load.'\n );\n return;\n }\n\n // Success - clear the failure flag\n this.visitorIdFetchFailed = false;\n\n DataStore.setVisitorInfo(visitorInfoData);\n // store to db as well\n await DataStore.storeData(\n Constants.KEY_MP_IDL_VISITOR_ID_INFO,\n visitorInfoData\n );\n\n const cookieValue = encodeURIComponent(JSON.stringify(visitorInfoData));\n DataStore.addCommonCookie('x-mplidl', cookieValue);\n DataStore.addCommonCookie('x-mpidl', cookieValue);\n DataStore.addCommonCookie('x-lmid', visitorInfoData.mId);\n DataStore.addCommonCookie('x-ldid', visitorInfoData.dId);\n\n Logger.logDbg('Visitor ID set successfully:', visitorInfoData.mId);\n } catch (err) {\n Logger.logError('Error in setOrResetVisitorId:', err);\n this.visitorIdFetchFailed = true;\n DataStore.setVisitorInfo(null);\n Reporter.reportError('setOrResetVisitorId', err);\n }\n }\n}\n"],"mappings":";;;AAAA,SAASA,MAAM,QAAQ,kBAAkB;AACzC,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,cAAc,QAAQ,2BAA2B;AAE1D,SAASC,KAAK,QAAQ,iBAAiB;AAEvC,OAAO,MAAMC,gBAAgB,CAAC;EAI5B,aAAaC,IAAIA,CAACC,KAAa,EAAiB;IAC9C,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC7B,MAAM,IAAI,CAACE,mBAAmB,CAAC,CAAC;IAChC,MAAM,IAAI,CAACC,mBAAmB,CAAC,KAAK,CAAC;EACvC;;EAEA;AACF;AACA;AACA;EACE,aAAaC,sBAAsBA,CAAA,EAA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,SAAS,CAACoB,SAAS,CACvBnB,SAAS,CAACoD,0BAA0B,EACpCD,eACF,CAAC;MAED,MAAMM,WAAW,GAAGC,kBAAkB,CAACC,IAAI,CAACC,SAAS,CAACT,eAAe,CAAC,CAAC;MACvEpD,SAAS,CAAC4B,eAAe,CAAC,UAAU,EAAE8B,WAAW,CAAC;MAClD1D,SAAS,CAAC4B,eAAe,CAAC,SAAS,EAAE8B,WAAW,CAAC;MACjD1D,SAAS,CAAC4B,eAAe,CAAC,QAAQ,EAAEwB,eAAe,CAACE,GAAG,CAAC;MACxDtD,SAAS,CAAC4B,eAAe,CAAC,QAAQ,EAAEwB,eAAe,CAACU,GAAG,CAAC;MAExD/D,MAAM,CAACc,MAAM,CAAC,8BAA8B,EAAEuC,eAAe,CAACE,GAAG,CAAC;IACpE,CAAC,CAAC,OAAOjC,GAAG,EAAE;MACZtB,MAAM,CAACuB,QAAQ,CAAC,+BAA+B,EAAED,GAAG,CAAC;MACrD,IAAI,CAACT,oBAAoB,GAAG,IAAI;MAChCZ,SAAS,CAACyD,cAAc,CAAC,IAAI,CAAC;MAC9BvD,QAAQ,CAAC6C,WAAW,CAAC,qBAAqB,EAAE1B,GAAG,CAAC;IAClD;EACF;AACF;AAtNE;AAAA0C,eAAA,CADW1D,gBAAgB,0BAEW,KAAK","ignoreList":[]}
|
|
@@ -2,13 +2,6 @@ import type { Logger } from './logger';
|
|
|
2
2
|
export interface MapLike<T = any> {
|
|
3
3
|
[key: string]: T;
|
|
4
4
|
}
|
|
5
|
-
export interface RunQueueModel {
|
|
6
|
-
sseOnly: boolean;
|
|
7
|
-
name: string;
|
|
8
|
-
dcrName: string;
|
|
9
|
-
eventId: string;
|
|
10
|
-
dcrPayload?: Record<string, any>;
|
|
11
|
-
}
|
|
12
5
|
export declare type TypedAny = Record<string, string | number | boolean | string[] | boolean[] | number[] | Record<string, string | number | boolean | string[] | boolean[] | number[]>>;
|
|
13
6
|
export declare type EventProcessorFn = (payload: TypedAny) => void;
|
|
14
7
|
export interface AppCustomerInfo {
|
|
@@ -23,6 +16,7 @@ export interface AppCustomerInfo {
|
|
|
23
16
|
}
|
|
24
17
|
export interface AppPageLoad {
|
|
25
18
|
page_name: string;
|
|
19
|
+
page_url?: string;
|
|
26
20
|
is_entry?: number;
|
|
27
21
|
deep_link_url?: string;
|
|
28
22
|
app_version?: string;
|
|
@@ -72,6 +66,7 @@ export interface Report {
|
|
|
72
66
|
tagCt: number;
|
|
73
67
|
dws: 'j' | 'n';
|
|
74
68
|
v: string;
|
|
69
|
+
devPayload?: string;
|
|
75
70
|
}
|
|
76
71
|
export interface UrlInfo {
|
|
77
72
|
tfUrl: string;
|
|
@@ -103,16 +98,42 @@ export interface SdkInitOptions {
|
|
|
103
98
|
projectId: string;
|
|
104
99
|
baseUrl: string;
|
|
105
100
|
logLevel: string;
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated device_type is now auto-detected and cannot be overridden
|
|
103
|
+
* This field is ignored. The SDK uses Expo/react-native-device-info for reliable detection.
|
|
104
|
+
*/
|
|
106
105
|
device_type?: string;
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated app_version is now auto-detected and cannot be overridden
|
|
108
|
+
* This field is ignored. The SDK will always use the actual app version from the device.
|
|
109
|
+
*/
|
|
107
110
|
app_version?: string;
|
|
111
|
+
/**
|
|
112
|
+
* @deprecated os_version is now auto-detected and cannot be overridden
|
|
113
|
+
* This field is ignored. The SDK will always use the actual OS version from the device.
|
|
114
|
+
*/
|
|
108
115
|
os_version?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Event deduplication window in milliseconds
|
|
118
|
+
* If the same event (name + payload) fires within this window, it will be skipped
|
|
119
|
+
* Purchase events are deduplicated by transaction_id regardless of other fields
|
|
120
|
+
* Default: 5000ms (5 seconds)
|
|
121
|
+
* Set to 0 to disable deduplication
|
|
122
|
+
*/
|
|
123
|
+
eventDeduplicationWindowMs?: number;
|
|
124
|
+
/**
|
|
125
|
+
* Callback invoked when SDK initialization fails after all retries
|
|
126
|
+
* Use this to handle initialization failures gracefully in your app
|
|
127
|
+
* @param error The error that caused the failure
|
|
128
|
+
*/
|
|
129
|
+
onInitFailure?: (error: Error) => void;
|
|
109
130
|
}
|
|
110
131
|
export interface MpDeviceInfo {
|
|
111
132
|
package_name?: string;
|
|
112
133
|
short_version?: string;
|
|
113
134
|
long_version?: string;
|
|
114
|
-
os_version
|
|
115
|
-
device_model_name
|
|
135
|
+
os_version?: string;
|
|
136
|
+
device_model_name?: string;
|
|
116
137
|
locale?: string;
|
|
117
138
|
timezone_abbreviation?: string;
|
|
118
139
|
carrier?: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { BaseResourceParamType } from '../models/mp-client-sdk';
|
|
2
2
|
export declare class Constants {
|
|
3
3
|
static PLACEHOLDER_REGEX: RegExp;
|
|
4
|
-
static LARGE_RANDOM_POOL: (size?: number) => string;
|
|
5
4
|
static MP_DL_EVT: string;
|
|
6
5
|
static CUST_EVT: string;
|
|
7
6
|
static ST_OK: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeJsvHelper, MapLike, MpDeviceInfo, QcInfoItem,
|
|
1
|
+
import type { DeJsvHelper, MapLike, MpDeviceInfo, QcInfoItem, SdkInitOptions, UrlInfo, VisitInfo, VisitorInfo } from './app-types';
|
|
2
2
|
import type { GeoResponse } from '../models/geo-api-response';
|
|
3
3
|
import type { ClientSdkDeItem, ClientSdkPrItem, ClientSdkQcItem, ClientSdkTagItem, MpClientSdk } from '../models/mp-client-sdk';
|
|
4
4
|
export declare class DataStore {
|
|
@@ -17,8 +17,6 @@ export declare class DataStore {
|
|
|
17
17
|
private static mpEnvShort;
|
|
18
18
|
private static devicePlatform;
|
|
19
19
|
private static deviceType;
|
|
20
|
-
private static runQueue;
|
|
21
|
-
private static isProcessing;
|
|
22
20
|
private static sdkInitOptions;
|
|
23
21
|
private static deviceInfo;
|
|
24
22
|
private static geoInfo;
|
|
@@ -28,7 +26,6 @@ export declare class DataStore {
|
|
|
28
26
|
private static commonCookies;
|
|
29
27
|
static init(clientSdk: MpClientSdk): Promise<void>;
|
|
30
28
|
static resetCollectorUrl(baseCollectorUrl: string, sdkEnv: string, vendorId: string, projectId: string): boolean;
|
|
31
|
-
static enQueueTMFire(sseOnly: boolean, name: string, dcrName: string, eventId: string, dcrPayload?: Record<string, any>): void;
|
|
32
29
|
static isDataStoreReady(): boolean;
|
|
33
30
|
static shouldExecuteTMForEvent(eventName: string): boolean;
|
|
34
31
|
static shouldExecuteSST(eventName: string): boolean;
|
|
@@ -38,9 +35,6 @@ export declare class DataStore {
|
|
|
38
35
|
static setDeviceInfo(info: MpDeviceInfo): void;
|
|
39
36
|
static getDeviceInfo(): MpDeviceInfo;
|
|
40
37
|
static setSdkInitOptions(options: SdkInitOptions): void;
|
|
41
|
-
static deQueueTMFire(): RunQueueModel;
|
|
42
|
-
static isTagManagerProcessing(): boolean;
|
|
43
|
-
static setTagManagerProcessing(status: boolean): void;
|
|
44
38
|
static getSdkDataElements(): MapLike<ClientSdkDeItem>;
|
|
45
39
|
static getSdkQC(): ClientSdkQcItem[];
|
|
46
40
|
static hasOneSSTTag(): boolean;
|
|
@@ -51,7 +45,8 @@ export declare class DataStore {
|
|
|
51
45
|
static getAttrInfoUrl(): string;
|
|
52
46
|
static setVisitInfo(visitInfo: VisitInfo): void;
|
|
53
47
|
static visitInfoToString(): string;
|
|
54
|
-
static setVisitorInfo(visitorInfo: VisitorInfo): void;
|
|
48
|
+
static setVisitorInfo(visitorInfo: VisitorInfo | null): void;
|
|
49
|
+
static getVisitorInfo(): VisitorInfo | null;
|
|
55
50
|
static getDebugId(): string;
|
|
56
51
|
static getErrorReportUrl(): string;
|
|
57
52
|
static getIdlUrl(): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare enum DeepLinkType {
|
|
2
|
+
CUSTOM_SCHEME = "custom_scheme",
|
|
3
|
+
UNIVERSAL_LINK = "universal_link",
|
|
4
|
+
APP_LINK = "app_link",
|
|
5
|
+
HTTP_LINK = "http_link"
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Helper class to automatically detect and handle deeplinks
|
|
9
|
+
*
|
|
10
|
+
* Supports multiple link types:
|
|
11
|
+
* 1. Custom URL Schemes: myapp://product/123
|
|
12
|
+
* 2. Universal Links (iOS): https://my-site.com/product/123
|
|
13
|
+
* 3. App Links (Android): https://my-site.com/product/123
|
|
14
|
+
* 4. HTTP Links: http://my-site.com/product/123
|
|
15
|
+
*
|
|
16
|
+
* Common use cases:
|
|
17
|
+
* - Ad clicks (Facebook, Google, TikTok ads with http/https URLs)
|
|
18
|
+
* - Push notification deep links
|
|
19
|
+
* - Email marketing links
|
|
20
|
+
* - SMS campaign links
|
|
21
|
+
* - QR codes
|
|
22
|
+
*/
|
|
23
|
+
export declare class DeepLinkHelper {
|
|
24
|
+
private static listener;
|
|
25
|
+
private static onDeepLinkCallback;
|
|
26
|
+
/**
|
|
27
|
+
* Determine the type of deeplink
|
|
28
|
+
* @param url The URL to analyze
|
|
29
|
+
* @returns The type of deeplink
|
|
30
|
+
*/
|
|
31
|
+
static getLinkType(url: string): DeepLinkType;
|
|
32
|
+
/**
|
|
33
|
+
* Initialize deeplink detection
|
|
34
|
+
* - Checks if app was opened with initial URL (custom scheme, universal link, or HTTP link)
|
|
35
|
+
* - Sets up listener for deeplinks while app is running
|
|
36
|
+
* @param callback Optional callback to be notified when deeplink is detected
|
|
37
|
+
* @returns The initial URL if app was opened with deeplink, null otherwise
|
|
38
|
+
*/
|
|
39
|
+
static initialize(callback?: (url: string, linkType: DeepLinkType) => void): Promise<string | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Set up listener for deeplinks received while app is running
|
|
42
|
+
* Works for all link types: custom schemes, universal links, app links, HTTP links
|
|
43
|
+
*/
|
|
44
|
+
private static setupListener;
|
|
45
|
+
/**
|
|
46
|
+
* Handle deeplink URL - notify callback if registered
|
|
47
|
+
* @param url The deeplink URL
|
|
48
|
+
*/
|
|
49
|
+
private static handleDeepLink;
|
|
50
|
+
/**
|
|
51
|
+
* Remove deeplink listener and clear callback
|
|
52
|
+
*/
|
|
53
|
+
static cleanup(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Parse UTM parameters and other campaign data from URL
|
|
56
|
+
* @param url The deeplink URL
|
|
57
|
+
* @returns Object containing campaign parameters
|
|
58
|
+
*/
|
|
59
|
+
static parseCampaignParams(url: string): Record<string, string>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
interface DeviceAppInfo {
|
|
2
|
+
app_version: string;
|
|
3
|
+
build_number: string;
|
|
4
|
+
package_name: string;
|
|
5
|
+
device_model_name: string;
|
|
6
|
+
device_manufacturer: string;
|
|
7
|
+
device_id: string;
|
|
8
|
+
os_name: string;
|
|
9
|
+
os_version: string;
|
|
10
|
+
is_tablet: boolean;
|
|
11
|
+
is_emulator: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Helper class to automatically detect device and app information
|
|
15
|
+
* Supports both Expo and bare React Native:
|
|
16
|
+
* 1. Tries Expo modules first (works in Expo Go)
|
|
17
|
+
* 2. Falls back to react-native-device-info (for bare RN)
|
|
18
|
+
* 3. Returns safe defaults if neither is available
|
|
19
|
+
*/
|
|
20
|
+
export declare class DeviceInfoHelper {
|
|
21
|
+
private static expoApplication;
|
|
22
|
+
private static expoDevice;
|
|
23
|
+
private static expoConstants;
|
|
24
|
+
private static deviceInfo;
|
|
25
|
+
private static initialized;
|
|
26
|
+
/**
|
|
27
|
+
* Try to load Expo modules and react-native-device-info
|
|
28
|
+
* This uses dynamic imports to avoid errors when modules aren't available
|
|
29
|
+
*/
|
|
30
|
+
private static initialize;
|
|
31
|
+
/**
|
|
32
|
+
* Get comprehensive app and device information
|
|
33
|
+
* All methods are async-safe and handle errors gracefully
|
|
34
|
+
*/
|
|
35
|
+
static getAppInfo(): Promise<DeviceAppInfo>;
|
|
36
|
+
/**
|
|
37
|
+
* Get device info using Expo modules (works in Expo Go)
|
|
38
|
+
*/
|
|
39
|
+
private static getAppInfoFromExpo;
|
|
40
|
+
/**
|
|
41
|
+
* Get device info using react-native-device-info (for bare RN)
|
|
42
|
+
*/
|
|
43
|
+
private static getAppInfoFromDeviceInfo;
|
|
44
|
+
/**
|
|
45
|
+
* Safe default values when no device info library is available
|
|
46
|
+
*/
|
|
47
|
+
private static getSafeDefaults;
|
|
48
|
+
/**
|
|
49
|
+
* Get app version in format: "1.0.0 (123)"
|
|
50
|
+
* Combines version and build number for better tracking
|
|
51
|
+
*/
|
|
52
|
+
static getFormattedAppVersion(): Promise<string>;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EventBusCallback } from './app-types';
|
|
2
|
+
export declare class EventBus {
|
|
3
|
+
private static eventRegister;
|
|
4
|
+
static on(eventName: string, callback: EventBusCallback): void;
|
|
5
|
+
/**
|
|
6
|
+
* Remove a specific callback for an event
|
|
7
|
+
* @param eventName Event name to remove callback from
|
|
8
|
+
* @param callback The callback function to remove
|
|
9
|
+
*/
|
|
10
|
+
static off(eventName: string, callback: EventBusCallback): void;
|
|
11
|
+
/**
|
|
12
|
+
* Remove all callbacks for a specific event
|
|
13
|
+
* @param eventName Event name to clear all listeners for
|
|
14
|
+
*/
|
|
15
|
+
static clearEvent(eventName: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Remove all event listeners (used during SDK shutdown)
|
|
18
|
+
*/
|
|
19
|
+
static clearAll(): void;
|
|
20
|
+
static triggerEvent(eventName: string, payload: any): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MapLike, SdkInitOptions, VisitorInfo } from './app-types';
|
|
2
|
+
export declare class NetworkService {
|
|
3
|
+
/**
|
|
4
|
+
* Sleep for a specified duration
|
|
5
|
+
*/
|
|
6
|
+
private static sleep;
|
|
7
|
+
/**
|
|
8
|
+
* Fetch with timeout wrapper
|
|
9
|
+
*/
|
|
10
|
+
private static fetchWithTimeout;
|
|
11
|
+
/**
|
|
12
|
+
* Fetch visitor/identity info from server
|
|
13
|
+
* Returns null if fetch fails (caller should handle retry logic)
|
|
14
|
+
*/
|
|
15
|
+
static fetchIdlInfo(url: string): Promise<VisitorInfo | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Fetch visitor/identity info with retry logic
|
|
18
|
+
* @param url The IDL URL
|
|
19
|
+
* @param retries Number of retries (default: 3)
|
|
20
|
+
* @returns VisitorInfo or null if all retries fail
|
|
21
|
+
*/
|
|
22
|
+
static fetchIdlInfoWithRetry(url: string, retries?: number): Promise<VisitorInfo | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Refresh client SDK JSON configuration with retry logic
|
|
25
|
+
* @param sdkInitOptions SDK initialization options
|
|
26
|
+
* @returns true if successful, throws Error if all retries fail
|
|
27
|
+
*/
|
|
28
|
+
static refreshClientSdkJson(sdkInitOptions: SdkInitOptions): Promise<void>;
|
|
29
|
+
static sendPostRequest(url: string, body: MapLike): void;
|
|
30
|
+
static sendGetRequest(url: string): void;
|
|
31
|
+
private static sendNetworkRequest;
|
|
32
|
+
}
|
|
@@ -4,9 +4,10 @@ export declare class Reporter {
|
|
|
4
4
|
static initReporter(envName: string, envId: string, deviceType: string, language: string, deviceOs: string, // device os is being used as a browser proxy
|
|
5
5
|
pageName: string, evtName: string, evtId: string, clientTagsDownStream: 'j' | 'n', clientSdkVersion: string, initialItems?: ReportTagItem[]): void;
|
|
6
6
|
static setExpectedTagCount(ct: number, evtId: string): void;
|
|
7
|
+
static reportDevPayload(devPayload: Record<string, any>, evtId: string): void;
|
|
7
8
|
static reportItem(item: ReportTagItem, evtId: string): void;
|
|
8
9
|
static publishReport(evtId: string): void;
|
|
9
10
|
static reportError(methodMetaData: string, err: any): void;
|
|
10
|
-
static postSST(data: MapLike, envName: string, envId: string, serverTagDownStream: 'j' | 'n', eventName: string, evtId: string): Promise<void>;
|
|
11
|
+
static postSST(data: MapLike, envName: string, envId: string, serverTagDownStream: 'j' | 'n', eventName: string, evtId: string, eventData?: Record<string, any>): Promise<void>;
|
|
11
12
|
static postAttrInfo(payload: MapLike): void;
|
|
12
13
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DeStorageDuration } from '../models/mp-client-sdk';
|
|
2
|
+
export declare class StorageHelper {
|
|
3
|
+
private static sessionStore;
|
|
4
|
+
private static visitorStoreCache;
|
|
5
|
+
private static isInitialized;
|
|
6
|
+
/**
|
|
7
|
+
* Initialize the storage helper
|
|
8
|
+
* Loads visitor store from AsyncStorage and cleans expired values
|
|
9
|
+
* Should be called once during SDK initialization
|
|
10
|
+
*/
|
|
11
|
+
static initialize(): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Clear visitor-scoped values older than 30 days
|
|
14
|
+
*/
|
|
15
|
+
static clearExpiredVisitorData(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Persist the visitor store cache to AsyncStorage
|
|
18
|
+
*/
|
|
19
|
+
private static persistVisitorStore;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a value is defined (not null, undefined, or empty string)
|
|
22
|
+
*/
|
|
23
|
+
private static isDefined;
|
|
24
|
+
/**
|
|
25
|
+
* Store a data element value based on storage duration
|
|
26
|
+
* @param deKey - The data element key
|
|
27
|
+
* @param value - The value to store
|
|
28
|
+
* @param storageDuration - The storage duration type
|
|
29
|
+
*/
|
|
30
|
+
static deStorageDurationSet(deKey: string, value: any, storageDuration: DeStorageDuration): void;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieve a data element value based on storage duration
|
|
33
|
+
* @param deKey - The data element key
|
|
34
|
+
* @param defaultValue - Default value if not found
|
|
35
|
+
* @param storageDuration - The storage duration type
|
|
36
|
+
* @returns The stored value or default value
|
|
37
|
+
*/
|
|
38
|
+
static deStorageDurationGet(deKey: string, defaultValue: any, storageDuration: DeStorageDuration): any;
|
|
39
|
+
/**
|
|
40
|
+
* Clear all session-scoped values (called on new session if needed)
|
|
41
|
+
*/
|
|
42
|
+
static clearSessionStore(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Clear all visitor-scoped values
|
|
45
|
+
*/
|
|
46
|
+
static clearVisitorStore(): Promise<void>;
|
|
47
|
+
}
|
|
@@ -33,6 +33,31 @@ export declare class Utils {
|
|
|
33
33
|
static regExpEscape(input: string): string;
|
|
34
34
|
static convertToRegex(input: string, ignoreCase: boolean, fullMatch: boolean): RegExp;
|
|
35
35
|
static safeExecute(fn: (payload: any) => any, payload: any): any;
|
|
36
|
+
/**
|
|
37
|
+
* Encode string to Base64 - React Native compatible
|
|
38
|
+
* Works with both ASCII and UTF-8 strings
|
|
39
|
+
* @param str String to encode
|
|
40
|
+
* @returns Base64 encoded string
|
|
41
|
+
*/
|
|
42
|
+
static toBase64(str: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Encode an object payload to Base64 string
|
|
45
|
+
* @param payload Object to encode
|
|
46
|
+
* @returns Base64 encoded string, or empty string on error
|
|
47
|
+
*/
|
|
48
|
+
static encodeToBase64(payload: Record<string, any>): string;
|
|
49
|
+
/**
|
|
50
|
+
* Get the size of a payload in bytes
|
|
51
|
+
* @param payload Object to measure
|
|
52
|
+
* @returns Size in bytes
|
|
53
|
+
*/
|
|
54
|
+
static getPayloadSizeBytes(payload: Record<string, any>): number;
|
|
55
|
+
/**
|
|
56
|
+
* Check if payload exceeds the maximum allowed size (250KB)
|
|
57
|
+
* @param payload Object to check
|
|
58
|
+
* @returns True if payload is oversized
|
|
59
|
+
*/
|
|
60
|
+
static isPayloadOversized(payload: Record<string, any>): boolean;
|
|
36
61
|
static getUniqueID(): string;
|
|
37
62
|
/**
|
|
38
63
|
* Make HTTP GET request - React Native implementation
|
|
@@ -11,9 +11,43 @@ export declare class MpDataLayerHelper {
|
|
|
11
11
|
dlInitEvent: string;
|
|
12
12
|
receivedInitialEvent: boolean;
|
|
13
13
|
eventQueue: Array<any>;
|
|
14
|
+
private isProcessing;
|
|
14
15
|
private isEntryPoint;
|
|
16
|
+
private eventDedupWindowMs;
|
|
17
|
+
private eventDeduplicationCache;
|
|
18
|
+
private purchaseTransactionCache;
|
|
15
19
|
constructor(dlEventName: string, dlInitMode: string, dlInitEvent: string, storageKeyName?: string);
|
|
16
20
|
init(globalEventListeners: Record<string, EventProcessorFn>): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Set the event deduplication window
|
|
23
|
+
* @param windowMs Window in milliseconds (0 to disable)
|
|
24
|
+
*/
|
|
25
|
+
setDeduplicationWindow(windowMs: number): void;
|
|
26
|
+
/**
|
|
27
|
+
* Generate a unique fingerprint for an event
|
|
28
|
+
* @param eventName Event name
|
|
29
|
+
* @param payload Event payload
|
|
30
|
+
* @returns Fingerprint string
|
|
31
|
+
*/
|
|
32
|
+
private getEventFingerprint;
|
|
33
|
+
/**
|
|
34
|
+
* Extract transaction_id from purchase event payload
|
|
35
|
+
* @param payload Event payload
|
|
36
|
+
* @returns transaction_id or null
|
|
37
|
+
*/
|
|
38
|
+
private extractTransactionId;
|
|
39
|
+
/**
|
|
40
|
+
* Check if event is a duplicate within the deduplication window
|
|
41
|
+
* @param eventName Event name
|
|
42
|
+
* @param payload Event payload
|
|
43
|
+
* @returns true if duplicate, false otherwise
|
|
44
|
+
*/
|
|
45
|
+
private isDuplicateEvent;
|
|
46
|
+
/**
|
|
47
|
+
* Remove expired entries from deduplication caches
|
|
48
|
+
* @param now Current timestamp
|
|
49
|
+
*/
|
|
50
|
+
private cleanupDeduplicationCache;
|
|
17
51
|
pushEvent(eventName: string, payload: MapLike): void;
|
|
18
52
|
processQItems(eventName: string, payload: MapLike): Promise<void>;
|
|
19
53
|
/**
|
|
@@ -50,8 +84,16 @@ export declare class MpDataLayerHelper {
|
|
|
50
84
|
getState(): TypedAny[];
|
|
51
85
|
hasEventHappened(key: string): boolean;
|
|
52
86
|
reset(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Full shutdown - clears all state and allows reinitialization
|
|
89
|
+
*/
|
|
90
|
+
shutdown(): void;
|
|
53
91
|
ready(): void;
|
|
54
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Process next event in queue with atomic check-and-set
|
|
94
|
+
* Ensures only one event processes at a time, eliminating race conditions
|
|
95
|
+
*/
|
|
96
|
+
processNext(): void;
|
|
55
97
|
getIsEntryPointValue(): number;
|
|
56
98
|
resetEntryPointInfo(): void;
|
|
57
99
|
}
|
|
@@ -1,26 +1,60 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react-native-get-random-values';
|
|
2
|
+
import type { AppCustomerInfo, AppPageLoad, MapLike, SdkInitOptions } from './common/app-types';
|
|
2
3
|
import { EventBus } from './common/event-bus';
|
|
3
4
|
declare class MagicPixelImpl {
|
|
4
5
|
private static dl;
|
|
5
6
|
private static customerInfo;
|
|
6
7
|
private static customerIdentifiers;
|
|
7
8
|
private static deepLinkUrl;
|
|
9
|
+
private static orgId;
|
|
8
10
|
private static firstAppLaunch;
|
|
9
|
-
static
|
|
11
|
+
private static isReady;
|
|
12
|
+
private static isInitializing;
|
|
13
|
+
private static eventBuffer;
|
|
14
|
+
private static onInitFailureCallback;
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the MagicPixel SDK
|
|
17
|
+
* This method is synchronous - it stores config immediately and runs async setup in background
|
|
18
|
+
* Events called before async setup completes are buffered and processed once ready
|
|
19
|
+
* @param options SDK initialization options
|
|
20
|
+
*/
|
|
21
|
+
static init(options: SdkInitOptions): void;
|
|
22
|
+
/**
|
|
23
|
+
* Shutdown the SDK and release all resources
|
|
24
|
+
* Call this when the app is closing or when you need to reinitialize the SDK
|
|
25
|
+
* After shutdown, you must call init() again to use the SDK
|
|
26
|
+
*/
|
|
27
|
+
static shutdown(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Async initialization - runs in background
|
|
30
|
+
*/
|
|
31
|
+
private static initAsync;
|
|
10
32
|
static recordEvent(eventName: string, payload: MapLike): void;
|
|
33
|
+
private static processRecordEvent;
|
|
11
34
|
static ready(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Flush buffered events after SDK is ready
|
|
37
|
+
* Events are processed in the order they were received
|
|
38
|
+
*/
|
|
39
|
+
private static flushEventBuffer;
|
|
12
40
|
static getDebugId(): string;
|
|
13
|
-
private static checkAndFireTM;
|
|
14
41
|
private static runTM;
|
|
15
42
|
private static _fireTM;
|
|
16
43
|
private static _fireTMPrivate;
|
|
17
44
|
static setCustomerInfo(customerInfo: AppCustomerInfo): void;
|
|
18
45
|
static setFirebaseAppInstanceId(instanceId: string): void;
|
|
19
46
|
static setDeepLinkUrl(deepLinkUrl: string): void;
|
|
20
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Set device info with auto-detected values
|
|
49
|
+
* Standard fields (os_version, device_model_name, package_name) are always auto-detected
|
|
50
|
+
* Optional customFields parameter allows adding custom tracking fields only
|
|
51
|
+
* @param customFields Optional custom fields to add (cannot override standard fields)
|
|
52
|
+
*/
|
|
53
|
+
static setDeviceInfo(customFields?: Record<string, any>): Promise<void>;
|
|
21
54
|
static setFacebookClientId(fbp: string): void;
|
|
22
55
|
private static setAppVersion;
|
|
23
56
|
static recordPageLoad(pageLoadInfo: AppPageLoad): void;
|
|
57
|
+
private static processRecordPageLoad;
|
|
24
58
|
/**
|
|
25
59
|
* Set user information for tracking
|
|
26
60
|
* @param userInfo User information object
|
|
@@ -77,4 +111,4 @@ declare class MagicPixelImpl {
|
|
|
77
111
|
}
|
|
78
112
|
export declare const MagicPixelEventBus: typeof EventBus;
|
|
79
113
|
export declare const MagicPixel: typeof MagicPixelImpl;
|
|
80
|
-
export {};
|
|
114
|
+
export { DeepLinkHelper, DeepLinkType } from './common/deeplink-helper';
|
|
@@ -9,6 +9,13 @@ export interface ClientSdkDeItem {
|
|
|
9
9
|
fn?: (deHelper: any, input: any) => any;
|
|
10
10
|
isAsync?: boolean;
|
|
11
11
|
fnTOut?: number;
|
|
12
|
+
stDur?: DeStorageDuration;
|
|
13
|
+
}
|
|
14
|
+
export declare enum DeStorageDuration {
|
|
15
|
+
NONE = "NONE",
|
|
16
|
+
EVENT = "EVENT",
|
|
17
|
+
SESSION = "SESSION",
|
|
18
|
+
VISITOR = "VISITOR"
|
|
12
19
|
}
|
|
13
20
|
export declare enum ParamResourceEncodingType {
|
|
14
21
|
URL_ENC = "URL_ENC",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class VisitIdProcessor {
|
|
2
|
+
private static visitorIdFetchFailed;
|
|
3
|
+
static init(orgId: string): Promise<void>;
|
|
4
|
+
/**
|
|
5
|
+
* Check if visitor ID needs to be retried
|
|
6
|
+
* Called on each page_load to retry if initial fetch failed
|
|
7
|
+
*/
|
|
8
|
+
static retryVisitorIdIfNeeded(): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Check if visitor ID is available
|
|
11
|
+
*/
|
|
12
|
+
static hasVisitorId(): boolean;
|
|
13
|
+
static isFirstOpenAfterInstall(): Promise<boolean>;
|
|
14
|
+
static getFacebookFBP(): Promise<string>;
|
|
15
|
+
static initDebugId(orgId: string): Promise<void>;
|
|
16
|
+
static setOrResetVisitInfo(incrementDepth: boolean): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Synchronously increment visit depth in memory, persist to storage in background
|
|
19
|
+
* This prevents race conditions when multiple page_load events fire quickly
|
|
20
|
+
*/
|
|
21
|
+
static incrementVisitDepth(): void;
|
|
22
|
+
static setOrResetVisitorId(): Promise<void>;
|
|
23
|
+
}
|