@amplifyup/sdk 0.2.4 → 0.2.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.
package/dist/react.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import { P as PageConfig, f as AmplifyUpConfig, h as AmplifyPageContextInput, C as ContentSource, a as AmplifyContentMeta } from './types-ffQNIQCK.js';
3
2
  export { Z as ZoneConfig } from './types-ffQNIQCK.js';
4
- import react__default, { ReactNode, FC } from 'react';
5
- import { C as ComponentRegistry } from './AmplifyRenderer-BNWBrFQN.js';
6
- export { A as AmplifyRenderer, d as defineComponentRegistry } from './AmplifyRenderer-BNWBrFQN.js';
7
- import { o as Field$1, p as FIELDS_BRAND } from './query-Xo9cy-2F.js';
8
- export { A as FieldRef, B as Fields, I as ImageValue, C as LayoutComponentProps, L as ListRow, P as PortableRef, Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, r as attachFieldEnvelopes, v as composerStoreKey, u as envelopeListRows, z as isBrandedFields, x as isFieldEnvelope, y as isReadOnlyRowField, w as listOwnerFromSpec, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants, t as toFieldEnvelopes } from './query-Xo9cy-2F.js';
3
+ import React__default, { ReactNode, FC } from 'react';
4
+ import { C as ComponentRegistry } from './AmplifyRenderer-CTwblDs3.js';
5
+ export { A as AmplifyRenderer, d as defineComponentRegistry } from './AmplifyRenderer-CTwblDs3.js';
6
+ import { o as Field$1, p as FIELDS_BRAND } from './query-Bs5o-qmw.js';
7
+ export { r as FieldRef, t as Fields, I as ImageValue, L as LayoutComponentProps, u as ListRow, P as PortableRef, Q as QueryContentError, b as QueryContentOptions, c as QueryFilter, d as QueryFilterOp, e as QueryPagination, f as QueryResult, g as QuerySort, h as QuerySpec, S as SelectVariantsError, i as SelectVariantsOptions, j as SelectVariantsResult, v as attachFieldEnvelopes, w as composerStoreKey, x as envelopeListRows, y as isBrandedFields, z as isFieldEnvelope, A as isReadOnlyRowField, B as listOwnerFromSpec, n as nextPageSpec, q as queryContent, s as searchSpec, m as selectVariants, C as toFieldEnvelopes } from './query-Bs5o-qmw.js';
9
8
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
10
9
 
11
10
  interface AmplifyPageContentProps {
@@ -38,7 +37,7 @@ interface AmplifyPageContentProps {
38
37
  * Live pages paint the SSG/ISR layout first. Client Edge resolve (visitor id)
39
38
  * overlays only when the personalized tree differs from that static HTML.
40
39
  */
41
- declare function AmplifyPageContent(contentProps: AmplifyPageContentProps): react_jsx_runtime.JSX.Element | null;
40
+ declare function AmplifyPageContent(contentProps: AmplifyPageContentProps): React__default.JSX.Element | null;
42
41
 
43
42
  type AmplifyPageProps = Omit<AmplifyPageContentProps, 'registry'>;
44
43
  /**
@@ -62,6 +61,13 @@ declare function useInComposer(force?: boolean): boolean;
62
61
  /** @deprecated Prefer `useInComposer`. Kept for internal AmplifyPageContent. */
63
62
  declare function useComposerPreviewFlag(force?: boolean): boolean;
64
63
 
64
+ /**
65
+ * SDK Components for Slot and Field rendering
66
+ *
67
+ * These components allow developers to explicitly define where slots and fields
68
+ * are rendered in their components, with full control over styling and structure.
69
+ */
70
+
65
71
  /**
66
72
  * Slot Component
67
73
  *
@@ -91,7 +97,7 @@ declare function useComposerPreviewFlag(force?: boolean): boolean;
91
97
  declare function Slot({ name, className }: {
92
98
  name: string;
93
99
  className?: string;
94
- }): react_jsx_runtime.JSX.Element | null;
100
+ }): React__default.JSX.Element | null;
95
101
  type RejectFieldInput<T> = [T] extends [readonly unknown[]] ? never : T extends {
96
102
  readonly [FIELDS_BRAND]: true;
97
103
  } ? never : T;
@@ -126,7 +132,7 @@ declare function Field<T = unknown>(props: {
126
132
  /** Required with `value` for computed values. */
127
133
  name?: string;
128
134
  className?: string;
129
- }): react_jsx_runtime.JSX.Element | null;
135
+ }): React__default.JSX.Element | null;
130
136
  /**
131
137
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
132
138
  *
@@ -155,7 +161,7 @@ declare function RichText<T = string | null>(props: {
155
161
  as?: keyof JSX.IntrinsicElements;
156
162
  /** String children are treated as the markdown value (same as `value`). */
157
163
  children?: ReactNode;
158
- }): react_jsx_runtime.JSX.Element | null;
164
+ }): React__default.JSX.Element | null;
159
165
  /**
160
166
  * Image — renders a provider-backed image value as `<img>`.
161
167
  *
@@ -178,13 +184,13 @@ declare function Image<T = unknown>(props: {
178
184
  /** Required with `value` for computed values. */
179
185
  name?: string;
180
186
  alt?: string;
181
- } & Omit<react__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
187
+ } & Omit<React__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): React__default.JSX.Element | null;
182
188
 
183
189
  /** Tells Slot whether the layout/provider fetch has settled. */
184
190
  declare function ComposerLayoutStatusProvider({ ready, children, }: {
185
191
  ready: boolean;
186
192
  children: ReactNode;
187
- }): react_jsx_runtime.JSX.Element;
193
+ }): React__default.JSX.Element;
188
194
 
189
195
  /** Composer slot lifecycle. Loading ≠ empty. */
190
196
  type SlotState = 'loading' | 'empty' | 'filled';
@@ -202,12 +208,12 @@ declare function ComposerProvider({ children, enabled, }: {
202
208
  children: ReactNode;
203
209
  /** When false, pass through any parent store without creating or wiring one. */
204
210
  enabled?: boolean;
205
- }): react_jsx_runtime.JSX.Element;
211
+ }): React__default.JSX.Element;
206
212
  declare function MaybeComposerProvider({ enabled, layoutNodeId, children, }: {
207
213
  enabled: boolean;
208
214
  layoutNodeId?: string;
209
215
  children: ReactNode;
210
- }): react_jsx_runtime.JSX.Element;
216
+ }): React__default.JSX.Element;
211
217
 
212
218
  interface AmplifyUpContextType {
213
219
  pageConfig: PageConfig | null;
@@ -225,7 +231,7 @@ interface AmplifyUpProviderProps {
225
231
  */
226
232
  pageContext?: AmplifyPageContextInput;
227
233
  }
228
- declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
234
+ declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): React__default.JSX.Element;
229
235
  declare function useAmplifyUp(): AmplifyUpContextType;
230
236
 
231
237
  export { AmplifyContentMeta, AmplifyPageContent, type AmplifyPageContentProps, type AmplifyPageProps, AmplifyUpProvider, ComponentRegistry, ComposerLayoutStatusProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Image, MaybeComposerProvider, PageConfig, RichText, Slot, type SlotState, bindAmplifyPage, resolveSlotState, slotShowsAddComponent, slotStateFromEl, useAmplifyUp, useComposerPreviewFlag, useInComposer };
package/dist/react.js CHANGED
@@ -437,7 +437,7 @@ function isComposerPreview() {
437
437
  }
438
438
 
439
439
  // src/field-envelope.ts
440
- var FIELDS_BRAND = Symbol("amplifyup.fields");
440
+ var FIELDS_BRAND = /* @__PURE__ */ Symbol("amplifyup.fields");
441
441
  var IDENTIFIER_KEYS = /* @__PURE__ */ new Set([
442
442
  "id",
443
443
  "_id",
@@ -3938,7 +3938,6 @@ function getSDK(adapter) {
3938
3938
  sdkInstance.ensureWindowBridge();
3939
3939
  return sdkInstance;
3940
3940
  }
3941
- var trackContentView = (contentId, contentType, properties) => getSDK().trackContentView(contentId, contentType, properties);
3942
3941
  var refreshEventTracking = () => getSDK().refreshEventTracking();
3943
3942
  getSDK();
3944
3943
  var PageContentRegistryContext = React3.createContext(null);
@@ -4914,7 +4913,7 @@ function Image(props) {
4914
4913
 
4915
4914
  // src/component-key.ts
4916
4915
  var componentKey = (id) => id.toLowerCase().replace(/[^a-z0-9]/g, "");
4917
- var REGISTRY_BRAND = Symbol.for("amplifyup.componentRegistry");
4916
+ var REGISTRY_BRAND = /* @__PURE__ */ Symbol.for("amplifyup.componentRegistry");
4918
4917
  var defineComponentRegistry = (components) => {
4919
4918
  const index = /* @__PURE__ */ new Map();
4920
4919
  for (const [name, component] of Object.entries(components)) {
@@ -5098,32 +5097,6 @@ function AmplifyRendererInner(rendererProps) {
5098
5097
  const error = serverPageConfig ? null : clientHook.error;
5099
5098
  const contentSource = clientHook.source;
5100
5099
  const [variantCache, setVariantCache] = React3.useState({});
5101
- React3.useEffect(() => {
5102
- if (typeof window !== "undefined") {
5103
- if (window.__AMPLIFYUP_PREVIEW_MODE__ === true) {
5104
- return;
5105
- }
5106
- if (window.location.pathname.includes("/api/pages/proxy")) {
5107
- return;
5108
- }
5109
- if (window.self !== window.top) {
5110
- return;
5111
- }
5112
- const urlParams = new URLSearchParams(window.location.search);
5113
- if (urlParams.get("preview") === "true" || urlParams.get("visualEditor") === "true") {
5114
- return;
5115
- }
5116
- if (window.location.href.includes("preview=true") || window.location.href.includes("visualEditor=true")) {
5117
- return;
5118
- }
5119
- }
5120
- if (pageConfig && pageConfig.id !== "default") {
5121
- trackContentView(pageConfig.id, "page", {
5122
- route: pageConfig.route,
5123
- title: pageConfig.title
5124
- });
5125
- }
5126
- }, [pageConfig]);
5127
5100
  React3.useEffect(() => {
5128
5101
  if (!pageConfig?.eventTracking?.length) return;
5129
5102
  const sdk = getSDK();