@ledgerhq/live-common 25.0.0-next.2 → 25.0.0-next.3

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 (77) hide show
  1. package/lib/__tests__/accounts/importAccounts.js +1 -1
  2. package/lib/__tests__/test-helpers/setup.js +1 -1
  3. package/lib/account/helpers.d.ts +5 -1
  4. package/lib/account/helpers.d.ts.map +1 -1
  5. package/lib/account/helpers.js +28 -1
  6. package/lib/account/helpers.js.map +1 -1
  7. package/lib/apps/filtering.test.js +1 -1
  8. package/lib/currencies/helpers.d.ts +9 -0
  9. package/lib/currencies/helpers.d.ts.map +1 -0
  10. package/lib/currencies/helpers.js +78 -0
  11. package/lib/currencies/helpers.js.map +1 -0
  12. package/lib/currencies/helpers.test.d.ts +2 -0
  13. package/lib/currencies/helpers.test.d.ts.map +1 -0
  14. package/lib/currencies/helpers.test.js +20 -0
  15. package/lib/currencies/helpers.test.js.map +1 -0
  16. package/lib/currencies/index.d.ts +1 -0
  17. package/lib/currencies/index.d.ts.map +1 -1
  18. package/lib/currencies/index.js +1 -0
  19. package/lib/currencies/index.js.map +1 -1
  20. package/lib/currencies/react.d.ts +4 -0
  21. package/lib/currencies/react.d.ts.map +1 -0
  22. package/lib/currencies/react.js +16 -0
  23. package/lib/currencies/react.js.map +1 -0
  24. package/lib/platform/PlatformAppProvider/api/api.mock.js +11 -11
  25. package/lib/platform/PlatformAppProvider/api/api.mock.js.map +1 -1
  26. package/lib/platform/PlatformAppProvider/helpers.d.ts +0 -7
  27. package/lib/platform/PlatformAppProvider/helpers.d.ts.map +1 -1
  28. package/lib/platform/PlatformAppProvider/helpers.js +1 -29
  29. package/lib/platform/PlatformAppProvider/helpers.js.map +1 -1
  30. package/lib/platform/converters.d.ts +4 -4
  31. package/lib/platform/converters.d.ts.map +1 -1
  32. package/lib/platform/converters.js +40 -2
  33. package/lib/platform/converters.js.map +1 -1
  34. package/lib/platform/filters.d.ts +18 -0
  35. package/lib/platform/filters.d.ts.map +1 -0
  36. package/lib/platform/filters.js +63 -0
  37. package/lib/platform/filters.js.map +1 -0
  38. package/lib/platform/helpers.d.ts +7 -0
  39. package/lib/platform/helpers.d.ts.map +1 -0
  40. package/lib/platform/helpers.js +22 -0
  41. package/lib/platform/helpers.js.map +1 -0
  42. package/lib/platform/logic.d.ts +1 -5
  43. package/lib/platform/logic.d.ts.map +1 -1
  44. package/lib/platform/logic.js +1 -18
  45. package/lib/platform/logic.js.map +1 -1
  46. package/lib/platform/providers/RemoteLiveAppProvider/api/mock.json +87 -246
  47. package/lib/platform/react.d.ts +11 -0
  48. package/lib/platform/react.d.ts.map +1 -0
  49. package/lib/platform/react.js +61 -0
  50. package/lib/platform/react.js.map +1 -0
  51. package/lib/platform/types.d.ts +8 -2
  52. package/lib/platform/types.d.ts.map +1 -1
  53. package/lib/platform/types.js +15 -0
  54. package/lib/platform/types.js.map +1 -1
  55. package/lib/platform/version.test.js +1 -1
  56. package/lib/walletconnect/walletconnect.test.js +0 -2
  57. package/lib/walletconnect/walletconnect.test.js.map +1 -1
  58. package/package.json +3 -2
  59. package/src/__tests__/accounts/importAccounts.ts +1 -1
  60. package/src/__tests__/test-helpers/setup.ts +1 -1
  61. package/src/account/helpers.ts +51 -0
  62. package/src/apps/filtering.test.ts +1 -1
  63. package/src/currencies/helpers.test.ts +21 -0
  64. package/src/currencies/helpers.ts +69 -0
  65. package/src/currencies/index.ts +1 -0
  66. package/src/currencies/react.ts +16 -0
  67. package/src/platform/PlatformAppProvider/api/api.mock.ts +11 -11
  68. package/src/platform/PlatformAppProvider/helpers.ts +0 -48
  69. package/src/platform/converters.ts +60 -6
  70. package/src/platform/filters.ts +102 -0
  71. package/src/platform/helpers.ts +33 -0
  72. package/src/platform/logic.ts +1 -20
  73. package/src/platform/providers/RemoteLiveAppProvider/api/mock.json +87 -246
  74. package/src/platform/react.ts +93 -0
  75. package/src/platform/types.ts +23 -1
  76. package/src/platform/version.test.ts +1 -1
  77. package/src/walletconnect/walletconnect.test.ts +0 -3
@@ -16,7 +16,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  exports.__esModule = true;
17
17
  exports.getPlatformTransactionSignFlowInfos = exports.currencyToPlatformCurrency = exports.accountToPlatformAccount = void 0;
18
18
  var platformAdapter_1 = __importDefault(require("../generated/platformAdapter"));
19
- function accountToPlatformAccount(account) {
19
+ var account_1 = require("../account");
20
+ var types_1 = require("./types");
21
+ function accountToPlatformAccount(account, parentAccount) {
22
+ if ((0, account_1.isSubAccount)(account)) {
23
+ if (!parentAccount) {
24
+ throw new Error("No 'parentAccount' account provided for token account");
25
+ }
26
+ return __assign({ id: account.id, balance: account.balance, address: parentAccount.freshAddress, blockHeight: parentAccount.blockHeight, lastSyncDate: parentAccount.lastSyncDate }, ((0, account_1.isTokenAccount)(account)
27
+ ? {
28
+ name: "".concat(parentAccount.name, " (").concat(account.token.ticker, ")"),
29
+ currency: account.token.id,
30
+ spendableBalance: account.spendableBalance
31
+ }
32
+ : {
33
+ name: account.name,
34
+ currency: account.currency.id,
35
+ spendableBalance: parentAccount.spendableBalance
36
+ }));
37
+ }
20
38
  return {
21
39
  id: account.id,
22
40
  name: account.name,
@@ -30,8 +48,28 @@ function accountToPlatformAccount(account) {
30
48
  }
31
49
  exports.accountToPlatformAccount = accountToPlatformAccount;
32
50
  function currencyToPlatformCurrency(currency) {
51
+ if (currency.type === "TokenCurrency") {
52
+ if (currency.parentCurrency.family !== "ethereum") {
53
+ throw new Error("Only ERC20 tokens are supported");
54
+ }
55
+ return {
56
+ type: types_1.PlatformCurrencyType.TokenCurrency,
57
+ standard: types_1.PlatformTokenStandard.ERC20,
58
+ id: currency.id,
59
+ ticker: currency.ticker,
60
+ contract: currency.contractAddress,
61
+ name: currency.name,
62
+ parent: currency.parentCurrency.id,
63
+ color: currency.parentCurrency.color,
64
+ units: currency.units.map(function (unit) { return ({
65
+ name: unit.name,
66
+ code: unit.code,
67
+ magnitude: unit.magnitude
68
+ }); })
69
+ };
70
+ }
33
71
  return {
34
- type: currency.type,
72
+ type: types_1.PlatformCurrencyType.CryptoCurrency,
35
73
  id: currency.id,
36
74
  ticker: currency.ticker,
37
75
  name: currency.name,
@@ -1 +1 @@
1
- {"version":3,"file":"converters.js","sourceRoot":"","sources":["../../src/platform/converters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iFAAoD;AASpD,SAAgB,wBAAwB,CAAC,OAAgB;IACvD,OAAO;QACL,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC7B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC;AACJ,CAAC;AAXD,4DAWC;AACD,SAAgB,0BAA0B,CACxC,QAAwB;IAExB,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,EAAE,EAAE,QAAQ,CAAC,EAAE;QACf,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,CAAC;YACnC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,EAJkC,CAIlC,CAAC;KACJ,CAAC;AACJ,CAAC;AAhBD,gEAgBC;AAEM,IAAM,mCAAmC,GAAG,UACjD,UAA+B;IAM/B,IAAM,MAAM,GAAG,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CAAC,MAAM;QACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,CAAC;YACnC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,EAJkC,CAIlC,CAAC;KACJ,CAAC;AACJ,CAAC;AAtCD,gEAsCC;AAEM,IAAM,mCAAmC,GAAG,UACjD,UAA+B;IAM/B,IAAM,MAAM,GAAG,4BAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAE3C,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,mCAAmC,CAAC,UAAU,CAAC,CAAC;KAC/D;IAED,OAAO;QACL,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,aAAK,UAAU,CAA0B;QACjD,eAAe,EAAE,KAAK;KACvB,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,mCAAmC,uCAkB9C"}
@@ -0,0 +1,18 @@
1
+ import { PlatformAccount, PlatformCurrency, AppManifest } from "./types";
2
+ export declare type FilterParams = {
3
+ branches?: string[];
4
+ platform?: string;
5
+ private?: boolean;
6
+ version?: string;
7
+ };
8
+ export declare type AccountFilters = {
9
+ currencies?: string[];
10
+ };
11
+ export declare function filterPlatformAccounts(accounts: PlatformAccount[], filters: AccountFilters): PlatformAccount[];
12
+ export declare type CurrencyFilters = {
13
+ includeTokens?: boolean;
14
+ currencies?: string[];
15
+ };
16
+ export declare function filterPlatformCurrencies(currencies: PlatformCurrency[], filters: CurrencyFilters): PlatformCurrency[];
17
+ export declare function filterPlatformApps(appManifests: AppManifest[], filterParams: FilterParams): AppManifest[];
18
+ //# sourceMappingURL=filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/platform/filters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIzE,oBAAY,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EAAE,EAC3B,OAAO,EAAE,cAAc,GACtB,eAAe,EAAE,CAcnB;AAED,oBAAY,eAAe,GAAG;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,gBAAgB,EAAE,EAC9B,OAAO,EAAE,eAAe,GACvB,gBAAgB,EAAE,CAmBpB;AA2BD,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,WAAW,EAAE,EAC3B,YAAY,EAAE,YAAY,GACzB,WAAW,EAAE,CASf"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ exports.filterPlatformApps = exports.filterPlatformCurrencies = exports.filterPlatformAccounts = void 0;
7
+ var minimatch_1 = require("minimatch");
8
+ var helpers_1 = require("./helpers");
9
+ var semver_1 = __importDefault(require("semver"));
10
+ function filterPlatformAccounts(accounts, filters) {
11
+ var filterCurrencyRegexes = filters.currencies
12
+ ? filters.currencies.map(function (filter) { return (0, minimatch_1.makeRe)(filter); })
13
+ : null;
14
+ return accounts.filter(function (account) {
15
+ if (filterCurrencyRegexes &&
16
+ !filterCurrencyRegexes.some(function (regex) { return account.currency.match(regex); })) {
17
+ return false;
18
+ }
19
+ return true;
20
+ });
21
+ }
22
+ exports.filterPlatformAccounts = filterPlatformAccounts;
23
+ function filterPlatformCurrencies(currencies, filters) {
24
+ var filterCurrencyRegexes = filters.currencies
25
+ ? filters.currencies.map(function (filter) { return (0, minimatch_1.makeRe)(filter); })
26
+ : null;
27
+ return currencies.filter(function (currency) {
28
+ if (!filters.includeTokens && (0, helpers_1.isPlatformTokenCurrency)(currency)) {
29
+ return false;
30
+ }
31
+ if (filterCurrencyRegexes &&
32
+ !filterCurrencyRegexes.some(function (regex) { return currency.id.match(regex); })) {
33
+ return false;
34
+ }
35
+ return true;
36
+ });
37
+ }
38
+ exports.filterPlatformCurrencies = filterPlatformCurrencies;
39
+ function matchVersion(filterParams, manifest) {
40
+ return (!filterParams.version ||
41
+ semver_1["default"].satisfies(filterParams.version, manifest.apiVersion));
42
+ }
43
+ function matchBranches(filterParams, manifest) {
44
+ return (!filterParams.branches || filterParams.branches.includes(manifest.branch));
45
+ }
46
+ function matchPlatform(filterParams, manifest) {
47
+ return (!filterParams.platform ||
48
+ manifest.platform === "all" ||
49
+ filterParams.platform === manifest.platform);
50
+ }
51
+ function matchPrivate(filterParams, manifest) {
52
+ return filterParams.private === true || !(manifest.private === true);
53
+ }
54
+ function filterPlatformApps(appManifests, filterParams) {
55
+ return appManifests.filter(function (appManifest) {
56
+ return (matchBranches(filterParams, appManifest) &&
57
+ matchPlatform(filterParams, appManifest) &&
58
+ matchPrivate(filterParams, appManifest) &&
59
+ matchVersion(filterParams, appManifest));
60
+ });
61
+ }
62
+ exports.filterPlatformApps = filterPlatformApps;
63
+ //# sourceMappingURL=filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/platform/filters.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmC;AAEn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L,CAAC;AAtBD,4DAsBC;AAED,SAAS,YAAY,CAAC,YAA0B,EAAE,QAAqB;IACrE,OAAO,CACL,CAAC,YAAY,CAAC,OAAO;QACrB,mBAAM,CAAC,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,CAC5D,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,YAA0B,EAAE,QAAqB;IACtE,OAAO,CACL,CAAC,YAAY,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAC1E,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,YAA0B,EAAE,QAAqB;IACtE,OAAO,CACL,CAAC,YAAY,CAAC,QAAQ;QACtB,QAAQ,CAAC,QAAQ,KAAK,KAAK;QAC3B,YAAY,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAC5C,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,YAA0B,EAAE,QAAqB;IACrE,OAAO,YAAY,CAAC,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,SAAgB,kBAAkB,CAChC,YAA2B,EAC3B,YAA0B;IAE1B,OAAO,YAAY,CAAC,MAAM,CAAC,UAAC,WAAwB;QAClD,OAAO,CACL,aAAa,CAAC,YAAY,EAAE,WAAW,CAAC;YACxC,aAAa,CAAC,YAAY,EAAE,WAAW,CAAC;YACxC,YAAY,CAAC,YAAY,EAAE,WAAW,CAAC;YACvC,YAAY,CAAC,YAAY,EAAE,WAAW,CAAC,CACxC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAZD,gDAYC"}
@@ -0,0 +1,7 @@
1
+ import { Currency } from "../types";
2
+ import { PlatformCurrency, PlatformSupportedCurrency, PlatformERC20TokenCurrency, PlatformCryptoCurrency } from "./types";
3
+ export declare function isPlatformSupportedCurrency(currency: Currency): currency is PlatformSupportedCurrency;
4
+ export declare function isPlatformCryptoCurrency(currency: PlatformCurrency): currency is PlatformCryptoCurrency;
5
+ export declare function isPlatformTokenCurrency(currency: PlatformCurrency): currency is PlatformERC20TokenCurrency;
6
+ export declare function isPlatformERC20TokenCurrency(currency: PlatformCurrency): currency is PlatformERC20TokenCurrency;
7
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/platform/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,QAAQ,GACjB,QAAQ,IAAI,yBAAyB,CAEvC;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,gBAAgB,GACzB,QAAQ,IAAI,sBAAsB,CAEpC;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,gBAAgB,GACzB,QAAQ,IAAI,0BAA0B,CAExC;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,gBAAgB,GACzB,QAAQ,IAAI,0BAA0B,CAExC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.isPlatformERC20TokenCurrency = exports.isPlatformTokenCurrency = exports.isPlatformCryptoCurrency = exports.isPlatformSupportedCurrency = void 0;
4
+ var currencies_1 = require("../currencies");
5
+ var types_1 = require("./types");
6
+ function isPlatformSupportedCurrency(currency) {
7
+ return (0, currencies_1.isCryptoCurrency)(currency) || (0, currencies_1.isTokenCurrency)(currency);
8
+ }
9
+ exports.isPlatformSupportedCurrency = isPlatformSupportedCurrency;
10
+ function isPlatformCryptoCurrency(currency) {
11
+ return currency.type === types_1.PlatformCurrencyType.CryptoCurrency;
12
+ }
13
+ exports.isPlatformCryptoCurrency = isPlatformCryptoCurrency;
14
+ function isPlatformTokenCurrency(currency) {
15
+ return currency.type === types_1.PlatformCurrencyType.TokenCurrency;
16
+ }
17
+ exports.isPlatformTokenCurrency = isPlatformTokenCurrency;
18
+ function isPlatformERC20TokenCurrency(currency) {
19
+ return currency.standard === "ERC20";
20
+ }
21
+ exports.isPlatformERC20TokenCurrency = isPlatformERC20TokenCurrency;
22
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/platform/helpers.ts"],"names":[],"mappings":";;;AAAA,4CAAkE;AAElE,iCAMiB;AAEjB,SAAgB,2BAA2B,CACzC,QAAkB;IAElB,OAAO,IAAA,6BAAgB,EAAC,QAAQ,CAAC,IAAI,IAAA,4BAAe,EAAC,QAAQ,CAAC,CAAC;AACjE,CAAC;AAJD,kEAIC;AAED,SAAgB,wBAAwB,CACtC,QAA0B;IAE1B,OAAO,QAAQ,CAAC,IAAI,KAAK,4BAAoB,CAAC,cAAc,CAAC;AAC/D,CAAC;AAJD,4DAIC;AAED,SAAgB,uBAAuB,CACrC,QAA0B;IAE1B,OAAO,QAAQ,CAAC,IAAI,KAAK,4BAAoB,CAAC,aAAa,CAAC;AAC9D,CAAC;AAJD,0DAIC;AAED,SAAgB,4BAA4B,CAC1C,QAA0B;IAE1B,OAAQ,QAAuC,CAAC,QAAQ,KAAK,OAAO,CAAC;AACvE,CAAC;AAJD,oEAIC"}
@@ -1,6 +1,2 @@
1
- import type { AppManifest, AppPlatform, AppBranch } from "./types";
2
- export declare function translateContent(content: any, locale?: string): any;
3
- export declare function isSupported(manifest: AppManifest): any;
4
- export declare function matchBranches(manifest: AppManifest, branches: AppBranch[]): boolean;
5
- export declare function matchPlatform(manifest: AppManifest, platform: AppPlatform): boolean;
1
+ export declare function translateContent(content: any, locale?: string): string;
6
2
  //# sourceMappingURL=logic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logic.d.ts","sourceRoot":"","sources":["../../src/platform/logic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGnE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAO,OAG3D;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,OAKhD;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,WAEzE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,WAEzE"}
1
+ {"version":3,"file":"logic.d.ts","sourceRoot":"","sources":["../../src/platform/logic.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAO,GAAG,MAAM,CAGpE"}
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  exports.__esModule = true;
6
- exports.matchPlatform = exports.matchBranches = exports.isSupported = exports.translateContent = void 0;
7
- var semver_1 = __importDefault(require("semver"));
8
- var version_1 = require("./version");
3
+ exports.translateContent = void 0;
9
4
  function translateContent(content, locale) {
10
5
  if (locale === void 0) { locale = "en"; }
11
6
  if (!content || typeof content !== "object")
@@ -13,16 +8,4 @@ function translateContent(content, locale) {
13
8
  return content[locale] || content.en;
14
9
  }
15
10
  exports.translateContent = translateContent;
16
- function isSupported(manifest) {
17
- return semver_1["default"].satisfies(semver_1["default"].coerce((0, version_1.getPlatformVersion)()) || "", manifest.apiVersion);
18
- }
19
- exports.isSupported = isSupported;
20
- function matchBranches(manifest, branches) {
21
- return branches.indexOf(manifest.branch) > -1;
22
- }
23
- exports.matchBranches = matchBranches;
24
- function matchPlatform(manifest, platform) {
25
- return manifest.platform === "all" || manifest.platform === platform;
26
- }
27
- exports.matchPlatform = matchPlatform;
28
11
  //# sourceMappingURL=logic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logic.js","sourceRoot":"","sources":["../../src/platform/logic.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4B;AAE5B,qCAA+C;AAE/C,SAAgB,gBAAgB,CAAC,OAAY,EAAE,MAAa;IAAb,uBAAA,EAAA,aAAa;IAC1D,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAC5D,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC;AACvC,CAAC;AAHD,4CAGC;AAED,SAAgB,WAAW,CAAC,QAAqB;IAC/C,OAAO,mBAAM,CAAC,SAAS,CACrB,mBAAM,CAAC,MAAM,CAAC,IAAA,4BAAkB,GAAE,CAAC,IAAI,EAAE,EACzC,QAAQ,CAAC,UAAU,CACpB,CAAC;AACJ,CAAC;AALD,kCAKC;AAED,SAAgB,aAAa,CAAC,QAAqB,EAAE,QAAqB;IACxE,OAAO,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAChD,CAAC;AAFD,sCAEC;AAED,SAAgB,aAAa,CAAC,QAAqB,EAAE,QAAqB;IACxE,OAAO,QAAQ,CAAC,QAAQ,KAAK,KAAK,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACvE,CAAC;AAFD,sCAEC"}
1
+ {"version":3,"file":"logic.js","sourceRoot":"","sources":["../../src/platform/logic.ts"],"names":[],"mappings":";;;AAAA,SAAgB,gBAAgB,CAAC,OAAY,EAAE,MAAa;IAAb,uBAAA,EAAA,aAAa;IAC1D,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAC5D,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC;AACvC,CAAC;AAHD,4CAGC"}