@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,68 @@
|
|
|
1
|
+
import { PaymentStatus } from "../../hooks/types";
|
|
2
|
+
import { BaseAPIResponse } from "../config/endpoints";
|
|
3
|
+
export interface IGetPaymentMethodsResponse extends BaseAPIResponse {
|
|
4
|
+
data: {
|
|
5
|
+
bank_transfer: boolean;
|
|
6
|
+
sloud_wallet: boolean;
|
|
7
|
+
card: boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface IPaymentStatusRequest {
|
|
11
|
+
path: {
|
|
12
|
+
id: string;
|
|
13
|
+
reference: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface IGetProductsResponse {
|
|
17
|
+
status: string;
|
|
18
|
+
message: string;
|
|
19
|
+
data: {
|
|
20
|
+
status: PaymentStatus;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface IGeneratePaymentInstrumentPayload {
|
|
24
|
+
amount: number;
|
|
25
|
+
customer: {
|
|
26
|
+
first_name: string;
|
|
27
|
+
last_name: string;
|
|
28
|
+
phone_number: string;
|
|
29
|
+
email: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface IPaymentInstrumentResponse extends BaseAPIResponse {
|
|
33
|
+
data: {
|
|
34
|
+
reference: string;
|
|
35
|
+
account_name: string;
|
|
36
|
+
account_number: string;
|
|
37
|
+
bank: string;
|
|
38
|
+
expiry: string;
|
|
39
|
+
amount: number;
|
|
40
|
+
charge: number;
|
|
41
|
+
currency: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface IPaymentStatusResponse extends BaseAPIResponse {
|
|
45
|
+
data: {
|
|
46
|
+
reference: string;
|
|
47
|
+
status: string;
|
|
48
|
+
amount: number;
|
|
49
|
+
currency: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface IGetChargePayload {
|
|
54
|
+
amount: number;
|
|
55
|
+
}
|
|
56
|
+
export interface IGetChargeRequest {
|
|
57
|
+
path: {
|
|
58
|
+
slug: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface IGetChargeResponse {
|
|
62
|
+
status: string;
|
|
63
|
+
message: string;
|
|
64
|
+
data: {
|
|
65
|
+
charge: number;
|
|
66
|
+
total_amount: number;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export interface IGetProductsResponse {
|
|
2
|
+
status: string;
|
|
3
|
+
message: string;
|
|
4
|
+
data: IProduct[];
|
|
5
|
+
metadata: IMetadata;
|
|
6
|
+
}
|
|
7
|
+
export interface IProductDetail {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
price: number;
|
|
12
|
+
currency: string;
|
|
13
|
+
image_url: string[];
|
|
14
|
+
variation: Record<string, string[]>;
|
|
15
|
+
discount: number;
|
|
16
|
+
discounted_amount: number;
|
|
17
|
+
availability: string;
|
|
18
|
+
in_stock: number;
|
|
19
|
+
}
|
|
20
|
+
export interface IGetProductResponse {
|
|
21
|
+
status: string;
|
|
22
|
+
message: string;
|
|
23
|
+
data: IProductDetail;
|
|
24
|
+
}
|
|
25
|
+
export interface IPaymentDetails {
|
|
26
|
+
reference?: string;
|
|
27
|
+
account_name?: string;
|
|
28
|
+
account_number?: string;
|
|
29
|
+
bank?: string;
|
|
30
|
+
expiry?: string;
|
|
31
|
+
amount?: number;
|
|
32
|
+
currency?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface IOrderProductResponseData {
|
|
35
|
+
payment_details: IPaymentDetails;
|
|
36
|
+
}
|
|
37
|
+
export interface IOrderProductResponse {
|
|
38
|
+
status: string;
|
|
39
|
+
message: string;
|
|
40
|
+
data: IOrderProductResponseData;
|
|
41
|
+
}
|
|
42
|
+
export interface IMetadata {
|
|
43
|
+
cursor: string;
|
|
44
|
+
beforeCursor: string;
|
|
45
|
+
totalCount: number;
|
|
46
|
+
pageSize: number;
|
|
47
|
+
}
|
|
48
|
+
export interface IProduct {
|
|
49
|
+
id: number;
|
|
50
|
+
name: string;
|
|
51
|
+
category: string;
|
|
52
|
+
amount: number;
|
|
53
|
+
currency: string;
|
|
54
|
+
in_stock: number;
|
|
55
|
+
availability: number;
|
|
56
|
+
image_url: string[];
|
|
57
|
+
discounted_amount: number;
|
|
58
|
+
}
|
|
59
|
+
export interface IGetProductsRequest {
|
|
60
|
+
path: {
|
|
61
|
+
id: string;
|
|
62
|
+
collectionId: string | null;
|
|
63
|
+
};
|
|
64
|
+
params: {
|
|
65
|
+
name: string;
|
|
66
|
+
pageSize: number;
|
|
67
|
+
pageNumber: number;
|
|
68
|
+
cursor?: number;
|
|
69
|
+
beforeCursor?: number;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export interface IGetProductRequest {
|
|
73
|
+
path: {
|
|
74
|
+
productId: string;
|
|
75
|
+
storeId: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface IOrderProductRequest {
|
|
79
|
+
path: {
|
|
80
|
+
slug: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface IBuyerDetails {
|
|
84
|
+
first_name: string;
|
|
85
|
+
last_name: string;
|
|
86
|
+
email: string;
|
|
87
|
+
phone_number: string;
|
|
88
|
+
}
|
|
89
|
+
export interface IDeliveryDetails {
|
|
90
|
+
street: string;
|
|
91
|
+
country: string;
|
|
92
|
+
state: string;
|
|
93
|
+
city: string;
|
|
94
|
+
note: string;
|
|
95
|
+
}
|
|
96
|
+
export interface IItem {
|
|
97
|
+
product_id: string;
|
|
98
|
+
discount: number;
|
|
99
|
+
variation: string[];
|
|
100
|
+
quantity: number;
|
|
101
|
+
}
|
|
102
|
+
export interface IOrderProductRequestPayload {
|
|
103
|
+
discount: number;
|
|
104
|
+
additional_amount: number;
|
|
105
|
+
payment_method: string;
|
|
106
|
+
buyer_details: IBuyerDetails;
|
|
107
|
+
channel: 'pickup' | 'delivery';
|
|
108
|
+
delivery_details: IDeliveryDetails;
|
|
109
|
+
items: IItem[];
|
|
110
|
+
}
|
|
111
|
+
export interface IGetProductAvailabilityRequest {
|
|
112
|
+
path: {
|
|
113
|
+
slug: string;
|
|
114
|
+
productId: string;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export interface IGetProductAvailabilityResponse {
|
|
118
|
+
status: string;
|
|
119
|
+
message: string;
|
|
120
|
+
data: {
|
|
121
|
+
is_available: boolean;
|
|
122
|
+
quantity: number;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface IGetStorePath {
|
|
2
|
+
slug: string;
|
|
3
|
+
}
|
|
4
|
+
export interface IGetStoreResponse {
|
|
5
|
+
status: string;
|
|
6
|
+
message: string;
|
|
7
|
+
data: IGetStoreData;
|
|
8
|
+
}
|
|
9
|
+
export type SocialMediaPlatformTypes = 'Whatsapp' | 'Facebook' | 'Instagram' | 'TikTok' | 'X';
|
|
10
|
+
export interface IGetStoreData {
|
|
11
|
+
id: string;
|
|
12
|
+
banner_url: string;
|
|
13
|
+
avatar_url: string;
|
|
14
|
+
maintenance_mode: boolean;
|
|
15
|
+
preferences?: {
|
|
16
|
+
mode_of_delivery: 'Pickup' | 'Delivery' | 'Delivery/Pickup';
|
|
17
|
+
mode_of_transaction_charge: 'Customer' | 'Merchant';
|
|
18
|
+
};
|
|
19
|
+
social_media: {
|
|
20
|
+
platform: SocialMediaPlatformTypes;
|
|
21
|
+
url: string;
|
|
22
|
+
}[];
|
|
23
|
+
delivery_areas: {
|
|
24
|
+
location: string;
|
|
25
|
+
amount: number;
|
|
26
|
+
}[];
|
|
27
|
+
phone_number: string;
|
|
28
|
+
collections: Collection[];
|
|
29
|
+
best_sellers: Bestseller[];
|
|
30
|
+
metadata: Metadata;
|
|
31
|
+
}
|
|
32
|
+
export interface Metadata {
|
|
33
|
+
description: string;
|
|
34
|
+
author: string;
|
|
35
|
+
store_slug: string;
|
|
36
|
+
address: string;
|
|
37
|
+
business_name: string;
|
|
38
|
+
}
|
|
39
|
+
export interface Bestseller {
|
|
40
|
+
id: number;
|
|
41
|
+
product: string;
|
|
42
|
+
category: string;
|
|
43
|
+
amount: number;
|
|
44
|
+
currency: string;
|
|
45
|
+
in_stock: number;
|
|
46
|
+
availability: number;
|
|
47
|
+
keywords: string[];
|
|
48
|
+
image_url: string[];
|
|
49
|
+
name: string;
|
|
50
|
+
discounted_amount: number;
|
|
51
|
+
}
|
|
52
|
+
export interface Collection {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
description: string;
|
|
56
|
+
cover_image_url: string[];
|
|
57
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RollupOptions } from "rollup";
|
|
2
|
+
/**
|
|
3
|
+
* Rollup configuration for bundling the PaymentWidget project.
|
|
4
|
+
* Supports TypeScript, PostCSS, asset imports, and generates
|
|
5
|
+
* ESM, CJS, and UMD bundles with sourcemaps.
|
|
6
|
+
*/
|
|
7
|
+
declare const config: RollupOptions;
|
|
8
|
+
export default config;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ChangeEvent, type FocusEvent, type HTMLProps } from 'react';
|
|
2
|
+
export interface IInput extends HTMLProps<HTMLInputElement> {
|
|
3
|
+
error?: string | boolean;
|
|
4
|
+
label: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
9
|
+
onDelete?: () => void;
|
|
10
|
+
type?: string;
|
|
11
|
+
value?: string | number;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
autoComplete?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
inputClass?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "react-loading-skeleton/dist/skeleton.css";
|
|
2
|
+
interface PaymentOptionsSkeletonProps {
|
|
3
|
+
numberOfSkeletons?: number;
|
|
4
|
+
}
|
|
5
|
+
declare const PaymentOptionsSkeleton: ({ numberOfSkeletons, }: PaymentOptionsSkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default PaymentOptionsSkeleton;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ChangeEvent, type FocusEvent, type HTMLProps } from 'react';
|
|
2
|
+
export interface ITextArea extends HTMLProps<HTMLTextAreaElement> {
|
|
3
|
+
error?: string | boolean;
|
|
4
|
+
label: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
onChange?: (e: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
8
|
+
onFocus?: (e: FocusEvent<HTMLTextAreaElement>) => void;
|
|
9
|
+
onDelete?: () => void;
|
|
10
|
+
value?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
autoComplete?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
inputClass?: string;
|
|
16
|
+
rows?: number;
|
|
17
|
+
cols?: number;
|
|
18
|
+
showCancelIcon?: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ITextArea } from "./TextArea.types";
|
|
2
|
+
declare const TextArea: ({ error, name, onChange, onFocus, onDelete, label, placeholder, value, disabled, autoComplete, title, required, inputClass, rows, cols, showCancelIcon, }: ITextArea) => JSX.Element;
|
|
3
|
+
export default TextArea;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ModalProps {
|
|
3
|
+
title: string;
|
|
4
|
+
children: React.JSX.Element;
|
|
5
|
+
isControllable?: boolean;
|
|
6
|
+
isOpen?: boolean;
|
|
7
|
+
isCentralizedHeader?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const Modal: ({ title, children, isControllable, isOpen, isCentralizedHeader, }: ModalProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export default Modal;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const RadioButton: ({ label, name, value, id, disabled, onChange, checked, }: {
|
|
3
|
+
label: string;
|
|
4
|
+
name: string;
|
|
5
|
+
value: string;
|
|
6
|
+
id: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default RadioButton;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ProductItem } from '../../../../hooks/types';
|
|
2
|
+
import { IGetStoreData } from '../../../../services';
|
|
3
|
+
import { DeliveryDetails, EditItemAction, RemoveItemAction, ResetDataAction, SetDataAction, SetDeliveryDetailsAction, SetLoadingAction, SetStoreAction } from '../types';
|
|
4
|
+
export declare const setData: (data: ProductItem[]) => SetDataAction;
|
|
5
|
+
export declare const setStore: (store: IGetStoreData) => SetStoreAction;
|
|
6
|
+
export declare const setLoading: (isLoading: boolean) => SetLoadingAction;
|
|
7
|
+
export declare const setDeliveryDetails: (details: Partial<DeliveryDetails>) => SetDeliveryDetailsAction;
|
|
8
|
+
export declare const editItemQuantity: (index: number, quantity?: number) => EditItemAction;
|
|
9
|
+
export declare const removeItem: (index: number) => RemoveItemAction;
|
|
10
|
+
export declare const resetData: () => ResetDataAction;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ResetModalAction, SetAboutModalAction, SetCurrentIndexAction, SetOpenAction } from '../types';
|
|
2
|
+
export declare const setOpen: (isOpen: boolean) => SetOpenAction;
|
|
3
|
+
export declare const setCurrentIndex: (index: number) => SetCurrentIndexAction;
|
|
4
|
+
export declare const setAboutModal: (isOpen: boolean) => SetAboutModalAction;
|
|
5
|
+
export declare const resetModal: () => ResetModalAction;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PaymentStatus } from "../../../../hooks/types";
|
|
2
|
+
import { IPaymentDetails } from "../../../../services/products/types";
|
|
3
|
+
import { ResetPaymentAction, SetAdditionalAmountAction, SetPaymentDetailsAction, SetPaymentStatusAction } from "../types";
|
|
4
|
+
export declare const setPaymentStatus: (status: PaymentStatus) => SetPaymentStatusAction;
|
|
5
|
+
export declare const setPaymentDetails: (details: IPaymentDetails) => SetPaymentDetailsAction;
|
|
6
|
+
export declare const setAdditionalAmount: (amount: number) => SetAdditionalAmountAction;
|
|
7
|
+
export declare const resetPayment: () => ResetPaymentAction;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const PAYMENT_ACTIONS: {
|
|
2
|
+
readonly SET_PAYMENT_STATUS: "SET_PAYMENT_STATUS";
|
|
3
|
+
readonly SET_PAYMENT_DETAILS: "SET_PAYMENT_DETAILS";
|
|
4
|
+
readonly SET_ADDITIONAL_AMOUNT: "SET_ADDITIONAL_AMOUNT";
|
|
5
|
+
readonly RESET_PAYMENT: "RESET_PAYMENT";
|
|
6
|
+
};
|
|
7
|
+
export declare const MODAL_ACTIONS: {
|
|
8
|
+
readonly SET_OPEN: "SET_OPEN";
|
|
9
|
+
readonly SET_CURRENT_INDEX: "SET_CURRENT_INDEX";
|
|
10
|
+
readonly SET_ABOUT_MODAL: "SET_ABOUT_MODAL";
|
|
11
|
+
readonly RESET_MODAL: "RESET_MODAL";
|
|
12
|
+
};
|
|
13
|
+
export declare const DATA_ACTIONS: {
|
|
14
|
+
readonly SET_DATA: "SET_DATA";
|
|
15
|
+
readonly SET_STORE: "SET_STORE";
|
|
16
|
+
readonly SET_LOADING: "SET_LOADING";
|
|
17
|
+
readonly SET_DELIVERY_DETAILS: "SET_DELIVERY_DETAILS";
|
|
18
|
+
readonly EDIT_ITEM: "EDIT_ITEM";
|
|
19
|
+
readonly REMOVE_ITEM: "REMOVE_ITEM";
|
|
20
|
+
readonly RESET_DATA: "RESET_DATA";
|
|
21
|
+
};
|
|
22
|
+
export declare const GLOBAL_ACTIONS: {
|
|
23
|
+
readonly RESET_ALL: "RESET_ALL";
|
|
24
|
+
};
|