@polyv/product-sdk 1.8.0 → 1.9.0

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
@@ -4,6 +4,7 @@ import { InteractionCore } from '@polyv/interaction-core';
4
4
  import { LinkJumpWay } from '@polyv/utils/es/external-link';
5
5
  import { PageContent } from '@polyv/interaction-core';
6
6
  import { PageOptions } from '@polyv/interaction-core';
7
+ import { YN } from '@polyv/interaction-core';
7
8
 
8
9
  export declare class Address {
9
10
  interactionCore: InteractionCore;
@@ -276,6 +277,13 @@ export declare interface EditAddressParams extends AddressBasicData {
276
277
  id: string;
277
278
  }
278
279
 
280
+ /**
281
+ * 生成商品数据
282
+ * @param internalData 内部商品数据
283
+ * @returns 商品数据
284
+ */
285
+ export declare function filterInternalData(internalData: InternalProductData): ProductData;
286
+
279
287
  /**
280
288
  * 金融商品数据
281
289
  */
@@ -298,6 +306,12 @@ export declare interface GetLaunchProductListParams {
298
306
  status?: ProductStatus;
299
307
  }
300
308
 
309
+ export declare interface GetLaunchProductTagListParams {
310
+ pageNumber?: number;
311
+ pageSize?: number;
312
+ keyword?: string;
313
+ }
314
+
301
315
  /**
302
316
  * 获取订单详情参数
303
317
  */
@@ -351,6 +365,100 @@ export declare interface GetProductListParams {
351
365
  page?: number;
352
366
  }
353
367
 
368
+ /**
369
+ * 内部商品数据
370
+ */
371
+ declare interface InternalProductData extends ProductLinkData, ProductExplainData {
372
+ /** 商品 id */
373
+ productId: number;
374
+ /** 封面 */
375
+ cover: string;
376
+ /** 名称 */
377
+ name: string;
378
+ /** 描述 */
379
+ productDesc: string;
380
+ /** 详情 */
381
+ productDetail: string;
382
+ /** 状态 */
383
+ status: ProductStatus;
384
+ /** 序号 */
385
+ showId: number;
386
+ /** 序号(管理端用) */
387
+ rank: number;
388
+ /** 按钮文案 */
389
+ btnShow: string;
390
+ /** 特色标签 json 字符串 */
391
+ features: string;
392
+ /** 商品类型 */
393
+ productType: ProductType;
394
+ /** 原价 */
395
+ price: number;
396
+ /** 原价类型 */
397
+ originalPriceType: ProductPriceType;
398
+ /** 自定义原价 */
399
+ customOriginalPrice: string;
400
+ /** 价格类型 */
401
+ priceType: ProductPriceType;
402
+ /** 推送规则 */
403
+ productPushRule?: ProductPushRule;
404
+ /** 商品推送记录 id */
405
+ logId?: string;
406
+ /** 其他数据,有 coverList、videoList、jumpWay */
407
+ ext?: string;
408
+ /** 购买类型 */
409
+ buyType: ProductBuyType;
410
+ /** 价格 */
411
+ realPrice: number;
412
+ /** 自定义价格 */
413
+ customPrice: string;
414
+ /** 是否开价 */
415
+ openPriceEnable: YN;
416
+ /** 履约方式 */
417
+ deliveryType: ProductDeliveryType;
418
+ /** 客服联系方式(二维码图片地址), 渠道码被删除则没有值 */
419
+ customerServiceContact: string;
420
+ /** 客服方式 */
421
+ customerServiceType: ProductServiceType;
422
+ /** 是否显示售罄 */
423
+ markAsSoldout: YN;
424
+ /** 库存开关 */
425
+ stockEnabled: YN;
426
+ /** 库存 */
427
+ stock: number;
428
+ /** 收益率 */
429
+ yield: string;
430
+ /** 参数,里面有薪资待遇 */
431
+ params: string;
432
+ /** 是否已置顶 */
433
+ toppingEnable: YN;
434
+ /** AI 手卡 json */
435
+ aiCard: string;
436
+ /** 商品来源 */
437
+ productOrigin: ProductOrigin;
438
+ /** 版本号 */
439
+ version: ProductVersion;
440
+ /** 商品讲解次数 */
441
+ productExplainNum: number;
442
+ /** 商品标签 */
443
+ tags?: InternalProductTagItem[];
444
+ }
445
+
446
+ declare type InternalProductPayload = Omit<InternalProductData, 'productId' | 'showId' | 'rank' | 'logId' | 'productExplainNum' | 'tags'> & Partial<Pick<InternalProductData, 'productId' | 'showId' | 'rank' | 'logId' | 'productExplainNum' | 'tags'>>;
447
+
448
+ declare interface InternalProductTagItem {
449
+ id: number;
450
+ name: string;
451
+ }
452
+
453
+ declare interface InternalProductTagItem {
454
+ channelId: number;
455
+ id: number;
456
+ name: string;
457
+ type: string;
458
+ createTime: number;
459
+ updateTime: number;
460
+ }
461
+
354
462
  export declare interface LaunchProductListResult extends PageContent<ProductData> {
355
463
  /**
356
464
  * 上架数量
@@ -736,6 +844,13 @@ export declare interface OrderWaitPayData extends OrderBasicData {
736
844
  expiredAt: number;
737
845
  }
738
846
 
847
+ /**
848
+ * 格式化特色标签
849
+ */
850
+ export declare function parseFeature(features: string): string[];
851
+
852
+ export declare function parseTags(tags?: InternalProductTagItem[]): ProductTagItem[];
853
+
739
854
  export declare class Payment {
740
855
  interactionCore: InteractionCore;
741
856
  config: ProductSDKConfig;
@@ -917,12 +1032,13 @@ export declare class Product {
917
1032
  * 保存商品 AI 手卡内容(发起端)
918
1033
  * @param {number} productId 商品 ID
919
1034
  * @param {string} aiCardContent AI 手卡内容
1035
+ * @param {boolean} sendSocket 是否发送 socket 更新
920
1036
  * @example
921
1037
  * ```js
922
- * await productTarget.UpdateProductAiCardContent(123, '新的 AI 手卡内容');
1038
+ * await productTarget.updateProductAiCardContent(123, '新的 AI 手卡内容');
923
1039
  * ```
924
1040
  */
925
- UpdateProductAiCardContent(productId: number, aiCardContent: string): Promise<void>;
1041
+ updateProductAiCardContent(productId: number, aiCardContent: string, sendSocket?: boolean): Promise<void>;
926
1042
  /**
927
1043
  * 获取商品数据
928
1044
  * @param productId 商品 id
@@ -938,6 +1054,43 @@ export declare class Product {
938
1054
  * ```
939
1055
  */
940
1056
  getLaunchProductData(productId: number): Promise<ProductData>;
1057
+ /**
1058
+ * 获取商品标签数据(发起端)
1059
+ * @param params 请求参数
1060
+ * @example
1061
+ * ```js
1062
+ * const res = await productTarget.getLaunchProductTagList({ pageNumber: 1, pageSize: 10 });
1063
+ * console.log(res.contents);
1064
+ * ```
1065
+ */
1066
+ getLaunchProductTagList(params: GetLaunchProductTagListParams): Promise<PageContent<ProductTagItem>>;
1067
+ /**
1068
+ * 创建商品标签(发起端)
1069
+ * @param name 标签名称
1070
+ * @example
1071
+ * ```js
1072
+ * const tag = await productTarget.createProductTag('新品');
1073
+ * ```
1074
+ */
1075
+ createProductTag(name: string): Promise<ProductTagItem>;
1076
+ /**
1077
+ * 创建商品
1078
+ * @param data 商品数据
1079
+ * @example
1080
+ * ```js
1081
+ * await productTarget.createProduct(productData);
1082
+ * ```
1083
+ */
1084
+ createProduct(data: ProductData): Promise<void>;
1085
+ /**
1086
+ * 更新商品
1087
+ * @param data 商品数据
1088
+ * @example
1089
+ * ```js
1090
+ * await productTarget.updateProduct(productData);
1091
+ * ```
1092
+ */
1093
+ updateProduct(data: ProductData): Promise<void>;
941
1094
  /**
942
1095
  * 发送商品点击事件
943
1096
  *
@@ -1349,6 +1502,10 @@ export declare interface ProductBasicData {
1349
1502
  * 版本号
1350
1503
  */
1351
1504
  version: ProductVersion;
1505
+ /**
1506
+ * 商品标签
1507
+ */
1508
+ tags: ProductTagItem[];
1352
1509
  }
1353
1510
 
1354
1511
  /**
@@ -2149,6 +2306,20 @@ export declare interface ProductTag {
2149
2306
  name: string;
2150
2307
  }
2151
2308
 
2309
+ /**
2310
+ * 商品标签数据
2311
+ */
2312
+ export declare interface ProductTagItem {
2313
+ /**
2314
+ * 标签名称
2315
+ */
2316
+ label: string;
2317
+ /**
2318
+ * 标签 id
2319
+ */
2320
+ value: number;
2321
+ }
2322
+
2152
2323
  /**
2153
2324
  * 商品类型
2154
2325
  */
@@ -2207,6 +2378,14 @@ export declare enum RefundStatus {
2207
2378
  Processing = "PROCESSING"
2208
2379
  }
2209
2380
 
2381
+ export declare function restoreInternalData(productData: ProductData, mode?: RestoreMode): Partial<InternalProductPayload>;
2382
+
2383
+ /**
2384
+ * 还原内部商品数据
2385
+ * @param productData 商品数据
2386
+ */
2387
+ declare type RestoreMode = 'create' | 'update';
2388
+
2210
2389
  export declare interface SendProductClickParams {
2211
2390
  /**
2212
2391
  * 商品 id