@polyv/product-sdk 1.1.0-rc-20250703.1 → 1.3.0-rc-20250814.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.js CHANGED
@@ -2,6 +2,7 @@ var PolyvApiUrl = /* @__PURE__ */ function(PolyvApiUrl2) {
2
2
  PolyvApiUrl2["GetProductTagList"] = "/live/v4/watch/channel/product/tag/list";
3
3
  PolyvApiUrl2["GetProductListByShowId"] = "/live/v3/sdk/watch/interactive/product/list-by-showId";
4
4
  PolyvApiUrl2["GetProductListByTag"] = "/live/v4/watch/channel/product/list";
5
+ PolyvApiUrl2["GetProductListByLaunch"] = "/live/v4/channel/product/list";
5
6
  PolyvApiUrl2["GetProductDataById"] = "/live/v3/sdk/watch/interactive/product/get-by-product-id";
6
7
  PolyvApiUrl2["GetOrderList"] = "/live/v4/watch/channel/viewer/product/order/list";
7
8
  PolyvApiUrl2["GetOrderDetail"] = "/live/v4/watch/channel/viewer/product/order/get-detail";
@@ -15,6 +16,17 @@ var PolyvApiUrl = /* @__PURE__ */ function(PolyvApiUrl2) {
15
16
  PolyvApiUrl2["AddAddress"] = "/live/v4/watch/channel/viewer/address/save";
16
17
  PolyvApiUrl2["UpdateAddress"] = "/live/v4/watch/channel/viewer/address/update";
17
18
  PolyvApiUrl2["DeleteAddress"] = "/live/v4/watch/channel/viewer/address/delete";
19
+ PolyvApiUrl2["StartProductExplain"] = "/live/v4/channel/product/product-explain/start-now";
20
+ PolyvApiUrl2["EndProductExplain"] = "/live/v4/channel/product/product-explain/end-now";
21
+ PolyvApiUrl2["RestartProductExplain"] = "/live/v4/channel/product/product-explain/restart-now";
22
+ PolyvApiUrl2["DeleteProductExplain"] = "/live/v4/channel/product/product-explain/delete";
23
+ PolyvApiUrl2["OpenProductPrice"] = "/live/v4/channel/product/open-price";
24
+ PolyvApiUrl2["HideProductPrice"] = "/live/v4/channel/product/un-open-price";
25
+ PolyvApiUrl2["ProductPushRule"] = "/live/v4/channel/product/push/rule";
26
+ PolyvApiUrl2["PushProduct"] = "/live/v4/channel/product/push/push";
27
+ PolyvApiUrl2["CancelPushProduct"] = "/live/v4/channel/product/push/cancel-push";
28
+ PolyvApiUrl2["BatchDeleteProduct"] = "/live/v4/channel/product/delete-batch";
29
+ PolyvApiUrl2["BatchShelfProduct"] = "/live/v4/channel/product/shelf-batch";
18
30
  return PolyvApiUrl2;
19
31
  }({});
20
32
  function boolToYN(o) {
@@ -604,7 +616,7 @@ var ProductLinkJumpWay = /* @__PURE__ */ function(ProductLinkJumpWay2) {
604
616
  }({});
605
617
  var ProductStatus = /* @__PURE__ */ function(ProductStatus2) {
606
618
  ProductStatus2[ProductStatus2["OnSale"] = 1] = "OnSale";
607
- ProductStatus2[ProductStatus2["OffSale"] = 0] = "OffSale";
619
+ ProductStatus2[ProductStatus2["OffSale"] = 2] = "OffSale";
608
620
  return ProductStatus2;
609
621
  }({});
610
622
  var ProductMediaType = /* @__PURE__ */ function(ProductMediaType2) {
@@ -623,6 +635,12 @@ var ProductExplainType = /* @__PURE__ */ function(ProductExplainType2) {
623
635
  ProductExplainType2["Playback"] = "recordFile";
624
636
  return ProductExplainType2;
625
637
  }({});
638
+ var ProductExplainOperation = /* @__PURE__ */ function(ProductExplainOperation2) {
639
+ ProductExplainOperation2["Start"] = "start";
640
+ ProductExplainOperation2["End"] = "end";
641
+ ProductExplainOperation2["Restart"] = "restart";
642
+ return ProductExplainOperation2;
643
+ }({});
626
644
  var ProductBuyType = /* @__PURE__ */ function(ProductBuyType2) {
627
645
  ProductBuyType2["DirectBuy"] = "inner";
628
646
  ProductBuyType2["Link"] = "link";
@@ -713,6 +731,7 @@ function parseFeature(features) {
713
731
  return list;
714
732
  }
715
733
  function filterInternalData(internalData) {
734
+ var _internalData$showId;
716
735
  var basicData = {
717
736
  productId: internalData.productId,
718
737
  cover: internalData.cover,
@@ -723,11 +742,13 @@ function filterInternalData(internalData) {
723
742
  description: internalData.productDesc,
724
743
  detail: internalData.productDetail,
725
744
  status: internalData.status,
726
- displayNumber: internalData.showId,
745
+ displayNumber: (_internalData$showId = internalData.showId) !== null && _internalData$showId !== void 0 ? _internalData$showId : internalData.rank,
727
746
  buttonText: internalData.btnShow,
728
747
  featureTags: parseFeature(internalData.features),
729
748
  pushRule: internalData.productPushRule,
730
- pushLogId: internalData.logId
749
+ pushLogId: internalData.logId,
750
+ rank: internalData.rank,
751
+ originalData: internalData
731
752
  };
732
753
  var linkData = {
733
754
  linkType: internalData.linkType,
@@ -783,11 +804,14 @@ function filterInternalData(internalData) {
783
804
  buyType: internalData.buyType,
784
805
  realPrice: internalData.realPrice,
785
806
  originPrice: internalData.price,
807
+ originPriceType: internalData.originalPriceType || ProductPriceType.Amount,
808
+ customOriginalPrice: internalData.customOriginalPrice,
786
809
  customPrice: internalData.customPrice,
787
810
  priceVisible: ynToBool(internalData.openPriceEnable, "Y"),
788
811
  deliveryType: internalData.deliveryType,
789
812
  customerServiceContact: internalData.customerServiceContact,
790
813
  customerServiceType: internalData.customerServiceType,
814
+ forceShowSoldOut: ynToBool(internalData.markAsSoldout, "N"),
791
815
  stockEnabled: ynToBool(internalData.stockEnabled, "N"),
792
816
  stock: internalData.stock
793
817
  });
@@ -1111,6 +1135,7 @@ var Product = /* @__PURE__ */ function() {
1111
1135
  _defineProperty$4(this, "ProductServiceType", ProductServiceType);
1112
1136
  _defineProperty$4(this, "ProductPushRule", ProductPushRule);
1113
1137
  _defineProperty$4(this, "eventEmitter", new EventEmitter());
1138
+ _defineProperty$4(this, "__isPushingProduct", false);
1114
1139
  _defineProperty$4(this, "__handleProductMessage", function(socketData) {
1115
1140
  var status = Number(socketData.status);
1116
1141
  switch (status) {
@@ -1130,6 +1155,9 @@ var Product = /* @__PURE__ */ function() {
1130
1155
  }
1131
1156
  // 删除商品
1132
1157
  case 3: {
1158
+ if (_this.__currentPushingProductId === socketData.content.productId) {
1159
+ _this.__clearCurrentPushingProduct();
1160
+ }
1133
1161
  _this.eventEmitter.emit(ProductEvents.DeleteProduct, {
1134
1162
  productId: socketData.content.productId
1135
1163
  });
@@ -1169,6 +1197,9 @@ var Product = /* @__PURE__ */ function() {
1169
1197
  // 推送商品
1170
1198
  case 9: {
1171
1199
  var _content = socketData.content;
1200
+ _this.__currentPushingProductId = _content.productId;
1201
+ _this.__currentPushingProductPushRule = _content.productPushRule;
1202
+ _this.__isPushingProduct = true;
1172
1203
  _this.eventEmitter.emit(ProductEvents.PushProduct, {
1173
1204
  productData: filterInternalData(_content),
1174
1205
  pushRule: _content.productPushRule
@@ -1185,6 +1216,8 @@ var Product = /* @__PURE__ */ function() {
1185
1216
  }
1186
1217
  // 取消推送
1187
1218
  case 11: {
1219
+ _this.__clearCurrentPushingProduct();
1220
+ _this.__isPushingProduct = true;
1188
1221
  _this.eventEmitter.emit(ProductEvents.CancelPushProduct, {
1189
1222
  productId: socketData.content.productId
1190
1223
  });
@@ -1229,6 +1262,21 @@ var Product = /* @__PURE__ */ function() {
1229
1262
  }, "product");
1230
1263
  }
1231
1264
  return _createClass$3(Product2, [{
1265
+ key: "__clearCurrentPushingProduct",
1266
+ value: function __clearCurrentPushingProduct() {
1267
+ this.__currentPushingProductId = void 0;
1268
+ this.__currentPushingProductPushRule = void 0;
1269
+ }
1270
+ /**
1271
+ * 获取商品标签列表
1272
+ * @param params 获取参数
1273
+ * @example
1274
+ * ```js
1275
+ * const data = await productTarget.getProductTagList({ pageNumber: 1 });
1276
+ * console.log('标签列表', data.contents);
1277
+ * ```
1278
+ */
1279
+ }, {
1232
1280
  key: "getProductTagList",
1233
1281
  value: function() {
1234
1282
  var _getProductTagList = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee() {
@@ -1312,38 +1360,75 @@ var Product = /* @__PURE__ */ function() {
1312
1360
  return getProductList;
1313
1361
  }()
1314
1362
  }, {
1315
- key: "getProductData",
1363
+ key: "getLaunchProductList",
1316
1364
  value: function() {
1317
- var _getProductData = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee3(productId) {
1318
- var _productData$detail;
1319
- var data, productData, res;
1365
+ var _getLaunchProductList = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee3(params) {
1366
+ var _params$pageNumber2, pageNumber, _params$pageSize2, pageSize, status, keyword, data;
1320
1367
  return _regenerator$3().w(function(_context3) {
1321
1368
  while (1) switch (_context3.n) {
1322
1369
  case 0:
1370
+ _params$pageNumber2 = params.pageNumber, pageNumber = _params$pageNumber2 === void 0 ? 1 : _params$pageNumber2, _params$pageSize2 = params.pageSize, pageSize = _params$pageSize2 === void 0 ? 10 : _params$pageSize2, status = params.status, keyword = params.keyword;
1323
1371
  _context3.n = 1;
1372
+ return this.iarCore.polyvApi.get(PolyvApiUrl.GetProductListByLaunch, {
1373
+ pageNumber,
1374
+ pageSize,
1375
+ status,
1376
+ keyword
1377
+ });
1378
+ case 1:
1379
+ data = _context3.v;
1380
+ return _context3.a(2, {
1381
+ pageNumber: data.pageNumber,
1382
+ pageSize: data.pageSize,
1383
+ totalItems: data.totalItems,
1384
+ totalPages: data.totalPages,
1385
+ contents: data.contents.map(function(data2) {
1386
+ return filterInternalData(data2);
1387
+ }),
1388
+ upCount: data.ext.upCount,
1389
+ downCount: data.ext.downCount
1390
+ });
1391
+ }
1392
+ }, _callee3, this);
1393
+ }));
1394
+ function getLaunchProductList(_x) {
1395
+ return _getLaunchProductList.apply(this, arguments);
1396
+ }
1397
+ return getLaunchProductList;
1398
+ }()
1399
+ }, {
1400
+ key: "getProductData",
1401
+ value: function() {
1402
+ var _getProductData = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee4(productId) {
1403
+ var _productData$detail;
1404
+ var data, productData, res;
1405
+ return _regenerator$3().w(function(_context4) {
1406
+ while (1) switch (_context4.n) {
1407
+ case 0:
1408
+ _context4.n = 1;
1324
1409
  return this.iarCore.polyvApi.get(PolyvApiUrl.GetProductDataById, {
1325
1410
  productId
1326
1411
  }, {
1327
1412
  useAESDecrypt: true
1328
1413
  });
1329
1414
  case 1:
1330
- data = _context3.v;
1415
+ data = _context4.v;
1331
1416
  productData = filterInternalData(data);
1332
1417
  if (!((_productData$detail = productData.detail) !== null && _productData$detail !== void 0 && _productData$detail.endsWith(".json"))) {
1333
- _context3.n = 3;
1418
+ _context4.n = 3;
1334
1419
  break;
1335
1420
  }
1336
- _context3.n = 2;
1421
+ _context4.n = 2;
1337
1422
  return this.iarCore.otherApi.get(productData.detail, {});
1338
1423
  case 2:
1339
- res = _context3.v;
1424
+ res = _context4.v;
1340
1425
  productData.detail = res.productDetail;
1341
1426
  case 3:
1342
- return _context3.a(2, productData);
1427
+ return _context4.a(2, productData);
1343
1428
  }
1344
- }, _callee3, this);
1429
+ }, _callee4, this);
1345
1430
  }));
1346
- function getProductData(_x) {
1431
+ function getProductData(_x2) {
1347
1432
  return _getProductData.apply(this, arguments);
1348
1433
  }
1349
1434
  return getProductData;
@@ -1351,28 +1436,29 @@ var Product = /* @__PURE__ */ function() {
1351
1436
  }, {
1352
1437
  key: "sendProductClickEvent",
1353
1438
  value: function() {
1354
- var _sendProductClickEvent = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee4(params) {
1439
+ var _sendProductClickEvent = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee5(params) {
1440
+ var _this$config, _this$config$getProdu;
1355
1441
  var userInfo, channelInfo, productConfig;
1356
- return _regenerator$3().w(function(_context4) {
1357
- while (1) switch (_context4.n) {
1442
+ return _regenerator$3().w(function(_context5) {
1443
+ while (1) switch (_context5.n) {
1358
1444
  case 0:
1359
- _context4.n = 1;
1445
+ _context5.n = 1;
1360
1446
  return this.iarCore.getUserInfo();
1361
1447
  case 1:
1362
- userInfo = _context4.v;
1363
- _context4.n = 2;
1448
+ userInfo = _context5.v;
1449
+ _context5.n = 2;
1364
1450
  return this.iarCore.getChannelInfo();
1365
1451
  case 2:
1366
- channelInfo = _context4.v;
1367
- _context4.n = 3;
1368
- return this.config.getProductConfig();
1452
+ channelInfo = _context5.v;
1453
+ _context5.n = 3;
1454
+ return (_this$config = this.config) === null || _this$config === void 0 || (_this$config$getProdu = _this$config.getProductConfig) === null || _this$config$getProdu === void 0 ? void 0 : _this$config$getProdu.call(_this$config);
1369
1455
  case 3:
1370
- productConfig = _context4.v;
1371
- if (!(!productConfig.productHotEffectEnabled && !productConfig.productLinkJumpTipEnabled)) {
1372
- _context4.n = 4;
1456
+ productConfig = _context5.v;
1457
+ if (!(!(productConfig !== null && productConfig !== void 0 && productConfig.productHotEffectEnabled) && !(productConfig !== null && productConfig !== void 0 && productConfig.productLinkJumpTipEnabled))) {
1458
+ _context5.n = 4;
1373
1459
  break;
1374
1460
  }
1375
- return _context4.a(2);
1461
+ return _context5.a(2);
1376
1462
  case 4:
1377
1463
  this.iarCore.emitSocket({
1378
1464
  EVENT: "PRODUCT_CLICK",
@@ -1385,11 +1471,11 @@ var Product = /* @__PURE__ */ function() {
1385
1471
  roomId: channelInfo.channelId
1386
1472
  }, "product");
1387
1473
  case 5:
1388
- return _context4.a(2);
1474
+ return _context5.a(2);
1389
1475
  }
1390
- }, _callee4, this);
1476
+ }, _callee5, this);
1391
1477
  }));
1392
- function sendProductClickEvent(_x2) {
1478
+ function sendProductClickEvent(_x3) {
1393
1479
  return _sendProductClickEvent.apply(this, arguments);
1394
1480
  }
1395
1481
  return sendProductClickEvent;
@@ -1412,19 +1498,19 @@ var Product = /* @__PURE__ */ function() {
1412
1498
  }, {
1413
1499
  key: "getProductExplainEnabled",
1414
1500
  value: function() {
1415
- var _getProductExplainEnabled = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee5() {
1416
- var _productConfig$produc;
1501
+ var _getProductExplainEnabled = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee6() {
1502
+ var _this$config2, _this$config2$getProd, _productConfig$produc;
1417
1503
  var productConfig;
1418
- return _regenerator$3().w(function(_context5) {
1419
- while (1) switch (_context5.n) {
1504
+ return _regenerator$3().w(function(_context6) {
1505
+ while (1) switch (_context6.n) {
1420
1506
  case 0:
1421
- _context5.n = 1;
1422
- return this.config.getProductConfig();
1507
+ _context6.n = 1;
1508
+ return (_this$config2 = this.config) === null || _this$config2 === void 0 || (_this$config2$getProd = _this$config2.getProductConfig) === null || _this$config2$getProd === void 0 ? void 0 : _this$config2$getProd.call(_this$config2);
1423
1509
  case 1:
1424
- productConfig = _context5.v;
1425
- return _context5.a(2, (_productConfig$produc = productConfig === null || productConfig === void 0 ? void 0 : productConfig.productExplainEnabled) !== null && _productConfig$produc !== void 0 ? _productConfig$produc : false);
1510
+ productConfig = _context6.v;
1511
+ return _context6.a(2, (_productConfig$produc = productConfig === null || productConfig === void 0 ? void 0 : productConfig.productExplainEnabled) !== null && _productConfig$produc !== void 0 ? _productConfig$produc : false);
1426
1512
  }
1427
- }, _callee5, this);
1513
+ }, _callee6, this);
1428
1514
  }));
1429
1515
  function getProductExplainEnabled() {
1430
1516
  return _getProductExplainEnabled.apply(this, arguments);
@@ -1434,24 +1520,24 @@ var Product = /* @__PURE__ */ function() {
1434
1520
  }, {
1435
1521
  key: "generateProductExplainPageUrl",
1436
1522
  value: function() {
1437
- var _generateProductExplainPageUrl = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee6(params) {
1523
+ var _generateProductExplainPageUrl = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee7(params) {
1438
1524
  var domainInfo, channelInfo, queryParams;
1439
- return _regenerator$3().w(function(_context6) {
1440
- while (1) switch (_context6.n) {
1525
+ return _regenerator$3().w(function(_context7) {
1526
+ while (1) switch (_context7.n) {
1441
1527
  case 0:
1442
1528
  domainInfo = this.iarCore.getDomainInfo();
1443
- _context6.n = 1;
1529
+ _context7.n = 1;
1444
1530
  return this.iarCore.getChannelInfo();
1445
1531
  case 1:
1446
- channelInfo = _context6.v;
1532
+ channelInfo = _context7.v;
1447
1533
  queryParams = _objectSpread$3({
1448
1534
  channelId: channelInfo.channelId
1449
1535
  }, params || {});
1450
- return _context6.a(2, concat("".concat(domainInfo.watchPageDomain, "/landing/product/explain"), queryParams));
1536
+ return _context7.a(2, concat("".concat(domainInfo.watchPageDomain, "/landing/product/explain"), queryParams));
1451
1537
  }
1452
- }, _callee6, this);
1538
+ }, _callee7, this);
1453
1539
  }));
1454
- function generateProductExplainPageUrl(_x3) {
1540
+ function generateProductExplainPageUrl(_x4) {
1455
1541
  return _generateProductExplainPageUrl.apply(this, arguments);
1456
1542
  }
1457
1543
  return generateProductExplainPageUrl;
@@ -1459,19 +1545,19 @@ var Product = /* @__PURE__ */ function() {
1459
1545
  }, {
1460
1546
  key: "getOutLinkProductRedirectEnabled",
1461
1547
  value: function() {
1462
- var _getOutLinkProductRedirectEnabled = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee7() {
1463
- var _productConfig$outLin;
1548
+ var _getOutLinkProductRedirectEnabled = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee8() {
1549
+ var _this$config3, _this$config3$getProd, _productConfig$outLin;
1464
1550
  var productConfig;
1465
- return _regenerator$3().w(function(_context7) {
1466
- while (1) switch (_context7.n) {
1551
+ return _regenerator$3().w(function(_context8) {
1552
+ while (1) switch (_context8.n) {
1467
1553
  case 0:
1468
- _context7.n = 1;
1469
- return this.config.getProductConfig();
1554
+ _context8.n = 1;
1555
+ return (_this$config3 = this.config) === null || _this$config3 === void 0 || (_this$config3$getProd = _this$config3.getProductConfig) === null || _this$config3$getProd === void 0 ? void 0 : _this$config3$getProd.call(_this$config3);
1470
1556
  case 1:
1471
- productConfig = _context7.v;
1472
- return _context7.a(2, (_productConfig$outLin = productConfig === null || productConfig === void 0 ? void 0 : productConfig.outLinkProductRedirectEnabled) !== null && _productConfig$outLin !== void 0 ? _productConfig$outLin : false);
1557
+ productConfig = _context8.v;
1558
+ return _context8.a(2, (_productConfig$outLin = productConfig === null || productConfig === void 0 ? void 0 : productConfig.outLinkProductRedirectEnabled) !== null && _productConfig$outLin !== void 0 ? _productConfig$outLin : false);
1473
1559
  }
1474
- }, _callee7, this);
1560
+ }, _callee8, this);
1475
1561
  }));
1476
1562
  function getOutLinkProductRedirectEnabled() {
1477
1563
  return _getOutLinkProductRedirectEnabled.apply(this, arguments);
@@ -1481,24 +1567,25 @@ var Product = /* @__PURE__ */ function() {
1481
1567
  }, {
1482
1568
  key: "getProductPayOrderEnabled",
1483
1569
  value: function() {
1484
- var _getProductPayOrderEnabled = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee8() {
1570
+ var _getProductPayOrderEnabled = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee9() {
1571
+ var _this$config4, _this$config4$getProd, _productConfig$produc2;
1485
1572
  var productConfig;
1486
- return _regenerator$3().w(function(_context8) {
1487
- while (1) switch (_context8.n) {
1573
+ return _regenerator$3().w(function(_context9) {
1574
+ while (1) switch (_context9.n) {
1488
1575
  case 0:
1489
- _context8.n = 1;
1490
- return this.config.getProductConfig();
1576
+ _context9.n = 1;
1577
+ return (_this$config4 = this.config) === null || _this$config4 === void 0 || (_this$config4$getProd = _this$config4.getProductConfig) === null || _this$config4$getProd === void 0 ? void 0 : _this$config4$getProd.call(_this$config4);
1491
1578
  case 1:
1492
- productConfig = _context8.v;
1579
+ productConfig = _context9.v;
1493
1580
  if (productConfig) {
1494
- _context8.n = 2;
1581
+ _context9.n = 2;
1495
1582
  break;
1496
1583
  }
1497
- return _context8.a(2, false);
1584
+ return _context9.a(2, false);
1498
1585
  case 2:
1499
- return _context8.a(2, productConfig.productPayOrderEnabled);
1586
+ return _context9.a(2, (_productConfig$produc2 = productConfig.productPayOrderEnabled) !== null && _productConfig$produc2 !== void 0 ? _productConfig$produc2 : false);
1500
1587
  }
1501
- }, _callee8, this);
1588
+ }, _callee9, this);
1502
1589
  }));
1503
1590
  function getProductPayOrderEnabled() {
1504
1591
  return _getProductPayOrderEnabled.apply(this, arguments);
@@ -1508,113 +1595,404 @@ var Product = /* @__PURE__ */ function() {
1508
1595
  }, {
1509
1596
  key: "getProductHotSaleConfig",
1510
1597
  value: function() {
1511
- var _getProductHotSaleConfig = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee9() {
1512
- var _productConfig$produc2;
1598
+ var _getProductHotSaleConfig = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee0() {
1599
+ var _this$config5, _this$config5$getProd, _productConfig$produc3;
1513
1600
  var productConfig;
1514
- return _regenerator$3().w(function(_context9) {
1515
- while (1) switch (_context9.n) {
1601
+ return _regenerator$3().w(function(_context0) {
1602
+ while (1) switch (_context0.n) {
1516
1603
  case 0:
1517
- _context9.n = 1;
1518
- return this.config.getProductConfig();
1604
+ _context0.n = 1;
1605
+ return (_this$config5 = this.config) === null || _this$config5 === void 0 || (_this$config5$getProd = _this$config5.getProductConfig) === null || _this$config5$getProd === void 0 ? void 0 : _this$config5$getProd.call(_this$config5);
1519
1606
  case 1:
1520
- productConfig = _context9.v;
1607
+ productConfig = _context0.v;
1521
1608
  if (productConfig) {
1522
- _context9.n = 2;
1609
+ _context0.n = 2;
1523
1610
  break;
1524
1611
  }
1525
- return _context9.a(2);
1612
+ return _context0.a(2);
1526
1613
  case 2:
1527
- return _context9.a(2, {
1528
- productHotEffectEnabled: (_productConfig$produc2 = productConfig.productHotEffectEnabled) !== null && _productConfig$produc2 !== void 0 ? _productConfig$produc2 : false,
1614
+ return _context0.a(2, {
1615
+ productHotEffectEnabled: (_productConfig$produc3 = productConfig.productHotEffectEnabled) !== null && _productConfig$produc3 !== void 0 ? _productConfig$produc3 : false,
1529
1616
  productHotEffectTips: productConfig.productHotEffectTips
1530
1617
  });
1531
1618
  }
1532
- }, _callee9, this);
1619
+ }, _callee0, this);
1533
1620
  }));
1534
1621
  function getProductHotSaleConfig() {
1535
1622
  return _getProductHotSaleConfig.apply(this, arguments);
1536
1623
  }
1537
1624
  return getProductHotSaleConfig;
1538
1625
  }()
1626
+ }, {
1627
+ key: "getCurrentPushingProductId",
1628
+ value: function getCurrentPushingProductId() {
1629
+ return this.__currentPushingProductId;
1630
+ }
1631
+ /**
1632
+ * 获取当前推送中的商品数据
1633
+ * @example
1634
+ * ```js
1635
+ * const productData = await productTarget.getCurrentPushingProduct();
1636
+ * console.log('当前推送中的商品数据', productData);
1637
+ * ```
1638
+ */
1539
1639
  }, {
1540
1640
  key: "getCurrentPushingProduct",
1541
1641
  value: function() {
1542
- var _getCurrentPushingProduct = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee0(productId) {
1543
- var _productConfig$channe;
1544
- var productConfig, pid, result;
1545
- return _regenerator$3().w(function(_context0) {
1546
- while (1) switch (_context0.n) {
1642
+ var _getCurrentPushingProduct = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee1(productId) {
1643
+ var _this$config6, _this$config6$getProd;
1644
+ var productConfig, pid, pushRule, _productConfig$channe, _productConfig$channe2, result;
1645
+ return _regenerator$3().w(function(_context1) {
1646
+ while (1) switch (_context1.n) {
1547
1647
  case 0:
1548
- _context0.n = 1;
1549
- return this.config.getProductConfig();
1648
+ _context1.n = 1;
1649
+ return (_this$config6 = this.config) === null || _this$config6 === void 0 || (_this$config6$getProd = _this$config6.getProductConfig) === null || _this$config6$getProd === void 0 ? void 0 : _this$config6$getProd.call(_this$config6);
1550
1650
  case 1:
1551
- productConfig = _context0.v;
1552
- if (!(!productConfig || !((_productConfig$channe = productConfig.channelProductPushingStatusVO) !== null && _productConfig$channe !== void 0 && _productConfig$channe.productId))) {
1553
- _context0.n = 2;
1651
+ productConfig = _context1.v;
1652
+ if (this.__isPushingProduct) {
1653
+ pid = this.__currentPushingProductId;
1654
+ pushRule = this.__currentPushingProductPushRule;
1655
+ } else {
1656
+ pid = productId !== null && productId !== void 0 ? productId : productConfig === null || productConfig === void 0 || (_productConfig$channe = productConfig.channelProductPushingStatusVO) === null || _productConfig$channe === void 0 ? void 0 : _productConfig$channe.productId;
1657
+ pushRule = productConfig === null || productConfig === void 0 || (_productConfig$channe2 = productConfig.channelProductPushingStatusVO) === null || _productConfig$channe2 === void 0 ? void 0 : _productConfig$channe2.pushRule;
1658
+ }
1659
+ if (pid) {
1660
+ _context1.n = 2;
1554
1661
  break;
1555
1662
  }
1556
- return _context0.a(2);
1663
+ return _context1.a(2);
1557
1664
  case 2:
1558
- pid = productId !== null && productId !== void 0 ? productId : productConfig.channelProductPushingStatusVO.productId;
1559
- _context0.n = 3;
1665
+ _context1.n = 3;
1560
1666
  return this.getProductData(pid);
1561
1667
  case 3:
1562
- result = _context0.v;
1563
- return _context0.a(2, _objectSpread$3(_objectSpread$3({}, result), {}, {
1564
- pushRule: productConfig.channelProductPushingStatusVO.pushRule
1668
+ result = _context1.v;
1669
+ return _context1.a(2, _objectSpread$3(_objectSpread$3({}, result), {}, {
1670
+ pushRule
1565
1671
  }));
1566
1672
  }
1567
- }, _callee0, this);
1673
+ }, _callee1, this);
1568
1674
  }));
1569
- function getCurrentPushingProduct(_x4) {
1675
+ function getCurrentPushingProduct(_x5) {
1570
1676
  return _getCurrentPushingProduct.apply(this, arguments);
1571
1677
  }
1572
1678
  return getCurrentPushingProduct;
1573
1679
  }()
1680
+ }, {
1681
+ key: "_explainProduct",
1682
+ value: function() {
1683
+ var _explainProduct2 = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee10(productId, recordType) {
1684
+ var channelInfo, data, apiPath, _t;
1685
+ return _regenerator$3().w(function(_context10) {
1686
+ while (1) switch (_context10.n) {
1687
+ case 0:
1688
+ _context10.n = 1;
1689
+ return this.iarCore.getChannelInfo();
1690
+ case 1:
1691
+ channelInfo = _context10.v;
1692
+ data = {
1693
+ sessionId: channelInfo.sessionId,
1694
+ productId
1695
+ };
1696
+ _t = recordType;
1697
+ _context10.n = _t === ProductExplainOperation.Start ? 2 : _t === ProductExplainOperation.Restart ? 3 : 4;
1698
+ break;
1699
+ case 2:
1700
+ apiPath = PolyvApiUrl.StartProductExplain;
1701
+ return _context10.a(3, 5);
1702
+ case 3:
1703
+ apiPath = PolyvApiUrl.RestartProductExplain;
1704
+ return _context10.a(3, 5);
1705
+ case 4:
1706
+ apiPath = PolyvApiUrl.EndProductExplain;
1707
+ data.recordType = recordType;
1708
+ return _context10.a(3, 5);
1709
+ case 5:
1710
+ return _context10.a(2, this.iarCore.polyvApi.post(apiPath, {
1711
+ data
1712
+ }));
1713
+ }
1714
+ }, _callee10, this);
1715
+ }));
1716
+ function _explainProduct(_x6, _x7) {
1717
+ return _explainProduct2.apply(this, arguments);
1718
+ }
1719
+ return _explainProduct;
1720
+ }()
1721
+ /**
1722
+ * 开始商品讲解
1723
+ * @param productId 商品 id
1724
+ * @example
1725
+ * ```js
1726
+ * await productTarget.startExplain(123);
1727
+ * ```
1728
+ */
1729
+ }, {
1730
+ key: "startExplain",
1731
+ value: function startExplain(productId) {
1732
+ return this._explainProduct(productId, ProductExplainOperation.Start);
1733
+ }
1734
+ /**
1735
+ * 重新开始商品讲解
1736
+ * @param productId 商品 id
1737
+ * @example
1738
+ * ```js
1739
+ * await productTarget.restartExplain(123);
1740
+ * ```
1741
+ */
1742
+ }, {
1743
+ key: "restartExplain",
1744
+ value: function restartExplain(productId) {
1745
+ return this._explainProduct(productId, ProductExplainOperation.Restart);
1746
+ }
1747
+ /**
1748
+ * 结束商品讲解
1749
+ * @param productId 商品 id
1750
+ * @example
1751
+ * ```js
1752
+ * await productTarget.endExplain(123);
1753
+ * ```
1754
+ */
1755
+ }, {
1756
+ key: "endExplain",
1757
+ value: function endExplain(productId) {
1758
+ return this._explainProduct(productId, ProductExplainOperation.End);
1759
+ }
1760
+ /**
1761
+ * 删除商品讲解
1762
+ * @param productId 商品 id
1763
+ * @example
1764
+ * ```js
1765
+ * await productTarget.deleteExplain(123);
1766
+ * ```
1767
+ */
1768
+ }, {
1769
+ key: "deleteExplain",
1770
+ value: function() {
1771
+ var _deleteExplain = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee11(productId) {
1772
+ return _regenerator$3().w(function(_context11) {
1773
+ while (1) switch (_context11.n) {
1774
+ case 0:
1775
+ return _context11.a(2, this.iarCore.polyvApi.post(PolyvApiUrl.DeleteProductExplain, {
1776
+ productId
1777
+ }));
1778
+ }
1779
+ }, _callee11, this);
1780
+ }));
1781
+ function deleteExplain(_x8) {
1782
+ return _deleteExplain.apply(this, arguments);
1783
+ }
1784
+ return deleteExplain;
1785
+ }()
1786
+ }, {
1787
+ key: "openProductPrice",
1788
+ value: function() {
1789
+ var _openProductPrice = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee12(productId) {
1790
+ return _regenerator$3().w(function(_context12) {
1791
+ while (1) switch (_context12.n) {
1792
+ case 0:
1793
+ return _context12.a(2, this.iarCore.polyvApi.post(PolyvApiUrl.OpenProductPrice, {
1794
+ productId
1795
+ }));
1796
+ }
1797
+ }, _callee12, this);
1798
+ }));
1799
+ function openProductPrice(_x9) {
1800
+ return _openProductPrice.apply(this, arguments);
1801
+ }
1802
+ return openProductPrice;
1803
+ }()
1804
+ }, {
1805
+ key: "hideProductPrice",
1806
+ value: function() {
1807
+ var _hideProductPrice = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee13(productId) {
1808
+ return _regenerator$3().w(function(_context13) {
1809
+ while (1) switch (_context13.n) {
1810
+ case 0:
1811
+ return _context13.a(2, this.iarCore.polyvApi.post(PolyvApiUrl.HideProductPrice, {
1812
+ productId
1813
+ }));
1814
+ }
1815
+ }, _callee13, this);
1816
+ }));
1817
+ function hideProductPrice(_x0) {
1818
+ return _hideProductPrice.apply(this, arguments);
1819
+ }
1820
+ return hideProductPrice;
1821
+ }()
1822
+ }, {
1823
+ key: "getProductSetting",
1824
+ value: function() {
1825
+ var _getProductSetting = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee14() {
1826
+ var data;
1827
+ return _regenerator$3().w(function(_context14) {
1828
+ while (1) switch (_context14.n) {
1829
+ case 0:
1830
+ _context14.n = 1;
1831
+ return this.iarCore.polyvApi.get(PolyvApiUrl.ProductPushRule, {});
1832
+ case 1:
1833
+ data = _context14.v;
1834
+ return _context14.a(2, {
1835
+ pushingProduct: data.channelProductPushingStatusVO,
1836
+ productPushRule: data.productPushRule,
1837
+ productExplainEnabled: ynToBool(data.productExplainEnabled, "N"),
1838
+ productExplainingAutoPushAndSticky: ynToBool(data.productExplainingAutoPushAndSticky, "N")
1839
+ });
1840
+ }
1841
+ }, _callee14, this);
1842
+ }));
1843
+ function getProductSetting() {
1844
+ return _getProductSetting.apply(this, arguments);
1845
+ }
1846
+ return getProductSetting;
1847
+ }()
1848
+ }, {
1849
+ key: "pushProduct",
1850
+ value: function() {
1851
+ var _pushProduct = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee15(productId, rule) {
1852
+ return _regenerator$3().w(function(_context15) {
1853
+ while (1) switch (_context15.n) {
1854
+ case 0:
1855
+ return _context15.a(2, this.iarCore.polyvApi.post(PolyvApiUrl.PushProduct, {
1856
+ productId,
1857
+ productPushRule: rule || ProductPushRule.SmallCard
1858
+ }));
1859
+ }
1860
+ }, _callee15, this);
1861
+ }));
1862
+ function pushProduct(_x1, _x10) {
1863
+ return _pushProduct.apply(this, arguments);
1864
+ }
1865
+ return pushProduct;
1866
+ }()
1867
+ }, {
1868
+ key: "cancelPushProduct",
1869
+ value: function() {
1870
+ var _cancelPushProduct = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee16(productId) {
1871
+ return _regenerator$3().w(function(_context16) {
1872
+ while (1) switch (_context16.n) {
1873
+ case 0:
1874
+ return _context16.a(2, this.iarCore.polyvApi.post(PolyvApiUrl.CancelPushProduct, {
1875
+ productId
1876
+ }));
1877
+ }
1878
+ }, _callee16, this);
1879
+ }));
1880
+ function cancelPushProduct(_x11) {
1881
+ return _cancelPushProduct.apply(this, arguments);
1882
+ }
1883
+ return cancelPushProduct;
1884
+ }()
1885
+ }, {
1886
+ key: "batchDeleteProduct",
1887
+ value: function() {
1888
+ var _batchDeleteProduct = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee17(productIds) {
1889
+ return _regenerator$3().w(function(_context17) {
1890
+ while (1) switch (_context17.n) {
1891
+ case 0:
1892
+ return _context17.a(2, this.iarCore.polyvApi.post(PolyvApiUrl.BatchDeleteProduct, {
1893
+ productIds
1894
+ }));
1895
+ }
1896
+ }, _callee17, this);
1897
+ }));
1898
+ function batchDeleteProduct(_x12) {
1899
+ return _batchDeleteProduct.apply(this, arguments);
1900
+ }
1901
+ return batchDeleteProduct;
1902
+ }()
1903
+ }, {
1904
+ key: "batchOnShelfProduct",
1905
+ value: function() {
1906
+ var _batchOnShelfProduct = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee18(productIds) {
1907
+ return _regenerator$3().w(function(_context18) {
1908
+ while (1) switch (_context18.n) {
1909
+ case 0:
1910
+ return _context18.a(2, this.iarCore.polyvApi.post(PolyvApiUrl.BatchShelfProduct, {
1911
+ productIds,
1912
+ status: ProductStatus.OnSale
1913
+ }));
1914
+ }
1915
+ }, _callee18, this);
1916
+ }));
1917
+ function batchOnShelfProduct(_x13) {
1918
+ return _batchOnShelfProduct.apply(this, arguments);
1919
+ }
1920
+ return batchOnShelfProduct;
1921
+ }()
1922
+ }, {
1923
+ key: "batchOffShelfProduct",
1924
+ value: function() {
1925
+ var _batchOffShelfProduct = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee19(productIds) {
1926
+ return _regenerator$3().w(function(_context19) {
1927
+ while (1) switch (_context19.n) {
1928
+ case 0:
1929
+ return _context19.a(2, this.iarCore.polyvApi.post(PolyvApiUrl.BatchShelfProduct, {
1930
+ productIds,
1931
+ status: ProductStatus.OffSale
1932
+ }));
1933
+ }
1934
+ }, _callee19, this);
1935
+ }));
1936
+ function batchOffShelfProduct(_x14) {
1937
+ return _batchOffShelfProduct.apply(this, arguments);
1938
+ }
1939
+ return batchOffShelfProduct;
1940
+ }()
1574
1941
  }, {
1575
1942
  key: "getSupportToDirectBuy",
1576
1943
  value: function() {
1577
- var _getSupportToDirectBuy = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee1() {
1578
- var userInfo, authType, notSupportAuthTypes;
1579
- return _regenerator$3().w(function(_context1) {
1580
- while (1) switch (_context1.n) {
1944
+ var _getSupportToDirectBuy = _asyncToGenerator$3(/* @__PURE__ */ _regenerator$3().m(function _callee20() {
1945
+ var _this$config7, _this$config7$getProd;
1946
+ var userInfo, productConfig, authType, notSupportAuthTypes;
1947
+ return _regenerator$3().w(function(_context20) {
1948
+ while (1) switch (_context20.n) {
1581
1949
  case 0:
1582
- _context1.n = 1;
1950
+ _context20.n = 1;
1583
1951
  return this.getProductPayOrderEnabled();
1584
1952
  case 1:
1585
- if (_context1.v) {
1586
- _context1.n = 2;
1953
+ if (_context20.v) {
1954
+ _context20.n = 2;
1587
1955
  break;
1588
1956
  }
1589
- return _context1.a(2, false);
1957
+ return _context20.a(2, false);
1590
1958
  case 2:
1591
- _context1.n = 3;
1959
+ _context20.n = 3;
1592
1960
  return this.iarCore.getUserInfo();
1593
1961
  case 3:
1594
- userInfo = _context1.v;
1962
+ userInfo = _context20.v;
1595
1963
  if (userInfo.unionId) {
1596
- _context1.n = 4;
1964
+ _context20.n = 4;
1597
1965
  break;
1598
1966
  }
1599
- return _context1.a(2, false);
1967
+ return _context20.a(2, false);
1600
1968
  case 4:
1969
+ _context20.n = 5;
1970
+ return (_this$config7 = this.config) === null || _this$config7 === void 0 || (_this$config7$getProd = _this$config7.getProductConfig) === null || _this$config7$getProd === void 0 ? void 0 : _this$config7$getProd.call(_this$config7);
1971
+ case 5:
1972
+ productConfig = _context20.v;
1973
+ if (productConfig !== null && productConfig !== void 0 && productConfig.directBuyEnabled) {
1974
+ _context20.n = 6;
1975
+ break;
1976
+ }
1977
+ return _context20.a(2, false);
1978
+ case 6:
1601
1979
  authType = userInfo.authType;
1602
1980
  if (!(!authType || authType === AuthType.None)) {
1603
- _context1.n = 5;
1981
+ _context20.n = 7;
1604
1982
  break;
1605
1983
  }
1606
- return _context1.a(2, true);
1607
- case 5:
1984
+ return _context20.a(2, true);
1985
+ case 7:
1608
1986
  notSupportAuthTypes = [AuthType.Custom, AuthType.External, AuthType.Direct, AuthType.EnterpriseWeChat];
1609
1987
  if (!notSupportAuthTypes.includes(authType)) {
1610
- _context1.n = 6;
1988
+ _context20.n = 8;
1611
1989
  break;
1612
1990
  }
1613
- return _context1.a(2, false);
1614
- case 6:
1615
- return _context1.a(2, true);
1991
+ return _context20.a(2, false);
1992
+ case 8:
1993
+ return _context20.a(2, true);
1616
1994
  }
1617
- }, _callee1, this);
1995
+ }, _callee20, this);
1618
1996
  }));
1619
1997
  function getSupportToDirectBuy() {
1620
1998
  return _getSupportToDirectBuy.apply(this, arguments);
@@ -2676,8 +3054,8 @@ var Payment = /* @__PURE__ */ function() {
2676
3054
  console.log(
2677
3055
  "%c@polyv/product-sdk",
2678
3056
  "background:#67C23A;padding: 2px 6px;border-radius: 3px;color: #fff",
2679
- "[version: 1.1.0-rc-20250703.1]",
2680
- "[buildTime: 2025-07-03 01:47:38]"
3057
+ "[version: 1.3.0-rc-20250814.1]",
3058
+ "[buildTime: 2025-08-14 03:10:27]"
2681
3059
  );
2682
3060
  export {
2683
3061
  Address,
@@ -2693,6 +3071,7 @@ export {
2693
3071
  ProductBuyType,
2694
3072
  ProductDeliveryType,
2695
3073
  ProductEvents,
3074
+ ProductExplainOperation,
2696
3075
  ProductExplainStatus,
2697
3076
  ProductExplainType,
2698
3077
  ProductLinkJumpWay,