@zealicsolutions/web-ui 1.0.140-beta.221 → 1.0.140-beta.223

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.
@@ -82,10 +82,14 @@ export declare const composeRwoParamsV2: ({ selectedWebpageId, includeRwoRecordI
82
82
  * return; // No context for this webpage
83
83
  * }
84
84
  *
85
- * // Get rwoRecordId with priority:
86
- * // 1. Organism-specific: webpageContext[organismId].rwoRecordId
87
- * // 2. Webpage-level: webpageContext.rwoRecordId
85
+ * // Get organism context - ONLY use organism-specific context
86
+ * // DO NOT fallback to webpage-level rwoRecordId
88
87
  * const organismContext = webpageContext[organismId] as Record<string, string> | undefined;
89
- * const rwoRecordIdForOrganism = organismContext?.rwoRecordId
90
- * || (webpageContext.rwoRecordId as string | undefined);
88
+ *
89
+ * // Use organism context for data fetching (includes rwoRecordId + other fields)
90
+ * // Form fetching payload: { [sourceFieldId]: value, rwoRecordId: value }
91
+ * const fetchPayload = organismContext || {};
92
+ *
93
+ * // Use ONLY organism-specific rwoRecordId for form submission
94
+ * const rwoRecordIdForSubmission = organismContext?.rwoRecordId;
91
95
  */
@@ -2,12 +2,15 @@
2
2
  * Hook for organisms to easily access their RWO context from URL parameters.
3
3
  * Uses webpage-scoped structure to prevent cross-page context pollution.
4
4
  *
5
- * NEW Structure: { [webpageId]: { rwoRecordId, [organismId]: { rwoRecordId, ... } } }
5
+ * Structure: { [webpageId]: { [organismId]: { rwoRecordId, [fieldId]: value } } }
6
+ *
7
+ * CRITICAL: Forms ONLY use rwoRecordId from their organism-specific context.
8
+ * DO NOT fallback to webpage-level or top-level rwoRecordId.
6
9
  *
7
10
  * Organisms look up context by:
8
11
  * 1. Get their current webpage ID from prop or URL
9
- * 2. Look up rwoContext[webpageId] to get the webpage's context
10
- * 3. Read rwoRecordId with priority: webpageContext[organismId].rwoRecordId > webpageContext.rwoRecordId
12
+ * 2. Look up rwoContext[webpageId][organismId] to get organism's context
13
+ * 3. Read rwoRecordId ONLY from organism-specific context
11
14
  *
12
15
  * @param organismId - The ID of the organism consuming the context
13
16
  * @param currentWebpageId - The webpage ID this organism belongs to (REQUIRED for proper scoping)
@@ -13,20 +13,24 @@ export declare const getRwoTargets: (url?: string) => Array<{
13
13
  recordId: string;
14
14
  }>;
15
15
  /**
16
- * Gets the appropriate RWO record ID for a specific organism using webpage-scoped RWO context.
16
+ * Gets the RWO record ID for a specific organism using webpage-scoped RWO context.
17
17
  *
18
- * NEW Structure: { [webpageId]: { rwoRecordId, [organismId]: { rwoRecordId, ... } } }
18
+ * Structure: { [webpageId]: { [organismId]: { rwoRecordId, [fieldId]: value } } }
19
19
  *
20
- * Priority:
21
- * 1. Organism-specific: rwoContext[webpageId][organismId].rwoRecordId
22
- * 2. Webpage-level: rwoContext[webpageId].rwoRecordId
20
+ * CRITICAL: Forms ONLY use rwoRecordId from their organism-specific context.
21
+ * DO NOT fallback to webpage-level rwoRecordId - this prevents unintended data fetching.
23
22
  *
24
- * This structure ensures organisms ONLY read context for their own webpage.
23
+ * Organisms read context by:
24
+ * 1. Get their current webpage ID
25
+ * 2. Look up rwoContext[webpageId][organismId] to get organism's context
26
+ * 3. Read rwoRecordId ONLY from organism-specific context
27
+ *
28
+ * This ensures forms only fetch/edit data when explicitly navigated to with their own context.
25
29
  *
26
30
  * @param organismId - The ID of the organism
27
31
  * @param url - The URL to parse (defaults to current location)
28
32
  * @param currentWebpageId - The current webpage ID (REQUIRED for proper scoping)
29
- * @returns The record ID to use, or undefined if not found or no context for this webpage
33
+ * @returns The record ID to use, or undefined if not found or no context for this organism
30
34
  */
31
35
  export declare const getRwoRecordIdForOrganism: (organismId: string, url?: string, currentWebpageId?: string) => string | undefined;
32
36
  export declare const updateSearchParams: (currentParams: URLSearchParams, internalLink?: Nullable<string>, isPreview?: boolean) => URLSearchParams;