@classytic/commerce-sdk 0.1.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.

Potentially problematic release.


This version of @classytic/commerce-sdk might be problematic. Click here for more details.

Files changed (131) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +104 -0
  3. package/dist/adjustment-DTSLM7AN.js +5 -0
  4. package/dist/adjustment-DTSLM7AN.js.map +1 -0
  5. package/dist/analytics/index.d.ts +27 -0
  6. package/dist/analytics/index.js +6 -0
  7. package/dist/analytics/index.js.map +1 -0
  8. package/dist/analytics-DMcD-o8w.d.ts +76 -0
  9. package/dist/api-factory-B_h4RKBm.d.ts +280 -0
  10. package/dist/auth/index.d.ts +39 -0
  11. package/dist/auth/index.js +5 -0
  12. package/dist/auth/index.js.map +1 -0
  13. package/dist/catalog/index.d.ts +479 -0
  14. package/dist/catalog/index.js +9 -0
  15. package/dist/catalog/index.js.map +1 -0
  16. package/dist/chunk-4ZQK3FFN.js +40 -0
  17. package/dist/chunk-4ZQK3FFN.js.map +1 -0
  18. package/dist/chunk-5L6EXDGH.js +465 -0
  19. package/dist/chunk-5L6EXDGH.js.map +1 -0
  20. package/dist/chunk-5ZFW3FEI.js +183 -0
  21. package/dist/chunk-5ZFW3FEI.js.map +1 -0
  22. package/dist/chunk-66OQAZSL.js +94 -0
  23. package/dist/chunk-66OQAZSL.js.map +1 -0
  24. package/dist/chunk-6RYGA6MF.js +123 -0
  25. package/dist/chunk-6RYGA6MF.js.map +1 -0
  26. package/dist/chunk-B6MPVOV7.js +328 -0
  27. package/dist/chunk-B6MPVOV7.js.map +1 -0
  28. package/dist/chunk-BDA2WSJA.js +148 -0
  29. package/dist/chunk-BDA2WSJA.js.map +1 -0
  30. package/dist/chunk-EIVYT3HM.js +126 -0
  31. package/dist/chunk-EIVYT3HM.js.map +1 -0
  32. package/dist/chunk-EPQN7ZKZ.js +27 -0
  33. package/dist/chunk-EPQN7ZKZ.js.map +1 -0
  34. package/dist/chunk-FA7QFJ2G.js +177 -0
  35. package/dist/chunk-FA7QFJ2G.js.map +1 -0
  36. package/dist/chunk-I5TIKUIQ.js +261 -0
  37. package/dist/chunk-I5TIKUIQ.js.map +1 -0
  38. package/dist/chunk-ILQUH444.js +135 -0
  39. package/dist/chunk-ILQUH444.js.map +1 -0
  40. package/dist/chunk-IXMWZJLV.js +616 -0
  41. package/dist/chunk-IXMWZJLV.js.map +1 -0
  42. package/dist/chunk-KZIGRIQG.js +75 -0
  43. package/dist/chunk-KZIGRIQG.js.map +1 -0
  44. package/dist/chunk-OF5M6R2S.js +769 -0
  45. package/dist/chunk-OF5M6R2S.js.map +1 -0
  46. package/dist/chunk-PYYLHUV6.js +3 -0
  47. package/dist/chunk-PYYLHUV6.js.map +1 -0
  48. package/dist/chunk-QO5AGZFP.js +159 -0
  49. package/dist/chunk-QO5AGZFP.js.map +1 -0
  50. package/dist/chunk-QUMTBLNE.js +76 -0
  51. package/dist/chunk-QUMTBLNE.js.map +1 -0
  52. package/dist/chunk-R5Z7NYLH.js +126 -0
  53. package/dist/chunk-R5Z7NYLH.js.map +1 -0
  54. package/dist/chunk-SZYWG5IB.js +75 -0
  55. package/dist/chunk-SZYWG5IB.js.map +1 -0
  56. package/dist/chunk-U3XT35GZ.js +202 -0
  57. package/dist/chunk-U3XT35GZ.js.map +1 -0
  58. package/dist/chunk-UGELTUIZ.js +830 -0
  59. package/dist/chunk-UGELTUIZ.js.map +1 -0
  60. package/dist/chunk-VR36QVX2.js +122 -0
  61. package/dist/chunk-VR36QVX2.js.map +1 -0
  62. package/dist/chunk-WUOQK7BO.js +13 -0
  63. package/dist/chunk-WUOQK7BO.js.map +1 -0
  64. package/dist/chunk-X6PV5MHG.js +582 -0
  65. package/dist/chunk-X6PV5MHG.js.map +1 -0
  66. package/dist/chunk-ZWLMFLLH.js +534 -0
  67. package/dist/chunk-ZWLMFLLH.js.map +1 -0
  68. package/dist/content/index.d.ts +309 -0
  69. package/dist/content/index.js +6 -0
  70. package/dist/content/index.js.map +1 -0
  71. package/dist/core/index.d.ts +107 -0
  72. package/dist/core/index.js +5 -0
  73. package/dist/core/index.js.map +1 -0
  74. package/dist/core/react.d.ts +107 -0
  75. package/dist/core/react.js +5 -0
  76. package/dist/core/react.js.map +1 -0
  77. package/dist/coupon-CHFcw7cd.d.ts +632 -0
  78. package/dist/coupon-zGkvO-Xx.d.ts +129 -0
  79. package/dist/crud.factory-DyKaPHcU.d.ts +181 -0
  80. package/dist/finance/index.d.ts +81 -0
  81. package/dist/finance/index.js +5 -0
  82. package/dist/finance/index.js.map +1 -0
  83. package/dist/finance-BJdfKRw0.d.ts +135 -0
  84. package/dist/index.d.ts +31 -0
  85. package/dist/index.js +29 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/inventory/index.d.ts +512 -0
  88. package/dist/inventory/index.js +16 -0
  89. package/dist/inventory/index.js.map +1 -0
  90. package/dist/inventory-DCiIZh8P.d.ts +742 -0
  91. package/dist/logistics/index.d.ts +226 -0
  92. package/dist/logistics/index.js +7 -0
  93. package/dist/logistics/index.js.map +1 -0
  94. package/dist/logistics-V8a9lUN3.d.ts +428 -0
  95. package/dist/media-CNLJK93J.d.ts +721 -0
  96. package/dist/movement-7MV3ADY5.js +5 -0
  97. package/dist/movement-7MV3ADY5.js.map +1 -0
  98. package/dist/payment-BRboLqvU.d.ts +127 -0
  99. package/dist/payments/index.d.ts +55 -0
  100. package/dist/payments/index.js +6 -0
  101. package/dist/payments/index.js.map +1 -0
  102. package/dist/platform/index.d.ts +645 -0
  103. package/dist/platform/index.js +8 -0
  104. package/dist/platform/index.js.map +1 -0
  105. package/dist/pos-D1jkkFl0.d.ts +885 -0
  106. package/dist/product-p09zXkXB.d.ts +260 -0
  107. package/dist/purchase-24BGT2HA.js +5 -0
  108. package/dist/purchase-24BGT2HA.js.map +1 -0
  109. package/dist/request-652PS6VR.js +5 -0
  110. package/dist/request-652PS6VR.js.map +1 -0
  111. package/dist/sales/index.d.ts +585 -0
  112. package/dist/sales/index.js +9 -0
  113. package/dist/sales/index.js.map +1 -0
  114. package/dist/server.d.ts +120 -0
  115. package/dist/server.js +27 -0
  116. package/dist/server.js.map +1 -0
  117. package/dist/size-guide-DgjzjM5P.d.ts +554 -0
  118. package/dist/stock-DEApGC-w.d.ts +632 -0
  119. package/dist/stock-OOUW57VQ.js +5 -0
  120. package/dist/stock-OOUW57VQ.js.map +1 -0
  121. package/dist/supplier-OC6JAWV6.js +5 -0
  122. package/dist/supplier-OC6JAWV6.js.map +1 -0
  123. package/dist/transaction/index.d.ts +104 -0
  124. package/dist/transaction/index.js +8 -0
  125. package/dist/transaction/index.js.map +1 -0
  126. package/dist/transaction-BTmoHpWh.d.ts +428 -0
  127. package/dist/transaction-u5oaNuav.d.ts +84 -0
  128. package/dist/transfer-7SYSH3RG.js +5 -0
  129. package/dist/transfer-7SYSH3RG.js.map +1 -0
  130. package/dist/user-data-DdLjAGwO.d.ts +132 -0
  131. package/package.json +146 -0
@@ -0,0 +1,127 @@
1
+ import { A as ApiResponse } from './api-factory-B_h4RKBm.js';
2
+
3
+ type PaymentStatus = "pending" | "verified" | "failed" | "refunded" | "partially_refunded" | "cancelled";
4
+ /**
5
+ * Transaction reference info
6
+ */
7
+ interface TransactionEntity {
8
+ referenceModel: "Order";
9
+ referenceId: string;
10
+ }
11
+ /**
12
+ * Verification result returned from backend
13
+ */
14
+ interface VerificationResult {
15
+ transactionId: string;
16
+ status: PaymentStatus;
17
+ amount: number;
18
+ category: string;
19
+ verifiedAt: string;
20
+ verifiedBy: string;
21
+ entity: TransactionEntity | null;
22
+ }
23
+ /**
24
+ * Reject result returned from backend
25
+ */
26
+ interface RejectResult {
27
+ transactionId: string;
28
+ status: "failed";
29
+ failedAt: string;
30
+ failureReason: string;
31
+ }
32
+ /**
33
+ * Verify payment request payload
34
+ */
35
+ interface VerifyPaymentPayload {
36
+ /** Transaction ID (MongoDB ObjectId) */
37
+ transactionId: string;
38
+ /** Optional verification notes */
39
+ notes?: string;
40
+ }
41
+ /**
42
+ * Reject payment request payload
43
+ */
44
+ interface RejectPaymentPayload {
45
+ /** Transaction ID (MongoDB ObjectId) */
46
+ transactionId: string;
47
+ /** Reason for rejection */
48
+ reason: string;
49
+ }
50
+
51
+ interface FetchOptions {
52
+ cache?: RequestCache;
53
+ revalidate?: number;
54
+ tags?: string[];
55
+ }
56
+ /**
57
+ * Payment API for admin payment management
58
+ *
59
+ * Manual Payment Verification Flow:
60
+ * 1. Customer places order → Transaction created with status 'pending'
61
+ * 2. Customer pays via bKash/Nagad/bank transfer/cash
62
+ * 3. Admin verifies payment via verifyPayment() endpoint
63
+ * 4. Backend updates transaction to 'verified'
64
+ * 5. Order status auto-updates to 'confirmed', payment status to 'verified'
65
+ *
66
+ * Endpoints:
67
+ * - POST /webhooks/payments/manual/verify - Verify pending payment (superadmin)
68
+ * - POST /webhooks/payments/manual/reject - Reject pending payment (superadmin)
69
+ */
70
+ declare class PaymentApi {
71
+ private baseUrl;
72
+ /**
73
+ * Verify a manual payment (Admin/Superadmin only)
74
+ * POST /webhooks/payments/manual/verify
75
+ *
76
+ * Use this when admin confirms a customer's manual payment
77
+ * (bKash, Nagad, bank transfer, cash, etc.)
78
+ *
79
+ * After verification:
80
+ * - Transaction status → 'verified'
81
+ * - Order payment status → 'verified'
82
+ * - Order status → 'confirmed' (if was 'pending')
83
+ *
84
+ * @example
85
+ * const result = await paymentApi.verifyPayment({
86
+ * token: adminToken,
87
+ * data: {
88
+ * transactionId: '507f1f77bcf86cd799439011',
89
+ * notes: 'Verified bKash payment TrxID: ABC123'
90
+ * }
91
+ * });
92
+ */
93
+ verifyPayment({ token, data, options, }: {
94
+ token: string;
95
+ data: VerifyPaymentPayload;
96
+ options?: FetchOptions;
97
+ }): Promise<ApiResponse<VerificationResult>>;
98
+ /**
99
+ * Reject a manual payment (Admin/Superadmin only)
100
+ * POST /webhooks/payments/manual/reject
101
+ *
102
+ * Use this when admin rejects a customer's payment claim
103
+ * (invalid reference, insufficient amount, fraud, etc.)
104
+ *
105
+ * After rejection:
106
+ * - Transaction status → 'failed'
107
+ * - Order payment status → 'failed'
108
+ * - Reason recorded in transaction
109
+ *
110
+ * @example
111
+ * const result = await paymentApi.rejectPayment({
112
+ * token: adminToken,
113
+ * data: {
114
+ * transactionId: '507f1f77bcf86cd799439011',
115
+ * reason: 'Invalid bKash TrxID - payment not found'
116
+ * }
117
+ * });
118
+ */
119
+ rejectPayment({ token, data, options, }: {
120
+ token: string;
121
+ data: RejectPaymentPayload;
122
+ options?: FetchOptions;
123
+ }): Promise<ApiResponse<RejectResult>>;
124
+ }
125
+ declare const paymentApi: PaymentApi;
126
+
127
+ export { PaymentApi as P, type RejectResult as R, type TransactionEntity as T, type VerificationResult as V, type VerifyPaymentPayload as a, type RejectPaymentPayload as b, paymentApi as p };
@@ -0,0 +1,55 @@
1
+ import { a as VerifyPaymentPayload, V as VerificationResult, b as RejectPaymentPayload, R as RejectResult } from '../payment-BRboLqvU.js';
2
+ export { P as PaymentApi, T as TransactionEntity, p as paymentApi } from '../payment-BRboLqvU.js';
3
+ import '../api-factory-B_h4RKBm.js';
4
+
5
+ interface UsePaymentActionsReturn {
6
+ verifyPayment: (data: VerifyPaymentPayload) => Promise<VerificationResult>;
7
+ isVerifying: boolean;
8
+ rejectPayment: (data: RejectPaymentPayload) => Promise<RejectResult>;
9
+ isRejecting: boolean;
10
+ isLoading: boolean;
11
+ }
12
+
13
+ /**
14
+ * Payment verification actions for admin
15
+ *
16
+ * Manual Payment Verification Flow:
17
+ * 1. Customer places order → Transaction created with status 'pending'
18
+ * 2. Customer pays via bKash/Nagad/bank transfer/cash
19
+ * 3. Admin verifies payment via verifyPayment()
20
+ * 4. Backend updates transaction to 'verified'
21
+ * 5. Order status auto-updates to 'confirmed', payment status to 'verified'
22
+ *
23
+ * @param token - Auth token (admin/superadmin)
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * function PaymentVerifier({ transaction }) {
28
+ * const { verifyPayment, rejectPayment, isLoading } = usePaymentActions(token);
29
+ *
30
+ * const handleVerify = async () => {
31
+ * await verifyPayment({
32
+ * transactionId: transaction._id,
33
+ * notes: 'Verified bKash payment TrxID: ABC123',
34
+ * });
35
+ * };
36
+ *
37
+ * const handleReject = async () => {
38
+ * await rejectPayment({
39
+ * transactionId: transaction._id,
40
+ * reason: 'Invalid bKash TrxID - payment not found',
41
+ * });
42
+ * };
43
+ *
44
+ * return (
45
+ * <>
46
+ * <Button onClick={handleVerify} disabled={isLoading}>Verify</Button>
47
+ * <Button onClick={handleReject} disabled={isLoading}>Reject</Button>
48
+ * </>
49
+ * );
50
+ * }
51
+ * ```
52
+ */
53
+ declare function usePaymentActions(token: string): UsePaymentActionsReturn;
54
+
55
+ export { RejectPaymentPayload, RejectResult, type UsePaymentActionsReturn, VerificationResult, VerifyPaymentPayload, usePaymentActions };
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ export { PaymentApi, paymentApi, usePaymentActions } from '../chunk-ILQUH444.js';
3
+ import '../chunk-U3XT35GZ.js';
4
+ import '../chunk-VR36QVX2.js';
5
+ //# sourceMappingURL=index.js.map
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}