mainstack-payments 0.0.0 → 0.0.2

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 (81) hide show
  1. package/build/mainstack-payments.js +25240 -95861
  2. package/build/src/api/config.d.ts +6 -0
  3. package/build/src/api/index.d.ts +54 -0
  4. package/build/src/app.d.ts +1 -0
  5. package/build/src/assets/themes/baseThemes.d.ts +2 -0
  6. package/build/src/components/CheckoutForm.d.ts +15 -0
  7. package/build/src/components/DrawerModal.d.ts +10 -0
  8. package/build/src/components/Payment.d.ts +19 -0
  9. package/build/src/components/PaystackPaymentErrorModal.d.ts +6 -0
  10. package/build/src/components/PaystackPaymentModal.d.ts +8 -0
  11. package/build/src/components/WalletPay.d.ts +11 -0
  12. package/build/src/constants/index.d.ts +2 -0
  13. package/build/src/enums/currenciesEnums.d.ts +6 -0
  14. package/build/src/hooks/useApi.d.ts +22 -0
  15. package/build/src/hooks/usePayment.d.ts +7 -0
  16. package/build/src/index.d.ts +3 -0
  17. package/build/src/pages/Home.d.ts +2 -0
  18. package/build/src/pages/Index.d.ts +2 -0
  19. package/build/src/pages/Login.d.ts +2 -0
  20. package/build/src/pages/Page404.d.ts +2 -0
  21. package/build/src/pages/PaymentRedirect.d.ts +2 -0
  22. package/build/src/provider/index.d.ts +6 -0
  23. package/build/src/routes/index.d.ts +7 -0
  24. package/build/src/types/index.d.ts +35 -0
  25. package/{src/utils/countries_flag.json → build/src/utils/countries_flag.json.d.ts} +4 -1
  26. package/{src/utils/countries_with_flags_and_currencies.json → build/src/utils/countries_with_flags_and_currencies.json.d.ts} +4 -1
  27. package/build/src/utils/formatUnderscoreText.d.ts +2 -0
  28. package/build/src/utils/index.d.ts +3 -0
  29. package/build/src/utils/stringifyPrice.d.ts +4 -0
  30. package/build/src/utils/validations.d.ts +14 -0
  31. package/package.json +30 -10
  32. package/.env.sample +0 -1
  33. package/.eslintignore +0 -5
  34. package/.eslintrc.json +0 -95
  35. package/.github/PULL_REQUEST_TEMPLATE.md +0 -15
  36. package/.husky/commit-msg +0 -4
  37. package/.husky/pre-commit +0 -6
  38. package/.prettierignore +0 -7
  39. package/.prettierrc +0 -9
  40. package/.vscode/extensions.json +0 -10
  41. package/build/_redirects +0 -1
  42. package/build/manifest.json +0 -15
  43. package/build/robots.txt +0 -3
  44. package/build/style.css +0 -6
  45. package/build/vite.svg +0 -1
  46. package/commitlint.config.cjs +0 -1
  47. package/index.html +0 -31
  48. package/public/_redirects +0 -1
  49. package/public/manifest.json +0 -15
  50. package/public/robots.txt +0 -3
  51. package/public/vite.svg +0 -1
  52. package/src/api/config.ts +0 -36
  53. package/src/api/index.ts +0 -84
  54. package/src/app.tsx +0 -39
  55. package/src/assets/images/tired-emoji.png +0 -0
  56. package/src/assets/styles/index.css +0 -26
  57. package/src/assets/themes/baseThemes.ts +0 -30
  58. package/src/components/CheckoutForm.tsx +0 -426
  59. package/src/components/DrawerModal.tsx +0 -63
  60. package/src/components/Payment.tsx +0 -772
  61. package/src/components/PaystackPaymentErrorModal.tsx +0 -120
  62. package/src/components/PaystackPaymentModal.tsx +0 -120
  63. package/src/components/WalletPay.tsx +0 -160
  64. package/src/constants/index.ts +0 -3
  65. package/src/enums/currenciesEnums.ts +0 -7
  66. package/src/hooks/usePayment.ts +0 -60
  67. package/src/index.ts +0 -3
  68. package/src/pages/Home.tsx +0 -97
  69. package/src/pages/Index.tsx +0 -23
  70. package/src/pages/Login.tsx +0 -13
  71. package/src/pages/Page404.tsx +0 -13
  72. package/src/pages/PaymentRedirect.tsx +0 -15
  73. package/src/routes/index.tsx +0 -8
  74. package/src/types/index.ts +0 -48
  75. package/src/utils/countries-flag.json +0 -1752
  76. package/src/utils/formatUnderscoreText.ts +0 -5
  77. package/src/utils/index.ts +0 -4
  78. package/src/utils/stringifyPrice.ts +0 -37
  79. package/src/utils/validations.ts +0 -44
  80. package/tsconfig.json +0 -35
  81. package/vite.config.ts +0 -36
@@ -1,5 +0,0 @@
1
- /** @format */
2
-
3
- export const replaceUnderscores = (input: string): string => {
4
- return input?.replace(/_/g, " ");
5
- };
@@ -1,4 +0,0 @@
1
- /** @format */
2
-
3
- export { replaceUnderscores } from "./formatUnderscoreText";
4
- export { stringifyPrice } from "./stringifyPrice";
@@ -1,37 +0,0 @@
1
- /** @format */
2
-
3
- const roundToTwo = (num: number) => {
4
- return Math.round((num + Number.EPSILON) * 100) / 100;
5
- };
6
-
7
- export const stringifyPrice = (price: any | number | bigint) => {
8
- const valToStringify =
9
- price &&
10
- roundToTwo(Number(price)) &&
11
- roundToTwo(Number(price)).toString().split(".")[0];
12
- const rev: any[] =
13
- valToStringify && valToStringify.toString().split("").reverse();
14
-
15
- const newPrice: any = [];
16
- for (let i = 0; i < rev?.length; i++) {
17
- if (
18
- rev?.length > 3 &&
19
- i + 1 !== rev?.length &&
20
- (i + 1) % 3 === 0 &&
21
- i + 1 >= 3
22
- ) {
23
- newPrice.push(rev[i], ",");
24
- } else {
25
- newPrice.push(rev[i]);
26
- }
27
- }
28
-
29
- const secondString =
30
- price && roundToTwo(Number(price)).toString().split(".")[1];
31
- return `${newPrice.reverse().join("") || 0}${
32
- secondString ? `.${(secondString || "")?.padEnd(2, "0") || "00"}` : ""
33
- }`;
34
- // return `${newPrice.reverse().join("")}`;
35
- };
36
-
37
- export { roundToTwo };
@@ -1,44 +0,0 @@
1
- /** @format */
2
-
3
- import * as yup from "yup";
4
-
5
- export const VALIDATIONS = {
6
- email: yup
7
- .string()
8
- .matches(
9
- /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
10
- "Please enter a valid email"
11
- )
12
- .required("Please enter your email address"),
13
- fullname: yup
14
- .string()
15
- .required("Please enter your fullname")
16
- .matches(
17
- /^[a-z- ]{3,40}$/i,
18
- "Only 3 to 40 characters containing alphabets, numbers, _ and - are allowed"
19
- ),
20
- username: yup
21
- .string()
22
- .required("Please enter a username")
23
- .matches(
24
- /^(?![0-9._])(?!.*d_)(?!.*_d)[a-zA-Z0-9_]+$/,
25
- "Only letters, numbers and _ are allowed"
26
- )
27
- .ensure(),
28
- password: yup.string().required("Please enter a password"),
29
- url: yup
30
- .string()
31
- .url("Must be a valid mainstack url")
32
- .required("URL is required"),
33
- name: yup
34
- .string()
35
- .required("Please enter name")
36
- .matches(
37
- /^(?![0-9._])(?!.*d_)(?!.*_d)\w+( \w+)*$/,
38
- "Only letters, numbers and _ are allowed"
39
- ),
40
- firstname: yup.string().required("First name is required"),
41
- lastname: yup.string().required("Last name is required"),
42
- country: yup.string().required("Country is required"),
43
- message: yup.string().required("Please type a message"),
44
- };
package/tsconfig.json DELETED
@@ -1,35 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "types": ["vite/client", "vite-plugin-svgr/client"],
4
- "target": "es6",
5
- "useDefineForClassFields": true,
6
- "lib": ["DOM", "DOM.Iterable", "esnext"],
7
- "allowJs": false,
8
- "skipLibCheck": true,
9
- "esModuleInterop": false,
10
- "allowSyntheticDefaultImports": true,
11
- "strict": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "module": "esnext",
14
- "moduleResolution": "node",
15
- "resolveJsonModule": true,
16
- "isolatedModules": true,
17
- "noEmit": true,
18
- "jsx": "react-jsx",
19
- "composite": true,
20
- "paths": {
21
- // "*": ["./*"],
22
- "@/*": ["./src/*"]
23
- },
24
- "baseUrl": "src"
25
- },
26
- "include": [
27
- "src",
28
- "vite.config.ts",
29
- "**/*.ts",
30
- "**/*.tsx",
31
- "**/*.json",
32
- "commitlint.config.cjs"
33
- ],
34
- "exclude": ["node_modules"]
35
- }
package/vite.config.ts DELETED
@@ -1,36 +0,0 @@
1
- /** @format */
2
-
3
- import { defineConfig } from "vite";
4
- import react from "@vitejs/plugin-react";
5
- import viteTsconfigPaths from "vite-tsconfig-paths";
6
- import svgrPlugin from "vite-plugin-svgr";
7
- import envCompatible from "vite-plugin-env-compatible";
8
- import path from "path";
9
-
10
- // /** @type {import('vite').UserConfig} */
11
- // export default {
12
-
13
- // };
14
- export default defineConfig({
15
- envPrefix: "REACT_APP_",
16
- plugins: [react(), viteTsconfigPaths(), svgrPlugin()],
17
- server: {
18
- open: true,
19
- port: 3008,
20
- },
21
- resolve: {
22
- alias: {
23
- "@": path.resolve(__dirname, "./src"),
24
- },
25
- },
26
- build: {
27
- outDir: "build",
28
- lib: {
29
- entry: path.resolve(__dirname, "src/index.ts"),
30
- formats: ["es"],
31
- },
32
- commonjsOptions: {
33
- transformMixedEsModules: true,
34
- },
35
- },
36
- });