0.0.2-beta.5 • Published 2 years ago
csc-canoe-sdk v0.0.2-beta.5
@csc/canoe-sdk 轻舟运营SDK
主要封装轻舟「界面管理」和「运营位管理」两个模块,为 c 端提供界面和运营位获取数据接口、运营位投放弹窗 UI、nps 问卷弹窗 UI 等能力
1、安装方式
// pnpm
pnpm i @csc/canoe-sdk
// or yarn
yarn add @csc/canoe-sdk
2、使用方式
界面管理
- 方式一:调用 Api 获取完整数据
import CanoeSdk from '@csc/canoe-sdk/lib';
import { request } from '@/services'; // 业务请求模块
const canoeSdk = new CanoeSdk({ request }); // 初始化
// 接口调用
canoeSdk.Api.getResourcesByExhibitionCode({
position: 'framework', // 界面标识
pit_mark: 'framework--beginner_guide', // 位置标识(非必传)
})
- 方式二:通过内置 api 获取指定数据(简化返回数据)
import CanoeSdk from '@csc/canoe-sdk/lib';
import { request } from '@/services'; // 业务请求模块
const canoeSdk = new CanoeSdk({ request }); // 初始化
// 首页界面配置数据
const home = canoeSdk.newExhibition('home')
await home.getExhibition() // 获取界面信息
await home.getPits() // 获取位置信息
await home.getPitMaterials('home--scene_entry') // 根据位置标识获取位置物料
await home.getAllMaterials() // 获取所有位置物料
运营位管理
3、SDK 初始化
new CanoeSdk({ request })
request 参数 headers 请求携带参数: |Parameters |type |required |description | ---- | ---- | ---- | ---- |x-business-id |Number |true |业务线id |x-channel-id |Number |true |渠道id |x-device-id |String|true |用户设备id
4、API定义
详见 界面接口文档
sdk response:
Parameters | type | description |
---|---|---|
Api | {getResourcesByExhibitionCode: Function} | 界面接口 |
newExhibition | (position: string): ExhibitionInfo) | 创建一个界面 |
destroy | Function | 销毁实例 |
ExhibitionInfo:
Parameters | type | description |
---|---|---|
getExhibition | () => Promise | 获取界面信息 |
getPits | (): => Promise | 获取界面位置列表 |
getPitMaterials | (pit: string) => Promise | 获取单个位置物料 |
getAllMaterials | () => Promise | 获取所有位置物料 |
5、业务概述
稿定套版解决方案
6、相关文档
0.0.2-beta.5
2 years ago