@berachain/config 0.1.24-beta.3 → 0.1.24-beta.5

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 (69) hide show
  1. package/dist/bepolia.cjs +0 -1
  2. package/dist/bepolia.mjs +0 -1
  3. package/dist/{chunk-4RBW7LA7.mjs → chunk-5SH7AT43.mjs} +1 -1
  4. package/dist/{chunk-WRTYGXJM.cjs → chunk-AU3LYJAB.cjs} +26 -6
  5. package/dist/{chunk-ONKAV4AG.cjs → chunk-B2BTOQVP.cjs} +5 -5
  6. package/dist/{chunk-TJPHIVC5.mjs → chunk-IGYS2XEK.mjs} +2 -2
  7. package/dist/{chunk-3K6IUX3G.mjs → chunk-OWAB24JG.mjs} +1 -1
  8. package/dist/{chunk-ZG7CKYT4.cjs → chunk-SHM2VD4A.cjs} +10 -10
  9. package/dist/{chunk-BM46XQJA.mjs → chunk-VWRKCGMU.mjs} +22 -2
  10. package/dist/{chunk-4UCGQIWY.mjs → chunk-XA5DMTFW.mjs} +2 -2
  11. package/dist/{chunk-EPWUWEWI.cjs → chunk-ZJEZCW5Z.cjs} +3 -3
  12. package/dist/{chunk-3NQ3NFWW.cjs → chunk-ZTYHPIUW.cjs} +2 -2
  13. package/dist/index.cjs +0 -1
  14. package/dist/index.mjs +0 -1
  15. package/dist/internal/dedupeCspSources.d.ts +9 -0
  16. package/dist/internal/dedupeCspSources.d.ts.map +1 -0
  17. package/dist/internal/header-sources.cjs +258 -148
  18. package/dist/internal/header-sources.d.ts +108 -2
  19. package/dist/internal/header-sources.d.ts.map +1 -1
  20. package/dist/internal/header-sources.mjs +254 -144
  21. package/dist/internal/index.cjs +4 -7
  22. package/dist/internal/index.mjs +5 -8
  23. package/dist/internal/maintenance.cjs +1 -3
  24. package/dist/internal/maintenance.mjs +0 -2
  25. package/dist/internal/nextjs/index.cjs +9 -11
  26. package/dist/internal/nextjs/index.mjs +6 -8
  27. package/dist/internal/nextjs/utils/index.cjs +0 -1
  28. package/dist/internal/nextjs/utils/index.mjs +0 -1
  29. package/dist/internal/sentry/index.cjs +2 -3
  30. package/dist/internal/sentry/index.mjs +1 -2
  31. package/dist/internal/sentry/sentry.client.config.cjs +6 -8
  32. package/dist/internal/sentry/sentry.client.config.mjs +2 -4
  33. package/dist/internal/tailwind/index.cjs +1 -3
  34. package/dist/internal/tailwind/index.mjs +0 -2
  35. package/dist/internal/wagmi/index.cjs +8 -11
  36. package/dist/internal/wagmi/index.mjs +4 -7
  37. package/dist/mainnet.cjs +3 -5
  38. package/dist/mainnet.mjs +2 -4
  39. package/dist/{sentry.edge.config-F4334LEP.cjs → sentry.edge.config-3Y5ABKSB.cjs} +4 -6
  40. package/dist/{sentry.edge.config-JU55FF2U.mjs → sentry.edge.config-SIWSKDGR.mjs} +2 -4
  41. package/dist/{sentry.server.config-M77KFJ6J.mjs → sentry.server.config-HY6I2WQ5.mjs} +2 -4
  42. package/dist/{sentry.server.config-KFRT37Q3.cjs → sentry.server.config-ZXGUVYT6.cjs} +4 -6
  43. package/package.json +1 -1
  44. package/dist/chunk-2XYRGOX3.mjs +0 -64
  45. package/dist/chunk-75ZPJI57.cjs +0 -9
  46. package/dist/chunk-7P6ASYW6.mjs +0 -9
  47. package/dist/chunk-ADH7F47T.cjs +0 -26
  48. package/dist/chunk-CAOMAWN5.mjs +0 -26
  49. package/dist/chunk-NX4FI7G3.cjs +0 -64
  50. package/dist/internal/edge-config/edgeConfig.codegen.d.ts +0 -344
  51. package/dist/internal/edge-config/edgeConfig.codegen.d.ts.map +0 -1
  52. package/dist/internal/edge-config/index.cjs +0 -37
  53. package/dist/internal/edge-config/index.d.ts +0 -5
  54. package/dist/internal/edge-config/index.d.ts.map +0 -1
  55. package/dist/internal/edge-config/index.mjs +0 -37
  56. package/dist/internal/edge-config/isFlagEnabled.d.ts +0 -17
  57. package/dist/internal/edge-config/isFlagEnabled.d.ts.map +0 -1
  58. package/dist/internal/edge-config/safeGetAll.d.ts +0 -15
  59. package/dist/internal/edge-config/safeGetAll.d.ts.map +0 -1
  60. package/dist/internal/edge-config/safeGetConfig.d.ts +0 -19
  61. package/dist/internal/edge-config/safeGetConfig.d.ts.map +0 -1
  62. package/dist/internal/flags/beraEdgeConfigAdapter.d.ts +0 -9
  63. package/dist/internal/flags/beraEdgeConfigAdapter.d.ts.map +0 -1
  64. package/dist/internal/flags/flags.d.ts +0 -29
  65. package/dist/internal/flags/flags.d.ts.map +0 -1
  66. package/dist/internal/flags/index.cjs +0 -206
  67. package/dist/internal/flags/index.d.ts +0 -2
  68. package/dist/internal/flags/index.d.ts.map +0 -1
  69. package/dist/internal/flags/index.mjs +0 -206
@@ -2,14 +2,12 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkONKAV4AGcjs = require('../../chunk-ONKAV4AG.cjs');
6
- require('../../chunk-WRTYGXJM.cjs');
7
- require('../../chunk-ADH7F47T.cjs');
5
+ var _chunkB2BTOQVPcjs = require('../../chunk-B2BTOQVP.cjs');
6
+ require('../../chunk-AU3LYJAB.cjs');
8
7
  require('../../chunk-EYYJ2UZT.cjs');
9
- require('../../chunk-75ZPJI57.cjs');
10
8
 
11
9
  // src/internal/sentry/sentry.client.config.ts
12
- if (_chunkONKAV4AGcjs.sentryDebug) {
10
+ if (_chunkB2BTOQVPcjs.sentryDebug) {
13
11
  console.log(
14
12
  "[@berachain/config] sentryDebug init",
15
13
  process.env.NEXT_PUBLIC_SENTRY_DSN
@@ -20,10 +18,10 @@ function initSentryClient(Sentry, opt = {}) {
20
18
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
21
19
  tunnel: "/monitoring-tunnel",
22
20
  // Adjust this value in production, or use tracesSampler for greater control
23
- tracesSampleRate: _chunkONKAV4AGcjs.tracesSampleRate,
21
+ tracesSampleRate: _chunkB2BTOQVPcjs.tracesSampleRate,
24
22
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
25
- debug: _chunkONKAV4AGcjs.sentryDebug,
26
- environment: _chunkONKAV4AGcjs.sentryEnvironment,
23
+ debug: _chunkB2BTOQVPcjs.sentryDebug,
24
+ environment: _chunkB2BTOQVPcjs.sentryEnvironment,
27
25
  ...opt,
28
26
  // You can remove this option if you're not planning to use the Sentry Session Replay feature:
29
27
  // integrations: [],
@@ -2,11 +2,9 @@ import {
2
2
  sentryDebug,
3
3
  sentryEnvironment,
4
4
  tracesSampleRate
5
- } from "../../chunk-3K6IUX3G.mjs";
6
- import "../../chunk-BM46XQJA.mjs";
7
- import "../../chunk-CAOMAWN5.mjs";
5
+ } from "../../chunk-OWAB24JG.mjs";
6
+ import "../../chunk-VWRKCGMU.mjs";
8
7
  import "../../chunk-KJXYSGNH.mjs";
9
- import "../../chunk-7P6ASYW6.mjs";
10
8
 
11
9
  // src/internal/sentry/sentry.client.config.ts
12
10
  if (sentryDebug) {
@@ -1,6 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../../chunk-75ZPJI57.cjs');
2
-
3
- // src/internal/tailwind/index.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/internal/tailwind/index.ts
4
2
  var _containerqueries = require('@tailwindcss/container-queries'); var _containerqueries2 = _interopRequireDefault(_containerqueries);
5
3
  var _typography = require('@tailwindcss/typography'); var _typography2 = _interopRequireDefault(_typography);
6
4
  var _tailwindcssanimate = require('tailwindcss-animate'); var _tailwindcssanimate2 = _interopRequireDefault(_tailwindcssanimate);
@@ -1,5 +1,3 @@
1
- import "../../chunk-7P6ASYW6.mjs";
2
-
3
1
  // src/internal/tailwind/index.ts
4
2
  import containerQueries from "@tailwindcss/container-queries";
5
3
  import typography from "@tailwindcss/typography";
@@ -1,17 +1,14 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-ZG7CKYT4.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-SHM2VD4A.cjs');
2
2
  require('../../chunk-MQOVN5NH.cjs');
3
- require('../../chunk-EPWUWEWI.cjs');
3
+ require('../../chunk-ZJEZCW5Z.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
- var _chunkWRTYGXJMcjs = require('../../chunk-WRTYGXJM.cjs');
10
9
 
11
-
12
- var _chunkADH7F47Tcjs = require('../../chunk-ADH7F47T.cjs');
10
+ var _chunkAU3LYJABcjs = require('../../chunk-AU3LYJAB.cjs');
13
11
  require('../../chunk-EYYJ2UZT.cjs');
14
- require('../../chunk-75ZPJI57.cjs');
15
12
 
16
13
  // src/internal/wagmi/index.ts
17
14
 
@@ -25,12 +22,12 @@ require('../../chunk-75ZPJI57.cjs');
25
22
 
26
23
 
27
24
  var _chains = require('viem/chains');
28
- var defaultChain = _chunkADH7F47Tcjs.defaultChainId === _chains.berachain.id ? _chains.berachain : _chains.berachainBepolia;
25
+ var defaultChain = _chunkAU3LYJABcjs.defaultChainId === _chains.berachain.id ? _chains.berachain : _chains.berachainBepolia;
29
26
  var urls = [
30
- _chunkWRTYGXJMcjs.privateRcpUrl,
31
- _chunkWRTYGXJMcjs.jsonRpcUrl,
32
- _chunkWRTYGXJMcjs.alchemyJsonRpcUrl,
33
- _chunkWRTYGXJMcjs.publicJsonRpcUrl
27
+ _chunkAU3LYJABcjs.privateRcpUrl,
28
+ _chunkAU3LYJABcjs.jsonRpcUrl,
29
+ _chunkAU3LYJABcjs.alchemyJsonRpcUrl,
30
+ _chunkAU3LYJABcjs.publicJsonRpcUrl
34
31
  ].filter(Boolean);
35
32
  var externalChains = [
36
33
  _chains.mainnet,
@@ -1,17 +1,14 @@
1
- import "../../chunk-TJPHIVC5.mjs";
1
+ import "../../chunk-IGYS2XEK.mjs";
2
2
  import "../../chunk-KPZI7IXR.mjs";
3
- import "../../chunk-4RBW7LA7.mjs";
3
+ import "../../chunk-5SH7AT43.mjs";
4
4
  import {
5
5
  alchemyJsonRpcUrl,
6
+ defaultChainId,
6
7
  jsonRpcUrl,
7
8
  privateRcpUrl,
8
9
  publicJsonRpcUrl
9
- } from "../../chunk-BM46XQJA.mjs";
10
- import {
11
- defaultChainId
12
- } from "../../chunk-CAOMAWN5.mjs";
10
+ } from "../../chunk-VWRKCGMU.mjs";
13
11
  import "../../chunk-KJXYSGNH.mjs";
14
- import "../../chunk-7P6ASYW6.mjs";
15
12
 
16
13
  // src/internal/wagmi/index.ts
17
14
  import {
package/dist/mainnet.cjs CHANGED
@@ -1,10 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkEPWUWEWIcjs = require('./chunk-EPWUWEWI.cjs');
4
- require('./chunk-WRTYGXJM.cjs');
5
- require('./chunk-ADH7F47T.cjs');
3
+ var _chunkZJEZCW5Zcjs = require('./chunk-ZJEZCW5Z.cjs');
4
+ require('./chunk-AU3LYJAB.cjs');
6
5
  require('./chunk-EYYJ2UZT.cjs');
7
- require('./chunk-75ZPJI57.cjs');
8
6
 
9
7
 
10
- exports.mainnet = _chunkEPWUWEWIcjs.mainnet;
8
+ exports.mainnet = _chunkZJEZCW5Zcjs.mainnet;
package/dist/mainnet.mjs CHANGED
@@ -1,10 +1,8 @@
1
1
  import {
2
2
  mainnet
3
- } from "./chunk-4RBW7LA7.mjs";
4
- import "./chunk-BM46XQJA.mjs";
5
- import "./chunk-CAOMAWN5.mjs";
3
+ } from "./chunk-5SH7AT43.mjs";
4
+ import "./chunk-VWRKCGMU.mjs";
6
5
  import "./chunk-KJXYSGNH.mjs";
7
- import "./chunk-7P6ASYW6.mjs";
8
6
  export {
9
7
  mainnet
10
8
  };
@@ -1,19 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkONKAV4AGcjs = require('./chunk-ONKAV4AG.cjs');
5
- require('./chunk-WRTYGXJM.cjs');
6
- require('./chunk-ADH7F47T.cjs');
4
+ var _chunkB2BTOQVPcjs = require('./chunk-B2BTOQVP.cjs');
5
+ require('./chunk-AU3LYJAB.cjs');
7
6
  require('./chunk-EYYJ2UZT.cjs');
8
- require('./chunk-75ZPJI57.cjs');
9
7
 
10
8
  // src/internal/sentry/sentry.edge.config.ts
11
9
  function initSentryEdge(Sentry, opt = {}) {
12
10
  return Sentry.init({
13
11
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
14
12
  // Adjust this value in production, or use tracesSampler for greater control
15
- tracesSampleRate: _chunkONKAV4AGcjs.tracesSampleRate,
16
- environment: _chunkONKAV4AGcjs.sentryEnvironment,
13
+ tracesSampleRate: _chunkB2BTOQVPcjs.tracesSampleRate,
14
+ environment: _chunkB2BTOQVPcjs.sentryEnvironment,
17
15
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
18
16
  debug: false,
19
17
  ...opt
@@ -1,11 +1,9 @@
1
1
  import {
2
2
  sentryEnvironment,
3
3
  tracesSampleRate
4
- } from "./chunk-3K6IUX3G.mjs";
5
- import "./chunk-BM46XQJA.mjs";
6
- import "./chunk-CAOMAWN5.mjs";
4
+ } from "./chunk-OWAB24JG.mjs";
5
+ import "./chunk-VWRKCGMU.mjs";
7
6
  import "./chunk-KJXYSGNH.mjs";
8
- import "./chunk-7P6ASYW6.mjs";
9
7
 
10
8
  // src/internal/sentry/sentry.edge.config.ts
11
9
  function initSentryEdge(Sentry, opt = {}) {
@@ -1,11 +1,9 @@
1
1
  import {
2
2
  sentryEnvironment,
3
3
  tracesSampleRate
4
- } from "./chunk-3K6IUX3G.mjs";
5
- import "./chunk-BM46XQJA.mjs";
6
- import "./chunk-CAOMAWN5.mjs";
4
+ } from "./chunk-OWAB24JG.mjs";
5
+ import "./chunk-VWRKCGMU.mjs";
7
6
  import "./chunk-KJXYSGNH.mjs";
8
- import "./chunk-7P6ASYW6.mjs";
9
7
 
10
8
  // src/internal/sentry/sentry.server.config.ts
11
9
  function initSentryServer(Sentry, opt = {}) {
@@ -1,19 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkONKAV4AGcjs = require('./chunk-ONKAV4AG.cjs');
5
- require('./chunk-WRTYGXJM.cjs');
6
- require('./chunk-ADH7F47T.cjs');
4
+ var _chunkB2BTOQVPcjs = require('./chunk-B2BTOQVP.cjs');
5
+ require('./chunk-AU3LYJAB.cjs');
7
6
  require('./chunk-EYYJ2UZT.cjs');
8
- require('./chunk-75ZPJI57.cjs');
9
7
 
10
8
  // src/internal/sentry/sentry.server.config.ts
11
9
  function initSentryServer(Sentry, opt = {}) {
12
10
  return Sentry.init({
13
11
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
14
12
  // Adjust this value in production, or use tracesSampler for greater control
15
- tracesSampleRate: _chunkONKAV4AGcjs.tracesSampleRate,
16
- environment: _chunkONKAV4AGcjs.sentryEnvironment,
13
+ tracesSampleRate: _chunkB2BTOQVPcjs.tracesSampleRate,
14
+ environment: _chunkB2BTOQVPcjs.sentryEnvironment,
17
15
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
18
16
  debug: false,
19
17
  ...opt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@berachain/config",
3
- "version": "0.1.24-beta.3",
3
+ "version": "0.1.24-beta.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -1,64 +0,0 @@
1
- import {
2
- currentDapp,
3
- defaultChainId
4
- } from "./chunk-CAOMAWN5.mjs";
5
-
6
- // src/internal/edge-config/isFlagEnabled.ts
7
- function _checkChain(flag, chain, defaultReturn) {
8
- if (flag.chain?.length) {
9
- return flag.chain.includes(
10
- chain === 80094 /* MAINNET */ ? "mainnet" : "bepolia"
11
- );
12
- }
13
- return defaultReturn;
14
- }
15
- function _checkBranch(flag, _environment, defaultReturn) {
16
- if (!_environment) {
17
- return defaultReturn;
18
- }
19
- const environment = _environment === "development" ? "preview" : _environment;
20
- if (flag.branch?.length) {
21
- return flag.branch.includes(
22
- environment
23
- );
24
- }
25
- return defaultReturn;
26
- }
27
- function _checkAppName(flag, app, defaultReturn) {
28
- if (flag.app?.length && app) {
29
- return flag.app.includes(app);
30
- }
31
- return defaultReturn;
32
- }
33
- function _checkTime(flag, key, defaultReturn) {
34
- const time = flag[key];
35
- if (!time) {
36
- return defaultReturn;
37
- }
38
- if (key === "startAt") {
39
- return time ? new Date(time) <= /* @__PURE__ */ new Date() : defaultReturn;
40
- } else {
41
- return time ? new Date(time) >= /* @__PURE__ */ new Date() : defaultReturn;
42
- }
43
- }
44
- function isFlagEnabled(flag, {
45
- chain = defaultChainId,
46
- environment = process.env.VERCEL_TARGET_ENV,
47
- app = currentDapp
48
- } = {}) {
49
- if (!flag) return false;
50
- if (typeof flag === "boolean") {
51
- return flag;
52
- }
53
- if (flag.condition === "OR") {
54
- return _checkChain(flag, chain, false) || _checkBranch(flag, environment, false) || _checkAppName(flag, app, false) || // this condition is weird but it's consistent with the logic in the AND condition
55
- // this means that if startAt is false, but endAt is true, the flag is enabled anyway
56
- // we should prob consider a cleaner way to handle the OR condition in the future
57
- _checkTime(flag, "startAt", false) || _checkTime(flag, "endAt", false);
58
- }
59
- return _checkChain(flag, chain, true) && _checkBranch(flag, environment, true) && _checkAppName(flag, app, true) && _checkTime(flag, "startAt", true) && _checkTime(flag, "endAt", true);
60
- }
61
-
62
- export {
63
- isFlagEnabled
64
- };
@@ -1,9 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
-
8
-
9
- exports.__export = __export;
@@ -1,9 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- export {
8
- __export
9
- };
@@ -1,26 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkEYYJ2UZTcjs = require('./chunk-EYYJ2UZT.cjs');
4
-
5
- // src/utils/dynamicEnvVariable.ts
6
- var defaultChainId = process.env.NEXT_PUBLIC_CHAIN_ID ? Number(process.env.NEXT_PUBLIC_CHAIN_ID) : 80094 /* MAINNET */;
7
- if (!Object.values(_chunkEYYJ2UZTcjs.ChainId).includes(defaultChainId)) {
8
- throw new Error(
9
- `process.env.NEXT_PUBLIC_CHAIN_ID is invalid: ${defaultChainId}.
10
- This value must be one of the following: ${Object.values(_chunkEYYJ2UZTcjs.ChainId).filter(Number).join(", ")} when using @berachain/config/internal.`
11
- );
12
- }
13
- var isProduction = process.env.VERCEL_TARGET_ENV === "production";
14
- var isLocalHost = process.env.NODE_ENV === "development";
15
- var isPreview = process.env.VERCEL_TARGET_ENV === "preview" || isLocalHost;
16
- var isStaging = process.env.VERCEL_TARGET_ENV === "staging";
17
- var currentDapp = process.env.NEXT_PUBLIC_BERA_APP_NAME;
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
- exports.defaultChainId = defaultChainId; exports.isProduction = isProduction; exports.isLocalHost = isLocalHost; exports.isPreview = isPreview; exports.isStaging = isStaging; exports.currentDapp = currentDapp;
@@ -1,26 +0,0 @@
1
- import {
2
- ChainId
3
- } from "./chunk-KJXYSGNH.mjs";
4
-
5
- // src/utils/dynamicEnvVariable.ts
6
- var defaultChainId = process.env.NEXT_PUBLIC_CHAIN_ID ? Number(process.env.NEXT_PUBLIC_CHAIN_ID) : 80094 /* MAINNET */;
7
- if (!Object.values(ChainId).includes(defaultChainId)) {
8
- throw new Error(
9
- `process.env.NEXT_PUBLIC_CHAIN_ID is invalid: ${defaultChainId}.
10
- This value must be one of the following: ${Object.values(ChainId).filter(Number).join(", ")} when using @berachain/config/internal.`
11
- );
12
- }
13
- var isProduction = process.env.VERCEL_TARGET_ENV === "production";
14
- var isLocalHost = process.env.NODE_ENV === "development";
15
- var isPreview = process.env.VERCEL_TARGET_ENV === "preview" || isLocalHost;
16
- var isStaging = process.env.VERCEL_TARGET_ENV === "staging";
17
- var currentDapp = process.env.NEXT_PUBLIC_BERA_APP_NAME;
18
-
19
- export {
20
- defaultChainId,
21
- isProduction,
22
- isLocalHost,
23
- isPreview,
24
- isStaging,
25
- currentDapp
26
- };
@@ -1,64 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
- var _chunkADH7F47Tcjs = require('./chunk-ADH7F47T.cjs');
5
-
6
- // src/internal/edge-config/isFlagEnabled.ts
7
- function _checkChain(flag, chain, defaultReturn) {
8
- if (_optionalChain([flag, 'access', _ => _.chain, 'optionalAccess', _2 => _2.length])) {
9
- return flag.chain.includes(
10
- chain === 80094 /* MAINNET */ ? "mainnet" : "bepolia"
11
- );
12
- }
13
- return defaultReturn;
14
- }
15
- function _checkBranch(flag, _environment, defaultReturn) {
16
- if (!_environment) {
17
- return defaultReturn;
18
- }
19
- const environment = _environment === "development" ? "preview" : _environment;
20
- if (_optionalChain([flag, 'access', _3 => _3.branch, 'optionalAccess', _4 => _4.length])) {
21
- return flag.branch.includes(
22
- environment
23
- );
24
- }
25
- return defaultReturn;
26
- }
27
- function _checkAppName(flag, app, defaultReturn) {
28
- if (_optionalChain([flag, 'access', _5 => _5.app, 'optionalAccess', _6 => _6.length]) && app) {
29
- return flag.app.includes(app);
30
- }
31
- return defaultReturn;
32
- }
33
- function _checkTime(flag, key, defaultReturn) {
34
- const time = flag[key];
35
- if (!time) {
36
- return defaultReturn;
37
- }
38
- if (key === "startAt") {
39
- return time ? new Date(time) <= /* @__PURE__ */ new Date() : defaultReturn;
40
- } else {
41
- return time ? new Date(time) >= /* @__PURE__ */ new Date() : defaultReturn;
42
- }
43
- }
44
- function isFlagEnabled(flag, {
45
- chain = _chunkADH7F47Tcjs.defaultChainId,
46
- environment = process.env.VERCEL_TARGET_ENV,
47
- app = _chunkADH7F47Tcjs.currentDapp
48
- } = {}) {
49
- if (!flag) return false;
50
- if (typeof flag === "boolean") {
51
- return flag;
52
- }
53
- if (flag.condition === "OR") {
54
- return _checkChain(flag, chain, false) || _checkBranch(flag, environment, false) || _checkAppName(flag, app, false) || // this condition is weird but it's consistent with the logic in the AND condition
55
- // this means that if startAt is false, but endAt is true, the flag is enabled anyway
56
- // we should prob consider a cleaner way to handle the OR condition in the future
57
- _checkTime(flag, "startAt", false) || _checkTime(flag, "endAt", false);
58
- }
59
- return _checkChain(flag, chain, true) && _checkBranch(flag, environment, true) && _checkAppName(flag, app, true) && _checkTime(flag, "startAt", true) && _checkTime(flag, "endAt", true);
60
- }
61
-
62
-
63
-
64
- exports.isFlagEnabled = isFlagEnabled;