@todesktop/shared 7.190.0 → 7.191.1

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.
Files changed (75) hide show
  1. package/.prettierignore +0 -2
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +42 -15
  4. package/eslint.config.mjs +8 -55
  5. package/lib/{base.d.ts → cjs/base.d.ts} +82 -75
  6. package/lib/{desktopify.d.ts → cjs/desktopify.d.ts} +74 -74
  7. package/lib/{desktopify.js → cjs/desktopify.js} +12 -11
  8. package/lib/{desktopify2.d.ts → cjs/desktopify2.d.ts} +223 -223
  9. package/lib/{getSiteInfo.d.ts → cjs/getSiteInfo.d.ts} +6 -6
  10. package/lib/{hsm.d.ts → cjs/hsm.d.ts} +1 -1
  11. package/lib/{hsm.js → cjs/hsm.js} +1 -1
  12. package/lib/{index.d.ts → cjs/index.d.ts} +7 -8
  13. package/lib/{index.js → cjs/index.js} +11 -9
  14. package/lib/{invitePermissionLabels.d.ts → cjs/invitePermissionLabels.d.ts} +4 -2
  15. package/lib/{invitePermissionLabels.js → cjs/invitePermissionLabels.js} +11 -3
  16. package/lib/{personalAccessTokens.d.ts → cjs/personalAccessTokens.d.ts} +12 -12
  17. package/lib/{plans.d.ts → cjs/plans.d.ts} +27 -27
  18. package/lib/{plans.js → cjs/plans.js} +165 -163
  19. package/lib/{plugin.d.ts → cjs/plugin.d.ts} +18 -18
  20. package/lib/{toDesktop.d.ts → cjs/toDesktop.d.ts} +66 -66
  21. package/lib/cjs/translation.d.ts +2 -0
  22. package/lib/{validations.d.ts → cjs/validations.d.ts} +66 -66
  23. package/lib/cjs/validations.js +178 -0
  24. package/lib/esm/base.d.ts +326 -0
  25. package/lib/esm/base.js +19 -0
  26. package/lib/esm/desktopify.d.ts +339 -0
  27. package/lib/esm/desktopify.js +71 -0
  28. package/lib/esm/desktopify2.d.ts +506 -0
  29. package/lib/esm/desktopify2.js +77 -0
  30. package/lib/esm/getSiteInfo.d.ts +24 -0
  31. package/lib/esm/getSiteInfo.js +1 -0
  32. package/lib/esm/hsm.d.ts +30 -0
  33. package/lib/esm/hsm.js +35 -0
  34. package/lib/esm/index.d.ts +12 -0
  35. package/lib/esm/index.js +14 -0
  36. package/lib/esm/invitePermissionLabels.d.ts +13 -0
  37. package/lib/esm/invitePermissionLabels.js +24 -0
  38. package/lib/esm/personalAccessTokens.d.ts +24 -0
  39. package/lib/esm/personalAccessTokens.js +1 -0
  40. package/lib/esm/plans.d.ts +130 -0
  41. package/lib/esm/plans.js +626 -0
  42. package/lib/esm/plugin.d.ts +55 -0
  43. package/lib/esm/plugin.js +1 -0
  44. package/lib/esm/toDesktop.d.ts +191 -0
  45. package/lib/esm/toDesktop.js +1 -0
  46. package/lib/esm/translation.d.ts +2 -0
  47. package/lib/esm/translation.js +13 -0
  48. package/lib/esm/validations.d.ts +102 -0
  49. package/lib/{validations.js → esm/validations.js} +54 -56
  50. package/package.json +29 -20
  51. package/src/base.ts +90 -82
  52. package/src/desktopify.ts +82 -80
  53. package/src/desktopify2.ts +240 -240
  54. package/src/getSiteInfo.ts +6 -6
  55. package/src/hsm.ts +7 -7
  56. package/src/index.cjs.ts +19 -0
  57. package/src/index.ts +14 -14
  58. package/src/invitePermissionLabels.ts +20 -6
  59. package/src/personalAccessTokens.ts +12 -12
  60. package/src/plans.ts +191 -191
  61. package/src/plugin.ts +19 -19
  62. package/src/toDesktop.ts +70 -70
  63. package/src/translation.ts +2 -2
  64. package/src/validations.ts +51 -49
  65. package/tsconfig.esm.json +15 -0
  66. package/tsconfig.json +6 -4
  67. package/.prettierrc +0 -5
  68. package/lib/translation.d.ts +0 -2
  69. package/lib/{base.js → cjs/base.js} +3 -3
  70. /package/lib/{desktopify2.js → cjs/desktopify2.js} +0 -0
  71. /package/lib/{getSiteInfo.js → cjs/getSiteInfo.js} +0 -0
  72. /package/lib/{personalAccessTokens.js → cjs/personalAccessTokens.js} +0 -0
  73. /package/lib/{plugin.js → cjs/plugin.js} +0 -0
  74. /package/lib/{toDesktop.js → cjs/toDesktop.js} +0 -0
  75. /package/lib/{translation.js → cjs/translation.js} +0 -0
@@ -1,22 +1,22 @@
1
1
  export interface IAppFromServerProps {
2
- id: string;
3
- name: string;
4
2
  appModelId: string;
5
- url: string;
6
- meta: IAppFromServerPropsMeta;
3
+ appType: 'app' | 'electron' | 'menubar' | 'tabbed';
7
4
  html?: string;
8
5
  iconUrl?: string;
6
+ id: string;
7
+ meta: IAppFromServerPropsMeta;
8
+ name: string;
9
9
  secret: string;
10
- appType: 'app' | 'menubar' | 'tabbed' | 'electron';
10
+ url: string;
11
11
  }
12
12
  interface IAppFromServerPropsMeta {
13
13
  isFrameBlocked: boolean;
14
14
  isHttps?: boolean;
15
15
  }
16
16
  export interface IAppFromServerPropsDimension {
17
- width: number;
18
17
  height: number;
19
18
  type: string;
19
+ width: number;
20
20
  }
21
21
  export interface IAppFromServerPropsS3PutsEntity {
22
22
  ETag: string;
@@ -5,7 +5,7 @@
5
5
  * - mas-installer = Mac Installer Distribution (for Mac App Store)
6
6
  * - mas-dev = Apple Development
7
7
  */
8
- export type MacTarget = 'mac' | 'mac-installer' | 'mas' | 'mas-installer' | 'mas-dev';
8
+ export type MacTarget = 'mac-installer' | 'mac' | 'mas-dev' | 'mas-installer' | 'mas';
9
9
  export type WindowsTarget = 'windows';
10
10
  export declare function isMacTarget(type: string): type is MacTarget;
11
11
  export declare function isWindowsTarget(type: string): type is MacTarget;
@@ -4,7 +4,7 @@ exports.getAPIKeyNameFromHSM = exports.getCertificateNameFromHSM = void 0;
4
4
  exports.isMacTarget = isMacTarget;
5
5
  exports.isWindowsTarget = isWindowsTarget;
6
6
  function isMacTarget(type) {
7
- return ['mac', 'mac-installer', 'mas', 'mas-installer', 'mas-dev'].includes(type);
7
+ return ['mac', 'mac-installer', 'mas', 'mas-dev', 'mas-installer'].includes(type);
8
8
  }
9
9
  function isWindowsTarget(type) {
10
10
  return ['windows'].includes(type);
@@ -1,13 +1,12 @@
1
- export * from './toDesktop';
1
+ export * from './base';
2
2
  export * from './desktopify';
3
- export * from './validations';
3
+ export * from './desktopify2';
4
4
  export * from './getSiteInfo';
5
- export * from './plans';
6
- export * from './base';
7
- export * from './plugin';
8
5
  export * from './hsm';
9
6
  export * from './invitePermissionLabels';
10
7
  export * from './personalAccessTokens';
11
- export * from './desktopify2';
12
- declare const schemaVersion: string;
13
- export { schemaVersion };
8
+ export * from './plans';
9
+ export * from './plugin';
10
+ export * from './toDesktop';
11
+ export * from './validations';
12
+ export declare const schemaVersion: any;
@@ -15,17 +15,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.schemaVersion = void 0;
18
- const package_json_1 = require("../package.json");
19
- __exportStar(require("./toDesktop"), exports);
18
+ /* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports */
19
+ // CJS-specific entry point
20
+ // Path is relative to lib/cjs/ output directory
21
+ const packageJson = require('../../package.json');
22
+ __exportStar(require("./base"), exports);
20
23
  __exportStar(require("./desktopify"), exports);
21
- __exportStar(require("./validations"), exports);
24
+ __exportStar(require("./desktopify2"), exports);
22
25
  __exportStar(require("./getSiteInfo"), exports);
23
- __exportStar(require("./plans"), exports);
24
- __exportStar(require("./base"), exports);
25
- __exportStar(require("./plugin"), exports);
26
26
  __exportStar(require("./hsm"), exports);
27
27
  __exportStar(require("./invitePermissionLabels"), exports);
28
28
  __exportStar(require("./personalAccessTokens"), exports);
29
- __exportStar(require("./desktopify2"), exports);
30
- const schemaVersion = package_json_1.version;
31
- exports.schemaVersion = schemaVersion;
29
+ __exportStar(require("./plans"), exports);
30
+ __exportStar(require("./plugin"), exports);
31
+ __exportStar(require("./toDesktop"), exports);
32
+ __exportStar(require("./validations"), exports);
33
+ exports.schemaVersion = packageJson.version;
@@ -1,11 +1,13 @@
1
1
  import { UserIHaveSentInviteTo } from './toDesktop';
2
- export type InvitePermissionKey = 'canBuild' | 'canRelease' | 'canManageUsers';
2
+ export type InvitePermissionKey = 'canBuild' | 'canManageBilling' | 'canManageUsers' | 'canRelease';
3
3
  export type InvitePermissionFlags = Record<InvitePermissionKey, boolean>;
4
4
  export declare const INVITE_PERMISSION_LABELS: Record<InvitePermissionKey, string>;
5
5
  export declare const formatInvitePermissionSummary: (permissions: Partial<InvitePermissionFlags>) => string;
6
6
  export type NormalizedInvitePermissions = {
7
7
  canBuild: boolean;
8
- canRelease: boolean;
8
+ canManageBilling: boolean;
9
9
  canManageUsers: boolean;
10
+ canRelease: boolean;
10
11
  };
12
+ export declare const FULL_OWNER_PERMISSIONS: NormalizedInvitePermissions;
11
13
  export declare const normalizeInvitePermissions: (permissions?: UserIHaveSentInviteTo["permissions"]) => NormalizedInvitePermissions;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeInvitePermissions = exports.formatInvitePermissionSummary = exports.INVITE_PERMISSION_LABELS = void 0;
3
+ exports.normalizeInvitePermissions = exports.FULL_OWNER_PERMISSIONS = exports.formatInvitePermissionSummary = exports.INVITE_PERMISSION_LABELS = void 0;
4
4
  exports.INVITE_PERMISSION_LABELS = {
5
5
  canBuild: 'Can build',
6
- canRelease: 'Can release',
6
+ canManageBilling: 'Can manage billing',
7
7
  canManageUsers: 'Can manage users',
8
+ canRelease: 'Can release',
8
9
  };
9
10
  const formatInvitePermissionSummary = (permissions) => {
10
11
  const enabled = Object.entries(permissions)
@@ -13,9 +14,16 @@ const formatInvitePermissionSummary = (permissions) => {
13
14
  return enabled.join(', ');
14
15
  };
15
16
  exports.formatInvitePermissionSummary = formatInvitePermissionSummary;
17
+ exports.FULL_OWNER_PERMISSIONS = {
18
+ canBuild: true,
19
+ canManageBilling: true,
20
+ canManageUsers: true,
21
+ canRelease: true,
22
+ };
16
23
  const normalizeInvitePermissions = (permissions) => ({
17
24
  canBuild: (permissions === null || permissions === void 0 ? void 0 : permissions.canBuild) === true,
18
- canRelease: (permissions === null || permissions === void 0 ? void 0 : permissions.canRelease) === true,
25
+ canManageBilling: (permissions === null || permissions === void 0 ? void 0 : permissions.canManageBilling) === true,
19
26
  canManageUsers: (permissions === null || permissions === void 0 ? void 0 : permissions.canManageUsers) === true,
27
+ canRelease: (permissions === null || permissions === void 0 ? void 0 : permissions.canRelease) === true,
20
28
  });
21
29
  exports.normalizeInvitePermissions = normalizeInvitePermissions;
@@ -1,24 +1,24 @@
1
- export type PatStatus = 'active' | 'revoked' | 'expired';
2
- export type PatPermissionSource = 'owner' | 'delegate';
1
+ export type PatStatus = 'active' | 'expired' | 'revoked';
2
+ export type PatPermissionSource = 'delegate' | 'owner';
3
3
  export interface PatAppScope {
4
- ownerUserId: string;
5
4
  applicationId: string;
5
+ ownerUserId: string;
6
6
  permissionSource: PatPermissionSource;
7
7
  }
8
8
  export interface PatUsageApp {
9
- ownerUserId: string;
10
9
  applicationId: string;
10
+ ownerUserId: string;
11
11
  }
12
12
  export interface PatSummary {
13
- tokenId: string;
14
- tokenPrefix: string;
15
- description: string;
16
- createdAt: string | null;
17
- expiresAt: string | null;
18
- revokedAt: string | null;
19
- lastUsedAt: string | null;
20
- lastUsedByApp: PatUsageApp | null;
21
13
  appScopes: PatAppScope[];
14
+ createdAt: null | string;
15
+ description: string;
16
+ expiresAt: null | string;
17
+ lastUsedAt: null | string;
18
+ lastUsedByApp: null | PatUsageApp;
19
+ revokedAt: null | string;
22
20
  status: PatStatus;
21
+ tokenId: string;
22
+ tokenPrefix: string;
23
23
  }
24
24
  export type PatListItem = PatSummary;
@@ -1,10 +1,10 @@
1
1
  import { Subscription } from './base';
2
2
  export type PriceKey = `${'monthly' | 'yearly'}_${string}`;
3
3
  export type Price = {
4
+ amount: number;
4
5
  id: string;
5
- status: 'active' | 'inactive';
6
6
  period: 'monthly' | 'yearly';
7
- amount: number;
7
+ status: 'active' | 'inactive';
8
8
  };
9
9
  export type Product<T extends PriceKey = any> = {
10
10
  id: string;
@@ -12,88 +12,88 @@ export type Product<T extends PriceKey = any> = {
12
12
  };
13
13
  export type PlanTier = 'basic' | 'legacy_pro' | 'pro' | 'scale';
14
14
  export type Plan = {
15
- tier: PlanTier;
16
- label: string;
17
15
  eligiblePlanTiers: PlanTier[];
16
+ label: string;
18
17
  products: Record<'dev' | 'prod', Product[]>;
18
+ tier: PlanTier;
19
19
  };
20
20
  export type Configuration = {
21
- default_return_url: string;
22
21
  business_profile: {
23
22
  headline: string;
24
23
  privacy_policy_url: string;
25
24
  terms_of_service_url: string;
26
25
  };
27
- metadata: {
28
- [name: string]: string | number | null;
29
- };
26
+ default_return_url: string;
30
27
  features: {
31
28
  payment_method_update: {
32
29
  enabled: boolean;
33
30
  };
34
31
  subscription_update: {
35
- enabled: boolean;
36
32
  default_allowed_updates: ('price' | 'promotion_code' | 'quantity')[];
33
+ enabled: boolean;
37
34
  products: {
38
- product: string;
39
35
  prices: string[];
36
+ product: string;
40
37
  }[];
41
38
  };
42
39
  };
40
+ metadata: {
41
+ [name: string]: null | number | string;
42
+ };
43
43
  };
44
44
  export declare enum PortalConfigKey {
45
- CLIUpdateDev = "cli_update_dev",
46
- CLIUpdateProd = "cli_update_prod",
47
- CLIUpgradeDev = "cli_upgrade_dev",
48
- CLIUpgradeProd = "cli_upgrade_prod",
49
45
  BuilderUpdateDev = "builder_update_dev",
50
46
  BuilderUpdateProd = "builder_update_prod",
51
47
  BuilderUpgradeDev = "builder_upgrade_dev",
52
- BuilderUpgradeProd = "builder_upgrade_prod"
48
+ BuilderUpgradeProd = "builder_upgrade_prod",
49
+ CLIUpdateDev = "cli_update_dev",
50
+ CLIUpdateProd = "cli_update_prod",
51
+ CLIUpgradeDev = "cli_upgrade_dev",
52
+ CLIUpgradeProd = "cli_upgrade_prod"
53
53
  }
54
54
  export declare const products: {
55
55
  readonly dev: {
56
56
  readonly builder: {
57
- readonly essential: Product<"monthly_99" | "monthly_125" | "yearly_1200">;
57
+ readonly essential: Product<"monthly_125" | "monthly_99" | "yearly_1200">;
58
58
  readonly professional: Product<"monthly_199" | "monthly_240" | "monthly_300" | "yearly_2880">;
59
59
  };
60
60
  readonly cli: {
61
+ readonly founder: Product<"monthly_125" | "yearly_1200" | "monthly_100">;
61
62
  readonly founder30: Product<"monthly_30">;
62
63
  readonly founder50: Product<"monthly_50" | "monthly_90">;
63
- readonly founder: Product<"monthly_125" | "yearly_1200" | "monthly_100">;
64
64
  readonly performance: Product<"monthly_300" | "monthly_375" | "yearly_3600">;
65
65
  readonly scale: Product<"monthly_1200" | "monthly_1500" | "yearly_14400">;
66
66
  };
67
67
  readonly legacy: {
68
+ readonly business: Product<"monthly_199">;
69
+ readonly enterprise: Product<"monthly_700">;
68
70
  readonly essential: Product<"monthly_58">;
69
71
  readonly essentialNew: Product<"monthly_58" | "yearly_580">;
72
+ readonly growth: Product<"monthly_199">;
70
73
  readonly professional: Product<"monthly_199" | "yearly_1990" | "yearly_2388">;
71
74
  readonly startup: Product<"monthly_49" | "yearly_200">;
72
- readonly growth: Product<"monthly_199">;
73
- readonly business: Product<"monthly_199">;
74
- readonly enterprise: Product<"monthly_700">;
75
75
  };
76
76
  };
77
77
  readonly prod: {
78
78
  readonly builder: {
79
- readonly essential: Product<"monthly_99" | "monthly_125" | "yearly_1200">;
79
+ readonly essential: Product<"monthly_125" | "monthly_99" | "yearly_1200">;
80
80
  readonly professional: Product<"monthly_199" | "monthly_240" | "monthly_300" | "yearly_2880">;
81
81
  };
82
82
  readonly cli: {
83
+ readonly founder: Product<"monthly_125" | "yearly_1200" | "monthly_100">;
83
84
  readonly founder30: Product<"monthly_30">;
84
85
  readonly founder50: Product<"monthly_50" | "monthly_90">;
85
- readonly founder: Product<"monthly_125" | "yearly_1200" | "monthly_100">;
86
86
  readonly performance: Product<"monthly_300" | "monthly_375" | "yearly_3600">;
87
87
  readonly scale: Product<"monthly_1200" | "monthly_1500" | "yearly_14400">;
88
88
  };
89
89
  readonly legacy: {
90
+ readonly business: Product<"monthly_199">;
91
+ readonly enterprise: Product<"monthly_700">;
90
92
  readonly essential: Product<"monthly_58">;
91
93
  readonly essentialNew: Product<"monthly_58" | "yearly_580">;
94
+ readonly growth: Product<"monthly_199">;
92
95
  readonly professional: Product<"monthly_199" | "yearly_1990" | "yearly_2388">;
93
96
  readonly startup: Product<"monthly_49" | "yearly_200">;
94
- readonly growth: Product<"monthly_199">;
95
- readonly business: Product<"monthly_199">;
96
- readonly enterprise: Product<"monthly_700">;
97
97
  };
98
98
  };
99
99
  };
@@ -125,6 +125,6 @@ export declare const configurations: {
125
125
  };
126
126
  export declare const hasActiveSub: (sub?: Subscription) => boolean;
127
127
  export declare const hasPlan: (plan: Plan, sub?: Subscription) => boolean;
128
- export declare const getPlan: (sub?: Pick<Subscription, "productId" | "planId">) => Plan | null;
129
- export type LegacyProductKey = 'startup' | 'business' | 'essential' | 'growth' | 'essential_new' | 'professional' | 'professional_annual' | 'professional_annual_full_price' | 'cli_founder' | 'cli_founder_30' | 'cli_founder_50' | 'cli_performance' | 'cli_scale' | 'builder_essential' | 'builder_professional' | 'enterprise';
128
+ export declare const getPlan: (sub?: Pick<Subscription, "planId" | "productId">) => null | Plan;
129
+ export type LegacyProductKey = 'builder_essential' | 'builder_professional' | 'business' | 'cli_founder_30' | 'cli_founder_50' | 'cli_founder' | 'cli_performance' | 'cli_scale' | 'enterprise' | 'essential_new' | 'essential' | 'growth' | 'professional_annual_full_price' | 'professional_annual' | 'professional' | 'startup';
130
130
  export declare const LegacyProductRecord: Record<LegacyProductKey, Record<'dev' | 'prod', Product>>;