@classytic/commerce-sdk 0.1.1 → 0.2.1
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 +187 -74
- package/dist/accounting/api/account.d.ts +49 -0
- package/dist/accounting/api/account.js +45 -0
- package/dist/accounting/api/budget.d.ts +76 -0
- package/dist/accounting/api/budget.js +82 -0
- package/dist/accounting/api/constants.d.ts +58 -0
- package/dist/accounting/api/constants.js +79 -0
- package/dist/accounting/api/fiscal-period.d.ts +31 -0
- package/dist/accounting/api/fiscal-period.js +30 -0
- package/dist/accounting/api/index.d.ts +7 -0
- package/dist/accounting/api/journal-entry.d.ts +66 -0
- package/dist/accounting/api/journal-entry.js +72 -0
- package/dist/accounting/api/posting.d.ts +55 -0
- package/dist/accounting/api/posting.js +70 -0
- package/dist/accounting/api/reports.d.ts +63 -0
- package/dist/accounting/api/reports.js +81 -0
- package/dist/accounting/hooks/account.d.ts +29 -0
- package/dist/accounting/hooks/account.js +102 -0
- package/dist/accounting/hooks/budget.d.ts +39 -0
- package/dist/accounting/hooks/budget.js +106 -0
- package/dist/accounting/hooks/fiscal-period.d.ts +22 -0
- package/dist/accounting/hooks/fiscal-period.js +52 -0
- package/dist/accounting/hooks/index.d.ts +6 -0
- package/dist/accounting/hooks/journal-entry.d.ts +37 -0
- package/dist/accounting/hooks/journal-entry.js +89 -0
- package/dist/accounting/hooks/posting.d.ts +128 -0
- package/dist/accounting/hooks/posting.js +119 -0
- package/dist/accounting/hooks/reports.d.ts +32 -0
- package/dist/accounting/hooks/reports.js +131 -0
- package/dist/accounting/index.d.ts +15 -0
- package/dist/accounting/index.js +15 -0
- package/dist/accounting/types/index.d.ts +375 -0
- package/dist/analytics/api/analytics.d.ts +16 -0
- package/dist/analytics/api/analytics.js +27 -0
- package/dist/analytics/api/index.d.ts +1 -0
- package/dist/analytics/hooks/analytics.d.ts +12 -0
- package/dist/analytics/hooks/analytics.js +33 -0
- package/dist/analytics/hooks/index.d.ts +1 -0
- package/dist/analytics/index.d.ts +4 -27
- package/dist/analytics/index.js +4 -6
- package/dist/analytics/types.d.ts +46 -0
- package/dist/audit/api/audit.d.ts +17 -0
- package/dist/audit/api/audit.js +21 -0
- package/dist/audit/hooks/audit.d.ts +17 -0
- package/dist/audit/hooks/audit.js +38 -0
- package/dist/audit/index.d.ts +4 -0
- package/dist/audit/index.js +4 -0
- package/dist/audit/types/index.d.ts +32 -0
- package/dist/auth/api/user-data.d.ts +30 -0
- package/dist/auth/api/user-data.js +70 -0
- package/dist/auth/hooks/user-search.d.ts +32 -0
- package/dist/auth/hooks/user-search.js +51 -0
- package/dist/auth/index.d.ts +4 -39
- package/dist/auth/index.js +5 -5
- package/dist/auth/types.d.ts +46 -0
- package/dist/auth/types.js +27 -0
- package/dist/catalog/api/category.d.ts +97 -0
- package/dist/catalog/api/category.js +109 -0
- package/dist/catalog/api/index.d.ts +4 -0
- package/dist/catalog/api/product.d.ts +136 -0
- package/dist/catalog/api/product.js +142 -0
- package/dist/catalog/api/review.d.ts +32 -0
- package/dist/catalog/api/review.js +41 -0
- package/dist/catalog/api/size-guide.d.ts +46 -0
- package/dist/catalog/api/size-guide.js +58 -0
- package/dist/catalog/hooks/category.d.ts +201 -0
- package/dist/catalog/hooks/category.js +295 -0
- package/dist/catalog/hooks/index.d.ts +4 -0
- package/dist/catalog/hooks/product.d.ts +165 -0
- package/dist/catalog/hooks/product.js +267 -0
- package/dist/catalog/hooks/review.d.ts +18 -0
- package/dist/catalog/hooks/review.js +38 -0
- package/dist/catalog/hooks/size-guide.d.ts +136 -0
- package/dist/catalog/hooks/size-guide.js +173 -0
- package/dist/catalog/index.d.ts +13 -571
- package/dist/catalog/index.js +10 -9
- package/dist/catalog/prefetch.d.ts +29 -0
- package/dist/catalog/prefetch.js +32 -0
- package/dist/catalog/types/category.d.ts +168 -0
- package/dist/catalog/types/index.d.ts +4 -0
- package/dist/catalog/types/product.d.ts +261 -0
- package/dist/catalog/types/review.d.ts +48 -0
- package/dist/catalog/types/size-guide.d.ts +118 -0
- package/dist/client.d.ts +138 -0
- package/dist/client.js +129 -0
- package/dist/content/api/cms.d.ts +27 -0
- package/dist/content/api/cms.js +43 -0
- package/dist/content/api/index.d.ts +2 -0
- package/dist/content/api/media.d.ts +74 -0
- package/dist/content/api/media.js +77 -0
- package/dist/content/hooks/cms.d.ts +31 -0
- package/dist/content/hooks/cms.js +62 -0
- package/dist/content/hooks/index.d.ts +2 -0
- package/dist/content/hooks/media.d.ts +74 -0
- package/dist/content/hooks/media.js +153 -0
- package/dist/content/index.d.ts +7 -309
- package/dist/content/index.js +6 -6
- package/dist/content/types/cms.d.ts +390 -0
- package/dist/content/types/media.d.ts +110 -0
- package/dist/core/api-factory.d.ts +17 -0
- package/dist/core/api-factory.js +39 -0
- package/dist/core/api-handler.d.ts +53 -0
- package/dist/core/api-handler.js +89 -0
- package/dist/core/index.d.ts +4 -166
- package/dist/core/index.js +4 -5
- package/dist/core/prefetch.d.ts +2 -0
- package/dist/core/prefetch.js +3 -0
- package/dist/core/react/crud.factory.d.ts +3 -0
- package/dist/core/react/crud.factory.js +5 -0
- package/dist/core/react/index.d.ts +4 -0
- package/dist/core/react/index.js +7 -0
- package/dist/core/react/mutation.factory.d.ts +9 -0
- package/dist/core/react/mutation.factory.js +21 -0
- package/dist/core/react/query.factory.d.ts +12 -0
- package/dist/core/react/query.factory.js +5 -0
- package/dist/core/server-context.d.ts +6 -0
- package/dist/core/server-context.js +12 -0
- package/dist/core/types/shared.d.ts +29 -0
- package/dist/finance/api/finance.d.ts +22 -0
- package/dist/finance/api/finance.js +29 -0
- package/dist/finance/api/index.d.ts +1 -0
- package/dist/finance/hooks/finance.d.ts +32 -0
- package/dist/finance/hooks/finance.js +66 -0
- package/dist/finance/hooks/index.d.ts +1 -0
- package/dist/finance/index.d.ts +4 -81
- package/dist/finance/index.js +4 -5
- package/dist/finance/types/finance.d.ts +82 -0
- package/dist/index.d.ts +139 -32
- package/dist/index.js +113 -29
- package/dist/inventory/api/adjustment.d.ts +123 -0
- package/dist/inventory/api/adjustment.js +120 -0
- package/dist/inventory/api/availability.d.ts +70 -0
- package/dist/inventory/api/availability.js +47 -0
- package/dist/inventory/api/cost.d.ts +58 -0
- package/dist/inventory/api/cost.js +34 -0
- package/dist/inventory/api/index.d.ts +18 -0
- package/dist/inventory/api/lot.d.ts +82 -0
- package/dist/inventory/api/lot.js +46 -0
- package/dist/inventory/api/movement.d.ts +71 -0
- package/dist/inventory/api/movement.js +75 -0
- package/dist/inventory/api/package.d.ts +97 -0
- package/dist/inventory/api/package.js +56 -0
- package/dist/inventory/api/procurement.d.ts +110 -0
- package/dist/inventory/api/procurement.js +59 -0
- package/dist/inventory/api/purchase.d.ts +106 -0
- package/dist/inventory/api/purchase.js +115 -0
- package/dist/inventory/api/replenishment.d.ts +145 -0
- package/dist/inventory/api/replenishment.js +63 -0
- package/dist/inventory/api/report.d.ts +102 -0
- package/dist/inventory/api/report.js +54 -0
- package/dist/inventory/api/request.d.ts +157 -0
- package/dist/inventory/api/request.js +140 -0
- package/dist/inventory/api/reservation.d.ts +77 -0
- package/dist/inventory/api/reservation.js +51 -0
- package/dist/inventory/api/scan.d.ts +29 -0
- package/dist/inventory/api/scan.js +30 -0
- package/dist/inventory/api/supplier.d.ts +9 -0
- package/dist/inventory/api/supplier.js +24 -0
- package/dist/inventory/api/trace.d.ts +71 -0
- package/dist/inventory/api/trace.js +39 -0
- package/dist/inventory/api/transfer.d.ts +162 -0
- package/dist/inventory/api/transfer.js +155 -0
- package/dist/inventory/api/warehouse.d.ts +199 -0
- package/dist/inventory/api/warehouse.js +155 -0
- package/dist/inventory/hooks/adjustment.d.ts +24 -0
- package/dist/inventory/hooks/adjustment.js +30 -0
- package/dist/inventory/hooks/availability.d.ts +16 -0
- package/dist/inventory/hooks/availability.js +35 -0
- package/dist/inventory/hooks/cost.d.ts +21 -0
- package/dist/inventory/hooks/cost.js +50 -0
- package/dist/inventory/hooks/index.d.ts +18 -0
- package/dist/inventory/hooks/inventory.d.ts +130 -0
- package/dist/inventory/hooks/inventory.js +267 -0
- package/dist/inventory/hooks/lot.d.ts +26 -0
- package/dist/inventory/hooks/lot.js +67 -0
- package/dist/inventory/hooks/movement.d.ts +68 -0
- package/dist/inventory/hooks/movement.js +106 -0
- package/dist/inventory/hooks/package.d.ts +32 -0
- package/dist/inventory/hooks/package.js +80 -0
- package/dist/inventory/hooks/procurement.d.ts +28 -0
- package/dist/inventory/hooks/procurement.js +87 -0
- package/dist/inventory/hooks/purchase.d.ts +63 -0
- package/dist/inventory/hooks/purchase.js +119 -0
- package/dist/inventory/hooks/replenishment.d.ts +34 -0
- package/dist/inventory/hooks/replenishment.js +87 -0
- package/dist/inventory/hooks/report.d.ts +37 -0
- package/dist/inventory/hooks/report.js +79 -0
- package/dist/inventory/hooks/request.d.ts +113 -0
- package/dist/inventory/hooks/request.js +218 -0
- package/dist/inventory/hooks/reservation.d.ts +25 -0
- package/dist/inventory/hooks/reservation.js +56 -0
- package/dist/inventory/hooks/scan.d.ts +14 -0
- package/dist/inventory/hooks/scan.js +22 -0
- package/dist/inventory/hooks/supplier.d.ts +24 -0
- package/dist/inventory/hooks/supplier.js +30 -0
- package/dist/inventory/hooks/trace.d.ts +19 -0
- package/dist/inventory/hooks/trace.js +55 -0
- package/dist/inventory/hooks/transfer.d.ts +90 -0
- package/dist/inventory/hooks/transfer.js +197 -0
- package/dist/inventory/hooks/warehouse.d.ts +87 -0
- package/dist/inventory/hooks/warehouse.js +240 -0
- package/dist/inventory/index.d.ts +39 -512
- package/dist/inventory/index.js +37 -16
- package/dist/inventory/types/index.d.ts +3 -0
- package/dist/inventory/types/inventory.d.ts +485 -0
- package/dist/inventory/types/supplier.d.ts +90 -0
- package/dist/inventory/types/warehouse.d.ts +182 -0
- package/dist/logistics/api/index.d.ts +1 -0
- package/dist/logistics/api/logistics.d.ts +260 -0
- package/dist/logistics/api/logistics.js +249 -0
- package/dist/logistics/hooks/index.d.ts +1 -0
- package/dist/logistics/hooks/logistics.d.ts +252 -0
- package/dist/logistics/hooks/logistics.js +370 -0
- package/dist/logistics/index.d.ts +4 -248
- package/dist/logistics/index.js +4 -7
- package/dist/logistics/types/logistics.d.ts +188 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/hydration-C-jfQLut.d.ts +270 -0
- package/dist/notifications/api/notification.d.ts +15 -0
- package/dist/notifications/api/notification.js +43 -0
- package/dist/notifications/hooks/notification.d.ts +34 -0
- package/dist/notifications/hooks/notification.js +86 -0
- package/dist/notifications/hooks/stream.d.ts +22 -0
- package/dist/notifications/hooks/stream.js +80 -0
- package/dist/notifications/index.d.ts +5 -0
- package/dist/notifications/index.js +5 -0
- package/dist/notifications/types/index.d.ts +57 -0
- package/dist/payments/api/index.d.ts +1 -0
- package/dist/payments/api/payment.d.ts +89 -0
- package/dist/payments/api/payment.js +93 -0
- package/dist/payments/hooks/payment.d.ts +53 -0
- package/dist/payments/hooks/payment.js +93 -0
- package/dist/payments/index.d.ts +4 -55
- package/dist/payments/index.js +4 -6
- package/dist/payments/types/payment.d.ts +50 -0
- package/dist/permissions/checker.d.ts +125 -0
- package/dist/permissions/checker.js +150 -0
- package/dist/permissions/index.d.ts +3 -0
- package/dist/permissions/index.js +4 -0
- package/dist/permissions/roles.d.ts +39 -0
- package/dist/permissions/roles.js +66 -0
- package/dist/platform/api/branch.d.ts +57 -0
- package/dist/platform/api/branch.js +73 -0
- package/dist/platform/api/config.d.ts +67 -0
- package/dist/platform/api/config.js +83 -0
- package/dist/platform/api/features.d.ts +15 -0
- package/dist/platform/api/features.js +20 -0
- package/dist/platform/api/index.d.ts +6 -0
- package/dist/platform/api/promo.d.ts +286 -0
- package/dist/platform/api/promo.js +276 -0
- package/dist/platform/api/user.d.ts +10 -0
- package/dist/platform/api/user.js +29 -0
- package/dist/platform/api/webhook.d.ts +102 -0
- package/dist/platform/api/webhook.js +124 -0
- package/dist/platform/hooks/branch.d.ts +24 -0
- package/dist/platform/hooks/branch.js +31 -0
- package/dist/platform/hooks/config.d.ts +61 -0
- package/dist/platform/hooks/config.js +100 -0
- package/dist/platform/hooks/features.d.ts +22 -0
- package/dist/platform/hooks/features.js +75 -0
- package/dist/platform/hooks/index.d.ts +6 -0
- package/dist/platform/hooks/promo.d.ts +218 -0
- package/dist/platform/hooks/promo.js +451 -0
- package/dist/platform/hooks/user.d.ts +24 -0
- package/dist/platform/hooks/user.js +30 -0
- package/dist/platform/index.d.ts +18 -645
- package/dist/platform/index.js +14 -8
- package/dist/platform/prefetch.d.ts +9 -0
- package/dist/platform/prefetch.js +11 -0
- package/dist/platform/types/branch.d.ts +110 -0
- package/dist/platform/types/branch.js +16 -0
- package/dist/platform/types/config.d.ts +137 -0
- package/dist/platform/types/features.d.ts +46 -0
- package/dist/platform/types/promo.d.ts +260 -0
- package/dist/platform/types/user.d.ts +72 -0
- package/dist/platform/types/webhook.d.ts +165 -0
- package/dist/sales/api/cart.d.ts +34 -0
- package/dist/sales/api/cart.js +38 -0
- package/dist/sales/api/customer.d.ts +40 -0
- package/dist/sales/api/customer.js +52 -0
- package/dist/sales/api/earning-rules.d.ts +54 -0
- package/dist/sales/api/earning-rules.js +56 -0
- package/dist/sales/api/index.d.ts +9 -0
- package/dist/sales/api/loyalty.d.ts +54 -0
- package/dist/sales/api/loyalty.js +57 -0
- package/dist/sales/api/order.d.ts +147 -0
- package/dist/sales/api/order.js +69 -0
- package/dist/sales/api/pos.d.ts +81 -0
- package/dist/sales/api/pos.js +95 -0
- package/dist/sales/api/referrals.d.ts +63 -0
- package/dist/sales/api/referrals.js +62 -0
- package/dist/sales/api/tiers.d.ts +66 -0
- package/dist/sales/api/tiers.js +59 -0
- package/dist/sales/hooks/cart.d.ts +50 -0
- package/dist/sales/hooks/cart.js +161 -0
- package/dist/sales/hooks/customer.d.ts +100 -0
- package/dist/sales/hooks/customer.js +130 -0
- package/dist/sales/hooks/earning-rules.d.ts +31 -0
- package/dist/sales/hooks/earning-rules.js +112 -0
- package/dist/sales/hooks/index.d.ts +8 -0
- package/dist/sales/hooks/loyalty.d.ts +51 -0
- package/dist/sales/hooks/loyalty.js +122 -0
- package/dist/sales/hooks/order.d.ts +219 -0
- package/dist/sales/hooks/order.js +401 -0
- package/dist/sales/hooks/pos.d.ts +87 -0
- package/dist/sales/hooks/pos.js +222 -0
- package/dist/sales/hooks/referrals.d.ts +34 -0
- package/dist/sales/hooks/referrals.js +132 -0
- package/dist/sales/hooks/tiers.d.ts +32 -0
- package/dist/sales/hooks/tiers.js +144 -0
- package/dist/sales/index.d.ts +25 -587
- package/dist/sales/index.js +19 -9
- package/dist/sales/prefetch.d.ts +10 -0
- package/dist/sales/prefetch.js +13 -0
- package/dist/sales/types/cart.d.ts +123 -0
- package/dist/sales/types/customer.d.ts +119 -0
- package/dist/sales/types/earning-rules.d.ts +75 -0
- package/dist/sales/types/index.d.ts +8 -0
- package/dist/sales/types/loyalty.d.ts +120 -0
- package/dist/sales/types/order.d.ts +487 -0
- package/dist/sales/types/order.js +22 -0
- package/dist/sales/types/pos.d.ts +227 -0
- package/dist/sales/types/referrals.d.ts +51 -0
- package/dist/sales/types/tiers.d.ts +56 -0
- package/dist/server.d.ts +41 -23
- package/dist/server.js +41 -36
- package/dist/transaction/api/index.d.ts +1 -0
- package/dist/transaction/api/transaction.d.ts +63 -0
- package/dist/transaction/api/transaction.js +84 -0
- package/dist/transaction/hooks/index.d.ts +1 -0
- package/dist/transaction/hooks/transaction.d.ts +106 -0
- package/dist/transaction/hooks/transaction.js +156 -0
- package/dist/transaction/index.d.ts +4 -104
- package/dist/transaction/index.js +5 -8
- package/dist/transaction/types/transaction.d.ts +440 -0
- package/dist/transaction/types/transaction.js +86 -0
- package/package.json +36 -25
- package/dist/adjustment-MNH3AT6S.js +0 -5
- package/dist/adjustment-MNH3AT6S.js.map +0 -1
- package/dist/analytics/index.js.map +0 -1
- package/dist/analytics-DMcD-o8w.d.ts +0 -76
- package/dist/api-factory-B_h4RKBm.d.ts +0 -280
- package/dist/auth/index.js.map +0 -1
- package/dist/catalog/index.js.map +0 -1
- package/dist/chunk-24FDD6UR.js +0 -75
- package/dist/chunk-24FDD6UR.js.map +0 -1
- package/dist/chunk-2TF7QNYV.js +0 -159
- package/dist/chunk-2TF7QNYV.js.map +0 -1
- package/dist/chunk-2YAZ5WG6.js +0 -479
- package/dist/chunk-2YAZ5WG6.js.map +0 -1
- package/dist/chunk-36NLLAVH.js +0 -177
- package/dist/chunk-36NLLAVH.js.map +0 -1
- package/dist/chunk-3OYSJB3P.js +0 -126
- package/dist/chunk-3OYSJB3P.js.map +0 -1
- package/dist/chunk-5E57JODA.js +0 -135
- package/dist/chunk-5E57JODA.js.map +0 -1
- package/dist/chunk-7LZCW4VF.js +0 -13
- package/dist/chunk-7LZCW4VF.js.map +0 -1
- package/dist/chunk-ANYGZ6O5.js +0 -830
- package/dist/chunk-ANYGZ6O5.js.map +0 -1
- package/dist/chunk-AQAISI4F.js +0 -183
- package/dist/chunk-AQAISI4F.js.map +0 -1
- package/dist/chunk-B6MPVOV7.js +0 -328
- package/dist/chunk-B6MPVOV7.js.map +0 -1
- package/dist/chunk-CILP56G2.js +0 -94
- package/dist/chunk-CILP56G2.js.map +0 -1
- package/dist/chunk-ERQ52WHY.js +0 -534
- package/dist/chunk-ERQ52WHY.js.map +0 -1
- package/dist/chunk-FOTUJPM4.js +0 -640
- package/dist/chunk-FOTUJPM4.js.map +0 -1
- package/dist/chunk-IHCBBLLW.js +0 -198
- package/dist/chunk-IHCBBLLW.js.map +0 -1
- package/dist/chunk-J4JBQET2.js +0 -76
- package/dist/chunk-J4JBQET2.js.map +0 -1
- package/dist/chunk-L4OEI4VZ.js +0 -123
- package/dist/chunk-L4OEI4VZ.js.map +0 -1
- package/dist/chunk-LRV7MWWX.js +0 -616
- package/dist/chunk-LRV7MWWX.js.map +0 -1
- package/dist/chunk-N43VE355.js +0 -126
- package/dist/chunk-N43VE355.js.map +0 -1
- package/dist/chunk-PYYLHUV6.js +0 -3
- package/dist/chunk-PYYLHUV6.js.map +0 -1
- package/dist/chunk-QCTXAMLA.js +0 -261
- package/dist/chunk-QCTXAMLA.js.map +0 -1
- package/dist/chunk-RIKAPJNG.js +0 -40
- package/dist/chunk-RIKAPJNG.js.map +0 -1
- package/dist/chunk-U3XT35GZ.js +0 -202
- package/dist/chunk-U3XT35GZ.js.map +0 -1
- package/dist/chunk-W22WB3WZ.js +0 -148
- package/dist/chunk-W22WB3WZ.js.map +0 -1
- package/dist/chunk-WTIJMKML.js +0 -27
- package/dist/chunk-WTIJMKML.js.map +0 -1
- package/dist/chunk-X2CQFJPR.js +0 -75
- package/dist/chunk-X2CQFJPR.js.map +0 -1
- package/dist/chunk-YYFKLOKO.js +0 -769
- package/dist/chunk-YYFKLOKO.js.map +0 -1
- package/dist/client-Cs7E_usr.d.ts +0 -113
- package/dist/content/index.js.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/react.d.ts +0 -107
- package/dist/core/react.js +0 -5
- package/dist/core/react.js.map +0 -1
- package/dist/coupon-BZSZ0y3n.d.ts +0 -129
- package/dist/coupon-CDzL4bJG.d.ts +0 -655
- package/dist/crud.factory-DyKaPHcU.d.ts +0 -181
- package/dist/finance/index.js.map +0 -1
- package/dist/finance-BJdfKRw0.d.ts +0 -135
- package/dist/index.js.map +0 -1
- package/dist/inventory/index.js.map +0 -1
- package/dist/inventory-B5pssqRx.d.ts +0 -748
- package/dist/logistics/index.js.map +0 -1
- package/dist/logistics-CrpKadKE.d.ts +0 -410
- package/dist/media-CNLJK93J.d.ts +0 -721
- package/dist/movement-R3CERFAM.js +0 -5
- package/dist/movement-R3CERFAM.js.map +0 -1
- package/dist/order-B3dCvHgK.d.ts +0 -360
- package/dist/payment-BRboLqvU.d.ts +0 -127
- package/dist/payments/index.js.map +0 -1
- package/dist/platform/index.js.map +0 -1
- package/dist/pos-BCqkx2-K.d.ts +0 -527
- package/dist/product-p09zXkXB.d.ts +0 -260
- package/dist/purchase-54PER2PY.js +0 -5
- package/dist/purchase-54PER2PY.js.map +0 -1
- package/dist/request-MP6NV5ZE.js +0 -5
- package/dist/request-MP6NV5ZE.js.map +0 -1
- package/dist/sales/index.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/size-guide-DgjzjM5P.d.ts +0 -554
- package/dist/stock-2LP4HJSB.js +0 -5
- package/dist/stock-2LP4HJSB.js.map +0 -1
- package/dist/stock-CfrU5_Wr.d.ts +0 -632
- package/dist/supplier-BWJTRZ5Z.js +0 -5
- package/dist/supplier-BWJTRZ5Z.js.map +0 -1
- package/dist/transaction/index.js.map +0 -1
- package/dist/transaction-Bf6WjYCh.d.ts +0 -84
- package/dist/transaction-dL3WW-er.d.ts +0 -442
- package/dist/transfer-4XSS6HWT.js +0 -5
- package/dist/transfer-4XSS6HWT.js.map +0 -1
- package/dist/user-data-DdLjAGwO.d.ts +0 -132
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { handleApiRequest } from "../../core/api-handler.js";
|
|
2
|
+
|
|
3
|
+
//#region src/platform/api/webhook.ts
|
|
4
|
+
/**
|
|
5
|
+
* Payment Webhook API
|
|
6
|
+
*
|
|
7
|
+
* Handles manual payment verification/rejection for superadmins.
|
|
8
|
+
*
|
|
9
|
+
* Routes:
|
|
10
|
+
* - POST /webhooks/payments/manual/verify - Verify manual payment (superadmin)
|
|
11
|
+
* - POST /webhooks/payments/manual/reject - Reject manual payment (superadmin)
|
|
12
|
+
*
|
|
13
|
+
* Note: Provider webhooks (POST /webhooks/payments/:provider) are called
|
|
14
|
+
* directly by payment providers (Stripe, SSLCommerz, etc.) and don't need
|
|
15
|
+
* a frontend client method.
|
|
16
|
+
*/
|
|
17
|
+
var WebhookApi = class {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.baseUrl = "/webhooks/payments";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Verify a manual payment (superadmin only)
|
|
23
|
+
* POST /webhooks/payments/manual/verify
|
|
24
|
+
*
|
|
25
|
+
* Flow:
|
|
26
|
+
* 1. Customer places order with manual payment (cash, bKash, Nagad, bank)
|
|
27
|
+
* 2. Customer pays and provides transaction reference
|
|
28
|
+
* 3. Admin verifies payment via this endpoint
|
|
29
|
+
* 4. Transaction status -> 'verified'
|
|
30
|
+
* 5. Order payment status -> 'verified', order status -> 'confirmed'
|
|
31
|
+
*
|
|
32
|
+
* @param params.transactionId - Transaction ID to verify
|
|
33
|
+
* @param params.notes - Optional verification notes
|
|
34
|
+
* @param params.token - Auth token (superadmin required)
|
|
35
|
+
* @param params.options - Additional fetch options
|
|
36
|
+
* @returns Verification result with transaction details
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const result = await webhookApi.verifyPayment({
|
|
41
|
+
* token: adminToken,
|
|
42
|
+
* transactionId: '507f1f77bcf86cd799439011',
|
|
43
|
+
* notes: 'Verified bKash TrxID via app',
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
async verifyPayment({ token, transactionId, notes, options = {} }) {
|
|
48
|
+
if (!transactionId) throw new Error("Transaction ID is required");
|
|
49
|
+
if (!token) throw new Error("Authentication required");
|
|
50
|
+
const body = { transactionId };
|
|
51
|
+
if (notes) body.notes = notes;
|
|
52
|
+
return handleApiRequest("POST", `${this.baseUrl}/manual/verify`, {
|
|
53
|
+
token,
|
|
54
|
+
body,
|
|
55
|
+
cache: "no-store",
|
|
56
|
+
...options
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Reject a manual payment (superadmin only)
|
|
61
|
+
* POST /webhooks/payments/manual/reject
|
|
62
|
+
*
|
|
63
|
+
* Flow:
|
|
64
|
+
* 1. Customer claims to have paid but admin finds issue
|
|
65
|
+
* 2. Admin rejects payment with reason via this endpoint
|
|
66
|
+
* 3. Transaction status -> 'failed', failureReason recorded
|
|
67
|
+
* 4. Order payment status -> 'failed'
|
|
68
|
+
*
|
|
69
|
+
* Common rejection reasons:
|
|
70
|
+
* - Invalid transaction reference
|
|
71
|
+
* - Amount mismatch
|
|
72
|
+
* - Duplicate claim
|
|
73
|
+
* - Suspected fraud
|
|
74
|
+
* - Payment not received
|
|
75
|
+
*
|
|
76
|
+
* @param params.transactionId - Transaction ID to reject
|
|
77
|
+
* @param params.reason - Rejection reason (required)
|
|
78
|
+
* @param params.token - Auth token (superadmin required)
|
|
79
|
+
* @param params.options - Additional fetch options
|
|
80
|
+
* @returns Rejection result with failure details
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const result = await webhookApi.rejectPayment({
|
|
85
|
+
* token: adminToken,
|
|
86
|
+
* transactionId: '507f1f77bcf86cd799439011',
|
|
87
|
+
* reason: 'Invalid bKash TrxID - no matching transaction found',
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
async rejectPayment({ token, transactionId, reason, options = {} }) {
|
|
92
|
+
if (!transactionId) throw new Error("Transaction ID is required");
|
|
93
|
+
if (!reason) throw new Error("Rejection reason is required");
|
|
94
|
+
if (!token) throw new Error("Authentication required");
|
|
95
|
+
const body = {
|
|
96
|
+
transactionId,
|
|
97
|
+
reason
|
|
98
|
+
};
|
|
99
|
+
return handleApiRequest("POST", `${this.baseUrl}/manual/reject`, {
|
|
100
|
+
token,
|
|
101
|
+
body,
|
|
102
|
+
cache: "no-store",
|
|
103
|
+
...options
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Alias for verifyPayment - more explicit naming
|
|
108
|
+
* @deprecated Use verifyPayment instead
|
|
109
|
+
*/
|
|
110
|
+
async verifyManualPayment(params) {
|
|
111
|
+
return this.verifyPayment(params);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Alias for rejectPayment - more explicit naming
|
|
115
|
+
* @deprecated Use rejectPayment instead
|
|
116
|
+
*/
|
|
117
|
+
async rejectManualPayment(params) {
|
|
118
|
+
return this.rejectPayment(params);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const webhookApi = new WebhookApi();
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
export { WebhookApi, webhookApi };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Branch, CreateBranchPayload, UpdateBranchPayload } from "../types/branch.js";
|
|
2
|
+
import * as _classytic_arc_next_query0 from "@classytic/arc-next/query";
|
|
3
|
+
import * as _classytic_arc_next0 from "@classytic/arc-next";
|
|
4
|
+
|
|
5
|
+
//#region src/platform/hooks/branch.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Branch hooks using createCrudHooks factory
|
|
8
|
+
*
|
|
9
|
+
* Provides:
|
|
10
|
+
* - useBranches: List branches with filtering/pagination
|
|
11
|
+
* - useBranchDetail: Get single branch
|
|
12
|
+
* - useBranchActions: Create, update, delete mutations
|
|
13
|
+
* - useBranchNavigation: Navigation between branches
|
|
14
|
+
*/
|
|
15
|
+
declare const branchHooks: _classytic_arc_next0.CrudHooksReturn<Branch, CreateBranchPayload, UpdateBranchPayload>;
|
|
16
|
+
declare const BRANCH_KEYS: _classytic_arc_next_query0.QueryKeys, useBranches: {
|
|
17
|
+
(params?: Record<string, unknown>, options?: _classytic_arc_next_query0.ListQueryOptions<Branch> | undefined): _classytic_arc_next_query0.ListQueryResult<Branch>;
|
|
18
|
+
(token: string | null, params?: Record<string, unknown>, options?: _classytic_arc_next_query0.ListQueryOptions<Branch> | undefined): _classytic_arc_next_query0.ListQueryResult<Branch>;
|
|
19
|
+
}, useBranchDetail: {
|
|
20
|
+
(id: string | null, options?: _classytic_arc_next_query0.DetailQueryOptions<Branch> | undefined): _classytic_arc_next_query0.DetailQueryResult<Branch>;
|
|
21
|
+
(id: string | null, token: string | null, options?: _classytic_arc_next_query0.DetailQueryOptions<Branch> | undefined): _classytic_arc_next_query0.DetailQueryResult<Branch>;
|
|
22
|
+
}, useBranchActions: () => _classytic_arc_next0.CrudActions<Branch, CreateBranchPayload, UpdateBranchPayload>, useBranchNavigation: () => _classytic_arc_next0.NavigateFn<Branch>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { BRANCH_KEYS, branchHooks, useBranchActions, useBranchDetail, useBranchNavigation, useBranches };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createCrudHooks } from "../../core/react/crud.factory.js";
|
|
4
|
+
import { branchApi } from "../api/branch.js";
|
|
5
|
+
|
|
6
|
+
//#region src/platform/hooks/branch.ts
|
|
7
|
+
/**
|
|
8
|
+
* Branch Hooks
|
|
9
|
+
*
|
|
10
|
+
* React hooks for branch CRUD operations using the factory pattern.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Branch hooks using createCrudHooks factory
|
|
14
|
+
*
|
|
15
|
+
* Provides:
|
|
16
|
+
* - useBranches: List branches with filtering/pagination
|
|
17
|
+
* - useBranchDetail: Get single branch
|
|
18
|
+
* - useBranchActions: Create, update, delete mutations
|
|
19
|
+
* - useBranchNavigation: Navigation between branches
|
|
20
|
+
*/
|
|
21
|
+
const branchHooks = createCrudHooks({
|
|
22
|
+
api: branchApi,
|
|
23
|
+
entityKey: "branches",
|
|
24
|
+
singular: "Branch",
|
|
25
|
+
plural: "Branches",
|
|
26
|
+
defaults: { staleTime: 900 * 1e3 }
|
|
27
|
+
});
|
|
28
|
+
const { KEYS: BRANCH_KEYS, useList: useBranches, useDetail: useBranchDetail, useActions: useBranchActions, useNavigation: useBranchNavigation } = branchHooks;
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { BRANCH_KEYS, branchHooks, useBranchActions, useBranchDetail, useBranchNavigation, useBranches };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { QueryKeys } from "../../core/react/query.factory.js";
|
|
2
|
+
import { PlatformConfig, UpdatePlatformConfigPayload } from "../types/config.js";
|
|
3
|
+
import { PermissionMatrix } from "../api/config.js";
|
|
4
|
+
|
|
5
|
+
//#region src/platform/hooks/config.d.ts
|
|
6
|
+
declare const PLATFORM_KEYS: QueryKeys;
|
|
7
|
+
interface QueryOptions {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
staleTime?: number;
|
|
10
|
+
}
|
|
11
|
+
interface UsePlatformConfigReturn {
|
|
12
|
+
config: PlatformConfig | null;
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
isFetching: boolean;
|
|
15
|
+
error: Error | null;
|
|
16
|
+
refetch: () => void;
|
|
17
|
+
}
|
|
18
|
+
interface UsePaymentMethodsReturn {
|
|
19
|
+
paymentMethods: PlatformConfig["paymentMethods"] | null;
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface UseDeliveryZonesReturn {
|
|
23
|
+
deliveryZones: NonNullable<PlatformConfig["checkout"]>["deliveryZones"] | null;
|
|
24
|
+
isLoading: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface UseMembershipConfigReturn {
|
|
27
|
+
membershipConfig: PlatformConfig["membership"] | null;
|
|
28
|
+
isLoading: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface UseUpdatePlatformConfigReturn {
|
|
31
|
+
updateConfig: (data: UpdatePlatformConfigPayload) => Promise<unknown>;
|
|
32
|
+
isUpdating: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get full platform configuration.
|
|
36
|
+
*/
|
|
37
|
+
declare function usePlatformConfig(options?: QueryOptions): UsePlatformConfigReturn;
|
|
38
|
+
/**
|
|
39
|
+
* Update platform configuration (admin only).
|
|
40
|
+
*/
|
|
41
|
+
declare function useUpdatePlatformConfig(): UseUpdatePlatformConfigReturn;
|
|
42
|
+
/** Get payment methods from platform config */
|
|
43
|
+
declare function usePaymentMethods(options?: QueryOptions): UsePaymentMethodsReturn;
|
|
44
|
+
/** Get delivery zones from platform config */
|
|
45
|
+
declare function useDeliveryZones(options?: QueryOptions): UseDeliveryZonesReturn;
|
|
46
|
+
/** Get membership config from platform config */
|
|
47
|
+
declare function useMembershipConfig(options?: QueryOptions): UseMembershipConfigReturn;
|
|
48
|
+
declare const PERMISSION_MATRIX_KEYS: QueryKeys;
|
|
49
|
+
interface UsePermissionMatrixReturn {
|
|
50
|
+
matrix: PermissionMatrix | null;
|
|
51
|
+
isLoading: boolean;
|
|
52
|
+
error: Error | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the full RBAC permission matrix from the backend.
|
|
56
|
+
* Single source of truth — replaces hardcoded SDK permission groups.
|
|
57
|
+
* Cached for 30 minutes (permission config is static).
|
|
58
|
+
*/
|
|
59
|
+
declare function usePermissionMatrix(options?: QueryOptions): UsePermissionMatrixReturn;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { PERMISSION_MATRIX_KEYS, PLATFORM_KEYS, UseDeliveryZonesReturn, UseMembershipConfigReturn, UsePaymentMethodsReturn, UsePermissionMatrixReturn, UsePlatformConfigReturn, UseUpdatePlatformConfigReturn, useDeliveryZones, useMembershipConfig, usePaymentMethods, usePermissionMatrix, usePlatformConfig, useUpdatePlatformConfig };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useMutationWithTransition } from "../../core/react/mutation.factory.js";
|
|
4
|
+
import { createQueryKeys } from "../../core/react/query.factory.js";
|
|
5
|
+
import { platformConfigApi } from "../api/config.js";
|
|
6
|
+
import { useQuery } from "@tanstack/react-query";
|
|
7
|
+
|
|
8
|
+
//#region src/platform/hooks/config.ts
|
|
9
|
+
/**
|
|
10
|
+
* Platform Configuration Hooks
|
|
11
|
+
*
|
|
12
|
+
* Hooks for platform configuration management.
|
|
13
|
+
* Primary source for: payment methods, checkout, VAT, delivery zones, membership.
|
|
14
|
+
*/
|
|
15
|
+
const PLATFORM_KEYS = createQueryKeys("platform-config");
|
|
16
|
+
/**
|
|
17
|
+
* Get full platform configuration.
|
|
18
|
+
*/
|
|
19
|
+
function usePlatformConfig(options = {}) {
|
|
20
|
+
const { data, isLoading, isFetching, error, refetch } = useQuery({
|
|
21
|
+
queryKey: PLATFORM_KEYS.detail("config"),
|
|
22
|
+
queryFn: async () => {
|
|
23
|
+
return (await platformConfigApi.getConfig()).data ?? null;
|
|
24
|
+
},
|
|
25
|
+
enabled: options.enabled !== false,
|
|
26
|
+
staleTime: options.staleTime ?? 300 * 1e3
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
config: data ?? null,
|
|
30
|
+
isLoading,
|
|
31
|
+
isFetching,
|
|
32
|
+
error,
|
|
33
|
+
refetch
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Update platform configuration (admin only).
|
|
38
|
+
*/
|
|
39
|
+
function useUpdatePlatformConfig() {
|
|
40
|
+
const mutation = useMutationWithTransition({
|
|
41
|
+
mutationFn: (data) => platformConfigApi.updateConfig({ data }),
|
|
42
|
+
invalidateQueries: [PLATFORM_KEYS.all],
|
|
43
|
+
messages: {
|
|
44
|
+
success: "Configuration updated successfully",
|
|
45
|
+
error: "Failed to update configuration"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
updateConfig: mutation.mutateAsync,
|
|
50
|
+
isUpdating: mutation.isPending
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Get payment methods from platform config */
|
|
54
|
+
function usePaymentMethods(options = {}) {
|
|
55
|
+
const { config, isLoading } = usePlatformConfig(options);
|
|
56
|
+
return {
|
|
57
|
+
paymentMethods: config?.paymentMethods ?? null,
|
|
58
|
+
isLoading
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Get delivery zones from platform config */
|
|
62
|
+
function useDeliveryZones(options = {}) {
|
|
63
|
+
const { config, isLoading } = usePlatformConfig(options);
|
|
64
|
+
return {
|
|
65
|
+
deliveryZones: config?.checkout?.deliveryZones ?? null,
|
|
66
|
+
isLoading
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Get membership config from platform config */
|
|
70
|
+
function useMembershipConfig(options = {}) {
|
|
71
|
+
const { config, isLoading } = usePlatformConfig(options);
|
|
72
|
+
return {
|
|
73
|
+
membershipConfig: config?.membership ?? null,
|
|
74
|
+
isLoading
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const PERMISSION_MATRIX_KEYS = createQueryKeys("permission-matrix");
|
|
78
|
+
/**
|
|
79
|
+
* Get the full RBAC permission matrix from the backend.
|
|
80
|
+
* Single source of truth — replaces hardcoded SDK permission groups.
|
|
81
|
+
* Cached for 30 minutes (permission config is static).
|
|
82
|
+
*/
|
|
83
|
+
function usePermissionMatrix(options = {}) {
|
|
84
|
+
const { data, isLoading, error } = useQuery({
|
|
85
|
+
queryKey: PERMISSION_MATRIX_KEYS.detail("full"),
|
|
86
|
+
queryFn: async () => {
|
|
87
|
+
return (await platformConfigApi.getPermissionMatrix()).data ?? null;
|
|
88
|
+
},
|
|
89
|
+
enabled: options.enabled !== false,
|
|
90
|
+
staleTime: options.staleTime ?? 1800 * 1e3
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
matrix: data ?? null,
|
|
94
|
+
isLoading,
|
|
95
|
+
error
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { PERMISSION_MATRIX_KEYS, PLATFORM_KEYS, useDeliveryZones, useMembershipConfig, usePaymentMethods, usePermissionMatrix, usePlatformConfig, useUpdatePlatformConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FeatureManifest, FeatureStatus, FeatureTier, PlanInfo } from "../types/features.js";
|
|
2
|
+
|
|
3
|
+
//#region src/platform/hooks/features.d.ts
|
|
4
|
+
declare const FEATURE_KEYS: {
|
|
5
|
+
manifest: readonly ["features", "manifest"];
|
|
6
|
+
};
|
|
7
|
+
declare function useFeatures(): {
|
|
8
|
+
/** Full manifest */manifest: FeatureManifest | undefined; /** Deployment plan info */
|
|
9
|
+
plan: PlanInfo; /** Whether deployment is on trial */
|
|
10
|
+
isTrial: boolean; /** Whether deployment is on a paid plan */
|
|
11
|
+
isPaid: boolean; /** Check if a feature is enabled (any tier) */
|
|
12
|
+
isEnabled: (featureId: string) => boolean; /** Get feature-level status (active, trial, disabled, expired, upgrade_required) */
|
|
13
|
+
getStatus: (featureId: string) => FeatureStatus; /** Check if feature meets a minimum tier (e.g. "standard") */
|
|
14
|
+
hasTier: (featureId: string, minTier: FeatureTier) => boolean; /** Check if a specific capability is available */
|
|
15
|
+
hasCapability: (featureId: string, capability: string) => boolean; /** Get the resolved tier for a feature */
|
|
16
|
+
getTier: (featureId: string) => FeatureTier | null; /** Get all capabilities for a feature */
|
|
17
|
+
getCapabilities: (featureId: string) => string[]; /** List of enabled feature IDs */
|
|
18
|
+
enabled: string[];
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { FEATURE_KEYS, useFeatures };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { featuresApi } from "../api/features.js";
|
|
4
|
+
import { useQuery } from "@tanstack/react-query";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
|
|
7
|
+
//#region src/platform/hooks/features.ts
|
|
8
|
+
/**
|
|
9
|
+
* Feature License Hook
|
|
10
|
+
*
|
|
11
|
+
* Fetches the deployment's feature manifest once on app boot.
|
|
12
|
+
* Supports tier-based gating, plan status, and feature-level status.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const { isEnabled, plan, getStatus } = useFeatures();
|
|
17
|
+
*
|
|
18
|
+
* if (!isEnabled("loyalty")) return null;
|
|
19
|
+
* if (plan.status === "trial") showTrialBanner();
|
|
20
|
+
* if (getStatus("warehouse") === "upgrade_required") showUpgradePrompt();
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
const FEATURE_KEYS = { manifest: ["features", "manifest"] };
|
|
24
|
+
const TIER_RANK = {
|
|
25
|
+
basic: 0,
|
|
26
|
+
standard: 1,
|
|
27
|
+
enterprise: 2
|
|
28
|
+
};
|
|
29
|
+
const DEFAULT_PLAN = {
|
|
30
|
+
status: "trial",
|
|
31
|
+
name: "Trial",
|
|
32
|
+
expiresAt: null,
|
|
33
|
+
daysRemaining: -1
|
|
34
|
+
};
|
|
35
|
+
function useFeatures() {
|
|
36
|
+
const query = useQuery({
|
|
37
|
+
queryKey: FEATURE_KEYS.manifest,
|
|
38
|
+
queryFn: async () => {
|
|
39
|
+
return (await featuresApi.getManifest()).data;
|
|
40
|
+
},
|
|
41
|
+
staleTime: 600 * 1e3,
|
|
42
|
+
gcTime: 1800 * 1e3
|
|
43
|
+
});
|
|
44
|
+
const featureMap = useMemo(() => {
|
|
45
|
+
const map = /* @__PURE__ */ new Map();
|
|
46
|
+
if (query.data?.features) for (const f of query.data.features) map.set(f.id, f);
|
|
47
|
+
return map;
|
|
48
|
+
}, [query.data]);
|
|
49
|
+
const plan = query.data?.plan ?? DEFAULT_PLAN;
|
|
50
|
+
return {
|
|
51
|
+
manifest: query.data,
|
|
52
|
+
plan,
|
|
53
|
+
isTrial: plan.status === "trial",
|
|
54
|
+
isPaid: plan.status === "pro" || plan.status === "enterprise",
|
|
55
|
+
isEnabled: (featureId) => featureMap.get(featureId)?.enabled ?? false,
|
|
56
|
+
getStatus: (featureId) => featureMap.get(featureId)?.status ?? "disabled",
|
|
57
|
+
hasTier: (featureId, minTier) => {
|
|
58
|
+
const f = featureMap.get(featureId);
|
|
59
|
+
if (!f?.enabled) return false;
|
|
60
|
+
return TIER_RANK[f.tier] >= TIER_RANK[minTier];
|
|
61
|
+
},
|
|
62
|
+
hasCapability: (featureId, capability) => {
|
|
63
|
+
const f = featureMap.get(featureId);
|
|
64
|
+
if (!f?.enabled) return false;
|
|
65
|
+
return f.capabilities.includes(capability);
|
|
66
|
+
},
|
|
67
|
+
getTier: (featureId) => featureMap.get(featureId)?.tier ?? null,
|
|
68
|
+
getCapabilities: (featureId) => featureMap.get(featureId)?.capabilities ?? [],
|
|
69
|
+
enabled: query.data?.enabled ?? [],
|
|
70
|
+
isLoading: query.isLoading
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { FEATURE_KEYS, useFeatures };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FeatureManifest, FeatureTier, ResolvedFeature } from "../types/features.js";
|
|
2
|
+
import { PERMISSION_MATRIX_KEYS, PLATFORM_KEYS, UseDeliveryZonesReturn, UseMembershipConfigReturn, UsePaymentMethodsReturn, UsePermissionMatrixReturn, UsePlatformConfigReturn, UseUpdatePlatformConfigReturn, useDeliveryZones, useMembershipConfig, usePaymentMethods, usePermissionMatrix, usePlatformConfig, useUpdatePlatformConfig } from "./config.js";
|
|
3
|
+
import { BRANCH_KEYS, branchHooks, useBranchActions, useBranchDetail, useBranchNavigation, useBranches } from "./branch.js";
|
|
4
|
+
import { USER_KEYS, useUserActions, useUserDetail, useUserNavigation, useUsers, userHooks } from "./user.js";
|
|
5
|
+
import { EVALUATION_KEYS, PROGRAM_KEYS, VOUCHER_KEYS, programHooks, useFullProgram, useProgramActions, useProgramDetail, useProgramNavigation, useProgramRewards, useProgramRules, useProgramTransition, usePrograms, usePromoCommit, usePromoEvaluate, usePromoPreview, usePromoRollback, useVoucherCancel, useVoucherGenerate, useVoucherGenerateSingle, useVoucherValidate } from "./promo.js";
|
|
6
|
+
import { FEATURE_KEYS, useFeatures } from "./features.js";
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { CommitResult, CreateProgramPayload, CreateRewardPayload, CreateRulePayload, EvaluateInput, EvaluationResult, FullProgram, GenerateCodesPayload, GenerateSingleCodePayload, Program, ProgramTransitionAction, Reward, Rule, UpdateRewardPayload, UpdateRulePayload, Voucher, VoucherValidation } from "../types/promo.js";
|
|
2
|
+
import * as _tanstack_react_query0 from "@tanstack/react-query";
|
|
3
|
+
import * as _classytic_arc_next_query0 from "@classytic/arc-next/query";
|
|
4
|
+
import * as _classytic_arc_next0 from "@classytic/arc-next";
|
|
5
|
+
|
|
6
|
+
//#region src/platform/hooks/promo.d.ts
|
|
7
|
+
declare const programHooks: _classytic_arc_next0.CrudHooksReturn<Program, CreateProgramPayload, Partial<CreateProgramPayload>>;
|
|
8
|
+
declare const PROGRAM_KEYS: _classytic_arc_next_query0.QueryKeys, usePrograms: {
|
|
9
|
+
(params?: Record<string, unknown>, options?: _classytic_arc_next_query0.ListQueryOptions<Program> | undefined): _classytic_arc_next_query0.ListQueryResult<Program>;
|
|
10
|
+
(token: string | null, params?: Record<string, unknown>, options?: _classytic_arc_next_query0.ListQueryOptions<Program> | undefined): _classytic_arc_next_query0.ListQueryResult<Program>;
|
|
11
|
+
}, useProgramDetail: {
|
|
12
|
+
(id: string | null, options?: _classytic_arc_next_query0.DetailQueryOptions<Program> | undefined): _classytic_arc_next_query0.DetailQueryResult<Program>;
|
|
13
|
+
(id: string | null, token: string | null, options?: _classytic_arc_next_query0.DetailQueryOptions<Program> | undefined): _classytic_arc_next_query0.DetailQueryResult<Program>;
|
|
14
|
+
}, useProgramActions: () => _classytic_arc_next0.CrudActions<Program, CreateProgramPayload, Partial<CreateProgramPayload>>, useProgramNavigation: () => _classytic_arc_next0.NavigateFn<Program>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetch a program with its rules and rewards pre-loaded
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const { data: program, isLoading } = useFullProgram(token, programId);
|
|
21
|
+
* console.log(program?.rules, program?.rewards);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function useFullProgram(token: string, id: string | undefined, options?: {
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
}): _tanstack_react_query0.UseQueryResult<FullProgram, Error>;
|
|
27
|
+
/**
|
|
28
|
+
* Transition a program status (activate / pause / archive)
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* const { transition, isTransitioning } = useProgramTransition(token);
|
|
33
|
+
* await transition({ id: programId, action: "activate" });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function useProgramTransition(token: string): {
|
|
37
|
+
transition: _tanstack_react_query0.UseMutateAsyncFunction<Program, Error, {
|
|
38
|
+
id: string;
|
|
39
|
+
action: ProgramTransitionAction;
|
|
40
|
+
}, unknown>;
|
|
41
|
+
isTransitioning: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* CRUD mutations for rules on a program
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* const { addRule, updateRule, removeRule } = useProgramRules(token);
|
|
49
|
+
* await addRule({ programId, data: { minimumAmount: 500 } });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare function useProgramRules(token: string): {
|
|
53
|
+
addRule: _tanstack_react_query0.UseMutateAsyncFunction<Rule, Error, {
|
|
54
|
+
programId: string;
|
|
55
|
+
data: CreateRulePayload;
|
|
56
|
+
}, unknown>;
|
|
57
|
+
isAddingRule: boolean;
|
|
58
|
+
updateRule: _tanstack_react_query0.UseMutateAsyncFunction<Rule, Error, {
|
|
59
|
+
programId: string;
|
|
60
|
+
ruleId: string;
|
|
61
|
+
data: UpdateRulePayload;
|
|
62
|
+
}, unknown>;
|
|
63
|
+
isUpdatingRule: boolean;
|
|
64
|
+
removeRule: _tanstack_react_query0.UseMutateAsyncFunction<void, Error, {
|
|
65
|
+
programId: string;
|
|
66
|
+
ruleId: string;
|
|
67
|
+
}, unknown>;
|
|
68
|
+
isRemovingRule: boolean;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* CRUD mutations for rewards on a program
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* const { addReward, updateReward, removeReward } = useProgramRewards(token);
|
|
76
|
+
* await addReward({ programId, data: { rewardType: 'discount', discountMode: 'percentage', discountAmount: 10 } });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
declare function useProgramRewards(token: string): {
|
|
80
|
+
addReward: _tanstack_react_query0.UseMutateAsyncFunction<Reward, Error, {
|
|
81
|
+
programId: string;
|
|
82
|
+
data: CreateRewardPayload;
|
|
83
|
+
}, unknown>;
|
|
84
|
+
isAddingReward: boolean;
|
|
85
|
+
updateReward: _tanstack_react_query0.UseMutateAsyncFunction<Reward, Error, {
|
|
86
|
+
programId: string;
|
|
87
|
+
rewardId: string;
|
|
88
|
+
data: UpdateRewardPayload;
|
|
89
|
+
}, unknown>;
|
|
90
|
+
isUpdatingReward: boolean;
|
|
91
|
+
removeReward: _tanstack_react_query0.UseMutateAsyncFunction<void, Error, {
|
|
92
|
+
programId: string;
|
|
93
|
+
rewardId: string;
|
|
94
|
+
}, unknown>;
|
|
95
|
+
isRemovingReward: boolean;
|
|
96
|
+
};
|
|
97
|
+
declare const VOUCHER_KEYS: {
|
|
98
|
+
all: readonly ["vouchers"];
|
|
99
|
+
detail: (id: string) => readonly ["vouchers", string];
|
|
100
|
+
byCode: (code: string) => readonly ["vouchers", "code", string];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Batch-generate voucher codes
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* const { generate, isGenerating } = useVoucherGenerate(token);
|
|
108
|
+
* const vouchers = await generate({ programId, count: 50 });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
declare function useVoucherGenerate(token: string): {
|
|
112
|
+
generate: _tanstack_react_query0.UseMutateAsyncFunction<Voucher[], Error, GenerateCodesPayload, unknown>;
|
|
113
|
+
isGenerating: boolean;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Generate a single voucher code
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```tsx
|
|
120
|
+
* const { generateSingle, isGenerating } = useVoucherGenerateSingle(token);
|
|
121
|
+
* const voucher = await generateSingle({ programId, code: "WELCOME50" });
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
declare function useVoucherGenerateSingle(token: string): {
|
|
125
|
+
generateSingle: _tanstack_react_query0.UseMutateAsyncFunction<Voucher, Error, GenerateSingleCodePayload, unknown>;
|
|
126
|
+
isGenerating: boolean;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Validate a voucher code
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```tsx
|
|
133
|
+
* const { validate, isValidating } = useVoucherValidate(token);
|
|
134
|
+
* const result = await validate("SUMMER20");
|
|
135
|
+
* if (result.valid) { ... }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
declare function useVoucherValidate(token: string): {
|
|
139
|
+
validate: _tanstack_react_query0.UseMutateAsyncFunction<VoucherValidation, Error, string, unknown>;
|
|
140
|
+
isValidating: boolean;
|
|
141
|
+
result: VoucherValidation | undefined;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Cancel a voucher
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```tsx
|
|
148
|
+
* const { cancel, isCancelling } = useVoucherCancel(token);
|
|
149
|
+
* await cancel(voucherId);
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
declare function useVoucherCancel(token: string): {
|
|
153
|
+
cancel: _tanstack_react_query0.UseMutateAsyncFunction<Voucher, Error, string, unknown>;
|
|
154
|
+
isCancelling: boolean;
|
|
155
|
+
};
|
|
156
|
+
declare const EVALUATION_KEYS: {
|
|
157
|
+
all: readonly ["evaluations"];
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Preview promo evaluation (dry-run, no side effects)
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```tsx
|
|
164
|
+
* const { preview, isPreviewing, result } = usePromoPreview(token);
|
|
165
|
+
* const evaluation = await preview({ items, subtotal: 1500, codes: ["SUMMER20"] });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
declare function usePromoPreview(token: string): {
|
|
169
|
+
preview: _tanstack_react_query0.UseMutateAsyncFunction<EvaluationResult, Error, EvaluateInput, unknown>;
|
|
170
|
+
isPreviewing: boolean;
|
|
171
|
+
result: EvaluationResult | undefined;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Evaluate cart (reserves usage counts, must be committed or rolled back)
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```tsx
|
|
178
|
+
* const { evaluate, isEvaluating } = usePromoEvaluate(token);
|
|
179
|
+
* const result = await evaluate({ items, subtotal: 1500, codes: ["SUMMER20"] });
|
|
180
|
+
* // Later: commit or rollback
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
declare function usePromoEvaluate(token: string): {
|
|
184
|
+
evaluate: _tanstack_react_query0.UseMutateAsyncFunction<EvaluationResult, Error, EvaluateInput, unknown>;
|
|
185
|
+
isEvaluating: boolean;
|
|
186
|
+
result: EvaluationResult | undefined;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Commit an evaluation to an order
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```tsx
|
|
193
|
+
* const { commit, isCommitting } = usePromoCommit(token);
|
|
194
|
+
* await commit({ evaluationId, orderId });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
declare function usePromoCommit(token: string): {
|
|
198
|
+
commit: _tanstack_react_query0.UseMutateAsyncFunction<CommitResult, Error, {
|
|
199
|
+
evaluationId: string;
|
|
200
|
+
orderId: string;
|
|
201
|
+
}, unknown>;
|
|
202
|
+
isCommitting: boolean;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Rollback an uncommitted evaluation
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```tsx
|
|
209
|
+
* const { rollback, isRollingBack } = usePromoRollback(token);
|
|
210
|
+
* await rollback(evaluationId);
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
declare function usePromoRollback(token: string): {
|
|
214
|
+
rollback: _tanstack_react_query0.UseMutateAsyncFunction<void, Error, string, unknown>;
|
|
215
|
+
isRollingBack: boolean;
|
|
216
|
+
};
|
|
217
|
+
//#endregion
|
|
218
|
+
export { EVALUATION_KEYS, PROGRAM_KEYS, VOUCHER_KEYS, programHooks, useFullProgram, useProgramActions, useProgramDetail, useProgramNavigation, useProgramRewards, useProgramRules, useProgramTransition, usePrograms, usePromoCommit, usePromoEvaluate, usePromoPreview, usePromoRollback, useVoucherCancel, useVoucherGenerate, useVoucherGenerateSingle, useVoucherValidate };
|