@vindhq/sloud-payment-sdk 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/README.md +398 -0
- package/dist/index.cjs.js +51442 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.esm.js +51440 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.umd.js +51448 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/react/index.esm.js +51440 -0
- package/dist/react/index.esm.js.map +1 -0
- package/dist/react/rollup.config.d.ts +8 -0
- package/dist/react/rollup.config.dts.d.ts +3 -0
- package/dist/react/src/components/Button/Button.types.d.ts +6 -0
- package/dist/react/src/components/Button/index.d.ts +3 -0
- package/dist/react/src/components/CopyToClipboardSpan/CopyToClipboard.types.d.ts +4 -0
- package/dist/react/src/components/CopyToClipboardSpan/index.d.ts +3 -0
- package/dist/react/src/components/Input/Input.types.d.ts +17 -0
- package/dist/react/src/components/Input/index.d.ts +3 -0
- package/dist/react/src/components/Skeleton/PaymentOptionSkeletons.d.ts +6 -0
- package/dist/react/src/components/TextArea/TextArea.types.d.ts +19 -0
- package/dist/react/src/components/TextArea/index.d.ts +3 -0
- package/dist/react/src/components/Widget.d.ts +6 -0
- package/dist/react/src/components/modals/AwaitingPaymentModal/AwaitingPaymentModal.d.ts +2 -0
- package/dist/react/src/components/modals/AwaitingPaymentTimeoutModal/AwaitingPaymentTimeoutModal.d.ts +2 -0
- package/dist/react/src/components/modals/Modal.d.ts +10 -0
- package/dist/react/src/components/modals/PaymentDetailsModal/PaymentDetailsModal.d.ts +2 -0
- package/dist/react/src/components/modals/PaymentDetailsModal/hooks/useTimer.d.ts +7 -0
- package/dist/react/src/components/modals/PaymentOptionsModal/PaymentOptionsModal.d.ts +2 -0
- package/dist/react/src/components/modals/PaymentOptionsModal/RadioButton.d.ts +11 -0
- package/dist/react/src/components/modals/PaymentOptionsModal/paymentOptionsMap.d.ts +5 -0
- package/dist/react/src/components/modals/SuccessModal/SuccessModal.d.ts +2 -0
- package/dist/react/src/components/modals/state/actions/data.d.ts +10 -0
- package/dist/react/src/components/modals/state/actions/index.d.ts +5 -0
- package/dist/react/src/components/modals/state/actions/modal.d.ts +5 -0
- package/dist/react/src/components/modals/state/actions/payment.d.ts +7 -0
- package/dist/react/src/components/modals/state/constants/actionTypes.d.ts +24 -0
- package/dist/react/src/components/modals/state/constants/index.d.ts +2 -0
- package/dist/react/src/components/modals/state/constants/initialState.d.ts +36 -0
- package/dist/react/src/components/modals/state/reducers/data.d.ts +2 -0
- package/dist/react/src/components/modals/state/reducers/index.d.ts +2 -0
- package/dist/react/src/components/modals/state/reducers/modal.d.ts +2 -0
- package/dist/react/src/components/modals/state/reducers/payment.d.ts +2 -0
- package/dist/react/src/components/modals/state/types/common.d.ts +12 -0
- package/dist/react/src/components/modals/state/types/data.d.ts +34 -0
- package/dist/react/src/components/modals/state/types/index.d.ts +8 -0
- package/dist/react/src/components/modals/state/types/modal.d.ts +12 -0
- package/dist/react/src/components/modals/state/types/payment.d.ts +14 -0
- package/dist/react/src/components/modals/state/utils/index.d.ts +37 -0
- package/dist/react/src/context/ModalProvider.d.ts +4 -0
- package/dist/react/src/context/PaymentInfoContext.d.ts +26 -0
- package/dist/react/src/context/PaymentWidgetContext.d.ts +13 -0
- package/dist/react/src/context/modal.d.ts +4 -0
- package/dist/react/src/context/types.d.ts +28 -0
- package/dist/react/src/hooks/types.d.ts +34 -0
- package/dist/react/src/hooks/useModalControl.d.ts +27 -0
- package/dist/react/src/hooks/usePaymentAPI.d.ts +10 -0
- package/dist/react/src/hooks/useShortPolling.d.ts +4 -0
- package/dist/react/src/index.d.ts +2 -0
- package/dist/react/src/services/config/endpoints.d.ts +9 -0
- package/dist/react/src/services/config/error.d.ts +5 -0
- package/dist/react/src/services/index.d.ts +27 -0
- package/dist/react/src/services/payments/index.d.ts +4 -0
- package/dist/react/src/services/payments/types.d.ts +68 -0
- package/dist/react/src/services/products/index.d.ts +1 -0
- package/dist/react/src/services/products/types.d.ts +124 -0
- package/dist/react/src/services/store/index.d.ts +2 -0
- package/dist/react/src/services/store/types.d.ts +57 -0
- package/dist/react/src/services/utils/widgetConfig.d.ts +20 -0
- package/dist/react/src/svg_components/ArrowLeftIcon.d.ts +3 -0
- package/dist/react/src/svg_components/BankTransferIcon.d.ts +2 -0
- package/dist/react/src/svg_components/CancelIcon.d.ts +7 -0
- package/dist/react/src/svg_components/CardIcon.d.ts +2 -0
- package/dist/react/src/svg_components/CloseIcon.d.ts +3 -0
- package/dist/react/src/svg_components/CopyIcon.d.ts +2 -0
- package/dist/react/src/svg_components/EyeCloseIcon.d.ts +5 -0
- package/dist/react/src/svg_components/EyeOpenIcon.d.ts +5 -0
- package/dist/react/src/svg_components/SloudIcon.d.ts +2 -0
- package/dist/react/src/utils/enums/AxiosErrorCodes.d.ts +7 -0
- package/dist/react/src/utils/enums/AxiosMethods.d.ts +7 -0
- package/dist/react/src/utils/helpers/classNames.d.ts +7 -0
- package/dist/react/src/utils/helpers/formatCurrency.d.ts +10 -0
- package/dist/react/src/utils/helpers/phoneDefaults.d.ts +3 -0
- package/dist/react/src/utils/helpers/validatePhone.d.ts +7 -0
- package/dist/react/src/utils/image_utils/index.d.ts +9 -0
- package/dist/react/src/utils/storage/index.d.ts +9 -0
- package/dist/react/src/widget.d.ts +27 -0
- package/dist/rollup.config.d.ts +8 -0
- package/dist/rollup.config.dts.d.ts +3 -0
- package/dist/src/components/Button/Button.types.d.ts +6 -0
- package/dist/src/components/Button/index.d.ts +3 -0
- package/dist/src/components/CopyToClipboardSpan/CopyToClipboard.types.d.ts +4 -0
- package/dist/src/components/CopyToClipboardSpan/index.d.ts +3 -0
- package/dist/src/components/Input/Input.types.d.ts +17 -0
- package/dist/src/components/Input/index.d.ts +3 -0
- package/dist/src/components/Skeleton/PaymentOptionSkeletons.d.ts +6 -0
- package/dist/src/components/TextArea/TextArea.types.d.ts +19 -0
- package/dist/src/components/TextArea/index.d.ts +3 -0
- package/dist/src/components/Widget.d.ts +6 -0
- package/dist/src/components/modals/AwaitingPaymentModal/AwaitingPaymentModal.d.ts +2 -0
- package/dist/src/components/modals/AwaitingPaymentTimeoutModal/AwaitingPaymentTimeoutModal.d.ts +2 -0
- package/dist/src/components/modals/Modal.d.ts +10 -0
- package/dist/src/components/modals/PaymentDetailsModal/PaymentDetailsModal.d.ts +2 -0
- package/dist/src/components/modals/PaymentDetailsModal/hooks/useTimer.d.ts +7 -0
- package/dist/src/components/modals/PaymentOptionsModal/PaymentOptionsModal.d.ts +2 -0
- package/dist/src/components/modals/PaymentOptionsModal/RadioButton.d.ts +11 -0
- package/dist/src/components/modals/PaymentOptionsModal/paymentOptionsMap.d.ts +5 -0
- package/dist/src/components/modals/SuccessModal/SuccessModal.d.ts +2 -0
- package/dist/src/components/modals/state/actions/data.d.ts +10 -0
- package/dist/src/components/modals/state/actions/index.d.ts +5 -0
- package/dist/src/components/modals/state/actions/modal.d.ts +5 -0
- package/dist/src/components/modals/state/actions/payment.d.ts +7 -0
- package/dist/src/components/modals/state/constants/actionTypes.d.ts +24 -0
- package/dist/src/components/modals/state/constants/index.d.ts +2 -0
- package/dist/src/components/modals/state/constants/initialState.d.ts +36 -0
- package/dist/src/components/modals/state/reducers/data.d.ts +2 -0
- package/dist/src/components/modals/state/reducers/index.d.ts +2 -0
- package/dist/src/components/modals/state/reducers/modal.d.ts +2 -0
- package/dist/src/components/modals/state/reducers/payment.d.ts +2 -0
- package/dist/src/components/modals/state/types/common.d.ts +12 -0
- package/dist/src/components/modals/state/types/data.d.ts +34 -0
- package/dist/src/components/modals/state/types/index.d.ts +8 -0
- package/dist/src/components/modals/state/types/modal.d.ts +12 -0
- package/dist/src/components/modals/state/types/payment.d.ts +14 -0
- package/dist/src/components/modals/state/utils/index.d.ts +37 -0
- package/dist/src/context/ModalProvider.d.ts +4 -0
- package/dist/src/context/PaymentInfoContext.d.ts +26 -0
- package/dist/src/context/PaymentWidgetContext.d.ts +13 -0
- package/dist/src/context/modal.d.ts +4 -0
- package/dist/src/context/types.d.ts +28 -0
- package/dist/src/hooks/types.d.ts +34 -0
- package/dist/src/hooks/useModalControl.d.ts +27 -0
- package/dist/src/hooks/usePaymentAPI.d.ts +10 -0
- package/dist/src/hooks/useShortPolling.d.ts +4 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/services/config/endpoints.d.ts +9 -0
- package/dist/src/services/config/error.d.ts +5 -0
- package/dist/src/services/index.d.ts +27 -0
- package/dist/src/services/payments/index.d.ts +4 -0
- package/dist/src/services/payments/types.d.ts +68 -0
- package/dist/src/services/products/index.d.ts +1 -0
- package/dist/src/services/products/types.d.ts +124 -0
- package/dist/src/services/store/index.d.ts +2 -0
- package/dist/src/services/store/types.d.ts +57 -0
- package/dist/src/services/utils/widgetConfig.d.ts +20 -0
- package/dist/src/svg_components/ArrowLeftIcon.d.ts +3 -0
- package/dist/src/svg_components/BankTransferIcon.d.ts +2 -0
- package/dist/src/svg_components/CancelIcon.d.ts +7 -0
- package/dist/src/svg_components/CardIcon.d.ts +2 -0
- package/dist/src/svg_components/CloseIcon.d.ts +3 -0
- package/dist/src/svg_components/CopyIcon.d.ts +2 -0
- package/dist/src/svg_components/EyeCloseIcon.d.ts +5 -0
- package/dist/src/svg_components/EyeOpenIcon.d.ts +5 -0
- package/dist/src/svg_components/SloudIcon.d.ts +2 -0
- package/dist/src/utils/enums/AxiosErrorCodes.d.ts +7 -0
- package/dist/src/utils/enums/AxiosMethods.d.ts +7 -0
- package/dist/src/utils/helpers/classNames.d.ts +7 -0
- package/dist/src/utils/helpers/formatCurrency.d.ts +10 -0
- package/dist/src/utils/helpers/phoneDefaults.d.ts +3 -0
- package/dist/src/utils/helpers/validatePhone.d.ts +7 -0
- package/dist/src/utils/image_utils/index.d.ts +9 -0
- package/dist/src/utils/storage/index.d.ts +9 -0
- package/dist/src/widget.d.ts +27 -0
- package/package.json +87 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility function to get the current base URL based on widget configuration
|
|
3
|
+
* @returns The appropriate base URL for API calls
|
|
4
|
+
*/
|
|
5
|
+
export declare const getBaseURL: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* Utility function to check if widget is in local environment
|
|
8
|
+
* @returns boolean indicating if widget is in local environment
|
|
9
|
+
*/
|
|
10
|
+
export declare const isLocalEnvironment: () => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Utility function to get widget configuration
|
|
13
|
+
* @returns Current widget options or null if not set
|
|
14
|
+
*/
|
|
15
|
+
export declare const getWidgetConfiguration: () => import("../index").WidgetOptions;
|
|
16
|
+
/**
|
|
17
|
+
* Debug utility to log current widget options state
|
|
18
|
+
* @returns void
|
|
19
|
+
*/
|
|
20
|
+
export declare const debugWidgetOptions: () => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conditionally combines class names from an object.
|
|
3
|
+
* @param classes - An object where keys are class names and values are booleans.
|
|
4
|
+
* @returns A space-separated string of class names.
|
|
5
|
+
*/
|
|
6
|
+
declare const classNames: (classes: Record<string, boolean>) => string;
|
|
7
|
+
export default classNames;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a numeric value into Nigerian Naira currency format.
|
|
3
|
+
*
|
|
4
|
+
* @param value - The amount to format (number or numeric string).
|
|
5
|
+
* @param currencyCode - Optional ISO 4217 currency code (default: 'NGN').
|
|
6
|
+
* @param locale - Optional BCP 47 locale string (default: 'en-NG').
|
|
7
|
+
* @returns A currency-formatted string, e.g. ₦12,500.00
|
|
8
|
+
*/
|
|
9
|
+
declare const formatCurrency: (value?: number | string, currencyCode?: string, locale?: string, showDecimals?: boolean) => string;
|
|
10
|
+
export default formatCurrency;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface PaymentWidgetOptions {
|
|
2
|
+
public_key: string;
|
|
3
|
+
isLocalEnv?: boolean;
|
|
4
|
+
amount: number;
|
|
5
|
+
first_name: string;
|
|
6
|
+
last_name: string;
|
|
7
|
+
phone_number: string;
|
|
8
|
+
email: string;
|
|
9
|
+
}
|
|
10
|
+
export default class PaymentWidget {
|
|
11
|
+
private options;
|
|
12
|
+
private container;
|
|
13
|
+
private root;
|
|
14
|
+
constructor(options: PaymentWidgetOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Creates the container div if it doesn’t exist.
|
|
17
|
+
*/
|
|
18
|
+
private ensureContainer;
|
|
19
|
+
/**
|
|
20
|
+
* Renders the widget popup.
|
|
21
|
+
*/
|
|
22
|
+
showPopup(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Optionally allow hiding/unmounting the widget.
|
|
25
|
+
*/
|
|
26
|
+
hidePopup(): void;
|
|
27
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vindhq/sloud-payment-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A custom payment SDK for seamless payment processing integration",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.cjs.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.esm.js",
|
|
15
|
+
"require": "./dist/index.cjs.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"payment",
|
|
24
|
+
"payment-sdk",
|
|
25
|
+
"payment-gateway",
|
|
26
|
+
"payment-widget",
|
|
27
|
+
"react",
|
|
28
|
+
"payment-processing",
|
|
29
|
+
"checkout",
|
|
30
|
+
"payment-form",
|
|
31
|
+
"sloud",
|
|
32
|
+
"payment-integration",
|
|
33
|
+
"fintech"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"prebuild": "rm -rf dist",
|
|
37
|
+
"build": "rollup --config rollup.config.ts --configPlugin typescript && rollup --config rollup.config.dts.ts --configPlugin typescript && npm run postbuild",
|
|
38
|
+
"postbuild": "rm -rf dist/rollup.config.d.ts dist/rollup.config.dts.d.ts dist/src",
|
|
39
|
+
"dev": "rollup --config rollup.config.ts --configPlugin typescript -w"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/vindhq/Payment-Widget.git"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/vindhq/Payment-Widget/issues"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
50
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
54
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
55
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
56
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
57
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
58
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
59
|
+
"@rollup/plugin-typescript": "^11.1.2",
|
|
60
|
+
"@rollup/plugin-url": "^8.0.1",
|
|
61
|
+
"@types/node": "^24.5.2",
|
|
62
|
+
"@types/react": "^18.2.0",
|
|
63
|
+
"@types/react-dom": "^18.2.0",
|
|
64
|
+
"@types/yup": "^0.32.0",
|
|
65
|
+
"postcss": "^8.5.6",
|
|
66
|
+
"rollup": "^4.5.0",
|
|
67
|
+
"rollup-plugin-dts": "^6.2.3",
|
|
68
|
+
"rollup-plugin-livereload": "^2.0.5",
|
|
69
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
70
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
71
|
+
"rollup-plugin-serve": "^3.0.0",
|
|
72
|
+
"rollup-plugin-visualizer": "^6.0.5",
|
|
73
|
+
"sass": "^1.69.5",
|
|
74
|
+
"ts-node": "^10.9.2",
|
|
75
|
+
"tslib": "^2.8.1",
|
|
76
|
+
"typescript": "^5.2.2"
|
|
77
|
+
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"axios": "^1.12.2",
|
|
80
|
+
"formik": "^2.4.6",
|
|
81
|
+
"libphonenumber-js": "^1.12.23",
|
|
82
|
+
"react-hot-toast": "^2.6.0",
|
|
83
|
+
"react-loading-skeleton": "^3.5.0",
|
|
84
|
+
"react-phone-number-input": "^3.4.12",
|
|
85
|
+
"yup": "^1.7.1"
|
|
86
|
+
}
|
|
87
|
+
}
|