pih-appointment-widget 0.0.1
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 +70 -0
- package/babel.config.js +6 -0
- package/dist/App.js +38 -0
- package/dist/Example.js +25 -0
- package/dist/appointment-widget.umd.min.js +1 -0
- package/dist/components/BookingPopup.js +12 -0
- package/dist/index.js +8 -0
- package/dist/pih-appointment-widget.umd.js +53 -0
- package/package.json +60 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/rollup.config.js +43 -0
- package/src/App.js +41 -0
- package/src/Example.js +24 -0
- package/src/components/BookingPopup.js +7 -0
- package/src/index.js +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Getting Started with Create React App
|
|
2
|
+
|
|
3
|
+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
4
|
+
|
|
5
|
+
## Available Scripts
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
### `npm start`
|
|
10
|
+
|
|
11
|
+
Runs the app in the development mode.\
|
|
12
|
+
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
|
13
|
+
|
|
14
|
+
The page will reload when you make changes.\
|
|
15
|
+
You may also see any lint errors in the console.
|
|
16
|
+
|
|
17
|
+
### `npm test`
|
|
18
|
+
|
|
19
|
+
Launches the test runner in the interactive watch mode.\
|
|
20
|
+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
21
|
+
|
|
22
|
+
### `npm run build`
|
|
23
|
+
|
|
24
|
+
Builds the app for production to the `build` folder.\
|
|
25
|
+
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
26
|
+
|
|
27
|
+
The build is minified and the filenames include the hashes.\
|
|
28
|
+
Your app is ready to be deployed!
|
|
29
|
+
|
|
30
|
+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
31
|
+
|
|
32
|
+
### `npm run eject`
|
|
33
|
+
|
|
34
|
+
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
|
35
|
+
|
|
36
|
+
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
37
|
+
|
|
38
|
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
|
39
|
+
|
|
40
|
+
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
|
41
|
+
|
|
42
|
+
## Learn More
|
|
43
|
+
|
|
44
|
+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
45
|
+
|
|
46
|
+
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
47
|
+
|
|
48
|
+
### Code Splitting
|
|
49
|
+
|
|
50
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
|
51
|
+
|
|
52
|
+
### Analyzing the Bundle Size
|
|
53
|
+
|
|
54
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
|
55
|
+
|
|
56
|
+
### Making a Progressive Web App
|
|
57
|
+
|
|
58
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
|
59
|
+
|
|
60
|
+
### Advanced Configuration
|
|
61
|
+
|
|
62
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
|
63
|
+
|
|
64
|
+
### Deployment
|
|
65
|
+
|
|
66
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
|
67
|
+
|
|
68
|
+
### `npm run build` fails to minify
|
|
69
|
+
|
|
70
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
package/babel.config.js
ADDED
package/dist/App.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
|
+
var _BookingPopup = _interopRequireDefault(require("./components/BookingPopup.js"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
let popupInstance = null;
|
|
15
|
+
const PopupSDK = {
|
|
16
|
+
showPopup: (content, onAction) => {
|
|
17
|
+
if (!popupInstance) {
|
|
18
|
+
popupInstance = document.createElement("div");
|
|
19
|
+
document.body.appendChild(popupInstance);
|
|
20
|
+
}
|
|
21
|
+
const PopupWrapper = () => {
|
|
22
|
+
const [open, setOpen] = (0, _react.useState)(true);
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_BookingPopup.default, _extends({}, content, {
|
|
24
|
+
onClose: () => setOpen(false),
|
|
25
|
+
open: open
|
|
26
|
+
})));
|
|
27
|
+
};
|
|
28
|
+
_reactDom.default.render(/*#__PURE__*/_react.default.createElement(PopupWrapper, null), popupInstance);
|
|
29
|
+
},
|
|
30
|
+
closePopup: () => {
|
|
31
|
+
if (popupInstance) {
|
|
32
|
+
_reactDom.default.unmountComponentAtNode(popupInstance);
|
|
33
|
+
popupInstance = null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
window.PopupSDK = PopupSDK;
|
|
38
|
+
var _default = exports.default = PopupSDK;
|
package/dist/Example.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _BookingPopup = _interopRequireDefault(require("./components/BookingPopup.js"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const Example = () => {
|
|
11
|
+
const [open, setOpen] = (0, _react.useState)(true);
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_BookingPopup.default, {
|
|
13
|
+
color: "#50B6AE",
|
|
14
|
+
onClose: () => setOpen(false),
|
|
15
|
+
open: open,
|
|
16
|
+
hospitalId: "dMtEGhak",
|
|
17
|
+
hospitalHdr: "Web_Widget_BA_TVH",
|
|
18
|
+
isCorporate: false,
|
|
19
|
+
hospitalName: "The View Hospital, Qatar",
|
|
20
|
+
tenantId: "tvh_hospital_tennet",
|
|
21
|
+
tenantSecret: "shdfhghfjsdfvb427653",
|
|
22
|
+
language: "en"
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = Example;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).MyPackage=t(e.React,e.ReactDOM)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e),l=n(t);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},u.apply(null,arguments)}const a=()=>o.default.createElement("div",null,"se");let r=null;const d={showPopup:(t,n)=>{r||(r=document.createElement("div"),document.body.appendChild(r));const d=()=>{const[n,l]=e.useState(!0);return o.default.createElement(o.default.Fragment,null,o.default.createElement(a,u({},t,{onClose:()=>l(!1),open:n})))};l.default.render(o.default.createElement(d,null),r)},closePopup:()=>{r&&(l.default.unmountComponentAtNode(r),r=null)}};return window.PopupSDK=d,d}));
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const BookingPopup = () => {
|
|
10
|
+
return /*#__PURE__*/_react.default.createElement("div", null, "se");
|
|
11
|
+
};
|
|
12
|
+
var _default = exports.default = BookingPopup;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _client = _interopRequireDefault(require("react-dom/client"));
|
|
5
|
+
var _Example = _interopRequireDefault(require("./Example"));
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
const root = _client.default.createRoot(document.getElementById("root"));
|
|
8
|
+
root.render(/*#__PURE__*/_react.default.createElement(_Example.default, null));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('react-dom')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['react', 'react-dom'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.MyPackage = factory(global.React, global.ReactDOM));
|
|
5
|
+
})(this, (function (React, ReactDOM) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
11
|
+
|
|
12
|
+
function _extends() {
|
|
13
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
14
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
15
|
+
var t = arguments[e];
|
|
16
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
17
|
+
}
|
|
18
|
+
return n;
|
|
19
|
+
}, _extends.apply(null, arguments);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const BookingPopup = () => {
|
|
23
|
+
return /*#__PURE__*/React__default["default"].createElement("div", null, "se");
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
let popupInstance = null;
|
|
27
|
+
const PopupSDK = {
|
|
28
|
+
showPopup: (content, onAction) => {
|
|
29
|
+
if (!popupInstance) {
|
|
30
|
+
popupInstance = document.createElement("div");
|
|
31
|
+
document.body.appendChild(popupInstance);
|
|
32
|
+
}
|
|
33
|
+
const PopupWrapper = () => {
|
|
34
|
+
const [open, setOpen] = React.useState(true);
|
|
35
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(BookingPopup, _extends({}, content, {
|
|
36
|
+
onClose: () => setOpen(false),
|
|
37
|
+
open: open
|
|
38
|
+
})));
|
|
39
|
+
};
|
|
40
|
+
ReactDOM__default["default"].render(/*#__PURE__*/React__default["default"].createElement(PopupWrapper, null), popupInstance);
|
|
41
|
+
},
|
|
42
|
+
closePopup: () => {
|
|
43
|
+
if (popupInstance) {
|
|
44
|
+
ReactDOM__default["default"].unmountComponentAtNode(popupInstance);
|
|
45
|
+
popupInstance = null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
window.PopupSDK = PopupSDK;
|
|
50
|
+
|
|
51
|
+
return PopupSDK;
|
|
52
|
+
|
|
53
|
+
}));
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pih-appointment-widget",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/App.js",
|
|
5
|
+
"module": "dist/App.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"require": "./dist/App.js",
|
|
9
|
+
"import": "./dist/App.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@babel/cli": "^7.25.9",
|
|
14
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
15
|
+
"@testing-library/react": "^13.4.0",
|
|
16
|
+
"@testing-library/user-event": "^13.5.0",
|
|
17
|
+
"axios": "^1.8.4",
|
|
18
|
+
"react": "^18.3.1",
|
|
19
|
+
"react-dom": "^18.3.1",
|
|
20
|
+
"react-scripts": "5.0.1",
|
|
21
|
+
"web-vitals": "^2.1.4"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "babel src -d dist",
|
|
25
|
+
"build:roll": "rollup -c",
|
|
26
|
+
"prepublishOnly": "npm run build",
|
|
27
|
+
"start": "react-scripts start",
|
|
28
|
+
"test": "react-scripts test",
|
|
29
|
+
"eject": "react-scripts eject"
|
|
30
|
+
},
|
|
31
|
+
"eslintConfig": {
|
|
32
|
+
"extends": [
|
|
33
|
+
"react-app",
|
|
34
|
+
"react-app/jest"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"browserslist": {
|
|
38
|
+
"production": [
|
|
39
|
+
">0.2%",
|
|
40
|
+
"not dead",
|
|
41
|
+
"not op_mini all"
|
|
42
|
+
],
|
|
43
|
+
"development": [
|
|
44
|
+
"last 1 chrome version",
|
|
45
|
+
"last 1 firefox version",
|
|
46
|
+
"last 1 safari version"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@babel/core": "^7.26.0",
|
|
51
|
+
"@babel/preset-env": "^7.26.0",
|
|
52
|
+
"@babel/preset-react": "^7.26.3",
|
|
53
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
54
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
55
|
+
"@rollup/plugin-image": "^3.0.3",
|
|
56
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
57
|
+
"rollup": "^2.79.2",
|
|
58
|
+
"rollup-plugin-terser": "^7.0.2"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="theme-color" content="#000000" />
|
|
8
|
+
<meta
|
|
9
|
+
name="description"
|
|
10
|
+
content="Web site created using create-react-app"
|
|
11
|
+
/>
|
|
12
|
+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
13
|
+
<!--
|
|
14
|
+
manifest.json provides metadata used when your web app is installed on a
|
|
15
|
+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
16
|
+
-->
|
|
17
|
+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
18
|
+
<!--
|
|
19
|
+
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
+
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
+
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
+
|
|
23
|
+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
+
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
+
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
+
-->
|
|
27
|
+
<title>React App</title>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
31
|
+
<div id="root"></div>
|
|
32
|
+
<!--
|
|
33
|
+
This HTML file is a template.
|
|
34
|
+
If you open it directly in the browser, you will see an empty page.
|
|
35
|
+
|
|
36
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
37
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
38
|
+
|
|
39
|
+
To begin the development, run `npm start` or `yarn start`.
|
|
40
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
|
41
|
+
-->
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"short_name": "React App",
|
|
3
|
+
"name": "Create React App Sample",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "favicon.ico",
|
|
7
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
+
"type": "image/x-icon"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"src": "logo192.png",
|
|
12
|
+
"type": "image/png",
|
|
13
|
+
"sizes": "192x192"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"src": "logo512.png",
|
|
17
|
+
"type": "image/png",
|
|
18
|
+
"sizes": "512x512"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"start_url": ".",
|
|
22
|
+
"display": "standalone",
|
|
23
|
+
"theme_color": "#000000",
|
|
24
|
+
"background_color": "#ffffff"
|
|
25
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { terser } from 'rollup-plugin-terser'; // For minification
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve'; // To resolve npm dependencies
|
|
3
|
+
import commonjs from '@rollup/plugin-commonjs'; // To handle CommonJS modules
|
|
4
|
+
import babel from '@rollup/plugin-babel'; // To transpile with Babel
|
|
5
|
+
import image from '@rollup/plugin-image';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
input: 'src/App.js', // Path to your package's main entry point
|
|
9
|
+
output: [
|
|
10
|
+
{
|
|
11
|
+
file: 'dist/pih-appointment-widget.umd.js', // UMD build output file
|
|
12
|
+
format: 'umd', // UMD format
|
|
13
|
+
name: 'MyPackage', // Global variable name (use a unique name)
|
|
14
|
+
globals: {
|
|
15
|
+
react: 'React', // Define global variable for React
|
|
16
|
+
'react-dom': 'ReactDOM', // Define global variable for ReactDOM
|
|
17
|
+
axios: 'axios', // Add axios here as well if you want to expose it globally
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
file: 'dist/appointment-widget.umd.min.js', // UMD minified output
|
|
22
|
+
format: 'umd',
|
|
23
|
+
name: 'MyPackage',
|
|
24
|
+
plugins: [terser()], // Minify the output
|
|
25
|
+
globals: {
|
|
26
|
+
react: 'React', // Define global variable for React
|
|
27
|
+
'react-dom': 'ReactDOM', // Define global variable for ReactDOM
|
|
28
|
+
axios: 'axios', // Minified version should still handle axios externally
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
plugins: [
|
|
33
|
+
image(),
|
|
34
|
+
resolve(), // Resolve modules from node_modules
|
|
35
|
+
babel({
|
|
36
|
+
exclude: 'node_modules/**', // Exclude transpiling node_modules
|
|
37
|
+
presets: ['@babel/preset-env', '@babel/preset-react'], // Use Babel presets
|
|
38
|
+
babelHelpers: 'bundled', // Ensure the correct Babel helper functions are included
|
|
39
|
+
}),
|
|
40
|
+
commonjs(), // Convert CommonJS modules to ES6
|
|
41
|
+
],
|
|
42
|
+
external: ['react', 'react-dom', 'axios'], // Mark react, react-dom, and axios as external dependencies
|
|
43
|
+
};
|
package/src/App.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
import BookingPopup from "./components/BookingPopup.js";
|
|
4
|
+
|
|
5
|
+
let popupInstance = null;
|
|
6
|
+
|
|
7
|
+
const PopupSDK = {
|
|
8
|
+
showPopup: (content, onAction) => {
|
|
9
|
+
if (!popupInstance) {
|
|
10
|
+
popupInstance = document.createElement("div");
|
|
11
|
+
document.body.appendChild(popupInstance);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const PopupWrapper = () => {
|
|
15
|
+
const [open, setOpen] = useState(true);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<BookingPopup
|
|
20
|
+
{...content}
|
|
21
|
+
onClose={() => setOpen(false)}
|
|
22
|
+
open={open}
|
|
23
|
+
/>
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
ReactDOM.render(<PopupWrapper />, popupInstance);
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
closePopup: () => {
|
|
32
|
+
if (popupInstance) {
|
|
33
|
+
ReactDOM.unmountComponentAtNode(popupInstance);
|
|
34
|
+
popupInstance = null;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
window.PopupSDK = PopupSDK;
|
|
40
|
+
|
|
41
|
+
export default PopupSDK;
|
package/src/Example.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import BookingPopup from "./components/BookingPopup.js";
|
|
3
|
+
|
|
4
|
+
const Example = () => {
|
|
5
|
+
const [open, setOpen] = useState(true);
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<BookingPopup
|
|
9
|
+
color="#50B6AE"
|
|
10
|
+
onClose={() => setOpen(false)}
|
|
11
|
+
open={open}
|
|
12
|
+
hospitalId="dMtEGhak"
|
|
13
|
+
hospitalHdr="Web_Widget_BA_TVH"
|
|
14
|
+
isCorporate={false}
|
|
15
|
+
hospitalName="The View Hospital, Qatar"
|
|
16
|
+
tenantId="tvh_hospital_tennet"
|
|
17
|
+
tenantSecret="shdfhghfjsdfvb427653"
|
|
18
|
+
language="en"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default Example;
|