@amplifyup/sdk 0.1.53 → 0.1.55

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/dist/index.mjs CHANGED
@@ -545,6 +545,23 @@ function mergeEventContext(properties, attached) {
545
545
  function setPageResourceFields(fields) {
546
546
  }
547
547
 
548
+ // src/debug.ts
549
+ function envFlag(value) {
550
+ if (!value) return false;
551
+ const v = value.trim().toLowerCase();
552
+ return v === "1" || v === "true" || v === "yes";
553
+ }
554
+ function readAmplifyUpDebugEnv() {
555
+ try {
556
+ if (typeof process === "undefined") return false;
557
+ return envFlag(process.env.NEXT_PUBLIC_AMPLIFYUP_DEBUG) || envFlag(process.env.AMPLIFYUP_DEBUG);
558
+ } catch {
559
+ return false;
560
+ }
561
+ }
562
+ function setAmplifyUpDebug(enabled) {
563
+ }
564
+
548
565
  // src/reservedRoutes.ts
549
566
  var AMPLIFYUP_EDITOR_ROUTE = "/__amplifyup/editor";
550
567
  function isAmplifyUpEditorRoute(pathname) {
@@ -1124,13 +1141,13 @@ var AmplifyUpSDK = class {
1124
1141
  }
1125
1142
  this.config = {
1126
1143
  trackingId: previewOverrides.trackingId || config.trackingId,
1127
- debug: config.debug ?? true,
1128
- // Enable debug by default
1144
+ debug: config.debug ?? readAmplifyUpDebugEnv(),
1129
1145
  target: this.target,
1130
1146
  dev: config.dev,
1131
1147
  ...config.siteId ? { siteId: config.siteId } : {},
1132
1148
  ...config.pageContext ? { pageContext: config.pageContext } : {}
1133
1149
  };
1150
+ setAmplifyUpDebug(!!this.config.debug);
1134
1151
  if (config.pageContext) {
1135
1152
  this.pendingPageContext = config.pageContext;
1136
1153
  this.recomputeAttachedContext();