### Run Function Example Source: https://docs.wized.com/llms Example JavaScript for executing a custom function, such as initializing an external library. ```javascript return initializeMyLibrary(); ``` -------------------------------- ### Example: Interact with Firebase Firestore Source: https://docs.wized.com/javascript-api Shows how to get a Firebase client, access its modules (like firestore), and use them to perform operations such as fetching a document. This example highlights dynamic module imports and version checking for compatibility. ```javascript window.Wized = window.Wized || []; window.Wized.push(async (Wized) => { const { version, firestore, modules } = await Wized.requests.getClient('my_firebase_app'); // Check for the client version if (version !== '10') return; // Retrieve the Firestore module const { doc, getDoc } = await modules.firestore; // Use the Firestore methods const docRef = doc(firestore, 'todos', '1234'); const docSnap = await getDoc(docRef); const todo = docSnap.data(); console.log('Todo:', todo); }); ``` -------------------------------- ### Sign up with email and password (Supabase Example) Source: https://docs.wized.com/requests/firebase/sign-up-email-password Details the process of signing up a user with email and password, using Supabase as an example, including steps and visual aids. ```APIDOC Supabase Sign Up (Email + Password): - Method: Sign up(email + password) - Purpose: Adds a new user to your application using email and password. - Steps: 1. Open the request panel and click '+'. 2. Name the request, select the Supabase app, and choose 'Sign up(email + password)' as the method. 3. Under the 'Email' menu, fill in the email (or use an input/form field). 4. Fill in the password. - Dependencies: Supabase project setup. - Inputs: - email: User's email address (string). - password: User's password (string). - Outputs: (Details not provided in source text) - Related: Firebase sign-up methods, Supabase sign-in methods. ``` -------------------------------- ### Wized JavaScript API Example Source: https://docs.wized.com/requests/supabase/get-item Illustrative example of using the Wized JavaScript API for integrating with various services. ```javascript // Example: Fetching data using Wized API // This is a conceptual example, actual API calls may vary. Wized.api.fetchData({ service: 'supabase', endpoint: 'users', params: { select: 'id,name,email', limit: 10 } }).then(response => { console.log('Fetched users:', response); }).catch(error => { console.error('Error fetching users:', error); }); Wized.api.callFunction('myCustomFunction', { payload: { userId: 'user123' } }).then(response => { console.log('Function result:', response); }).catch(error => { console.error('Error calling function:', error); }); ``` -------------------------------- ### API Example URL Source: https://docs.wized.com/llms An example of an API endpoint with query parameters for filtering and sorting. ```plaintext https://api.example.com/products?category=electronics&order=price_ascending ``` -------------------------------- ### Airtable Request Setup and Usage Source: https://docs.wized.com/llms Guides users on integrating with Airtable using Wized, covering app creation, authentication, and request configuration for data operations. ```APIDOC Airtable Requests What is an Airtable Request? - A method to integrate your Application with Airtable for data operations (retrieve, create, update, delete). - Supports public data fetching or authenticated access via Wized. How to Create Airtable App: 1. Go to 'My Apps' panel in Wized. 2. Click '+' button and add a name (e.g., 'Airtable App'). 3. Select 'Airtable' option. 4. Connect Airtable using OAuth and select bases. 5. Click 'Add base' and select Airtable Base. 6. Click 'Grant access' and wait for authorization. Configure your request: - Create a new request (e.g., 'get_blog_posts'). - Add to a folder (optional). - Select your Airtable App from the dropdown. ``` -------------------------------- ### Create Native Request in Wized Source: https://docs.wized.com/requests/creating-requests Guides users through creating requests for Wized's native integrations. This involves selecting an app, choosing a method from a predefined list (e.g., Get List Items, Login), and configuring method-specific inputs like email and password for authentication. ```Wized Steps: 1. Navigate to Requests. 2. Click '+' to create a new request. 3. Name the request and select the 'app'. 4. Configure request using dropdowns for methods like: - Get List Items - Get Item - Login - Create Item - Sign In - Update Profile - Get User 5. Provide necessary inputs (e.g., email, password for Login). Note: Wized facilitates API calls, not authentication itself. ``` -------------------------------- ### Navigate To URL Source: https://docs.wized.com/llms Example JavaScript returning a URL path for navigation after a successful user registration. ```javascript return '/login'; ``` -------------------------------- ### Working with npm Packages Source: https://docs.wized.com/requests/firebase/sign-up-email-password Guides on how to use npm packages within the Wized project context. ```APIDOC NPM Packages: - Usage: /using-npm-packages/ - Description: Instructions and best practices for integrating and using npm packages in Wized projects. ``` -------------------------------- ### Supabase Database API Source: https://docs.wized.com/data-store/inputs Documentation for Supabase database operations, including creating items, updating items, getting lists, getting individual items, deleting items, and unsubscribing from real-time updates. ```APIDOC Supabase Database Operations: - Create item: /requests/supabase/create-item/ - Description: Creates a new item in the Supabase database. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Update item: /requests/supabase/update-item/ - Description: Updates an existing item in the Supabase database. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Get list: /requests/supabase/get-list/ - Description: Retrieves a list of items from the Supabase database. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Get item: /requests/supabase/get-item/ - Description: Retrieves a single item from the Supabase database. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Delete item: /requests/supabase/delete-item/ - Description: Deletes an item from the Supabase database. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Unsubscribe real-time: /requests/supabase/unsubscribe-real-time/ - Description: Stops listening for real-time updates from the Supabase database. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) ``` -------------------------------- ### JavaScript Division and Arithmetic Operators Example Source: https://docs.wized.com/llms Provides examples of subtraction, multiplication, and division operators in JavaScript. It shows calculations involving variables, API responses, and fixed numbers for stock, interest, and average scores. ```JavaScript // Subtraction: Calculate remaining stock with variable let initialStock = v.initialStock; // stock variable let soldItems = 5; // fixed number of items sold return remainingStock = initialStock - soldItems; // subtract sold items from stock // Multiplication: Calculate interest on product price from API response let productPrice = 200; // fixed product price let interestRate = r.getInterest.data; // interest rate from an API request response return totalWithInterest = productPrice * interestRate; // multiply price by interest rate // Division: Calculate average score from a sum of scores let sumOfScores = v.totalScores; // total scores variable let numberOfTests = 4; // fixed number of tests return averageScore = sumOfScores / numberOfTests; // divide total scores by number of tests ``` -------------------------------- ### Supabase Integration Setup and Usage Source: https://docs.wized.com/requests/supabase Details on setting up and using the Wized Supabase integration, which acts as a wrapper for the Supabase JavaScript client library (@supabase/supabase-js). It covers providing project credentials and interacting with Supabase features. ```APIDOC Supabase Integration: Description: Integrates with your Supabase instance, acting as a wrapper for the @supabase/supabase-js client library. Setup: 1. Add Supabase to 'My Apps' in Wized. 2. Provide Supabase URL: Your unique Project URL. 3. Provide Supabase key: Your API key (anon/public). These details can be found in your Supabase dashboard under Project Settings > API. Functionalities: - Database Operations: Create, Update, Get List, Get Item, Delete Item. - Authentication: Sign Up, Sign In (Email-Password, OAuth), Update User, Get User, Password Reset, Sign Out. - Storage: Upload File, Get File URL, Download File. - Real-time: Subscribe to real-time updates. - Edge Functions: Invoke functions. Dependencies: @supabase/supabase-js ``` -------------------------------- ### Firebase: Get Items List API Source: https://docs.wized.com/llms Retrieves a collection of documents from Cloud Firestore. Supports optional filtering by field, sorting by field, and pagination using 'Start After' or 'Start At' methods. Real-time subscription is also available. ```APIDOC APIDOC: method: Get items list description: Fetches a collection from your Cloud Firestore database. parameters: - name: Firebase App type: string description: The Firebase app to be used for the request. - name: Path type: string description: The full path to the collection in your Cloud Firestore database. - name: Limit items type: integer optional: true description: Limits the number of items returned. - name: Subscribe realtime type: boolean optional: true default: false description: Enables real-time updates for the data. - name: Filter by Field Path type: string optional: true description: The field path to filter the collection by. - name: Filter by Criteria type: any optional: true description: The criteria to filter the collection by (e.g., value, comparison operator). - name: Sort by Field Path type: string optional: true description: The field path to sort the collection by. - name: Sort Direction type: string optional: true enum: [ascending, descending] description: The direction to sort the collection. - name: Pagination - Start After type: any optional: true description: Specifies the value to start pagination after. - name: Pagination - Start At type: any optional: true description: Specifies the value to start pagination at. - name: Pagination - Multiple Fields type: array optional: true description: Defines the starting point for pagination across multiple fields. usage: 1. Open the request panel. 2. Click '+' to add a new request. 3. Provide a name and select the Firebase app. 4. Choose 'Get items list' as the method. 5. Fill in the collection path. 6. Optionally, configure limit, filtering, sorting, and pagination. ``` -------------------------------- ### Airtable Get List Filtering Source: https://docs.wized.com/changelog Improvements to Airtable 'Get List' requests, specifically regarding filtering by reference fields. This update enhances the ability to accurately filter records based on relational data. Detailed examples are available in the official documentation. ```APIDOC AirtableGetListRequest: // ... other parameters filterByReferenceField: { fieldName: string, referenceValue: string } // Description: Filters records based on a reference field and its value. // Example: To filter by a 'relatedRecord' field where the ID is 'rec123': // filterByReferenceField: { fieldName: 'relatedRecord', referenceValue: 'rec123' } ``` -------------------------------- ### Airtable Get List Filtering Source: https://docs.wized.com/changelog/index Improvements to Airtable 'Get List' requests, specifically regarding filtering by reference fields. This update enhances the ability to accurately filter records based on relational data. Detailed examples are available in the official documentation. ```APIDOC AirtableGetListRequest: // ... other parameters filterByReferenceField: { fieldName: string, referenceValue: string } // Description: Filters records based on a reference field and its value. // Example: To filter by a 'relatedRecord' field where the ID is 'rec123': // filterByReferenceField: { fieldName: 'relatedRecord', referenceValue: 'rec123' } ``` -------------------------------- ### Supabase Authentication - Sign Up Source: https://docs.wized.com/elements/configuration-types/single-use Documentation for signing up a new user in Supabase using email and password. ```APIDOC Supabase Auth - Sign Up: signUp(email: string, password: string): Promise Registers a new user with email and password. Parameters: email: The user's email address. password: The user's password. Returns: A promise that resolves with the user's authentication data. ``` -------------------------------- ### Example: Get a Wized Element Source: https://docs.wized.com/javascript-api Illustrates how to retrieve a specific WizedElement by its name using Wized.elements.get. This is typically done within a Wized.push callback to ensure the Wized object is available. ```javascript window.Wized = window.Wized || []; window.Wized.push((Wized) => { const element = Wized.elements.get('element_name'); // You can now interact with the 'element' object }); ``` -------------------------------- ### Supabase Integration Setup Source: https://docs.wized.com/llms Instructions on how to set up the Supabase integration within Wized, requiring the Supabase URL and API key (anon public). ```APIDOC Setup Supabase Integration: 1. Add Supabase to 'My Apps' in Wized. 2. Provide the following information: - Supabase URL: Your unique Project URL. - Supabase key: Your API key (anon public). These details can be found in your Supabase dashboard under Project Settings > API. ``` -------------------------------- ### Modulus (%) Operator in JavaScript Source: https://docs.wized.com/formulas/operators Returns the remainder of a division. It's useful for tasks like checking for even/odd numbers or implementing cyclic patterns. This example shows how to get the remainder. ```javascript /* Keep in mind that this example has fixed values, however, you can replace any value with a value from a cookie, variable, form, input, etc. */ return (remainder = 10 % 3); // 1 (10 \u00f7 3 = 3 with remainder 1) ``` -------------------------------- ### Wized Element Event Setup Source: https://docs.wized.com/elements/events Describes the process of setting up event listeners for website elements within the Wized platform. This involves selecting an element, navigating to the events section, and choosing a specific JavaScript event from a dropdown menu. ```APIDOC Wized Element Event Setup: 1. Select Element: Click on the target element in the Wized elements panel. 2. Go to Events Section: In the right panel, click the lightning icon. 3. Choose Event: Use the dropdown to select a standard JavaScript event (e.g., 'click', 'submit', 'change', 'input', 'focus', 'blur', 'keydown'). Note: Element events must be linked to an element with a Wized attribute. For events not tied to specific elements, use Global Events. ``` -------------------------------- ### Example: Get All Wized Elements Source: https://docs.wized.com/javascript-api Demonstrates fetching all WizedElements and also how to fetch elements filtered by a specific name using Wized.elements.getAll. This is useful for batch operations or targeting elements by a common identifier. ```javascript window.Wized = window.Wized || []; window.Wized.push((Wized) => { const allElements = Wized.elements.getAll(); // Returns all elements const elementsWithName = Wized.elements.getAll('element_name'); // Returns elements with the name "element_name" console.log('All elements:', allElements); console.log('Elements with name:', elementsWithName); }); ``` -------------------------------- ### Firebase Get List Request Settings Source: https://docs.wized.com/changelog Enhancements for fetching data lists from Firebase. New settings allow fetching data starting at or after a specified document, improving control over data retrieval. Consult the documentation for specific implementation details. ```APIDOC FirebaseGetListRequest: // ... other parameters startAfter: string | null // Description: Fetches data starting after the specified document ID. startAt: string | null // Description: Fetches data starting at the specified document ID. ``` -------------------------------- ### Firebase Get List Request Settings Source: https://docs.wized.com/changelog/index Enhancements for fetching data lists from Firebase. New settings allow fetching data starting at or after a specified document, improving control over data retrieval. Consult the documentation for specific implementation details. ```APIDOC FirebaseGetListRequest: // ... other parameters startAfter: string | null // Description: Fetches data starting after the specified document ID. startAt: string | null // Description: Fetches data starting at the specified document ID. ``` -------------------------------- ### Example: Interact with Supabase Client Source: https://docs.wized.com/javascript-api Demonstrates how to retrieve a Supabase client using Wized.requests.getClient and interact with it, specifically fetching the authenticated user. It includes a crucial check for the client version before calling methods. ```javascript window.Wized = window.Wized || []; window.Wized.push(async (Wized) => { const { version, client } = await Wized.requests.getClient('my_supabase_app'); // It's important to check the client version before using it if (version.startsWith('2')) { const user = await client.auth.getUser(); console.log('Supabase User:', user); } }); ``` -------------------------------- ### Supabase API Requests Source: https://docs.wized.com/start-here/getting-started Documentation for Supabase API requests, covering authentication, database, storage, and edge functions. This includes user management, data operations, file handling, and function invocation. ```APIDOC Supabase API: Authentication: - Sign up user: POST /requests/supabase/sign-up/ - Sign in user (Email-password): POST /requests/supabase/sign-in-password/ - Sign in user (Provider): POST /requests/supabase/sign-in-oauth/ - Sign in user (Magic link): POST /requests/supabase/sign-in-magic-link/ - Update user: POST /requests/supabase/update-user/ - Get user: GET /requests/supabase/get-user/ - Send password reset: POST /requests/supabase/send-password-reset/ - Sign out: POST /requests/supabase/sign-out/ Database: - Create item: POST /requests/supabase/create-item/ - Update item: POST /requests/supabase/update-item/ - Get list: GET /requests/supabase/get-list/ - Get item: GET /requests/supabase/get-item/ - Delete item: DELETE /requests/supabase/delete-item/ - Unsubscribe real-time: POST /requests/supabase/unsubscribe-real-time/ Storage: - Upload file: POST /requests/supabase/upload-file/ - Get file url: GET /requests/supabase/get-file-url/ - Download file: GET /requests/supabase/download-file/ Edge Functions: - Invoke function: POST /requests/supabase/invoke-function/ ``` -------------------------------- ### Supabase Sign Up User (Email/Password) Source: https://docs.wized.com/requests/supabase/sign-up This section details the process of signing up a new user in Supabase using email and password. It outlines the request parameters, including email, password, optional redirect URL, and user metadata. ```APIDOC Supabase Sign Up User (Email/Password): Endpoint: POST /auth/v1/signup (Hypothetical, based on common patterns) Description: Adds a new user to the Supabase project using email and password authentication. Parameters: - email (string, required): The user's email address. - password (string, required): The user's password. - redirect_to (string, optional): The URL to redirect the user to after email confirmation. This is used for email verification flows. - user_metadata (object, optional): Custom data to associate with the user profile, such as name or preferences. Example Request Body: { "email": "user@example.com", "password": "securepassword123", "redirect_to": "https://your-app.com/welcome", "user_metadata": { "name": "John Doe" } } Returns: - User object upon successful signup. - Error object if signup fails (e.g., email already exists, invalid password). Related Methods: - Supabase Sign In User (Email/Password) - Supabase Sign Up User (Phone) - Supabase Send Password Reset ``` -------------------------------- ### Wized Script Integration with Webflow Source: https://docs.wized.com/start-here/getting-started Instructions on how to integrate the Wized script into your Webflow project. This involves copying the provided script and pasting it into the `` section of your Webflow site's custom code settings. ```javascript // Paste the Wized script provided by Wized into the section of your Webflow project. // Example: // Ensure the script is correctly placed in Webflow's Custom Code settings under the tag. ``` -------------------------------- ### Supabase Authentication: Sign Up User Source: https://docs.wized.com/requests/supabase/create-item This method handles the creation of new user accounts in Supabase Auth, typically using email and password. It requires the user's email and password. This is the initial step for user registration. ```APIDOC Supabase Auth: Sign Up User Description: Creates a new user account in Supabase Auth. Example (Conceptual): Method: POST Endpoint: /auth/v1/signup Body: { "email": "user@example.com", "password": "securepassword" } Parameters: - email: The user's email address. - password: The user's chosen password. Returns: User information or authentication token upon successful sign-up. ``` -------------------------------- ### Switch Statement Example Source: https://docs.wized.com/formulas/conditionals Compares a value against multiple cases. Use for readability with many fixed conditions. This example assigns an activity based on the day of the week. ```javascript /* Keep in mind that this example has fixed values, however, you can replace any value with a value from a cookie, variable, form, input, etc. */ const day = 'Monday'; let activity = ''; switch (day) { case 'Monday': activity = 'Play guitar'; break; case 'Friday': activity = 'Play soccer'; break; default: activity = 'Play tennis'; } return activity; // return: "Play guitar" ``` -------------------------------- ### Create and Return a JavaScript Array Source: https://docs.wized.com/llms Shows the creation of a JavaScript array named `myShoppingList` containing several string elements. The example then returns this array, which is a common way to store ordered lists of data. ```JavaScript return (myShoppingList = ['apples', 'milk', 'eggs', 'bread']); ``` -------------------------------- ### Else If Ladder Example Source: https://docs.wized.com/formulas/conditionals Tests multiple conditions sequentially after an initial `if`. Stops at the first truthy condition. This example demonstrates assigning a grade based on a score. ```javascript /* Keep in mind that this example has fixed values, however, you can replace any value with a value from a cookie, variable, form, input, etc. */ const score = 85; let grade = ''; if (score >= 90) { grade = 'A'; } else if (score >= 80) { grade = 'B'; } else { grade = 'C'; } return grade; // result: "B" ``` -------------------------------- ### Airtable API Requests Source: https://docs.wized.com/data-store/inputs Documentation for Airtable API requests, including operations for creating, updating, getting lists of, getting individual items, and deleting items. ```APIDOC Airtable Database Operations: - Create item: POST /requests/airtable/methods/data/create-item/ - Description: Creates a new item in Airtable. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Update item: /requests/airtable/methods/data/update-item/ - Description: Updates an existing item in Airtable. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Get list items: /requests/airtable/methods/data/get-list-items/ - Description: Retrieves a list of items from Airtable. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Get item: /requests/airtable/methods/data/get-item/ - Description: Retrieves a single item from Airtable. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Delete item: /requests/airtable/methods/data/delete-item/ - Description: Deletes an item from Airtable. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) ``` -------------------------------- ### Wized JavaScript API Source: https://docs.wized.com/start-here/getting-started Reference for the Wized JavaScript API, which allows programmatic interaction with Wized functionalities within web applications. ```APIDOC Wized JavaScript API: - Introduction: /javascript-api/ - Working with npm packages: /using-npm-packages/ ``` -------------------------------- ### Airtable Database Operations Source: https://docs.wized.com/requests/firebase/sign-up-email-password Provides API documentation for common database operations on Airtable, including creating, updating, getting lists, getting single items, and deleting items. ```APIDOC Airtable Database API: - Create item: POST /requests/airtable/methods/data/create-item/ - Description: Creates a new item in an Airtable base. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Update item: PUT/PATCH /requests/airtable/methods/data/update-item/ - Description: Updates an existing item in an Airtable base. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Get list items: GET /requests/airtable/methods/data/get-list-items/ - Description: Retrieves a list of items from an Airtable base. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Get item: GET /requests/airtable/methods/data/get-item/ - Description: Retrieves a single item from an Airtable base by its ID. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) - Delete item: DELETE /requests/airtable/methods/data/delete-item/ - Description: Deletes an item from an Airtable base by its ID. - Parameters: (Details not provided in source text) - Returns: (Details not provided in source text) ``` -------------------------------- ### Software Architecture Source: https://docs.wized.com/requests/firebase/sign-up-email-password Provides documentation on the Wized software architecture, including stack choices and putting pieces together. ```APIDOC Wized Software Architecture: - Introduction: /software-architecture/ - Description: General introduction to the software architecture. - Choosing the stack: /software-architecture/choosing-the-stack - Description: Guidance on selecting the technology stack. - Put all the pieces together: /software-architecture/all-pieces-together - Description: How different components of the architecture integrate. - Workflows: /workflows - Description: Documentation on Wized workflows. ``` -------------------------------- ### Supabase Get List Pagination Source: https://docs.wized.com/changelog Introduces 'Range From' and 'Range To' fields for Supabase 'Get List' requests, enabling efficient pagination of large datasets by fetching results in chunks. ```APIDOC Supabase 'Get List' Request: Pagination Parameters: - Range From: Specifies the starting index for the result set. - Range To: Specifies the ending index for the result set. - Purpose: Allows fetching data in paginated segments, improving performance for large tables. - Reference: https://supabase.com/docs/reference/javascript/range ``` -------------------------------- ### Supabase Get List Pagination Source: https://docs.wized.com/changelog/index Introduces 'Range From' and 'Range To' fields for Supabase 'Get List' requests, enabling efficient pagination of large datasets by fetching results in chunks. ```APIDOC Supabase 'Get List' Request: Pagination Parameters: - Range From: Specifies the starting index for the result set. - Range To: Specifies the ending index for the result set. - Purpose: Allows fetching data in paginated segments, improving performance for large tables. - Reference: https://supabase.com/docs/reference/javascript/range ``` -------------------------------- ### Wized JavaScript Environment Setup and Parameters Source: https://docs.wized.com/llms This snippet defines the context for AI to generate JavaScript code within the Wized Function Editor. It outlines available data access parameters (cookies, variables, inputs, forms, API responses, navigation) and essential coding rules like always returning a value and avoiding direct DOM manipulation or console logs. ```JavaScript You are assisting a Wized user, a low-code platform integrated with Webflow for creating interactive web applications. The user needs guidance writing JavaScript code within the Wized Function Editor to customize website behavior. Keep the following points in mind: - **Data Access:** Wized offers real-time access to data through specific parameters: - `c`: Cookies (e.g., `c.myCookie`) - `v`: Variables (e.g., `v.myVariable`) - `i`: Inputs (e.g., `i.myInputField`) - `f`: Forms (e.g., `f.myForm.name.email`) - `r`: API Responses (e.g., `r.myRequest.data.price`) - `n`: Navigation (e.g., `n.currentPage`) - **Functions:** Functions within the Function Editor must always return a value using the `return` keyword. - **Syntax:** Ensure the code is valid JavaScript and supported by modern web browsers. - **No `console.log`:** Avoid `console.log` statements, as Wized provides a built-in preview for results. - **No direct DOM access:** Do not use `document.getElementById` or similar DOM access methods, as Wized automatically manages element selection. Now, provide the user with Wized-compatible JavaScript code to answer their question. ``` -------------------------------- ### Airtable Database Operations Source: https://docs.wized.com/requests/rest/body Provides links to API endpoints for common database operations on Airtable, including creating, updating, getting lists, getting single items, and deleting items. ```APIDOC APIDOC: - /requests/airtable/methods/data/create-item/ - /requests/airtable/methods/data/update-item/ - /requests/airtable/methods/data/get-list-items/ - /requests/airtable/methods/data/get-item/ - /requests/airtable/methods/data/delete-item/ ``` -------------------------------- ### Wized API Documentation - Supabase Download File Source: https://docs.wized.com/changelog Documentation for the Supabase 'Download File' request, enabling downloads from private storage buckets. ```APIDOC Supabase Download File Request: Description: Allows downloading files from private Supabase storage buckets. Usage: Refer to the official documentation for detailed setup and parameters. Related: Other Supabase requests available within Wized. ``` -------------------------------- ### Airtable Database Operations Source: https://docs.wized.com/elements/events Provides links to API documentation for common Airtable database operations, including creating, updating, getting lists, getting single items, and deleting items. ```APIDOC Airtable Database API: - Create item: /requests/airtable/methods/data/create-item/ - Update item: /requests/airtable/methods/data/update-item/ - Get list items: /requests/airtable/methods/data/get-list-items/ - Get item: /requests/airtable/methods/data/get-item/ - Delete item: /requests/airtable/methods/data/delete-item/ ``` -------------------------------- ### Wized API Documentation - Supabase Download File Source: https://docs.wized.com/changelog/index Documentation for the Supabase 'Download File' request, enabling downloads from private storage buckets. ```APIDOC Supabase Download File Request: Description: Allows downloading files from private Supabase storage buckets. Usage: Refer to the official documentation for detailed setup and parameters. Related: Other Supabase requests available within Wized. ``` -------------------------------- ### JavaScript Combined Logical Operators Example Source: https://docs.wized.com/llms Shows how to combine multiple logical operators (AND and OR) to create complex conditions. This example checks for an admin role and either logged-in status or a valid session. ```JavaScript // Combined example: Check if user is an admin and either logged in or has a valid session let role = r.auth_user.data.role === "admin"; // boolean for admin role let loggedInStatus = r.auth_user.ok; // boolean for login status let validSession = v.session === "valid"; // boolean for valid session status return access = role && (loggedInStatus || validSession); // true if admin and (logged in OR has a valid session) ``` -------------------------------- ### Run Function Initialization Source: https://docs.wized.com/global-events/actions-available This JavaScript snippet is used to execute a custom function, such as initializing an external library. Ensure the library is imported into the project. ```javascript // Make sure to have imported the library in your Webflow project return initializeMyLibrary(); ``` -------------------------------- ### Supabase Database - Create Item Source: https://docs.wized.com/elements/configuration-types/single-use Documentation for creating a new record in a Supabase database table. ```APIDOC Supabase DB - Create Item: createItem(tableName: string, data: object): Promise Inserts a new row into a specified table. Parameters: tableName: The name of the table. data: An object containing the data for the new row. Returns: A promise that resolves with the inserted row data. ``` -------------------------------- ### Supabase Database Operations Source: https://docs.wized.com/elements/events Provides links to API documentation for Supabase database operations, including creating, updating, getting lists, getting single items, deleting items, and unsubscribing from real-time updates. ```APIDOC Supabase Database API: - Create item: /requests/supabase/create-item/ - Update item: /requests/supabase/update-item/ - Get list: /requests/supabase/get-list/ - Get item: /requests/supabase/get-item/ - Delete item: /requests/supabase/delete-item/ - Unsubscribe real-time: /requests/supabase/unsubscribe-real-time/ ``` -------------------------------- ### Firebase Database Operations Source: https://docs.wized.com/requests/rest/body Lists API endpoints for Firebase database interactions, including creating, updating, getting lists, getting items, uploading/getting file URLs, deleting items, and unsubscribing from real-time updates. ```APIDOC APIDOC: - /requests/firebase/create-item/ - /requests/firebase/update-item/ - /requests/firebase/get-list/ - /requests/firebase/get-item/ - /requests/firebase/upload-file/ - /requests/firebase/get-file-url/ - /requests/firebase/delete-item/ - /requests/firebase/unsubscribe-real-time/ ``` -------------------------------- ### Supabase Authentication Methods Source: https://docs.wized.com/elements Documentation for Supabase authentication, including user signup, sign-in via email/password, OAuth providers, magic links, profile updates, password reset, and sign-out. ```APIDOC Supabase Authentication: Sign Up User: Endpoint: /requests/supabase/sign-up/ Description: Registers a new user in Supabase. Method: POST (Assumed) Parameters: (Details not provided in source text) Returns: (Details not provided in source text) Sign In User (Email-Password): Endpoint: /requests/supabase/sign-in-password/ Description: Authenticates a user using their email and password. Method: POST (Assumed) Parameters: (Details not provided in source text) Returns: (Details not provided in source text) Sign In User (OAuth Provider): Endpoint: /requests/supabase/sign-in-oauth/ Description: Authenticates a user via an OAuth provider (e.g., Google, GitHub). Method: GET/POST (Assumed) Parameters: (Details not provided in source text) Returns: (Details not provided in source text) Sign In User (Magic Link): Endpoint: /requests/supabase/sign-in-magic-link/ Description: Authenticates a user using a magic link sent to their email. Method: POST (Assumed) Parameters: (Details not provided in source text) Returns: (Details not provided in source text) Update User: Endpoint: /requests/supabase/update-user/ Description: Updates the profile information of the currently authenticated user. Method: PUT/PATCH (Assumed) Parameters: (Details not provided in source text) Returns: (Details not provided in source text) Get User: Endpoint: /requests/supabase/get-user/ Description: Retrieves information about the currently authenticated user. Method: GET Parameters: (Details not provided in source text) Returns: (Details not provided in source text) Send Password Reset: Endpoint: /requests/supabase/send-password-reset/ Description: Sends a password reset email to the user. Method: POST (Assumed) Parameters: (Details not provided in source text) Returns: (Details not provided in source text) Sign Out: Endpoint: /requests/supabase/sign-out/ Description: Signs out the currently authenticated user. Method: POST (Assumed) Parameters: None Returns: (Details not provided in source text) ``` -------------------------------- ### Using npm Packages Source: https://docs.wized.com/requests/rest/body Provides guidance on working with npm packages within the Wized project. ```javascript console.log('Guidance on using npm packages is available at /using-npm-packages/'); ``` -------------------------------- ### Get User Supabase Method Source: https://docs.wized.com/llms Retrieves the details of the currently logged-in user using Supabase. This method is accessed via the Wized request panel by selecting the Supabase app and choosing the 'Get user' option. ```APIDOC Method: Get user Description: Retrieves the details of the currently logged-in user using Supabase. Usage: 1. Open the request panel and click the '+' button to add a new request. 2. Fill in an appropriate name and select the Supabase app. 3. Under the method, choose 'Get user'. ``` -------------------------------- ### Supabase Database API Requests Source: https://docs.wized.com/start-here/glossary/if-else Documentation for Supabase database API requests within Wized, covering item creation, update, retrieval, deletion, and real-time subscriptions. ```APIDOC SupabaseDatabase: Create item: POST /supabase/create-item Description: Creates a new item in the Supabase database. Parameters: (Refer to specific endpoint documentation for details) Returns: (Refer to specific endpoint documentation for details) Update item: PUT /supabase/update-item Description: Updates an existing item in the Supabase database. Parameters: (Refer to specific endpoint documentation for details) Returns: (Refer to specific endpoint documentation for details) Get list: GET /supabase/get-list Description: Retrieves a list of items from the Supabase database. Parameters: (Refer to specific endpoint documentation for details) Returns: (Refer to specific endpoint documentation for details) Get item: GET /supabase/get-item Description: Retrieves a single item from the Supabase database. Parameters: (Refer to specific endpoint documentation for details) Returns: (Refer to specific endpoint documentation for details) Delete item: DELETE /supabase/delete-item Description: Deletes an item from the Supabase database. Parameters: (Refer to specific endpoint documentation for details) Returns: (Refer to specific endpoint documentation for details) Unsubscribe real-time: POST /supabase/unsubscribe-real-time Description: Unsubscribes from real-time database listeners. Parameters: (Refer to specific endpoint documentation for details) Returns: (Refer to specific endpoint documentation for details) ``` -------------------------------- ### Get Session Supabase Method Source: https://docs.wized.com/llms Retrieves the details of the current local session using Supabase. This method is accessed via the Wized request panel by selecting the Supabase app and choosing the 'Get session' option. ```APIDOC Method: Get session Description: Retrieves the details of the current local session using Supabase. Usage: 1. Open the request panel and click the '+' button to add a new request. 2. Fill in an appropriate name and select the Supabase app. 3. Under the method, choose 'Get session'. ``` -------------------------------- ### Supabase Storage - Download File Source: https://docs.wized.com/elements/configuration-types/single-use Documentation for downloading files from Supabase Storage. ```APIDOC Supabase Storage - Download File: downloadFile(bucketName: string, filePath: string): Promise Downloads a file from Supabase Storage. Parameters: bucketName: The name of the storage bucket. filePath: The path to the file. Returns: A promise that resolves with the file content as a Blob. ``` -------------------------------- ### Software Architecture and Workflows Source: https://docs.wized.com/requests/rest/body Covers Wized software architecture, stack selection, integration of components, and workflow management. ```APIDOC APIDOC: - /software-architecture/ - /software-architecture/choosing-the-stack - /software-architecture/all-pieces-together - /workflows ```