gamepoint 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +2 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -26,7 +26,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
26
26
|
\****************************/
|
|
27
27
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
28
28
|
|
|
29
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ activate: () => (/* binding */ activate),\n/* harmony export */ duration: () => (/* binding */ duration),\n/* harmony export */ getOpenid: () => (/* binding */ getOpenid),\n/* harmony export */ getUserData: () => (/* binding */ getUserData),\n/* harmony export */ saveSchedule: () => (/* binding */ saveSchedule),\n/* harmony export */ saveUserData: () => (/* binding */ saveUserData),\n/* harmony export */ send: () => (/* binding */ send),\n/* harmony export */ sendEvent: () => (/* binding */ sendEvent)\n/* harmony export */ });\nconst send = (url, params, httpType = \"GET\", timeout = 3000) => {\n return new Promise((resolve, reject) => {\n let xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n if (xhr.readyState == 4) {\n if (xhr.status >= 200 && xhr.status < 400) {\n resolve(JSON.parse(xhr.responseText));\n } else {\n reject(xhr);\n }\n }\n };\n if (httpType === \"GET\" && params) {\n if (params && typeof params === \"object\" && !Array.isArray(params) && Object.keys(params).length > 0) {\n let str = [];\n for (let k in params) {\n if (typeof params[k] === \"string\") {\n str.push(k + \"=\" + encodeURIComponent(params[k]));\n } else {\n str.push(k + \"=\" + encodeURIComponent(JSON.stringify(params[k])));\n }\n }\n url += \"?\" + str.join(\"&\");\n }\n }\n xhr.open(httpType, url, true);\n if (httpType === \"POST\" || httpType === \"PUT\") {\n if (params) {\n params = JSON.stringify(params);\n }\n xhr.setRequestHeader(\"Content-Type\", \"application/json;charset=UTF-8\");\n } else if (httpType === \"GET\") {}\n xhr.timeout = timeout;\n xhr.ontimeout = () => {\n reject(\"Request timed out\");\n xhr.abort();\n };\n xhr.send(httpType === \"POST\" || httpType === \"PUT\" ? params : null);\n });\n};\nconst getOpenid = (code, openid = \"\", information) => {\n let params = {\n code: code,\n openid: openid,\n appid: information.appId\n };\n return send(information.serverUrl + \"/api/getOpenid\", params, \"GET\");\n};\nconst sendEvent = (eventName, content = \"\", information) => {\n let params = {\n token: information.token,\n openId: information.openid,\n appKey: information.appKey,\n operType: eventName,\n content: content\n };\n return send(information.serverUrl + \"/api/event\", params, \"GET\");\n};\nconst saveSchedule = (data, information) => {\n let params = {\n token: information.token,\n schedule: data.schedule,\n checkpoint: data.checkpoint,\n progress: data.progress,\n pointId: data.pointId,\n status: data.status\n };\n return send(information.serverUrl + \"/api/schedule\", params, \"GET\");\n};\nconst activate = (data, information) => {\n let params = {\n token: information.token,\n openId: information.openid,\n projectid: data.projectid,\n clickid: data.clickid,\n eventType: \"active\",\n appKey: \"1\",\n promotionid: \"1\",\n requestid: \"1\",\n adid: \"1\",\n creativeid: \"1\",\n creativetype: \"1\"\n };\n return send(information.serverUrl + \"/api/activate\", params, \"GET\");\n};\nconst duration = information => {\n let params = {\n openId: information.openid\n };\n return send(information.serverUrl + \"/api/duration\", params, \"GET\");\n};\nconst getUserData = (data, information) => {\n let params = {\n openId: information.openid,\n gameId: data.gameId,\n platformId: information.platformId\n };\n return send(information.serverUrl + \"/gamedataapi/getUserData\", params, \"POST\");\n};\nconst saveUserData = (data, information) => {\n let params = {\n openId: information.openid,\n platformId: information.platformId,\n gameHash: data.gameHash,\n gameId: data.gameId,\n gameData: data.gameData\n };\n return send(information.serverUrl + \"/gamedataapi/saveUserData\", params, \"POST\");\n};\n\n//# sourceURL=webpack://gamepoint/./src/HttpManager.js?");
|
|
29
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ activate: () => (/* binding */ activate),\n/* harmony export */ duration: () => (/* binding */ duration),\n/* harmony export */ getOpenid: () => (/* binding */ getOpenid),\n/* harmony export */ getUserData: () => (/* binding */ getUserData),\n/* harmony export */ saveSchedule: () => (/* binding */ saveSchedule),\n/* harmony export */ saveUserData: () => (/* binding */ saveUserData),\n/* harmony export */ send: () => (/* binding */ send),\n/* harmony export */ sendEvent: () => (/* binding */ sendEvent)\n/* harmony export */ });\nconst send = (url, params, httpType = \"GET\", timeout = 3000) => {\n return new Promise((resolve, reject) => {\n let xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n if (xhr.readyState == 4) {\n if (xhr.status >= 200 && xhr.status < 400) {\n resolve(JSON.parse(xhr.responseText));\n } else {\n reject(xhr);\n }\n }\n };\n if (httpType === \"GET\" && params) {\n if (params && typeof params === \"object\" && !Array.isArray(params) && Object.keys(params).length > 0) {\n let str = [];\n for (let k in params) {\n if (typeof params[k] === \"string\") {\n str.push(k + \"=\" + encodeURIComponent(params[k]));\n } else {\n str.push(k + \"=\" + encodeURIComponent(JSON.stringify(params[k])));\n }\n }\n url += \"?\" + str.join(\"&\");\n }\n }\n xhr.open(httpType, url, true);\n if (httpType === \"POST\" || httpType === \"PUT\") {\n if (params) {\n params = JSON.stringify(params);\n }\n xhr.setRequestHeader(\"Content-Type\", \"application/json;charset=UTF-8\");\n } else if (httpType === \"GET\") {}\n xhr.timeout = timeout;\n xhr.ontimeout = () => {\n reject(\"Request timed out\");\n xhr.abort();\n };\n xhr.send(httpType === \"POST\" || httpType === \"PUT\" ? params : null);\n });\n};\nconst getOpenid = (code, openid = \"\", information) => {\n let params = {\n code: code,\n openid: openid,\n appid: information.appId\n };\n return send(information.serverUrl + \"/api/getOpenid\", params, \"GET\");\n};\nconst sendEvent = (eventName, content = \"\", information) => {\n let params = {\n token: information.token,\n openId: information.openid,\n appKey: information.appKey,\n operType: eventName,\n content: content\n };\n return send(information.serverUrl + \"/api/event\", params, \"GET\");\n};\nconst saveSchedule = (data, information) => {\n let params = {\n token: information.token,\n schedule: data.schedule,\n checkpoint: data.checkpoint,\n progress: data.progress,\n pointId: data.pointId,\n status: data.status\n };\n return send(information.serverUrl + \"/api/schedule\", params, \"GET\");\n};\nconst activate = (data, information) => {\n let params = {\n token: information.token,\n openId: information.openid,\n projectid: data.projectid,\n clickid: data.clickid,\n eventType: \"active\",\n appKey: \"1\",\n promotionid: \"1\",\n requestid: \"1\",\n adid: \"1\",\n creativeid: \"1\",\n creativetype: \"1\"\n };\n return send(information.serverUrl + \"/api/activate\", params, \"GET\");\n};\nconst duration = information => {\n let params = {\n openId: information.openid\n };\n return send(information.serverUrl + \"/api/duration\", params, \"GET\");\n};\nconst getUserData = (data, information) => {\n let params = {\n openId: information.openid,\n gameId: data.gameId,\n platformId: information.platformId,\n serverId: data.serverId || 0\n };\n return send(information.serverUrl + \"/gamedataapi/getUserData\", params, \"POST\");\n};\nconst saveUserData = (data, information) => {\n let params = {\n openId: information.openid,\n platformId: information.platformId,\n gameHash: data.gameHash,\n gameId: data.gameId,\n gameData: data.gameData,\n serverId: data.serverId || 0\n };\n return send(information.serverUrl + \"/gamedataapi/saveUserData\", params, \"POST\");\n};\n\n//# sourceURL=webpack://gamepoint/./src/HttpManager.js?");
|
|
30
30
|
|
|
31
31
|
/***/ }),
|
|
32
32
|
|
|
@@ -46,7 +46,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
46
46
|
\**********************/
|
|
47
47
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
48
48
|
|
|
49
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Analytics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Analytics */ \"./src/Analytics.js\");\n/* harmony import */ var _HttpManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpManager */ \"./src/HttpManager.js\");\n/* harmony import */ var _Info__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Info */ \"./src/Info.js\");\n\n\n\nconst GA = {\n Analytics: _Analytics__WEBPACK_IMPORTED_MODULE_0__.Analytics,\n init: data => {\n return new Promise((resolve, reject) => {\n try {\n (0,_Info__WEBPACK_IMPORTED_MODULE_2__.setConfig)(data);\n resolve();\n } catch (error) {\n reject(error);\n }\n });\n },\n getOpenId: (code, openid) => {\n return new Promise((resolve, reject) => {\n const currentConfig = (0,_Info__WEBPACK_IMPORTED_MODULE_2__.getConfig)();\n return (0,_HttpManager__WEBPACK_IMPORTED_MODULE_1__.getOpenid)(code, openid, currentConfig).then(res => {\n (0,_Info__WEBPACK_IMPORTED_MODULE_2__.setConfig)(res.data);\n return resolve(res);\n });\n });\n }\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GA);\n\n//# sourceURL=webpack://gamepoint/./src/index.js?");
|
|
49
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Analytics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Analytics */ \"./src/Analytics.js\");\n/* harmony import */ var _HttpManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpManager */ \"./src/HttpManager.js\");\n/* harmony import */ var _Info__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Info */ \"./src/Info.js\");\n\n\n\nconst GA = {\n Analytics: _Analytics__WEBPACK_IMPORTED_MODULE_0__.Analytics,\n init: data => {\n return new Promise((resolve, reject) => {\n try {\n (0,_Info__WEBPACK_IMPORTED_MODULE_2__.setConfig)(data);\n resolve();\n } catch (error) {\n reject(error);\n }\n });\n },\n getOpenId: (code, openid) => {\n return new Promise((resolve, reject) => {\n const currentConfig = (0,_Info__WEBPACK_IMPORTED_MODULE_2__.getConfig)();\n return (0,_HttpManager__WEBPACK_IMPORTED_MODULE_1__.getOpenid)(code, openid, currentConfig).then(res => {\n (0,_Info__WEBPACK_IMPORTED_MODULE_2__.setConfig)(res.data);\n const condata = (0,_Info__WEBPACK_IMPORTED_MODULE_2__.getConfig)();\n setInterval(() => {\n (0,_HttpManager__WEBPACK_IMPORTED_MODULE_1__.duration)(condata);\n }, 10 * 1000);\n return resolve(res);\n });\n });\n }\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GA);\n\n//# sourceURL=webpack://gamepoint/./src/index.js?");
|
|
50
50
|
|
|
51
51
|
/***/ })
|
|
52
52
|
|