@pdfvector/util 0.0.10 → 0.0.12
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 +7 -0
- package/.tsc/lib/index.js +11 -0
- package/.tsc/lib/plan.d.ts +24 -0
- package/.tsc/lib/plan.js +31 -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
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
export * from "./date";
|
|
2
|
+
export * from "./format";
|
|
3
|
+
export * from "./get-error-message";
|
|
4
|
+
export * from "./plan";
|
|
1
5
|
export declare const isCI: boolean;
|
|
2
6
|
export declare const isLocal: boolean;
|
|
3
7
|
export declare const isLive: boolean;
|
|
4
8
|
export declare const instanceServerPort = 34000;
|
|
5
9
|
export declare const gatewayServerPort = 35000;
|
|
6
10
|
export declare const websitePort = 36000;
|
|
11
|
+
export declare const appPort = 37000;
|
|
7
12
|
export declare const websiteURL: string;
|
|
13
|
+
export declare const appURL: string;
|
|
14
|
+
export declare const gatewayServerURL: string;
|
|
8
15
|
export declare const productTitle = "PDF Vector";
|
|
9
16
|
export interface ErrorService {
|
|
10
17
|
captureError: (error: unknown) => void;
|
package/.tsc/lib/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export * from "./date";
|
|
2
|
+
export * from "./format";
|
|
3
|
+
export * from "./get-error-message";
|
|
4
|
+
export * from "./plan";
|
|
1
5
|
function getCIWithBun() {
|
|
2
6
|
try {
|
|
3
7
|
return Bun.env.CI;
|
|
@@ -57,9 +61,16 @@ export const isLive = !isLocal;
|
|
|
57
61
|
export const instanceServerPort = 34000;
|
|
58
62
|
export const gatewayServerPort = 35000;
|
|
59
63
|
export const websitePort = 36000;
|
|
64
|
+
export const appPort = 37000;
|
|
60
65
|
export const websiteURL = isLocal
|
|
61
66
|
? `http://localhost:${websitePort}`
|
|
62
67
|
: "https://www.pdfvector.com";
|
|
68
|
+
export const appURL = isLocal
|
|
69
|
+
? `http://localhost:${appPort}`
|
|
70
|
+
: "https://app.pdfvector.com";
|
|
71
|
+
export const gatewayServerURL = isLocal
|
|
72
|
+
? `http://localhost:${gatewayServerPort}`
|
|
73
|
+
: "https://gateway.pdfvector.com";
|
|
63
74
|
export const productTitle = "PDF Vector";
|
|
64
75
|
export const errorService = {
|
|
65
76
|
captureError: (error) => {
|
|
@@ -0,0 +1,24 @@
|
|
|
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 interface Plan {
|
|
9
|
+
key: PlanKey;
|
|
10
|
+
annual: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface PlanSchedule {
|
|
13
|
+
plan: Plan;
|
|
14
|
+
date: Date;
|
|
15
|
+
}
|
|
16
|
+
export interface ChangedPlan {
|
|
17
|
+
key: PlanKey;
|
|
18
|
+
time: number;
|
|
19
|
+
credits: number;
|
|
20
|
+
}
|
|
21
|
+
export declare const planDefinitions: Record<PlanKey, PlanDefinition>;
|
|
22
|
+
export declare const planKeys: [PlanKey, ...PlanKey[]];
|
|
23
|
+
export declare function isPlanKey(value: string): value is PlanKey;
|
|
24
|
+
export declare function formatPlanLabel(plan: Plan): string;
|
package/.tsc/lib/plan.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const planDefinitions = {
|
|
2
|
+
free: {
|
|
3
|
+
label: "Free",
|
|
4
|
+
monthlyCredits: 100,
|
|
5
|
+
monthlyPrice: 0,
|
|
6
|
+
annualPrice: 0,
|
|
7
|
+
},
|
|
8
|
+
basic: {
|
|
9
|
+
label: "Basic",
|
|
10
|
+
monthlyCredits: 3000,
|
|
11
|
+
monthlyPrice: 25,
|
|
12
|
+
annualPrice: 23,
|
|
13
|
+
},
|
|
14
|
+
pro: {
|
|
15
|
+
label: "Pro",
|
|
16
|
+
monthlyCredits: 100000,
|
|
17
|
+
monthlyPrice: 97,
|
|
18
|
+
annualPrice: 89,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const planKeys = Object.keys(planDefinitions);
|
|
22
|
+
export function isPlanKey(value) {
|
|
23
|
+
return planKeys.includes(value);
|
|
24
|
+
}
|
|
25
|
+
export function formatPlanLabel(plan) {
|
|
26
|
+
const parts = ["the", planDefinitions[plan.key].label];
|
|
27
|
+
if (plan.key !== "free")
|
|
28
|
+
parts.push(plan.annual ? "annual" : "monthly");
|
|
29
|
+
parts.push("plan");
|
|
30
|
+
return parts.join(" ");
|
|
31
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @pdfvector/util
|
|
2
2
|
|
|
3
|
+
## 0.0.12
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#82](https://github.com/phuctm97/pdfvector/pull/82) [`56c9406`](https://github.com/phuctm97/pdfvector/commit/56c94061e0622599a5f4edce21416c6b2adbc56b) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Update spa
|
|
9
|
+
|
|
10
|
+
## 0.0.11
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
- [#68](https://github.com/phuctm97/pdfvector/pull/68) [`df69b5c`](https://github.com/phuctm97/pdfvector/commit/df69b5caf6ba0f619ab18b0416d13ef370cea864) Thanks [@phuctm97](https://github.com/phuctm97)! - Add Better Auth to gateway-server with email/password authentication, email verification, and password reset
|
|
16
|
+
|
|
3
17
|
## 0.0.10
|
|
4
18
|
### Patch Changes
|
|
5
19
|
|