gamepoint 1.0.0
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 +117 -0
- package/package.json +27 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
3
|
+
* This devtool is neither made for production nor for readable output files.
|
|
4
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
5
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
6
|
+
* or disable the default devtool with "devtool: false".
|
|
7
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
8
|
+
*/
|
|
9
|
+
/******/ (() => { // webpackBootstrap
|
|
10
|
+
/******/ "use strict";
|
|
11
|
+
/******/ var __webpack_modules__ = ({
|
|
12
|
+
|
|
13
|
+
/***/ "./src/Analytics.js":
|
|
14
|
+
/*!**************************!*\
|
|
15
|
+
!*** ./src/Analytics.js ***!
|
|
16
|
+
\**************************/
|
|
17
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
18
|
+
|
|
19
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Analytics: () => (/* binding */ Analytics)\n/* harmony export */ });\n/* harmony import */ var _HttpManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HttpManager */ \"./src/HttpManager.js\");\n/* harmony import */ var _Info__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Info */ \"./src/Info.js\");\n\n\nconst Analytics = {\n track: (eventName, content = \"\") => {\n const currentConfig = (0,_Info__WEBPACK_IMPORTED_MODULE_1__.getConfig)();\n (0,_HttpManager__WEBPACK_IMPORTED_MODULE_0__.sendEvent)(eventName, content, currentConfig);\n },\n saveSchedule: data => {\n const currentConfig = (0,_Info__WEBPACK_IMPORTED_MODULE_1__.getConfig)();\n (0,_HttpManager__WEBPACK_IMPORTED_MODULE_0__.saveSchedule)(data, currentConfig);\n },\n activate: data => {\n const currentConfig = (0,_Info__WEBPACK_IMPORTED_MODULE_1__.getConfig)();\n (0,_HttpManager__WEBPACK_IMPORTED_MODULE_0__.activate)(data, currentConfig);\n },\n duration: () => {\n const currentConfig = (0,_Info__WEBPACK_IMPORTED_MODULE_1__.getConfig)();\n (0,_HttpManager__WEBPACK_IMPORTED_MODULE_0__.duration)(currentConfig);\n }\n};\n\n//# sourceURL=webpack://gamepoint/./src/Analytics.js?");
|
|
20
|
+
|
|
21
|
+
/***/ }),
|
|
22
|
+
|
|
23
|
+
/***/ "./src/HttpManager.js":
|
|
24
|
+
/*!****************************!*\
|
|
25
|
+
!*** ./src/HttpManager.js ***!
|
|
26
|
+
\****************************/
|
|
27
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
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 */ saveSchedule: () => (/* binding */ saveSchedule),\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: openid ? \"\" : code,\n openid: code ? \"\" : 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};\n\n//# sourceURL=webpack://gamepoint/./src/HttpManager.js?");
|
|
30
|
+
|
|
31
|
+
/***/ }),
|
|
32
|
+
|
|
33
|
+
/***/ "./src/Info.js":
|
|
34
|
+
/*!*********************!*\
|
|
35
|
+
!*** ./src/Info.js ***!
|
|
36
|
+
\*********************/
|
|
37
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
38
|
+
|
|
39
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getConfig: () => (/* binding */ getConfig),\n/* harmony export */ setConfig: () => (/* binding */ setConfig)\n/* harmony export */ });\nlet configuration = {\n appId: \"\",\n openid: \"\",\n serverUrl: \"\",\n channelId: \"\",\n version: \"\",\n token: \"\",\n appKey: \"\"\n};\nfunction setConfig(data) {\n configuration = {\n ...configuration,\n ...data\n };\n}\nfunction getConfig() {\n return {\n ...configuration\n };\n}\n\n//# sourceURL=webpack://gamepoint/./src/Info.js?");
|
|
40
|
+
|
|
41
|
+
/***/ }),
|
|
42
|
+
|
|
43
|
+
/***/ "./src/index.js":
|
|
44
|
+
/*!**********************!*\
|
|
45
|
+
!*** ./src/index.js ***!
|
|
46
|
+
\**********************/
|
|
47
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
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 });\n });\n }\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GA);\n\n//# sourceURL=webpack://gamepoint/./src/index.js?");
|
|
50
|
+
|
|
51
|
+
/***/ })
|
|
52
|
+
|
|
53
|
+
/******/ });
|
|
54
|
+
/************************************************************************/
|
|
55
|
+
/******/ // The module cache
|
|
56
|
+
/******/ var __webpack_module_cache__ = {};
|
|
57
|
+
/******/
|
|
58
|
+
/******/ // The require function
|
|
59
|
+
/******/ function __webpack_require__(moduleId) {
|
|
60
|
+
/******/ // Check if module is in cache
|
|
61
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
62
|
+
/******/ if (cachedModule !== undefined) {
|
|
63
|
+
/******/ return cachedModule.exports;
|
|
64
|
+
/******/ }
|
|
65
|
+
/******/ // Create a new module (and put it into the cache)
|
|
66
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
67
|
+
/******/ // no module.id needed
|
|
68
|
+
/******/ // no module.loaded needed
|
|
69
|
+
/******/ exports: {}
|
|
70
|
+
/******/ };
|
|
71
|
+
/******/
|
|
72
|
+
/******/ // Execute the module function
|
|
73
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
74
|
+
/******/
|
|
75
|
+
/******/ // Return the exports of the module
|
|
76
|
+
/******/ return module.exports;
|
|
77
|
+
/******/ }
|
|
78
|
+
/******/
|
|
79
|
+
/************************************************************************/
|
|
80
|
+
/******/ /* webpack/runtime/define property getters */
|
|
81
|
+
/******/ (() => {
|
|
82
|
+
/******/ // define getter functions for harmony exports
|
|
83
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
84
|
+
/******/ for(var key in definition) {
|
|
85
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
86
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
87
|
+
/******/ }
|
|
88
|
+
/******/ }
|
|
89
|
+
/******/ };
|
|
90
|
+
/******/ })();
|
|
91
|
+
/******/
|
|
92
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
93
|
+
/******/ (() => {
|
|
94
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
95
|
+
/******/ })();
|
|
96
|
+
/******/
|
|
97
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
98
|
+
/******/ (() => {
|
|
99
|
+
/******/ // define __esModule on exports
|
|
100
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
101
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
102
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
103
|
+
/******/ }
|
|
104
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
105
|
+
/******/ };
|
|
106
|
+
/******/ })();
|
|
107
|
+
/******/
|
|
108
|
+
/************************************************************************/
|
|
109
|
+
/******/
|
|
110
|
+
/******/ // startup
|
|
111
|
+
/******/ // Load entry module and return exports
|
|
112
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
113
|
+
/******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
|
|
114
|
+
/******/ module.exports = __webpack_exports__;
|
|
115
|
+
/******/
|
|
116
|
+
/******/ })()
|
|
117
|
+
;
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gamepoint",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "webpack --config webpack.prod.js",
|
|
8
|
+
"dev": "webpack --config webpack.dev.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"lib/"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "pjl",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@babel/core": "^7.24.7",
|
|
18
|
+
"@babel/preset-env": "^7.24.7",
|
|
19
|
+
"babel-loader": "^9.1.3",
|
|
20
|
+
"babel-preset-env": "^1.7.0",
|
|
21
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
22
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
23
|
+
"webpack": "^5.92.0",
|
|
24
|
+
"webpack-cli": "^5.1.4",
|
|
25
|
+
"webpack-merge": "^5.10.0"
|
|
26
|
+
}
|
|
27
|
+
}
|