@shopify/app-bridge-core
Version:
**[Join our team and work on libraries like this one.](https://www.shopify.ca/careers)**
28 lines (25 loc) • 1.09 kB
JavaScript
import { Action } from '../../actions/Link/AppLink/index.js';
import { matchesObject, validate, matchesString, matchesEnum } from '../type-validate.js';
import { relativeUrlSchema, relativePathSchema, createActionValidator } from '../utils.js';
var AllowedRedirectType;
(function (AllowedRedirectType) {
AllowedRedirectType["APP"] = "APP::NAVIGATION::REDIRECT::APP";
AllowedRedirectType["LEGACY_APP"] = "APP";
})(AllowedRedirectType || (AllowedRedirectType = {}));
const linkPropsSchema = matchesObject({
label: matchesString(),
destination: relativeUrlSchema,
redirectType: matchesEnum(AllowedRedirectType),
});
const linkActionSchema = matchesObject({
label: matchesString(),
destination: relativePathSchema,
redirectType: matchesEnum(AllowedRedirectType),
});
function validateProps(props) {
return validate(props, linkPropsSchema);
}
function validateAction(action) {
return validate(action, createActionValidator(Action, linkActionSchema, true, true));
}
export { Action, linkActionSchema, linkPropsSchema, validateAction, validateProps };