@jolibox/types 1.2.8 → 1.2.9-beta.9

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.
@@ -8,6 +8,7 @@ export interface LoginCommandParams {
8
8
  }>>;
9
9
  [CHECK_SESSION]: () => Promise<StandardResponse<{
10
10
  isLogin: boolean;
11
+ isSubUser?: boolean;
11
12
  }>>;
12
13
  }
13
14
  export type LoginParamsType = keyof LoginCommandParams;
@@ -1,20 +1,76 @@
1
1
  import { StandardResponse } from '../response';
2
2
  export declare const PURCHASE_GEM_IN_APP = "PaymentSDK.purchaseGem";
3
3
  export declare const GET_GEM_PRODUCT_INFO = "PaymentSDK.getGemProducts";
4
+ export declare const GET_SUBSCRIPTION_PLANS = "PaymentSDK.getSubscriptionPlans";
5
+ export declare const SUBSCRIBE = "PaymentSDK.subscribe";
6
+ export declare const FLUSH_SUB_INFO_CACHE = "PaymentSDK.flushSubInfoCache";
4
7
  export interface IGemProductInfo {
5
8
  productId: string;
6
9
  totalAmountStr: string;
7
10
  quantity: number;
8
11
  appStoreProductId?: string;
9
12
  }
13
+ export type SubscriptionTier = 'BASIC' | 'STANDARD';
14
+ /**
15
+ * 订阅计划类型枚举
16
+ */
17
+ export type PlanType = 'ONE_WEEK' | 'ONE_MONTH' | 'ONE_YEAR' | 'WEEKLY_RENEW' | 'MONTHLY_RENEW' | 'ANNUAL_RENEW' | 'DAY_PASS';
18
+ /**
19
+ * 订阅档位接口定义
20
+ */
21
+ export interface ISubscriptionTierData {
22
+ /** 产品ID,必填 */
23
+ productId: string;
24
+ /** 应用商店产品ID,H5端不返回此字段 */
25
+ appStoreProductId?: string;
26
+ /** 订阅档位等级,可选字段 */
27
+ tier?: SubscriptionTier;
28
+ /** 域名,必填 */
29
+ domain: string;
30
+ /** 计划类型,必填 */
31
+ planType: PlanType;
32
+ /** 天票天数,仅当 type = DAY_PASS 时返回 */
33
+ dayPassDay?: number;
34
+ /** 试用天数,必填 */
35
+ trialDay: number;
36
+ /** 金额字符串,必填 */
37
+ amountStr: string;
38
+ /** 货币类型,必填 */
39
+ currency: string;
40
+ /** 原始金额字符串,可选 */
41
+ originalAmountStr?: string;
42
+ /** 折扣百分比,可选 */
43
+ discountPercentage?: string;
44
+ /** 合作伙伴币数量,可选 */
45
+ partnerCoinQuantity?: number;
46
+ /** 原始合作伙伴币数量,可选 */
47
+ originalPartnerCoinQuantity?: number;
48
+ /** 是否默认选中,必填 */
49
+ defaultSelect: boolean;
50
+ /** 标签,可选 */
51
+ tag?: string;
52
+ /** 购买链接,可选 */
53
+ purchaseUrl?: string;
54
+ benefitText?: string[];
55
+ }
10
56
  export interface PaymentCommandParams {
11
57
  [PURCHASE_GEM_IN_APP]: (params: {
12
58
  productId: string;
13
59
  }) => Promise<StandardResponse<{
14
- totalAmount: string;
60
+ totalAmount?: string;
15
61
  } | void, unknown>>;
16
62
  [GET_GEM_PRODUCT_INFO]: () => Promise<StandardResponse<{
17
63
  products: IGemProductInfo[];
18
64
  } | void, unknown>>;
65
+ [GET_SUBSCRIPTION_PLANS]: () => Promise<StandardResponse<{
66
+ plans: ISubscriptionTierData[];
67
+ } | void, unknown>>;
68
+ [SUBSCRIBE]: (params: {
69
+ productId: string;
70
+ }) => Promise<StandardResponse<{
71
+ subPlanId: string;
72
+ errMsg: string;
73
+ } | void, unknown>>;
74
+ [FLUSH_SUB_INFO_CACHE]: () => Promise<StandardResponse<void, unknown>>;
19
75
  }
20
76
  export type PaymentCommandType = keyof PaymentCommandParams;
package/dist/env.d.ts CHANGED
@@ -32,6 +32,7 @@ export interface Env {
32
32
  isLogin: boolean;
33
33
  token?: string;
34
34
  isSubUser?: boolean;
35
+ appAccountToken?: string;
35
36
  };
36
37
  mpInfo?: {
37
38
  mpName: string;
@@ -1,4 +1,4 @@
1
- import { IGemProductInfo, StandardResponse } from '../commands';
1
+ import { IGemProductInfo, ISubscriptionTierData, StandardResponse } from '../commands';
2
2
  type GemProductInfo = Omit<IGemProductInfo, 'appStoreProductId'>;
3
3
  export interface Payment {
4
4
  purchaseGem: (params: {
@@ -9,5 +9,14 @@ export interface Payment {
9
9
  getGemProducts: () => Promise<StandardResponse<{
10
10
  products: GemProductInfo[];
11
11
  } | void, unknown>>;
12
+ getSubscriptionPlans?: () => Promise<StandardResponse<{
13
+ plans: ISubscriptionTierData[];
14
+ } | void, unknown>>;
15
+ subscribe?: (params: {
16
+ productId: string;
17
+ }) => Promise<StandardResponse<{
18
+ subPlanId: string;
19
+ errMsg: string;
20
+ } | void, unknown>>;
12
21
  }
13
22
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jolibox/types",
3
3
  "description": "This project is common types used for JS-SDk interfere & implement",
4
- "version": "1.2.8",
4
+ "version": "1.2.9-beta.9",
5
5
  "typings": "dist/index.d.ts",
6
6
  "license": "MIT",
7
7
  "files": [