@zealicsolutions/web-ui 1.0.140-beta.152 → 1.0.140-beta.154

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.
@@ -21,10 +21,26 @@ export declare const encodeObjectToBase64Url: (obj: Record<string, unknown>) =>
21
21
  */
22
22
  export declare const decodeBase64UrlToObject: <T>(input: string) => T | null;
23
23
  /**
24
- * Compose organism-namespaced `rwoContext` and page-level `rwoRecordId` from inputs
25
- * mapping entries provide source field id and target organism ids
24
+ * Compose organism-namespaced `rwoContext` from inputs.
25
+ * All RWO data is stored inside rwoContext - no separate rwoRecordId URL param.
26
+ *
27
+ * Structure:
28
+ * {
29
+ * "selectedWebpageId": "target-webpage-uuid", // Scopes context to webpage
30
+ * "[organismId]": {
31
+ * "rwoRecordId": "record-uuid",
32
+ * "[fieldId]": "value"
33
+ * }
34
+ * }
35
+ *
36
+ * @param selectedWebpageId - Target webpage ID to scope the context
37
+ * @param includeRwoRecordId - Whether to include rwoRecordId in organism contexts
38
+ * @param recordId - The primary record ID
39
+ * @param mapping - Field mappings to target organisms
40
+ * @param contextSource - Source data for field resolution
26
41
  */
27
- export declare const composeRwoParamsV2: ({ includeRwoRecordId, recordId, mapping, contextSource, }: {
42
+ export declare const composeRwoParamsV2: ({ selectedWebpageId, includeRwoRecordId, recordId, mapping, contextSource, }: {
43
+ selectedWebpageId?: string | undefined;
28
44
  includeRwoRecordId?: boolean | undefined;
29
45
  recordId?: string | undefined;
30
46
  mapping?: {
@@ -40,10 +56,21 @@ export declare const composeRwoParamsV2: ({ includeRwoRecordId, recordId, mappin
40
56
  *
41
57
  * const [searchParams] = useSearchParams();
42
58
  * const rwoContextParam = searchParams.get('rwoContext') || '';
43
- * const rwoRecordId = searchParams.get('rwoRecordId');
59
+ * const selectedWebpageId = searchParams.get('selectedWebpageId');
44
60
  *
45
61
  * // Decode rwoContext to get organism-specific context
46
- * const rwoContext = rwoContextParam ? decodeBase64UrlToObject<Record<string, Record<string, string>>>(rwoContextParam) : null;
47
- * const organismContext = rwoContext?.[organismId];
48
- * const rwoRecordIdForOrganism = organismContext?.rwoRecordId || rwoRecordId || undefined;
62
+ * const rwoContext = rwoContextParam
63
+ * ? decodeBase64UrlToObject<Record<string, unknown>>(rwoContextParam)
64
+ * : null;
65
+ *
66
+ * // Verify context is for current webpage before using
67
+ * const contextWebpageId = rwoContext?.selectedWebpageId as string | undefined;
68
+ * if (contextWebpageId && contextWebpageId !== selectedWebpageId) {
69
+ * // Context is for a different page, ignore it
70
+ * return;
71
+ * }
72
+ *
73
+ * // Get organism-specific context (rwoRecordId is inside organism context, NOT separate URL param)
74
+ * const organismContext = rwoContext?.[organismId] as Record<string, string> | undefined;
75
+ * const rwoRecordIdForOrganism = organismContext?.rwoRecordId;
49
76
  */