@amplifyup/sdk 0.1.77 → 0.1.78

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.
@@ -166,6 +166,7 @@ var AWSAdapter = class {
166
166
  return;
167
167
  }
168
168
  const trackingId = eventData?.trackingId || this.config?.trackingId;
169
+ const debug = this.config?.debug;
169
170
  const query = trackingId ? `?tid=${encodeURIComponent(trackingId)}` : "";
170
171
  const url = `${this.apiGatewayUrl}${endpoint}${query}`;
171
172
  try {
@@ -180,15 +181,15 @@ var AWSAdapter = class {
180
181
  keepalive: true
181
182
  });
182
183
  if (!response.ok) {
183
- if (this.config.debug) {
184
+ if (debug) {
184
185
  console.warn(`AmplifyUp SDK: Event tracking failed: ${response.status} ${response.statusText}`);
185
186
  }
186
- } else if (this.config.debug) {
187
+ } else if (debug) {
187
188
  const result = await response.json().catch(() => ({}));
188
189
  console.log("AmplifyUp SDK: Event tracked", result);
189
190
  }
190
191
  } catch (error) {
191
- if (this.config.debug) {
192
+ if (debug) {
192
193
  console.error("AmplifyUp SDK: Event tracking error:", error);
193
194
  }
194
195
  }
@@ -3563,6 +3564,14 @@ function getSDK(adapter) {
3563
3564
  var trackContentView = (contentId, contentType, properties) => getSDK().trackContentView(contentId, contentType, properties);
3564
3565
  var refreshEventTracking = () => getSDK().refreshEventTracking();
3565
3566
  getSDK();
3567
+ var PageContentRegistryContext = createContext(null);
3568
+ function useRegisterPageContent(enabled = true) {
3569
+ const register = useContext(PageContentRegistryContext);
3570
+ useEffect(() => {
3571
+ if (!enabled || !register) return;
3572
+ return register();
3573
+ }, [enabled, register]);
3574
+ }
3566
3575
  function useInComposer(force = false) {
3567
3576
  const [detected, setDetected] = useState(false);
3568
3577
  useEffect(() => {
@@ -3804,6 +3813,7 @@ function AmplifyRendererInner({
3804
3813
  composerPreview
3805
3814
  }) {
3806
3815
  const clientHook = useAmplifyUp();
3816
+ useRegisterPageContent(!serverPageConfig);
3807
3817
  const composerPreviewFlag = useComposerPreviewFlag(!!composerPreview);
3808
3818
  const pageConfig = serverPageConfig || clientHook.pageConfig || null;
3809
3819
  const loading = serverPageConfig ? false : clientHook.loading;