@woocommerce/data
Version:
WooCommerce Admin data store and utilities
119 lines • 7.72 kB
TypeScript
import { DispatchFromMap } from '@automattic/data-stores';
import { ACTION_TYPES as TYPES } from './action-types';
import { PaypalOnboardingStatus, SelectorKeysWithActions, RecommendedTypes, InstallPluginsResponse, ActivatePluginsResponse, PluginNames, JetpackConnectionDataResponse } from './types';
export declare function updateActivePlugins(active: string[], replace?: boolean): {
type: TYPES.UPDATE_ACTIVE_PLUGINS;
active: string[];
replace: boolean;
};
export declare function updateInstalledPlugins(installed: string[], replace?: boolean): {
type: TYPES.UPDATE_INSTALLED_PLUGINS;
installed: string[];
replace?: boolean;
};
export declare function setIsRequesting(selector: SelectorKeysWithActions, isRequesting: boolean): {
type: TYPES.SET_IS_REQUESTING;
selector: SelectorKeysWithActions;
isRequesting: boolean;
};
export declare function setError(selector: SelectorKeysWithActions, error: unknown): {
type: TYPES.SET_ERROR;
selector: SelectorKeysWithActions;
error: unknown;
};
export declare function updateIsJetpackConnected(jetpackConnection: boolean): {
type: TYPES.UPDATE_JETPACK_CONNECTION;
jetpackConnection: boolean;
};
export declare function updateJetpackConnectionData(results: JetpackConnectionDataResponse): {
type: TYPES.UPDATE_JETPACK_CONNECTION_DATA;
results: JetpackConnectionDataResponse;
};
export declare function updateJetpackConnectUrl(redirectUrl: string, jetpackConnectUrl: string): {
type: TYPES.UPDATE_JETPACK_CONNECT_URL;
jetpackConnectUrl: string;
redirectUrl: string;
};
export declare const createErrorNotice: (errorMessage: string) => {
[key: string]: unknown;
type: 'CREATE_NOTICE';
};
export declare function setPaypalOnboardingStatus(status: Partial<PaypalOnboardingStatus>): {
type: TYPES.SET_PAYPAL_ONBOARDING_STATUS;
paypalOnboardingStatus: Partial<PaypalOnboardingStatus>;
};
export declare function setRecommendedPlugins(type: string, plugins: Plugin[]): {
type: TYPES.SET_RECOMMENDED_PLUGINS;
recommendedType: string;
plugins: Plugin[];
};
export declare function installPlugins(plugins: Partial<PluginNames>[], async?: boolean): Generator<unknown, InstallPluginsResponse | undefined, {
data: {
installed: string[];
results: Record<string, boolean>;
install_time?: Record<string, number> | undefined;
activated: string[];
};
errors: import("../types").WPError<Partial<"facebook-for-woocommerce" | "jetpack" | "klarna-checkout-for-woocommerce" | "klarna-payments-for-woocommerce" | "mailchimp-for-woocommerce" | "creative-mail-by-constant-contact" | "woocommerce-gateway-paypal-express-checkout" | "woocommerce-gateway-stripe" | "woocommerce-payfast-gateway" | "woocommerce-payments" | "woocommerce-services" | "woocommerce-services:shipping" | "woocommerce-services:tax" | "woocommerce-shipstation-integration" | "woocommerce-mercadopago" | "google-listings-and-ads" | "woo-razorpay" | "mailpoet" | "pinterest-for-woocommerce" | "tiktok-for-business:alt" | "codistoconnect">>;
success: boolean;
message: string;
} & Response>;
export declare function activatePlugins(plugins: Partial<PluginNames>[]): Generator<unknown, ActivatePluginsResponse | undefined, {
data: {
activated: string[];
active: string[];
};
errors: import("../types").WPError<Partial<"facebook-for-woocommerce" | "jetpack" | "klarna-checkout-for-woocommerce" | "klarna-payments-for-woocommerce" | "mailchimp-for-woocommerce" | "creative-mail-by-constant-contact" | "woocommerce-gateway-paypal-express-checkout" | "woocommerce-gateway-stripe" | "woocommerce-payfast-gateway" | "woocommerce-payments" | "woocommerce-services" | "woocommerce-services:shipping" | "woocommerce-services:tax" | "woocommerce-shipstation-integration" | "woocommerce-mercadopago" | "google-listings-and-ads" | "woo-razorpay" | "mailpoet" | "pinterest-for-woocommerce" | "tiktok-for-business:alt" | "codistoconnect">>;
success: boolean;
message: string;
} & Response>;
export declare function installAndActivatePlugins(plugins: string[]): Generator<any, {
data: {
installed: string[];
results: Record<string, boolean>;
install_time?: Record<string, number> | undefined;
activated: string[];
};
errors: import("../types").WPError<Partial<"facebook-for-woocommerce" | "jetpack" | "klarna-checkout-for-woocommerce" | "klarna-payments-for-woocommerce" | "mailchimp-for-woocommerce" | "creative-mail-by-constant-contact" | "woocommerce-gateway-paypal-express-checkout" | "woocommerce-gateway-stripe" | "woocommerce-payfast-gateway" | "woocommerce-payments" | "woocommerce-services" | "woocommerce-services:shipping" | "woocommerce-services:tax" | "woocommerce-shipstation-integration" | "woocommerce-mercadopago" | "google-listings-and-ads" | "woo-razorpay" | "mailpoet" | "pinterest-for-woocommerce" | "tiktok-for-business:alt" | "codistoconnect">>;
success: boolean;
message: string;
headers: Headers;
ok: boolean;
redirected: boolean;
status: number;
statusText: string;
type: ResponseType;
url: string;
clone(): Response;
body: ReadableStream<Uint8Array> | null;
bodyUsed: boolean;
arrayBuffer(): Promise<ArrayBuffer>;
blob(): Promise<Blob>;
formData(): Promise<FormData>;
json(): Promise<any>;
text(): Promise<string>;
}, {
data: {
installed: string[];
results: Record<string, boolean>;
install_time?: Record<string, number> | undefined;
activated: string[];
};
errors: import("../types").WPError<Partial<"facebook-for-woocommerce" | "jetpack" | "klarna-checkout-for-woocommerce" | "klarna-payments-for-woocommerce" | "mailchimp-for-woocommerce" | "creative-mail-by-constant-contact" | "woocommerce-gateway-paypal-express-checkout" | "woocommerce-gateway-stripe" | "woocommerce-payfast-gateway" | "woocommerce-payments" | "woocommerce-services" | "woocommerce-services:shipping" | "woocommerce-services:tax" | "woocommerce-shipstation-integration" | "woocommerce-mercadopago" | "google-listings-and-ads" | "woo-razorpay" | "mailpoet" | "pinterest-for-woocommerce" | "tiktok-for-business:alt" | "codistoconnect">>;
success: boolean;
message: string;
} & Response>;
export declare function connectToJetpack(getAdminLink: (endpoint: string) => string): Generator<any, string, string>;
export declare function installJetpackAndConnect(errorAction: (errorMessage: string) => void, getAdminLink: (endpoint: string) => string): Generator<any, void, string>;
export declare function connectToJetpackWithFailureRedirect(failureRedirect: string, errorAction: (errorMessage: string) => void, getAdminLink: (endpoint: string) => string): Generator<any, void, string>;
export declare function dismissRecommendedPlugins(type: RecommendedTypes): Generator<any, boolean | never[], Plugin[] & boolean>;
export type Actions = ReturnType<typeof updateActivePlugins | typeof updateInstalledPlugins | typeof setIsRequesting | typeof setError | typeof updateIsJetpackConnected | typeof updateJetpackConnectUrl | typeof updateJetpackConnectionData | typeof setPaypalOnboardingStatus | typeof setRecommendedPlugins | typeof createErrorNotice>;
export type ActionDispatchers = DispatchFromMap<{
installPlugins: typeof installPlugins;
activatePlugins: typeof activatePlugins;
installJetpackAndConnect: typeof installJetpackAndConnect;
installAndActivatePlugins: typeof installAndActivatePlugins;
connectToJetpackWithFailureRedirect: typeof connectToJetpackWithFailureRedirect;
dismissRecommendedPlugins: typeof dismissRecommendedPlugins;
}>;
//# sourceMappingURL=actions.d.ts.map