Product Library
Updated: 2024-04-22 19:18:32
Functional Overview
This module primarily handles logic related to the product library, such as displaying products, product push notifications, and product listing/unlisting messages.
Initialization and Destruction
Before instantiating and using this module, the SDK must be initialized and configured. For details, see the reference documentation.
Online File Import Method
// script 标签引入,根据版本号引入JS版本。
<script src="https://websdk.videocc.net/interactions-receive-sdk/0.24.0/lib/polyv-ir.umd.js"></script>
<script>
const { Product } = window.PolyvIRSDK;
</script>
Import Method (Recommended)
import { Product } from '@polyv/interactions-receive-sdk';
const productSdk = new Product();
Usage Flow
Listening to Product Library Messages
productSdk.on(productSdk.events.PRODUCT_MESSAGE, (msg) => {
// TODO 根据商品库消息的类型,处理对应业务
const ProductMessageStatus = productSdk.ProductMessageStatus;
const status = `${msg.status}`;
switch (status) {
// 上架商品
case ProductMessageStatus.OnShelf:
break;
// 下架商品
case ProductMessageStatus.OffShelf:
break;
// 删除商品
case ProductMessageStatus.DeleteProduct:
break;
// 添加商品
case ProductMessageStatus.AddProduct:
break;
// 修改商品
case ProductMessageStatus.ChangeProduct:
break;
// 上移商品
case ProductMessageStatus.MoveUp:
break;
// 下移商品
case ProductMessageStatus.MoveDown:
break;
// 商品推送
case ProductMessageStatus.PushProduct:
break;
// 商品库开关
case ProductMessageStatus.ProductSwitch:
break;
default:
break;
}
});
