picgo 3.1.0 → 3.2.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/.node-version +1 -1
- package/README.md +40 -9
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/Cloud/__mocks__/lifecycleScenarios.d.ts +3 -2
- package/dist/types/index.d.ts +42 -0
- package/package.json +1 -1
|
@@ -6,10 +6,11 @@ import type { CloudBillingOverview, CloudUsage, ICloudUserInfo } from '../../../
|
|
|
6
6
|
* 使用方式(PicGo desktop 主进程会读到 process.env):
|
|
7
7
|
* PICGO_MOCK_LIFECYCLE=grace pnpm dev
|
|
8
8
|
*
|
|
9
|
-
* 可选值:active-pro | active-pro-yearly | active-grant | grace | frozen | pending-cleanup
|
|
9
|
+
* 可选值:active-pro | active-pro-yearly | active-pro-cancel | active-grant | active-grant-lifetime | grace | frozen | pending-cleanup | redemption-stacked | redemption-stacked-long | subscription-with-redemption | subscription-ended-with-redemption | subscription-pending
|
|
10
10
|
* 取消 mock:unset PICGO_MOCK_LIFECYCLE
|
|
11
11
|
*/
|
|
12
|
-
export type MockLifecycleScenario = 'active-pro' | 'active-pro-yearly' | 'active-pro-cancel' | 'active-grant' | 'active-grant-lifetime' | 'grace' | 'frozen' | 'pending-cleanup';
|
|
12
|
+
export type MockLifecycleScenario = 'active-pro' | 'active-pro-yearly' | 'active-pro-cancel' | 'active-grant' | 'active-grant-lifetime' | 'grace' | 'frozen' | 'pending-cleanup' | 'redemption-stacked' | 'redemption-stacked-long' | 'subscription-with-redemption' | 'subscription-ended-with-redemption' | 'subscription-pending';
|
|
13
|
+
export declare const ALL_MOCK_SCENARIOS: readonly MockLifecycleScenario[];
|
|
13
14
|
export declare function getMockScenario(): MockLifecycleScenario | undefined;
|
|
14
15
|
export declare function buildMockOverview(scenario: MockLifecycleScenario): CloudBillingOverview;
|
|
15
16
|
export declare function buildMockUsage(scenario: MockLifecycleScenario, appType: 'gui' | 'cli'): CloudUsage;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -108,6 +108,8 @@ export type CloudBillingPlanInfo = {
|
|
|
108
108
|
capability: string;
|
|
109
109
|
/** 订阅计费周期类型:'monthly' / 'yearly' / null(免费用户)。 */
|
|
110
110
|
billingPeriod: string | null;
|
|
111
|
+
/** 订阅来源的 plan code;与限时会员同时存在时,订阅那一行用它展示自己的档位。旧服务端不下发。 */
|
|
112
|
+
subscription?: string;
|
|
111
113
|
source: 'entitlement' | 'admin_grant' | 'both' | 'free';
|
|
112
114
|
};
|
|
113
115
|
export type CloudLifecyclePhase = 'active' | 'grace' | 'frozen' | 'pending_cleanup';
|
|
@@ -130,14 +132,54 @@ export type CloudLifecycleInfo = {
|
|
|
130
132
|
currentPhaseEndsAt: string | null;
|
|
131
133
|
flags: CloudLifecycleFlags;
|
|
132
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* 服务端由 raw status + 账期终点派生的订阅有效状态。客户端判断续费 / 取消 / 已结束只看它,
|
|
137
|
+
* raw `status` 仅用于展示与排错。
|
|
138
|
+
*/
|
|
139
|
+
export declare enum CloudSubscriptionStanding {
|
|
140
|
+
Live = "live",
|
|
141
|
+
Ending = "ending",
|
|
142
|
+
Ended = "ended",
|
|
143
|
+
None = "none"
|
|
144
|
+
}
|
|
133
145
|
export type CloudSubscriptionInfo = {
|
|
134
146
|
status: string;
|
|
147
|
+
/** 旧服务端不下发。 */
|
|
148
|
+
standing?: CloudSubscriptionStanding;
|
|
135
149
|
currentPeriodEnd: string | null;
|
|
136
150
|
};
|
|
151
|
+
export declare enum CloudFixedTermSource {
|
|
152
|
+
Redemption = "redemption",
|
|
153
|
+
Admin = "admin",
|
|
154
|
+
Purchase = "purchase"
|
|
155
|
+
}
|
|
156
|
+
/** 当前生效的一种限时会员来源(兑换 / 赠送 / 买断),不会自动续费,可与订阅同时计时。 */
|
|
157
|
+
export type CloudFixedTerm = {
|
|
158
|
+
source: CloudFixedTermSource;
|
|
159
|
+
/** 该来源当前生效的 plan code(多段兑换时即当前这一段)。 */
|
|
160
|
+
plan: string;
|
|
161
|
+
/** 该来源的结束时间;兑换来源为整条叠加时间线的终点。 */
|
|
162
|
+
endsAt: string;
|
|
163
|
+
daysRemaining: number;
|
|
164
|
+
};
|
|
165
|
+
/** 叠加兑换里排在当前这一段之后的一段,按消耗顺序排列。 */
|
|
166
|
+
export type CloudRedemptionSegment = {
|
|
167
|
+
plan: string;
|
|
168
|
+
startsAt: string;
|
|
169
|
+
endsAt: string;
|
|
170
|
+
};
|
|
137
171
|
export type CloudBillingOverview = {
|
|
138
172
|
plan: CloudBillingPlanInfo;
|
|
139
173
|
lifecycle: CloudLifecycleInfo;
|
|
140
174
|
subscription: CloudSubscriptionInfo | null;
|
|
175
|
+
/** 排在当前兑换段之后的兑换段;旧服务端不下发时为空数组。 */
|
|
176
|
+
redemptionQueue: CloudRedemptionSegment[];
|
|
177
|
+
/** 当前生效的限时会员,每种来源一条;旧服务端不下发时为空数组。 */
|
|
178
|
+
fixedTerms: CloudFixedTerm[];
|
|
179
|
+
/** 已付款但订阅记录尚未由 webhook 写入时,该订阅的 plan;否则为 null。 */
|
|
180
|
+
pendingSubscription: {
|
|
181
|
+
plan: string;
|
|
182
|
+
} | null;
|
|
141
183
|
};
|
|
142
184
|
export type ImportResult = {
|
|
143
185
|
total: number;
|