@contentstack/studio-message-types 1.1.5 → 1.2.1

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.
@@ -1,20 +1,18 @@
1
1
  import type { Operation, Path } from "@contentstack/studio-internal";
2
- type CompositionQuery = {
3
- composableUid: string;
4
- } | {
5
- /**
6
- * IMPORTANT: If you only pass the URL without the composable UID,
7
- * we will still fetch the composition. However, it will be slower
8
- * as we will have to process all the compositions.
9
- */
10
- url: string;
11
- } | {
12
- composableUid: string;
13
- url: string;
14
- };
2
+ import type { CompositionQuery } from "./composition-query";
3
+ type SDKFramework = "react" | "vue" | "angular" | "vanilla";
15
4
  export type InitMessage = {
16
5
  sdkVersion: string;
17
6
  schemaVersion: string;
7
+ sdkFramework: SDKFramework;
8
+ timestamp?: number;
9
+ uid: string;
10
+ globalLocale?: string;
11
+ globalVariantAlias?: string;
12
+ requestedUrl?: string;
13
+ configPassedToTheSdk: {
14
+ contentTypeUid: string;
15
+ };
18
16
  };
19
17
  export declare enum TARGET_NODE {
20
18
  ACTIVE_NODE = "active-node",
@@ -144,6 +142,9 @@ export interface SerializedEvent {
144
142
  clientX: number;
145
143
  clientY: number;
146
144
  }
145
+ export interface UrlChangeEventPayload {
146
+ url: string;
147
+ }
147
148
  export interface OpenComposableStudioFromVBEventData {
148
149
  compositionEntryUid: string;
149
150
  windowFeatures?: string;
@@ -158,6 +159,76 @@ export interface CompositionSavedEventData {
158
159
  contentTypeUid: string;
159
160
  locale: string;
160
161
  }
162
+ export interface PrimaryCompositionDetectedEventData {
163
+ compositionEntryUid: string;
164
+ compositionQuery: CompositionQuery;
165
+ }
166
+ /** A composition that was considered while resolving a URL query, with its specificity score. */
167
+ export interface ShortlistedComposition {
168
+ composable_uid: string;
169
+ uid?: string;
170
+ title?: string;
171
+ url?: string;
172
+ /** literal-character specificity from URL ranking; absent for non-URL queries */
173
+ specificity?: number;
174
+ /**
175
+ * Why this candidate did or didn't win when a composition is resolved BY URL.
176
+ *
177
+ * When several compositions match the request URL and tie at the highest
178
+ * specificity, the SDK queries each tied *linked* candidate's connected content
179
+ * type for an entry matching that URL; the candidate whose content type owns a
180
+ * matching entry wins. This records that check's result for this candidate:
181
+ *
182
+ * - "found": the connected content type HAS an entry for this URL — a valid winner.
183
+ * - "absent": the connected content type was queried but has NO entry for this
184
+ * URL — it cannot serve the page (an expected, non-collision loss).
185
+ * - "not-checked": no query ran — the candidate either didn't tie at the top
186
+ * specificity tier, or it's a freeform composition with no content type to query.
187
+ *
188
+ * Absent for non-URL resolution (by composableUid or templateContentTypeUid).
189
+ */
190
+ connectedEntryResult?: "found" | "absent" | "not-checked";
191
+ }
192
+ /** The composition that won resolution (what the component actually rendered). */
193
+ export interface ResolvedComposition {
194
+ composable_uid: string;
195
+ uid?: string;
196
+ title?: string;
197
+ url?: string;
198
+ connected_content_type?: string;
199
+ }
200
+ /**
201
+ * Iframe → Studio resolution telemetry, emitted per SDK component instance on
202
+ * every fetch (success and failure) when running inside Studio. Reports what the
203
+ * user passed to `useCompositionData`, which compositions were shortlisted (with
204
+ * specificity), and which won — letting Studio list what loaded and, when the
205
+ * data proves it, explain why the edited composition didn't.
206
+ */
207
+ export interface CompositionResolutionDiagnosticEventData {
208
+ kind: "composition-resolution";
209
+ /** True for `StudioCanvas` (renders the edited composition by uid), false for regular components. */
210
+ isCanvasComponent: boolean;
211
+ /** What was passed to `useCompositionData`. */
212
+ query: CompositionQuery;
213
+ /** Subset of the resolution options actually used. */
214
+ options?: {
215
+ locale?: string;
216
+ variantAlias?: string;
217
+ templateEntryUid?: string;
218
+ };
219
+ /** Which identifier the SDK resolved by (composableUid > templateContentTypeUid > url). */
220
+ prioritizedBy: "composableUid" | "templateContentTypeUid" | "url";
221
+ /** Candidates considered (all URL-ranking tiers). Single entry for uid/ct queries; absent for custom fetchers / legacy path. */
222
+ shortlisted?: ShortlistedComposition[];
223
+ /** The winner — present on success. */
224
+ resolved?: ResolvedComposition;
225
+ /** Present on failure (e.g. COMPOSITION_NOT_FOUND_BY_URL). */
226
+ error?: {
227
+ id?: string;
228
+ message: string;
229
+ };
230
+ timestamp: number;
231
+ }
161
232
  export interface HiddenElementNotificationEventData {
162
233
  action: "open" | "close";
163
234
  uid: "__all__" | (string & {});
@@ -177,4 +248,4 @@ export interface ApplySymbolOperationEventData {
177
248
  operations: Operation[];
178
249
  uid: string;
179
250
  }
180
- export type { CompositionQuery };
251
+ export {};
@@ -7,3 +7,4 @@ export var TARGET_NODE;
7
7
  TARGET_NODE["SLOT_NODE"] = "slot-node";
8
8
  TARGET_NODE["FOCUSED_NODE"] = "focused-node";
9
9
  })(TARGET_NODE || (TARGET_NODE = {}));
10
+ // Import types that are referenced
@@ -0,0 +1,27 @@
1
+ export type CompositionQuery = {
2
+ composableUid: string;
3
+ } | {
4
+ /**
5
+ * IMPORTANT: If you only pass the URL without the composable UID,
6
+ * we will still fetch the composition. However, it will be slower
7
+ * as we will have to process all the compositions.
8
+ */
9
+ url: string;
10
+ } | {
11
+ composableUid: string;
12
+ url: string;
13
+ } | {
14
+ /**
15
+ * Filter compositions by connected content type UID.
16
+ * Returns the first matching composition (limit 1).
17
+ */
18
+ templateContentTypeUid: string;
19
+ } | {
20
+ /**
21
+ * Filter compositions by connected content type UID with URL context.
22
+ * The templateContentTypeUid takes priority for composition fetch.
23
+ * URL is preserved for iframe/Studio context and future resolution.
24
+ */
25
+ url: string;
26
+ templateContentTypeUid: string;
27
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,7 @@
1
- import { HitboxDetails, ValidatePropEventPayload, PreProcessedBreakpoint, SlotNodeHitboxDetails, HighlightNodeEventPayload, RequestHighlightNodeEventPayload, HighlightFocusedNodeEventPayload, HighlightSlotNodeEventPayload, HighlightStyleNodeEventPayload, HighlightActiveNodeEventPayload, BaseHighlightEventPayload, RegularNodeHitboxDetails, SerializedEvent, Breakpoint, HighlightAncestorsEventPayload, InitMessage, DefaultBreakpoint, ActiveBreakpointEventPayload, BreakpointInput, RegisterBreakpointsEventPayload, SetCursorTypeEventPayload, UpdateStyleEventPayload, ComputedStyleSection, ChangeActiveStyleGroupPayload, handleActiveNodePayload, handleFocusedNodePayload, handleActiveSlotNode, MouseMoveEventPayload, MouseUpEventPayload, DraggerPosition, UpdateBindingErrorsEventPayload, OpenComposableStudioFromVBEventData, OpenComposableStudioFromStudioEventData, CompositionSavedEventData, HiddenElementNotificationEventData, GetNodeScreenshotEventData, GetNodeScreenshotResponseEventData, RefetchSpecEventData, ApplySymbolOperationEventData, TARGET_NODE } from "./client";
2
- export type { InitMessage, HighlightActiveNodeEventPayload, HighlightAncestorsEventPayload, HighlightStyleNodeEventPayload, HighlightSlotNodeEventPayload, HighlightFocusedNodeEventPayload, HighlightNodeEventPayload, RequestHighlightNodeEventPayload, BaseHighlightEventPayload, HitboxDetails, RegularNodeHitboxDetails, SlotNodeHitboxDetails, SerializedEvent, ValidatePropEventPayload, Breakpoint, PreProcessedBreakpoint, DefaultBreakpoint, BreakpointInput, ActiveBreakpointEventPayload, RegisterBreakpointsEventPayload, SetCursorTypeEventPayload, UpdateStyleEventPayload, ComputedStyleSection, ChangeActiveStyleGroupPayload, handleActiveNodePayload, handleFocusedNodePayload, handleActiveSlotNode, MouseMoveEventPayload, MouseUpEventPayload, DraggerPosition, UpdateBindingErrorsEventPayload, OpenComposableStudioFromVBEventData, OpenComposableStudioFromStudioEventData, CompositionSavedEventData, HiddenElementNotificationEventData, GetNodeScreenshotEventData, GetNodeScreenshotResponseEventData, RefetchSpecEventData, ApplySymbolOperationEventData, } from "./client";
1
+ import { HitboxDetails, ValidatePropEventPayload, PreProcessedBreakpoint, SlotNodeHitboxDetails, HighlightNodeEventPayload, RequestHighlightNodeEventPayload, HighlightFocusedNodeEventPayload, HighlightSlotNodeEventPayload, HighlightStyleNodeEventPayload, HighlightActiveNodeEventPayload, BaseHighlightEventPayload, RegularNodeHitboxDetails, SerializedEvent, UrlChangeEventPayload, Breakpoint, HighlightAncestorsEventPayload, InitMessage, DefaultBreakpoint, ActiveBreakpointEventPayload, BreakpointInput, RegisterBreakpointsEventPayload, SetCursorTypeEventPayload, UpdateStyleEventPayload, ComputedStyleSection, ChangeActiveStyleGroupPayload, handleActiveNodePayload, handleFocusedNodePayload, handleActiveSlotNode, MouseMoveEventPayload, MouseUpEventPayload, DraggerPosition, UpdateBindingErrorsEventPayload, OpenComposableStudioFromVBEventData, OpenComposableStudioFromStudioEventData, CompositionSavedEventData, PrimaryCompositionDetectedEventData, CompositionResolutionDiagnosticEventData, HiddenElementNotificationEventData, GetNodeScreenshotEventData, GetNodeScreenshotResponseEventData, RefetchSpecEventData, ApplySymbolOperationEventData, TARGET_NODE } from "./client";
2
+ import type { CompositionQuery } from "./composition-query";
3
+ export type { CompositionQuery };
4
+ export type { InitMessage, HighlightActiveNodeEventPayload, HighlightAncestorsEventPayload, HighlightStyleNodeEventPayload, HighlightSlotNodeEventPayload, HighlightFocusedNodeEventPayload, HighlightNodeEventPayload, RequestHighlightNodeEventPayload, BaseHighlightEventPayload, HitboxDetails, RegularNodeHitboxDetails, SlotNodeHitboxDetails, SerializedEvent, UrlChangeEventPayload, ValidatePropEventPayload, Breakpoint, PreProcessedBreakpoint, DefaultBreakpoint, BreakpointInput, ActiveBreakpointEventPayload, RegisterBreakpointsEventPayload, SetCursorTypeEventPayload, UpdateStyleEventPayload, ComputedStyleSection, ChangeActiveStyleGroupPayload, handleActiveNodePayload, handleFocusedNodePayload, handleActiveSlotNode, MouseMoveEventPayload, MouseUpEventPayload, DraggerPosition, UpdateBindingErrorsEventPayload, OpenComposableStudioFromVBEventData, OpenComposableStudioFromStudioEventData, CompositionSavedEventData, PrimaryCompositionDetectedEventData, CompositionResolutionDiagnosticEventData, ShortlistedComposition, ResolvedComposition, HiddenElementNotificationEventData, GetNodeScreenshotEventData, GetNodeScreenshotResponseEventData, RefetchSpecEventData, ApplySymbolOperationEventData, } from "./client";
3
5
  export { TARGET_NODE } from "./client";
4
6
  export type BaseType = {
5
7
  InitMessage: InitMessage;
@@ -15,6 +17,7 @@ export type BaseType = {
15
17
  RegularNodeHitboxDetails: RegularNodeHitboxDetails;
16
18
  SlotNodeHitboxDetails: SlotNodeHitboxDetails;
17
19
  SerializedEvent: SerializedEvent;
20
+ UrlChangeEventPayload: UrlChangeEventPayload;
18
21
  ValidatePropEventPayload: ValidatePropEventPayload;
19
22
  Breakpoint: Breakpoint;
20
23
  PreProcessedBreakpoint: PreProcessedBreakpoint;
@@ -36,6 +39,8 @@ export type BaseType = {
36
39
  OpenComposableStudioFromVBEventData: OpenComposableStudioFromVBEventData;
37
40
  OpenComposableStudioFromStudioEventData: OpenComposableStudioFromStudioEventData;
38
41
  CompositionSavedEventData: CompositionSavedEventData;
42
+ PrimaryCompositionDetectedEventData: PrimaryCompositionDetectedEventData;
43
+ CompositionResolutionDiagnosticEventData: CompositionResolutionDiagnosticEventData;
39
44
  HiddenElementNotificationEventData: HiddenElementNotificationEventData;
40
45
  GetNodeScreenshotEventData: GetNodeScreenshotEventData;
41
46
  GetNodeScreenshotResponseEventData: GetNodeScreenshotResponseEventData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/studio-message-types",
3
- "version": "1.1.5",
3
+ "version": "1.2.1",
4
4
  "description": "Shared message types for communication between Studio platform and SDKs",
5
5
  "author": "RavenColEvol <ravilamkoti@gmail.com>",
6
6
  "homepage": "https://github.com/contentstack/composable-studio-sdk#readme",
@@ -37,5 +37,5 @@
37
37
  "peerDependencies": {
38
38
  "@contentstack/studio-internal": "*"
39
39
  },
40
- "gitHead": "6739518a282ff9788218b0acd2e46e0be2a6fb68"
40
+ "gitHead": "d4e0a1d80b39a2bfa9ac12baa5d4d4a852f4b326"
41
41
  }