rn-erxes-sdk 0.1.0 → 0.1.2

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 CHANGED
@@ -1,31 +1,145 @@
1
- # rn-erxes-sdk
1
+ <br>
2
2
 
3
- React Native Erxes SDK
3
+ <p align="center">
4
+ <img src="docs/static/img/logo_dark.svg" alt="erxes logo" width="20%" />
5
+ </p>
4
6
 
5
- ## Installation
7
+ <p align="center">An open-source Hubspot/Qualtrics alternative enables SaaS providers and digital marketing agencies/developers to create unique experiences for their entire business
8
+ </p>
6
9
 
7
- ```sh
8
- npm install rn-erxes-sdk
9
- ```
10
+ <p align="center">
11
+ <a href="https://erxes.io/resource-center">Docs</a>
12
+ |
13
+ <a href="https://xosdemo.erxes.io/">Demo</a>
14
+ |
15
+ <a href="https://erxes.io/">Website</a>
16
+ |
17
+ <a href="https://erxes.io/invest">Invest</a>
18
+ </p>
19
+ </p>
10
20
 
11
- ## Usage
21
+ <p align="center">
22
+ <a href="https://github.com/erxes/erxes/blob/master/LICENSE.md">
23
+ <img alt="License Badge" src="https://img.shields.io/badge/license-AGPLv3-brightgreen">
24
+ </a>
25
+ <a href="#">
26
+ <img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/erxes/erxes">
27
+ </a>
28
+ <a href="https://www.figma.com/@erxes" target="_blank">
29
+ <img alt="Figma" src="https://img.shields.io/badge/Figma-Design%20System-blueviolet">
30
+ </a>
31
+ <a href="https://docs.erxes.io/docs/contribute/overview">
32
+ <img alt="Help Wanted" src="https://img.shields.io/badge/Help%20Wanted-Contribute-blue">
33
+ </a>
34
+ <a href="https://github.com/erxes/erxes/stargazers">
35
+ <img alt="Stars" src="https://img.shields.io/badge/Stars-%202.7k-orange">
36
+ </a>
37
+ <a href="https://discord.com/invite/aaGzy3gQK5">
38
+ <img alt="Discord" src="https://img.shields.io/badge/Discord-%20Community-blueviolet">
39
+ </a>
40
+ <a href="https://explore.transifex.com/erxes-inc/erxes/">
41
+ <img alt="Transfix" src="https://img.shields.io/badge/translations-contribute-brightgreen">
42
+ </a>
43
+ <a href="https://ossrank.com/p/416">
44
+ <img alt="Ossrank" src="https://shields.io/endpoint?url=https://ossrank.com/shield/416">
45
+ </a>
46
+ <a href="https://twitter.com/erxeshq">
47
+ <img alt="Twitter" src="https://img.shields.io/badge/twitter-blue">
48
+ </a>
49
+ </p>
12
50
 
13
- ```js
14
- import { multiply } from 'rn-erxes-sdk';
51
+ <p align="center">
52
+ <a href="https://erxes.io" target="_blank" rel="noopener noreferrer"><img src="https://erxes-docs.s3.us-west-2.amazonaws.com/xos.jpeg" width="100%" alt="erxes: Free and open fair-code licensed experience operating system (XOS)">
53
+ </a>
54
+ </p>
15
55
 
16
- // ...
56
+ Achieving growth and unity within your company is possible with erxes, because it is:
17
57
 
18
- const result = await multiply(3, 7);
19
- ```
58
+ - **100% free & sustainable:** erxes offers a sustainable business model in which both developers and users win. It is open-source software, but even better.
59
+ - **100% customizable:** Our plugin-based architecture provides unlimited customization and lets you meet all your needs, no matter how specific they are.
60
+ - **100% privacy:** We've designed the erxes platform to retain complete control over your company's sensitive data with no third-party monitoring.
61
+ - **100% in control:** You can build any experience you want, where all the channels your business operates on are connected and integrated.
62
+
63
+ ## What does erxes mean? How do you pronounce it?
64
+
65
+ erxes (pronounced 'erk-sis') means "heavenly bodies" in Mongolian. It is branded as “erxes” with all lowercase letters.
66
+
67
+ ## What is erxes?
68
+
69
+ erxes is a secure, self-hosted, and scalable open-source experience operating system (XOS) that enables SaaS providers and digital marketing agencies/developers to create unique experiences that work for all types of business. You can learn more about **<a href="https://docs.erxes.io/docs/introduction/architecture">erxes architecture in our documentation</a>.**
70
+
71
+ ## erxes XOS & Plugins
72
+
73
+ erxes is composed of 2 main components: **XOS** & **Plugins**
74
+
75
+ **XOS:** It contains the project's core. You can find the admin panel and the code that runs different plugins. The operating system comes with utility features that allow users to customize, improve speed, and enhance the experience along with plugins/features.
76
+
77
+ **Plugins:** erxes comes with a set of plugins that allow you to create unique customer experiences. Below is a list of some plugins you can choose from our **<a href="https://erxes.io/marketplace" >marketplace</a>** after you’ve finished installing erxes XOS:
78
+
79
+ - **Team Inbox** - Combine real-time client and team communication with in-app messaging, live chat, email, and form, so your customers can reach you, however, and whenever they want.<img src="https://s3.amazonaws.com/erxes/github/features-transparent.png" width="400" align="right" style="max-width: 50%">
80
+ - **Messenger** - Enable businesses to capture every single customer feedback and educate customers through knowledge-base right from the erxes Messenger.
81
+ - **Sales Management** - Easy and clear sales funnels allow you to control your sales pipeline from one responsive field by precisely analyzing your progress and determining your next best move for success.
82
+ - **Lead generation** - Turn regular visitors into qualified leads by capturing them with a customizable landing page, forms, pop-up, or embed placements.
83
+ - **Engage** - Start converting your prospects into potential customers through email, SMS, messenger, or more interactions to drive them to a successful close.
84
+ - **Contact Management** - Access our all-in-one CRM system in one go, so it’s easier to coordinate and manage your customer interactions.
85
+ - **Knowledgebase** - Educate your customers and staff by creating a help center related to your brands, products, and services to reach a higher level of satisfaction.
86
+ - **Task Management** - Create a more collaborative, self-reliant and cross-linked team. **<a href="https://erxes.io/marketplace" >See more on our website</a>**.
87
+
88
+ ## Getting Started
89
+
90
+ Read **<a href="https://docs.erxes.io/docs/intro" >the documentation<a>** to install erxes locally.
91
+
92
+ **🖐 Requirements**
93
+
94
+ Complete installation requirements can be found in the documentation under **<a href="https://docs.erxes.io/docs/intro" >installation requirements</a>**.
95
+
96
+ Supported operating systems:
97
+
98
+ - Ubuntu v20.04 or higher
99
+ - macOS Mojave or higher
100
+
101
+ Node:
102
+
103
+ - NodeJS v12.0 or higher
104
+ - NPM >= 6.x
105
+
106
+ Database:
107
+
108
+ - MongoDB 3.6+
109
+ - Redis 3.x+
110
+ - RabbitMQ 3.8.x+
111
+ - Elasticsearch
112
+
113
+ Software package managing systems:
114
+
115
+ - Homebrew (optional)
116
+ - Yarn
117
+ - Xcode (optional)
118
+
119
+ We recommend always using the latest version of erxes to start your new projects. Enjoy 🎉
120
+
121
+ ## Become a partner
122
+
123
+ Offer your expertise to the world and introduce your community to erxes.
124
+ Let’s start growing **<a href="https://erxes.io/partners">together</a>**.
20
125
 
21
126
  ## Contributing
22
127
 
23
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
128
+ Please read our **<a href="https://github.com/erxes/erxes/blob/master/CONTRIBUTING.md" >contributing guide<a>** before submitting a Pull Request to the project.
24
129
 
25
- ## License
130
+ ## Community support
131
+
132
+ For general help using erxes, please refer to the erxes documentation. For additional help, you can use one of these channels to ask a question:
26
133
 
27
- MIT
134
+ - **<a href="https://discord.com/invite/aaGzy3gQK5" > Discord</a>** For live discussion with the community
135
+ - **<a href="https://github.com/erxes/erxes" > GitHub</a>** Bug reports, contributions
136
+ - **<a href="https://github.com/erxes/erxes/issues" > Feedback section</a>** Roadmap, feature requests & bugs
137
+ - **<a href="https://twitter.com/erxesHQ" > Twitter</a>** Get the news fast
28
138
 
29
- ---
139
+ ## Upgrade Guides
140
+
141
+ Follow our **<a href="https://docs.erxes.io/docs/update/">upgrade guides</a>** on the documentation to keep your erxes code up-to-date. See our dedicated repository for the erxes documentation, or view our **<a href="https://docs.erxes.io/docs/intro">documentation here</a>**.
142
+
143
+ ## License
30
144
 
31
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
145
+ See the <a href="https://github.com/erxes/erxes/blob/master/LICENSE.md" >**LICENSE**</a> file for licensing information.
@@ -4,8 +4,58 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _App = _interopRequireDefault(require("./App"));
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNativeWebview = require("react-native-webview");
9
+ var _reactNative = require("react-native");
8
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- var _default = _App.default;
11
+ const ErxesSDK = _ref => {
12
+ let {
13
+ brandId,
14
+ src,
15
+ pollInterval = 6000
16
+ } = _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}"; script.async = true; var entry = document.getElementsByTagName('script')[0]; entry.parentNode.insertBefore(script, entry); })(); true;`;
18
+ const onMessage = data => {
19
+ const {
20
+ notificationCount
21
+ } = JSON.parse(data.nativeEvent.data);
22
+ console.log('****************** ', notificationCount);
23
+ };
24
+ return /*#__PURE__*/_react.default.createElement(_reactNativeWebview.WebView, {
25
+ source: _reactNative.Platform.OS === 'ios' ? require('./index.html') : {
26
+ uri: 'file:///android_asset/index.html'
27
+ },
28
+ originWhitelist: ['*'],
29
+ sharedCookiesEnabled: true,
30
+ cacheEnabled: true,
31
+ allowFileAccess: true,
32
+ domStorageEnabled: true,
33
+ thirdPartyCookiesEnabled: true
34
+ // allowingReadAccessToURL
35
+ // style={{ width: 200 }}
36
+ ,
37
+ onLoadEnd: syntheticEvent => {
38
+ // update component to be aware of loading status
39
+ const {
40
+ nativeEvent
41
+ } = syntheticEvent;
42
+ console.log(nativeEvent.loading);
43
+ },
44
+ javaScriptEnabled: true,
45
+ onError: er => {
46
+ console.log(er);
47
+ },
48
+ startInLoadingState: true
49
+ // renderLoading={() => <Loader />}
50
+ ,
51
+ injectedJavaScript: runFirst
52
+ // injectedJavaScriptBeforeContentLoaded={runFirst}
53
+
54
+ // onNavigationStateChange={this.handleWebViewNavigationStateChange}
55
+ ,
56
+ onMessage: onMessage
57
+ });
58
+ };
59
+ var _default = ErxesSDK;
10
60
  exports.default = _default;
11
61
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_App","_interopRequireDefault","require","obj","__esModule","default","_default","ErxesSDK","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAEdC,YAAQ;AAAAC,OAAA,CAAAH,OAAA,GAAAC,QAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNativeWebview","_reactNative","obj","__esModule","default","ErxesSDK","_ref","brandId","src","pollInterval","runFirst","onMessage","data","notificationCount","JSON","parse","nativeEvent","console","log","createElement","WebView","source","Platform","OS","uri","originWhitelist","sharedCookiesEnabled","cacheEnabled","allowFileAccess","domStorageEnabled","thirdPartyCookiesEnabled","onLoadEnd","syntheticEvent","loading","javaScriptEnabled","onError","er","startInLoadingState","injectedJavaScript","_default","exports"],"sourceRoot":"../../src","sources":["index.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,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAQxC,MAAMG,QAA6B,GAAGC,IAAA,IAIhC;EAAA,IAJiC;IACrCC,OAAO;IACPC,GAAG;IACHC,YAAY,GAAG;EACjB,CAAC,GAAAH,IAAA;EACC,MAAMI,QAAQ,GAAI,oDAAmDH,OAAQ,oBAAmBE,YAAa,iLAAgLD,GAAI,2IAA0I;EAE3a,MAAMG,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,oBACEhB,MAAA,CAAAO,OAAA,CAAAe,aAAA,CAACnB,mBAAA,CAAAoB,OAAO;IACNC,MAAM,EACJC,qBAAQ,CAACC,EAAE,KAAK,KAAK,GACjBxB,OAAO,CAAC,cAAc,CAAC,GACvB;MAAEyB,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;AAAC,IAAA4B,QAAA,GAEalC,QAAQ;AAAAmC,OAAA,CAAApC,OAAA,GAAAmC,QAAA"}
@@ -1,3 +1,53 @@
1
- import ErxesSDK from './App';
1
+ import React from 'react';
2
+ import { WebView } from 'react-native-webview';
3
+ import { Platform } from 'react-native';
4
+ const ErxesSDK = _ref => {
5
+ let {
6
+ brandId,
7
+ src,
8
+ pollInterval = 6000
9
+ } = _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}"; script.async = true; var entry = document.getElementsByTagName('script')[0]; entry.parentNode.insertBefore(script, entry); })(); true;`;
11
+ const onMessage = data => {
12
+ const {
13
+ notificationCount
14
+ } = JSON.parse(data.nativeEvent.data);
15
+ console.log('****************** ', notificationCount);
16
+ };
17
+ return /*#__PURE__*/React.createElement(WebView, {
18
+ source: Platform.OS === 'ios' ? require('./index.html') : {
19
+ uri: 'file:///android_asset/index.html'
20
+ },
21
+ originWhitelist: ['*'],
22
+ sharedCookiesEnabled: true,
23
+ cacheEnabled: true,
24
+ allowFileAccess: true,
25
+ domStorageEnabled: true,
26
+ thirdPartyCookiesEnabled: true
27
+ // allowingReadAccessToURL
28
+ // style={{ width: 200 }}
29
+ ,
30
+ onLoadEnd: syntheticEvent => {
31
+ // update component to be aware of loading status
32
+ const {
33
+ nativeEvent
34
+ } = syntheticEvent;
35
+ console.log(nativeEvent.loading);
36
+ },
37
+ javaScriptEnabled: true,
38
+ onError: er => {
39
+ console.log(er);
40
+ },
41
+ startInLoadingState: true
42
+ // renderLoading={() => <Loader />}
43
+ ,
44
+ injectedJavaScript: runFirst
45
+ // injectedJavaScriptBeforeContentLoaded={runFirst}
46
+
47
+ // onNavigationStateChange={this.handleWebViewNavigationStateChange}
48
+ ,
49
+ onMessage: onMessage
50
+ });
51
+ };
2
52
  export default ErxesSDK;
3
53
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ErxesSDK"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,OAAO;AAE5B,eAAeA,QAAQ"}
1
+ {"version":3,"names":["React","WebView","Platform","ErxesSDK","_ref","brandId","src","pollInterval","runFirst","onMessage","data","notificationCount","JSON","parse","nativeEvent","console","log","createElement","source","OS","require","uri","originWhitelist","sharedCookiesEnabled","cacheEnabled","allowFileAccess","domStorageEnabled","thirdPartyCookiesEnabled","onLoadEnd","syntheticEvent","loading","javaScriptEnabled","onError","er","startInLoadingState","injectedJavaScript"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,QAAQ,QAAQ,cAAc;AAQvC,MAAMC,Q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Types = {
3
+ brandId: string;
4
+ src: string;
5
+ pollInterval?: number;
6
+ };
7
+ declare const ErxesSDK: React.FC<PropTypes>;
2
8
  export default ErxesSDK;
3
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,OAAO,CAAC;AAE7B,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA8CjC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-erxes-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "react-native erxes sdk",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/index.tsx CHANGED
@@ -1,3 +1,59 @@
1
- import ErxesSDK from './App';
1
+ import React from 'react';
2
+ import { WebView } from 'react-native-webview';
3
+ import { Platform } from 'react-native';
4
+
5
+ export type PropTypes = {
6
+ brandId: string;
7
+ src: string;
8
+ pollInterval?: number;
9
+ };
10
+
11
+ const ErxesSDK: React.FC<PropTypes> = ({
12
+ brandId,
13
+ src,
14
+ pollInterval = 6000,
15
+ }) => {
16
+ 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}"; script.async = true; var entry = document.getElementsByTagName('script')[0]; entry.parentNode.insertBefore(script, entry); })(); true;`;
17
+
18
+ const onMessage = (data: any) => {
19
+ const { notificationCount } = JSON.parse(data.nativeEvent.data);
20
+
21
+ console.log('****************** ', notificationCount);
22
+ };
23
+
24
+ return (
25
+ <WebView
26
+ source={
27
+ Platform.OS === 'ios'
28
+ ? require('./index.html')
29
+ : { uri: 'file:///android_asset/index.html' }
30
+ }
31
+ originWhitelist={['*']}
32
+ sharedCookiesEnabled={true}
33
+ cacheEnabled={true}
34
+ allowFileAccess={true}
35
+ domStorageEnabled={true}
36
+ thirdPartyCookiesEnabled={true}
37
+ // allowingReadAccessToURL
38
+ // style={{ width: 200 }}
39
+ onLoadEnd={(syntheticEvent) => {
40
+ // update component to be aware of loading status
41
+ const { nativeEvent } = syntheticEvent;
42
+ console.log(nativeEvent.loading);
43
+ }}
44
+ javaScriptEnabled={true}
45
+ onError={(er) => {
46
+ console.log(er);
47
+ }}
48
+ startInLoadingState={true}
49
+ // renderLoading={() => <Loader />}
50
+ injectedJavaScript={runFirst}
51
+ // injectedJavaScriptBeforeContentLoaded={runFirst}
52
+
53
+ // onNavigationStateChange={this.handleWebViewNavigationStateChange}
54
+ onMessage={onMessage}
55
+ />
56
+ );
57
+ };
2
58
 
3
59
  export default ErxesSDK;
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNativeWebview = _interopRequireDefault(require("react-native-webview"));
9
- var _reactNative = require("react-native");
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- const ErxesSDK = _ref => {
12
- let {
13
- brandId,
14
- src,
15
- pollInterval
16
- } = _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
- const onMessage = data => {
19
- const {
20
- notificationCount
21
- } = JSON.parse(data.nativeEvent.data);
22
- console.log('****************** ', notificationCount);
23
- };
24
- return /*#__PURE__*/_react.default.createElement(_reactNativeWebview.default, {
25
- source: _reactNative.Platform.OS === 'ios' ? require('./index.html') : {
26
- uri: 'file:///android_asset/index.html'
27
- },
28
- originWhitelist: ['*'],
29
- sharedCookiesEnabled: true,
30
- cacheEnabled: true,
31
- allowFileAccess: true,
32
- domStorageEnabled: true,
33
- thirdPartyCookiesEnabled: true
34
- // allowingReadAccessToURL
35
- // style={{ width: 200 }}
36
- ,
37
- onLoadEnd: syntheticEvent => {
38
- // update component to be aware of loading status
39
- const {
40
- nativeEvent
41
- } = syntheticEvent;
42
- console.log(nativeEvent.loading);
43
- },
44
- javaScriptEnabled: true,
45
- onError: er => {
46
- console.log(er);
47
- },
48
- startInLoadingState: true
49
- // renderLoading={() => <Loader />}
50
- ,
51
- injectedJavaScript: runFirst
52
- // injectedJavaScriptBeforeContentLoaded={runFirst}
53
-
54
- // onNavigationStateChange={this.handleWebViewNavigationStateChange}
55
- ,
56
- onMessage: onMessage
57
- });
58
- };
59
- var _default = ErxesSDK;
60
- exports.default = _default;
61
- //# sourceMappingURL=App.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNativeWebview","_reactNative","obj","__esModule","default","ErxesSDK","_ref","brandId","src","pollInterval","runFirst","onMessage","data","notificationCount","JSON","parse","nativeEvent","console","log","createElement","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":";;;;;;A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AAK;MACflB,OAAO,CAACC,GAAG,CAACiB,EAAE,CAAC;IACjB,CAAE;IACFC,mBAAmB,EAAE;IACrB;IAAA;IACAC,kBAAkB,EAAE3B;IACpB;;IAEA;IAAA;IACAC,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAAC,IAAA2B,QAAA,GAEajC,QAAQ;AAAAkC,OAAA,CAAAnC,OAAA,GAAAkC,QAAA"}
package/lib/module/App.js DELETED
@@ -1,53 +0,0 @@
1
- import React from 'react';
2
- import WebView from 'react-native-webview';
3
- import { Platform } from 'react-native';
4
- const ErxesSDK = _ref => {
5
- let {
6
- brandId,
7
- src,
8
- pollInterval
9
- } = _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
- const onMessage = data => {
12
- const {
13
- notificationCount
14
- } = JSON.parse(data.nativeEvent.data);
15
- console.log('****************** ', notificationCount);
16
- };
17
- return /*#__PURE__*/React.createElement(WebView, {
18
- source: Platform.OS === 'ios' ? require('./index.html') : {
19
- uri: 'file:///android_asset/index.html'
20
- },
21
- originWhitelist: ['*'],
22
- sharedCookiesEnabled: true,
23
- cacheEnabled: true,
24
- allowFileAccess: true,
25
- domStorageEnabled: true,
26
- thirdPartyCookiesEnabled: true
27
- // allowingReadAccessToURL
28
- // style={{ width: 200 }}
29
- ,
30
- onLoadEnd: syntheticEvent => {
31
- // update component to be aware of loading status
32
- const {
33
- nativeEvent
34
- } = syntheticEvent;
35
- console.log(nativeEvent.loading);
36
- },
37
- javaScriptEnabled: true,
38
- onError: er => {
39
- console.log(er);
40
- },
41
- startInLoadingState: true
42
- // renderLoading={() => <Loader />}
43
- ,
44
- injectedJavaScript: runFirst
45
- // injectedJavaScriptBeforeContentLoaded={runFirst}
46
-
47
- // onNavigationStateChange={this.handleWebViewNavigationStateChange}
48
- ,
49
- onMessage: onMessage
50
- });
51
- };
52
- export default ErxesSDK;
53
- //# sourceMappingURL=App.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","WebView","Platform","ErxesSDK","_ref","brandId","src","pollInterval","runFirst","onMessage","data","notificationCount","JSON","parse","nativeEvent","console","log","createElement","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,OAAOC,OAAO,MAAM,sBAAsB;AAC1C,SAASC,QAAQ,QAAQ,cAAc;AAQvC,MAAMC,QAA6B,GAAGC,IAAA,IAAoC;EAAA,IAAnC;IAAEC,OAAO;IAAEC,GAAG;IAAEC;EAAa,CAAC,GAAAH,IAAA;EACnE,MAAMI,QAAQ,GAAI,oDAAmDH,OAAQ,oBAAmBE,YAAa,iLAAgLD,GAAI,2KAA0K;EAE3c,MAAMG,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,oBACEX,KAAA,CAAAiB,aAAA,CAAChB,OAAO;IACNiB,MAAM,EACJhB,QAAQ,CAACiB,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;QAAEf;MAAY,CAAC,GAAGe,cAAc;MACtCd,OAAO,CAACC,GAAG,CAACF,WAAW,CAACgB,OAAO,CAAC;IAClC,CAAE;IACFC,iBAAiB,EAAE,IAAK;IACxBC,OAAO,EAAGC,EAAE,IAAK;MACflB,OAAO,CAACC,GAAG,CAACiB,EAAE,CAAC;IACjB,CAAE;IACFC,mBAAmB,EAAE;IACrB;IAAA;IACAC,kBAAkB,EAAE3B;IACpB;;IAEA;IAAA;IACAC,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAED,eAAeN,QAAQ"}
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- export type PropTypes = {
3
- brandId: string;
4
- src: string;
5
- pollInterval: number;
6
- };
7
- declare const ErxesSDK: React.FC<PropTypes>;
8
- export default ErxesSDK;
9
- //# sourceMappingURL=App.d.ts.map
@@ -1 +0,0 @@
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,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA0CjC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
package/src/App.tsx DELETED
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
- import WebView from 'react-native-webview';
3
- import { Platform } from 'react-native';
4
-
5
- export type PropTypes = {
6
- brandId: string;
7
- src: string;
8
- pollInterval: number;
9
- };
10
-
11
- const ErxesSDK: React.FC<PropTypes> = ({ brandId, src, pollInterval }) => {
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
-
14
- const onMessage = (data: any) => {
15
- const { notificationCount } = JSON.parse(data.nativeEvent.data);
16
-
17
- console.log('****************** ', notificationCount);
18
- };
19
-
20
- return (
21
- <WebView
22
- source={
23
- Platform.OS === 'ios'
24
- ? require('./index.html')
25
- : { uri: 'file:///android_asset/index.html' }
26
- }
27
- originWhitelist={['*']}
28
- sharedCookiesEnabled={true}
29
- cacheEnabled={true}
30
- allowFileAccess={true}
31
- domStorageEnabled={true}
32
- thirdPartyCookiesEnabled={true}
33
- // allowingReadAccessToURL
34
- // style={{ width: 200 }}
35
- onLoadEnd={(syntheticEvent) => {
36
- // update component to be aware of loading status
37
- const { nativeEvent } = syntheticEvent;
38
- console.log(nativeEvent.loading);
39
- }}
40
- javaScriptEnabled={true}
41
- onError={(er) => {
42
- console.log(er);
43
- }}
44
- startInLoadingState={true}
45
- // renderLoading={() => <Loader />}
46
- injectedJavaScript={runFirst}
47
- // injectedJavaScriptBeforeContentLoaded={runFirst}
48
-
49
- // onNavigationStateChange={this.handleWebViewNavigationStateChange}
50
- onMessage={onMessage}
51
- />
52
- );
53
- };
54
-
55
- export default ErxesSDK;