@polyv/product-sdk 1.3.0-rc-20250814.1 → 1.5.0-rc-20250925.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.es.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { CommonResult } from '@polyv/iar-core-sdk';
1
+ import { CommonResult } from '@polyv/interaction-core';
2
2
  import { EventEmitter } from '@polyv/utils/es/event';
3
- import { InteractionReceiveCore } from '@polyv/iar-core-sdk';
3
+ import { InteractionCore } from '@polyv/interaction-core';
4
4
  import { LinkJumpWay } from '@polyv/utils/es/external-link';
5
5
  import { LinkType } from '@polyv/utils/es/external-link';
6
- import { PageContent } from '@polyv/iar-core-sdk';
7
- import { PageOptions } from '@polyv/iar-core-sdk';
6
+ import { PageContent } from '@polyv/interaction-core';
7
+ import { PageOptions } from '@polyv/interaction-core';
8
8
 
9
9
  export declare class Address {
10
- iarCore: InteractionReceiveCore;
10
+ interactionCore: InteractionCore;
11
11
  config: ProductSDKConfig;
12
- constructor(iarCore: InteractionReceiveCore, config: ProductSDKConfig);
12
+ constructor(interactionCore: InteractionCore, config: ProductSDKConfig);
13
13
  /**
14
14
  * 获取地址列表
15
15
  * @param params 分页参数
@@ -414,7 +414,7 @@ export declare interface NormalProductData extends ProductBasicData, ProductLink
414
414
  }
415
415
 
416
416
  export declare class Order {
417
- iarCore: InteractionReceiveCore;
417
+ interactionCore: InteractionCore;
418
418
  config: ProductSDKConfig;
419
419
  OrderStatus: typeof OrderStatus;
420
420
  PayStatus: typeof PayStatus;
@@ -425,7 +425,7 @@ export declare class Order {
425
425
  RefundStatus: typeof RefundStatus;
426
426
  CreateOrderFailReason: typeof CreateOrderFailReason;
427
427
  OrderRefundFailReason: typeof OrderRefundFailReason;
428
- constructor(iarCore: InteractionReceiveCore, config: ProductSDKConfig);
428
+ constructor(interactionCore: InteractionCore, config: ProductSDKConfig);
429
429
  /**
430
430
  * 获取订单列表
431
431
  * @param params 获取参数
@@ -720,10 +720,10 @@ export declare interface OrderWaitPayData extends OrderBasicData {
720
720
  }
721
721
 
722
722
  export declare class Payment {
723
- iarCore: InteractionReceiveCore;
723
+ interactionCore: InteractionCore;
724
724
  config: ProductSDKConfig;
725
725
  PaymentProvider: typeof PaymentProvider;
726
- constructor(iarCore: InteractionReceiveCore, config: ProductSDKConfig);
726
+ constructor(interactionCore: InteractionCore, config: ProductSDKConfig);
727
727
  /**
728
728
  * 获取微信/支付宝支付参数
729
729
  * @param options 支付订单参数
@@ -807,11 +807,8 @@ export declare interface PositionProductData extends ProductBasicData, ProductLi
807
807
  treatment: string;
808
808
  }
809
809
 
810
- /**
811
- * 商品库 SDK 模块
812
- */
813
810
  export declare class Product {
814
- iarCore: InteractionReceiveCore;
811
+ interactionCore: InteractionCore;
815
812
  config?: ProductSDKConfig | undefined;
816
813
  ProductType: typeof ProductType;
817
814
  ProductLinkType: typeof ProductLinkType;
@@ -825,11 +822,13 @@ export declare class Product {
825
822
  ProductDeliveryType: typeof ProductDeliveryType;
826
823
  ProductServiceType: typeof ProductServiceType;
827
824
  ProductPushRule: typeof ProductPushRule;
825
+ ProductMoveOperation: typeof ProductMoveOperation;
826
+ ProductSortType: typeof ProductSortType;
828
827
  eventEmitter: EventEmitter<ProductEventsRelations, ProductEvents>;
829
828
  private __currentPushingProductId;
830
829
  private __currentPushingProductPushRule;
831
830
  private __isPushingProduct;
832
- constructor(iarCore: InteractionReceiveCore, config?: ProductSDKConfig | undefined);
831
+ constructor(interactionCore: InteractionCore, config?: ProductSDKConfig | undefined);
833
832
  /* Excluded from this release type: __clearCurrentPushingProduct */
834
833
  /**
835
834
  * 获取商品标签列表
@@ -942,6 +941,7 @@ export declare class Product {
942
941
  /* Excluded from this release type: getCurrentPushingProductId */
943
942
  /**
944
943
  * 获取当前推送中的商品数据
944
+ * @param productId 可选,指定商品ID,如果不提供则获取当前配置中的推送商品
945
945
  * @example
946
946
  * ```js
947
947
  * const productData = await productTarget.getCurrentPushingProduct();
@@ -986,6 +986,15 @@ export declare class Product {
986
986
  * ```
987
987
  */
988
988
  deleteExplain(productId: number): Promise<void>;
989
+ /**
990
+ * 获取当前正在讲解的商品 id
991
+ * @example
992
+ * ```js
993
+ * const productId = await productTarget.getCurrentProductExplain();
994
+ * console.log('当前正在讲解的商品 id', productId);
995
+ * ```
996
+ */
997
+ getCurrentProductExplain(): Promise<number | null>;
989
998
  /**
990
999
  * 商品开价
991
1000
  * @param productId 商品 id
@@ -1008,6 +1017,14 @@ export declare class Product {
1008
1017
  * 获取商品设置
1009
1018
  */
1010
1019
  getProductSetting(): Promise<ProductSetting>;
1020
+ /**
1021
+ * 更新商品设置
1022
+ * @param {Object} params
1023
+ * @param {boolean} params.productExplainEnabled 商品讲解开关
1024
+ * @param {boolean} params.productExplainingAutoPushAndSticky 讲解自动置顶
1025
+ * @param {boolean} params.hideProductPriceEnabled 隐藏商品价格
1026
+ */
1027
+ updateProductSetting(params: Partial<ProductSetting>): Promise<void>;
1011
1028
  /**
1012
1029
  * 推送商品
1013
1030
  * @param productId 商品 id
@@ -1054,6 +1071,85 @@ export declare class Product {
1054
1071
  * ```
1055
1072
  */
1056
1073
  batchOffShelfProduct(productIds: number[]): Promise<void>;
1074
+ /**
1075
+ * 商品置顶
1076
+ * @param productId 商品 id
1077
+ * @example
1078
+ * ```js
1079
+ * await productTarget.topProduct(123);
1080
+ * ```
1081
+ */
1082
+ topProduct(productId: number): Promise<void>;
1083
+ /**
1084
+ * 取消商品置顶
1085
+ * @param productId 商品 id
1086
+ * @example
1087
+ * ```js
1088
+ * await productTarget.cancelTopProduct(123);
1089
+ * ```
1090
+ */
1091
+ cancelTopProduct(productId: number): Promise<void>;
1092
+ /**
1093
+ * 设为售罄
1094
+ * @param productId 商品 id
1095
+ * @example
1096
+ * ```js
1097
+ * await productTarget.setProductSoldOut(123);
1098
+ * ```
1099
+ */
1100
+ setProductSoldOut(productId: number): Promise<void>;
1101
+ /**
1102
+ * 取消售罄
1103
+ * @param productId 商品 id
1104
+ * @example
1105
+ * ```js
1106
+ * await productTarget.cancelProductSoldOut(123);
1107
+ * ```
1108
+ */
1109
+ cancelProductSoldOut(productId: number): Promise<void>;
1110
+ /**
1111
+ * 获取商品库开关
1112
+ * @example
1113
+ * ```js
1114
+ * const enabled = await productTarget.getProductEnabled();
1115
+ * console.log('商品库开关', enabled);
1116
+ * ```
1117
+ */
1118
+ getProductEnabled(): Promise<boolean>;
1119
+ /**
1120
+ * 更新商品库开关
1121
+ * @param enabled true | false
1122
+ * @example
1123
+ * ```js
1124
+ * await productTarget.updateProductEnabled(true);
1125
+ * ```
1126
+ */
1127
+ updateProductEnabled(enabled: boolean): Promise<void>;
1128
+ /**
1129
+ * 修改商品排序
1130
+ * @param {object} params
1131
+ * @param {number} params.productId 商品 id
1132
+ * @param {number} params.rank 排序值
1133
+ * @example
1134
+ * ```js
1135
+ * await productTarget.updateProductSort({ productId: 123, rank: 1 });
1136
+ * ```
1137
+ */
1138
+ updateProductSort(params: {
1139
+ productId: number;
1140
+ rank: number;
1141
+ }): Promise<void>;
1142
+ /**
1143
+ * 上移/下移商品
1144
+ * @param productId 商品 id
1145
+ * @param {ProductMoveOperation} operation 操作类型
1146
+ * @example
1147
+ * ```js
1148
+ * await productTarget.moveProduct(123, ProductMoveOperation.MoveUp);
1149
+ * await productTarget.moveProduct(456, ProductMoveOperation.MoveDown);
1150
+ * ```
1151
+ */
1152
+ moveProduct(productId: number, operation: ProductMoveOperation): Promise<void>;
1057
1153
  /**
1058
1154
  * 判断当前用户是否支持直接购买商品
1059
1155
  * @example
@@ -1141,6 +1237,10 @@ export declare interface ProductBasicData {
1141
1237
  * 原始数据
1142
1238
  */
1143
1239
  originalData?: unknown;
1240
+ /**
1241
+ * 置顶中
1242
+ */
1243
+ topping?: boolean;
1144
1244
  }
1145
1245
 
1146
1246
  /**
@@ -1244,61 +1344,163 @@ export declare enum ProductDeliveryType {
1244
1344
  Virtual = "virtual"
1245
1345
  }
1246
1346
 
1347
+ /**
1348
+ * 商品事件
1349
+ * @eventenum {@link ProductEventsRelations}
1350
+ */
1247
1351
  export declare enum ProductEvents {
1248
1352
  /**
1249
1353
  * 上架商品
1354
+ * @description 当商品上架时,会触发该事件
1355
+ * @example
1356
+ * ```js
1357
+ * productTarget.eventEmitter.on(ProductEvents.OnSaleProduct, (data) => {
1358
+ * console.log('商品数据', data.productData);
1359
+ * });
1360
+ * ```
1250
1361
  */
1251
1362
  OnSaleProduct = "OnSaleProduct",
1252
1363
  /**
1253
1364
  * 下架商品
1365
+ * @description 当商品下架时,会触发该事件
1366
+ * @example
1367
+ * ```js
1368
+ * productTarget.eventEmitter.on(ProductEvents.OffSaleProduct, (data) => {
1369
+ * console.log('商品数据', data.productData);
1370
+ * });
1371
+ * ```
1254
1372
  */
1255
1373
  OffSaleProduct = "OffSaleProduct",
1256
1374
  /**
1257
1375
  * 添加商品
1376
+ * @description 当商品添加时,会触发该事件
1377
+ * @example
1378
+ * ```js
1379
+ * productTarget.eventEmitter.on(ProductEvents.AddProduct, (data) => {
1380
+ * console.log('商品数据', data.productData);
1381
+ * });
1382
+ * ```
1258
1383
  */
1259
1384
  AddProduct = "AddProduct",
1260
1385
  /**
1261
1386
  * 删除商品
1387
+ * @description 当商品删除时,会触发该事件
1388
+ * @example
1389
+ * ```js
1390
+ * productTarget.eventEmitter.on(ProductEvents.DeleteProduct, (data) => {
1391
+ * console.log('商品 id', data.productId);
1392
+ * });
1393
+ * ```
1262
1394
  */
1263
1395
  DeleteProduct = "DeleteProduct",
1264
1396
  /**
1265
1397
  * 修改商品
1398
+ * @description 当商品修改时,会触发该事件
1399
+ * @example
1400
+ * ```js
1401
+ * productTarget.eventEmitter.on(ProductEvents.ChangeProduct, (data) => {
1402
+ * console.log('商品数据', data.productData);
1403
+ * });
1404
+ * ```
1266
1405
  */
1267
1406
  ChangeProduct = "ChangeProduct",
1268
1407
  /**
1269
1408
  * 上移或下移商品
1409
+ * @description 当商品上移或下移时,会触发该事件
1410
+ * @example
1411
+ * ```js
1412
+ * productTarget.eventEmitter.on(ProductEvents.MoveProduct, (data) => {
1413
+ * console.log('发生改变的两个商品', data.targetProducts);
1414
+ * });
1415
+ * ```
1270
1416
  */
1271
1417
  MoveProduct = "MoveProduct",
1272
1418
  /**
1273
1419
  * 修改商品排序
1420
+ * @description 当商品排序修改时,会触发该事件
1421
+ * @example
1422
+ * ```js
1423
+ * productTarget.eventEmitter.on(ProductEvents.ChangeProductRank, (data) => {
1424
+ * console.log('商品数据', data.productData);
1425
+ * });
1426
+ * ```
1274
1427
  */
1275
1428
  ChangeProductRank = "ChangeProductRank",
1276
1429
  /**
1277
1430
  * 商品售罄
1431
+ * @description 当商品售罄时,会触发该事件
1432
+ * @example
1433
+ * ```js
1434
+ * productTarget.eventEmitter.on(ProductEvents.ProductSoldOut, (data) => {
1435
+ * console.log('商品 id', data.productId);
1436
+ * });
1437
+ * ```
1278
1438
  */
1279
1439
  ProductSoldOut = "ProductSoldOut",
1280
1440
  /**
1281
1441
  * 推送商品
1442
+ * @description 当商品推送时,会触发该事件
1443
+ * @example
1444
+ * ```js
1445
+ * productTarget.eventEmitter.on(ProductEvents.PushProduct, (data) => {
1446
+ * console.log('商品数据', data.productData);
1447
+ * });
1448
+ * ```
1282
1449
  */
1283
1450
  PushProduct = "PushProduct",
1284
1451
  /**
1285
1452
  * 取消推送商品
1453
+ * @description 当商品取消推送时,会触发该事件
1454
+ * @example
1455
+ * ```js
1456
+ * productTarget.eventEmitter.on(ProductEvents.CancelPushProduct, (data) => {
1457
+ * console.log('商品 id', data.productId);
1458
+ * });
1459
+ * ```
1286
1460
  */
1287
1461
  CancelPushProduct = "CancelPushProduct",
1288
1462
  /**
1289
1463
  * 商品库列表开关
1464
+ * @description 当商品库列表开关时,会触发该事件
1465
+ * @example
1466
+ * ```js
1467
+ * productTarget.eventEmitter.on(ProductEvents.ProductListEnabled, (data) => {
1468
+ * console.log('开启或关闭', data.enabled);
1469
+ * });
1470
+ * ```
1290
1471
  */
1291
1472
  ProductListEnabled = "ProductListEnabled",
1292
1473
  /**
1293
1474
  * 刷新当前商品列表
1475
+ * @description 当商品列表刷新时,会触发该事件
1476
+ * @example
1477
+ * ```js
1478
+ * productTarget.eventEmitter.on(ProductEvents.RefreshProductList, (data) => {
1479
+ * console.log('商品列表', data.productList);
1480
+ * });
1481
+ * ```
1294
1482
  */
1295
1483
  RefreshProductList = "RefreshProductList",
1296
1484
  /**
1297
1485
  * 商品点击事件
1486
+ * @description 当商品点击时,会触发该事件
1487
+ * @example
1488
+ * ```js
1489
+ * productTarget.eventEmitter.on(ProductEvents.ProductClick, (data) => {
1490
+ * console.log('商品 id', data.productId);
1491
+ * });
1492
+ * ```
1298
1493
  */
1299
1494
  ProductClick = "ProductClick",
1300
1495
  /**
1301
1496
  * 商品点击次数统计事件
1497
+ * @description 当点击次数发生改变时,会触发该事件
1498
+ * @example
1499
+ * ```js
1500
+ * productTarget.eventEmitter.on(ProductEvents.ProductClickTimes, (data) => {
1501
+ * console.log('商品 id', data.productId);
1502
+ * });
1503
+ * ```
1302
1504
  */
1303
1505
  ProductClickTimes = "ProductClickTimes"
1304
1506
  }
@@ -1623,6 +1825,20 @@ export declare enum ProductMediaType {
1623
1825
  MaterialVideo = "material-video"
1624
1826
  }
1625
1827
 
1828
+ /**
1829
+ * 商品移动操作
1830
+ */
1831
+ export declare enum ProductMoveOperation {
1832
+ /**
1833
+ * 上移
1834
+ */
1835
+ MoveUp = "moveUp",
1836
+ /**
1837
+ * 下移
1838
+ */
1839
+ MoveDown = "moveDown"
1840
+ }
1841
+
1626
1842
  /**
1627
1843
  * 商品价格类型
1628
1844
  */
@@ -1696,6 +1912,10 @@ export declare interface ProductSetting {
1696
1912
  productExplainingAutoPushAndSticky: boolean;
1697
1913
  /** 商品推送方式 */
1698
1914
  productPushRule: ProductPushRule | 'chooseCard';
1915
+ /** 隐藏商品价格开关 */
1916
+ hideProductPriceEnabled: boolean;
1917
+ /** 商品排序方式 */
1918
+ productListSortType: ProductSortType;
1699
1919
  /** 推送中的商品 */
1700
1920
  pushingProduct?: {
1701
1921
  productId: number;
@@ -1703,6 +1923,20 @@ export declare interface ProductSetting {
1703
1923
  };
1704
1924
  }
1705
1925
 
1926
+ /**
1927
+ * 商品排序方式
1928
+ */
1929
+ export declare enum ProductSortType {
1930
+ /**
1931
+ * 升序
1932
+ */
1933
+ Asc = "ASC",
1934
+ /**
1935
+ * 降序(默认排序)
1936
+ */
1937
+ Desc = "DESC"
1938
+ }
1939
+
1706
1940
  /**
1707
1941
  * 商品状态
1708
1942
  */