azirid-react 0.9.7 → 0.9.9
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 +6 -4
- package/dist/index.cjs +13 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +13 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -738,9 +738,8 @@ declare global {
|
|
|
738
738
|
* Internal widget renderer — loads Payphone SDK and mounts PPaymentButtonBox.
|
|
739
739
|
* Used by usePayphoneCheckout, usePayButton hooks and PayphoneModal component.
|
|
740
740
|
*/
|
|
741
|
-
declare function PayphoneWidgetRenderer({ config,
|
|
741
|
+
declare function PayphoneWidgetRenderer({ config, containerId, onReady, onError, }: {
|
|
742
742
|
config: PayphoneWidgetConfig;
|
|
743
|
-
responseUrl: string;
|
|
744
743
|
containerId: string;
|
|
745
744
|
onReady?: () => void;
|
|
746
745
|
onError?: (error: Error) => void;
|
|
@@ -1952,7 +1951,6 @@ interface TransferModalProps {
|
|
|
1952
1951
|
|
|
1953
1952
|
interface PayphoneModalProps {
|
|
1954
1953
|
config: PayphoneWidgetConfig;
|
|
1955
|
-
successUrl: string;
|
|
1956
1954
|
onClose: () => void;
|
|
1957
1955
|
}
|
|
1958
1956
|
|
package/dist/index.d.ts
CHANGED
|
@@ -738,9 +738,8 @@ declare global {
|
|
|
738
738
|
* Internal widget renderer — loads Payphone SDK and mounts PPaymentButtonBox.
|
|
739
739
|
* Used by usePayphoneCheckout, usePayButton hooks and PayphoneModal component.
|
|
740
740
|
*/
|
|
741
|
-
declare function PayphoneWidgetRenderer({ config,
|
|
741
|
+
declare function PayphoneWidgetRenderer({ config, containerId, onReady, onError, }: {
|
|
742
742
|
config: PayphoneWidgetConfig;
|
|
743
|
-
responseUrl: string;
|
|
744
743
|
containerId: string;
|
|
745
744
|
onReady?: () => void;
|
|
746
745
|
onError?: (error: Error) => void;
|
|
@@ -1952,7 +1951,6 @@ interface TransferModalProps {
|
|
|
1952
1951
|
|
|
1953
1952
|
interface PayphoneModalProps {
|
|
1954
1953
|
config: PayphoneWidgetConfig;
|
|
1955
|
-
successUrl: string;
|
|
1956
1954
|
onClose: () => void;
|
|
1957
1955
|
}
|
|
1958
1956
|
|
package/dist/index.js
CHANGED
|
@@ -2295,7 +2295,6 @@ function loadPayphoneSdk() {
|
|
|
2295
2295
|
}
|
|
2296
2296
|
function PayphoneWidgetRenderer({
|
|
2297
2297
|
config,
|
|
2298
|
-
responseUrl,
|
|
2299
2298
|
containerId,
|
|
2300
2299
|
onReady,
|
|
2301
2300
|
onError
|
|
@@ -2317,18 +2316,17 @@ function PayphoneWidgetRenderer({
|
|
|
2317
2316
|
amountWithoutTax: config.amountWithoutTax,
|
|
2318
2317
|
currency: config.currency,
|
|
2319
2318
|
storeId: config.storeId,
|
|
2320
|
-
reference: config.reference
|
|
2321
|
-
responseUrl
|
|
2319
|
+
reference: config.reference
|
|
2322
2320
|
}).render(containerId);
|
|
2323
2321
|
onReady?.();
|
|
2324
2322
|
});
|
|
2325
2323
|
}).catch((err) => {
|
|
2326
2324
|
onError?.(new Error(err instanceof Error ? err.message : "Failed to load Payphone SDK"));
|
|
2327
2325
|
});
|
|
2328
|
-
}, [config,
|
|
2326
|
+
}, [config, containerId, onReady, onError]);
|
|
2329
2327
|
return /* @__PURE__ */ jsx("div", { id: containerId });
|
|
2330
2328
|
}
|
|
2331
|
-
function PayphoneModal({ config,
|
|
2329
|
+
function PayphoneModal({ config, onClose }) {
|
|
2332
2330
|
const [error, setError] = useState(null);
|
|
2333
2331
|
return /* @__PURE__ */ jsx("div", { style: overlayStyle, onClick: onClose, children: /* @__PURE__ */ jsxs("div", { style: cardStyle, onClick: (e) => e.stopPropagation(), children: [
|
|
2334
2332
|
/* @__PURE__ */ jsx("h2", { style: titleStyle, children: "Payphone" }),
|
|
@@ -2337,7 +2335,6 @@ function PayphoneModal({ config, successUrl, onClose }) {
|
|
|
2337
2335
|
PayphoneWidgetRenderer,
|
|
2338
2336
|
{
|
|
2339
2337
|
config,
|
|
2340
|
-
responseUrl: successUrl,
|
|
2341
2338
|
containerId: "pp-button-azirid",
|
|
2342
2339
|
onError: (err) => setError(err.message)
|
|
2343
2340
|
}
|
|
@@ -2862,7 +2859,6 @@ function PricingTable({
|
|
|
2862
2859
|
PayphoneModal,
|
|
2863
2860
|
{
|
|
2864
2861
|
config: payphoneData.widgetConfig,
|
|
2865
|
-
successUrl,
|
|
2866
2862
|
onClose: () => setPayphoneData(null)
|
|
2867
2863
|
}
|
|
2868
2864
|
)
|
|
@@ -2942,7 +2938,6 @@ function usePayButton({
|
|
|
2942
2938
|
const [payphoneConfig, setPayphoneConfig] = useState(null);
|
|
2943
2939
|
const [currentError, setCurrentError] = useState(null);
|
|
2944
2940
|
const payphoneConfirmTriggered = useRef(false);
|
|
2945
|
-
const responseUrl = typeof window !== "undefined" ? window.location.href.split("?")[0] : "";
|
|
2946
2941
|
const params = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
2947
2942
|
const callbackId = params.get("id");
|
|
2948
2943
|
const callbackClientTxId = params.get("clientTransactionId");
|
|
@@ -2993,15 +2988,16 @@ function usePayButton({
|
|
|
2993
2988
|
setSelectedProvider(provider);
|
|
2994
2989
|
setStatus("processing");
|
|
2995
2990
|
setCurrentError(null);
|
|
2991
|
+
const currentUrl = typeof window !== "undefined" ? window.location.href.split("?")[0] : "";
|
|
2996
2992
|
doCheckout({
|
|
2997
2993
|
intentId,
|
|
2998
2994
|
planId,
|
|
2999
2995
|
provider,
|
|
3000
|
-
successUrl:
|
|
3001
|
-
cancelUrl:
|
|
2996
|
+
successUrl: currentUrl,
|
|
2997
|
+
cancelUrl: currentUrl
|
|
3002
2998
|
});
|
|
3003
2999
|
},
|
|
3004
|
-
[doCheckout, intentId, planId
|
|
3000
|
+
[doCheckout, intentId, planId]
|
|
3005
3001
|
);
|
|
3006
3002
|
const { mutate: confirmPayphone } = usePayphoneConfirm({
|
|
3007
3003
|
onSuccess: (data) => {
|
|
@@ -3148,12 +3144,11 @@ function usePayButton({
|
|
|
3148
3144
|
if (!payphoneConfig || isPayphoneCallback) return null;
|
|
3149
3145
|
return PayphoneWidgetRenderer({
|
|
3150
3146
|
config: payphoneConfig,
|
|
3151
|
-
responseUrl,
|
|
3152
3147
|
containerId: PP_CONTAINER_ID,
|
|
3153
3148
|
onError: handleSdkError
|
|
3154
3149
|
});
|
|
3155
3150
|
};
|
|
3156
|
-
}, [payphoneConfig,
|
|
3151
|
+
}, [payphoneConfig, isPayphoneCallback, handleSdkError]);
|
|
3157
3152
|
return {
|
|
3158
3153
|
providers,
|
|
3159
3154
|
checkout,
|
|
@@ -3452,7 +3447,6 @@ function PayButton({
|
|
|
3452
3447
|
PayphoneModal,
|
|
3453
3448
|
{
|
|
3454
3449
|
config: checkoutData.widgetConfig,
|
|
3455
|
-
successUrl,
|
|
3456
3450
|
onClose: () => {
|
|
3457
3451
|
onSuccess?.(checkoutData);
|
|
3458
3452
|
}
|
|
@@ -3976,7 +3970,6 @@ function usePayphoneCheckout({
|
|
|
3976
3970
|
const [currentError, setCurrentError] = useState(null);
|
|
3977
3971
|
const checkoutTriggered = useRef(false);
|
|
3978
3972
|
const confirmTriggered = useRef(false);
|
|
3979
|
-
const responseUrl = typeof window !== "undefined" ? window.location.href.split("?")[0] : "";
|
|
3980
3973
|
const params = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
3981
3974
|
const callbackId = params.get("id");
|
|
3982
3975
|
const callbackClientTxId = params.get("clientTransactionId");
|
|
@@ -4002,10 +3995,10 @@ function usePayphoneCheckout({
|
|
|
4002
3995
|
checkout({
|
|
4003
3996
|
intentId,
|
|
4004
3997
|
provider: "PAYPHONE",
|
|
4005
|
-
successUrl:
|
|
4006
|
-
cancelUrl:
|
|
3998
|
+
successUrl: window.location.href,
|
|
3999
|
+
cancelUrl: window.location.href
|
|
4007
4000
|
});
|
|
4008
|
-
}, [checkout, intentId,
|
|
4001
|
+
}, [checkout, intentId, isCallback]);
|
|
4009
4002
|
const { mutate: confirm } = usePayphoneConfirm({
|
|
4010
4003
|
onSuccess: (data) => {
|
|
4011
4004
|
setStatus(data.status === "confirmed" || data.status === "already_confirmed" ? "confirmed" : "cancelled");
|
|
@@ -4036,12 +4029,11 @@ function usePayphoneCheckout({
|
|
|
4036
4029
|
if (!widgetConfig || isCallback) return null;
|
|
4037
4030
|
return PayphoneWidgetRenderer({
|
|
4038
4031
|
config: widgetConfig,
|
|
4039
|
-
responseUrl,
|
|
4040
4032
|
containerId: CONTAINER_ID,
|
|
4041
4033
|
onError: handleSdkError
|
|
4042
4034
|
});
|
|
4043
4035
|
};
|
|
4044
|
-
}, [widgetConfig,
|
|
4036
|
+
}, [widgetConfig, isCallback, handleSdkError]);
|
|
4045
4037
|
return { PayphoneWidget, status, intentId, error: currentError };
|
|
4046
4038
|
}
|
|
4047
4039
|
function useTransferPayment({
|
|
@@ -4281,7 +4273,7 @@ function usePasswordToggle() {
|
|
|
4281
4273
|
}
|
|
4282
4274
|
|
|
4283
4275
|
// src/index.ts
|
|
4284
|
-
var SDK_VERSION = "0.9.
|
|
4276
|
+
var SDK_VERSION = "0.9.9";
|
|
4285
4277
|
|
|
4286
4278
|
export { AuthForm, AziridProvider, BASE_PATHS, CheckoutButton, ForgotPasswordForm, InvoiceList, LoginForm, PATHS, PayButton, PayphoneCallback, PayphoneWidgetRenderer, PricingTable, ReferralCard, ReferralStats, ResetPasswordForm, SDK_VERSION, SignupForm, SubscriptionBadge, buildPaths, changePasswordSchema, cn, createAccessClient, createForgotPasswordSchema, createLoginSchema, createMutationHook, createResetPasswordConfirmSchema, createSignupSchema, en, es, forgotPasswordSchema, isAuthError, loginSchema, magicLinkRequestSchema, magicLinkVerifySchema, passkeyRegisterStartSchema, removeStyles, resetPasswordConfirmSchema, resolveMessages, signupSchema, socialLoginSchema, useAccessClient, useAzirid, useBootstrap, useBranding, useChangePassword, useCheckout, useFormState, useInvoices, useLogin, useLogout, useMagicLink, useMessages, usePasskeys, usePasswordReset, usePasswordToggle, usePayButton, usePaymentProviders, usePayphoneCheckout, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferPayment, useTransferProofs };
|
|
4287
4279
|
//# sourceMappingURL=index.js.map
|