1 const typeToMethod = new Map([
2 [`dismiss`, `dismiss`],
3 [`link`, `create`],
4 ])
5
6 type LinkingErrorMessageInput = {
7 moduleA: string
8 moduleAKey: string
9 moduleB: string
10 moduleBKey: string
11 type: "dismiss" | "link"
12 }
13
14 /**
15 *
16 * Example: Module to dismiss salesChannel and apiKey by keys sales_channel_id and api_key_id was not found. Ensure the link exists, keys are correct, and the link is passed in the correct order to method 'remoteLink.dismiss'
17 */
18 export const linkingErrorMessage = (input: LinkingErrorMessageInput) => {
19 const { moduleA, moduleB, moduleAKey, moduleBKey, type } = input
20 return `Module to type ${moduleA} and ${moduleB} by keys ${moduleAKey} and ${moduleBKey} was not found. Ensure the link exists, keys are correct, and link is passed in the correct order to method 'remoteLink.${typeToMethod.get(
21 type
22 )}'.
23 `
24 }