Sitewide Contexts

Sitewide Contexts can be used to make rendering decisions in templates.

Be mindful that detail and other pages are cached by default on the CDN. If you make a Server-Side-Rendering decision based on a context, then it could be cached for all users. In order to render bot or personalized content, either Cache Bypass rules must be set up in the CDN or the context must only be used in Client-Side-Rendering code. Warning - never cache bot or personalized content!

Composability

Video - Designing for composability in Qwik
Video outline

- useContext vs. props in Qwik

- component reuse
  - composability (atomic design)
    - in site - [atomic design](https://bradfrost.com/blog/post/atomic-web-design/)
    - in other sites - [atomic design](https://qwik.dev/docs/advanced/containers/)

- component testing techniques
  - encapsulation makes testing easier
  - props - straightforward
  - dependency injection - harder to understand

- scope determines the best way to access state
  - separation of concerns - limit scope to minimum level
    - sitewide environment (affects all components) 
      - useContext
      - useLocation
      - css Themes, etc.
    - component environment 
      - props + useStore for encapsulation of data
      - component DOM properties are also an underused option to store local state          
          

Sitewide Contexts

useDev

{
  "isDev": false,
  "performance": {},
  "timeStamp": 1765327009188
}

useRender

{
  "isBrandOrigin": false,
  "isCsr": false,
  "isDev": false,
  "isFragment": false,
  "isLib": true,
  "isMinWidth0Rem": false,
  "isMinWidth48Rem": false,
  "isMinWidth64Rem": true,
  "isProd": true,
  "isSsr": false,
  "route": {
    "urlMatch": {
      "include": "/docs/.+"
    },
    "error": {
      "type": 404,
      "errorPageUrl": "/docs/errors/search/404"
    },
    "routeType": "notFoundSearch",
    "analyticsId": "unknown"
  },
  "isMobileUa": false,
  "isTabletUa": false,
  "isBotUa": true
}

useReq

{
  "headers": {
    "accept": "*/*",
    "accept-encoding": "gzip, br",
    "cf-connecting-ip": "216.73.216.105",
    "cf-ipcountry": "US",
    "cf-ray": "9ab8ab8f6f6dcf67",
    "cf-visitor": "{\"scheme\":\"https\"}",
    "connection": "Keep-Alive",
    "host": "va-site.pages.dev",
    "user-agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)",
    "x-forwarded-proto": "https",
    "x-real-ip": "216.73.216.105"
  },
  "url": "https://va-site.pages.dev/docs/contexts",
  "cf": {
    "httpProtocol": "HTTP/2",
    "clientAcceptEncoding": "gzip, deflate, br",
    "requestPriority": "weight=16;exclusive=0;group=0;group-weight=0",
    "edgeRequestKeepAliveStatus": 1,
    "requestHeaderNames": {},
    "clientTcpRtt": 1,
    "colo": "CMH",
    "asn": 16509,
    "asOrganization": "Anthropic, PBC",
    "country": "US",
    "isEUCountry": false,
    "city": "Columbus",
    "continent": "NA",
    "region": "Ohio",
    "regionCode": "OH",
    "timezone": "America/New_York",
    "longitude": "-82.99879",
    "latitude": "39.96118",
    "postalCode": "43215",
    "tlsVersion": "TLSv1.3",
    "tlsCipher": "AEAD-AES256-GCM-SHA384",
    "tlsClientRandom": "RFKQcwQtvgRAcMlruxZxj8Ejyf98bGPnKFjfe53en7M=",
    "tlsClientCiphersSha1": "WUS9+h7TjVkF9aEouGuCEMjGQGA=",
    "tlsClientExtensionsSha1": "yJGn+JJBRh0Ay/ajE1jzOKGdQaA=",
    "tlsClientExtensionsSha1Le": "HqOM/jhWIRxAGWuTbYQvU8ZbFGU=",
    "tlsExportedAuthenticator": {
      "clientHandshake": "86fb4f3e6bd4e595c7afce2e2c77971abd591f0132eb749ef3dc9a2831109470f0c14cbf387abe25ac5dc1b58d116d65",
      "serverHandshake": "ce0e06149aa5c72e8b498126cf6851a31424b1d740e8110bf0726a94c8f7bc000411a71e059a7e8cb722f0373e652729",
      "clientFinished": "1d199a71d4f36f765c5390cf18bd92c6f717751d61e1b4bf9f08d7df9d9aec76238521915029296d5fb0367e5943a0ff",
      "serverFinished": "21e2e9b9e9ae70c3c12225c957c20a85cab50d9cca8f4d54dae12f0c9846977eb2566f08f75b90442e34e21e82438bda"
    },
    "tlsClientHelloLength": "253",
    "tlsClientAuth": {
      "certPresented": "0",
      "certVerified": "NONE",
      "certRevoked": "0",
      "certIssuerDN": "",
      "certSubjectDN": "",
      "certIssuerDNRFC2253": "",
      "certSubjectDNRFC2253": "",
      "certIssuerDNLegacy": "",
      "certSubjectDNLegacy": "",
      "certSerial": "",
      "certIssuerSerial": "",
      "certSKI": "",
      "certIssuerSKI": "",
      "certFingerprintSHA1": "",
      "certFingerprintSHA256": "",
      "certNotBefore": "",
      "certNotAfter": ""
    },
    "verifiedBotCategory": "",
    "pagesHostName": "va-site.pages.dev",
    "botManagement": {
      "corporateProxy": false,
      "verifiedBot": false,
      "jsDetection": {
        "passed": false
      },
      "staticResource": false,
      "detectionIds": {},
      "score": 99
    }
  }
}

useConfig

{
  "api": {
    "careNavPromoCategories": false,
    "careSaytApi": "https://carenav-sayt.azurewebsites.net/CareSAYT",
    "careSenseFacetsEnabled": false,
    "fastPagesProdOrigin": "https://www.getcare.veterancarefinder.org",
    "omniCareNavSearchPath": "/api/carenav/category-results",
    "omniCategoryPath": "/api/carenav/care-category-listing",
    "omni500timeout": 10000,
    "omniLocationCategoryPath": "/api/carenav/locations-categories",
    "omniDataPath": "/api/OmniData",
    "omniOrigin": "https://devvaomni.azurewebsites.net/",
    "omniSearchFacetPath": "/api/OmniSearchFacets",
    "omniSearchPath": "/api/OmniSearch",
    "omniSitemapPath": "/api/OmniSitemap",
    "omniVersion": "2.17.0",
    "omniVersionMajor": 2,
    "omniVersionMinor": 17,
    "omniVersionPatch": 0
  },
  "brand": "va",
  "booking": {
    "opts": {
      "displayMoreLocationsBooking": true,
      "hideCallMsg": false,
      "pagination": true,
      "persistUserSession": true,
      "removeEmptyVisitTypes": false,
      "useLocalTime": false
    },
    "locationVersion": "v2",
    "clinicianVersion": "v3",
    "clinicianApiV3": "https://api.demo-uat.dex.care",
    "clinicianScheduling": "https://scheduling.demo-uat.dex.care/provider",
    "clinicianApi": "https://api.demo-uat.dex.care/v1/providers/",
    "clinicianApiV5": "/api/provider/timeslot/",
    "proxyV5origin": "https://api.demo-uat.dex.care",
    "slotSearchV5": "/v5/slots/search",
    "careOptionOrigin": "https://api.demo-uat.dex.care/v1/availability/slots",
    "departmentOrigin": "https://api.demo-uat.dex.care/v1/departments/",
    "locationTimeslotOrigin": "/api/location/timeslot/",
    "retailScheduling": "https://scheduling.demo-uat.dex.care/retail",
    "virtualScheduling": "https://scheduling.demo-uat.dex.care/virtual"
  },
  "carecoreVersion": "v5.1.0",
  "configOverrideParam": true,
  "cssTheme": {
    "--brand-color-primary-light": "89, 95, 226",
    "--brand-color-primary": "23, 46, 81",
    "--brand-color-primary-dark": "33, 33, 33",
    "--brand-color-secondary-light": "89, 95, 226",
    "--brand-color-secondary": "49, 91, 157",
    "--brand-color-secondary-dark": "89, 95, 226",
    "--brand-color-tertiary-light": "228, 237, 244",
    "--brand-color-tertiary": "49, 91, 157",
    "--brand-color-tertiary-dark": "228, 237, 244",
    "--brand-color-quaternary-light": "100, 170, 250",
    "--brand-color-quaternary": "100, 170, 250",
    "--brand-color-quaternary-dark": "100, 170, 250",
    "--brand-color-neutral-0": "0, 0, 0",
    "--brand-color-neutral-10": "33, 33, 33",
    "--brand-color-neutral-20": "33, 33, 33",
    "--brand-color-neutral-30": "51, 51, 51",
    "--brand-color-neutral-40": "51, 51, 51",
    "--brand-color-neutral-50": "85, 85, 85",
    "--brand-color-neutral-60": "85, 85, 85",
    "--brand-color-neutral-70": "153, 153, 153",
    "--brand-color-neutral-80": "153, 153, 153",
    "--brand-color-neutral-90": "245, 245, 245",
    "--brand-color-neutral-95": "255, 255, 255",
    "--brand-color-neutral-99": "255, 255, 255",
    "--brand-color-neutral-100": "255, 255, 255",
    "--brand-color-link": "0, 107, 166",
    "--brand-color-success": "97, 124, 54",
    "--brand-color-warning": "195, 52, 52",
    "--brand-color-rating-stars": "0, 68, 124",
    "--brand-color-header": "54, 54, 54",
    "--brand-button-border-radius": "8px",
    "--brand-button-border-width": "1px",
    "--brand-input-border-radius": "8px",
    "--brand-input-open-border-radius": "8px",
    "--brand-input-border-width": "1px",
    "--brand-select-border-radius": "8px",
    "--brand-select-border-width": "1px",
    "--brand-checkbox-border-radius": "2px",
    "--brand-checkbox-border-width": "1px",
    "--brand-panel-border-radius": "8px",
    "--brand-img-border-radius": "0.75rem",
    "--brand-font-family-body": "\"Source Sans Pro\",sans-serif",
    "--brand-font-family-body2": "\"Source Sans Pro\",sans-serif",
    "--brand-font-family-display": "\"Source Sans Pro\",sans-serif"
  },
  "displayDistance": false,
  "displayMiddleNames": true,
  "dexPrefsMaxAge": "2592000",
  "env": "prod",
  "head": {
    "links": [
      {
        "rel": "preload",
        "href": "/fonts/source-sans-pro-latin-400-normal.woff2",
        "as": "font",
        "type": "font/woff2",
        "crossorigin": ""
      },
      {
        "rel": "preload",
        "href": "/fonts/source-sans-pro-latin-600-normal.woff2",
        "as": "font",
        "type": "font/woff2",
        "crossorigin": ""
      },
      {
        "rel": "preload",
        "href": "/fonts/source-sans-pro-latin-700-normal.woff2",
        "as": "font",
        "type": "font/woff2",
        "crossorigin": ""
      },
      {
        "rel": "preload",
        "href": "/fonts/Bitter-VariableFont_wght.ttf",
        "as": "font",
        "type": "font/ttf",
        "crossorigin": ""
      }
    ],
    "meta": [
      {
        "name": "robots",
        "content": "noindex, nofollow"
      }
    ],
    "styles": [
      {
        "style": "
          @font-face {
            font-family: 'Source Sans Pro';
            src: url('/fonts/source-sans-pro-latin-400-normal.woff2') format('woff2');
            font-weight: 400;
            font-display: swap;
            font-style: normal;
          }
          @font-face {
            font-family: 'Source Sans Pro';
            src: url('/fonts/source-sans-pro-latin-600-normal.woff2') format('woff2');
            font-weight: 600;
            font-display: swap;
            font-style: normal;
          }
          @font-face {
            font-family: 'Source Sans Pro';
            src: url('/fonts/source-sans-pro-latin-700-normal.woff2') format('woff2');
            font-weight: 700;
            font-display: swap;
            font-style: normal;
          }
          @font-face {
            font-family: 'Bitter';
            src: url('/fonts/Bitter-VariableFont_wght.ttf') format('truetype');
            font-display: swap;
            font-style: normal;
          }
        "
      }
    ]
  },
  "images": {
    "department": {
      "transformations": "width=480,fit=cover",
      "height": "160",
      "sources": [
        {
          "media": "(min-width: 1024px)",
          "transformations": "width=1024,fit=cover"
        },
        {
          "media": "(min-width: 768px)",
          "transformations": "width=768,fit=cover"
        }
      ],
      "styles": "departmentHeroImg aspect-video block h-36 w-full object-cover overflow-hidden rounded-brand-img min-[400px]:h-60 lg:w-[828px]",
      "width": "auto"
    },
    "clinician": {
      "transformations": "width=300,fit=cover",
      "height": "200",
      "placeholder": "https://womphealthwp.ampify.care/7910/Placeholder.png",
      "styles": "clinicianHeroImg aspect-square w-[200px] max-w-none overflow-hidden rounded-brand-img border border-solid",
      "width": "200"
    },
    "useImageOptimizer": true
  },
  "map": {
    "defaultLatLng": {
      "lat": 47.5741,
      "lng": -122.3975
    },
    "defaultLocation": "Portland, OR",
    "defaultMarker": {
      "markerType": "svg",
      "elementString": "
      <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"52\" viewBox=\"0 0 50 70\" fill=\"#c84b26\">
        <path d='M23.0164 65.9543L23.1657 66.1684H23.1916C24.6865 68.0042 27.5944 67.9503 28.9836 65.9543C32.3385 61.1395 35.2121 57.0864 37.6687 53.6214C42.127 47.3332 45.2122 42.9818 47.309 39.5289C48.9416 36.8407 49.9943 34.6678 50.6355 32.5227C51.2779 30.3736 51.5 28.277 51.5 25.7506C51.5 11.7942 40.0847 0.5 26 0.5C11.9153 0.5 0.5 11.7942 0.5 25.7506C0.5 28.277 0.72208 30.3736 1.36449 32.5227C2.00572 34.6678 3.05844 36.8407 4.69097 39.5289C6.78784 42.9817 9.87301 47.3332 14.3312 53.6213C16.7879 57.0864 19.6615 61.1395 23.0164 65.9543ZM35.9133 25.7506C35.9133 31.1591 31.4753 35.5601 26 35.5601C20.5247 35.5601 16.0867 31.1591 16.0867 25.7506C16.0867 20.3421 20.5247 15.9412 26 15.9412C31.4753 15.9412 35.9133 20.3421 35.9133 25.7506Z' /> 
      </svg>",
      "fillColor": "#32539e",
      "strokeColor": "#ffffff"
    },
    "geoStorageName": "location"
  },
  "reviews": {
    "useAlternateReviewsApi": false
  },
  "routes": {
    "all": {
      "headers": {
        "Referrer-Policy": "strict-origin-when-cross-origin",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "SAMEORIGIN"
      },
      "scripts": [
        {
          "element": {
            "cmp": "script",
            "attr": {
              "async": true,
              "src": "https://static.cloudflareinsights.com/beacon.min.js",
              "data-cf-beacon": "{\"token\":\"922af61282d747d8b26c7f71fc0c4675\"}"
            }
          },
          "insertTiming": "bodyEnd",
          "key": "cloudflareCWVScript"
        },
        {
          "element": {
            "cmp": "script",
            "attr": {
              "type": "application/json",
              "id": "dcAnalyticsConfig"
            },
            "children": [
              "{
                \"adobe\": {
                  \"organizationId\": \"82961DB664F112A10A495E58@AdobeOrg\",
                  \"datastreamId\": \"aeabc636-4562-4c75-8fc0-78ed65038907\"
                },
                \"google\": {
                  \"dataLayerName\": \"gtmDataLayer\",
                  \"gtagConfigs\": [
                    { \"gtagId\": \"G-BM0E9BRD1S\", \"groups\": \"default\", \"send_page_view\": false }
                  ]
                },
                \"isDebugEnabled\": false,
                \"appType\": \"bfcache\"
              }"
            ]
          },
          "insertTiming": "bodyEnd",
          "key": "dcAnalyticsConfig"
        },
        {
          "element": {
            "cmp": "script",
            "attr": {
              "async": true,
              "src": "https://phiprotect.dexcare.com/(d3d3Lmdvb2dsZXRhZ21hbmFnZXIuY29t)/(Z3RhZw==)/(anM=)?id=G-BM0E9BRD1S&l=gtmDataLayer"
            }
          },
          "insertTiming": "bodyEnd",
          "key": "gtm"
        },
        {
          "element": {
            "cmp": "script",
            "attr": {
              "async": true,
              "src": "/api/proxy/https://dex-analytics.dex.care/analytics.js"
            }
          },
          "insertTiming": "bodyEnd",
          "key": "dexcareAnalyticsScript"
        }
      ]
    },
    "docs": {
      "headers": {
        "Cache-Control": null
      },
      "urlMatch": {
        "include": "^/(docs)?/?$"
      },
      "redirectAction": {
        "action": "redirect",
        "path": "/docs"
      }
    },
    "docsNoStore": {
      "headers": {
        "Cache-Control": null
      }
    },
    "fragmentSAYT": {
      "headers": {
        "Cache-Control": null,
        "Cdn-Cache-Control": "max-age=604800, stale-if-error=86400"
      }
    },
    "home": {
      "headers": {
        "Cache-Control": null,
        "Cdn-Cache-Control": "max-age=43200, stale-if-error=86400"
      },
      "urlMatch": {
        "include": "^(/docs/theme-\\d/)?/care-nav/?$"
      },
      "redirectAction": {
        "action": "redirect",
        "path": "/care-nav"
      }
    },
    "location": {
      "headers": {
        "Cache-Control": null,
        "Cdn-Cache-Control": "max-age=604800, stale-if-error=86400"
      },
      "urlMatch": {
        "include": "^/(docs/theme-\\d/)?locations/[^/]+/[^/]+/[0-9]+/?$|^/(docs/theme-\\d/)?locations/[0-9]+/?$|^/(docs/theme-\\d/)?locations/[^/]+/[^/]+/?$"
      },
      "redirectAction": {
        "action": "omniSearch",
        "searchKey": "url",
        "params": {
          "locations": "true",
          "providers": "false"
        }
      }
    },
    "clinician": {
      "headers": {
        "Cache-Control": null,
        "Cdn-Cache-Control": "max-age=604800, stale-if-error=86400"
      },
      "urlMatch": {
        "include": "^/(docs/theme-\\d/)?provider/[^/]+/[0-9]+/?$"
      },
      "search404Reg": "/provider/([^/]+)/[0-9]+/?$",
      "redirectAction": {
        "action": "omniSearch",
        "searchKey": "profileUrls",
        "params": {
          "locations": "false",
          "providers": "true"
        }
      },
      "useSimilarClinicians": true
    },
    "searchCareCategory": {
      "headers": {
        "Cache-Control": null
      }
    },
    "searchLocation": {
      "headers": {
        "Cache-Control": null
      },
      "urlMatch": {
        "include": "^/(docs/theme-\\d/)?locations/?$"
      },
      "redirectAction": {
        "action": "redirect",
        "path": "/locations"
      }
    },
    "searchClinician": {
      "headers": {
        "Cache-Control": null
      },
      "urlMatch": {
        "include": "^/(docs/theme-\\d/)?providers/?$"
      },
      "redirectAction": {
        "action": "redirect",
        "path": "/providers"
      }
    },
    "virtual": {
      "headers": {
        "Cache-Control": null,
        "Cdn-Cache-Control": "max-age=604800, stale-if-error=86400"
      }
    },
    "notFound": {
      "urlMatch": {
        "include": ".+",
        "exclude": "/docs"
      },
      "error": {
        "type": 404,
        "errorPageUrl": "/errors/404"
      }
    },
    "notFoundSearch": {
      "urlMatch": {
        "include": "/docs/.+"
      },
      "error": {
        "type": 404,
        "errorPageUrl": "/docs/errors/search/404"
      }
    }
  },
  "searchFacets": {
    "acceptingNewPatientDisplay": true,
    "bookableOnline": false,
    "videoVisit": true
  },
  "security": {
    "csp": [
      "default-src 'self' 'unsafe-inline' https://static.cloudflareinsights.com",
      "connect-src 'self' https://*.azurewebsites.net https://cloudflareinsights.com https://edge.adobedc.net https://adobedc.demdex.net https://*.googleapis.com *.google.com https://*.gstatic.com https://ratings.md https://api.clockwisemd.com https://*.dex.care https://phiprotect.dexcare.com data: blob:",
      "font-src 'self' https://fonts.gstatic.com",
      "img-src 'self' https://*.googleapis.com https://blob.womp.it https://*.gstatic.com https://i.ytimg.com *.google.com *.googleusercontent.com https://phiprotect.dexcare.com https://www.va.gov data:",
      "script-src 'self' 'unsafe-inline' https: 'nonce-{nonce}' 'strict-dynamic'",
      "style-src 'self' https://fonts.googleapis.com 'unsafe-inline'",
      "frame-src 'self' 'nonce-{nonce}' https://www.youtube.com",
      "object-src 'none'",
      "base-uri 'self'",
      "frame-ancestors 'self'",
      "upgrade-insecure-requests"
    ]
  },
  "usePartyTown": false
}