/** * * @description app分享model */ export declare class AppShareModel { /** * 标题 */ title: string; /** * 文字内容 */ content?: string; /** * 图片 */ imageUrl: string; /** * 分享链接 */ url: string; /** * 分享功能是否开启. 默认为 true. * 当分享功能关闭时, 其他分享相关字段均无效. */ enabled?: boolean; /** * 海报分享标题. * 客户端: 海报分享必须. 若不存在则取 {@link #title}, 若也不存在, 则海报分享功能关闭. * H5: 非必填. 通过桥接给到客户端时, 建议可以只填充 {@link #title}. * 后端: 非必填. */ posterTitle?: string; /** * 海报分享内容. * 客户端: 非必须. 若不存在则取 {@link #content}, 若也不存在, 则海报只有标题内容. * H5: 非必填. 通过桥接给到客户端时, 建议可以只填充 {@link #content}. * 后端: 非必填. */ posterContent?: string; /** * 海报分享封面图. * 客户端: 海报分享非必须. 若不存在则取 {@link #imageUrl}, 若也不存在, 则海报无封面. * H5: 非必填. 通过桥接给到客户端时, 建议可以只填充 {@link #imageUrl}. * 后端: 非必填. */ posterUrl?: string; /** * 海报分享的展示时间. * 客户端: 海报分享非必须. 若不存在则海报不展示时间. * H5: 非必填. 通过桥接给到客户端时, 建议忽略该字段. * 后端: 非必填. */ posterTime?: string; /** 海报分享展示时间格式. */ posterTimeFormat?: string; /** * 海报分享功能是否开启. 默认为 false. * 当海报分享功能关闭时, 其他海报分享相关字段均无效. */ posterEnabled?: boolean; /** * 分享小程序设置: 小程序原始ID. * 获取方法: 登录小程序管理后台-设置-基本设置-帐号信息. * * 当此字段非空时, 客户端会显示 '分享至小程序' 功能. 详见微信小程序分享文档: * https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html */ wxMiniUserName?: string; /** * 分享小程序设置: 小程序页面路径. */ wxMiniPath?: string; /** * 分享小程序设置: 额外信息. * 通常开发者希望分享出去的小程序被二次打开时可以获取到更多信息, 例如群的标识. */ wxMiniShareTicket?: boolean; /** * 分享小程序设置: 小程序的类型. * 0为正式版, 1为测试版, 2为体验版. */ wxMiniType?: number; } /** * * @description 定义app点击转发时候的分享卡片内容 * @example **示例代码** ```js import { defineAppShareModel } from '@kbapp/js-bridge'; // 方式1 defineAppShareModel({ title: '分享标题', content: '分享内容', imageUrl: 'https://static.kaiba315.com.cn/kaiba-logo.png', // 分享图片 url: 'http://www.kaiba315.com.cn/' // 分享网页地址 success() { console.log('设置成功') }, fail() { console.log('设置失败') } }) // 方式2 defineAppShareModel({ onShareApp() { // 点击页面右上角的时候触发该回调, 定义转发内容 return { title: '分享标题', content: '分享内容', imageUrl: 'https://static.kaiba315.com.cn/kaiba-logo.png', // 分享图片 url: 'http://www.kaiba315.com.cn/' // 分享网页地址 } }, success() { console.log('设置成功') }, fail() { console.log('设置失败') } }) ``` */ export declare const defineAppShareModel: (...args: [params: AppShareModel & { success?: ((res: void) => void) | undefined; fail?: (error: import('./bridge-code').BridgeCode) => void; complete?: () => void; }] | [params: { onShareApp: () => AppShareModel; } & { success?: ((res: void) => void) | undefined; fail?: (error: import('./bridge-code').BridgeCode) => void; complete?: () => void; }]) => Promise; /** * * @description 主动唤起 分享面板 * 桥接type: 58 * @example **示例代码** ```js import { openAppSharePanel } from '@kbapp/market-partner-sdk'; openAppSharePanel({ title: '开吧分享', content: '开吧,开汽车上新生活!', url: 'http://www.kaiba315.com.cn/', imageUrl: 'https://static.kaiba315.com.cn/kaiba-logo.png', success() { console.log('打开分享面板成功') }, fail() { console.log('打开分享面板失败') } }) ``` * */ export declare const openAppSharePanel: (params: AppShareModel & { success?: ((res: void) => void) | undefined; fail?: (error: import('./bridge-code').BridgeCode) => void; complete?: () => void; }) => Promise; /** * * @description 监听 分享面板打开时触发 (主动和被动) * @example **示例代码** ```js import { onAppSharePanelShow } from '@kbapp/market-partner-sdk'; const stopHandle = onAppSharePanelShow(() => { console.log('分享面板打开') }) // stopHandle() 停止监听 ``` */ export declare function onAppSharePanelShow(callback: EventListenerOrEventListenerObject): () => void; /** * * @description 定义页面是否显示右上角分享菜单, 定义分享面板显示的相关状态 * 桥接type: 68 */ export declare const defineAppSharePanelState: (params: { /** 是否显示 显示右上角 ...菜单 */ showMenu: boolean; /** 显示分享面板布局, 0:正常显示. 1:只显示复制链接,浏览器打开相关. 2:只显示分享微信、QQ等. 默认 0 */ panelStyle: 0 | 1 | 2; } & { success?: ((res: void) => void) | undefined; fail?: (error: import('./bridge-code').BridgeCode) => void; complete?: () => void; }) => Promise;