Last active
February 4, 2020 09:51
-
-
Save zonzujiro/bd65cbb08e5bb2df5e039495163278ff to your computer and use it in GitHub Desktop.
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
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, | |
}; |
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
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', | |
}) |
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
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