@medipass/checkout-sdk 2.1.0 → 3.0.0-alpha.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/.eslintrc +40 -0
- package/CONTRIBUTING.md +21 -0
- package/{lib/style.css → dist/cjs/assets/index-e17dd0fd.css} +1 -1
- package/dist/cjs/constants.d.ts +27 -0
- package/dist/cjs/index.d.ts +32 -0
- package/dist/cjs/index.js +9 -0
- package/dist/cjs/initialiseWindow.d.ts +4 -0
- package/dist/cjs/overlay.d.ts +21 -0
- package/dist/cjs/requestUpdatePaymentDetails.d.ts +21 -0
- package/dist/cjs/updatePaymentOverlay.d.ts +21 -0
- package/dist/cjs/utils/object-to-css.d.ts +2 -0
- package/dist/esm/assets/index-e17dd0fd.css +1 -0
- package/dist/esm/constants.d.ts +27 -0
- package/dist/esm/index.d.ts +32 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/initialiseWindow.d.ts +4 -0
- package/dist/esm/overlay.d.ts +21 -0
- package/dist/esm/requestUpdatePaymentDetails.d.ts +21 -0
- package/dist/esm/updatePaymentOverlay.d.ts +21 -0
- package/dist/esm/utils/object-to-css.d.ts +2 -0
- package/dist/umd/assets/index.min-e17dd0fd.css +1 -0
- package/dist/umd/constants.d.ts +27 -0
- package/dist/umd/index.d.ts +32 -0
- package/dist/umd/index.min.js +17 -0
- package/dist/umd/initialiseWindow.d.ts +4 -0
- package/dist/umd/overlay.d.ts +21 -0
- package/dist/umd/requestUpdatePaymentDetails.d.ts +21 -0
- package/dist/umd/updatePaymentOverlay.d.ts +21 -0
- package/dist/umd/utils/object-to-css.d.ts +2 -0
- package/package.json +33 -15
- package/rollup.config.mjs +35 -0
- package/src/constants.ts +31 -0
- package/src/index.ts +244 -0
- package/src/initialiseWindow.ts +46 -0
- package/src/overlay.ts +272 -0
- package/src/requestUpdatePaymentDetails.ts +190 -0
- package/{es → src}/style.css +1 -1
- package/src/updatePaymentOverlay.ts +247 -0
- package/{es/utils/object-to-css.js → src/utils/object-to-css.ts} +4 -2
- package/tsconfig.json +32 -0
- package/es/constants.js +0 -23
- package/es/index.js +0 -264
- package/es/initialiseWindow.js +0 -34
- package/es/overlay.js +0 -184
- package/es/requestUpdatePaymentDetails.js +0 -232
- package/es/updatePaymentOverlay.js +0 -184
- package/lib/constants.js +0 -33
- package/lib/index.js +0 -280
- package/lib/initialiseWindow.js +0 -42
- package/lib/overlay.js +0 -196
- package/lib/requestUpdatePaymentDetails.js +0 -244
- package/lib/updatePaymentOverlay.js +0 -196
- package/lib/utils/object-to-css.js +0 -11
- package/umd/checkout-sdk.js +0 -50414
- package/umd/checkout-sdk.min.js +0 -31
- package/umd/checkout-sdk.min.js.map +0 -1
- package/umd/main.3a4213e0.css +0 -2
- package/umd/main.3a4213e0.css.map +0 -1
package/.eslintrc
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"commonjs": true,
|
|
5
|
+
"es6": true
|
|
6
|
+
},
|
|
7
|
+
"extends": [
|
|
8
|
+
"eslint:recommended",
|
|
9
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
10
|
+
"plugin:react/recommended",
|
|
11
|
+
"prettier"
|
|
12
|
+
],
|
|
13
|
+
"plugins": ["prettier"],
|
|
14
|
+
"parser": "@typescript-eslint/parser",
|
|
15
|
+
"parserOptions": {
|
|
16
|
+
"ecmaVersion": 9,
|
|
17
|
+
"sourceType": "module"
|
|
18
|
+
},
|
|
19
|
+
"ignorePatterns": ["**/dist"],
|
|
20
|
+
"rules": {
|
|
21
|
+
"indent": ["error", 2],
|
|
22
|
+
"linebreak-style": ["error", "unix"],
|
|
23
|
+
"semi": ["error", "always"],
|
|
24
|
+
"react/react-in-jsx-scope": "off",
|
|
25
|
+
"react/no-unknown-property": "off",
|
|
26
|
+
"react/prop-types": "off",
|
|
27
|
+
"no-unused-vars": "off",
|
|
28
|
+
"prettier/prettier": [
|
|
29
|
+
"error",
|
|
30
|
+
{
|
|
31
|
+
"bracketSpacing": true,
|
|
32
|
+
"bracketSameLine": false,
|
|
33
|
+
"printWidth": 120,
|
|
34
|
+
"singleQuote": true,
|
|
35
|
+
"trailingComma": "all",
|
|
36
|
+
"arrowParens": "avoid"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
## Prerequisites
|
|
2
|
+
|
|
3
|
+
[Node.js](http://nodejs.org/) >= 10 must be installed.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
- Running `yarn install` in the module's root directory will install everything you need for development.
|
|
8
|
+
|
|
9
|
+
## Running Tests
|
|
10
|
+
|
|
11
|
+
- `yarn test` will run the tests once.
|
|
12
|
+
|
|
13
|
+
- `yarn test:coverage` will run the tests and produce a coverage report in `coverage/`.
|
|
14
|
+
|
|
15
|
+
- `yarn test:watch` will run the tests on every change.
|
|
16
|
+
|
|
17
|
+
## Building
|
|
18
|
+
|
|
19
|
+
- `yarn build` will build the module for publishing to npm.
|
|
20
|
+
|
|
21
|
+
- `yarn clean` will delete built resources.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import url("https://fonts.googleapis.com/css?family=Lato:400,700");
|
|
1
|
+
@import url("https://fonts.googleapis.com/css?family=Lato:400,700");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const ENVS: {
|
|
2
|
+
readonly LOCAL: "local";
|
|
3
|
+
readonly DEV: "dev";
|
|
4
|
+
readonly STG: "stg";
|
|
5
|
+
readonly PROD_BLUE: "prod-blue";
|
|
6
|
+
readonly PROD: "prod";
|
|
7
|
+
};
|
|
8
|
+
export declare const ORIGINS: {
|
|
9
|
+
readonly local: "http://localhost:3001";
|
|
10
|
+
readonly dev: "https://dev-my.medipass.io";
|
|
11
|
+
readonly stg: "https://stg-my.medipass.io";
|
|
12
|
+
readonly "prod-blue": "https://my-blue.medipass.io";
|
|
13
|
+
readonly prod: "https://my.medipass.io";
|
|
14
|
+
};
|
|
15
|
+
export declare const EVENTS: {
|
|
16
|
+
readonly SUCCESS: "success";
|
|
17
|
+
readonly fAILURE: "failure";
|
|
18
|
+
readonly CANCEL: "cancel";
|
|
19
|
+
};
|
|
20
|
+
export declare const ERROR_MESSAGES: {
|
|
21
|
+
readonly NO_API_KEY_OR_NO_TOKEN: "apiKey or token is not provided";
|
|
22
|
+
readonly NO_PATIENT_REF_ID: "patientRefId is not provided";
|
|
23
|
+
readonly NO_ENVIROMENT_SET: "environment must be set";
|
|
24
|
+
readonly NO_CALLBACK_ORIGIN: "callbackOrigin must be set";
|
|
25
|
+
readonly GENERAL_ERROR: "Please ensure that all required values are passed";
|
|
26
|
+
};
|
|
27
|
+
export declare const ROOT_ELEMENT_ID: "medipass-checkout-sdk-root";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ENVS } from './constants';
|
|
2
|
+
import './style.css';
|
|
3
|
+
import { UpdatePaymentDetails } from './requestUpdatePaymentDetails';
|
|
4
|
+
interface CheckoutSdk {
|
|
5
|
+
ENVS: typeof ENVS;
|
|
6
|
+
isCheckoutInitiated: boolean;
|
|
7
|
+
isCheckoutComplete: boolean | null;
|
|
8
|
+
env: typeof ENVS[keyof typeof ENVS] | null;
|
|
9
|
+
onSuccess: ((args: {
|
|
10
|
+
transactionId: string;
|
|
11
|
+
}) => void) | null;
|
|
12
|
+
onFailure: ((args: {
|
|
13
|
+
transactionId: string;
|
|
14
|
+
}) => void) | null;
|
|
15
|
+
onCancel: ((args: {
|
|
16
|
+
transactionId: string;
|
|
17
|
+
}) => void) | null;
|
|
18
|
+
onClose: (() => void) | null;
|
|
19
|
+
init: (args: {
|
|
20
|
+
env: typeof ENVS[keyof typeof ENVS];
|
|
21
|
+
onSuccess: () => void;
|
|
22
|
+
onFailure: () => void;
|
|
23
|
+
onCancel: () => void;
|
|
24
|
+
onClose: () => void;
|
|
25
|
+
}) => void;
|
|
26
|
+
createCheckout: (args: {
|
|
27
|
+
paymentRequestUrl: string;
|
|
28
|
+
}) => void;
|
|
29
|
+
requestUpdatePaymentDetails: (args: UpdatePaymentDetails) => void;
|
|
30
|
+
}
|
|
31
|
+
declare const checkoutSDK: CheckoutSdk;
|
|
32
|
+
export default checkoutSDK;
|