react-native-unit-components
Version:
Unit React Native components
28 lines (27 loc) • 804 B
JavaScript
import { DISPATCH_REQUEST_REFRESH, LISTENERS } from '../../scripts/html/bodyScript';
export const getWhiteLabelAppParams = props => {
// customer token is the preferred way to authenticate
if (props.customerToken) {
return `
customer-token="${props.customerToken}"
`;
}
if (props.jwtToken) {
return `
jwt-token="${props.jwtToken}"
`;
}
return '';
};
export const injectRefreshEventIfNeeded = (currentWeb, requestRefreshEvent) => {
if (requestRefreshEvent) {
currentWeb?.injectJavaScript(`dispatchRefreshEvent('${JSON.stringify(requestRefreshEvent)}')`);
}
};
export const getWhiteLabelAppScript = () => {
return `
${DISPATCH_REQUEST_REFRESH}
${LISTENERS.unitWhiteLabelAppOnLoad}
`;
};
//# sourceMappingURL=UNWhiteLabelAppComponent.utils.js.map