@todesktop/shared 7.188.65 → 7.188.67

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/README.md ADDED
@@ -0,0 +1,75 @@
1
+ ## Stripe Subscriptions
2
+
3
+ Most of the code for coordinating Stripe subscriptions can be found in `plans.ts`. Conceptually, we organize subscriptions as follows:
4
+
5
+ - A `Price` captures the ID information of a Stripe Price and it's current status:
6
+ - `inactive` means that the price should no longer be used (but may have been used previously).
7
+ - `active` means that the price should be used going forward.
8
+ - A `Product` maps to what is shown in Stripe's [Product Catalogue](https://dashboard.stripe.com/products?active=true) UI. These help use organize the dev and prod versions of a `Product`, as well as their underlying `productId` and `priceIds`.
9
+ - A `Plan` is a collection of `Product`s, organized by their tier (basic, legacy_pro, pro, scale).
10
+
11
+ Each Plan also specifies the `eligiblePlanTiers` that it accepts for validation purposes. E.g. the basic plan specifies `['basic', 'legacy_pro', 'pro', 'scale']` in its `eligiblePlanTiers` field, meaning that Products belonging within any of those tiers would satisfy validation requirements. Similarly, the basic plan specifies `['scale']` in its tiers field, meaning that only **Products** belonging to the scale **Plans** would satisfy validation.
12
+
13
+ ### Adding a new subscription price
14
+
15
+ Before adding a new price, you'll first need to identify the Stripe [Stripe Product](https://dashboard.stripe.com/products?active=true) that the price should be added to.
16
+
17
+ Once you've added a new price to the product in Stripe's `live` and `test` mode, then you can come back and add it to the relevant product in `plans.ts`.
18
+
19
+ For example, these are the dev and prod records for the legacy enterprise product:
20
+
21
+ ```ts
22
+ const legacyEnterpriseDev = createProduct('prod_Hc9PMnHUmHvOlw', {
23
+ monthly_700: createPrice('price_1H2v6JIewCKA2h0IgUwsuctb', 'active'),
24
+ });
25
+
26
+ const legacyEnterpriseProd = createProduct('prod_GuGGWeMQ3SCuE9', {
27
+ monthly_700: createPrice('plan_GuGICX6nRtDthN', 'active'),
28
+ });
29
+ ```
30
+
31
+ If you added a new Stripe price to this product that is billed yearly for $10,000, then you would add update the products as follows:
32
+
33
+ ```ts
34
+ const legacyEnterpriseDev = createProduct('prod_Hc9PMnHUmHvOlw', {
35
+ monthly_700: createPrice('price_1H2v6JIewCKA2h0IgUwsuctb', 'active'),
36
+ yearly_10000: createPrice('...', 'active'),
37
+ });
38
+
39
+ const legacyEnterpriseProd = createProduct('prod_GuGGWeMQ3SCuE9', {
40
+ monthly_700: createPrice('plan_GuGICX6nRtDthN', 'active'),
41
+ yearly_10000: createPrice('...', 'active'),
42
+ });
43
+ ```
44
+
45
+ ### Rebuilding the Stripe Customer Portals
46
+
47
+ ToDesktop's subscription flow needs to support both **CLI** and **ToDesktop Builder** customers. To achieve this, we dynamically create/load billing portals based on whether the customer is a **CLI** or **ToDesktop Builder** user, whether the customer needs to **Upgrade** or **Update** their plan, and whether the environment is in prod or dev.
48
+
49
+ This leaves us with 8 unique customer portal configurations:
50
+
51
+ - _cliUpdateConfigurationDev_
52
+ - _cliUpdateConfigurationProd_
53
+ - _cliUpgradeConfigurationDev_
54
+ - _cliUpgradeConfigurationProd_
55
+ - _builderUpdateConfigurationDev_
56
+ - _builderUpdateConfigurationProd_
57
+ - _builderUpgradeConfigurationDev_
58
+ - _builderUpgradeConfigurationProd_
59
+
60
+ Each configuration specifies the products and prices (with an `active` status) that should be displayed when a user navigates to the customer billing portal.
61
+
62
+ The web app and desktop app then only need to specify the `PortalConfigKey` when creating a checkout session from the client:
63
+
64
+ ```ts
65
+ // begin a CLI upgrade customer portal session
66
+ await createCustomerPortalSession({
67
+ configuration: PortalConfigKey.CLIUpgradeProd,
68
+ flowData: {
69
+ type: 'subscription_update',
70
+ subscription_update: { subscription: subscription.id },
71
+ },
72
+ });
73
+ ```
74
+
75
+ If you have updated the products that are used by any of the portal configurations, then you'll also need to increase the `PORTAL_VERSION` constant by 1. This will ensure that the portals are rebuilt to use the latest products and prices. This happens in `createCustomerPortalSession` in the web app.
@@ -0,0 +1,57 @@
1
+ import typescriptEslint from '@typescript-eslint/eslint-plugin';
2
+ import prettier from 'eslint-plugin-prettier';
3
+ import globals from 'globals';
4
+ import tsParser from '@typescript-eslint/parser';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import js from '@eslint/js';
8
+ import { FlatCompat } from '@eslint/eslintrc';
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+ const compat = new FlatCompat({
13
+ baseDirectory: __dirname,
14
+ recommendedConfig: js.configs.recommended,
15
+ allConfig: js.configs.all,
16
+ });
17
+
18
+ export default [
19
+ ...compat.extends(
20
+ 'eslint:recommended',
21
+ 'plugin:@typescript-eslint/recommended',
22
+ 'prettier'
23
+ ),
24
+ {
25
+ plugins: {
26
+ '@typescript-eslint': typescriptEslint,
27
+ prettier,
28
+ },
29
+
30
+ languageOptions: {
31
+ globals: {
32
+ ...globals.node,
33
+ },
34
+
35
+ parser: tsParser,
36
+ ecmaVersion: 2020,
37
+ sourceType: 'module',
38
+
39
+ parserOptions: {
40
+ project: './tsconfig.json',
41
+ },
42
+ },
43
+
44
+ rules: {
45
+ 'prettier/prettier': 'error',
46
+
47
+ '@typescript-eslint/no-misused-promises': [
48
+ 'error',
49
+ {
50
+ checksVoidReturn: false,
51
+ },
52
+ ],
53
+
54
+ '@typescript-eslint/no-explicit-any': 'warn',
55
+ },
56
+ },
57
+ ];
package/lib/base.d.ts CHANGED
@@ -2,11 +2,11 @@ import { CIRunner, ExtraFileReference, FilePath, IAppBuilderLib, PlatformName, R
2
2
  export interface Schemable {
3
3
  schemaVersion?: number;
4
4
  }
5
- declare type CompositeIdFileLocationKey = string;
6
- export declare type StaticAnalysisItem = {
5
+ type CompositeIdFileLocationKey = string;
6
+ export type StaticAnalysisItem = {
7
7
  hidden: boolean;
8
8
  };
9
- export declare type ProgressTypes = 'queued' | 'progress' | 'done' | 'error';
9
+ export type ProgressTypes = 'queued' | 'progress' | 'done' | 'error';
10
10
  export interface IChecklistItem {
11
11
  [id: string]: boolean;
12
12
  }
@@ -183,7 +183,7 @@ export interface CustomWindowsCodeSignEV {
183
183
  hsmCertType: WindowsHSMCertType.ev;
184
184
  hsmCertName: string;
185
185
  }
186
- export declare type CustomMacCodeSign = {
186
+ export type CustomMacCodeSign = {
187
187
  type: 'url';
188
188
  certName: string;
189
189
  certPassword: string;
@@ -191,7 +191,7 @@ export declare type CustomMacCodeSign = {
191
191
  } | {
192
192
  type: 'hsm';
193
193
  };
194
- export declare type CustomMacNotarization = CustomNotarizationApiKeyAuth | CustomNotarizationPasswordAuth | CustomNotarizationPasswordHsmAuth;
194
+ export type CustomMacNotarization = CustomNotarizationApiKeyAuth | CustomNotarizationPasswordAuth | CustomNotarizationPasswordHsmAuth;
195
195
  export interface CustomNotarizationApiKeyAuth {
196
196
  appleApiKeyId: string;
197
197
  appleApiIssuer: string;
@@ -207,7 +207,7 @@ export interface CustomNotarizationPasswordHsmAuth {
207
207
  teamId: string;
208
208
  type: 'hsm';
209
209
  }
210
- export declare type ReleaseRedirectionRule = {
210
+ export type ReleaseRedirectionRule = {
211
211
  appId: string;
212
212
  rule: 'app';
213
213
  } | {
@@ -236,12 +236,7 @@ export interface BaseApp extends Schemable {
236
236
  id: string;
237
237
  relationshipToParent: string;
238
238
  } | null;
239
- subscription?: {
240
- status: string;
241
- subscriptionId: string;
242
- itemId: string;
243
- planId: string;
244
- };
239
+ subscription?: Subscription;
245
240
  shouldCreate32BitWindowsArtifacts?: boolean;
246
241
  shouldCreateAppImages?: boolean;
247
242
  shouldCreateAppleIntelArtifacts?: boolean;
@@ -271,4 +266,12 @@ export interface BaseApp extends Schemable {
271
266
  shouldPinToVersion?: boolean;
272
267
  };
273
268
  }
269
+ export type Subscription = {
270
+ status: string;
271
+ subscriptionId: string;
272
+ itemId: string;
273
+ planId: string;
274
+ productId?: string;
275
+ priceId?: string;
276
+ };
274
277
  export {};
package/lib/base.js CHANGED
@@ -8,14 +8,14 @@ var WindowsEVOnboardingSteps;
8
8
  WindowsEVOnboardingSteps["hasBeenVerified"] = "hasBeenVerified";
9
9
  WindowsEVOnboardingSteps["hasGeneratedCert"] = "hasGeneratedCert";
10
10
  WindowsEVOnboardingSteps["hasUploadedCert"] = "hasUploadedCert";
11
- })(WindowsEVOnboardingSteps = exports.WindowsEVOnboardingSteps || (exports.WindowsEVOnboardingSteps = {}));
11
+ })(WindowsEVOnboardingSteps || (exports.WindowsEVOnboardingSteps = WindowsEVOnboardingSteps = {}));
12
12
  var WindowsEVOnboardingProvider;
13
13
  (function (WindowsEVOnboardingProvider) {
14
14
  WindowsEVOnboardingProvider["globalsign"] = "globalsign";
15
15
  WindowsEVOnboardingProvider["other"] = "other";
16
- })(WindowsEVOnboardingProvider = exports.WindowsEVOnboardingProvider || (exports.WindowsEVOnboardingProvider = {}));
16
+ })(WindowsEVOnboardingProvider || (exports.WindowsEVOnboardingProvider = WindowsEVOnboardingProvider = {}));
17
17
  var WindowsHSMCertType;
18
18
  (function (WindowsHSMCertType) {
19
19
  WindowsHSMCertType["ev"] = "ev";
20
20
  WindowsHSMCertType["file"] = "file";
21
- })(WindowsHSMCertType = exports.WindowsHSMCertType || (exports.WindowsHSMCertType = {}));
21
+ })(WindowsHSMCertType || (exports.WindowsHSMCertType = WindowsHSMCertType = {}));
@@ -1,7 +1,7 @@
1
1
  import { IApp2 } from './desktopify2';
2
2
  import { IApp } from './toDesktop';
3
3
  import { Configuration, PackagerOptions, PublishOptions } from 'app-builder-lib';
4
- declare type appBuilderLib = PackagerOptions & PublishOptions;
4
+ type appBuilderLib = PackagerOptions & PublishOptions;
5
5
  export interface IAppBuilderLib extends appBuilderLib {
6
6
  config: Configuration;
7
7
  }
@@ -9,15 +9,15 @@ export interface ExtraFileReference {
9
9
  from: FilePath;
10
10
  to?: FilePath;
11
11
  }
12
- export declare type ISODate = string;
12
+ export type ISODate = string;
13
13
  export declare enum PlatformName {
14
14
  linux = "linux",
15
15
  mac = "mac",
16
16
  windows = "windows"
17
17
  }
18
- export declare type FilePath = string;
19
- export declare type SemanticVersion = string;
20
- export declare type URL = string;
18
+ export type FilePath = string;
19
+ export type SemanticVersion = string;
20
+ export type URL = string;
21
21
  export declare enum PackageManager {
22
22
  npm = "npm",
23
23
  yarn = "yarn",
@@ -40,30 +40,30 @@ export declare enum AnalysisStatus {
40
40
  done = "done",
41
41
  error = "error"
42
42
  }
43
- export declare type Arch = 'ia32' | 'x64' | 'arm64' | 'universal';
44
- export declare type MacArch = 'x64' | 'arm64' | 'universal';
45
- export declare type LinuxArch = 'x64' | 'arm64';
46
- export declare type WindowsArch = 'ia32' | 'x64' | 'arm64' | 'universal';
47
- export declare type LinuxArtifactName = 'appImage' | 'deb' | 'rpm' | 'snap';
48
- export declare type MacArtifactName = 'dmg' | 'zip' | 'installer' | 'mas' | 'pkg';
49
- export declare type WindowsArtifactName = 'msi' | 'nsis' | 'nsis-web' | 'nsis-web-7z' | 'appx';
50
- declare type ArtifactObject = {
43
+ export type Arch = 'ia32' | 'x64' | 'arm64' | 'universal';
44
+ export type MacArch = 'x64' | 'arm64' | 'universal';
45
+ export type LinuxArch = 'x64' | 'arm64';
46
+ export type WindowsArch = 'ia32' | 'x64' | 'arm64' | 'universal';
47
+ export type LinuxArtifactName = 'appImage' | 'deb' | 'rpm' | 'snap';
48
+ export type MacArtifactName = 'dmg' | 'zip' | 'installer' | 'mas' | 'pkg';
49
+ export type WindowsArtifactName = 'msi' | 'nsis' | 'nsis-web' | 'nsis-web-7z' | 'appx';
50
+ type ArtifactObject = {
51
51
  size: number;
52
52
  standardUrl: URL;
53
53
  url: URL;
54
54
  };
55
- declare type ArtifactDownload = Record<Arch, ArtifactObject | null> | null;
56
- declare type InstallerArtifact = {
55
+ type ArtifactDownload = Record<Arch, ArtifactObject | null> | null;
56
+ type InstallerArtifact = {
57
57
  [K in Arch]: (ArtifactObject & {
58
58
  isPinnedToVersion?: boolean;
59
59
  }) | null;
60
60
  };
61
- export declare type LinuxArtifactDownloads = Record<LinuxArtifactName, ArtifactDownload>;
62
- export declare type MacArtifactDownloads = {
61
+ export type LinuxArtifactDownloads = Record<LinuxArtifactName, ArtifactDownload>;
62
+ export type MacArtifactDownloads = {
63
63
  [K in MacArtifactName]: K extends 'installer' ? InstallerArtifact : ArtifactDownload;
64
64
  };
65
- export declare type WindowsArtifactDownloads = Record<WindowsArtifactName, ArtifactDownload>;
66
- export declare type CodeSignSkipReason = 'no-cert' | 'user-disabled';
65
+ export type WindowsArtifactDownloads = Record<WindowsArtifactName, ArtifactDownload>;
66
+ export type CodeSignSkipReason = 'no-cert' | 'user-disabled';
67
67
  export interface PlatformBuild {
68
68
  appBuilderLibConfig?: IAppBuilderLib;
69
69
  artifactDownloads?: LinuxArtifactDownloads | MacArtifactDownloads | WindowsArtifactDownloads;
@@ -90,7 +90,7 @@ export interface PlatformBuild {
90
90
  startedAt: ISODate;
91
91
  status: BuildStatus;
92
92
  }
93
- export declare type CIRunner = 'circle' | 'azure';
93
+ export type CIRunner = 'circle' | 'azure';
94
94
  export interface Build {
95
95
  appCustomDomain?: string;
96
96
  appName: string;
@@ -159,7 +159,7 @@ export interface Build {
159
159
  };
160
160
  windows?: PlatformBuild;
161
161
  }
162
- export declare type BundlePhobiaItem = {
162
+ export type BundlePhobiaItem = {
163
163
  result: {
164
164
  description: string;
165
165
  gzip: string;
@@ -168,7 +168,7 @@ export declare type BundlePhobiaItem = {
168
168
  } | null;
169
169
  error: string | null;
170
170
  };
171
- export declare type ComputedBuildProperties = Pick<Build, 'desktopifyVersion' | 'electronVersionUsed' | 'endedAt' | 'errorMessage' | 'releasedAt' | 'standardUniversalDownloadUrl' | 'startedAt' | 'status' | 'universalDownloadUrl'>;
171
+ export type ComputedBuildProperties = Pick<Build, 'desktopifyVersion' | 'electronVersionUsed' | 'endedAt' | 'errorMessage' | 'releasedAt' | 'standardUniversalDownloadUrl' | 'startedAt' | 'status' | 'universalDownloadUrl'>;
172
172
  export declare enum ManifestCategory {
173
173
  primary = "primary",
174
174
  buildStamped = "build-stamped",
@@ -276,7 +276,7 @@ export interface SmokeTestPerformance {
276
276
  */
277
277
  webContentsFinishLoadMs?: number;
278
278
  }
279
- export declare type SmokeTestState = 'progress' | 'done' | 'error' | 'skipped';
279
+ export type SmokeTestState = 'progress' | 'done' | 'error' | 'skipped';
280
280
  export declare const hasBuildKickedOff: (build: Build) => boolean;
281
281
  export declare const isPlatformBuildRunning: (platformBuild: PlatformBuild) => boolean;
282
282
  export declare const isCiBuildRunning: (build: Build) => boolean;
package/lib/desktopify.js CHANGED
@@ -6,13 +6,13 @@ var PlatformName;
6
6
  PlatformName["linux"] = "linux";
7
7
  PlatformName["mac"] = "mac";
8
8
  PlatformName["windows"] = "windows";
9
- })(PlatformName = exports.PlatformName || (exports.PlatformName = {}));
9
+ })(PlatformName || (exports.PlatformName = PlatformName = {}));
10
10
  var PackageManager;
11
11
  (function (PackageManager) {
12
12
  PackageManager["npm"] = "npm";
13
13
  PackageManager["yarn"] = "yarn";
14
14
  PackageManager["pnpm"] = "pnpm";
15
- })(PackageManager = exports.PackageManager || (exports.PackageManager = {}));
15
+ })(PackageManager || (exports.PackageManager = PackageManager = {}));
16
16
  var BuildStatus;
17
17
  (function (BuildStatus) {
18
18
  BuildStatus["queued"] = "queued";
@@ -21,7 +21,7 @@ var BuildStatus;
21
21
  BuildStatus["preparation"] = "preparation";
22
22
  BuildStatus["succeeded"] = "succeeded";
23
23
  BuildStatus["cancelled"] = "cancelled";
24
- })(BuildStatus = exports.BuildStatus || (exports.BuildStatus = {}));
24
+ })(BuildStatus || (exports.BuildStatus = BuildStatus = {}));
25
25
  var AnalysisStatus;
26
26
  (function (AnalysisStatus) {
27
27
  AnalysisStatus["notStarted"] = "notStarted";
@@ -31,20 +31,21 @@ var AnalysisStatus;
31
31
  AnalysisStatus["analyzing"] = "analyzing";
32
32
  AnalysisStatus["done"] = "done";
33
33
  AnalysisStatus["error"] = "error";
34
- })(AnalysisStatus = exports.AnalysisStatus || (exports.AnalysisStatus = {}));
34
+ })(AnalysisStatus || (exports.AnalysisStatus = AnalysisStatus = {}));
35
35
  var ManifestCategory;
36
36
  (function (ManifestCategory) {
37
37
  ManifestCategory["primary"] = "primary";
38
38
  ManifestCategory["buildStamped"] = "build-stamped";
39
39
  ManifestCategory["versioned"] = "versioned";
40
- })(ManifestCategory = exports.ManifestCategory || (exports.ManifestCategory = {}));
41
- exports.hasBuildKickedOff = (build) => {
40
+ })(ManifestCategory || (exports.ManifestCategory = ManifestCategory = {}));
41
+ const hasBuildKickedOff = (build) => {
42
42
  if (!build) {
43
43
  return false;
44
44
  }
45
45
  return build.status && build.status !== BuildStatus.preparation;
46
46
  };
47
- exports.isPlatformBuildRunning = (platformBuild) => {
47
+ exports.hasBuildKickedOff = hasBuildKickedOff;
48
+ const isPlatformBuildRunning = (platformBuild) => {
48
49
  if (!platformBuild) {
49
50
  return false;
50
51
  }
@@ -53,21 +54,25 @@ exports.isPlatformBuildRunning = (platformBuild) => {
53
54
  ('failed' !== platformBuild.status ||
54
55
  platformBuild.numberOfAttemptedBuilds < 2));
55
56
  };
57
+ exports.isPlatformBuildRunning = isPlatformBuildRunning;
56
58
  // NOTE: this relies on Firestore solely
57
- exports.isCiBuildRunning = (build) => {
59
+ const isCiBuildRunning = (build) => {
58
60
  if (!build) {
59
61
  return false;
60
62
  }
61
63
  return (build.status === 'building' ||
62
64
  (build.status === 'failed' &&
63
65
  ['linux', 'mac', 'windows'].some((platform) => build.status === 'building' ||
64
- (build.status === 'failed' && exports.isPlatformBuildRunning(build[platform])))));
66
+ (build.status === 'failed' && (0, exports.isPlatformBuildRunning)(build[platform])))));
65
67
  };
66
- exports.isBuildRunning = (build) => {
68
+ exports.isCiBuildRunning = isCiBuildRunning;
69
+ const isBuildRunning = (build) => {
67
70
  if (!build) {
68
71
  return false;
69
72
  }
70
73
  return (!['cancelled', 'succeeded'].includes(build.status) &&
71
- ['linux', 'mac', 'windows'].some((platform) => exports.isPlatformBuildRunning(build[platform])));
74
+ ['linux', 'mac', 'windows'].some((platform) => (0, exports.isPlatformBuildRunning)(build[platform])));
72
75
  };
73
- exports.isBuildCancellable = (build) => exports.hasBuildKickedOff(build) && exports.isBuildRunning(build);
76
+ exports.isBuildRunning = isBuildRunning;
77
+ const isBuildCancellable = (build) => (0, exports.hasBuildKickedOff)(build) && (0, exports.isBuildRunning)(build);
78
+ exports.isBuildCancellable = isBuildCancellable;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ISwitchableValue } from './toDesktop';
3
2
  import { MenuItemConstructorOptions, BrowserWindowConstructorOptions, WebPreferences, NotificationConstructorOptions, MessageBoxOptions } from '@todesktop/client-electron-types';
4
3
  import { BaseApp } from './base';
@@ -27,11 +26,11 @@ export interface FileAssetDetails extends BaseAssetDetails {
27
26
  md5Hash: string;
28
27
  type: 'file';
29
28
  }
30
- export declare type AssetDetails = AppIconAssetDetails | MenuIconAssetDetails | TrayMenubarIconAssetDetails | FileAssetDetails;
29
+ export type AssetDetails = AppIconAssetDetails | MenuIconAssetDetails | TrayMenubarIconAssetDetails | FileAssetDetails;
31
30
  /**
32
31
  * Custom ToDesktop Roles for Application & Tray Menus
33
32
  */
34
- declare type todesktopRoles = 'todesktop:launch-at-startup' | 'todesktop:check-for-updates' | 'todesktop:quit' | 'todesktop:quit-completely' | 'todesktop:new-window' | 'todesktop:new-tab' | 'todesktop:check-for-updates' | 'todesktop:history-home' | 'todesktop:history-back' | 'todesktop:history-forward' | 'todesktop:show-window' | 'todesktop:hide-window' | 'todesktop:toggle-window' | 'todesktop:toggle-window0' | 'todesktop:toggle-window1' | 'todesktop:toggle-window2' | 'todesktop:toggle-window3' | 'todesktop:toggle-window4';
33
+ type todesktopRoles = 'todesktop:launch-at-startup' | 'todesktop:check-for-updates' | 'todesktop:quit' | 'todesktop:quit-completely' | 'todesktop:new-window' | 'todesktop:new-tab' | 'todesktop:check-for-updates' | 'todesktop:history-home' | 'todesktop:history-back' | 'todesktop:history-forward' | 'todesktop:show-window' | 'todesktop:hide-window' | 'todesktop:toggle-window' | 'todesktop:toggle-window0' | 'todesktop:toggle-window1' | 'todesktop:toggle-window2' | 'todesktop:toggle-window3' | 'todesktop:toggle-window4';
35
34
  export interface DesktopifyMenuItemConstructorOptions extends Omit<MenuItemConstructorOptions, 'role' | 'submenu'> {
36
35
  platforms?: NodeJS.Platform[];
37
36
  submenu?: DesktopifyMenuItemConstructorOptions[];
@@ -51,7 +50,7 @@ export interface DesktopifyMenuItemConstructorOptions extends Omit<MenuItemConst
51
50
  *
52
51
  * @param windowId - The id of the window to toggle
53
52
  */
54
- export declare type DesktopifyAppTrayToggleWindowAction = {
53
+ export type DesktopifyAppTrayToggleWindowAction = {
55
54
  role: 'toggleWindow';
56
55
  windowId: string;
57
56
  };
@@ -60,7 +59,7 @@ export declare type DesktopifyAppTrayToggleWindowAction = {
60
59
  *
61
60
  * @param menu - The menu to show when action triggered
62
61
  */
63
- export declare type DesktopifyAppTrayToggleMenuAction = {
62
+ export type DesktopifyAppTrayToggleMenuAction = {
64
63
  role: 'toggleMenu';
65
64
  menu: DesktopifyMenuItemConstructorOptions[];
66
65
  };
@@ -69,17 +68,17 @@ export declare type DesktopifyAppTrayToggleMenuAction = {
69
68
  *
70
69
  * @param event - The name of the event
71
70
  */
72
- export declare type DesktopifyAppTrayJSEventAction = {
71
+ export type DesktopifyAppTrayJSEventAction = {
73
72
  role: 'jsEvent';
74
73
  event: string;
75
74
  };
76
75
  /**
77
76
  * No Action Tray Action
78
77
  */
79
- export declare type DesktopifyAppTrayNoAction = {
78
+ export type DesktopifyAppTrayNoAction = {
80
79
  role: 'noAction';
81
80
  };
82
- export declare type DesktopifyAppTrayAction = DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction | DesktopifyAppTrayJSEventAction | DesktopifyAppTrayNoAction;
81
+ export type DesktopifyAppTrayAction = DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction | DesktopifyAppTrayJSEventAction | DesktopifyAppTrayNoAction;
83
82
  export interface DesktopifyAppTray {
84
83
  id: string;
85
84
  objectId?: string;
@@ -98,21 +97,21 @@ export interface DesktopifyAppTray {
98
97
  rightClick: DesktopifyAppTrayAction;
99
98
  leftClick: DesktopifyAppTrayAction;
100
99
  }
101
- export declare type DesktopifyAppMenu = DesktopifyMenuItemConstructorOptions;
100
+ export type DesktopifyAppMenu = DesktopifyMenuItemConstructorOptions;
102
101
  /**
103
102
  * Whitelist of allowed DesktopifyWindow Options.
104
103
  * These attrs (if set) are passed to the `BrowserWindow` constructor
105
104
  * when the window is created
106
105
  */
107
106
  export declare const allowedBrowserWindowConstructorOptions: Readonly<(keyof BrowserWindowConstructorOptions)[]>;
108
- export declare type whitelistedBrowserWindowConstructorOptions = (typeof allowedBrowserWindowConstructorOptions)[number];
107
+ export type whitelistedBrowserWindowConstructorOptions = (typeof allowedBrowserWindowConstructorOptions)[number];
109
108
  /**
110
109
  * Whitelist of allowed DesktopifyWindow Web Preferences Options.
111
110
  * These attrs (if set) are passed to the webPreferences object in the `BrowserWindow` constructor
112
111
  * when the window is created
113
112
  */
114
113
  export declare const allowedWebPreferencesOptions: Readonly<(keyof WebPreferences)[]>;
115
- export declare type whitelistedWebPreferencesOptions = (typeof allowedWebPreferencesOptions)[number];
114
+ export type whitelistedWebPreferencesOptions = (typeof allowedWebPreferencesOptions)[number];
116
115
  /**
117
116
  * Interface for ToDesktop App Windows
118
117
  */
@@ -234,7 +233,7 @@ export interface DesktopifyAppWindow {
234
233
  */
235
234
  file?: string;
236
235
  }
237
- export declare type AutoUpdateConfiguration = {
236
+ export type AutoUpdateConfiguration = {
238
237
  autoUpdater: boolean;
239
238
  shouldAutoCheckOnLaunch: boolean;
240
239
  shouldAutoCheckInterval: boolean;
@@ -485,7 +484,7 @@ export interface DesktopifyApp2<Plugin = DesktopAppPlugin> {
485
484
  */
486
485
  shouldProtectContent?: boolean;
487
486
  }
488
- export declare type FindInPagePlacement = {
487
+ export type FindInPagePlacement = {
489
488
  offset: number;
490
489
  };
491
490
  export interface IApp2<Plugin = DesktopAppPlugin> extends BaseApp {
package/lib/hsm.d.ts CHANGED
@@ -5,8 +5,8 @@
5
5
  * - mas-installer = Mac Installer Distribution (for Mac App Store)
6
6
  * - mas-dev = Apple Development
7
7
  */
8
- export declare type MacTarget = 'mac' | 'mac-installer' | 'mas' | 'mas-installer' | 'mas-dev';
9
- export declare type WindowsTarget = 'windows';
8
+ export type MacTarget = 'mac' | 'mac-installer' | 'mas' | 'mas-installer' | 'mas-dev';
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;
12
12
  /**
package/lib/hsm.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAPIKeyNameFromHSM = exports.getCertificateNameFromHSM = exports.isWindowsTarget = exports.isMacTarget = void 0;
3
+ exports.getAPIKeyNameFromHSM = exports.getCertificateNameFromHSM = void 0;
4
+ exports.isMacTarget = isMacTarget;
5
+ exports.isWindowsTarget = isWindowsTarget;
4
6
  function isMacTarget(type) {
5
7
  return ['mac', 'mac-installer', 'mas', 'mas-installer', 'mas-dev'].includes(type);
6
8
  }
7
- exports.isMacTarget = isMacTarget;
8
9
  function isWindowsTarget(type) {
9
10
  return ['windows'].includes(type);
10
11
  }
11
- exports.isWindowsTarget = isWindowsTarget;
12
12
  /**
13
13
  * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
14
14
  * This function returns the key name that is used for certificate files that have a `.p12` postfix.
@@ -17,12 +17,13 @@ exports.isWindowsTarget = isWindowsTarget;
17
17
  * @param target the target type
18
18
  * @returns the name of the secret that is required for downloading the cert from HSM.
19
19
  */
20
- exports.getCertificateNameFromHSM = (appId, target) => {
20
+ const getCertificateNameFromHSM = (appId, target) => {
21
21
  if (!isMacTarget(target) && !isWindowsTarget(target)) {
22
22
  throw new Error(`Invalid target '${target}'. Only windows or mac certs are supported`);
23
23
  }
24
24
  return `todesktop-${appId}-${target}-cert`;
25
25
  };
26
+ exports.getCertificateNameFromHSM = getCertificateNameFromHSM;
26
27
  /**
27
28
  * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
28
29
  * This function returns the key name that is used for key files that have a `.p8` postfix.
@@ -32,9 +33,10 @@ exports.getCertificateNameFromHSM = (appId, target) => {
32
33
  * @param target the target type
33
34
  * @returns the name of the secret that is required for downloading the cert from HSM.
34
35
  */
35
- exports.getAPIKeyNameFromHSM = (appId, target) => {
36
+ const getAPIKeyNameFromHSM = (appId, target) => {
36
37
  if (!isMacTarget(target)) {
37
38
  throw new Error(`Invalid target '${target}'. Only mac certs are supported`);
38
39
  }
39
40
  return `todesktop-${appId}-${target}-api-key`;
40
41
  };
42
+ exports.getAPIKeyNameFromHSM = getAPIKeyNameFromHSM;
package/lib/index.js CHANGED
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
15
  };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  exports.schemaVersion = void 0;