in src/amo/installAddon.js [359:407]
category: getAddonEventCategory(type, UNINSTALL_ACTION),
label: guid,
});
})
.catch((error) => {
_log.error(`Uninstall error: ${error}`);
dispatch(setInstallError({ guid, error: FATAL_UNINSTALL_ERROR }));
});
}
render(): React.Node {
const { WrappedComponent, _addonManager, ...passThroughProps } = this.props;
// Wrapped components will receive these props.
const injectedProps: WithInstallHelpersInjectedProps = {
enable: (...args) => this.enable(...args),
// We pass a `boolean` value here, not the function.
hasAddonManager: _addonManager.hasAddonManager(),
install: (...args) => this.install(...args),
setCurrentStatus: (...args) => this.setCurrentStatus(...args),
uninstall: (...args) => this.uninstall(...args),
};
return <WrappedComponent {...injectedProps} {...passThroughProps} />;
}
}
export const withInstallHelpers = (
WrappedComponent: React.ComponentType<mixed>,
): React.ComponentType<mixed> => {
// eslint-disable-next-line react/static-property-placement
WithInstallHelpers.displayName = `WithInstallHelpers(${getDisplayName(
WrappedComponent,
)})`;
const mapStateToProps = (
state: AppState,
ownProps: WithInstallHelpersProps,
): WithInstallHelpersPropsFromState => {
const { addon } = ownProps;
invariant(typeof addon !== 'undefined', 'addon is required');
let currentVersion = ownProps.version;
if (!currentVersion) {
currentVersion =
addon && addon.currentVersionId
? getVersionById({