@@ -166,8 +166,8 @@ For example, if your page is `https.example.com/contact`, you can enable logging
166166#### Routing Prerendering System
167167The prerendering system optimizes the initial load:
168168``` typescript
169- Cal . prerender ( {
170- calLink: " organization/event-type " ,
169+ Cal ( " prerender " , {
170+ calLink ,
171171 type: " modal"
172172});
173173```
@@ -178,24 +178,63 @@ Key aspects:
178178- Loads the booking page but doesn't send the slots availability request
179179- Tries to reuse whenever it makes sense and do a fresh load otherwise
180180
181- Iframe Reuse and Reload Conditions. There could be three situations:
181+ Modal's Iframe Reuse and Reload Conditions. There could be four situations:
182182
183- 1 . Reuse
184- 2 . Reuse the iframe but refetch the slots
185- 3 . Do a fresh load in iframe
183+ 1 . Show modal as is. No connect and no requests happen - Corresponding action is "noAction"
184+ 2 . Connect but don't fetch the slots- Corresponding action is "connect-no-slots-fetch"
185+ 3 . Connect and fetch the slots - Corresponding action is "connect"
186+ 4 . Do a fresh load in iframe. Corresponding action is "fullReload"
186187
187- - ** Reuse** :
188- - Modal opens when
189- - Modal is not in a failed state
190- - config, params are same as the last time
191- - No threshold violations
188+ - ** Show modal as is** :
189+ - Modal is not in a failed state
190+ - config, params are same as the last time
191+ - No time threshold violations
192192
193- - ** Reuse the iframe but refetch the slots** :
193+ - ** Connect but don't fetch the slots** :
194194 - Only embed ` config ` changes (handled via "connect" flow)
195195 - Query query params changes (handled via "connect" flow)
196196 - Crossed slots stale time threshold (EMBED_MODAL_IFRAME_SLOT_STALE_TIME)
197197
198- - ** Fresh Reload Conditions** :
198+ - ** Connect and fetch the slots** :
199+ - Slots are stale
200+ - Crossed slots stale time threshold (EMBED_MODAL_IFRAME_SLOT_STALE_TIME)
201+
202+ - ** Do a fresh load in iframe** :
199203 - Different path being loaded(i.e. /pro vs /free)
200204 - Modal is in a failed state
201205 - Time since last render exceeds EMBED_MODAL_IFRAME_FORCE_RELOAD_THRESHOLD_MS
206+
207+
208+ #### Prerendering headless router
209+
210+ ** Without namespace:**
211+ Prerender when there are high chances of user clicking the CTA.
212+ ``` js
213+ Cal (' prerender' , {
214+ calLink: " router?formId=123&ONLY_THOSE_FIELDS_THAT_ARE_REQUIRED_BY_ROUTING_RULES_SHOULD_BE_PRESENT_HERE" ,
215+ // Prerender right now works only with "modal", so 'element click' embed is able to reuse this prerendered iframe
216+ type: " modal" ,
217+ // Shows skeleton loader for a Team Event's booking slots page
218+ pageType: " team.event.booking.slots"
219+ });
220+ ```
221+ Using the prerendered iframe with a CTA:
222+ ``` js
223+ < button data- cal- link= " router?formId=123&ALL_FIELDS_HERE" > Demo< / button>
224+ ```
225+
226+ ** With namespace:**
227+ Prerender when there are high changes of user clicking the CTA.
228+ ``` js
229+ Cal .ns .myNamespace (' prerender' , {
230+ calLink: " router?formId=123&ONLY_THOSE_FIELDS_THAT_ARE_REQUIRED_BY_ROUTING_RULES_SHOULD_BE_PRESENT_HERE" ,
231+ // Prerender right now works only with "modal", so 'element click' embed is able to reuse this prerendered iframe
232+ type: " modal"
233+ // Shows skeleton loader for a Team Event's booking slots page
234+ pageType: " team.event.booking.slots"
235+ });
236+ ```
237+ Using the prerendered iframe with a CTA:
238+ ``` js
239+ < button data- cal- namespace= " myNamespace" data- cal- link= " router?formId=123&ALL_FIELDS_HERE" > Demo< / button>
240+ ```
0 commit comments