import { Results } from 'groupby-api'; import Actions from '.'; import Configuration from '../configuration'; import Store from '../store'; declare namespace ActionCreators { /** * Updates state with given state. * @param state - The state to use. * @return - Action with state. */ function refreshState(state: any): Actions.RefreshState; /** * Updates the history state. * @param urlState - The history state to use. * @return - Action with state. */ function updateHistory(urlState: Actions.Payload.History.State): Actions.UpdateHistory; /** * Makes a request for more refinements for given navigation. * @param options - An object with the navigationId for * the navigation to fetch more refinements against and a request object for override. * @return - Action with `{ navigationId, request }`. */ function fetchMoreRefinements(options: Actions.Payload.Fetch.MoreRefinements): Actions.FetchMoreRefinements; /** * Makes a request for more refinements for given navigation. * @param navigationId - The navigationId for the navigation to fetch more refinements against. * @return - Action with `{ navigationId }`. */ function fetchMoreRefinements(navigationId: string): Actions.FetchMoreRefinements; /** * Makes a request for products. * @param options - An object with a request object for override. * @return - Action with `{ request }`. */ function fetchProducts(options?: Actions.Payload.Fetch.Override): Actions.FetchProducts; /** * Makes a request for products without history being set afterwards. * @param options - An object with a request object for override. * @return - Action with `{ request }`. */ function fetchProductsWithoutHistory(options?: Actions.Payload.Fetch.Override): Actions.FetchProductsWithoutHistory; /** * Wrapper for fetchProducts, dispatches it within saga when store is rehydrated * @param options - An object with a request object for override. * @return - Action with `{ request }`. */ function fetchProductsWhenHydrated(options?: Actions.Payload.Fetch.Override): Actions.FetchProductsWhenHydrated; /** * Makes a request for additional products beyond currently requested products. * @param options - An object with the * amount and forward values, and a request object for override * @return - Action with `{ amount, forward, request }`. */ function fetchMoreProducts(options: Actions.Payload.Fetch.MoreProducts): any; /** * Makes a request for additional products beyond currently requested products. * @param amount - Amount of more products to fetch. * @param forward - `true` to fetch forward * @return - Action with `{ amount, forward }`. */ function fetchMoreProducts(amount: number, forward?: boolean): any; /** * Makes a request for autocomplete suggestions. * @param options - An object * with the query term to fetch autocomplete suggestions against, and a request object for override. * @return - Action with `{ query, request }`. */ function fetchAutocompleteSuggestions(options: Actions.Payload.Fetch.AutocompleteSuggestions): Actions.FetchAutocompleteSuggestions; /** * Makes a request for autocomplete suggestions. * @param query - Search term to fetch autocomplete suggestions against. * @return - Action with `{ query }`. */ function fetchAutocompleteSuggestions(query: string): Actions.FetchAutocompleteSuggestions; /** * Makes a request for autocomplete products. * @param options - An object * with the query and refinements, and a request object for override. * @return - Action with `{ query, refinements, request }`. */ function fetchAutocompleteProducts(options: Actions.Payload.Fetch.AutocompleteProducts): Actions.FetchAutocompleteProducts; /** * Makes a request for autocomplete products. * @param query - Search term * to fetch autocomplete products against. * @param refinements - The applied * refinements. * @return - Action with `{ query, refinements }`. */ function fetchAutocompleteProducts(query: string, refinements?: Actions.Payload.Autocomplete.Refinement[]): Actions.FetchAutocompleteProducts; /** * Makes a request for the collection count for a given collection. * @param options - An object with the collection name, * and a request object for override. * @return - Action with `{ collection, request }`. */ function fetchCollectionCount(options: Actions.Payload.Fetch.CollectionCount): Actions.FetchCollectionCount; /** * Makes a request for the collection count for a given collection. * @param collection - Collection name. * @return - Action with `{ collection }`. */ function fetchCollectionCount(collection: string): Actions.FetchCollectionCount; /** * Makes a request for the details for a given product. * @param options - An object with the id for a specific product, * and a request object for override. * @return - Action with `{ id, request }`. */ function fetchProductDetails(options: Actions.Payload.Fetch.Details): Actions.FetchProductDetails; /** * Makes a request for the details for a given product. * @param id - The id for a specific product. * @param redirect - Indicates whether fetch is a result of a single product redirect. * @return - Action with `{ id }`. */ function fetchProductDetails(id: string, redirect?: boolean): Actions.FetchProductDetails; /** * Makes a request for recommendations products. * @param options - An object with a * request object for override. * @return - Action with `{ request }`. */ function fetchRecommendationsProducts(options?: Actions.Payload.Fetch.Override): Actions.FetchRecommendationsProducts; /** * Makes a request for past purchases. * @param options - An object with a query string, * and a request object for override. * @return - Action with `{ query, request }`. */ function fetchPastPurchases(options?: Actions.Payload.Fetch.PastPurchases): Actions.FetchPastPurchases; /** * Makes a request for past purchases. * @param query - A search term * @return - Action with `{ query }`. */ function fetchPastPurchases(query: string): Actions.FetchPastPurchases; /** * Makes a request for past purchase products. * @param options - An object with a request object for override. * @return - Action with `{ query, request }`. */ function fetchPastPurchaseProducts(options?: Actions.Payload.Fetch.PastPurchases): Actions.FetchPastPurchaseProducts; /** * Makes a request for more past purchase products. * @param options - An object with amount number, forward boolean, * and a request object for override. * @return - Action with `{ amount, forward, request }`. */ function fetchMorePastPurchaseProducts(options: Actions.Payload.Fetch.MorePastPurchases): Actions.FetchMorePastPurchaseProducts; /** * Makes a request for more past purchase products. * @param amount - The amount of additional products to fetch. * @param forward - Whether to fetch the next page or previous page. * and a request object for override. * @return - Action with `{ amount, forward }`. */ function fetchMorePastPurchaseProducts(amount: number, forward?: boolean): Actions.FetchMorePastPurchaseProducts; /** * Makes a request for more past purchase refinements for given navigation. * @param options - An object with the navigationId for * the navigation to fetch more refinements against and a request object for override. * @return - Action with `{ navigationId, request }`. */ function fetchMorePastPurchaseRefinements(options: Actions.Payload.Fetch.MorePastPurchaseRefinements): Actions.FetchMorePastPurchaseRefinements; /** * Makes a request for more past purchase refinements for given navigation. * @param navigationId - The navigationId for the navigation to fetch more refinements against. * @return - Action with `{ navigationId }`. */ function fetchMorePastPurchaseRefinements(navigationId: string): Actions.FetchMorePastPurchaseRefinements; /** * Makes a request for sayt past purchases. * @param options - An object with a query string, * and a request object for override. * @return - Action with `{ query, request }`. */ function fetchSaytPastPurchases(options: Actions.Payload.Fetch.PastPurchases): Actions.FetchSaytPastPurchases; /** * Makes a request for sayt past purchases. * @param query - A search term. * @return - Action with `{ query }`. */ function fetchSaytPastPurchases(query: string): Actions.FetchSaytPastPurchases; /** * Updates the search with given parameters. * @param newSearch - Search object for requested search. * @return - Actions with relevant data. */ function updateSearch(newSearch: Actions.Payload.Search): (state: Store.State) => (Actions.Action<"RESET_REFINEMENTS", string | boolean> | Actions.Action<"ADD_REFINEMENT", Actions.Payload.Navigation.AddRefinement> | Actions.Action<"SELECT_REFINEMENT", Actions.Payload.Navigation.Refinement> | Actions.Action<"RESET_PAGE", undefined> | Actions.Action<"UPDATE_QUERY", string>)[]; /** * Updates the search query. * @param query - Search term to use. * @return - Actions with relevant data. */ function updateQuery(query: string): Actions.ResetPageAndUpdateQuery; /** * Clears the query. * @return - Actions with relevant data. */ function resetQuery(): Actions.ResetPageAndUpdateQuery; /** * Adds a given refinement to the search. * @param field - The field name for the refinement. * @param valueOrLow - Either the value for a value refinement, or the low for a range refinement. * @param high - Either the high for a range refinement, or left out for a value refinement. * @return - Actions with relevant data. */ function addRefinement(field: string, valueOrLow: any, high?: any): Actions.ResetPageAndAddRefinement; /** * Removes all refinements for a given navigation field and adds the given * refinement to the search. * @param field - The field name for the navigation. * @param valueOrLow - Either the value for a value refinement, or the low for a range refinement. * @param high - Either the high for a range refinement, or left out for a value refinement. * @return - Actions with relevant data. */ function switchRefinement(field: string, valueOrLow: any, high?: any): Actions.SwitchRefinement; /** * Removes the selected refinements from the search. * @param field - true to reset all refinements, * or navigationId to reset all refinements on a specific navigation. * @return - Actions with relevant data. */ function resetRefinements(field: boolean | string): Actions.ResetPageAndResetRefinements; /** * Sets the current page in the store to page 1, but does not update the search. * @return - Action with undefined. */ function resetPage(): Actions.ResetPage; /** * Performs search with query, removes current refinements. * @param query - Search term to perform search with. If not supplied, * search with current query is performed, removing current refinements. * @return - Actions with relevant data. */ function search(query?: string): (state: Store.State) => Actions.Search; /** * Performs a new search with query or selected refinement, and resets recallId. * @param query - The query to use in the search. * @param field - The navigation for the refinement to select. * @param index - The index for the refinement. * @return - Actions with relevant data. */ function resetRecall(query?: string, { field, index }?: { field: string; index: number; }): (state: Store.State) => Actions.ResetRecall; /** * Selects a given refinement based on navigationId and index. * @param navigationId - The navigationId for the navigation to fetch more refinements against. * @param index - The index of the refinement intended to be selected. * @return - Actions with relevant data. */ function selectRefinement(navigationId: string, index: number): Actions.ResetPageAndSelectRefinement; /** * Selects the given refinements based on navigationId and indices. * @param navigationId - The navigationId for the navigation to fetch more refinements against. * @param indices - The indices of the refinements intended to be selected. * @return - Actions with relevant data. */ function selectMultipleRefinements(navigationId: string, indices: number[]): Actions.ResetPageAndSelectMultipleRefinements; /** * Removes a given refinement based on navigationId and index. * @param navigationId - The navigationId for the navigation to fetch more refinements against. * @param index - The index of the refinement intended to be selected. * @return - Actions with relevant data. */ function deselectRefinement(navigationId: string, index: number): Actions.ResetPageAndDeselectRefinement; /** * Selects a given collection based on id. * @param id - The id of the selected collection. * @return - Action with id. */ function selectCollection(id: string): Actions.SelectCollection; /** * Selects a given sort based on index. * @param index - The index of the selected sort. * @return - Action with index. */ function selectSort(index: number): Actions.SelectSort; /** * Updates the sorts using the data provided. * @param payload - An object containing the sort labels and options. * @return - Action with payload. */ function applySorts(payload: Actions.Payload.Sort): Actions.ApplySorts; /** * Updates the page size to given size. * @param size - The size the page is updated to. Must correspond to a size in the pageSize in the store. * @return - Action with size. */ function updatePageSize(size: number): Actions.UpdatePageSize; /** * Updates the current page to the given page. * @param page - The page to switch to. * @return - Action with page. */ function updateCurrentPage(page: number): Actions.UpdateCurrentPage; /** * Updates the details product in the store. * @param details - The product to use as the details product. * @return - Action with details. */ function updateDetails(details: Store.Details): Actions.UpdateDetails; /** * Updates the autocomplete query with the given term. * @param query - The search term to update the autocomplete query to and get suggestions based on. * @return - Action with query. */ function updateAutocompleteQuery(query: string): Actions.UpdateAutocompleteQuery; /** * The biasing object to receive and update biasing with * @param payload - Biasing object * @return - Action with biasing object. */ function updateBiasing(payload: Actions.Payload.Personalization.Biasing): (state: Store.State) => Actions.Action<"UPDATE_BIASING", Actions.Payload.Personalization.Biasing>; function updateSecuredPayload(payload: Configuration.Recommendations.SecuredPayload): Actions.Action<"UPDATE_SECURED_PAYLOAD", Configuration.Recommendations.SecuredPayload>; /** * The fetch state of infinite scroll request. * @param fetchObj - Whether is fetching forward or backward. * @return - Action with fetching state object. */ function infiniteScrollRequestState(fetchObj: Actions.Payload.InfiniteScroll): Actions.ReceiveInfiniteScroll; /** * The query object to receive and update state with. * @param query - Query object. * @return - Action with query object. */ function receiveQuery(query: Actions.Payload.Query): Actions.ReceiveQuery; /** * The response to receive and update state with. * @param res - Response object, as returned by the request. * @return - Actions with relevant data. */ function receiveProducts(res: Results): (state: Store.State) => Actions.Action<"RECEIVE_PRODUCTS", Results> | Actions.Action[]; /** * The products to receive and update the state with. * @param products - Products that will be received and updated to in the state. * @return - Action with products. */ function receiveProductRecords(products: Store.ProductWithMetadata[]): Actions.ReceiveProductRecords; /** * The collection count to receive and update the state with. * @param count - The count to update the collection count to. * @return - Action with count. */ function receiveCollectionCount(count: Actions.Payload.Collection.Count): Actions.ReceiveCollectionCount; /** * The navigations to receive and update state with. * @param navigations - The navigations that state will update to. * @return - Action with navigations. */ function receiveNavigations(navigations: Store.Navigation[]): Actions.ReceiveNavigations; /** * The page to receive and update state with. * @param page - The page object state will update to. * @return - Action with page. */ function receivePage(recordCount: number, current?: number): (state: Store.State) => Actions.Action<"RECEIVE_PAGE", Actions.Payload.Page>; /** * The template to receive and update state with. * @param template - The template state will update to. * @return - Action with template. */ function receiveTemplate(template: Store.Template): Actions.ReceiveTemplate; /** * The record count to receive and update state with. * @param recordCount - The record count state will update to. * @return - Action with recordCount. */ function receiveRecordCount(recordCount: number): Actions.ReceiveRecordCount; /** * The redirect to receive and update state with. * @param redirect - The redirect state will update to. * @return - Action with redirect. */ function receiveRedirect(redirect: string): Actions.ReceiveRedirect; /** * The siteParams to receive and update state with. * @param params - The siteParams from the response. * @return - Action with siteParams. */ function receiveSiteParams(params: Store.SiteParams[]): Actions.ReceiveSiteParams; /** * The more refinements to receive and update state with. * @param navigationId - The navigation the more refinements correspond to. * @param refinements - The more refinements. * @param selected - The selected array, indicating which indexes of the refinements are set to selected. * @return - Action with navigationId, refinements, and selected. */ function receiveMoreRefinements(navigationId: string, refinements: Store.Refinement[], selected: number[]): Actions.ReceiveMoreRefinements; /** * The more past purchase refinements to receive and update state with. * @param navigationId - The navigation the more refinements correspond to. * @param refinements - The more refinements. * @param selected - The selected array, indicating which indexes of the refinements are set to selected. * @return - Action with navigationId, refinements, and selected. */ function receiveMorePastPurchaseRefinements(navigationId: string, refinements: Store.Refinement[], selected: number[]): Actions.ReceiveMorePastPurchaseRefinements; /** * The autocomplete suggestions to receive and update state with. * @param suggestions - The suggestions to update the state to. * @return - Action with suggestions. */ function receiveAutocompleteSuggestions(suggestions: Actions.Payload.Autocomplete.Suggestions): Actions.ReceiveAutocompleteSuggestions; /** * The more products to receive and update state with. Products will be added on * to the products array in the store. * @param products - The products to add to the state. * @return - Action with products. */ function receiveMoreProducts(res: Results): (state: Store.State) => Actions.Action<"RECEIVE_MORE_PRODUCTS", Store.ProductWithMetadata[]>; /** * The autocomplete response to receive and update state with. * @param res - Response object, as returned in the request. * @return - Action and res. */ function receiveAutocompleteProducts(res: Results): (state: Store.State) => Actions.Action<"RECEIVE_AUTOCOMPLETE_PRODUCTS", Store.ProductWithMetadata[]> | Actions.Action[]; /** * The autocomplete products to receive and update state with. * @param products - The products to add to the autocomplete state. * @return - Action with products. */ function receiveAutocompleteProductRecords(products: Store.ProductWithMetadata[]): Actions.ReceiveAutocompleteProductRecords; /** * The autocomplete template to receive and update state with. * @param template - The template to add to the autocomplete state. * @return - Action with template. */ function receiveAutocompleteTemplate(template: Store.Template): Actions.ReceiveAutocompleteTemplate; /** * The recommendations products to receive and update state with. * @param products - The products to add to the recommendations state. * @return - Action with products. */ function receiveRecommendationsProducts(products: Store.ProductWithMetadata[]): Actions.ReceiveRecommendationsProducts; /** * The navigation sort to receive and update navigation sort state with. * @param navigations - The navigations to be sorted and order of sort. * @return - Action with navigations. */ function receiveNavigationSort(navigations: Store.Recommendations.Navigation[]): Actions.ReceiveNavigationSort; /** * Sets the details product in the store. * @param details - The product to use as the details product. * @return - Action with details. */ function receiveDetails(details: Store.Details): Actions.ReceiveDetails; /** * Sets the past purchase skus in the store. * @param products - The product skus to use. * @return - Action with skus. */ function receivePastPurchaseSkus(products: Store.PastPurchases.PastPurchaseProduct[]): Actions.ReceivePastPurchaseSkus; /** * Sets the past purchase sayt products in the store. * @param products - The products to use. * @return - Action with products. */ function receiveSaytPastPurchases(products: Store.ProductWithMetadata[]): Actions.ReceiveSaytPastPurchases; /** * Sets the past purchase products in the store. * @param products - The products to use. * @return - Action with products. */ function receivePastPurchaseProducts(products: Store.ProductWithMetadata[]): Actions.ReceivePastPurchaseProducts; /** * Sets the past purchase template in the store. * @param template - The template to use. * @return - Action with template. */ function receivePastPurchaseTemplate(template: Store.Template): Actions.ReceivePastPurchaseTemplate; /** * Sets the past purchases siteParams in the store. * @param siteParams - The siteParams to use. * @return - Action with siteParams. */ function receivePastPurchaseSiteParams(siteParams: Store.SiteParams[]): Actions.ReceivePastPurchaseSiteParams; /** * Adds the more past purchase products in the store. * @param res - The response to use. * @return - Actions with payloads. */ function receiveMorePastPurchaseProducts(res: Results): (state: Store.State) => Actions.Action<"RECEIVE_MORE_PAST_PURCHASE_PRODUCTS", Store.ProductWithMetadata[]>; /** * Sets the past purchase all record count in the store. * @param count - The count to use. * @return - Action with count. */ function receivePastPurchaseAllRecordCount(count: number): Actions.ReceivePastPurchaseAllRecordCount; /** * Sets the past purchase current record count in the store. * @param count - The count to use. * @return - Action with count. */ function receivePastPurchaseCurrentRecordCount(count: number): Actions.ReceivePastPurchaseCurrentRecordCount; /** * Sets the past purchase refinements in the store. * @param refinements - The refinements to use. * @return - Action with refinements. */ function receivePastPurchaseRefinements(refinements: Store.Navigation[]): Actions.ReceivePastPurchaseRefinements; /** * In the past purchase section, sets the current page in the store to page 1, but does not update the search. * @return - Action with undefined. */ function resetPastPurchasePage(): Actions.ResetPastPurchasePage; /** * The page to receive and update state with. * @param recordCount - The current recordCount. * @param current - The current page. * @return - Action with page. */ function receivePastPurchasePage(recordCount: number, current?: number, pageSize?: number): (state: Store.State) => Actions.Action<"RECEIVE_PAST_PURCHASE_PAGE", Actions.Payload.Page>; /** * In the past purchase section, selects a given refinement based on navigationId and index. * @param navigationId - The navigationId for the navigation to fetch more refinements against. * @param index - The index of the refinement intended to be selected. * @return - Actions with relevant data. */ function selectPastPurchaseRefinement(navigationId: string, index: number): Actions.PastPurchaseSelect; /** * In the past purchase section, selects the given refinements based on navigationId and indices. * @param navigationId - The navigationId for the navigation to fetch more refinements against. * @param indices - The indices of the refinements intended to be selected. * @return - Actions with relevant data. */ function selectMultiplePastPurchaseRefinements(navigationId: string, indices: number[]): Actions.PastPurchaseSelectMultiple; /** * Removes the currently selected past purchase refinements and selects the given one. * @param navigationId - The navigationId for the refinement intending to be selected. * @param index - The index of the refinement to be selected in the store. * @return - Actions with payloads. */ function resetAndSelectPastPurchaseRefinement(navigationId: string, index: number): Actions.PastPurchaseResetAndSelect; /** * Removes the current past purchase query and selects the given past purchase refinement. * @param navigationId - The navigationId for the refinement intending to be selected. * @param index - The index of the refinement to be selected in the store. * @return - Actions with payloads. */ function resetPastPurchaseQueryAndSelectRefinement(navigationId: string, index: number): Actions.PastPurchaseQueryAndSelect; /** * In the past purcahse page, removes a given refinement based on navigationId and index. * @param navigationId - The navigationId for the navigation to fetch more refinements against. * @param index - The index of the refinement intended to be selected. * @return - Actions with relevant data. */ function deselectPastPurchaseRefinement(navigationId: string, index: number): Actions.PastPurchaseDeselect; /** * In the past purchase page, removes the selected refinements from the search. * @param field - true to reset all refinements, * or navigationId to reset all refinements on a specific navigation. * @return - Actions with relevant data. */ function resetPastPurchaseRefinements(field?: boolean | string): Actions.PastPurchaseReset; /** * Removes the selected past purchase refinements and updates the past purchase query. * @param query - The query to use. * @return - Actions with payloads. */ function updatePastPurchaseQuery(query: string): Actions.PastPurchaseQuery; /** * Updates the past purchase page size to given size. * @param size - The size the page is updated to. Must correspond to a size in the pageSize in the store. * @return - Action with size. */ function updatePastPurchasePageSize(size: number): Actions.UpdatePastPurchasePageSize; /** * Updates the current page to the given page. * @param page - The page to switch to. * @return - Action with page. */ function updatePastPurchaseCurrentPage(page: number): Actions.UpdatePastPurchaseCurrentPage; /** * Updates the past purchase sort. * @param index - The index of the sort in the store to use. * @return - Action with index. */ function selectPastPurchasesSort(index: number): Actions.PastPurchaseSortActions; /** * Updates the past purchase sorts using the data provided. * @param payload - An object containing the sort labels and options. * @return - Action with payload. */ function applyPastPurchaseSorts(payload: Actions.Payload.Sort): Actions.ApplyPastPurchaseSorts; /** * Adds state for a given tag or section to the ui store. * @param tagName - The name of the tag or a unique identifier. * @param id - The id of the component or a unique id to use. * @param state - The state to add in the store. * @return - Action with tagName, id, and state. */ function createComponentState(tagName: string, id: string, state?: any): Actions.CreateComponentState; /** * Removes state for a given tag from the store. * @param tagName - The name of the tag or a unique identifier. * @param id - The id of the component or a unique id to use. * @return - Action with tagName and id. */ function removeComponentState(tagName: string, id: string): Actions.RemoveComponentState; /** * Updates the location in the store to the given location. * @param location - The location to update to. * @return - Action with location. */ function updateLocation(location: Store.Geolocation): Actions.UpdateLocation; /** * Set the sessionId in the store to the given id. * @param sessionId - The sessionId to set. * @return - Action with sessionId. */ function setSessionId(sessionId: Store.SessionId): Actions.SetSessionId; /** * Fires the START_APP action. * @return - Action with undefined. */ function startApp(): Actions.StartApp; /** * Fires the START_REDIRECT action. * @return - Action with undefined. */ function startRedirect(): Actions.StartRedirect; /** * Fires the DONE_REDIRECT action. * @return - Action with undefined. */ function stopRedirect(): Actions.DoneRedirect; } export default ActionCreators;