-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1943 from ThemeFuse/24103-getDCGroupsHandler
feat(dynamic_content): added handler to get dc groups
- Loading branch information
Showing
7 changed files
with
112 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { getPlaceholders } from "../api"; | ||
import { DCHandler } from "../types/DynamicContent"; | ||
import { t } from "../utils/i18n"; | ||
|
||
export const placeholders: DCHandler = async (res, rej, extraData) => { | ||
try { | ||
const placeholders = await getPlaceholders(extraData); | ||
|
||
res(placeholders); | ||
} catch (e) { | ||
rej(t("Failed to load dynamic content placeholders")); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Literal } from "../utils/types"; | ||
import { Response } from "./Response"; | ||
|
||
export enum DCTypes { | ||
image = "image", | ||
link = "link", | ||
richText = "richText", | ||
reference = "reference", | ||
multiReference = "multiReference" | ||
} | ||
|
||
interface BaseDCItem { | ||
label: string; | ||
placeholder: string; | ||
alias?: string; | ||
display?: "block" | "inline"; | ||
attr?: Record<string, Literal>; | ||
} | ||
|
||
export interface ConfigDCItem extends BaseDCItem { | ||
optgroup?: ConfigDCItem[]; | ||
} | ||
|
||
export type DCConfigItems = { | ||
[k in DCTypes]: ConfigDCItem[]; | ||
}; | ||
|
||
export type DCHandler = ( | ||
res: Response<ConfigDCItem[]>, | ||
rej: Response<string>, | ||
extraData: { entityType: string; groupType: string } | ||
) => void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters