rn-erxes-sdk 0.1.1 → 0.1.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/commonjs/App.js +5 -7
- package/lib/commonjs/App.js.map +1 -1
- package/lib/commonjs/index.html +1 -1
- package/lib/commonjs/index.js +6 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/App.js +4 -6
- package/lib/module/App.js.map +1 -1
- package/lib/module/index.html +1 -1
- package/lib/module/index.js +1 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/App.d.ts +1 -3
- package/lib/typescript/App.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/App.tsx +5 -8
- package/src/index.html +1 -1
- package/src/index.tsx +1 -3
package/lib/commonjs/App.js
CHANGED
|
@@ -5,23 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNativeWebview =
|
|
8
|
+
var _reactNativeWebview = require("react-native-webview");
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const ErxesSDK = _ref => {
|
|
12
12
|
let {
|
|
13
|
-
|
|
14
|
-
src,
|
|
15
|
-
pollInterval
|
|
13
|
+
script
|
|
16
14
|
} = _ref;
|
|
17
|
-
const runFirst = `window.erxesSettings = { messenger: { brand_id: "${brandId}", pollInterval: ${pollInterval}, css: ".topbar-button.right { visibility: hidden;} .erxes-launcher { visibility: hidden; }"}, }; (function () { var script = document.createElement('script'); script.src = "${src}/build/messengerWidget.bundle.js"; script.async = true; var entry = document.getElementsByTagName('script')[0]; entry.parentNode.insertBefore(script, entry); })(); true;`;
|
|
18
15
|
const onMessage = data => {
|
|
19
16
|
const {
|
|
20
17
|
notificationCount
|
|
21
18
|
} = JSON.parse(data.nativeEvent.data);
|
|
22
19
|
console.log('****************** ', notificationCount);
|
|
23
20
|
};
|
|
24
|
-
return /*#__PURE__*/_react.default.createElement(_reactNativeWebview.
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_reactNativeWebview.WebView, {
|
|
22
|
+
ref: () => {},
|
|
25
23
|
source: _reactNative.Platform.OS === 'ios' ? require('./index.html') : {
|
|
26
24
|
uri: 'file:///android_asset/index.html'
|
|
27
25
|
},
|
|
@@ -48,7 +46,7 @@ const ErxesSDK = _ref => {
|
|
|
48
46
|
startInLoadingState: true
|
|
49
47
|
// renderLoading={() => <Loader />}
|
|
50
48
|
,
|
|
51
|
-
injectedJavaScript:
|
|
49
|
+
injectedJavaScript: script
|
|
52
50
|
// injectedJavaScriptBeforeContentLoaded={runFirst}
|
|
53
51
|
|
|
54
52
|
// onNavigationStateChange={this.handleWebViewNavigationStateChange}
|
package/lib/commonjs/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNativeWebview","_reactNative","obj","__esModule","default","ErxesSDK","_ref","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNativeWebview","_reactNative","obj","__esModule","default","ErxesSDK","_ref","script","onMessage","data","notificationCount","JSON","parse","nativeEvent","console","log","createElement","WebView","ref","source","Platform","OS","uri","originWhitelist","sharedCookiesEnabled","cacheEnabled","allowFileAccess","domStorageEnabled","thirdPartyCookiesEnabled","onLoadEnd","syntheticEvent","loading","javaScriptEnabled","onError","er","startInLoadingState","injectedJavaScript","_default","exports"],"sourceRoot":"../../src","sources":["App.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAAwC,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAA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AAA,GAAAiC,QAAA"}
|
package/lib/commonjs/index.html
CHANGED
package/lib/commonjs/index.js
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
Object.defineProperty(exports, "ErxesSDK", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _App.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
7
12
|
var _App = _interopRequireDefault(require("./App"));
|
|
8
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _App.default;
|
|
10
|
-
exports.default = _default;
|
|
11
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_App","_interopRequireDefault","require","obj","__esModule","default"
|
|
1
|
+
{"version":3,"names":["_App","_interopRequireDefault","require","obj","__esModule","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
|
package/lib/module/App.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import WebView from 'react-native-webview';
|
|
2
|
+
import { WebView } from 'react-native-webview';
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
4
|
const ErxesSDK = _ref => {
|
|
5
5
|
let {
|
|
6
|
-
|
|
7
|
-
src,
|
|
8
|
-
pollInterval
|
|
6
|
+
script
|
|
9
7
|
} = _ref;
|
|
10
|
-
const runFirst = `window.erxesSettings = { messenger: { brand_id: "${brandId}", pollInterval: ${pollInterval}, css: ".topbar-button.right { visibility: hidden;} .erxes-launcher { visibility: hidden; }"}, }; (function () { var script = document.createElement('script'); script.src = "${src}/build/messengerWidget.bundle.js"; script.async = true; var entry = document.getElementsByTagName('script')[0]; entry.parentNode.insertBefore(script, entry); })(); true;`;
|
|
11
8
|
const onMessage = data => {
|
|
12
9
|
const {
|
|
13
10
|
notificationCount
|
|
@@ -15,6 +12,7 @@ const ErxesSDK = _ref => {
|
|
|
15
12
|
console.log('****************** ', notificationCount);
|
|
16
13
|
};
|
|
17
14
|
return /*#__PURE__*/React.createElement(WebView, {
|
|
15
|
+
ref: () => {},
|
|
18
16
|
source: Platform.OS === 'ios' ? require('./index.html') : {
|
|
19
17
|
uri: 'file:///android_asset/index.html'
|
|
20
18
|
},
|
|
@@ -41,7 +39,7 @@ const ErxesSDK = _ref => {
|
|
|
41
39
|
startInLoadingState: true
|
|
42
40
|
// renderLoading={() => <Loader />}
|
|
43
41
|
,
|
|
44
|
-
injectedJavaScript:
|
|
42
|
+
injectedJavaScript: script
|
|
45
43
|
// injectedJavaScriptBeforeContentLoaded={runFirst}
|
|
46
44
|
|
|
47
45
|
// onNavigationStateChange={this.handleWebViewNavigationStateChange}
|
package/lib/module/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","WebView","Platform","ErxesSDK","_ref","
|
|
1
|
+
{"version":3,"names":["React","WebView","Platform","ErxesSDK","_ref","script","onMessage","data","notificationCount","JSON","parse","nativeEvent","console","log","createElement","ref","source","OS","require","uri","originWhitelist","sharedCookiesEnabled","cacheEnabled","allowFileAccess","domStorageEnabled","thirdPartyCookiesEnabled","onLoadEnd","syntheticEvent","loading","javaScriptEnabled","onError","er","startInLoadingState","injectedJavaScript"],"sourceRoot":"../../src","sources":["App.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,QAAQ,QAAQ,cAAc;AAMvC,MAAMC,QAA6B,GAAGC,IAAA,IAAgB;EAAA,IAAf;IAAEC;EAAO,CAAC,GAAAD,IAAA;EAC/C,MAAME,SAAS,GAAIC,IAAS,IAAK;IAC/B,MAAM;MAAEC;IAAkB,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACH,IAAI,CAACI,WAAW,CAACJ,IAAI,CAAC;IAE/DK,OAAO,CAACC,GAAG,CAAC,qBAAqB,EAAEL,iBAAiB,CAAC;EACvD,CAAC;EAED,oBACER,KAAA,CAAAc,aAAA,CAACb,OAAO;IACNc,GAAG,EAAEA,CAAA,KAAM,CAAC,CAAE;IACdC,MAAM,EACJd,QAAQ,CAACe,EAAE,KAAK,KAAK,GACjBC,OAAO,CAAC,cAAc,CAAC,GACvB;MAAEC,GAAG,EAAE;IAAmC,CAC/C;IACDC,eAAe,EAAE,CAAC,GAAG,CAAE;IACvBC,oBAAoB,EAAE,IAAK;IAC3BC,YAAY,EAAE,IAAK;IACnBC,eAAe,EAAE,IAAK;IACtBC,iBAAiB,EAAE,IAAK;IACxBC,wBAAwB,EAAE;IAC1B;IACA;IAAA;IACAC,SAAS,EAAGC,cAAc,IAAK;MAC7B;MACA,MAAM;QAAEhB;MAAY,CAAC,GAAGgB,cAAc;MACtCf,OAAO,CAACC,GAAG,CAACF,WAAW,CAACiB,OAAO,CAAC;IAClC,CAAE;IACFC,iBAAiB,EAAE,IAAK;IACxBC,OAAO,EAAGC,EAAE,IAAK;MACfnB,OAAO,CAACC,GAAG,CAACkB,EAAE,CAAC;IACjB,CAAE;IACFC,mBAAmB,EAAE;IACrB;IAAA;IACAC,kBAAkB,EAAE5B;IACpB;;IAEA;IAAA;IACAC,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAED,eAAeH,QAAQ"}
|
package/lib/module/index.html
CHANGED
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ErxesSDK"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"names":["default","ErxesSDK"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,OAAO,IAAIC,QAAQ,QAAQ,OAAO"}
|
package/lib/typescript/App.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,SAAS,GAAG;IACtB,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAyCjC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,OAAO,CAAC"}
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import WebView from 'react-native-webview';
|
|
2
|
+
import { WebView } from 'react-native-webview';
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
4
|
|
|
5
5
|
export type PropTypes = {
|
|
6
|
-
|
|
7
|
-
src: string;
|
|
8
|
-
pollInterval: number;
|
|
6
|
+
script: string;
|
|
9
7
|
};
|
|
10
8
|
|
|
11
|
-
const ErxesSDK: React.FC<PropTypes> = ({
|
|
12
|
-
const runFirst = `window.erxesSettings = { messenger: { brand_id: "${brandId}", pollInterval: ${pollInterval}, css: ".topbar-button.right { visibility: hidden;} .erxes-launcher { visibility: hidden; }"}, }; (function () { var script = document.createElement('script'); script.src = "${src}/build/messengerWidget.bundle.js"; script.async = true; var entry = document.getElementsByTagName('script')[0]; entry.parentNode.insertBefore(script, entry); })(); true;`;
|
|
13
|
-
|
|
9
|
+
const ErxesSDK: React.FC<PropTypes> = ({ script }) => {
|
|
14
10
|
const onMessage = (data: any) => {
|
|
15
11
|
const { notificationCount } = JSON.parse(data.nativeEvent.data);
|
|
16
12
|
|
|
@@ -19,6 +15,7 @@ const ErxesSDK: React.FC<PropTypes> = ({ brandId, src, pollInterval }) => {
|
|
|
19
15
|
|
|
20
16
|
return (
|
|
21
17
|
<WebView
|
|
18
|
+
ref={() => {}}
|
|
22
19
|
source={
|
|
23
20
|
Platform.OS === 'ios'
|
|
24
21
|
? require('./index.html')
|
|
@@ -43,7 +40,7 @@ const ErxesSDK: React.FC<PropTypes> = ({ brandId, src, pollInterval }) => {
|
|
|
43
40
|
}}
|
|
44
41
|
startInLoadingState={true}
|
|
45
42
|
// renderLoading={() => <Loader />}
|
|
46
|
-
injectedJavaScript={
|
|
43
|
+
injectedJavaScript={script}
|
|
47
44
|
// injectedJavaScriptBeforeContentLoaded={runFirst}
|
|
48
45
|
|
|
49
46
|
// onNavigationStateChange={this.handleWebViewNavigationStateChange}
|
package/src/index.html
CHANGED
package/src/index.tsx
CHANGED