@pdfvector/util 0.0.11 → 0.0.13
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/.tsc/lib/date.d.ts +4 -0
- package/.tsc/lib/date.js +32 -0
- package/.tsc/lib/format.d.ts +1 -0
- package/.tsc/lib/format.js +3 -0
- package/.tsc/lib/get-error-message.d.ts +1 -0
- package/.tsc/lib/get-error-message.js +7 -0
- package/.tsc/lib/index.d.ts +4 -0
- package/.tsc/lib/index.js +4 -0
- package/.tsc/lib/plan.d.ts +27 -0
- package/.tsc/lib/plan.js +38 -0
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
package/.tsc/lib/date.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function getNextMonthDate(timestamp) {
|
|
2
|
+
const date = new Date(timestamp);
|
|
3
|
+
date.setMonth(date.getMonth() + 1);
|
|
4
|
+
return date;
|
|
5
|
+
}
|
|
6
|
+
export function getPreviousMonthDate() {
|
|
7
|
+
const date = new Date();
|
|
8
|
+
date.setMonth(date.getMonth() - 1);
|
|
9
|
+
return date;
|
|
10
|
+
}
|
|
11
|
+
export function formatShortDateTime(date) {
|
|
12
|
+
const d = typeof date === "number" ? new Date(date) : date;
|
|
13
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
14
|
+
month: "short",
|
|
15
|
+
day: "numeric",
|
|
16
|
+
hour: "numeric",
|
|
17
|
+
minute: "2-digit",
|
|
18
|
+
}).format(d);
|
|
19
|
+
}
|
|
20
|
+
export function formatLongDateTime(date) {
|
|
21
|
+
const d = typeof date === "number" ? new Date(date) : date;
|
|
22
|
+
const datePart = new Intl.DateTimeFormat("en-US", {
|
|
23
|
+
month: "short",
|
|
24
|
+
day: "numeric",
|
|
25
|
+
year: "numeric",
|
|
26
|
+
}).format(d);
|
|
27
|
+
const timePart = new Intl.DateTimeFormat("en-US", {
|
|
28
|
+
hour: "numeric",
|
|
29
|
+
minute: "2-digit",
|
|
30
|
+
}).format(d);
|
|
31
|
+
return `on ${datePart} at ${timePart}`;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatNumber(value: number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getErrorMessage(error: unknown): string;
|
package/.tsc/lib/index.d.ts
CHANGED
package/.tsc/lib/index.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface PlanDefinition {
|
|
2
|
+
label: string;
|
|
3
|
+
monthlyCredits: number;
|
|
4
|
+
monthlyPrice: number;
|
|
5
|
+
annualPrice: number;
|
|
6
|
+
}
|
|
7
|
+
export type PlanKey = "free" | "basic" | "pro";
|
|
8
|
+
export type AnyPlanKey = string;
|
|
9
|
+
export interface Plan {
|
|
10
|
+
key: AnyPlanKey;
|
|
11
|
+
annual: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface PlanSchedule {
|
|
14
|
+
plan: Plan;
|
|
15
|
+
date: Date;
|
|
16
|
+
}
|
|
17
|
+
export interface ChangedPlan {
|
|
18
|
+
key: AnyPlanKey;
|
|
19
|
+
time: number;
|
|
20
|
+
credits: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const freeMonthlyCredits = 100;
|
|
23
|
+
export declare const planDefinitions: Record<PlanKey, PlanDefinition>;
|
|
24
|
+
export declare const planKeys: [PlanKey, ...PlanKey[]];
|
|
25
|
+
export declare function isPlanKey(value: string): value is PlanKey;
|
|
26
|
+
export declare function capitalizeKey(key: string): string;
|
|
27
|
+
export declare function formatPlanLabel(plan: Plan): string;
|
package/.tsc/lib/plan.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const freeMonthlyCredits = 100;
|
|
2
|
+
export const planDefinitions = {
|
|
3
|
+
free: {
|
|
4
|
+
label: "Free",
|
|
5
|
+
monthlyCredits: freeMonthlyCredits,
|
|
6
|
+
monthlyPrice: 0,
|
|
7
|
+
annualPrice: 0,
|
|
8
|
+
},
|
|
9
|
+
basic: {
|
|
10
|
+
label: "Basic",
|
|
11
|
+
monthlyCredits: 3000,
|
|
12
|
+
monthlyPrice: 25,
|
|
13
|
+
annualPrice: 23,
|
|
14
|
+
},
|
|
15
|
+
pro: {
|
|
16
|
+
label: "Pro",
|
|
17
|
+
monthlyCredits: 100000,
|
|
18
|
+
monthlyPrice: 97,
|
|
19
|
+
annualPrice: 89,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const planKeys = Object.keys(planDefinitions);
|
|
23
|
+
export function isPlanKey(value) {
|
|
24
|
+
return planKeys.includes(value);
|
|
25
|
+
}
|
|
26
|
+
export function capitalizeKey(key) {
|
|
27
|
+
return key.charAt(0).toUpperCase() + key.slice(1);
|
|
28
|
+
}
|
|
29
|
+
export function formatPlanLabel(plan) {
|
|
30
|
+
const label = isPlanKey(plan.key)
|
|
31
|
+
? planDefinitions[plan.key].label
|
|
32
|
+
: capitalizeKey(plan.key);
|
|
33
|
+
const parts = ["the", label];
|
|
34
|
+
if (plan.key !== "free")
|
|
35
|
+
parts.push(plan.annual ? "annual" : "monthly");
|
|
36
|
+
parts.push("plan");
|
|
37
|
+
return parts.join(" ");
|
|
38
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @pdfvector/util
|
|
2
2
|
|
|
3
|
+
## 0.0.13
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#102](https://github.com/phuctm97/pdfvector/pull/102) [`4808c15`](https://github.com/phuctm97/pdfvector/commit/4808c15f69c705d1e335d2a88d652d464398f4fd) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Update pricing flow for enterprise
|
|
9
|
+
|
|
10
|
+
## 0.0.12
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
- [#82](https://github.com/phuctm97/pdfvector/pull/82) [`56c9406`](https://github.com/phuctm97/pdfvector/commit/56c94061e0622599a5f4edce21416c6b2adbc56b) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Update spa
|
|
16
|
+
|
|
3
17
|
## 0.0.11
|
|
4
18
|
### Patch Changes
|
|
5
19
|
|