Fluent Commerce Logo
Docs

Frameworks

User Interface Framework (WebApps, Manifest Configuration, Fragments, Components, and their Elements.), Orchestration Framework (Workflow, Actions, Rules, Entities, Contracts, Settings, Triggers, Status, and Variables), Developer Tooling (Modules, Templates, Connectors, and SDKs.)

Fetching Data with the useQuery Hook

Essential knowledge
This lesson focuses on fetching data within a custom form field using the `useQuery` hook. We'll move away from relying on page query data and instead directly query the Fluent GraphQL API to retrieve a list of nearby locations with product stock. This involves defining data structures for query results, storing the query in a constant, and using the `useQuery` hook to execute the query with dynamic parameters derived from the form's context and the user's context (via `useAuth`). We will then render the results in a selectable list using radio buttons.
  • Data Independence: Components should fetch their own data using the `useQuery` hook, rather than relying on potentially unavailable page query data.
  • GraphQL Query: A GraphQL query (`searchVirtualInventory`) is used to retrieve nearby locations with stock.
  • Data Structures: Interfaces (SVINode, SVIResult) are defined to structure the query results.
  • `useQuery` Hook: The `useQuery` hook is used to execute the GraphQL query with dynamic parameters.
  • Dynamic Parameters: Query parameters (`productRef`, `locationRef`, `lat`, `lng`) are derived from the form's entity context (product) and the user's context (location) using the `useAuth` hook.
  • Loading State: A loading state is implemented while the query progresses.
  • Result Rendering: The query results are initially logged to the console and then rendered as a list of selectable locations using radio buttons.
  • User Selection: A state variable and event handler are used to track the user's selected location.

Webhooks Frequently Asked Questions

Essential knowledge
Fluent Commerce doesn't support static IP whitelisting due to AWS Cloud's dynamic nature. Instead, robust authentication measures are in place for webhook security, including cryptographic signing and signature verification. While static IPs aren't recommended, securing webhook endpoints is achievable by configuring unique URLs and firewall rules. Additionally, setting up custom authorizers or message queue validation enhances security. Each webhook establishes a single connection, with inbound and outbound calls dependent on workflow events. For detailed guidance, refer to Fluent's 'Webhook overview' documentation.
  • Static IP Whitelisting: Fluent Commerce's AWS Cloud setup doesn't allow for static IP whitelisting due to the potential for IP address changes caused by scaling or architectural adjustments, as well as AWS's own IP address alterations.
  • Authentication Measures: Instead of relying on IP Access Control Lists, Fluent Commerce employs strong authentication measures for webhook requests, including cryptographic signing with a private key and verification using a public key to ensure the request's legitimacy and integrity.
  • IP-Based Restrictions: Implementing IP-based restrictions, such as whitelisting or IP ranges, is not recommended due to the dynamic nature of IP addresses in the AWS Cloud setup, which can lead to high exposure levels and difficulty in implementation.
  • Alternative Approaches for Access Control: Instead of IP-based restrictions, companies can utilize firewall/networking equipment or reverse proxies to restrict access based on incoming HTTP request details, or configure unique, specific static URLs for incoming traffic to filter and accept connections securely.