@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.
Files changed (163) hide show
  1. package/README.md +398 -0
  2. package/dist/index.cjs.js +51442 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.d.ts +29 -0
  5. package/dist/index.esm.js +51440 -0
  6. package/dist/index.esm.js.map +1 -0
  7. package/dist/index.umd.js +51448 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/react/index.esm.js +51440 -0
  10. package/dist/react/index.esm.js.map +1 -0
  11. package/dist/react/rollup.config.d.ts +8 -0
  12. package/dist/react/rollup.config.dts.d.ts +3 -0
  13. package/dist/react/src/components/Button/Button.types.d.ts +6 -0
  14. package/dist/react/src/components/Button/index.d.ts +3 -0
  15. package/dist/react/src/components/CopyToClipboardSpan/CopyToClipboard.types.d.ts +4 -0
  16. package/dist/react/src/components/CopyToClipboardSpan/index.d.ts +3 -0
  17. package/dist/react/src/components/Input/Input.types.d.ts +17 -0
  18. package/dist/react/src/components/Input/index.d.ts +3 -0
  19. package/dist/react/src/components/Skeleton/PaymentOptionSkeletons.d.ts +6 -0
  20. package/dist/react/src/components/TextArea/TextArea.types.d.ts +19 -0
  21. package/dist/react/src/components/TextArea/index.d.ts +3 -0
  22. package/dist/react/src/components/Widget.d.ts +6 -0
  23. package/dist/react/src/components/modals/AwaitingPaymentModal/AwaitingPaymentModal.d.ts +2 -0
  24. package/dist/react/src/components/modals/AwaitingPaymentTimeoutModal/AwaitingPaymentTimeoutModal.d.ts +2 -0
  25. package/dist/react/src/components/modals/Modal.d.ts +10 -0
  26. package/dist/react/src/components/modals/PaymentDetailsModal/PaymentDetailsModal.d.ts +2 -0
  27. package/dist/react/src/components/modals/PaymentDetailsModal/hooks/useTimer.d.ts +7 -0
  28. package/dist/react/src/components/modals/PaymentOptionsModal/PaymentOptionsModal.d.ts +2 -0
  29. package/dist/react/src/components/modals/PaymentOptionsModal/RadioButton.d.ts +11 -0
  30. package/dist/react/src/components/modals/PaymentOptionsModal/paymentOptionsMap.d.ts +5 -0
  31. package/dist/react/src/components/modals/SuccessModal/SuccessModal.d.ts +2 -0
  32. package/dist/react/src/components/modals/state/actions/data.d.ts +10 -0
  33. package/dist/react/src/components/modals/state/actions/index.d.ts +5 -0
  34. package/dist/react/src/components/modals/state/actions/modal.d.ts +5 -0
  35. package/dist/react/src/components/modals/state/actions/payment.d.ts +7 -0
  36. package/dist/react/src/components/modals/state/constants/actionTypes.d.ts +24 -0
  37. package/dist/react/src/components/modals/state/constants/index.d.ts +2 -0
  38. package/dist/react/src/components/modals/state/constants/initialState.d.ts +36 -0
  39. package/dist/react/src/components/modals/state/reducers/data.d.ts +2 -0
  40. package/dist/react/src/components/modals/state/reducers/index.d.ts +2 -0
  41. package/dist/react/src/components/modals/state/reducers/modal.d.ts +2 -0
  42. package/dist/react/src/components/modals/state/reducers/payment.d.ts +2 -0
  43. package/dist/react/src/components/modals/state/types/common.d.ts +12 -0
  44. package/dist/react/src/components/modals/state/types/data.d.ts +34 -0
  45. package/dist/react/src/components/modals/state/types/index.d.ts +8 -0
  46. package/dist/react/src/components/modals/state/types/modal.d.ts +12 -0
  47. package/dist/react/src/components/modals/state/types/payment.d.ts +14 -0
  48. package/dist/react/src/components/modals/state/utils/index.d.ts +37 -0
  49. package/dist/react/src/context/ModalProvider.d.ts +4 -0
  50. package/dist/react/src/context/PaymentInfoContext.d.ts +26 -0
  51. package/dist/react/src/context/PaymentWidgetContext.d.ts +13 -0
  52. package/dist/react/src/context/modal.d.ts +4 -0
  53. package/dist/react/src/context/types.d.ts +28 -0
  54. package/dist/react/src/hooks/types.d.ts +34 -0
  55. package/dist/react/src/hooks/useModalControl.d.ts +27 -0
  56. package/dist/react/src/hooks/usePaymentAPI.d.ts +10 -0
  57. package/dist/react/src/hooks/useShortPolling.d.ts +4 -0
  58. package/dist/react/src/index.d.ts +2 -0
  59. package/dist/react/src/services/config/endpoints.d.ts +9 -0
  60. package/dist/react/src/services/config/error.d.ts +5 -0
  61. package/dist/react/src/services/index.d.ts +27 -0
  62. package/dist/react/src/services/payments/index.d.ts +4 -0
  63. package/dist/react/src/services/payments/types.d.ts +68 -0
  64. package/dist/react/src/services/products/index.d.ts +1 -0
  65. package/dist/react/src/services/products/types.d.ts +124 -0
  66. package/dist/react/src/services/store/index.d.ts +2 -0
  67. package/dist/react/src/services/store/types.d.ts +57 -0
  68. package/dist/react/src/services/utils/widgetConfig.d.ts +20 -0
  69. package/dist/react/src/svg_components/ArrowLeftIcon.d.ts +3 -0
  70. package/dist/react/src/svg_components/BankTransferIcon.d.ts +2 -0
  71. package/dist/react/src/svg_components/CancelIcon.d.ts +7 -0
  72. package/dist/react/src/svg_components/CardIcon.d.ts +2 -0
  73. package/dist/react/src/svg_components/CloseIcon.d.ts +3 -0
  74. package/dist/react/src/svg_components/CopyIcon.d.ts +2 -0
  75. package/dist/react/src/svg_components/EyeCloseIcon.d.ts +5 -0
  76. package/dist/react/src/svg_components/EyeOpenIcon.d.ts +5 -0
  77. package/dist/react/src/svg_components/SloudIcon.d.ts +2 -0
  78. package/dist/react/src/utils/enums/AxiosErrorCodes.d.ts +7 -0
  79. package/dist/react/src/utils/enums/AxiosMethods.d.ts +7 -0
  80. package/dist/react/src/utils/helpers/classNames.d.ts +7 -0
  81. package/dist/react/src/utils/helpers/formatCurrency.d.ts +10 -0
  82. package/dist/react/src/utils/helpers/phoneDefaults.d.ts +3 -0
  83. package/dist/react/src/utils/helpers/validatePhone.d.ts +7 -0
  84. package/dist/react/src/utils/image_utils/index.d.ts +9 -0
  85. package/dist/react/src/utils/storage/index.d.ts +9 -0
  86. package/dist/react/src/widget.d.ts +27 -0
  87. package/dist/rollup.config.d.ts +8 -0
  88. package/dist/rollup.config.dts.d.ts +3 -0
  89. package/dist/src/components/Button/Button.types.d.ts +6 -0
  90. package/dist/src/components/Button/index.d.ts +3 -0
  91. package/dist/src/components/CopyToClipboardSpan/CopyToClipboard.types.d.ts +4 -0
  92. package/dist/src/components/CopyToClipboardSpan/index.d.ts +3 -0
  93. package/dist/src/components/Input/Input.types.d.ts +17 -0
  94. package/dist/src/components/Input/index.d.ts +3 -0
  95. package/dist/src/components/Skeleton/PaymentOptionSkeletons.d.ts +6 -0
  96. package/dist/src/components/TextArea/TextArea.types.d.ts +19 -0
  97. package/dist/src/components/TextArea/index.d.ts +3 -0
  98. package/dist/src/components/Widget.d.ts +6 -0
  99. package/dist/src/components/modals/AwaitingPaymentModal/AwaitingPaymentModal.d.ts +2 -0
  100. package/dist/src/components/modals/AwaitingPaymentTimeoutModal/AwaitingPaymentTimeoutModal.d.ts +2 -0
  101. package/dist/src/components/modals/Modal.d.ts +10 -0
  102. package/dist/src/components/modals/PaymentDetailsModal/PaymentDetailsModal.d.ts +2 -0
  103. package/dist/src/components/modals/PaymentDetailsModal/hooks/useTimer.d.ts +7 -0
  104. package/dist/src/components/modals/PaymentOptionsModal/PaymentOptionsModal.d.ts +2 -0
  105. package/dist/src/components/modals/PaymentOptionsModal/RadioButton.d.ts +11 -0
  106. package/dist/src/components/modals/PaymentOptionsModal/paymentOptionsMap.d.ts +5 -0
  107. package/dist/src/components/modals/SuccessModal/SuccessModal.d.ts +2 -0
  108. package/dist/src/components/modals/state/actions/data.d.ts +10 -0
  109. package/dist/src/components/modals/state/actions/index.d.ts +5 -0
  110. package/dist/src/components/modals/state/actions/modal.d.ts +5 -0
  111. package/dist/src/components/modals/state/actions/payment.d.ts +7 -0
  112. package/dist/src/components/modals/state/constants/actionTypes.d.ts +24 -0
  113. package/dist/src/components/modals/state/constants/index.d.ts +2 -0
  114. package/dist/src/components/modals/state/constants/initialState.d.ts +36 -0
  115. package/dist/src/components/modals/state/reducers/data.d.ts +2 -0
  116. package/dist/src/components/modals/state/reducers/index.d.ts +2 -0
  117. package/dist/src/components/modals/state/reducers/modal.d.ts +2 -0
  118. package/dist/src/components/modals/state/reducers/payment.d.ts +2 -0
  119. package/dist/src/components/modals/state/types/common.d.ts +12 -0
  120. package/dist/src/components/modals/state/types/data.d.ts +34 -0
  121. package/dist/src/components/modals/state/types/index.d.ts +8 -0
  122. package/dist/src/components/modals/state/types/modal.d.ts +12 -0
  123. package/dist/src/components/modals/state/types/payment.d.ts +14 -0
  124. package/dist/src/components/modals/state/utils/index.d.ts +37 -0
  125. package/dist/src/context/ModalProvider.d.ts +4 -0
  126. package/dist/src/context/PaymentInfoContext.d.ts +26 -0
  127. package/dist/src/context/PaymentWidgetContext.d.ts +13 -0
  128. package/dist/src/context/modal.d.ts +4 -0
  129. package/dist/src/context/types.d.ts +28 -0
  130. package/dist/src/hooks/types.d.ts +34 -0
  131. package/dist/src/hooks/useModalControl.d.ts +27 -0
  132. package/dist/src/hooks/usePaymentAPI.d.ts +10 -0
  133. package/dist/src/hooks/useShortPolling.d.ts +4 -0
  134. package/dist/src/index.d.ts +2 -0
  135. package/dist/src/services/config/endpoints.d.ts +9 -0
  136. package/dist/src/services/config/error.d.ts +5 -0
  137. package/dist/src/services/index.d.ts +27 -0
  138. package/dist/src/services/payments/index.d.ts +4 -0
  139. package/dist/src/services/payments/types.d.ts +68 -0
  140. package/dist/src/services/products/index.d.ts +1 -0
  141. package/dist/src/services/products/types.d.ts +124 -0
  142. package/dist/src/services/store/index.d.ts +2 -0
  143. package/dist/src/services/store/types.d.ts +57 -0
  144. package/dist/src/services/utils/widgetConfig.d.ts +20 -0
  145. package/dist/src/svg_components/ArrowLeftIcon.d.ts +3 -0
  146. package/dist/src/svg_components/BankTransferIcon.d.ts +2 -0
  147. package/dist/src/svg_components/CancelIcon.d.ts +7 -0
  148. package/dist/src/svg_components/CardIcon.d.ts +2 -0
  149. package/dist/src/svg_components/CloseIcon.d.ts +3 -0
  150. package/dist/src/svg_components/CopyIcon.d.ts +2 -0
  151. package/dist/src/svg_components/EyeCloseIcon.d.ts +5 -0
  152. package/dist/src/svg_components/EyeOpenIcon.d.ts +5 -0
  153. package/dist/src/svg_components/SloudIcon.d.ts +2 -0
  154. package/dist/src/utils/enums/AxiosErrorCodes.d.ts +7 -0
  155. package/dist/src/utils/enums/AxiosMethods.d.ts +7 -0
  156. package/dist/src/utils/helpers/classNames.d.ts +7 -0
  157. package/dist/src/utils/helpers/formatCurrency.d.ts +10 -0
  158. package/dist/src/utils/helpers/phoneDefaults.d.ts +3 -0
  159. package/dist/src/utils/helpers/validatePhone.d.ts +7 -0
  160. package/dist/src/utils/image_utils/index.d.ts +9 -0
  161. package/dist/src/utils/storage/index.d.ts +9 -0
  162. package/dist/src/widget.d.ts +27 -0
  163. 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,2 @@
1
+ export declare const getSubdomainClient: () => string;
2
+ export declare const getSubDomain: (host: string) => string;
@@ -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,3 @@
1
+ import React from 'react';
2
+ declare const ArrowLeftIcon: (props?: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
3
+ export default ArrowLeftIcon;
@@ -0,0 +1,2 @@
1
+ declare const BankTransferIcon: (props?: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
2
+ export default BankTransferIcon;
@@ -0,0 +1,7 @@
1
+ interface ICancelIcon {
2
+ fillColor: string;
3
+ height?: number;
4
+ width?: number;
5
+ }
6
+ declare const CancelIcon: ({ fillColor, height, width }: ICancelIcon) => JSX.Element;
7
+ export default CancelIcon;
@@ -0,0 +1,2 @@
1
+ declare const CardIcon: (props?: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
2
+ export default CardIcon;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const CloseIcon: ({ color, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
3
+ export default CloseIcon;
@@ -0,0 +1,2 @@
1
+ declare const CopyIcon: () => import("react/jsx-runtime").JSX.Element;
2
+ export default CopyIcon;
@@ -0,0 +1,5 @@
1
+ interface IEyeCloseIcon {
2
+ fillColor: string;
3
+ }
4
+ declare const EyeCloseIcon: ({ fillColor }: IEyeCloseIcon) => JSX.Element;
5
+ export default EyeCloseIcon;
@@ -0,0 +1,5 @@
1
+ interface IEyeOpenIcon {
2
+ fillColor: string;
3
+ }
4
+ declare const EyeOpenIcon: ({ fillColor }: IEyeOpenIcon) => JSX.Element;
5
+ export default EyeOpenIcon;
@@ -0,0 +1,2 @@
1
+ declare const SloudIcon: (props?: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
2
+ export default SloudIcon;
@@ -0,0 +1,7 @@
1
+ export declare enum EnumErrorCodes {
2
+ BadRquest = 400,
3
+ NotFound = 404,
4
+ Unauthorized = 401,
5
+ Forbidden = 403,
6
+ ServerError = 500
7
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum EnumAxiosMethod {
2
+ Get = "get",
3
+ Post = "post",
4
+ Put = "put",
5
+ Patch = "patch",
6
+ Delete = "delete"
7
+ }
@@ -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,3 @@
1
+ import type { CountryCode } from 'libphonenumber-js';
2
+ export declare const getDefaultCountryFromSettings: () => CountryCode;
3
+ export declare const getDefaultPrefixFromCountry: (country: CountryCode) => string;
@@ -0,0 +1,7 @@
1
+ import type { CountryCode } from 'libphonenumber-js';
2
+ interface PhoneValidationOptions {
3
+ country?: CountryCode;
4
+ strictPrefix?: string;
5
+ }
6
+ declare const validatePhone: (phone?: string, opts?: PhoneValidationOptions) => boolean;
7
+ export default validatePhone;
@@ -0,0 +1,9 @@
1
+ export declare const IMAGES: {
2
+ backgroundMock: string;
3
+ success: string;
4
+ waiting: string;
5
+ maintenance: string;
6
+ sloudEmblem: string;
7
+ sloudLogo: string;
8
+ noImageFallback: string;
9
+ };
@@ -0,0 +1,9 @@
1
+ export declare const AppStorage: {
2
+ setItem: (key: string, value: string) => void;
3
+ getItem: (key: string) => string | null;
4
+ removeItem: (key: string) => void;
5
+ };
6
+ export declare const AppStorageKeys: {
7
+ Store: string;
8
+ Bag: string;
9
+ };
@@ -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,3 @@
1
+ import { RollupOptions } from "rollup";
2
+ declare const config: RollupOptions;
3
+ export default config;
@@ -0,0 +1,6 @@
1
+ import { HTMLProps } from 'react';
2
+ export interface IButton extends HTMLProps<HTMLButtonElement> {
3
+ mode: 'outline' | 'solid';
4
+ type?: 'button' | 'submit' | 'reset';
5
+ loading?: boolean;
6
+ }
@@ -0,0 +1,3 @@
1
+ import { IButton } from './Button.types';
2
+ declare const Button: ({ mode, children, disabled, className, style, loading, ...rest }: IButton) => import("react/jsx-runtime").JSX.Element;
3
+ export default Button;
@@ -0,0 +1,4 @@
1
+ export interface ICopyToClipboard {
2
+ label: string;
3
+ text: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ import { ICopyToClipboard } from './CopyToClipboard.types';
2
+ declare const CopyToClipboardSpan: ({ label, text }: ICopyToClipboard) => import("react/jsx-runtime").JSX.Element;
3
+ export default CopyToClipboardSpan;
@@ -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,3 @@
1
+ import { IInput } from "./Input.types";
2
+ declare const Input: ({ error, name, onChange, onFocus, onDelete, label, placeholder, type, value, disabled, autoComplete, title, required, inputClass, }: IInput) => JSX.Element;
3
+ export default Input;
@@ -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,6 @@
1
+ import "../styles/widget.scss";
2
+ interface Props {
3
+ isOpen: boolean;
4
+ }
5
+ declare const Widget: ({ isOpen }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export default Widget;
@@ -0,0 +1,2 @@
1
+ declare const AwaitingPaymentModal: () => import("react/jsx-runtime").JSX.Element;
2
+ export default AwaitingPaymentModal;
@@ -0,0 +1,2 @@
1
+ declare const AwaitingPaymentTimeoutModal: () => import("react/jsx-runtime").JSX.Element;
2
+ export default AwaitingPaymentTimeoutModal;
@@ -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,2 @@
1
+ declare const PaymentDetailsModal: () => import("react/jsx-runtime").JSX.Element;
2
+ export default PaymentDetailsModal;
@@ -0,0 +1,7 @@
1
+ interface UseTimerProps {
2
+ start: boolean;
3
+ restart?: boolean;
4
+ callback?: () => void;
5
+ }
6
+ declare const useTimer: ({ start, restart, callback }: UseTimerProps) => string;
7
+ export default useTimer;
@@ -0,0 +1,2 @@
1
+ declare const PaymentOptionsModal: () => import("react/jsx-runtime").JSX.Element;
2
+ export default PaymentOptionsModal;
@@ -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,5 @@
1
+ export declare const paymentOptionsMap: Record<string, {
2
+ label: string;
3
+ value: string;
4
+ disabled?: boolean;
5
+ }>;
@@ -0,0 +1,2 @@
1
+ declare const SuccessModal: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SuccessModal;
@@ -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 { ResetAllAction } from '../types';
2
+ export declare const resetAll: () => ResetAllAction;
3
+ export * from './data';
4
+ export * from './modal';
5
+ export * from './payment';
@@ -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
+ };