azirid-react 0.11.0 → 0.11.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/dist/index.cjs +34 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -3
- package/dist/index.d.ts +33 -3
- package/dist/index.js +33 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -127,7 +127,9 @@ var SUFFIXES = {
|
|
|
127
127
|
passwordResetConfirm: "password/reset/confirm",
|
|
128
128
|
referralMe: "referrals/me",
|
|
129
129
|
referralStats: "referrals/stats",
|
|
130
|
-
userTenants: "tenants"
|
|
130
|
+
userTenants: "tenants",
|
|
131
|
+
branches: "branches",
|
|
132
|
+
paymentMethods: "payment-methods"
|
|
131
133
|
};
|
|
132
134
|
var BASE_PATHS = {
|
|
133
135
|
/** Proxy mode (Next.js): requests go to the same origin via route handler */
|
|
@@ -911,7 +913,7 @@ function AziridProviderInner({
|
|
|
911
913
|
user,
|
|
912
914
|
accessToken,
|
|
913
915
|
isAuthenticated: user !== null,
|
|
914
|
-
isLoading: loginMutation.isPending || signupMutation.isPending,
|
|
916
|
+
isLoading: isBootstrapping || loginMutation.isPending || signupMutation.isPending,
|
|
915
917
|
error,
|
|
916
918
|
login,
|
|
917
919
|
signup,
|
|
@@ -3012,6 +3014,8 @@ var PP_CONTAINER_ID = "pp-paybtn-azirid";
|
|
|
3012
3014
|
function usePayButton({
|
|
3013
3015
|
intentId,
|
|
3014
3016
|
planId,
|
|
3017
|
+
branchId,
|
|
3018
|
+
merchantAccountId,
|
|
3015
3019
|
onSuccess,
|
|
3016
3020
|
onError
|
|
3017
3021
|
}) {
|
|
@@ -3076,12 +3080,14 @@ function usePayButton({
|
|
|
3076
3080
|
doCheckout({
|
|
3077
3081
|
intentId,
|
|
3078
3082
|
planId,
|
|
3083
|
+
branchId,
|
|
3084
|
+
merchantAccountId,
|
|
3079
3085
|
provider,
|
|
3080
3086
|
successUrl: currentUrl,
|
|
3081
3087
|
cancelUrl: currentUrl
|
|
3082
3088
|
});
|
|
3083
3089
|
},
|
|
3084
|
-
[doCheckout, intentId, planId]
|
|
3090
|
+
[doCheckout, intentId, planId, branchId, merchantAccountId]
|
|
3085
3091
|
);
|
|
3086
3092
|
const { mutate: confirmPayphone } = usePayphoneConfirm({
|
|
3087
3093
|
onSuccess: (data) => {
|
|
@@ -3784,6 +3790,8 @@ function TransferModal2({ data, onClose, onProofSubmitted, labels }) {
|
|
|
3784
3790
|
function PayButton({
|
|
3785
3791
|
planId,
|
|
3786
3792
|
intentId,
|
|
3793
|
+
branchId,
|
|
3794
|
+
merchantAccountId,
|
|
3787
3795
|
successUrl,
|
|
3788
3796
|
cancelUrl,
|
|
3789
3797
|
className,
|
|
@@ -3809,6 +3817,8 @@ function PayButton({
|
|
|
3809
3817
|
} = usePayButton({
|
|
3810
3818
|
intentId,
|
|
3811
3819
|
planId,
|
|
3820
|
+
branchId,
|
|
3821
|
+
merchantAccountId,
|
|
3812
3822
|
onSuccess: (data) => {
|
|
3813
3823
|
if (data.provider === "MANUAL_TRANSFER") {
|
|
3814
3824
|
setShowTransferModal(true);
|
|
@@ -4189,11 +4199,13 @@ function useLogout(options) {
|
|
|
4189
4199
|
}
|
|
4190
4200
|
function useSession(options) {
|
|
4191
4201
|
const client = useAccessClient();
|
|
4202
|
+
const { isBootstrapping } = useAzirid();
|
|
4192
4203
|
const query = reactQuery.useQuery({
|
|
4193
4204
|
queryKey: ["azirid-access", "session"],
|
|
4194
4205
|
queryFn: () => client.get(client.paths.me),
|
|
4195
4206
|
retry: false,
|
|
4196
|
-
|
|
4207
|
+
// Wait for bootstrap to complete before fetching /me
|
|
4208
|
+
enabled: (options?.enabled ?? true) && !isBootstrapping,
|
|
4197
4209
|
refetchInterval: options?.refetchInterval,
|
|
4198
4210
|
refetchOnWindowFocus: options?.refetchOnWindowFocus ?? false
|
|
4199
4211
|
});
|
|
@@ -4627,6 +4639,21 @@ function useTransferPayment({
|
|
|
4627
4639
|
error: currentError
|
|
4628
4640
|
};
|
|
4629
4641
|
}
|
|
4642
|
+
function useBranches() {
|
|
4643
|
+
const client = useAccessClient();
|
|
4644
|
+
return reactQuery.useQuery({
|
|
4645
|
+
queryKey: ["azirid-access", "branches"],
|
|
4646
|
+
queryFn: () => client.get(client.paths.branches)
|
|
4647
|
+
});
|
|
4648
|
+
}
|
|
4649
|
+
function usePaymentMethods(branchId) {
|
|
4650
|
+
const client = useAccessClient();
|
|
4651
|
+
const path = branchId ? `${client.paths.paymentMethods}?branchId=${encodeURIComponent(branchId)}` : client.paths.paymentMethods;
|
|
4652
|
+
return reactQuery.useQuery({
|
|
4653
|
+
queryKey: ["azirid-access", "payment-methods", branchId ?? null],
|
|
4654
|
+
queryFn: () => client.get(path)
|
|
4655
|
+
});
|
|
4656
|
+
}
|
|
4630
4657
|
function useTenants() {
|
|
4631
4658
|
const client = useAccessClient();
|
|
4632
4659
|
return reactQuery.useQuery({
|
|
@@ -4719,7 +4746,7 @@ function usePasswordToggle() {
|
|
|
4719
4746
|
}
|
|
4720
4747
|
|
|
4721
4748
|
// src/index.ts
|
|
4722
|
-
var SDK_VERSION = "0.11.
|
|
4749
|
+
var SDK_VERSION = "0.11.1";
|
|
4723
4750
|
|
|
4724
4751
|
exports.AuthForm = AuthForm;
|
|
4725
4752
|
exports.AziridProvider = AziridProvider;
|
|
@@ -4764,6 +4791,7 @@ exports.socialLoginSchema = socialLoginSchema;
|
|
|
4764
4791
|
exports.useAccessClient = useAccessClient;
|
|
4765
4792
|
exports.useAzirid = useAzirid;
|
|
4766
4793
|
exports.useBootstrap = useBootstrap;
|
|
4794
|
+
exports.useBranches = useBranches;
|
|
4767
4795
|
exports.useBranding = useBranding;
|
|
4768
4796
|
exports.useChangePassword = useChangePassword;
|
|
4769
4797
|
exports.useCheckout = useCheckout;
|
|
@@ -4777,6 +4805,7 @@ exports.usePasskeys = usePasskeys;
|
|
|
4777
4805
|
exports.usePasswordReset = usePasswordReset;
|
|
4778
4806
|
exports.usePasswordToggle = usePasswordToggle;
|
|
4779
4807
|
exports.usePayButton = usePayButton;
|
|
4808
|
+
exports.usePaymentMethods = usePaymentMethods;
|
|
4780
4809
|
exports.usePaymentProviders = usePaymentProviders;
|
|
4781
4810
|
exports.usePayphoneCheckout = usePayphoneCheckout;
|
|
4782
4811
|
exports.usePayphoneConfirm = usePayphoneConfirm;
|