veplayer-mp-douyin
Advanced tools
Comparing version 1.2.9-rc.6 to 1.2.9-rc.7
@@ -54,3 +54,2 @@ "use strict"; | ||
triggerCollector(eventName, e) { | ||
// eventName!=='timeupdate' && console.log('CollectorBehavior>>triggerCollector', eventName, e) | ||
this.collector && this.collector.trigger(eventName, e); | ||
@@ -57,0 +56,0 @@ }, |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,3 +9,3 @@ /* eslint-disable @typescript-eslint/comma-dangle */ | ||
const index_1 = require("../enums/index"); | ||
const index_2 = __importDefault(require("../tool/index")); | ||
const index_2 = require("../tool/index"); | ||
exports.default = Behavior({ | ||
@@ -15,0 +12,0 @@ properties: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.initCollector = void 0; | ||
var veplayer_mp_logger_1 = require("veplayer-mp-logger"); | ||
Object.defineProperty(exports, "initCollector", { enumerable: true, get: function () { return veplayer_mp_logger_1.initCollector; } }); | ||
exports.DefaultCollector = void 0; | ||
const veplayer_mp_logger_1 = require("veplayer-mp-logger"); | ||
exports.DefaultCollector = veplayer_mp_logger_1.default; |
@@ -27,3 +27,3 @@ "use strict"; | ||
exports.PKG = 'douyin'; | ||
exports.VERSION = '1.2.9-rc.6'; | ||
exports.VERSION = '1.2.9-rc.7'; | ||
/** | ||
@@ -30,0 +30,0 @@ * 控制栏状态枚举 |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,7 +9,7 @@ /* eslint-disable no-magic-numbers */ | ||
const eventemitter3_1 = require("eventemitter3"); | ||
const videoBehavior_1 = __importDefault(require("./behaviors/videoBehavior")); | ||
const douyinBehavior_1 = __importDefault(require("./behaviors/douyinBehavior")); | ||
const collectorBehavior_1 = __importDefault(require("./behaviors/collectorBehavior")); | ||
const interact_behavior_1 = __importDefault(require("./behaviors/interact_behavior")); | ||
const industryBehavior_1 = __importDefault(require("./behaviors/industryBehavior")); | ||
const videoBehavior_1 = require("./behaviors/videoBehavior"); | ||
const douyinBehavior_1 = require("./behaviors/douyinBehavior"); | ||
const collectorBehavior_1 = require("./behaviors/collectorBehavior"); | ||
const interact_behavior_1 = require("./behaviors/interact_behavior"); | ||
const industryBehavior_1 = require("./behaviors/industryBehavior"); | ||
const index_1 = require("./enums/index"); | ||
@@ -22,3 +19,3 @@ const xgerror_1 = require("./xgerror"); | ||
const request_1 = require("./request"); | ||
const index_3 = __importDefault(require("./tool/index")); | ||
const index_3 = require("./tool/index"); | ||
(0, index_2.XgComponent)({ | ||
@@ -25,0 +22,0 @@ behaviors: [videoBehavior_1.default, douyinBehavior_1.default, collectorBehavior_1.default, interact_behavior_1.default, industryBehavior_1.default], |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const index_1 = require("../../utils/index"); | ||
const plugin_useraction_behavior_1 = __importDefault(require("../../behaviors/plugin_useraction_behavior")); | ||
const plugin_useraction_behavior_1 = require("../../behaviors/plugin_useraction_behavior"); | ||
(0, index_1.XgComponent)({ | ||
@@ -9,0 +6,0 @@ behaviors: [plugin_useraction_behavior_1.default], |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -9,4 +6,4 @@ /* eslint-disable no-magic-numbers */ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
const videoEventsBehavior_1 = __importDefault(require("../../behaviors/videoEventsBehavior")); | ||
const index_1 = __importDefault(require("../../tool/index")); | ||
const videoEventsBehavior_1 = require("../../behaviors/videoEventsBehavior"); | ||
const index_1 = require("../../tool/index"); | ||
const index_2 = require("../../utils/index"); | ||
@@ -13,0 +10,0 @@ const index_3 = require("../../enums/index"); |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const index_1 = require("../../utils/index"); | ||
const videoEventsBehavior_1 = __importDefault(require("../../behaviors/videoEventsBehavior")); | ||
const plugin_useraction_behavior_1 = __importDefault(require("../../behaviors/plugin_useraction_behavior")); | ||
const index_2 = __importDefault(require("../../tool/index")); | ||
const videoEventsBehavior_1 = require("../../behaviors/videoEventsBehavior"); | ||
const plugin_useraction_behavior_1 = require("../../behaviors/plugin_useraction_behavior"); | ||
const index_2 = require("../../tool/index"); | ||
(0, index_1.XgComponent)({ | ||
@@ -11,0 +8,0 @@ behaviors: [videoEventsBehavior_1.default, plugin_useraction_behavior_1.default], |
@@ -28,22 +28,33 @@ "use strict"; | ||
*/ | ||
setCollector(Collector, config = { appVersion: '1.0.0', appName: '视频云微信小程序', appId: 0, userId: 0, needET: false, log: false }) { | ||
setCollector(Collector, config) { | ||
const { appId = 0, userId = '', } = config || {}; | ||
tt.__COLLECTOR__ = Collector; | ||
tt.__COLLECTOR_INFO__ = { | ||
lineAppId: config.appId, | ||
lineUserId: config.userId || 0, | ||
lineAppId: appId, | ||
lineUserId: userId, | ||
}; | ||
if (tt.__COLLECTOR__ && tt.__COLLECTOR__.uploader) { | ||
this.initUploader(tt.__COLLECTOR__, config); | ||
}, | ||
/** | ||
* @description 初始化日志的tea的实例 | ||
* @param collector 日志构造函数 | ||
* @param config 日志配置 | ||
*/ | ||
initUploader(collector, config) { | ||
var _a; | ||
const { appVersion = '1.0.0', appName = '视频云小程序', userId = '', needET = false, log = false, channelDomain, verifyUrl, } = config || {}; | ||
if (collector && collector.uploader && !((_a = collector.uploader) === null || _a === void 0 ? void 0 : _a.TEA)) { | ||
const _data = { | ||
log: config.log, | ||
app_name: config.appName || '视频云微信小程序', | ||
app_version: config.appVersion || '1.0.0', | ||
user_unique_id: config.userId || '', | ||
channel_domain: config.channelDomain, | ||
log: log, | ||
app_name: appName, | ||
app_version: appVersion, | ||
user_unique_id: userId || '', | ||
channel_domain: channelDomain, | ||
}; | ||
if (config.channelDomain) { | ||
_data.channel_domain = config.channelDomain; | ||
if (channelDomain) { | ||
_data.channel_domain = channelDomain; | ||
} | ||
config.needET && (_data.event_verify_url = config.verifyUrl || 'https://xxx.xx.xx'); | ||
config.log && (_data.log = config.log); | ||
tt.__COLLECTOR__.uploader.init(_data); | ||
needET && (_data.event_verify_url = verifyUrl || 'https://xxx.xx.xx'); | ||
log && (_data.log = log); | ||
collector.uploader.init(_data); | ||
} | ||
@@ -53,26 +64,36 @@ }, | ||
* @description 初始化埋点上报对象 | ||
* @param config | ||
* @param config 日志配置 | ||
* @param videoInfo 视频信息 | ||
* @returns | ||
*/ | ||
getCollector(config = {}, videoInfo = {}) { | ||
getCollector(config, videoInfo = {}) { | ||
try { | ||
if (!tt.__COLLECTOR__) { | ||
// 如果没有__COLLECTOR__说明没有初始化日志,则在内部初始化 | ||
if (index_1.initCollector && typeof index_1.initCollector === 'function' && config.appId) { | ||
utils_1.VE_DEBUGGER.log('init logger by logInfo'); | ||
// @ts-ignore | ||
(0, index_1.initCollector)(config); | ||
} | ||
else { | ||
utils_1.VE_DEBUGGER.warn('the appId of logger config has not set'); | ||
} | ||
const { appId = 0, userId } = config || {}; | ||
if (index_1.DefaultCollector && typeof index_1.DefaultCollector === 'function' && config.appId) { | ||
// 优先使用logInfo的本地初始化 | ||
this.initUploader(index_1.DefaultCollector, config); | ||
const _c = Object.assign({ lineAppId: appId, lineUserId: userId }, config); | ||
utils_1.VE_DEBUGGER.log('init logger by logInfo'); | ||
return new index_1.DefaultCollector({ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-expect-error | ||
config: _c, | ||
videoInfo: videoInfo | ||
}); | ||
} | ||
const _c = Object.assign({ lineAppId: tt.__COLLECTOR_INFO__.lineAppId | 0, lineUserId: tt.__COLLECTOR_INFO__.lineUserId }, config); | ||
return new tt.__COLLECTOR__({ | ||
config: _c, | ||
videoInfo: videoInfo || {} | ||
}); | ||
else if (tt.__COLLECTOR__) { | ||
// 如果logInfo没有,则使用tt.__COLLECTOR__ 实例化 | ||
const _c = Object.assign({ lineAppId: tt.__COLLECTOR_INFO__.lineAppId | 0, lineUserId: tt.__COLLECTOR_INFO__.lineUserId }, config); | ||
utils_1.VE_DEBUGGER.warn('init logger by initCollector has deprecated,please pass the appid and userId in the component\'s logInfo property'); | ||
return new tt.__COLLECTOR__({ | ||
config: _c, | ||
videoInfo: videoInfo | ||
}); | ||
} | ||
else { | ||
utils_1.VE_DEBUGGER.warn('logger config has not set'); | ||
return null; | ||
} | ||
} | ||
catch (e) { | ||
// console.error('initCollector error', e) | ||
return null; | ||
@@ -79,0 +100,0 @@ } |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CollectorManager = exports.default = void 0; | ||
const mediaManager_1 = __importDefault(require("./mediaManager")); | ||
const mediaManager_1 = require("./mediaManager"); | ||
exports.default = mediaManager_1.default; | ||
const collector_1 = __importDefault(require("./collector")); | ||
const collector_1 = require("./collector"); | ||
exports.CollectorManager = collector_1.default; |
{ | ||
"name": "veplayer-mp-douyin", | ||
"version": "1.2.9-rc.6", | ||
"version": "1.2.9-rc.7", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "eventemitter3": "^5.0.1", |
3434
228370