chore: remove unused variables
This commit is contained in:
@@ -15,11 +15,9 @@ export function useWhatsappEmbeddedSignup() {
|
||||
const isProcessing = ref(false);
|
||||
const processingMessage = ref('');
|
||||
const authCodeReceived = ref(false);
|
||||
const currentStep = ref('initial');
|
||||
const authCode = ref(null);
|
||||
const businessData = ref(null);
|
||||
const isAuthenticating = ref(false);
|
||||
const hasSignupStarted = ref(false);
|
||||
|
||||
// Computed
|
||||
const authHeaders = computed(() => {
|
||||
@@ -58,16 +56,14 @@ export function useWhatsappEmbeddedSignup() {
|
||||
]);
|
||||
|
||||
const showLoader = computed(
|
||||
() => hasSignupStarted.value || isProcessing.value
|
||||
() => isAuthenticating.value || isProcessing.value
|
||||
);
|
||||
|
||||
// Error handling
|
||||
const handleSignupError = data => {
|
||||
currentStep.value = 'initial';
|
||||
isProcessing.value = false;
|
||||
authCodeReceived.value = false;
|
||||
isAuthenticating.value = false;
|
||||
hasSignupStarted.value = false;
|
||||
|
||||
const errorMessage =
|
||||
data.error ||
|
||||
@@ -77,11 +73,9 @@ export function useWhatsappEmbeddedSignup() {
|
||||
};
|
||||
|
||||
const handleSignupCancellation = data => {
|
||||
currentStep.value = 'initial';
|
||||
isProcessing.value = false;
|
||||
authCodeReceived.value = false;
|
||||
isAuthenticating.value = false;
|
||||
hasSignupStarted.value = false;
|
||||
|
||||
let message = t('INBOX_MGMT.ADD.WHATSAPP.EMBEDDED_SIGNUP.CANCELLED');
|
||||
if (data.data?.current_step) {
|
||||
@@ -92,7 +86,6 @@ export function useWhatsappEmbeddedSignup() {
|
||||
};
|
||||
|
||||
const handleSignupSuccess = inboxData => {
|
||||
currentStep.value = 'completed';
|
||||
isProcessing.value = false;
|
||||
isAuthenticating.value = false;
|
||||
|
||||
@@ -128,7 +121,6 @@ export function useWhatsappEmbeddedSignup() {
|
||||
return;
|
||||
}
|
||||
|
||||
currentStep.value = 'processing';
|
||||
isProcessing.value = true;
|
||||
processingMessage.value = t(
|
||||
'INBOX_MGMT.ADD.WHATSAPP.EMBEDDED_SIGNUP.PROCESSING'
|
||||
@@ -210,7 +202,6 @@ export function useWhatsappEmbeddedSignup() {
|
||||
if (authCodeReceived.value && authCode.value) {
|
||||
await completeSignupFlow(normalizedData);
|
||||
} else {
|
||||
currentStep.value = 'waiting_for_auth';
|
||||
processingMessage.value = t(
|
||||
'INBOX_MGMT.ADD.WHATSAPP.EMBEDDED_SIGNUP.WAITING_FOR_AUTH'
|
||||
);
|
||||
@@ -240,7 +231,6 @@ export function useWhatsappEmbeddedSignup() {
|
||||
// Authorization code received from Facebook
|
||||
authCode.value = response.authResponse.code;
|
||||
authCodeReceived.value = true;
|
||||
currentStep.value = 'auth_received';
|
||||
processingMessage.value = t(
|
||||
'INBOX_MGMT.ADD.WHATSAPP.EMBEDDED_SIGNUP.WAITING_FOR_BUSINESS_INFO'
|
||||
);
|
||||
@@ -252,10 +242,8 @@ export function useWhatsappEmbeddedSignup() {
|
||||
} else if (response.error) {
|
||||
handleSignupError({ error: response.error });
|
||||
} else {
|
||||
currentStep.value = 'initial';
|
||||
isProcessing.value = false;
|
||||
isAuthenticating.value = false;
|
||||
hasSignupStarted.value = false;
|
||||
useAlert(t('INBOX_MGMT.ADD.WHATSAPP.EMBEDDED_SIGNUP.CANCELLED'));
|
||||
}
|
||||
};
|
||||
@@ -305,7 +293,6 @@ export function useWhatsappEmbeddedSignup() {
|
||||
};
|
||||
|
||||
const launchEmbeddedSignup = () => {
|
||||
hasSignupStarted.value = true;
|
||||
processingMessage.value = t(
|
||||
'INBOX_MGMT.ADD.WHATSAPP.EMBEDDED_SIGNUP.AUTH_PROCESSING'
|
||||
);
|
||||
@@ -317,7 +304,6 @@ export function useWhatsappEmbeddedSignup() {
|
||||
}
|
||||
|
||||
isAuthenticating.value = true;
|
||||
currentStep.value = 'auth_processing';
|
||||
|
||||
// Following Facebook's embedded signup documentation
|
||||
window.FB.login(fbLoginCallback, {
|
||||
@@ -353,11 +339,9 @@ export function useWhatsappEmbeddedSignup() {
|
||||
isProcessing,
|
||||
processingMessage,
|
||||
authCodeReceived,
|
||||
currentStep,
|
||||
authCode,
|
||||
businessData,
|
||||
isAuthenticating,
|
||||
hasSignupStarted,
|
||||
|
||||
// Computed
|
||||
benefits,
|
||||
|
||||
@@ -284,16 +284,12 @@
|
||||
"AUTO_CONFIG": "Automatic webhook and phone number configuration"
|
||||
},
|
||||
"SUBMIT_BUTTON": "Connect with WhatsApp Business",
|
||||
"AUTH_PROCESSING": "Authenticating with Meta...",
|
||||
"AUTH_PROCESSING": "Authenticating with Meta",
|
||||
"WAITING_FOR_BUSINESS_INFO": "Please complete business setup in the Meta window...",
|
||||
"PROCESSING": "Setting up your WhatsApp Business Account...",
|
||||
"PROCESSING": "Setting up your WhatsApp Business Account",
|
||||
"LOADING_SDK": "Loading Facebook SDK...",
|
||||
"CANCELLED": "WhatsApp signup was cancelled",
|
||||
"STEP_AUTH": "Step 1: Authenticating with Meta",
|
||||
"STEP_BUSINESS": "Step 2: Selecting business account",
|
||||
"STEP_CREATING": "Step 3: Creating WhatsApp channel",
|
||||
"CANCELLED": "WhatsApp Signup was cancelled",
|
||||
"SUCCESS_TITLE": "WhatsApp Business Account Connected!",
|
||||
"SUCCESS_DESC": "Your WhatsApp Business Account has been successfully connected. Please provide a name for your inbox to complete the setup.",
|
||||
"WAITING_FOR_AUTH": "Waiting for authentication...",
|
||||
"INVALID_BUSINESS_DATA": "Invalid business data received from Facebook. Please try again.",
|
||||
"SIGNUP_ERROR": "Signup error occurred",
|
||||
|
||||
Reference in New Issue
Block a user