Skip to content

Instantly share code, notes, and snippets.

@zonzujiro
Last active February 4, 2020 09:51
Show Gist options
  • Save zonzujiro/bd65cbb08e5bb2df5e039495163278ff to your computer and use it in GitHub Desktop.
Save zonzujiro/bd65cbb08e5bb2df5e039495163278ff to your computer and use it in GitHub Desktop.
import { EditorTypes } from '@wix/ecl-types';
const Translations = {
title: 'dbs_section_title',
};
export const AddressInputDBSMPanel: EditorTypes.IDBSMPanelfinition = {
height: 297,
sections: [
{
role: 'selectionTagsListRole',
bindings: [
{
title: Translations.title,
prop: 'value',
supportedFieldTypes: [EditorTypes.DBSMFieldTypes.StringArray],
defaultFieldType: EditorTypes.DBSMFieldTypes.StringArray,
isInputProperty: true,
emptyValue: [],
},
],
},
],
compactErrorPanel: true,
};
import { registerWixDataBindings } from 'wix-dbsm-sdk'
// Registration of one definition
registerWixDataBindings(viewerTypes.selectionTags, (api: HostAPI) => {
return import('assets-server-url/selection-tags/dbsm.js);
}, {
sdkType: '$w.SelectionTags',
})
// Registration of multiple definitions under one sdkType
const dbsmPackages = {
['wixui.SelectionTags']: 'wix-ui-santa/selection-tags/dbsm.js',
['wixui.NavigationTags']: 'wix-ui-santa/navigation-tags/dbsm.js',
}
Object.entries(dbsmPackages).forEach(([viewerType, assetsLink]) => {
registerWixDataBindings(viewerType, () => import(assetsLink))
}, {
sdkType: '$w.SelectionTags',
})
interface HostAPI {
experiments: {
isOpen(name: string): boolean;
};
}
type BundleLoader = (api: HostAPI) => Promise<any>;
interface Options {
sdkType: string;
}
type RegisterWixDataBindings = (
viewerType: string,
loaderFunction: BundleLoader,
Options,
) => void;
export const registerWixDataBindings: RegisterWixDataBindings = (viewerType, loader, { sdkType }) => {}
export const enum DBSMFieldTypes {
Text = 'text',
Image = 'image',
StringArray = 'stringArray',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment