import { EventEmitter, JSX } from '../../stencil-public-runtime';
export interface Address {
id: string;
name: string;
firstName: string;
lastName: string;
street: string;
city: string;
state: string;
zip: string;
pincode?: string;
country: string;
countryCode: string;
phone: string;
default: boolean;
}
export interface AddAddressPayload {
session_id: string;
firstName: string;
lastName: string;
mobileNumber: string;
mobileNumberCode: string;
mobileNumberSortCode: string;
addLine1: string;
pincode: string;
latitude: number;
longitude: number;
city: string;
state: string;
country: string;
countryCode: string;
tagged: number;
name: string;
default: boolean;
}
export interface Subscription {
id: string;
name: string;
frequency: string;
currentShipping: number;
newShipping: number;
unit: string;
}
export declare enum AddressFlowScreen {
LIST = "list",
ADD_EDIT = "add_edit",
CONFIRM = "confirm",
SUCCESS = "success"
}
export declare class AddressFlow {
price: number;
productId: string;
quantity: number;
storeId: string;
subscriptionId: string;
gobackButton: boolean;
addresses: Address[];
subscriptions: Subscription[];
addressesUpdated: EventEmitter
;
updateSubscriptionView: EventEmitter;
currentScreen: AddressFlowScreen;
editingAddress: Address | null;
successDetails: {
address: Address;
isNew: boolean;
};
formValues: {
name: string;
firstName: string;
lastName: string;
street: string;
city: string;
state: string;
zip: string;
country: string;
countryCode: string;
phone: string;
setAsDefault: boolean;
latitude?: number;
longitude?: number;
};
/**
* New address for confirmation screen
*/
newAddress: Address;
loading: boolean;
isFormValid: boolean;
/**
* Internal copy of addresses for manipulation
*/
internalAddresses: Address[];
componentWillLoad(): void;
addressesChanged(newValue: Address[]): void;
/**
* Format address to display as JSX
*/
formatAddress(address: Address): JSX.Element;
/**
* Set an address as default
*/
setAsDefault(addressId: string): Promise;
/**
* Show the add/edit address screen
*/
showAddEditScreen(address?: Address | null): void;
/**
* Show the success screen after adding/editing an address
*/
showSuccessScreen(address: Address, isNew: boolean): void;
/**
* Cancel adding/editing an address
*/
cancelAddEdit(): void;
/**
* Cancel confirmation
*/
cancelConfirmation(): void;
getLocationFromPostalCode(postalCode: any, apiKey: any): Promise<{
postalCode: any;
city: string;
state: string;
country: string;
countryCode: string;
latitude: any;
longitude: any;
}>;
apiKey: string;
/**
* Handle form input changes
*/
handleInputChange(event: Event, field: string): Promise;
validateForm(): void;
private continueToConfirmation;
/** Set Default Address **/
private setDefaultAddress;
/**
* Confirm address update
*/
confirmAddressUpdate(): Promise;
/**
* Return to the list screen after success
*/
finishFlow(): void;
/**
* Edit address from confirmation screen
*/
editAddressFromConfirmation(): void;
/**
* Calculate shipping difference
*/
calculateDifference(current: number, newPrice: number): string;
private fetchAddresses;
renderListScreen(): any;
renderAddEditScreen(): any;
renderConfirmScreen(): any;
renderSuccessScreen(): any;
render(): any;
}