-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject.json
1 lines (1 loc) · 222 KB
/
project.json
1
{"name":"Partners admin","components":[{"name":"/Firebase/App","graph":{"connections":[{"fromId":"246f9453-a119-ac78-171e-3806cf596ecc","fromProperty":"didMount","toId":"50dfc8ce-7a08-9adb-1c3b-e7c072cb2a17","toProperty":"Do"},{"fromId":"50dfc8ce-7a08-9adb-1c3b-e7c072cb2a17","fromProperty":"Success","toId":"6ff16834-ca6b-1c76-0474-b60bc04b2dfa","toProperty":"Do"},{"fromId":"51716fcb-7d6d-ddb8-a821-82120b6c22a8","fromProperty":"state","toId":"313bc126-ff48-ef0c-398e-cf9b369b0a29","toProperty":"value"},{"fromId":"50dfc8ce-7a08-9adb-1c3b-e7c072cb2a17","fromProperty":"Success","toId":"fc603ca0-5506-3f2a-a360-a19cbd7b2770","toProperty":"Do"}],"roots":[{"id":"246f9453-a119-ac78-171e-3806cf596ecc","type":"Group","x":-111.4681915301291,"y":311.4376377651178,"parameters":{"backgroundColor":"#FFFFFF","minHeight":{"value":100,"unit":"vh"}},"ports":[],"dynamicports":[],"children":[{"id":"a24a02ae-c1b8-1250-72c3-a1d48cbc9558","type":"Router","parameters":{"name":"Firebase Main","pages":{"routes":["/Firebase/Start Page","/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd","/Firebase/Password Reset/Reset Firebase Password","/Firebase/Verify & Update Email/Update Firebase Email","/Firebase/User Auth/Sign-out","/Firebase/Delete Account/Delete Account","/Firebase/example-page"],"startPage":"/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd"}},"ports":[],"dynamicports":[],"children":[]}]},{"id":"50dfc8ce-7a08-9adb-1c3b-e7c072cb2a17","type":"/Firebase/Firebase_init - Setup Client","x":-351.6348581967958,"y":334.4376377651178,"parameters":{"apiKey":"","authDomain":"","projectId":"","storageBucket":"","messagingSenderId":"","appId":""},"ports":[],"dynamicports":[],"children":[]},{"id":"6ff16834-ca6b-1c76-0474-b60bc04b2dfa","type":"/Firebase/User Auth/Firebase - Get Current User","x":97.44847513653758,"y":415.6043044317845,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"51716fcb-7d6d-ddb8-a821-82120b6c22a8","type":"/Firebase/User Auth/Firebase - Set Auth State Persistence","x":-382.8848581967958,"y":760.15985998734,"parameters":{"state persistence":"local"},"ports":[],"dynamicports":[],"children":[]},{"id":"313bc126-ff48-ef0c-398e-cf9b369b0a29","type":"String","label":"State","x":-160.96819153012916,"y":772.40985998734,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"fc603ca0-5506-3f2a-a360-a19cbd7b2770","type":"/Firebase/CRUD Document(s) in a Collection/Query Filtered Firebase Docs","x":-680.1015248634625,"y":318.40985998734004,"parameters":{"collectionName":"","filter fieldName":"","filter operator < ; <= ; > ; >= ; =":"=","filter fieldValue":"","limit":"","orderBy fieldName":""},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":["246f9453-a119-ac78-171e-3806cf596ecc"],"comments":[{"text":"You must input the firebaseConfig keys of your project in this component setup panel","width":176,"height":203,"fill":"transparent","x":-365,"y":239,"id":"657f7c01-db92-bb5b-aab8-4011d8a7d56c"},{"text":"In the component's left panel, specify how the Authentication state persists when using the Firebase JS SDK. You can specify whether a signed-in user should be indefinitely persisted until explicit sign out, cleared when the window is closed, or cleared on page reload.\n\nLocal: Indicates that the state will be persisted even when the browser window is closed or the activity is destroyed in React Native. An explicit sign out is needed to clear that state. Note that Firebase Auth web sessions are single host origin and will be persisted for a single domain only.\n\nSession: Indicates that the state will only persist in the current session or tab, and will be cleared when the tab or window in which the user authenticated is closed. Applies only to web apps.\n\nNone: Indicates that the state will only be stored in memory and will be cleared when the window or activity is refreshed.","width":622,"height":355,"fill":"transparent","x":-552,"y":517,"id":"685e521e-1632-77e7-c864-9ab2842b9716"},{"text":"By default, a query retrieves all documents that satisfy the query in ascending order by document ID. You can specify the sort order for your data using orderBy(), and you can limit the number of documents retrieved using limit().\n\nFor example, you could query for the first 3 cities alphabetically with such setting: orderBy: cityName and limit: 3\n\nYou could also sort in descending order to get the last 6 countries with: orderBy: countryName ; order: desc ; limit: 6\n\nYou can combine where() filters with orderBy() and limit(). In the following example, the queries define a population threshold, sort by population in ascending order, and return only the first two results that exceed the threshold: \nfilter fieldName: population ; filter operator: > ; filter fieldValue: 10000 ; orderBy: population ; limit: 2.\n\nIf you have a filter with a filter operator (<, <=,...), your first ordering must be on the same field.\nAn orderBy() clause also filters for existence of the given fields. The result set will not include documents that do not contain the given fields.\nWhen you order a query by a given field, the query can return only the documents where the order-by field exists.","width":420,"height":574,"fill":"transparent","x":-935,"y":-155,"id":"ab7cb140-b586-b3c6-0924-824e3ded67bd"}]},"metadata":{"canvasSize":{"width":"1039px","height":"751px"},"canvasPos":{"x":0,"y":0}}},{"name":"/Firebase/CRUD Document(s) in a Collection/Convert Noodl Object to Firestore-compatible Plain Object","id":"bd097558-0f9f-8124-98df-47ce01a7b54f","graph":{"connections":[{"fromId":"30f3e20e-f5bc-6ac2-e847-4e79e85e834f","fromProperty":"out-Success","toId":"97e66d24-a5ef-e418-a784-00fd215411c8","toProperty":"Success"},{"fromId":"30f3e20e-f5bc-6ac2-e847-4e79e85e834f","fromProperty":"out-Failure","toId":"97e66d24-a5ef-e418-a784-00fd215411c8","toProperty":"Failure"},{"fromId":"bcd0b6ba-05b2-fc66-163d-1fe1770b6639","fromProperty":"Do","toId":"30f3e20e-f5bc-6ac2-e847-4e79e85e834f","toProperty":"run"},{"fromId":"bcd0b6ba-05b2-fc66-163d-1fe1770b6639","fromProperty":"Id","toId":"30f3e20e-f5bc-6ac2-e847-4e79e85e834f","toProperty":"in-id"},{"fromId":"30f3e20e-f5bc-6ac2-e847-4e79e85e834f","fromProperty":"out-plainObject","toId":"97e66d24-a5ef-e418-a784-00fd215411c8","toProperty":"plainObject"}],"roots":[{"id":"bcd0b6ba-05b2-fc66-163d-1fe1770b6639","type":"Component Inputs","x":-126,"y":4,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"Id","plug":"output","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"97e66d24-a5ef-e418-a784-00fd215411c8","type":"Component Outputs","x":387,"y":-5,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"plainObject","plug":"input","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"30f3e20e-f5bc-6ac2-e847-4e79e85e834f","type":"JavaScriptFunction","x":147.66666666666663,"y":-8,"parameters":{"functionScript":"// Check if the object exists in Noodl.Objects using the provided ID\r\nif (!Inputs.id || !Noodl.Objects[Inputs.id]) {\r\n console.error(\"Object not found or ID is invalid.\");\r\n Outputs.Failure(); // Signal if object not found or invalid ID\r\n return; // Exit the function\r\n}\r\n\r\nconst obj = Noodl.Objects[Inputs.id];\r\n\r\nfunction convertToPlainObject(obj) {\r\n if (typeof obj !== 'object' || obj === null) return obj;\r\n if (Array.isArray(obj)) {\r\n return obj.map(convertToPlainObject); // Recursively process arrays\r\n }\r\n const plainObj = {};\r\n Object.keys(obj).forEach(key => {\r\n const value = obj[key];\r\n if (value === undefined) {\r\n plainObj[key] = null; // Convert undefined to null\r\n } else if (typeof value === 'object' && value !== null) {\r\n plainObj[key] = convertToPlainObject(value); // Recurse for nested objects\r\n } else {\r\n plainObj[key] = value; // Copy value\r\n }\r\n });\r\n return plainObj;\r\n}\r\n\r\nconst plainObject = convertToPlainObject(obj);\r\n\r\nOutputs.plainObject = plainObject;\r\nOutputs.Success();"},"ports":[],"dynamicports":[{"name":"in-id","displayName":"id","plug":"input","type":"*","group":"Inputs","index":4},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-plainObject","displayName":"plainObject","plug":"output","type":"*","group":"Outputs","index":7}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[]}},{"name":"/Firebase/CRUD Document(s) in a Collection/Create Firebase Document","id":"60d20867-b887-eef7-ca96-b3b5381e386d","graph":{"connections":[{"fromId":"69d0a9bd-e7ff-cfb0-e844-87943a906c13","fromProperty":"out-Success","toId":"9550883a-73b0-77bf-4c58-059fd818914c","toProperty":"Success"},{"fromId":"69d0a9bd-e7ff-cfb0-e844-87943a906c13","fromProperty":"out-Failure","toId":"9550883a-73b0-77bf-4c58-059fd818914c","toProperty":"Failure"},{"fromId":"4dbf7887-3f77-6cca-ccfc-84d92538b141","fromProperty":"Do","toId":"69d0a9bd-e7ff-cfb0-e844-87943a906c13","toProperty":"run"},{"fromId":"4dbf7887-3f77-6cca-ccfc-84d92538b141","fromProperty":"Id","toId":"69d0a9bd-e7ff-cfb0-e844-87943a906c13","toProperty":"in-Id"},{"fromId":"4dbf7887-3f77-6cca-ccfc-84d92538b141","fromProperty":"collectionName","toId":"340e7e43-243e-c04f-56ea-ed735c5e8692","toProperty":"value"},{"fromId":"340e7e43-243e-c04f-56ea-ed735c5e8692","fromProperty":"savedValue","toId":"69d0a9bd-e7ff-cfb0-e844-87943a906c13","toProperty":"in-collectionName"}],"roots":[{"id":"4dbf7887-3f77-6cca-ccfc-84d92538b141","type":"Component Inputs","x":-217,"y":5,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"collectionName","plug":"output","type":{"name":"*"},"index":1},{"name":"Id","plug":"output","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"9550883a-73b0-77bf-4c58-059fd818914c","type":"Component Outputs","x":398,"y":37,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1}],"dynamicports":[],"children":[]},{"id":"69d0a9bd-e7ff-cfb0-e844-87943a906c13","type":"JavaScriptFunction","x":170.66666666666663,"y":-8,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseApp)) {\r\n console.log(\"Firebase client is not set up.\");\r\n Outputs.Failure();\r\n return; // Exit the function if Firebase is not set up\r\n}\r\n\r\nif (!Inputs.Id || !Noodl.Objects[Inputs.Id]) {\r\n console.error(\"Noodl Object with the provided ID does not exist.\");\r\n console.log(\"Available Noodl.Objects keys:\", Object.keys(Noodl.Objects));\r\n Outputs.Failure(); // Signal failure due to invalid input\r\n return; // Exit if the id input is invalid or the object does not exist\r\n}\r\n\r\nconst db = Noodl.Variables.firebaseDb;\r\nif (!db) {\r\n console.error(\"Firebase DB is not initialized.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\nconsole.log(\"Attempting to access collection with name:\", Inputs.collectionName);\r\n\r\n// Define the collection you're adding to using the dynamic collection name from Inputs\r\nconst dynamicCollection = window.collection(db, Inputs.collectionName);\r\nif (!dynamicCollection) {\r\n console.error(\"Failed to access specified collection.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\n// Function to replace undefined values with null in an object\r\nfunction toPlainObject(obj) {\r\n if (typeof obj !== 'object' || obj === null) return obj;\r\n if (Array.isArray(obj)) {\r\n return obj.map(toPlainObject);\r\n }\r\n const plainObj = {};\r\n Object.keys(obj).forEach(key => {\r\n const value = obj[key];\r\n if (value === undefined) {\r\n plainObj[key] = null;\r\n } else if (typeof value === 'object' && value !== null) {\r\n plainObj[key] = toPlainObject(value);\r\n } else {\r\n plainObj[key] = value;\r\n }\r\n });\r\n return plainObj;\r\n}\r\n\r\n// Use the object identified by Inputs.Id for the document data, ensuring undefined values are replaced with null\r\nconst originalData = Noodl.Objects[Inputs.Id];\r\nconst documentData = toPlainObject(originalData);\r\n\r\n// Add createdAt timestamp to documentData\r\ndocumentData.createdAt = window.serverTimestamp();\r\n\r\nconsole.log(\"Converted document data to be added:\", documentData);\r\nOutputs.object = documentData; // Output the processed object\r\n\r\n// Attempt to add a document to the specified collection using documentData\r\nwindow.addDoc(dynamicCollection, documentData)\r\n .then(docRef => {\r\n console.log(\"Document successfully written with ID: \", docRef.id);\r\n Outputs.Success(); // Signal success\r\n })\r\n .catch(error => {\r\n console.error(\"Error adding document: \", error);\r\n Outputs.Failure(); // Signal failure\r\n });"},"ports":[],"dynamicports":[{"name":"in-Id","displayName":"Id","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-collectionName","displayName":"collectionName","plug":"input","type":"*","group":"Inputs","index":5},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":7},{"name":"out-object","displayName":"object","plug":"output","type":"*","group":"Outputs","index":8}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"340e7e43-243e-c04f-56ea-ed735c5e8692","type":"String","x":-15.111111111111086,"y":109.66666666666669,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/CRUD Document(s) in a Collection/Delete Firebase Document","id":"a08270b6-ef6e-68f5-b1f4-824bf4e736fd","graph":{"connections":[{"fromId":"084f1125-156a-03ab-a758-357067f3206e","fromProperty":"out-Success","toId":"254006a5-e867-ac85-b617-fddf7b32a7ac","toProperty":"Success"},{"fromId":"084f1125-156a-03ab-a758-357067f3206e","fromProperty":"out-Failure","toId":"254006a5-e867-ac85-b617-fddf7b32a7ac","toProperty":"Failure"},{"fromId":"afde0550-ee28-cb64-348e-8771ea965535","fromProperty":"Do","toId":"084f1125-156a-03ab-a758-357067f3206e","toProperty":"run"},{"fromId":"afde0550-ee28-cb64-348e-8771ea965535","fromProperty":"Id","toId":"084f1125-156a-03ab-a758-357067f3206e","toProperty":"in-Id"},{"fromId":"afde0550-ee28-cb64-348e-8771ea965535","fromProperty":"CollectionName","toId":"fb4e4360-6830-a96b-bd13-2282b7f67b9a","toProperty":"value"},{"fromId":"fb4e4360-6830-a96b-bd13-2282b7f67b9a","fromProperty":"savedValue","toId":"084f1125-156a-03ab-a758-357067f3206e","toProperty":"in-collectionName"}],"roots":[{"id":"afde0550-ee28-cb64-348e-8771ea965535","type":"Component Inputs","x":-217,"y":5,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"CollectionName","plug":"output","type":{"name":"*"},"index":1},{"name":"Id","plug":"output","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"254006a5-e867-ac85-b617-fddf7b32a7ac","type":"Component Outputs","x":398,"y":37,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1}],"dynamicports":[],"children":[]},{"id":"084f1125-156a-03ab-a758-357067f3206e","type":"JavaScriptFunction","x":170.66666666666663,"y":-8,"parameters":{"functionScript":"const db = getFirestore(); // Directly invoke getFirestore()\r\n\r\n// Create a deletion function based on direct usage\r\nasync function deleteDocument(collectionName, documentId) {\r\n try {\r\n const docRef = doc(db, collectionName, documentId);\r\n await deleteDoc(docRef);\r\n console.log(\"Document successfully deleted\");\r\n // Trigger Noodl success output here\r\n Outputs.Success();\r\n } catch (error) {\r\n console.error(\"Error deleting document:\", error);\r\n // Trigger Noodl failure output here\r\n Outputs.Failure();\r\n }\r\n}\r\n\r\ndeleteDocument(Inputs.collectionName, Inputs.Id);"},"ports":[],"dynamicports":[{"name":"in-collectionName","displayName":"collectionName","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-Id","displayName":"Id","plug":"input","type":"*","group":"Inputs","index":5},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":7}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"fb4e4360-6830-a96b-bd13-2282b7f67b9a","type":"String","x":-15.111111111111086,"y":109.66666666666669,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/CRUD Document(s) in a Collection/Flatten Firebase Object","id":"15ace990-bafa-c8b7-adac-ff53c094602e","graph":{"connections":[{"fromId":"2a17ecb9-2b92-44d0-cde2-cfe47a153268","fromProperty":"out-Success","toId":"d13487cf-9cfd-6511-3d33-862384f9cfdb","toProperty":"Success"},{"fromId":"2a17ecb9-2b92-44d0-cde2-cfe47a153268","fromProperty":"out-flattenedObject","toId":"d13487cf-9cfd-6511-3d33-862384f9cfdb","toProperty":"flattenedObject"},{"fromId":"634b4c77-f892-d6ee-27b4-6d3b8fdedc18","fromProperty":"Do","toId":"2a17ecb9-2b92-44d0-cde2-cfe47a153268","toProperty":"run"},{"fromId":"634b4c77-f892-d6ee-27b4-6d3b8fdedc18","fromProperty":"objectId","toId":"2a17ecb9-2b92-44d0-cde2-cfe47a153268","toProperty":"in-objectId"},{"fromId":"2a17ecb9-2b92-44d0-cde2-cfe47a153268","fromProperty":"out-flattenedObjectId","toId":"d13487cf-9cfd-6511-3d33-862384f9cfdb","toProperty":"flattenedObjectId"}],"roots":[{"id":"634b4c77-f892-d6ee-27b4-6d3b8fdedc18","type":"Component Inputs","x":-129,"y":-17,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"objectId","plug":"output","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"d13487cf-9cfd-6511-3d33-862384f9cfdb","type":"Component Outputs","x":362,"y":31,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"flattenedObject","plug":"input","type":{"name":"*"},"index":2},{"name":"flattenedObjectId","plug":"input","type":{"name":"*"},"index":3}],"dynamicports":[],"children":[]},{"id":"2a17ecb9-2b92-44d0-cde2-cfe47a153268","type":"JavaScriptFunction","label":"Flatten object","x":141.66666666666669,"y":-30,"parameters":{"functionScript":"let result = {};\r\n\r\nfunction processObject(obj, path = '') {\r\n if (obj == null) {\r\n return;\r\n }\r\n Object.keys(obj).forEach((key) => {\r\n const fullPath = path ? `${path}.${key}` : key;\r\n\r\n if (Array.isArray(obj[key])) {\r\n obj[key].forEach((item, index) => {\r\n if (typeof item === 'object' && item !== null) {\r\n processObject(item, `${fullPath}[${index}]`);\r\n } else {\r\n result[`${fullPath}[${index}]`] = item;\r\n }\r\n });\r\n } else if (typeof obj[key] === 'object' && obj[key] !== null) {\r\n processObject(obj[key], fullPath);\r\n } else {\r\n result[fullPath] = obj[key];\r\n }\r\n });\r\n}\r\n\r\n// Use the original objectId and append \"flat\" to create a distinctive objectId\r\nfunction flattenObject(inputObject, objectId) {\r\n result = {}; // Reset result to an empty object\r\n processObject(inputObject);\r\n // Appending \"-flat\" to the original objectId\r\n const newObjectId = `flat-${objectId}`;\r\n return { flattenedObject: result, objectId: newObjectId };\r\n}\r\n\r\n// Inputs.objectId is provided to flatten the corresponding Noodl object\r\nconst inputObject = Noodl.Objects[Inputs.objectId]; // Directly fetching the object to flatten\r\n\r\n// Call flattenObject with this directly fetched object\r\nconst { flattenedObject, objectId: flattenedObjectId } = flattenObject(inputObject, Inputs.objectId);\r\nNoodl.Object.create({\r\n id: flattenedObjectId, // Using the new \"flat-objectId\"\r\n ...flattenedObject\r\n});\r\n\r\n// Outputting both the flattened object and its new ID\r\nOutputs.flattenedObject = flattenedObject;\r\nOutputs.flattenedObjectId = flattenedObjectId; // Outputs the new ID for the flattened object\r\n\r\nOutputs.Success();"},"ports":[],"dynamicports":[{"name":"in-objectId","displayName":"objectId","plug":"input","type":"*","group":"Inputs","index":4},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-flattenedObject","displayName":"flattenedObject","plug":"output","type":"*","group":"Outputs","index":6},{"name":"out-flattenedObjectId","displayName":"flattenedObjectId","plug":"output","type":"*","group":"Outputs","index":7}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[]}},{"name":"/Firebase/CRUD Document(s) in a Collection/Get All Firebase Docs from Collection","id":"ce3deed1-60ee-d3ab-ac00-6a70e3d8fef8","graph":{"connections":[{"fromId":"b38be1f3-361f-1f15-e7f0-44dd143e9a9c","fromProperty":"out-Success","toId":"c2a97858-2ea5-1dfb-5774-4dc20e23c0e1","toProperty":"Success"},{"fromId":"b38be1f3-361f-1f15-e7f0-44dd143e9a9c","fromProperty":"out-Failure","toId":"c2a97858-2ea5-1dfb-5774-4dc20e23c0e1","toProperty":"Failure"},{"fromId":"d84c2799-74c2-7cf2-4f2d-df01ca487906","fromProperty":"Do","toId":"b38be1f3-361f-1f15-e7f0-44dd143e9a9c","toProperty":"run"},{"fromId":"d84c2799-74c2-7cf2-4f2d-df01ca487906","fromProperty":"collectionName","toId":"07e0df0e-b48a-2ce8-19d5-0b3af5e912a0","toProperty":"value"},{"fromId":"07e0df0e-b48a-2ce8-19d5-0b3af5e912a0","fromProperty":"savedValue","toId":"b38be1f3-361f-1f15-e7f0-44dd143e9a9c","toProperty":"in-collectionName"},{"fromId":"b38be1f3-361f-1f15-e7f0-44dd143e9a9c","fromProperty":"out-documents","toId":"c2a97858-2ea5-1dfb-5774-4dc20e23c0e1","toProperty":"documentsList"}],"roots":[{"id":"d84c2799-74c2-7cf2-4f2d-df01ca487906","type":"Component Inputs","x":-217,"y":5,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"collectionName","plug":"output","type":{"name":"*"},"index":1}],"dynamicports":[],"children":[]},{"id":"c2a97858-2ea5-1dfb-5774-4dc20e23c0e1","type":"Component Outputs","x":398,"y":37,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"documentsList","plug":"input","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"b38be1f3-361f-1f15-e7f0-44dd143e9a9c","type":"JavaScriptFunction","x":170.66666666666663,"y":-8,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseApp)) {\r\n console.log(\"Firebase client is not set up.\");\r\n Outputs.Failure();\r\n return; // Exit the function if Firebase is not set up\r\n}\r\n\r\nconst db = Noodl.Variables.firebaseDb;\r\nif (!db) {\r\n console.error(\"Firebase DB is not initialized.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nif (!Inputs.collectionName) {\r\n console.error(\"collection name is not specified.\");\r\n console.log(\"Please specify collection name\");\r\n Outputs.Failure(); // Signal failure due to invalid input\r\n return; // Exit if the id input is invalid or the object does not exist\r\n}\r\nconsole.log(\"Attempting to access collection with name:\", Inputs.collectionName);\r\n\r\nconst collectionName = Inputs.collectionName; // The collection name is provided as an input\r\n\r\ntry {\r\n const querySnapshot = await window.getDocs(window.collection(db, collectionName));\r\n let documents = [];\r\n querySnapshot.forEach((doc) => {\r\n // Push document data along with doc.id into the documents array\r\n documents.push({ id: doc.id, ...doc.data() });\r\n });\r\n\r\n // Make sure there is an output defined for the documents array\r\n Outputs.documents = documents;\r\n Outputs.Success(); // Signal success after setting the documents output\r\n} catch (error) {\r\n console.error(\"Error reading documents:\", error);\r\n Outputs.Failure(); // Signal failure in case of an error\r\n}"},"ports":[],"dynamicports":[{"name":"in-collectionName","displayName":"collectionName","plug":"input","type":"*","group":"Inputs","index":4},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-documents","displayName":"documents","plug":"output","type":"*","group":"Outputs","index":7}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"07e0df0e-b48a-2ce8-19d5-0b3af5e912a0","type":"String","x":-16.111111111111086,"y":95.66666666666669,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/CRUD Document(s) in a Collection/Get Single Firebase Doc from Collection","id":"4125c31e-53dd-73b0-7156-c03d0a522ff2","graph":{"connections":[{"fromId":"469a4146-db76-812f-6d41-732c975e3003","fromProperty":"out-Success","toId":"157e5836-2a03-12f2-05af-f26936422bf3","toProperty":"Success"},{"fromId":"469a4146-db76-812f-6d41-732c975e3003","fromProperty":"out-Failure","toId":"157e5836-2a03-12f2-05af-f26936422bf3","toProperty":"Failure"},{"fromId":"5090de83-67b9-2cff-17fd-39695655e765","fromProperty":"Do","toId":"469a4146-db76-812f-6d41-732c975e3003","toProperty":"run"},{"fromId":"5090de83-67b9-2cff-17fd-39695655e765","fromProperty":"collectionName","toId":"c90a490a-8fbf-6a47-bb0b-f7ae755df8ed","toProperty":"value"},{"fromId":"5090de83-67b9-2cff-17fd-39695655e765","fromProperty":"firebaseDocId","toId":"de4d26be-7aa2-b3bf-a734-721b9d5af662","toProperty":"value"},{"fromId":"469a4146-db76-812f-6d41-732c975e3003","fromProperty":"out-fetchedObjectData","toId":"157e5836-2a03-12f2-05af-f26936422bf3","toProperty":"fetchedObjectData"},{"fromId":"469a4146-db76-812f-6d41-732c975e3003","fromProperty":"out-objectId","toId":"157e5836-2a03-12f2-05af-f26936422bf3","toProperty":"fromDocToNoodlObjectId"},{"fromId":"de4d26be-7aa2-b3bf-a734-721b9d5af662","fromProperty":"savedValue","toId":"469a4146-db76-812f-6d41-732c975e3003","toProperty":"in-firebaseDocId"},{"fromId":"c90a490a-8fbf-6a47-bb0b-f7ae755df8ed","fromProperty":"savedValue","toId":"469a4146-db76-812f-6d41-732c975e3003","toProperty":"in-collectionName"}],"roots":[{"id":"5090de83-67b9-2cff-17fd-39695655e765","type":"Component Inputs","x":-217,"y":5,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"collectionName","plug":"output","type":{"name":"*"},"index":1},{"name":"firebaseDocId","plug":"output","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"157e5836-2a03-12f2-05af-f26936422bf3","type":"Component Outputs","x":398,"y":37,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"fromDocToNoodlObjectId","plug":"input","type":{"name":"*"},"index":2},{"name":"fetchedObjectData","plug":"input","type":{"name":"*"},"index":3}],"dynamicports":[],"children":[]},{"id":"469a4146-db76-812f-6d41-732c975e3003","type":"JavaScriptFunction","label":"get Firebase doc","x":170.66666666666663,"y":-8,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseApp)) {\r\n console.log(\"Firebase client is not set up.\");\r\n Outputs.Failure();\r\n return; // Exit the function if Firebase is not set up\r\n}\r\n\r\nconst db = Noodl.Variables.firebaseDb;\r\nif (!db) {\r\n console.error(\"Firebase DB is not initialized.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nif (!Inputs.collectionName || !Inputs.firebaseDocId) {\r\n console.error(\"Collection name or document ID is not specified.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\nconsole.log(\"Attempting to access document with ID:\", Inputs.firebaseDocId, \"in collection:\", Inputs.collectionName);\r\n\r\ntry {\r\n const docRef = window.doc(db, Inputs.collectionName, Inputs.firebaseDocId); // Get a reference to the document\r\n const docSnapshot = await window.getDoc(docRef); // Retrieve the document\r\n\r\n if (!docSnapshot.exists()) {\r\n console.error(\"Document does not exist.\");\r\n Outputs.Failure();\r\n return;\r\n }\r\n\r\n const documentData = docSnapshot.data();\r\n // Use the docSnapshot.id as the Noodl object ID\r\n const objectId = docSnapshot.id;\r\n\r\n // Create the fetchedObject in Noodl's Object\r\n Noodl.Object.create({\r\n id: objectId, // Explicitly setting the ID here\r\n ...documentData\r\n });\r\n\r\n // Output the ID of the newly created object\r\n Outputs.objectId = objectId; // Make an Output port 'ObjectId' and connect it to an Object node for working with the plain object\r\n console.log(\"Successfully retrieved document and created object with ID:\", objectId);\r\n Outputs.fetchedObjectData = documentData; // Outputs the object data\r\n Outputs.Success();\r\n} catch (error) {\r\n console.error(\"Error retrieving document:\", error);\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"in-collectionName","displayName":"collectionName","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-firebaseDocId","displayName":"firebaseDocId","plug":"input","type":"*","group":"Inputs","index":5},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":7},{"name":"out-objectId","displayName":"objectId","plug":"output","type":"*","group":"Outputs","index":8},{"name":"out-fetchedObjectData","displayName":"fetchedObjectData","plug":"output","type":"*","group":"Outputs","index":9}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"c90a490a-8fbf-6a47-bb0b-f7ae755df8ed","type":"String","x":-28.111111111111086,"y":-57.333333333333314,"parameters":{"value":""},"ports":[],"dynamicports":[],"children":[]},{"id":"de4d26be-7aa2-b3bf-a734-721b9d5af662","type":"String","x":-25.194444444444457,"y":113.41666666666669,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/CRUD Document(s) in a Collection/Query Filtered Firebase Docs","id":"a426f472-cd2d-6149-89e9-c7d3c4e8efb2","graph":{"connections":[{"fromId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","fromProperty":"out-Success","toId":"1312f283-774b-340c-2e57-104c976d9dc5","toProperty":"Success"},{"fromId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","fromProperty":"out-Failure","toId":"1312f283-774b-340c-2e57-104c976d9dc5","toProperty":"Failure"},{"fromId":"39a722a6-c235-b384-f1d2-c3190b7dde97","fromProperty":"Do","toId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","toProperty":"run"},{"fromId":"39a722a6-c235-b384-f1d2-c3190b7dde97","fromProperty":"collectionName","toId":"6f00eabd-5eb1-3927-9b18-63d48393e2b4","toProperty":"value"},{"fromId":"6f00eabd-5eb1-3927-9b18-63d48393e2b4","fromProperty":"savedValue","toId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","toProperty":"in-collectionName"},{"fromId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","fromProperty":"out-documents","toId":"1312f283-774b-340c-2e57-104c976d9dc5","toProperty":"documentsList"},{"fromId":"39a722a6-c235-b384-f1d2-c3190b7dde97","fromProperty":"filter fieldName","toId":"6b297f91-b296-6c62-0ad4-438287512e8f","toProperty":"value"},{"fromId":"6b297f91-b296-6c62-0ad4-438287512e8f","fromProperty":"savedValue","toId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","toProperty":"in-whereField"},{"fromId":"39a722a6-c235-b384-f1d2-c3190b7dde97","fromProperty":"filter fieldValue","toId":"1845c1a6-13c7-296c-c194-c0b30413f6c2","toProperty":"value"},{"fromId":"1845c1a6-13c7-296c-c194-c0b30413f6c2","fromProperty":"savedValue","toId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","toProperty":"in-whereValue"},{"fromId":"39a722a6-c235-b384-f1d2-c3190b7dde97","fromProperty":"orderBy fieldName","toId":"d43f0021-5ac4-1fea-19a8-15059882b96f","toProperty":"value"},{"fromId":"d43f0021-5ac4-1fea-19a8-15059882b96f","fromProperty":"savedValue","toId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","toProperty":"in-orderByField"},{"fromId":"39a722a6-c235-b384-f1d2-c3190b7dde97","fromProperty":"order","toId":"e1aae953-d5f8-640e-5dea-118cbaabb000","toProperty":"currentState"},{"fromId":"e1aae953-d5f8-640e-5dea-118cbaabb000","fromProperty":"value","toId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","toProperty":"in-orderDirection"},{"fromId":"39a722a6-c235-b384-f1d2-c3190b7dde97","fromProperty":"limit","toId":"605ac8ae-2d16-7ed4-d43a-5e6672f02b38","toProperty":"value"},{"fromId":"605ac8ae-2d16-7ed4-d43a-5e6672f02b38","fromProperty":"savedValue","toId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","toProperty":"in-limit"},{"fromId":"39a722a6-c235-b384-f1d2-c3190b7dde97","fromProperty":"filter operator","toId":"5d33f0d6-e6f6-6508-325a-bea8cdf8c8e4","toProperty":"currentState"},{"fromId":"5d33f0d6-e6f6-6508-325a-bea8cdf8c8e4","fromProperty":"value","toId":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","toProperty":"in-whereOperator"}],"roots":[{"id":"39a722a6-c235-b384-f1d2-c3190b7dde97","type":"Component Inputs","x":-332,"y":-3,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"collectionName","plug":"output","type":{"name":"*"},"index":1,"group":"Data source"},{"name":"filter fieldName","plug":"output","type":{"name":"*"},"index":2,"group":"Filter"},{"name":"filter operator","plug":"output","type":{"name":"*"},"index":3,"group":"Filter"},{"name":"filter fieldValue","plug":"output","type":{"name":"*"},"index":4,"group":"Filter"},{"name":"orderBy fieldName","plug":"output","type":{"name":"*"},"index":5,"group":"Order"},{"name":"order","plug":"output","type":{"name":"*"},"index":6,"group":"Order"},{"name":"limit","plug":"output","type":{"name":"*"},"index":7,"group":"Limit"}],"dynamicports":[],"children":[]},{"id":"1312f283-774b-340c-2e57-104c976d9dc5","type":"Component Outputs","x":398,"y":37,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"documentsList","plug":"input","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"e7e53d1e-c28e-d3b7-c274-1e8a6b56c1d4","type":"JavaScriptFunction","x":170.66666666666663,"y":-8,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseApp)) {\r\n console.log(\"Firebase client is not set up.\");\r\n Outputs.Failure();\r\n return; // Exit the function if Firebase is not set up\r\n}\r\n\r\nconst db = Noodl.Variables.firebaseDb;\r\nif (!db) {\r\n console.error(\"Firebase DB is not initialized.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nif (!Inputs.collectionName) {\r\n console.error(\"collection name is not specified.\");\r\n console.log(\"Please specify collection name\");\r\n Outputs.Failure(); // Signal failure due to invalid input\r\n return; // Exit if the id input is invalid or the object does not exist\r\n}\r\nconsole.log(\"Attempting to access collection with name:\", Inputs.collectionName);\r\n\r\ntry {\r\n let query = window.collection(db, Inputs.collectionName);\r\n\r\n // Apply 'where' filter if provided\r\n if (Inputs.whereField && Inputs.whereOperator && Inputs.whereValue) {\r\n query = window.query(query, window.where(Inputs.whereField, Inputs.whereOperator, Inputs.whereValue));\r\n }\r\n\r\n // Apply 'orderBy' after 'where' if where operator is used\r\n if (Inputs.whereOperator && Inputs.orderByField) {\r\n if (Inputs.whereField !== Inputs.orderByField) {\r\n console.error(\"When using range comparison, 'orderBy' must be on the same field as the 'where' filter.\");\r\n Outputs.Failure();\r\n return;\r\n }\r\n query = window.query(query, window.orderBy(Inputs.orderByField, Inputs.orderDirection || 'asc'));\r\n } else if (Inputs.orderByField) {\r\n // Apply 'orderBy' if specified\r\n query = window.query(query, window.orderBy(Inputs.orderByField, Inputs.orderDirection || 'asc'));\r\n }\r\n\r\n // Apply 'limit' if specified\r\n if (Inputs.limit) {\r\n query = window.query(query, window.limit(Inputs.limit));\r\n }\r\n\r\n const querySnapshot = await window.getDocs(query);\r\n let documents = [];\r\n querySnapshot.forEach((doc) => {\r\n documents.push({ id: doc.id, ...doc.data() });\r\n });\r\n\r\n Outputs.documents = documents;\r\n Outputs.Success();\r\n} catch (error) {\r\n console.error(\"Error reading documents:\", error);\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"in-collectionName","displayName":"collectionName","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-whereField","displayName":"whereField","plug":"input","type":"*","group":"Inputs","index":5},{"name":"in-whereOperator","displayName":"whereOperator","plug":"input","type":"*","group":"Inputs","index":6},{"name":"in-whereValue","displayName":"whereValue","plug":"input","type":"*","group":"Inputs","index":7},{"name":"in-orderByField","displayName":"orderByField","plug":"input","type":"*","group":"Inputs","index":8},{"name":"in-orderDirection","displayName":"orderDirection","plug":"input","type":"*","group":"Inputs","index":9},{"name":"in-limit","displayName":"limit","plug":"input","type":"*","group":"Inputs","index":10},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":11},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":12},{"name":"out-documents","displayName":"documents","plug":"output","type":"*","group":"Outputs","index":13}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"6f00eabd-5eb1-3927-9b18-63d48393e2b4","type":"String","x":-77.11111111111109,"y":-122.33333333333331,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"6b297f91-b296-6c62-0ad4-438287512e8f","type":"String","x":-77.11111111111109,"y":-32.083333333333314,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"1845c1a6-13c7-296c-c194-c0b30413f6c2","type":"String","x":-76,"y":136,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"d43f0021-5ac4-1fea-19a8-15059882b96f","type":"String","x":-75.11111111111109,"y":208.91666666666669,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"e1aae953-d5f8-640e-5dea-118cbaabb000","type":"States","x":-75.11111111111109,"y":280.9166666666667,"parameters":{"values":"value","type-value":"string","value-Asc-value":"asc","value-Desc-value":"desc","type-true":"boolean","value-Desc-true":true,"states":"Ascending order,Descending order","value-Ascending order-value":"asc","value-Descending order-value":"desc"},"ports":[],"dynamicports":[{"type":{"name":"string","allowConnectionsOnly":true},"plug":"output","group":"Values","name":"value","index":6},{"type":{"name":"enum","enums":[{"label":"Number","value":"number"},{"label":"String","value":"string"},{"label":"Boolean","value":"boolean"},{"label":"Color","value":"color"},{"label":"Text Style","value":"textStyle"}],"allowEditOnly":true},"default":"number","plug":"input","group":"Types","displayName":"value","name":"type-value","index":7},{"plug":"input","type":"string","group":"Ascending order Values","name":"value-Ascending order-value","displayName":"value","editorName":"Ascending order|value","index":8},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"Ascending order Transitions","name":"transitiondef-Ascending order","index":9},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To Ascending order","name":"to-Ascending order","group":"Go to state","index":10},{"plug":"output","type":"boolean","displayName":"At Ascending order","name":"at-Ascending order","group":"Current state","index":11},{"plug":"output","type":"signal","displayName":"Has Reached Ascending order","name":"reached-Ascending order","group":"Current state","index":12},{"plug":"input","type":"string","group":"Descending order Values","name":"value-Descending order-value","displayName":"value","editorName":"Descending order|value","index":13},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"Descending order Transitions","name":"transitiondef-Descending order","index":14},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To Descending order","name":"to-Descending order","group":"Go to state","index":15},{"plug":"output","type":"boolean","displayName":"At Descending order","name":"at-Descending order","group":"Current state","index":16},{"plug":"output","type":"signal","displayName":"Has Reached Descending order","name":"reached-Descending order","group":"Current state","index":17},{"plug":"input","type":{"name":"enum","enums":["Ascending order","Descending order"]},"group":"States","displayName":"State","name":"currentState","default":"Ascending order","index":18}],"children":[]},{"id":"605ac8ae-2d16-7ed4-d43a-5e6672f02b38","type":"String","x":-76.11111111111109,"y":369.9166666666667,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"5d33f0d6-e6f6-6508-325a-bea8cdf8c8e4","type":"States","x":-76.48888888888882,"y":63.23333333333335,"parameters":{"states":"== (equal to),!= (not equal to),< (less than),<= (less than or equal to),> (greater than),>= (greater than or equal to),array-contains,array-contains-any,in,not-in,none","currentState":"none","values":"value","type-value":"string","value-== (equal to)-value":"==","value-!= (not equal to)-value":"!=","value-< (less than)-value":"<","value-<= (less than or equal to)-value":"<=","value-> (greater than)-value":">","value->= (greater than or equal to)-value":">=","value-array-contains-value":"array-contains","value-array-contains-any-value":"array-contains-any","value-in-value":"in","value-not-in-value":"not-in"},"ports":[],"dynamicports":[{"type":{"name":"string","allowConnectionsOnly":true},"plug":"output","group":"Values","name":"value","index":6},{"type":{"name":"enum","enums":[{"label":"Number","value":"number"},{"label":"String","value":"string"},{"label":"Boolean","value":"boolean"},{"label":"Color","value":"color"},{"label":"Text Style","value":"textStyle"}],"allowEditOnly":true},"default":"number","plug":"input","group":"Types","displayName":"value","name":"type-value","index":7},{"plug":"input","type":"string","group":"== (equal to) Values","name":"value-== (equal to)-value","displayName":"value","editorName":"== (equal to)|value","index":8},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"== (equal to) Transitions","name":"transitiondef-== (equal to)","index":9},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To == (equal to)","name":"to-== (equal to)","group":"Go to state","index":10},{"plug":"output","type":"boolean","displayName":"At == (equal to)","name":"at-== (equal to)","group":"Current state","index":11},{"plug":"output","type":"signal","displayName":"Has Reached == (equal to)","name":"reached-== (equal to)","group":"Current state","index":12},{"plug":"input","type":"string","group":"!= (not equal to) Values","name":"value-!= (not equal to)-value","displayName":"value","editorName":"!= (not equal to)|value","index":13},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"!= (not equal to) Transitions","name":"transitiondef-!= (not equal to)","index":14},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To != (not equal to)","name":"to-!= (not equal to)","group":"Go to state","index":15},{"plug":"output","type":"boolean","displayName":"At != (not equal to)","name":"at-!= (not equal to)","group":"Current state","index":16},{"plug":"output","type":"signal","displayName":"Has Reached != (not equal to)","name":"reached-!= (not equal to)","group":"Current state","index":17},{"plug":"input","type":"string","group":"< (less than) Values","name":"value-< (less than)-value","displayName":"value","editorName":"< (less than)|value","index":18},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"< (less than) Transitions","name":"transitiondef-< (less than)","index":19},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To < (less than)","name":"to-< (less than)","group":"Go to state","index":20},{"plug":"output","type":"boolean","displayName":"At < (less than)","name":"at-< (less than)","group":"Current state","index":21},{"plug":"output","type":"signal","displayName":"Has Reached < (less than)","name":"reached-< (less than)","group":"Current state","index":22},{"plug":"input","type":"string","group":"<= (less than or equal to) Values","name":"value-<= (less than or equal to)-value","displayName":"value","editorName":"<= (less than or equal to)|value","index":23},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"<= (less than or equal to) Transitions","name":"transitiondef-<= (less than or equal to)","index":24},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To <= (less than or equal to)","name":"to-<= (less than or equal to)","group":"Go to state","index":25},{"plug":"output","type":"boolean","displayName":"At <= (less than or equal to)","name":"at-<= (less than or equal to)","group":"Current state","index":26},{"plug":"output","type":"signal","displayName":"Has Reached <= (less than or equal to)","name":"reached-<= (less than or equal to)","group":"Current state","index":27},{"plug":"input","type":"string","group":"> (greater than) Values","name":"value-> (greater than)-value","displayName":"value","editorName":"> (greater than)|value","index":28},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"> (greater than) Transitions","name":"transitiondef-> (greater than)","index":29},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To > (greater than)","name":"to-> (greater than)","group":"Go to state","index":30},{"plug":"output","type":"boolean","displayName":"At > (greater than)","name":"at-> (greater than)","group":"Current state","index":31},{"plug":"output","type":"signal","displayName":"Has Reached > (greater than)","name":"reached-> (greater than)","group":"Current state","index":32},{"plug":"input","type":"string","group":">= (greater than or equal to) Values","name":"value->= (greater than or equal to)-value","displayName":"value","editorName":">= (greater than or equal to)|value","index":33},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":">= (greater than or equal to) Transitions","name":"transitiondef->= (greater than or equal to)","index":34},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To >= (greater than or equal to)","name":"to->= (greater than or equal to)","group":"Go to state","index":35},{"plug":"output","type":"boolean","displayName":"At >= (greater than or equal to)","name":"at->= (greater than or equal to)","group":"Current state","index":36},{"plug":"output","type":"signal","displayName":"Has Reached >= (greater than or equal to)","name":"reached->= (greater than or equal to)","group":"Current state","index":37},{"plug":"input","type":"string","group":"array-contains Values","name":"value-array-contains-value","displayName":"value","editorName":"array-contains|value","index":38},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"array-contains Transitions","name":"transitiondef-array-contains","index":39},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To array-contains","name":"to-array-contains","group":"Go to state","index":40},{"plug":"output","type":"boolean","displayName":"At array-contains","name":"at-array-contains","group":"Current state","index":41},{"plug":"output","type":"signal","displayName":"Has Reached array-contains","name":"reached-array-contains","group":"Current state","index":42},{"plug":"input","type":"string","group":"array-contains-any Values","name":"value-array-contains-any-value","displayName":"value","editorName":"array-contains-any|value","index":43},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"array-contains-any Transitions","name":"transitiondef-array-contains-any","index":44},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To array-contains-any","name":"to-array-contains-any","group":"Go to state","index":45},{"plug":"output","type":"boolean","displayName":"At array-contains-any","name":"at-array-contains-any","group":"Current state","index":46},{"plug":"output","type":"signal","displayName":"Has Reached array-contains-any","name":"reached-array-contains-any","group":"Current state","index":47},{"plug":"input","type":"string","group":"in Values","name":"value-in-value","displayName":"value","editorName":"in|value","index":48},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"in Transitions","name":"transitiondef-in","index":49},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To in","name":"to-in","group":"Go to state","index":50},{"plug":"output","type":"boolean","displayName":"At in","name":"at-in","group":"Current state","index":51},{"plug":"output","type":"signal","displayName":"Has Reached in","name":"reached-in","group":"Current state","index":52},{"plug":"input","type":"string","group":"not-in Values","name":"value-not-in-value","displayName":"value","editorName":"not-in|value","index":53},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"not-in Transitions","name":"transitiondef-not-in","index":54},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To not-in","name":"to-not-in","group":"Go to state","index":55},{"plug":"output","type":"boolean","displayName":"At not-in","name":"at-not-in","group":"Current state","index":56},{"plug":"output","type":"signal","displayName":"Has Reached not-in","name":"reached-not-in","group":"Current state","index":57},{"plug":"input","type":"string","group":"none Values","name":"value-none-value","displayName":"value","editorName":"none|value","index":58},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"none Transitions","name":"transitiondef-none","index":59},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To none","name":"to-none","group":"Go to state","index":60},{"plug":"output","type":"boolean","displayName":"At none","name":"at-none","group":"Current state","index":61},{"plug":"output","type":"signal","displayName":"Has Reached none","name":"reached-none","group":"Current state","index":62},{"plug":"input","type":{"name":"enum","enums":["== (equal to)","!= (not equal to)","< (less than)","<= (less than or equal to)","> (greater than)",">= (greater than or equal to)","array-contains","array-contains-any","in","not-in","none"]},"group":"States","displayName":"State","name":"currentState","default":"== (equal to)","index":63}],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/CRUD Document(s) in a Collection/Update Entire Firebase Array","id":"14fb4eb0-ce48-300c-a848-c682dd29a3f3","graph":{"connections":[{"fromId":"800d1703-b110-ecaf-1999-902de5bf1beb","fromProperty":"out-Success","toId":"dc7ea100-86ed-f116-4c74-22eb4bb1d5f3","toProperty":"Success"},{"fromId":"800d1703-b110-ecaf-1999-902de5bf1beb","fromProperty":"out-Failure","toId":"dc7ea100-86ed-f116-4c74-22eb4bb1d5f3","toProperty":"Failure"},{"fromId":"2a535e80-3507-93a5-0aa2-12479eee7d8b","fromProperty":"Do","toId":"800d1703-b110-ecaf-1999-902de5bf1beb","toProperty":"run"},{"fromId":"2a535e80-3507-93a5-0aa2-12479eee7d8b","fromProperty":"collectionName","toId":"27eede07-eff7-ca60-8444-3aa01b554cba","toProperty":"value"},{"fromId":"27eede07-eff7-ca60-8444-3aa01b554cba","fromProperty":"savedValue","toId":"800d1703-b110-ecaf-1999-902de5bf1beb","toProperty":"in-collectionName"},{"fromId":"2a535e80-3507-93a5-0aa2-12479eee7d8b","fromProperty":"firebaseDocId","toId":"4713900e-b636-c0ef-9cfd-a824ee919180","toProperty":"value"},{"fromId":"4713900e-b636-c0ef-9cfd-a824ee919180","fromProperty":"savedValue","toId":"800d1703-b110-ecaf-1999-902de5bf1beb","toProperty":"in-firebaseDocId"},{"fromId":"2a535e80-3507-93a5-0aa2-12479eee7d8b","fromProperty":"arrayFieldName","toId":"53f645da-0e99-65e8-4c40-8598f45e9e3c","toProperty":"value"},{"fromId":"53f645da-0e99-65e8-4c40-8598f45e9e3c","fromProperty":"savedValue","toId":"800d1703-b110-ecaf-1999-902de5bf1beb","toProperty":"in-arrayFieldName"},{"fromId":"2a535e80-3507-93a5-0aa2-12479eee7d8b","fromProperty":"arrayId","toId":"d113669b-644a-d64a-64c3-c58703948917","toProperty":"value"},{"fromId":"d113669b-644a-d64a-64c3-c58703948917","fromProperty":"savedValue","toId":"800d1703-b110-ecaf-1999-902de5bf1beb","toProperty":"in-arrayId"}],"roots":[{"id":"2a535e80-3507-93a5-0aa2-12479eee7d8b","type":"Component Inputs","x":-249,"y":-5,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"collectionName","plug":"output","type":{"name":"*"},"index":1},{"name":"firebaseDocId","plug":"output","type":{"name":"*"},"index":2},{"name":"arrayFieldName","plug":"output","type":{"name":"*"},"index":3},{"name":"arrayId","plug":"output","type":{"name":"*"},"index":4}],"dynamicports":[],"children":[]},{"id":"dc7ea100-86ed-f116-4c74-22eb4bb1d5f3","type":"Component Outputs","x":387,"y":69,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1}],"dynamicports":[],"children":[]},{"id":"800d1703-b110-ecaf-1999-902de5bf1beb","type":"JavaScriptFunction","x":176.66666666666663,"y":-8,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseApp)) {\r\n console.error(\"Firebase client is not set up.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nconst db = Noodl.Variables.firebaseDb;\r\nif (!db) {\r\n console.error(\"Firebase DB is not initialized.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nif (!Inputs.collectionName || !Inputs.firebaseDocId || !Inputs.arrayFieldName) {\r\n console.error(\"Required input(s) missing: collection name, document ID, or array field name.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nfunction toPlainObject(obj) {\r\n if (typeof obj !== 'object' || obj === null) return obj;\r\n if (Array.isArray(obj)) {\r\n return obj.map(toPlainObject); // Apply conversion recursively to array elements\r\n }\r\n const plainObj = {};\r\n Object.keys(obj).forEach(key => {\r\n const value = obj[key];\r\n if (value === undefined) {\r\n plainObj[key] = null;\r\n } else if (typeof value === 'object' && value !== null) {\r\n plainObj[key] = toPlainObject(value); // Recurse for nested objects\r\n } else {\r\n plainObj[key] = value;\r\n }\r\n });\r\n return plainObj;\r\n}\r\n\r\n// Noodl.Arrays[Inputs.arrayId] contains the new array to replace the existing one\r\nconst newNoodlArray = Noodl.Arrays[Inputs.arrayId];\r\nconst newArray = newNoodlArray.map(item => toPlainObject(item)); // Convert each item in the Noodl array\r\n\r\nconsole.log(`Attempting to update the array field '${Inputs.arrayFieldName}' in document:`, Inputs.firebaseDocId, \"within collection:\", Inputs.collectionName);\r\n\r\nasync function updateEntireArray(collectionName, docId, arrayFieldName, newArray) {\r\n const docRef = window.doc(db, collectionName, docId);\r\n const updateData = {};\r\n updateData[arrayFieldName] = newArray; // Prepare the update data to replace the entire array\r\n\r\n try {\r\n await window.updateDoc(docRef, updateData);\r\n console.log(`${arrayFieldName} array updated successfully`);\r\n Outputs.Success();\r\n } catch (error) {\r\n console.error(`Error updating ${arrayFieldName} array:`, error);\r\n Outputs.Failure();\r\n }\r\n}\r\n\r\n// Call the function with inputs\r\nupdateEntireArray(Inputs.collectionName, Inputs.firebaseDocId, Inputs.arrayFieldName, newArray);"},"ports":[],"dynamicports":[{"name":"in-collectionName","displayName":"collectionName","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-firebaseDocId","displayName":"firebaseDocId","plug":"input","type":"*","group":"Inputs","index":5},{"name":"in-arrayFieldName","displayName":"arrayFieldName","plug":"input","type":"*","group":"Inputs","index":6},{"name":"in-arrayId","displayName":"arrayId","plug":"input","type":"*","group":"Inputs","index":7},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":8},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":9}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"27eede07-eff7-ca60-8444-3aa01b554cba","type":"String","x":-26.111111111111086,"y":-86.33333333333331,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"4713900e-b636-c0ef-9cfd-a824ee919180","type":"String","x":-25.194444444444457,"y":52.416666666666686,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"53f645da-0e99-65e8-4c40-8598f45e9e3c","type":"String","x":-24.06111111111113,"y":169.81666666666666,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"d113669b-644a-d64a-64c3-c58703948917","type":"String","x":-23.28333333333336,"y":285.81666666666666,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/CRUD Document(s) in a Collection/Update Entire Firebase Document","id":"b4c1aa0b-1209-c61c-e962-73856314bae1","graph":{"connections":[{"fromId":"83a71a5e-074f-b163-9c3e-a754ba846a47","fromProperty":"out-Success","toId":"7db56d29-4e40-f090-f411-03d398740868","toProperty":"Success"},{"fromId":"83a71a5e-074f-b163-9c3e-a754ba846a47","fromProperty":"out-Failure","toId":"7db56d29-4e40-f090-f411-03d398740868","toProperty":"Failure"},{"fromId":"7ec259c3-c822-d1b5-2f57-7d8cdad075c8","fromProperty":"Do","toId":"83a71a5e-074f-b163-9c3e-a754ba846a47","toProperty":"run"},{"fromId":"7ec259c3-c822-d1b5-2f57-7d8cdad075c8","fromProperty":"collectionName","toId":"d9c50fd6-b9f4-78ba-081a-6b9097336d12","toProperty":"value"},{"fromId":"d9c50fd6-b9f4-78ba-081a-6b9097336d12","fromProperty":"savedValue","toId":"83a71a5e-074f-b163-9c3e-a754ba846a47","toProperty":"in-collectionName"},{"fromId":"7ec259c3-c822-d1b5-2f57-7d8cdad075c8","fromProperty":"firebaseDocId","toId":"749da18a-bdf1-2c99-db68-5458c446648d","toProperty":"value"},{"fromId":"749da18a-bdf1-2c99-db68-5458c446648d","fromProperty":"savedValue","toId":"83a71a5e-074f-b163-9c3e-a754ba846a47","toProperty":"in-firebaseDocId"},{"fromId":"7ec259c3-c822-d1b5-2f57-7d8cdad075c8","fromProperty":"merge","toId":"6823cdfb-cdb4-461a-e85f-766cdbfd184b","toProperty":"value"},{"fromId":"6823cdfb-cdb4-461a-e85f-766cdbfd184b","fromProperty":"savedValue","toId":"83a71a5e-074f-b163-9c3e-a754ba846a47","toProperty":"in-merge"},{"fromId":"7ec259c3-c822-d1b5-2f57-7d8cdad075c8","fromProperty":"objectId","toId":"83a71a5e-074f-b163-9c3e-a754ba846a47","toProperty":"in-objectId"}],"roots":[{"id":"7ec259c3-c822-d1b5-2f57-7d8cdad075c8","type":"Component Inputs","x":-235,"y":2,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"collectionName","plug":"output","type":{"name":"*"},"index":1},{"name":"firebaseDocId","plug":"output","type":{"name":"*"},"index":2},{"name":"merge","plug":"output","type":{"name":"*"},"index":3},{"name":"objectId","plug":"output","type":{"name":"*"},"index":4}],"dynamicports":[],"children":[]},{"id":"7db56d29-4e40-f090-f411-03d398740868","type":"Component Outputs","x":398,"y":37,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1}],"dynamicports":[],"children":[]},{"id":"83a71a5e-074f-b163-9c3e-a754ba846a47","type":"JavaScriptFunction","x":170.66666666666663,"y":-8,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseApp)) {\r\n console.error(\"Firebase client is not set up.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nconst db = Noodl.Variables.firebaseDb;\r\nif (!db) {\r\n console.error(\"Firebase DB is not initialized.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nif (!Inputs.collectionName || !Inputs.firebaseDocId) {\r\n console.error(\"Collection name or document ID is not specified.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nfunction toPlainObject(obj) {\r\n if (typeof obj !== 'object' || obj === null) return obj;\r\n if (Array.isArray(obj)) {\r\n return obj.map(toPlainObject);\r\n }\r\n const plainObj = {};\r\n Object.keys(obj).forEach(key => {\r\n const value = obj[key];\r\n if (value === undefined) {\r\n plainObj[key] = null; // Convert undefined to null\r\n } else if (typeof value === 'object' && value !== null) {\r\n plainObj[key] = toPlainObject(value); // Recurse for nested objects\r\n } else {\r\n plainObj[key] = value; // Copy value directly\r\n }\r\n });\r\n return plainObj;\r\n}\r\n\r\n// toPlainObject ensures all Noodl Object values are Firestore-compatible\r\nconst updateObject = toPlainObject(Noodl.Objects[Inputs.objectId]);\r\n// Add updatedAt timestamp to the updateObject\r\nupdateObject.updatedAt = window.serverTimestamp();\r\n\r\nconsole.log(\"Attempting to update document in collection:\", Inputs.collectionName, \"with ID:\", Inputs.firebaseDocId);\r\n\r\ntry {\r\n const docRef = window.doc(db, Inputs.collectionName, Inputs.firebaseDocId);\r\n // Dynamically decide whether to merge based on Inputs.merge\r\n if (Inputs.merge) {\r\n // If merge is true, update the document and merge fields (won't delete fields or items in arrays)\r\n await window.updateDoc(docRef, updateObject);\r\n console.log(\"Document fields merged successfully\");\r\n } else {\r\n // If merge is false, replace the entire document (useful for deleting fields or items in arrays)\r\n await window.setDoc(docRef, updateObject);\r\n console.log(\"Document successfully replaced or updated\");\r\n }\r\n\r\n Outputs.Success();\r\n} catch (error) {\r\n console.error(\"Error updating document:\", error);\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"in-collectionName","displayName":"collectionName","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-firebaseDocId","displayName":"firebaseDocId","plug":"input","type":"*","group":"Inputs","index":5},{"name":"in-objectId","displayName":"objectId","plug":"input","type":"*","group":"Inputs","index":6},{"name":"in-merge","displayName":"merge","plug":"input","type":"*","group":"Inputs","index":7},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":8},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":9}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"d9c50fd6-b9f4-78ba-081a-6b9097336d12","type":"String","x":-28.111111111111086,"y":-57.333333333333314,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"749da18a-bdf1-2c99-db68-5458c446648d","type":"String","x":-46.19444444444446,"y":43.416666666666686,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"6823cdfb-cdb4-461a-e85f-766cdbfd184b","type":"Boolean","x":-32.72777777777776,"y":164.81666666666666,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/CRUD Document(s) in a Collection/Update Firebase Object Field Values","id":"a0407e12-f5fe-7cf1-3d97-f9b6e2dc4948","graph":{"connections":[{"fromId":"9b53786e-f4d6-64a0-ae22-dc6d273a0a36","fromProperty":"out-Success","toId":"c56cbcb9-801d-7504-4d5b-1394128f0d2c","toProperty":"Success"},{"fromId":"9b53786e-f4d6-64a0-ae22-dc6d273a0a36","fromProperty":"out-Failure","toId":"c56cbcb9-801d-7504-4d5b-1394128f0d2c","toProperty":"Failure"},{"fromId":"5837050e-584b-004b-89ed-a59d9a786718","fromProperty":"Do","toId":"9b53786e-f4d6-64a0-ae22-dc6d273a0a36","toProperty":"run"},{"fromId":"5837050e-584b-004b-89ed-a59d9a786718","fromProperty":"collectionName","toId":"12a1b8bc-5cfb-d7e9-57c2-b09641092c27","toProperty":"value"},{"fromId":"12a1b8bc-5cfb-d7e9-57c2-b09641092c27","fromProperty":"savedValue","toId":"9b53786e-f4d6-64a0-ae22-dc6d273a0a36","toProperty":"in-collectionName"},{"fromId":"5837050e-584b-004b-89ed-a59d9a786718","fromProperty":"firebaseDocId","toId":"9bd52174-b4ac-5ece-c316-b2f88893c14b","toProperty":"value"},{"fromId":"5837050e-584b-004b-89ed-a59d9a786718","fromProperty":"objectId","toId":"9b53786e-f4d6-64a0-ae22-dc6d273a0a36","toProperty":"in-objectId"},{"fromId":"9bd52174-b4ac-5ece-c316-b2f88893c14b","fromProperty":"savedValue","toId":"9b53786e-f4d6-64a0-ae22-dc6d273a0a36","toProperty":"in-firebaseDocId"}],"roots":[{"id":"5837050e-584b-004b-89ed-a59d9a786718","type":"Component Inputs","x":-217,"y":5,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"collectionName","plug":"output","type":{"name":"*"},"index":1},{"name":"firebaseDocId","plug":"output","type":{"name":"*"},"index":2},{"name":"objectId","plug":"output","type":{"name":"*"},"index":3}],"dynamicports":[],"children":[]},{"id":"c56cbcb9-801d-7504-4d5b-1394128f0d2c","type":"Component Outputs","x":398,"y":37,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1}],"dynamicports":[],"children":[]},{"id":"9b53786e-f4d6-64a0-ae22-dc6d273a0a36","type":"JavaScriptFunction","x":170.66666666666663,"y":-8,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseApp)) {\r\n console.error(\"Firebase client is not set up.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nconst db = Noodl.Variables.firebaseDb;\r\nif (!db) {\r\n console.error(\"Firebase DB is not initialized.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nif (!Inputs.collectionName || !Inputs.firebaseDocId) {\r\n console.error(\"Collection name or document ID is not specified.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nfunction toPlainObject(obj) {\r\n if (typeof obj !== 'object' || obj === null) return obj;\r\n if (Array.isArray(obj)) {\r\n return obj.map(toPlainObject);\r\n }\r\n const plainObj = {};\r\n Object.keys(obj).forEach(key => {\r\n const value = obj[key];\r\n if (value === undefined) {\r\n plainObj[key] = null; // Convert undefined to null\r\n } else if (typeof value === 'object' && value !== null) {\r\n plainObj[key] = toPlainObject(value); // Recurse for nested objects\r\n } else {\r\n plainObj[key] = value; // Copy value directly\r\n }\r\n });\r\n return plainObj;\r\n}\r\n\r\n// toPlainObject converts the Noodl Object\r\n// Inputs.objectId should be a flattened JSON object representing the fields to update\r\n// For example: { \"name\": \"John Doe\", \"address.city\": \"New City\" }\r\n// Nested fields can be used using dot notation as shown above\r\n// Inputs.objectId is the same as the ID in Noodl.Objects and used to reference the update object\r\nconst updateObject = toPlainObject(Noodl.Objects[Inputs.objectId]);\r\n\r\nconsole.log(\"Attempting to update document in collection:\", Inputs.collectionName, \"with ID:\", Inputs.firebaseDocId);\r\n\r\ntry {\r\n const docRef = window.doc(db, Inputs.collectionName, Inputs.firebaseDocId);\r\n await window.updateDoc(docRef, updateObject);\r\n\r\n console.log(\"Document successfully updated\");\r\n Outputs.Success();\r\n} catch (error) {\r\n console.error(\"Error updating document:\", error);\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"in-collectionName","displayName":"collectionName","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-firebaseDocId","displayName":"firebaseDocId","plug":"input","type":"*","group":"Inputs","index":5},{"name":"in-objectId","displayName":"objectId","plug":"input","type":"*","group":"Inputs","index":6},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":7},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":8}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"12a1b8bc-5cfb-d7e9-57c2-b09641092c27","type":"String","x":-28.111111111111086,"y":-57.333333333333314,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"9bd52174-b4ac-5ece-c316-b2f88893c14b","type":"String","x":-22.194444444444457,"y":137.41666666666669,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/Delete Account/Confirm Delete Popup","id":"33f767de-e64d-b101-f9cc-f9ead7303b76","graph":{"connections":[{"fromId":"c78c6c7f-f401-2e53-1a86-946fa33a065f","fromProperty":"formatted","toId":"a5096f00-5c30-996e-908c-c573cdbc9e4d","toProperty":"text"},{"fromId":"bc4f387b-3371-a1b3-0dd7-5b27e129525f","fromProperty":"prop-email","toId":"c78c6c7f-f401-2e53-1a86-946fa33a065f","toProperty":"email"},{"fromId":"106ed29a-e2d4-9806-4ed6-cfd75844131e","fromProperty":"onClick","toId":"1a7979e9-e1b6-a1ae-cb7a-ce594e43e255","toProperty":"closeAction-User Confirmed"},{"fromId":"d6e98109-cf5c-5638-7e71-d8cae9a7cae0","fromProperty":"onClick","toId":"1a7979e9-e1b6-a1ae-cb7a-ce594e43e255","toProperty":"closeAction-User Cancelled"}],"roots":[{"id":"67c590cc-9314-8ac2-abaf-ad5d5fc94ca3","type":"Group","x":0,"y":0,"parameters":{"alignX":"center","alignItems":"center","paddingTop":{"value":16,"unit":"px"},"backgroundColor":"White"},"ports":[],"dynamicports":[],"children":[{"id":"a5096f00-5c30-996e-908c-c573cdbc9e4d","type":"Text","parameters":{"text":"","textAlignX":"center","marginBottom":{"value":16,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"480bc785-6586-6eb8-8f87-d85ac979b469","type":"Group","parameters":{"flexDirection":"row","justifyContent":"space-evenly"},"ports":[],"dynamicports":[],"children":[{"id":"106ed29a-e2d4-9806-4ed6-cfd75844131e","type":"net.noodl.controls.button","parameters":{"label":"Confirm","marginTop":{"value":0,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"d6e98109-cf5c-5638-7e71-d8cae9a7cae0","type":"net.noodl.controls.button","parameters":{"label":"Cancel"},"ports":[],"dynamicports":[],"children":[]}]}]},{"id":"c78c6c7f-f401-2e53-1a86-946fa33a065f","type":"String Format","x":-191.83333333333337,"y":31.833333333333314,"parameters":{"format":"You are about to delete the account associated to {email}.\nThis action is irreversible, please confirm."},"ports":[],"dynamicports":[{"name":"email","type":"string","plug":"input","index":2}],"children":[]},{"id":"bc4f387b-3371-a1b3-0dd7-5b27e129525f","type":"Model2","x":-421.58333333333337,"y":15.583333333333314,"parameters":{"modelId":"currentUser","properties":"email"},"ports":[],"dynamicports":[{"type":{"name":"*","allowConnectionsOnly":true},"plug":"input/output","group":"Properties","name":"prop-email","displayName":"email","index":7},{"type":"signal","plug":"output","group":"Changed Events","displayName":"email Changed","name":"changed-email","index":8}],"children":[]},{"id":"1a7979e9-e1b6-a1ae-cb7a-ce594e43e255","type":"NavigationClosePopup","x":297.52083333333326,"y":216.47916666666666,"parameters":{"closeActions":"User Confirmed,User Cancelled"},"ports":[],"dynamicports":[{"type":"signal","plug":"input","group":"Close Actions","name":"closeAction-User Confirmed","displayName":"User Confirmed","index":3},{"type":"signal","plug":"input","group":"Close Actions","name":"closeAction-User Cancelled","displayName":"User Cancelled","index":4}],"children":[]}],"visualRoots":["67c590cc-9314-8ac2-abaf-ad5d5fc94ca3"]}},{"name":"/Firebase/Delete Account/Delete Account","id":"dc13f9de-218c-e2b5-bb36-abcdc92944b8","graph":{"connections":[{"fromId":"9977d53b-c465-5fb0-9f5b-22b90b0a8c7e","fromProperty":"Success","toId":"bf0ca3a3-3d95-4c52-d24b-1f795639298c","toProperty":"navigate"},{"fromId":"7c4509c5-800a-c49d-59c5-881427db7979","fromProperty":"onTextChanged","toId":"b7d93e84-110a-8058-8252-fbbd908d108b","toProperty":"in-email"},{"fromId":"70a8fab9-f741-7353-42a5-4e25ee9f147a","fromProperty":"onTextChanged","toId":"b7d93e84-110a-8058-8252-fbbd908d108b","toProperty":"in-password"},{"fromId":"edfda6fc-bd1b-c7cf-6550-971e73f9ce5a","fromProperty":"onClick","toId":"b7d93e84-110a-8058-8252-fbbd908d108b","toProperty":"run"},{"fromId":"9977d53b-c465-5fb0-9f5b-22b90b0a8c7e","fromProperty":"isReauthRequired","toId":"04076ef8-8ea1-283b-b651-929b05428770","toProperty":"mounted"},{"fromId":"b7d93e84-110a-8058-8252-fbbd908d108b","fromProperty":"out-Success","toId":"9977d53b-c465-5fb0-9f5b-22b90b0a8c7e","toProperty":"Do"},{"fromId":"9977d53b-c465-5fb0-9f5b-22b90b0a8c7e","fromProperty":"isReauthRequired","toId":"dbd8e9d9-136b-38f6-67db-fc59d6f4a016","toProperty":"value"},{"fromId":"dbd8e9d9-136b-38f6-67db-fc59d6f4a016","fromProperty":"result","toId":"5f001e4c-dbd6-ba7a-df6c-8e7e09b4b4bb","toProperty":"mounted"},{"fromId":"5f001e4c-dbd6-ba7a-df6c-8e7e09b4b4bb","fromProperty":"onClick","toId":"561d7cb9-a49d-2823-06b6-62974c3dd99e","toProperty":"show"},{"fromId":"561d7cb9-a49d-2823-06b6-62974c3dd99e","fromProperty":"closeAction-User Confirmed","toId":"9977d53b-c465-5fb0-9f5b-22b90b0a8c7e","toProperty":"Do"},{"fromId":"561d7cb9-a49d-2823-06b6-62974c3dd99e","fromProperty":"closeAction-User Cancelled","toId":"bf0ca3a3-3d95-4c52-d24b-1f795639298c","toProperty":"navigate"}],"roots":[{"id":"ffee13f2-7fc5-c349-0bb5-fef67d776fb1","type":"Page","x":0,"y":0,"parameters":{},"ports":[],"dynamicports":[{"name":"title","displayName":"Title","type":"string","group":"General","plug":"input","default":"Delete Account","index":31},{"name":"urlPath","displayName":"Url Path","type":"string","group":"General","plug":"input","default":"delete-account","index":32}],"children":[{"id":"39d13239-b39a-d166-fde8-e9816f69e2db","type":"Group","parameters":{"marginTop":{"value":24,"unit":"px"},"marginLeft":{"value":24,"unit":"px"}},"ports":[],"dynamicports":[],"children":[{"id":"5f001e4c-dbd6-ba7a-df6c-8e7e09b4b4bb","type":"net.noodl.controls.button","parameters":{"label":"Delete account"},"ports":[],"dynamicports":[],"children":[]}]},{"id":"04076ef8-8ea1-283b-b651-929b05428770","type":"Group","label":"Eml-pwd inputs","parameters":{"mounted":false},"ports":[],"dynamicports":[],"children":[{"id":"a091ceeb-5c6a-f16f-ac1c-64bf2c2cccc5","type":"Text","label":"Alert text","parameters":{"text":"This action requires reauthentication","color":"Danger"},"ports":[],"dynamicports":[],"children":[]},{"id":"7c4509c5-800a-c49d-59c5-881427db7979","type":"net.noodl.controls.textinput","label":"Email Input","parameters":{"label":"","type":"email","placeholder":"Email","marginBottom":{"value":8,"unit":"px"},"useLabel":false,"mounted":true},"ports":[],"dynamicports":[],"children":[]},{"id":"70a8fab9-f741-7353-42a5-4e25ee9f147a","type":"net.noodl.controls.textinput","label":"Password Input","parameters":{"placeholder":"Password","useLabel":false,"mounted":true},"ports":[],"dynamicports":[],"children":[]},{"id":"edfda6fc-bd1b-c7cf-6550-971e73f9ce5a","type":"net.noodl.controls.button","parameters":{"label":"Authenticate","mounted":true},"ports":[],"dynamicports":[],"children":[]}]}]},{"id":"1f7b1345-2185-4db5-7cc0-40d9eb0a4762","type":"PageInputs","x":-100,"y":-50,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"9977d53b-c465-5fb0-9f5b-22b90b0a8c7e","type":"/Firebase/Delete Account/Firebase - User Delete","x":594,"y":278,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"bf0ca3a3-3d95-4c52-d24b-1f795639298c","type":"RouterNavigate","label":"To signup-login","x":837,"y":177.00000000000003,"parameters":{"router":"Firebase Main","target":"/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd"},"ports":[],"dynamicports":[{"plug":"input","type":{"name":"component","title":"Choose page component","components":["/Firebase/Start Page","/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd","/Firebase/Password Reset/Reset Firebase Password","/Firebase/Verify & Update Email/Update Firebase Email","/Firebase/User Auth/Sign-out","/Firebase/Delete Account/Delete Account","/Firebase/example-page"],"allowEditOnly":true},"group":"General","displayName":"Target Page","name":"target","index":3}],"children":[]},{"id":"b7d93e84-110a-8058-8252-fbbd908d108b","type":"JavaScriptFunction","label":"reauthenticateWithCredential","x":322,"y":370,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseAuth)) {\r\n console.error(\"Firebase Auth is not configured!\");\r\n Outputs.Failure();\r\n return; // Stops the function if Firebase Auth is not initialized\r\n}\r\n\r\nconst user = Noodl.Variables.firebaseAuth.currentUser;\r\nconst email = Inputs.email; // Assume email and password are provided through Noodl Inputs\r\nconst password = Inputs.password;\r\nconst credential = window.EmailAuthProvider.credential(email, password);\r\n\r\n// Re-authenticate user\r\nwindow.reauthenticateWithCredential(user, credential)\r\n .then(() => {\r\n console.log(\"User re-authenticated.\");\r\n Outputs.Success();\r\n })\r\n .catch((error) => {\r\n console.error(\"Error re-authenticating user: \", error);\r\n switch (error.code) {\r\n case \"auth/user-mismatch\":\r\n Outputs.error = \"The provided credentials do not match the logged-in user.\";\r\n break;\r\n case \"auth/user-not-found\":\r\n Outputs.error = \"No user corresponding to the provided credentials could be found.\";\r\n break;\r\n case \"auth/invalid-credential\":\r\n Outputs.error = \"The provided credential is invalid.\";\r\n break;\r\n case \"auth/invalid-email\":\r\n Outputs.error = \"The email address is not valid.\";\r\n break;\r\n case \"auth/wrong-password\":\r\n Outputs.error = \"Wrong password.\";\r\n break;\r\n default:\r\n Outputs.error = \"An error occurred during re-authentication.\";\r\n }\r\n Outputs.Failure();\r\n });"},"ports":[],"dynamicports":[{"name":"in-email","displayName":"email","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-password","displayName":"password","plug":"input","type":"*","group":"Inputs","index":5},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":7},{"name":"out-error","displayName":"error","plug":"output","type":"*","group":"Outputs","index":8}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"dbd8e9d9-136b-38f6-67db-fc59d6f4a016","type":"Inverter","x":315,"y":225,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"561d7cb9-a49d-2823-06b6-62974c3dd99e","type":"NavigationShowPopup","x":314.25,"y":102.79166666666669,"parameters":{"target":"/Firebase/Delete Account/Confirm Delete Popup"},"ports":[],"dynamicports":[{"name":"closeAction-User Confirmed","displayName":"User Confirmed","type":"signal","plug":"output","group":"Close Actions","index":3},{"name":"closeAction-User Cancelled","displayName":"User Cancelled","type":"signal","plug":"output","group":"Close Actions","index":4}],"children":[]}],"visualRoots":["ffee13f2-7fc5-c349-0bb5-fef67d776fb1"]}},{"name":"/Firebase/Delete Account/Firebase - User Delete","id":"f2c45ac9-a1ca-e8dc-4c97-e741d178d51b","graph":{"connections":[{"fromId":"4da46812-5ad1-cd20-d2ec-682ff2205feb","fromProperty":"Do","toId":"a91eb982-83ac-8601-7c5e-b23f6d53c1c3","toProperty":"run"},{"fromId":"a91eb982-83ac-8601-7c5e-b23f6d53c1c3","fromProperty":"out-Success","toId":"e42252e6-ca0f-5c1d-6949-d8add025823a","toProperty":"Success"},{"fromId":"a91eb982-83ac-8601-7c5e-b23f6d53c1c3","fromProperty":"out-Failure","toId":"e42252e6-ca0f-5c1d-6949-d8add025823a","toProperty":"Failure"},{"fromId":"a91eb982-83ac-8601-7c5e-b23f6d53c1c3","fromProperty":"out-isReauthRequired","toId":"e42252e6-ca0f-5c1d-6949-d8add025823a","toProperty":"isReauthRequired"}],"roots":[{"id":"4da46812-5ad1-cd20-d2ec-682ff2205feb","type":"Component Inputs","x":-63,"y":-38,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0}],"dynamicports":[],"children":[]},{"id":"e42252e6-ca0f-5c1d-6949-d8add025823a","type":"Component Outputs","x":339,"y":-47,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"isReauthRequired","plug":"input","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"a91eb982-83ac-8601-7c5e-b23f6d53c1c3","type":"JavaScriptFunction","label":"Delete user","x":141,"y":-51,"parameters":{"functionScript":"const user = Noodl.Variables.firebaseAuth.currentUser;\r\n\r\nif (user) {\r\n user.delete().then(() => {\r\n console.log(\"User account deleted successfully.\");\r\n Noodl.Objects.currentUser.fill(null); // Empty the currentUser object upon successful deletion\r\n Outputs.Success();\r\n }).catch((error) => {\r\n console.error(\"Error deleting user account:\", error);\r\n if (error.code === \"auth/requires-recent-login\") {\r\n console.error(\"User re-authentication required.\");\r\n Outputs.isReauthRequired = true; // Signal to the UI that re-authentication is required\r\n Outputs.Failure(); // Optionally, you might want to call Failure here or handle it differently\r\n } else {\r\n Outputs.error = \"Failed to delete user account.\";\r\n Outputs.Failure();\r\n }\r\n });\r\n} else {\r\n console.error(\"No user is currently signed in.\");\r\n Outputs.error = \"No user is currently signed in.\";\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":4},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-isReauthRequired","displayName":"isReauthRequired","plug":"output","type":"*","group":"Outputs","index":6},{"name":"out-error","displayName":"error","plug":"output","type":"*","group":"Outputs","index":7}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[]}},{"name":"/Firebase/Email Verification/Firebase - Send Email Verification","id":"bdd1ad8b-5213-a84d-aef5-1ab156b71cb7","graph":{"connections":[{"fromId":"b8ccf245-1af3-dc3f-4426-889c58c278c9","fromProperty":"Do","toId":"ffda7497-6c8c-52c9-32f5-3c5146428b82","toProperty":"run"},{"fromId":"ffda7497-6c8c-52c9-32f5-3c5146428b82","fromProperty":"out-Failure","toId":"8eb6acd7-0e12-9be4-00e1-421aba59176a","toProperty":"Failure"},{"fromId":"ffda7497-6c8c-52c9-32f5-3c5146428b82","fromProperty":"out-Success","toId":"8eb6acd7-0e12-9be4-00e1-421aba59176a","toProperty":"Success"},{"fromId":"ffda7497-6c8c-52c9-32f5-3c5146428b82","fromProperty":"out-error","toId":"8eb6acd7-0e12-9be4-00e1-421aba59176a","toProperty":"Error"}],"roots":[{"id":"b8ccf245-1af3-dc3f-4426-889c58c278c9","type":"Component Inputs","x":-114,"y":-75,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0}],"dynamicports":[],"children":[]},{"id":"8eb6acd7-0e12-9be4-00e1-421aba59176a","type":"Component Outputs","x":336,"y":-69,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"Error","plug":"input","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"ffda7497-6c8c-52c9-32f5-3c5146428b82","type":"JavaScriptFunction","label":"sendEmailVerification","x":105.66666666666663,"y":-91,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseAuth)) {\r\n console.error(\"Firebase Auth is not configured!\");\r\n return; // Stops the function if Firebase Auth servie is not initialized\r\n}\r\n\r\n// Use the Firebase Auth Variables to access the current user\r\nconst user = Noodl.Variables.firebaseAuth.currentUser;\r\n\r\nif (user) {\r\n // Call sendEmailVerification for the current user\r\n window.sendEmailVerification(user)\r\n .then(() => {\r\n console.log(\"Verification email sent.\");\r\n Outputs.Success();\r\n })\r\n .catch((error) => {\r\n console.error(\"Error sending email verification: \", error);\r\n // Handle specific errors with Outputs.error\r\n switch (error.code) {\r\n case \"auth/invalid-user-token\":\r\n Outputs.error = \"Invalid user token\";\r\n break;\r\n case \"auth/user-disabled\":\r\n Outputs.error = \"User disabled\";\r\n break;\r\n default:\r\n Outputs.error = \"Email verification send failed\";\r\n }\r\n Outputs.Failure();\r\n });\r\n} else {\r\n console.log(\"No signed-in user to send verification to.\");\r\n Outputs.error = \"No signed-in user\";\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":4},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-error","displayName":"error","plug":"output","type":"*","group":"Outputs","index":6}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[]}},{"name":"/Firebase/Email Verification/Firebase - Sent Email Verif Popup","id":"40b1b334-412e-8946-da23-4be927bb1ac0","graph":{"connections":[{"fromId":"8067ca8c-5c20-1469-972c-0bf80d66a985","fromProperty":"prop-providerData","toId":"e8bb195c-4eb9-da94-da32-4b11cb9480f5","toProperty":"providerData"},{"fromId":"40e6767d-902c-4f3b-c9f5-a3332af79bbd","fromProperty":"formatted","toId":"a1378d19-2a11-2758-c91b-f14c6241c2bb","toProperty":"text"},{"fromId":"e8bb195c-4eb9-da94-da32-4b11cb9480f5","fromProperty":"result","toId":"40e6767d-902c-4f3b-c9f5-a3332af79bbd","toProperty":"userEmail"}],"roots":[{"id":"8067ca8c-5c20-1469-972c-0bf80d66a985","type":"Model2","x":-828.3333333333335,"y":25,"parameters":{"modelId":"currentUser","properties":"providerData"},"ports":[],"dynamicports":[{"type":{"name":"*","allowConnectionsOnly":true},"plug":"input/output","group":"Properties","name":"prop-providerData","displayName":"providerData","index":7},{"type":"signal","plug":"output","group":"Changed Events","displayName":"providerData Changed","name":"changed-providerData","index":8}],"children":[]},{"id":"e8bb195c-4eb9-da94-da32-4b11cb9480f5","type":"Expression","x":-596.8819444444443,"y":-4.854166666666686,"parameters":{"expression":"providerData[0].email"},"ports":[],"dynamicports":[{"group":"Parameters","name":"providerData","type":{"name":"*","editAsType":"string"},"plug":"input","index":7},{"group":"Parameters","name":"email","type":{"name":"*","editAsType":"string"},"plug":"input","index":8}],"children":[],"metadata":{"merge":{"soureCodePorts":["expression"]}}},{"id":"7eaba45d-97e3-6053-3f81-331c05c865ca","type":"Group","x":-141,"y":-31,"parameters":{"backgroundColor":"White","justifyContent":"flex-start","paddingTop":{"value":24,"unit":"px"}},"ports":[],"dynamicports":[],"children":[{"id":"a1378d19-2a11-2758-c91b-f14c6241c2bb","type":"Text","label":"Verification email was sent","parameters":{"text":"","textAlignX":"center"},"ports":[],"dynamicports":[],"children":[]},{"id":"81725f3a-9b69-682b-1ccb-2976475d3630","type":"Text","parameters":{"text":"1. Verify it\n2. Log in on this page","textAlignX":"center"},"ports":[],"dynamicports":[],"children":[]}]},{"id":"40e6767d-902c-4f3b-c9f5-a3332af79bbd","type":"String Format","x":-318,"y":17,"parameters":{"format":"A verification link was emailed to: {userEmail}","userEmail":""},"ports":[],"dynamicports":[{"name":"userEmail","type":"string","plug":"input","index":2}],"children":[]}],"visualRoots":["7eaba45d-97e3-6053-3f81-331c05c865ca"],"comments":[{"text":"We output the array 'providerData' from currentUser object ","width":167,"height":189,"fill":"transparent","x":-837,"y":-66,"id":"a8795f27-b4ef-c0af-edfa-57e83be42043"},{"text":"Alternative script with a FUNCTION node: \nOutputs.userEmail = Inputs.providerData[0].email;\nfor outputting userEmail from the providerData input","width":346,"height":82,"fill":"transparent","x":-655,"y":223,"id":"5d14bad0-2271-48f6-a12e-0738744a4a05"}]}},{"name":"/Firebase/example-page","id":"3ee2a965-b31b-677e-ca77-67987227a6ff","graph":{"connections":[{"fromId":"13297ecd-cd87-4bb0-d51d-20edc11da664","fromProperty":"fromDocToNoodlObjectId","toId":"187bcce5-9803-7822-3ae8-b1cb08c12517","toProperty":"firebaseDocId"},{"fromId":"13297ecd-cd87-4bb0-d51d-20edc11da664","fromProperty":"fromDocToNoodlObjectId","toId":"d281ad75-9728-484c-cb7d-ad6225b6fc19","toProperty":"value"},{"fromId":"880a2e5e-bd53-bbf7-7dfb-01c6802ccae0","fromProperty":"didMount","toId":"5b791e3f-5281-b12a-b404-22975f6fbb97","toProperty":"Do"},{"fromId":"27048ede-f453-8bed-132e-cc58480e4f16","fromProperty":"documentsList","toId":"b9796d32-ef91-fdfa-09f2-ac0c620e36d2","toProperty":"items"}],"roots":[{"id":"880a2e5e-bd53-bbf7-7dfb-01c6802ccae0","type":"Page","x":0,"y":0,"parameters":{},"ports":[],"dynamicports":[{"name":"title","displayName":"Title","type":"string","group":"General","plug":"input","default":"example-page","index":31},{"name":"urlPath","displayName":"Url Path","type":"string","group":"General","plug":"input","default":"example-page","index":32}],"children":[{"id":"73ce6e93-071e-6c4b-ca20-4a9acd20e3f6","type":"Group","parameters":{},"ports":[],"dynamicports":[],"children":[]}]},{"id":"d14c55cb-7ea2-91fe-b76c-00a769a5f24e","type":"PageInputs","x":-100,"y":-50,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"5b3fc3d2-637d-8a89-390e-a3bff3fe45cb","type":"/Firebase/CRUD Document(s) in a Collection/Create Firebase Document","x":229.1543091557873,"y":264.55986341989035,"parameters":{"CollectionName":"providers","collectionName":"providers"},"ports":[],"dynamicports":[],"children":[]},{"id":"27048ede-f453-8bed-132e-cc58480e4f16","type":"/Firebase/CRUD Document(s) in a Collection/Get All Firebase Docs from Collection","x":-248.9684732161491,"y":403.1428016613953,"parameters":{"CollectionName":"providers","collectionName":"providers"},"ports":[],"dynamicports":[],"children":[]},{"id":"b9796d32-ef91-fdfa-09f2-ac0c620e36d2","type":"Collection2","x":-40.54742058456992,"y":429.98490692455186,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"13297ecd-cd87-4bb0-d51d-20edc11da664","type":"/Firebase/CRUD Document(s) in a Collection/Get Single Firebase Doc from Collection","label":"Get Single Doc from Collection","x":-359.7623784231664,"y":8.461082663085676,"parameters":{"CollectionName":"providers","docId":"2Dgj3tvsSLxLTC1hn7dj","firebaseDocId":"","collectionName":""},"ports":[],"dynamicports":[],"children":[]},{"id":"187bcce5-9803-7822-3ae8-b1cb08c12517","type":"/Firebase/CRUD Document(s) in a Collection/Get Single Firebase Doc from Collection","x":-360.94899557304933,"y":165.20824165765006,"parameters":{"CollectionName":"banking","collectionName":"banking"},"ports":[],"dynamicports":[],"children":[]},{"id":"d281ad75-9728-484c-cb7d-ad6225b6fc19","type":"Variable2","label":"Firebase doc id","x":-168.25227561791962,"y":8.217596634874042,"parameters":{"name":"firebaseDocId"},"ports":[],"dynamicports":[],"children":[]},{"id":"5b791e3f-5281-b12a-b404-22975f6fbb97","type":"/Firebase/User Auth/Firebase - Get Current User","x":226.00242894208168,"y":-2.8879210353851477,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":["880a2e5e-bd53-bbf7-7dfb-01c6802ccae0"],"comments":[{"text":"In this component's left panel, specify the name of the collection you want the document created in.","width":172,"height":232,"fill":"transparent","x":217,"y":122,"id":"706a5f9e-79ca-0886-2f12-cf7cb26608a1"},{"text":"Specify the collection name in the component's left panel.\nTo filter the fetched data, use the Array Filter node instead.","width":383,"height":179,"fill":"transparent","x":-260,"y":337,"id":"1a0195d0-a2a9-9213-8187-dfd89641968f"},{"text":"Specify the collection name and document ID in the component's left panel.","width":170,"height":237,"fill":"transparent","x":-370,"y":-89,"id":"efc2e06a-aab2-09e1-5c4d-7e80141b7c8f"}]}},{"name":"/Firebase/Firebase_init - Setup Client","id":"57e49d78-d0d9-99ca-aebe-dc9358c55e7f","graph":{"connections":[{"fromId":"b34e32b6-81a3-4e11-6e0b-3d6c29c14c1d","fromProperty":"apiKey","toId":"70aae2bd-7264-0606-f7cf-e595948c6ea8","toProperty":"value"},{"fromId":"b34e32b6-81a3-4e11-6e0b-3d6c29c14c1d","fromProperty":"authDomain","toId":"c1615425-8879-7ca9-b70a-78576ffc2af4","toProperty":"value"},{"fromId":"b34e32b6-81a3-4e11-6e0b-3d6c29c14c1d","fromProperty":"projectId","toId":"afeebf4f-3804-3420-f7fc-29a468c9435f","toProperty":"value"},{"fromId":"b34e32b6-81a3-4e11-6e0b-3d6c29c14c1d","fromProperty":"storageBucket","toId":"62299380-fe3d-95b7-29d6-914a973d3e88","toProperty":"value"},{"fromId":"b34e32b6-81a3-4e11-6e0b-3d6c29c14c1d","fromProperty":"messagingSenderId","toId":"cfd05114-2160-68c7-3aa5-8b8128223924","toProperty":"value"},{"fromId":"b34e32b6-81a3-4e11-6e0b-3d6c29c14c1d","fromProperty":"appId","toId":"5d8957f5-c624-9849-2673-7c0e3f00b761","toProperty":"value"},{"fromId":"70aae2bd-7264-0606-f7cf-e595948c6ea8","fromProperty":"savedValue","toId":"c0135ee9-bc7e-9647-04fc-74a985ea1520","toProperty":"in-apiKey"},{"fromId":"c1615425-8879-7ca9-b70a-78576ffc2af4","fromProperty":"savedValue","toId":"c0135ee9-bc7e-9647-04fc-74a985ea1520","toProperty":"in-authDomain"},{"fromId":"afeebf4f-3804-3420-f7fc-29a468c9435f","fromProperty":"savedValue","toId":"c0135ee9-bc7e-9647-04fc-74a985ea1520","toProperty":"in-projectId"},{"fromId":"62299380-fe3d-95b7-29d6-914a973d3e88","fromProperty":"savedValue","toId":"c0135ee9-bc7e-9647-04fc-74a985ea1520","toProperty":"in-storageBucket"},{"fromId":"cfd05114-2160-68c7-3aa5-8b8128223924","fromProperty":"savedValue","toId":"c0135ee9-bc7e-9647-04fc-74a985ea1520","toProperty":"in-messagingSenderId"},{"fromId":"5d8957f5-c624-9849-2673-7c0e3f00b761","fromProperty":"savedValue","toId":"c0135ee9-bc7e-9647-04fc-74a985ea1520","toProperty":"in-appId"},{"fromId":"b34e32b6-81a3-4e11-6e0b-3d6c29c14c1d","fromProperty":"Do","toId":"c0135ee9-bc7e-9647-04fc-74a985ea1520","toProperty":"run"},{"fromId":"c0135ee9-bc7e-9647-04fc-74a985ea1520","fromProperty":"out-Success","toId":"34099534-9fc2-85fe-1d05-ecfe1015d341","toProperty":"Success"},{"fromId":"c0135ee9-bc7e-9647-04fc-74a985ea1520","fromProperty":"out-Failure","toId":"34099534-9fc2-85fe-1d05-ecfe1015d341","toProperty":"Failure"}],"roots":[{"id":"b34e32b6-81a3-4e11-6e0b-3d6c29c14c1d","type":"Component Inputs","x":-487.3684210526315,"y":-148.8421052631578,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"apiKey","plug":"output","type":{"name":"*"},"index":1},{"name":"authDomain","plug":"output","type":{"name":"*"},"index":2},{"name":"projectId","plug":"output","type":{"name":"*"},"index":3},{"name":"storageBucket","plug":"output","type":{"name":"*"},"index":4},{"name":"messagingSenderId","plug":"output","type":{"name":"*"},"index":5},{"name":"appId","plug":"output","type":{"name":"*"},"index":6}],"dynamicports":[],"children":[]},{"id":"34099534-9fc2-85fe-1d05-ecfe1015d341","type":"Component Outputs","x":288,"y":9,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1}],"dynamicports":[],"children":[]},{"id":"c0135ee9-bc7e-9647-04fc-74a985ea1520","type":"JavaScriptFunction","x":81.10803324099732,"y":-108.17313019390582,"parameters":{"functionScript":"if (Boolean(Noodl.Variables.firebaseApp)) {\n console.log(\"Firebase client is already set up\");\n return; // Stops if the client already exists\n}\n\n// Inputs from the Noodl component, provided manually via the component's UI\nconst firebaseConfig = {\n apiKey: Inputs.apiKey,\n authDomain: Inputs.authDomain,\n projectId: Inputs.projectId,\n storageBucket: Inputs.storageBucket,\n messagingSenderId: Inputs.messagingSenderId,\n appId: Inputs.appId,\n};\n\ntry {\n // Utilize the global 'window' object to import and initialize Firebase, ensuring Firebase SDKs are loaded\n const app = window.initializeApp(firebaseConfig);\n const auth = window.getAuth(app);\n // Initialize Firestore and Firebase Storage with the Firebase app instance\n const db = window.getFirestore(app);\n const storage = window.getStorage(app);\n console.log(\"[Initialize] Firebase Storage instance:\", storage);\n\n // Initialize Google Auth Provider\n const provider = new window.GoogleAuthProvider();\n\n // Apply the default browser preference to localize the provider's OAuth flow\n auth.useDeviceLanguage();\n\n // Store the various Firebase app, auth, etc instances in Noodl variables for global access within the Noodl project\n Noodl.Variables.firebaseApp = app;\n Noodl.Variables.firebaseAuth = auth;\n Noodl.Variables.firebaseDb = db;\n Noodl.Variables.firebaseStorage = storage;\n Noodl.Variables.googleProvider = provider;\n\n console.log(\"[Initialize] Firebase Auth and Firestore now initialized\");\n Outputs.Success(); // Signal success in initialization\n} catch (e) {\n console.error(\"[Initialize] Error initializing Firebase and Firestore: \", e);\n Outputs.Failure(); // Signal failure in initialization\n}\n// Follow https://firebase.google.com/docs/auth/web/start for all auth setup","scriptInputs":[{"id":"rfto","label":"apiKey"},{"id":"n0bq","label":"authDomain"},{"id":"u9ag","label":"projectId"},{"id":"2i2d","label":"storageBucket"},{"id":"ogpk","label":"messagingSenderId"},{"id":"nwuv","label":"appId"}]},"ports":[],"dynamicports":[{"name":"intype-apiKey","displayName":"Type","editorName":"apiKey | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"}],"allowEditOnly":true},"default":"string","parent":"scriptInputs","parentItemId":"rfto","index":4},{"name":"in-apiKey","displayName":"apiKey","plug":"input","type":"string","group":"Inputs","index":5},{"name":"intype-authDomain","displayName":"Type","editorName":"authDomain | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"}],"allowEditOnly":true},"default":"string","parent":"scriptInputs","parentItemId":"n0bq","index":6},{"name":"in-authDomain","displayName":"authDomain","plug":"input","type":"string","group":"Inputs","index":7},{"name":"intype-projectId","displayName":"Type","editorName":"projectId | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"}],"allowEditOnly":true},"default":"string","parent":"scriptInputs","parentItemId":"u9ag","index":8},{"name":"in-projectId","displayName":"projectId","plug":"input","type":"string","group":"Inputs","index":9},{"name":"intype-storageBucket","displayName":"Type","editorName":"storageBucket | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"}],"allowEditOnly":true},"default":"string","parent":"scriptInputs","parentItemId":"2i2d","index":10},{"name":"in-storageBucket","displayName":"storageBucket","plug":"input","type":"string","group":"Inputs","index":11},{"name":"intype-messagingSenderId","displayName":"Type","editorName":"messagingSenderId | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"}],"allowEditOnly":true},"default":"string","parent":"scriptInputs","parentItemId":"ogpk","index":12},{"name":"in-messagingSenderId","displayName":"messagingSenderId","plug":"input","type":"string","group":"Inputs","index":13},{"name":"intype-appId","displayName":"Type","editorName":"appId | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"}],"allowEditOnly":true},"default":"string","parent":"scriptInputs","parentItemId":"nwuv","index":14},{"name":"in-appId","displayName":"appId","plug":"input","type":"string","group":"Inputs","index":15},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":16},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":17}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"70aae2bd-7264-0606-f7cf-e595948c6ea8","type":"String","x":-215.66541353383445,"y":-211.4548872180451,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"c1615425-8879-7ca9-b70a-78576ffc2af4","type":"String","x":-213.57894736842104,"y":-128.78947368421052,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"afeebf4f-3804-3420-f7fc-29a468c9435f","type":"String","x":-216.1578947368422,"y":-45.73684210526312,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"62299380-fe3d-95b7-29d6-914a973d3e88","type":"String","x":-217.42105263157896,"y":38.78947368421052,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"cfd05114-2160-68c7-3aa5-8b8128223924","type":"String","x":-217.7894736842104,"y":120.21052631578948,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"5d8957f5-c624-9849-2673-7c0e3f00b761","type":"String","x":-220.10526315789468,"y":207.36842105263156,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[],"comments":[{"text":"Creates the firebase instance and stores it in a Noodl Variable","width":178,"height":305,"fill":true,"x":67,"y":-187,"id":"429038d0-9816-0e53-0686-6a9e6f2c786b","color":"script"},{"text":"HEAD PAGE SETUP\nIn your Project settings sidebar, Custom Code section, add the below Head Code:\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nFirebase SDK version 9.0.0 is compatible with current setup, no version 9+.","width":1369,"height":1060,"fill":true,"x":-737,"y":-1315,"id":"81eb2055-81b4-4baf-ae2c-6565ff0218a8","largeFont":true},{"text":"<script type=\"module\">\n import { initializeApp } from \"https://www.gstatic.com/firebasejs/9.0.0/firebase-app.js\";\n import { getAuth, setPersistence, createUserWithEmailAndPassword, signInWithEmailAndPassword, browserLocalPersistence, browserSessionPersistence, inMemoryPersistence, onAuthStateChanged, sendEmailVerification, sendPasswordResetEmail, verifyBeforeUpdateEmail, updatePassword, EmailAuthProvider, reauthenticateWithCredential, signOut, GoogleAuthProvider, signInWithPopup } from \"https://www.gstatic.com/firebasejs/9.0.0/firebase-auth.js\";\n import { getFirestore, collection, addDoc, doc, deleteDoc, getDocs, query, getDoc, updateDoc, setDoc, serverTimestamp } from \"https://www.gstatic.com/firebasejs/9.0.0/firebase-firestore.js\";\n import { getStorage, ref, uploadBytes, getDownloadURL } from \"https://www.gstatic.com/firebasejs/9.0.0/firebase-storage.js\";\n\n // Expose Firebase initialization and auth functions to the global scope\n window.initializeApp = initializeApp;\n window.getAuth = getAuth;\n window.setPersistence = setPersistence;\n window.createUserWithEmailAndPassword = createUserWithEmailAndPassword;\n window.signInWithEmailAndPassword = signInWithEmailAndPassword;\n window.onAuthStateChanged = onAuthStateChanged;\n window.sendEmailVerification = sendEmailVerification;\n window.sendPasswordResetEmail = sendPasswordResetEmail;\n window.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;\n window.updatePassword = updatePassword;\n window.EmailAuthProvider = EmailAuthProvider;\n window.reauthenticateWithCredential = reauthenticateWithCredential;\n window.GoogleAuthProvider = GoogleAuthProvider;\n window.signInWithPopup = signInWithPopup;\n window.getFirestore = getFirestore;\n window.collection = collection;\n window.addDoc = addDoc;\n window.getDoc = getDoc;\n window.doc = doc;\n window.deleteDoc = deleteDoc;\n window.getDocs = getDocs;\n window.query = query;\n window.updateDoc = updateDoc;\n window.setDoc = setDoc;\n window.serverTimestamp = serverTimestamp;\n\n // Expose Auth persistence constants to the global scope\n window.browserLocalPersistence = browserLocalPersistence;\n window.browserSessionPersistence = browserSessionPersistence;\n window.inMemoryPersistence = inMemoryPersistence;\n\n // Expose Firebase Storage to global scope\n window.getStorage = getStorage;\n window.firebaseStorageRef = ref;\n window.uploadBytes = uploadBytes;\n window.getDownloadURL = getDownloadURL;\n</script>\n\n<script src=\"https://cdn.jsdelivr.net/npm/validator/validator.min.js\"></script>\n<script> window.validator = validator; </script>","width":1327,"height":934,"fill":true,"x":-713,"y":-1236,"id":"9483fc55-27b3-d428-d3bf-dea1130459f1","color":"comment"}]}},{"name":"/Firebase/Media Upload/Firebase - Download File","id":"ea6f4b7a-d619-324b-e619-f1302827dbec","graph":{"connections":[{"fromId":"a08c1504-37dc-d2c9-def3-c48945286acf","fromProperty":"Do","toId":"52fedc69-df08-7e3e-375d-0e507fef692d","toProperty":"run"},{"fromId":"a08c1504-37dc-d2c9-def3-c48945286acf","fromProperty":"downloadURL","toId":"52fedc69-df08-7e3e-375d-0e507fef692d","toProperty":"in-downloadURL"},{"fromId":"a08c1504-37dc-d2c9-def3-c48945286acf","fromProperty":"fileName","toId":"52fedc69-df08-7e3e-375d-0e507fef692d","toProperty":"in-fileName"}],"roots":[{"id":"a08c1504-37dc-d2c9-def3-c48945286acf","type":"Component Inputs","x":-72,"y":-19,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"downloadURL","plug":"output","type":{"name":"*"},"index":1},{"name":"fileName","plug":"output","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"814259a9-de4e-7b42-1719-ebb20f14e7be","type":"Component Outputs","x":384,"y":3,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1}],"dynamicports":[],"children":[]},{"id":"52fedc69-df08-7e3e-375d-0e507fef692d","type":"JavaScriptFunction","x":125,"y":-19,"parameters":{"functionScript":"// Create an anchor element\r\nconst anchor = document.createElement('a');\r\n\r\n// Set the href to the download URL\r\nanchor.href = Inputs.downloadURL; // Ensure this is the URL you obtained from Firebase Storage\r\n\r\n// Set the download attribute to the desired file name\r\nanchor.download = Inputs.fileName; // The file name you wish to use for the downloaded file\r\n\r\n// Append the anchor to the body (required for Firefox)\r\ndocument.body.appendChild(anchor);\r\n\r\n// Programmatically click the anchor to trigger the download\r\nanchor.click();\r\n\r\n// Remove the anchor from the body after triggering the download\r\ndocument.body.removeChild(anchor);"},"ports":[],"dynamicports":[{"name":"in-downloadURL","displayName":"downloadURL","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-fileName","displayName":"fileName","plug":"input","type":"*","group":"Inputs","index":5}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[]}},{"name":"/Firebase/Media Upload/Firebase - Upload File","id":"aca049c6-076a-c48d-2ddf-b7adafd9dd29","graph":{"connections":[{"fromId":"8e4df0fc-8012-bfd9-f521-2fa2870109b1","fromProperty":"file","toId":"66189424-c553-e51e-dd3d-b2b23c3466c8","toProperty":"in-file"},{"fromId":"8e4df0fc-8012-bfd9-f521-2fa2870109b1","fromProperty":"Do","toId":"66189424-c553-e51e-dd3d-b2b23c3466c8","toProperty":"run"},{"fromId":"66189424-c553-e51e-dd3d-b2b23c3466c8","fromProperty":"out-FileURL","toId":"bfce5c35-93d4-0b2f-bf94-1c71a015316b","toProperty":"downloadURL"},{"fromId":"66189424-c553-e51e-dd3d-b2b23c3466c8","fromProperty":"out-Success","toId":"bfce5c35-93d4-0b2f-bf94-1c71a015316b","toProperty":"Success"},{"fromId":"66189424-c553-e51e-dd3d-b2b23c3466c8","fromProperty":"out-Failure","toId":"bfce5c35-93d4-0b2f-bf94-1c71a015316b","toProperty":"Failure"},{"fromId":"66189424-c553-e51e-dd3d-b2b23c3466c8","fromProperty":"out-fileName","toId":"bfce5c35-93d4-0b2f-bf94-1c71a015316b","toProperty":"fileName"},{"fromId":"8e4df0fc-8012-bfd9-f521-2fa2870109b1","fromProperty":"name","toId":"66189424-c553-e51e-dd3d-b2b23c3466c8","toProperty":"in-name"},{"fromId":"8e4df0fc-8012-bfd9-f521-2fa2870109b1","fromProperty":"Authorized file type","toId":"b635464d-7f77-67e5-30a7-e114236b828a","toProperty":"currentState"},{"fromId":"b635464d-7f77-67e5-30a7-e114236b828a","fromProperty":"type","toId":"66189424-c553-e51e-dd3d-b2b23c3466c8","toProperty":"in-authorizedType"},{"fromId":"8e4df0fc-8012-bfd9-f521-2fa2870109b1","fromProperty":"storageFolder","toId":"66189424-c553-e51e-dd3d-b2b23c3466c8","toProperty":"in-folderName"},{"fromId":"8e4df0fc-8012-bfd9-f521-2fa2870109b1","fromProperty":"fileType","toId":"bfce5c35-93d4-0b2f-bf94-1c71a015316b","toProperty":"MIMEtype"},{"fromId":"66189424-c553-e51e-dd3d-b2b23c3466c8","fromProperty":"out-extension","toId":"bfce5c35-93d4-0b2f-bf94-1c71a015316b","toProperty":"extension"},{"fromId":"8e4df0fc-8012-bfd9-f521-2fa2870109b1","fromProperty":"Max file size in MB","toId":"1b1bcfd6-d90d-6937-bc7d-e6e1856c5102","toProperty":"value"},{"fromId":"1b1bcfd6-d90d-6937-bc7d-e6e1856c5102","fromProperty":"savedValue","toId":"66189424-c553-e51e-dd3d-b2b23c3466c8","toProperty":"in-maxSize"}],"roots":[{"id":"8e4df0fc-8012-bfd9-f521-2fa2870109b1","type":"Component Inputs","x":-397,"y":-48,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"file","plug":"output","type":{"name":"*"},"index":1},{"name":"storageFolder","plug":"output","type":{"name":"*"},"index":2},{"name":"name","plug":"output","type":{"name":"*"},"index":4},{"name":"Max file size in MB","plug":"output","type":{"name":"*"},"index":5},{"name":"Authorized file type","plug":"output","type":{"name":"*"},"index":7},{"name":"fileType","plug":"output","type":{"name":"*"},"index":8},{"name":"fileSize","plug":"output","type":{"name":"*"},"index":9}],"dynamicports":[],"children":[]},{"id":"bfce5c35-93d4-0b2f-bf94-1c71a015316b","type":"Component Outputs","x":303.00000000000017,"y":22,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"downloadURL","plug":"input","type":{"name":"*"},"index":2},{"name":"fileName","plug":"input","type":{"name":"*"},"index":3},{"name":"size","plug":"input","type":{"name":"*"},"index":5},{"name":"MIMEtype","plug":"input","type":{"name":"*"},"index":6},{"name":"extension","plug":"input","type":{"name":"*"},"index":7}],"dynamicports":[],"children":[]},{"id":"66189424-c553-e51e-dd3d-b2b23c3466c8","type":"JavaScriptFunction","label":"get downloadURL from file","x":63,"y":-152,"parameters":{"functionScript":"if (!Noodl.Variables.firebaseApp || !Noodl.Variables.firebaseStorage) {\r\n console.error(\"Firebase Storage is not set up.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\nconst file = Inputs.file;\r\nconst folderName = Inputs.folderName;\r\nconst customName = Inputs.name;\r\n\r\n// Log the file object and its properties for debugging\r\nconsole.log(\"Received file object:\", file);\r\nif (file) {\r\n console.log(`Is file a File object: ${file instanceof File}`);\r\n console.log(`File name: ${file.name}, File type: ${file.type}, File size: ${file.size} bytes`);\r\n}\r\n\r\nif (!file || !folderName || !customName) {\r\n console.error(\"File, folder name, or custom name is missing.\");\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\n// Check if the file's size is within the specified limit\r\n// Define the file size limit in MB\r\nconst fileSizeLimitMB = Inputs.maxSize;\r\n// Convert the limit to bytes for comparison (1 MB = 1,048,576 bytes)\r\nconst fileSizeLimitBytes = fileSizeLimitMB * 1024 * 1024;\r\n\r\nif (file.size > fileSizeLimitBytes) {\r\n console.error(`The submitted file's size (${(file.size / 1024 / 1024).toFixed(2)} MB) exceeds the allowed limit of ${fileSizeLimitMB} MB.`);\r\n Outputs.Failure();\r\n return; // Halt execution if the file size is too large\r\n}\r\n\r\n// Extract the category part of the file's MIME type, e.g., 'image' from 'image/jpeg'\r\nconst fileTypeCategory = file.type.split('/')[0];\r\n\r\n// Check if the category part of the file's MIME type matches the authorizedType\r\nif (Inputs.authorizedType !== fileTypeCategory) {\r\n console.error(`The submitted file's type '${fileTypeCategory}' does not match the authorized type '${Inputs.authorizedType}'.`);\r\n Outputs.Failure();\r\n return;\r\n}\r\n\r\n// Derive the file extension from the contentType\r\nconst extension = file.type.split('/').pop();\r\n// Construct the full file name with extension\r\nconst fileName = `${customName}.${extension}`;\r\n\r\ntry {\r\n // Directly use Noodl.Variables.firebaseStorage\r\n const storageRef = window.firebaseStorageRef(Noodl.Variables.firebaseStorage, `${folderName}/${fileName}`);\r\n const uploadResult = await window.uploadBytes(storageRef, file);\r\n const downloadURL = await window.getDownloadURL(storageRef);\r\n\r\n // Outputting relevant data upon successful upload\r\n Outputs.FileURL = downloadURL;\r\n Outputs.fileName = fileName;\r\n Outputs.extension = extension;\r\n console.log(\"File uploaded successfully: \", downloadURL);\r\n Outputs.Success();\r\n} catch (error) {\r\n console.error(\"Error uploading image: \", error);\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"in-file","displayName":"file","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-folderName","displayName":"folderName","plug":"input","type":"*","group":"Inputs","index":5},{"name":"in-name","displayName":"name","plug":"input","type":"*","group":"Inputs","index":6},{"name":"in-maxSize","displayName":"maxSize","plug":"input","type":"*","group":"Inputs","index":7},{"name":"in-authorizedType","displayName":"authorizedType","plug":"input","type":"*","group":"Inputs","index":8},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":9},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":10},{"name":"out-FileURL","displayName":"FileURL","plug":"output","type":"*","group":"Outputs","index":11},{"name":"out-fileName","displayName":"fileName","plug":"output","type":"*","group":"Outputs","index":12},{"name":"out-extension","displayName":"extension","plug":"output","type":"*","group":"Outputs","index":13}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"b635464d-7f77-67e5-30a7-e114236b828a","type":"States","label":"File type","x":-144.66666666666663,"y":39,"parameters":{"states":"image,video,audio,text,font,application,none","currentState":"none","type-image":"string","type-video":"string","values":"type","type-type":"string","value-image-type":"image","value-video-type":"video","value-audio-type":"audio","value-text-type":"text","value-font-type":"font","value-application-type":"application"},"ports":[],"dynamicports":[{"type":{"name":"string","allowConnectionsOnly":true},"plug":"output","group":"Values","name":"type","index":6},{"type":{"name":"enum","enums":[{"label":"Number","value":"number"},{"label":"String","value":"string"},{"label":"Boolean","value":"boolean"},{"label":"Color","value":"color"},{"label":"Text Style","value":"textStyle"}],"allowEditOnly":true},"default":"number","plug":"input","group":"Types","displayName":"type","name":"type-type","index":7},{"plug":"input","type":"string","group":"image Values","name":"value-image-type","displayName":"type","editorName":"image|type","index":8},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"image Transitions","name":"transitiondef-image","index":9},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To image","name":"to-image","group":"Go to state","index":10},{"plug":"output","type":"boolean","displayName":"At image","name":"at-image","group":"Current state","index":11},{"plug":"output","type":"signal","displayName":"Has Reached image","name":"reached-image","group":"Current state","index":12},{"plug":"input","type":"string","group":"video Values","name":"value-video-type","displayName":"type","editorName":"video|type","index":13},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"video Transitions","name":"transitiondef-video","index":14},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To video","name":"to-video","group":"Go to state","index":15},{"plug":"output","type":"boolean","displayName":"At video","name":"at-video","group":"Current state","index":16},{"plug":"output","type":"signal","displayName":"Has Reached video","name":"reached-video","group":"Current state","index":17},{"plug":"input","type":"string","group":"audio Values","name":"value-audio-type","displayName":"type","editorName":"audio|type","index":18},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"audio Transitions","name":"transitiondef-audio","index":19},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To audio","name":"to-audio","group":"Go to state","index":20},{"plug":"output","type":"boolean","displayName":"At audio","name":"at-audio","group":"Current state","index":21},{"plug":"output","type":"signal","displayName":"Has Reached audio","name":"reached-audio","group":"Current state","index":22},{"plug":"input","type":"string","group":"text Values","name":"value-text-type","displayName":"type","editorName":"text|type","index":23},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"text Transitions","name":"transitiondef-text","index":24},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To text","name":"to-text","group":"Go to state","index":25},{"plug":"output","type":"boolean","displayName":"At text","name":"at-text","group":"Current state","index":26},{"plug":"output","type":"signal","displayName":"Has Reached text","name":"reached-text","group":"Current state","index":27},{"plug":"input","type":"string","group":"font Values","name":"value-font-type","displayName":"type","editorName":"font|type","index":28},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"font Transitions","name":"transitiondef-font","index":29},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To font","name":"to-font","group":"Go to state","index":30},{"plug":"output","type":"boolean","displayName":"At font","name":"at-font","group":"Current state","index":31},{"plug":"output","type":"signal","displayName":"Has Reached font","name":"reached-font","group":"Current state","index":32},{"plug":"input","type":"string","group":"application Values","name":"value-application-type","displayName":"type","editorName":"application|type","index":33},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"application Transitions","name":"transitiondef-application","index":34},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To application","name":"to-application","group":"Go to state","index":35},{"plug":"output","type":"boolean","displayName":"At application","name":"at-application","group":"Current state","index":36},{"plug":"output","type":"signal","displayName":"Has Reached application","name":"reached-application","group":"Current state","index":37},{"plug":"input","type":"string","group":"none Values","name":"value-none-type","displayName":"type","editorName":"none|type","index":38},{"plug":"input","type":"curve","displayName":"Default","default":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"group":"none Transitions","name":"transitiondef-none","index":39},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To none","name":"to-none","group":"Go to state","index":40},{"plug":"output","type":"boolean","displayName":"At none","name":"at-none","group":"Current state","index":41},{"plug":"output","type":"signal","displayName":"Has Reached none","name":"reached-none","group":"Current state","index":42},{"plug":"input","type":{"name":"enum","enums":["image","video","audio","text","font","application","none"]},"group":"States","displayName":"State","name":"currentState","default":"image","index":43}],"children":[]},{"id":"1b1bcfd6-d90d-6937-bc7d-e6e1856c5102","type":"String","label":"Max size","x":-184.75,"y":-143.25,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/Password Reset/Firebase - Send Password Reset","id":"fdda83a6-dbef-d0d2-a359-40736075fbf8","graph":{"connections":[{"fromId":"585648d6-9391-8984-c034-db59c9e39a33","fromProperty":"Do","toId":"3493c084-a0e9-eac9-8408-b8731df576d9","toProperty":"run"},{"fromId":"3493c084-a0e9-eac9-8408-b8731df576d9","fromProperty":"out-Failure","toId":"c89da7bb-fa84-876c-0458-e3f1ad7a74f1","toProperty":"Failure"},{"fromId":"3493c084-a0e9-eac9-8408-b8731df576d9","fromProperty":"out-Success","toId":"c89da7bb-fa84-876c-0458-e3f1ad7a74f1","toProperty":"Success"},{"fromId":"3493c084-a0e9-eac9-8408-b8731df576d9","fromProperty":"out-error","toId":"c89da7bb-fa84-876c-0458-e3f1ad7a74f1","toProperty":"Error"},{"fromId":"3493c084-a0e9-eac9-8408-b8731df576d9","fromProperty":"out-email","toId":"c89da7bb-fa84-876c-0458-e3f1ad7a74f1","toProperty":"email"},{"fromId":"585648d6-9391-8984-c034-db59c9e39a33","fromProperty":"email","toId":"3493c084-a0e9-eac9-8408-b8731df576d9","toProperty":"in-email"}],"roots":[{"id":"585648d6-9391-8984-c034-db59c9e39a33","type":"Component Inputs","x":-104,"y":-89,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"email","plug":"output","type":{"name":"*"},"index":1}],"dynamicports":[],"children":[]},{"id":"c89da7bb-fa84-876c-0458-e3f1ad7a74f1","type":"Component Outputs","x":374,"y":-50,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"Error","plug":"input","type":{"name":"*"},"index":2},{"name":"email","plug":"input","type":{"name":"*"},"index":3}],"dynamicports":[],"children":[]},{"id":"3493c084-a0e9-eac9-8408-b8731df576d9","type":"JavaScriptFunction","label":"sendPasswordResetEmail","x":105.66666666666663,"y":-91,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseAuth)) {\r\n console.error(\"Firebase Auth is not configured!\");\r\n Outputs.Failure();\r\n return; // Stops the function if Firebase Auth is not initialized\r\n}\r\n\r\n// Retrieve the email address from the input\r\nconst email = Inputs.email;\r\n\r\nif (email) {\r\n // Call sendPasswordResetEmail for the provided email\r\n window.sendPasswordResetEmail(Noodl.Variables.firebaseAuth, email)\r\n .then(() => {\r\n console.log(\"Password reset email sent.\");\r\n Outputs.email = email;\r\n Outputs.Success();\r\n })\r\n .catch((error) => {\r\n console.error(\"Error sending password reset email: \", error.code, error.message);\r\n console.log(\"Caught error code:\", error.code); // Log the error code\r\n // Handle specific errors with Outputs.error\r\n switch (error.code) {\r\n case \"auth/invalid-email\":\r\n Outputs.error = \"Invalid email\";\r\n break;\r\n// case \"auth/user-not-found\":\r\n// Outputs.error = \"User not found\"; //\r\n// break;\r\n default:\r\n Outputs.error = \"Password reset email send failed\";\r\n }\r\n Outputs.Failure();\r\n });\r\n} else {\r\n console.log(\"Email address is required.\");\r\n Outputs.error = \"Email address is required\";\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"in-email","displayName":"email","plug":"input","type":"*","group":"Inputs","index":4},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-email","displayName":"email","plug":"output","type":"*","group":"Outputs","index":7},{"name":"out-error","displayName":"error","plug":"output","type":"*","group":"Outputs","index":8}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[],"comments":[{"text":"⚠️ The sendPasswordResetEmail function does not provide a success response only when the user exists; it's designed to return a \"success\" response even if the email is not associated with any user, to prevent enumeration attacks where an attacker could use this function to discover valid email addresses. Firebase's behavior is to silently fail, meaning it does not disclose whether an email is linked to an existing account or not, for privacy and security reasons.","width":455,"height":156,"fill":"transparent","x":105,"y":-247,"id":"3327e6a1-cf8b-cb8e-790f-c1aeeda611b1"}]}},{"name":"/Firebase/Password Reset/Firebase - Sent Pwd Reset Email Popup","id":"63b7f9b2-1871-4b49-def7-00539fa99c42","graph":{"connections":[{"fromId":"ac75e5d6-fa3e-f7d1-7441-ecd9fe53c8b7","fromProperty":"formatted","toId":"134b6953-c38b-5308-d258-f5ef265da77c","toProperty":"text"},{"fromId":"88ddd547-429b-1054-71f2-4e35210c7a35","fromProperty":"email","toId":"ac75e5d6-fa3e-f7d1-7441-ecd9fe53c8b7","toProperty":"email"},{"fromId":"577fc3bf-cc0d-aa2f-6419-089846821cdb","fromProperty":"onClick","toId":"cbb8f685-ea12-c344-22f2-a5056477b62f","toProperty":"navigate"}],"roots":[{"id":"1a572539-cf45-a03f-5501-1be3b6c95203","type":"Group","x":177,"y":0,"parameters":{"backgroundColor":"Grey - 400","justifyContent":"flex-start","paddingTop":{"value":24,"unit":"px"}},"ports":[],"dynamicports":[],"children":[{"id":"134b6953-c38b-5308-d258-f5ef265da77c","type":"Text","label":"Password reset link emailed","parameters":{"text":"","textAlignX":"center"},"ports":[],"dynamicports":[],"children":[]},{"id":"577fc3bf-cc0d-aa2f-6419-089846821cdb","type":"net.noodl.controls.button","label":"Back to Login","parameters":{"alignX":"center","marginTop":{"value":16,"unit":"px"},"label":"Back to Login"},"ports":[],"dynamicports":[],"children":[]}]},{"id":"ac75e5d6-fa3e-f7d1-7441-ecd9fe53c8b7","type":"String Format","x":0,"y":48,"parameters":{"format":"Password reset link emailed to {email}\nIf you did not receive it, please verify the email address.","userEmail":""},"ports":[],"dynamicports":[{"name":"email","type":"string","plug":"input","index":2}],"children":[]},{"id":"88ddd547-429b-1054-71f2-4e35210c7a35","type":"Component Inputs","x":-217,"y":46,"parameters":{},"ports":[{"name":"email","plug":"output","type":{"name":"*"},"index":0}],"dynamicports":[],"children":[]},{"id":"cbb8f685-ea12-c344-22f2-a5056477b62f","type":"RouterNavigate","x":426.66666666666663,"y":160.33333333333331,"parameters":{"router":"Firebase Main","target":"/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd"},"ports":[],"dynamicports":[{"plug":"input","type":{"name":"component","title":"Choose page component","components":["/Firebase/Start Page","/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd","/Firebase/Password Reset/Reset Firebase Password","/Firebase/Verify & Update Email/Update Firebase Email","/Firebase/User Auth/Sign-out","/Firebase/Delete Account/Delete Account","/Firebase/example-page"],"allowEditOnly":true},"group":"General","displayName":"Target Page","name":"target","index":3}],"children":[]}],"visualRoots":["1a572539-cf45-a03f-5501-1be3b6c95203"]}},{"name":"/Firebase/Password Reset/Reset Firebase Password","id":"19aefb69-25d0-50d5-a4c1-8354ba6e5090","graph":{"connections":[{"fromId":"97bbadfa-d2ab-eab7-ad10-76838e78534d","fromProperty":"onTextChanged","toId":"9569c72a-46df-3051-b201-2e9eada50240","toProperty":"email"},{"fromId":"9569c72a-46df-3051-b201-2e9eada50240","fromProperty":"email","toId":"7850d63b-5ec6-dfb2-763b-0779a781a2d6","toProperty":"popupParam-email"},{"fromId":"9569c72a-46df-3051-b201-2e9eada50240","fromProperty":"Success","toId":"97bbadfa-d2ab-eab7-ad10-76838e78534d","toProperty":"clear"},{"fromId":"e7960b46-0f04-ba74-6f8d-3f5e0da532e4","fromProperty":"onClick","toId":"9569c72a-46df-3051-b201-2e9eada50240","toProperty":"Do"},{"fromId":"9569c72a-46df-3051-b201-2e9eada50240","fromProperty":"Success","toId":"7850d63b-5ec6-dfb2-763b-0779a781a2d6","toProperty":"show"},{"fromId":"9569c72a-46df-3051-b201-2e9eada50240","fromProperty":"Error","toId":"08ece10e-08bd-23ec-fe10-b69a6bfac597","toProperty":"text"},{"fromId":"6126a77c-12a6-f473-c83d-6e6cb748f772","fromProperty":"state","toId":"08ece10e-08bd-23ec-fe10-b69a6bfac597","toProperty":"mounted"},{"fromId":"9569c72a-46df-3051-b201-2e9eada50240","fromProperty":"Error","toId":"6126a77c-12a6-f473-c83d-6e6cb748f772","toProperty":"onFromStart"}],"roots":[{"id":"4e769551-9d39-2ee2-54bc-7b67669d6003","type":"Page","label":"Page Reset Pwd","x":-268.25683817239747,"y":-192.8420108230763,"parameters":{},"ports":[],"dynamicports":[{"name":"title","displayName":"Title","type":"string","group":"General","plug":"input","default":"Reset Firebase Password","index":31},{"name":"urlPath","displayName":"Url Path","type":"string","group":"General","plug":"input","default":"reset-firebase-password","index":32}],"children":[{"id":"eb99a28e-08c7-84c6-4a84-f81d6c37be51","type":"Group","label":"Reset password form","parameters":{"flexDirection":"column","backgroundColor":"#FFFFFF","borderRadius":{"value":8,"unit":"px"},"sizeMode":"contentHeight","clip":true},"ports":[],"dynamicports":[],"children":[{"id":"a8df7145-7aa0-b8e0-b5a8-7f53527ae496","type":"Text","label":"","parameters":{"text":"Reset Password","marginBottom":{"value":16,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"97bbadfa-d2ab-eab7-ad10-76838e78534d","type":"net.noodl.controls.textinput","label":"Email Input","parameters":{"label":"","type":"email","placeholder":"Email","marginBottom":{"value":8,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"08ece10e-08bd-23ec-fe10-b69a6bfac597","type":"Text","label":"Error alert","parameters":{"text":"","color":"Danger","fontSize":{"value":12,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"e7960b46-0f04-ba74-6f8d-3f5e0da532e4","type":"net.noodl.controls.button","parameters":{"label":"Send reset password email"},"ports":[],"dynamicports":[],"children":[]},{"id":"5cfc6bd5-279d-b8b9-c1f5-678e04071ac2","type":"Group","parameters":{"flexDirection":"row","sizeMode":"contentHeight","alignItems":"center","marginTop":{"value":16,"unit":"px"},"columnGap":{"value":16,"unit":"px"}},"ports":[],"dynamicports":[],"children":[{"id":"f41be625-10ff-0a40-e2dc-817f637b6521","type":"net.noodl.controls.button","parameters":{"label":"Cancel"},"ports":[],"dynamicports":[],"children":[]}]}]}]},{"id":"0c102115-9ec1-d592-e5a3-aaf497d54a2b","type":"PageInputs","x":-317.25683817239747,"y":-240.8420108230763,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"9569c72a-46df-3051-b201-2e9eada50240","type":"/Firebase/Password Reset/Firebase - Send Password Reset","x":134.38252237779335,"y":-41.75377275130927,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"7850d63b-5ec6-dfb2-763b-0779a781a2d6","type":"NavigationShowPopup","label":"Show Reset Pwd Emailed Popup","x":331.07031709871876,"y":-41.242422693890774,"parameters":{"target":"/Firebase/Password Reset/Firebase - Sent Pwd Reset Email Popup"},"ports":[],"dynamicports":[{"name":"popupParam-email","displayName":"email","type":"string","plug":"input","group":"Params","index":3}],"children":[]},{"id":"6126a77c-12a6-f473-c83d-6e6cb748f772","type":"Switch","x":135.40337891993852,"y":172.64467699978786,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":["4e769551-9d39-2ee2-54bc-7b67669d6003"]}},{"name":"/Firebase/Start Page","id":"69559017-a17f-333b-c101-fbb0d1b4ce31","graph":{"connections":[],"roots":[{"id":"a4b7e4d4-c01d-1267-30b6-c2b448b90067","type":"Page","x":0,"y":0,"parameters":{"title":"Landing when signed-in"},"ports":[],"dynamicports":[{"name":"title","displayName":"Title","type":"string","group":"General","plug":"input","default":"Start Page","index":31},{"name":"urlPath","displayName":"Url Path","type":"string","group":"General","plug":"input","default":"landing-when-signed-in","index":32}],"children":[]},{"id":"10fa011a-db2f-e573-47e6-ed69e091fbc1","type":"PageInputs","x":-248,"y":-2,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":["a4b7e4d4-c01d-1267-30b6-c2b448b90067"]}},{"name":"/Firebase/User Auth/Email Format Validator","id":"83dd1bcb-f4fa-6945-02fc-47395c71d069","graph":{"connections":[{"fromId":"a1c06355-89d7-ef8c-4d2d-0817a4e1657b","fromProperty":"out-isValid","toId":"c0985ad8-ee64-de2c-510f-c09e167df196","toProperty":"condition"},{"fromId":"89278e7f-3ccc-5213-d93c-5bf3a80fe946","fromProperty":"email","toId":"a1c06355-89d7-ef8c-4d2d-0817a4e1657b","toProperty":"in-email"},{"fromId":"89278e7f-3ccc-5213-d93c-5bf3a80fe946","fromProperty":"Do","toId":"a1c06355-89d7-ef8c-4d2d-0817a4e1657b","toProperty":"run"},{"fromId":"c0985ad8-ee64-de2c-510f-c09e167df196","fromProperty":"ontrue","toId":"817d5527-1057-0c92-431f-1c7c72271e27","toProperty":"valid"},{"fromId":"c0985ad8-ee64-de2c-510f-c09e167df196","fromProperty":"onfalse","toId":"817d5527-1057-0c92-431f-1c7c72271e27","toProperty":"invalid"},{"fromId":"a1c06355-89d7-ef8c-4d2d-0817a4e1657b","fromProperty":"out-Failure","toId":"817d5527-1057-0c92-431f-1c7c72271e27","toProperty":"Failure"}],"roots":[{"id":"89278e7f-3ccc-5213-d93c-5bf3a80fe946","type":"Component Inputs","x":98,"y":-169,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"email","plug":"output","type":{"name":"*"},"index":1}],"dynamicports":[],"children":[]},{"id":"817d5527-1057-0c92-431f-1c7c72271e27","type":"Component Outputs","x":733,"y":-188,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"valid","plug":"input","type":{"name":"*"},"index":2},{"name":"invalid","plug":"input","type":{"name":"*"},"index":3}],"dynamicports":[],"children":[]},{"id":"a1c06355-89d7-ef8c-4d2d-0817a4e1657b","type":"JavaScriptFunction","label":"Function email validator","x":303,"y":-195,"parameters":{"functionScript":"const email = Inputs.email;\r\n\r\nif (window.validator && window.validator.isEmail(email)) {\r\n console.log(\"The email address is valid.\");\r\n Outputs.isValid = true;\r\n} else {\r\n console.log(\"The email address is invalid.\");\r\n Outputs.isValid = false;\r\n Outputs.Failure();\r\n}\r\n\r\n// Signal the completion of the operation\r\nOutputs.Done();"},"ports":[],"dynamicports":[{"name":"in-email","displayName":"email","plug":"input","type":"*","group":"Inputs","index":4},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-Done","displayName":"Done","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-isValid","displayName":"isValid","plug":"output","type":"*","group":"Outputs","index":7}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"c0985ad8-ee64-de2c-510f-c09e167df196","type":"Condition","x":517,"y":-109,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/User Auth/Firebase - Get Current User","id":"b7be6952-575d-223a-314a-edfb832ecad1","graph":{"connections":[{"fromId":"111c5f1b-4cc4-20a6-119c-edb6cd89df98","fromProperty":"Do","toId":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","toProperty":"run"},{"fromId":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","fromProperty":"out-loggedIn","toId":"fa099360-38c7-68c9-004e-667a9b5c8e3f","toProperty":"prop-loggedIn"},{"fromId":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","fromProperty":"out-isAnonymous","toId":"fa099360-38c7-68c9-004e-667a9b5c8e3f","toProperty":"prop-isAnonymous"},{"fromId":"fa099360-38c7-68c9-004e-667a9b5c8e3f","fromProperty":"stored","toId":"dce2cb9f-a909-d0e9-c408-139f5f61e7e9","toProperty":"Done"},{"fromId":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","fromProperty":"out-loggedIn","toId":"dce2cb9f-a909-d0e9-c408-139f5f61e7e9","toProperty":"loggedIn"},{"fromId":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","fromProperty":"out-Done","toId":"fa099360-38c7-68c9-004e-667a9b5c8e3f","toProperty":"store"},{"fromId":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","fromProperty":"out-emailVerified","toId":"dce2cb9f-a909-d0e9-c408-139f5f61e7e9","toProperty":"isEmailVerified"},{"fromId":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","fromProperty":"out-emailVerified","toId":"fa099360-38c7-68c9-004e-667a9b5c8e3f","toProperty":"prop-emailVerified"},{"fromId":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","fromProperty":"out-idToken","toId":"dce2cb9f-a909-d0e9-c408-139f5f61e7e9","toProperty":"idToken"},{"fromId":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","fromProperty":"out-email","toId":"dce2cb9f-a909-d0e9-c408-139f5f61e7e9","toProperty":"email"}],"roots":[{"id":"111c5f1b-4cc4-20a6-119c-edb6cd89df98","type":"Component Inputs","x":-54,"y":-114,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0}],"dynamicports":[],"children":[]},{"id":"dce2cb9f-a909-d0e9-c408-139f5f61e7e9","type":"Component Outputs","x":675,"y":-9,"parameters":{},"ports":[{"name":"Done","plug":"input","type":{"name":"*"},"index":11},{"name":"loggedIn","plug":"input","type":{"name":"*"},"index":12},{"name":"isEmailVerified","plug":"input","type":{"name":"*"},"index":13},{"name":"idToken","plug":"input","type":{"name":"*"},"index":14},{"name":"email","plug":"input","type":{"name":"*"},"index":15}],"dynamicports":[],"children":[]},{"id":"99ad1749-9a13-5289-c025-89a0ab0cfe7b","type":"JavaScriptFunction","label":"Get Current User","x":144,"y":-111.33333333333331,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseAuth)) {\r\n console.error(\"Firebase is not configured or initialized!\");\r\n return; // Stops the function if Firebase App is not initialized\r\n}\r\n\r\n// Initialize the firebase Auth service\r\nconst auth = window.getAuth();\r\n\r\nauth.onAuthStateChanged((user) => {\r\n if (user) {\r\n // User is signed in\r\n console.log(\"User is signed in\");\r\n\r\n // Store user details in Noodl.Objects\r\n Noodl.Objects.currentUser = {\r\n uid: user.uid,\r\n emailVerified: user.emailVerified,\r\n isAnonymous: user.isAnonymous,\r\n tenantId: user.tenantId,\r\n userCreationTime: user.metadata.creationTime,\r\n userLastSignInTime: user.metadata.lastSignInTime,\r\n refreshToken: user.refreshToken,\r\n providerData: user.providerData.map((userInfo) => ({\r\n displayName: userInfo.displayName,\r\n email: userInfo.email,\r\n phoneNumber: userInfo.phoneNumber,\r\n providerId: userInfo.providerId,\r\n photoURL: userInfo.photoURL\r\n }))\r\n };\r\n\r\n // Indicate the user is logged in\r\n Outputs.loggedIn = Boolean(user);\r\n Outputs.email = user.email;\r\n Outputs.emailVerified = user.emailVerified;\r\n\r\n // Get the JWT ID Token and output it\r\n user.getIdToken().then((token) => {\r\n Outputs.idToken = token;\r\n\r\n }).catch((error) => {\r\n console.error(\"Error getting ID token: \", error);\r\n });\r\n } else {\r\n // User is signed out\r\n console.log(\"User is signed out\");\r\n Noodl.Objects.currentUser = null; // Clear the current user object\r\n Outputs.loggedIn = false; // Indicate user is not logged in\r\n }\r\n Outputs.Done();\r\n});","scriptOutputs":[{"id":"i7yq","label":"emailVerified"},{"id":"vqty","label":"isAnonymous"},{"id":"na9e","label":"userCreationTime"},{"id":"tgqb","label":"userLastSignInTime"},{"id":"vvu6","label":"idToken"},{"id":"fyz9","label":"providerId"},{"id":"uoun","label":"tenantId"},{"id":"krlv","label":"userDisplayName"},{"id":"ogz4","label":"email"},{"id":"g79c","label":"loggedIn"}],"outtype-emailVerified":"boolean","outtype-isAnonymous":"boolean","outtype-anon":"boolean","outtype-verified":"boolean","outtype-userCreationTime":"date","outtype-userLastSignInTime":"date","outtype-loggedIn":"boolean"},"ports":[],"dynamicports":[{"name":"outtype-emailVerified","displayName":"Type","editorName":"emailVerified | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"i7yq","index":4},{"name":"out-emailVerified","displayName":"emailVerified","plug":"output","type":"boolean","group":"Outputs","index":5},{"name":"outtype-isAnonymous","displayName":"Type","editorName":"isAnonymous | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"vqty","index":6},{"name":"out-isAnonymous","displayName":"isAnonymous","plug":"output","type":"boolean","group":"Outputs","index":7},{"name":"outtype-userCreationTime","displayName":"Type","editorName":"userCreationTime | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"na9e","index":8},{"name":"out-userCreationTime","displayName":"userCreationTime","plug":"output","type":"date","group":"Outputs","index":9},{"name":"outtype-userLastSignInTime","displayName":"Type","editorName":"userLastSignInTime | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"tgqb","index":10},{"name":"out-userLastSignInTime","displayName":"userLastSignInTime","plug":"output","type":"date","group":"Outputs","index":11},{"name":"outtype-idToken","displayName":"Type","editorName":"idToken | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"vvu6","index":12},{"name":"out-idToken","displayName":"idToken","plug":"output","type":"*","group":"Outputs","index":13},{"name":"outtype-providerId","displayName":"Type","editorName":"providerId | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"fyz9","index":14},{"name":"out-providerId","displayName":"providerId","plug":"output","type":"*","group":"Outputs","index":15},{"name":"outtype-tenantId","displayName":"Type","editorName":"tenantId | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"uoun","index":16},{"name":"out-tenantId","displayName":"tenantId","plug":"output","type":"*","group":"Outputs","index":17},{"name":"outtype-userDisplayName","displayName":"Type","editorName":"userDisplayName | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"krlv","index":18},{"name":"out-userDisplayName","displayName":"userDisplayName","plug":"output","type":"*","group":"Outputs","index":19},{"name":"outtype-email","displayName":"Type","editorName":"email | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"ogz4","index":20},{"name":"out-email","displayName":"email","plug":"output","type":"*","group":"Outputs","index":21},{"name":"outtype-loggedIn","displayName":"Type","editorName":"loggedIn | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"g79c","index":22},{"name":"out-loggedIn","displayName":"loggedIn","plug":"output","type":"boolean","group":"Outputs","index":23},{"name":"out-Done","displayName":"Done","plug":"output","type":"signal","group":"Outputs","index":24}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"fa099360-38c7-68c9-004e-667a9b5c8e3f","type":"SetModelProperties","x":437.3333333333332,"y":-174.1111111111111,"parameters":{"modelId":"currentUser","idSource":"explicit","properties":"loggedIn,emailVerified,isAnonymous","type-loggedIn":"boolean","type-emailVerified":"boolean","type-isAnonymous":"boolean","type-userCreaTime":"date","type-userLastSigninTime":"date","type-idToken":"string","type-email":"string"},"ports":[],"dynamicports":[{"type":{"name":"boolean"},"plug":"input","group":"Property Values","displayName":"loggedIn","name":"prop-loggedIn","index":6},{"type":{"name":"enum","enums":[{"label":"String","value":"string"},{"label":"Boolean","value":"boolean"},{"label":"Number","value":"number"},{"label":"Date","value":"date"},{"label":"Array","value":"array"},{"label":"Object","value":"object"},{"label":"Any","value":"*"}],"allowEditOnly":true},"plug":"input","group":"Property Types","displayName":"loggedIn","default":"*","name":"type-loggedIn","index":7},{"type":{"name":"boolean"},"plug":"input","group":"Property Values","displayName":"emailVerified","name":"prop-emailVerified","index":8},{"type":{"name":"enum","enums":[{"label":"String","value":"string"},{"label":"Boolean","value":"boolean"},{"label":"Number","value":"number"},{"label":"Date","value":"date"},{"label":"Array","value":"array"},{"label":"Object","value":"object"},{"label":"Any","value":"*"}],"allowEditOnly":true},"plug":"input","group":"Property Types","displayName":"emailVerified","default":"*","name":"type-emailVerified","index":9},{"type":{"name":"boolean"},"plug":"input","group":"Property Values","displayName":"isAnonymous","name":"prop-isAnonymous","index":10},{"type":{"name":"enum","enums":[{"label":"String","value":"string"},{"label":"Boolean","value":"boolean"},{"label":"Number","value":"number"},{"label":"Date","value":"date"},{"label":"Array","value":"array"},{"label":"Object","value":"object"},{"label":"Any","value":"*"}],"allowEditOnly":true},"plug":"input","group":"Property Types","displayName":"isAnonymous","default":"*","name":"type-isAnonymous","index":11}],"children":[]}],"visualRoots":[],"comments":[{"text":"'currentUser' can be reused as id in an Object node anywhere in the project to make its properties available","width":180,"height":297,"fill":"transparent","x":423,"y":-296,"id":"1a741b3c-c058-6a8c-255c-f84cf01b31cb"}]}},{"name":"/Firebase/User Auth/Firebase - Set Auth State Persistence","id":"b5a81626-79f4-0cad-c5b3-27337a2c3dc1","graph":{"connections":[{"fromId":"9e8ddac9-d97c-8a48-0ebf-5c7eeeadc6a0","fromProperty":"state persistence","toId":"55d35b28-56d8-59cb-dfdb-5fd623bc8cb6","toProperty":"currentState"},{"fromId":"55d35b28-56d8-59cb-dfdb-5fd623bc8cb6","fromProperty":"stateChanged","toId":"6c1a1103-64a6-f52a-a4c9-060156944780","toProperty":"run"},{"fromId":"55d35b28-56d8-59cb-dfdb-5fd623bc8cb6","fromProperty":"state","toId":"6c1a1103-64a6-f52a-a4c9-060156944780","toProperty":"in-statePersistence"},{"fromId":"6c1a1103-64a6-f52a-a4c9-060156944780","fromProperty":"out-Success","toId":"cb36ff20-7704-b344-1add-cde6fdb00ec2","toProperty":"Success"},{"fromId":"6c1a1103-64a6-f52a-a4c9-060156944780","fromProperty":"out-Failure","toId":"cb36ff20-7704-b344-1add-cde6fdb00ec2","toProperty":"Failure"},{"fromId":"55d35b28-56d8-59cb-dfdb-5fd623bc8cb6","fromProperty":"state","toId":"cb36ff20-7704-b344-1add-cde6fdb00ec2","toProperty":"state"}],"roots":[{"id":"9e8ddac9-d97c-8a48-0ebf-5c7eeeadc6a0","type":"Component Inputs","x":-200,"y":-14,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"state persistence","plug":"output","type":{"name":"*"},"index":1}],"dynamicports":[],"children":[]},{"id":"cb36ff20-7704-b344-1add-cde6fdb00ec2","type":"Component Outputs","x":420,"y":1,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"state","plug":"input","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"6c1a1103-64a6-f52a-a4c9-060156944780","type":"JavaScriptFunction","x":200.66666666666663,"y":-106,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseApp)) {\r\n console.log(\"Firebase client is not set up.\");\r\n Outputs.Failure();\r\n return; // Exit the function if Firebase is not set up\r\n}\r\n\r\nconst auth = window.getAuth();\r\n\r\nfunction setAuthPersistence() {\r\n const persistenceOptions = {\r\n 'browserLocalPersistence': window.browserLocalPersistence,\r\n 'browserSessionPersistence': window.browserSessionPersistence,\r\n 'inMemoryPersistence': window.inMemoryPersistence\r\n };\r\n\r\n // Directly use Inputs.statePersistence to access the correct Firebase persistence value\r\n const selectedPersistence = persistenceOptions[Inputs.statePersistence];\r\n\r\n if (!selectedPersistence) {\r\n console.error('Invalid statePersistence value:', Inputs.statePersistence);\r\n Outputs.Failure();\r\n return;\r\n } \r\n\r\n // Use the globally available setPersistence function\r\n window.setPersistence(auth, selectedPersistence).then(() => {\r\n console.log(\"Auth state persistence set to \" + Inputs.statePersistence);\r\n Outputs.Success();\r\n Outputs.state = Inputs.statePersistence;\r\n }).catch((error) => {\r\n console.error(\"Failed to set auth state persistence:\", error);\r\n Outputs.Failure();\r\n });\r\n}\r\n\r\n// Call the function to set the auth persistence based on Inputs.statePersistence\r\nsetAuthPersistence();"},"ports":[],"dynamicports":[{"name":"in-statePersistence","displayName":"statePersistence","plug":"input","type":"*","group":"Inputs","index":4},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-state","displayName":"state","plug":"output","type":"*","group":"Outputs","index":7}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"55d35b28-56d8-59cb-dfdb-5fd623bc8cb6","type":"States","x":-5.333333333333371,"y":-29,"parameters":{"states":"local,session,none","values":"state","useTransitions":false,"type-state":"string","value-local-state":"browserLocalPersistence","value-session-state":"browserSessionPersistence","value-none-state":"inMemoryPersistence"},"ports":[],"dynamicports":[{"type":{"name":"string","allowConnectionsOnly":true},"plug":"output","group":"Values","name":"state","index":6},{"type":{"name":"enum","enums":[{"label":"Number","value":"number"},{"label":"String","value":"string"},{"label":"Boolean","value":"boolean"},{"label":"Color","value":"color"},{"label":"Text Style","value":"textStyle"}],"allowEditOnly":true},"default":"number","plug":"input","group":"Types","displayName":"state","name":"type-state","index":7},{"plug":"input","type":"string","group":"local Values","name":"value-local-state","displayName":"state","editorName":"local|state","index":8},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To local","name":"to-local","group":"Go to state","index":9},{"plug":"output","type":"boolean","displayName":"At local","name":"at-local","group":"Current state","index":10},{"plug":"output","type":"signal","displayName":"Has Reached local","name":"reached-local","group":"Current state","index":11},{"plug":"input","type":"string","group":"session Values","name":"value-session-state","displayName":"state","editorName":"session|state","index":12},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To session","name":"to-session","group":"Go to state","index":13},{"plug":"output","type":"boolean","displayName":"At session","name":"at-session","group":"Current state","index":14},{"plug":"output","type":"signal","displayName":"Has Reached session","name":"reached-session","group":"Current state","index":15},{"plug":"input","type":"string","group":"none Values","name":"value-none-state","displayName":"state","editorName":"none|state","index":16},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To none","name":"to-none","group":"Go to state","index":17},{"plug":"output","type":"boolean","displayName":"At none","name":"at-none","group":"Current state","index":18},{"plug":"output","type":"signal","displayName":"Has Reached none","name":"reached-none","group":"Current state","index":19},{"plug":"input","type":{"name":"enum","enums":["local","session","none"]},"group":"States","displayName":"State","name":"currentState","default":"local","index":20}],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/User Auth/Firebase - SignIn with Google Auth","id":"9a4f2080-ebe5-a40c-e008-be64246262aa","graph":{"connections":[{"fromId":"aedb627a-9f1e-3d39-6597-b52a5b5f8497","fromProperty":"Do","toId":"21dcf485-9a74-a1a6-0272-147e01551b00","toProperty":"run"},{"fromId":"21dcf485-9a74-a1a6-0272-147e01551b00","fromProperty":"out-Success","toId":"3318b174-03a1-1e73-66fa-d0b2e08057d7","toProperty":"Success"},{"fromId":"21dcf485-9a74-a1a6-0272-147e01551b00","fromProperty":"out-Failure","toId":"3318b174-03a1-1e73-66fa-d0b2e08057d7","toProperty":"Failure"},{"fromId":"21dcf485-9a74-a1a6-0272-147e01551b00","fromProperty":"out-userInfo","toId":"3318b174-03a1-1e73-66fa-d0b2e08057d7","toProperty":"userInfo"},{"fromId":"21dcf485-9a74-a1a6-0272-147e01551b00","fromProperty":"out-error","toId":"3318b174-03a1-1e73-66fa-d0b2e08057d7","toProperty":"error"}],"roots":[{"id":"aedb627a-9f1e-3d39-6597-b52a5b5f8497","type":"Component Inputs","x":-74,"y":-86,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0}],"dynamicports":[],"children":[]},{"id":"3318b174-03a1-1e73-66fa-d0b2e08057d7","type":"Component Outputs","x":325,"y":-96,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"userInfo","plug":"input","type":{"name":"*"},"index":2},{"name":"error","plug":"input","type":{"name":"*"},"index":3}],"dynamicports":[],"children":[]},{"id":"21dcf485-9a74-a1a6-0272-147e01551b00","type":"JavaScriptFunction","x":121,"y":-101,"parameters":{"functionScript":"const auth = Noodl.Variables.firebaseAuth;\r\nconst provider = Noodl.Variables.googleProvider;\r\n\r\ntry {\r\n const result = await window.signInWithPopup(auth, provider);\r\n const credential = result.credential; // Get the credential from the result\r\n const userInfo = result.user; // The signed-in user info.\r\n\r\n // This gives you a Google Access Token. You can use it to access the Google API.\r\n const token = credential ? credential.accessToken : null; // Check if credential exists and then access accessToken\r\n\r\n console.log(\"Access Token:\", token);\r\n console.log(\"User info:\", userInfo);\r\n // Store user details in Noodl Variables\r\n Noodl.Variables.userDetails = userInfo;\r\n\r\n Outputs.Success();\r\n Outputs.userInfo = userInfo;\r\n} catch (error) {\r\n const errorCode = error.code;\r\n const errorMessage = error.message;\r\n const email = error.email;\r\n // The AuthCredential type that was used.\r\n const credential = error.credential;\r\n\r\n console.error(\"Authentication failed:\", errorMessage);\r\n Outputs.Failure();\r\n Outputs.error = error;\r\n}"},"ports":[],"dynamicports":[{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":4},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-userInfo","displayName":"userInfo","plug":"output","type":"*","group":"Outputs","index":6},{"name":"out-error","displayName":"error","plug":"output","type":"*","group":"Outputs","index":7}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[]}},{"name":"/Firebase/User Auth/Firebase - User Sign-in","id":"3c3e556c-32c5-2743-d21c-f684604ade00","graph":{"connections":[{"fromId":"83e232a4-02d1-5a74-9893-b02811bc3248","fromProperty":"email","toId":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","toProperty":"in-email"},{"fromId":"83e232a4-02d1-5a74-9893-b02811bc3248","fromProperty":"password","toId":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","toProperty":"in-password"},{"fromId":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","fromProperty":"out-Failure","toId":"06cf31fd-6518-5f23-ebef-264269fc3ae6","toProperty":"Failure"},{"fromId":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","fromProperty":"out-Success","toId":"06cf31fd-6518-5f23-ebef-264269fc3ae6","toProperty":"Success"},{"fromId":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","fromProperty":"out-error","toId":"06cf31fd-6518-5f23-ebef-264269fc3ae6","toProperty":"error"},{"fromId":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","fromProperty":"out-loggedIn","toId":"06cf31fd-6518-5f23-ebef-264269fc3ae6","toProperty":"loggedIn"},{"fromId":"83e232a4-02d1-5a74-9893-b02811bc3248","fromProperty":"Do","toId":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","toProperty":"run"},{"fromId":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","fromProperty":"out-isNotVerified","toId":"06cf31fd-6518-5f23-ebef-264269fc3ae6","toProperty":"isNotVerified"},{"fromId":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","fromProperty":"out-showAlert","toId":"06cf31fd-6518-5f23-ebef-264269fc3ae6","toProperty":"showAlert"}],"roots":[{"id":"83e232a4-02d1-5a74-9893-b02811bc3248","type":"Component Inputs","x":-137,"y":-192,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"email","plug":"output","type":{"name":"*"},"index":1},{"name":"password","plug":"output","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"06cf31fd-6518-5f23-ebef-264269fc3ae6","type":"Component Outputs","x":327,"y":-193,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"error","plug":"input","type":{"name":"*"},"index":3},{"name":"loggedIn","plug":"input","type":{"name":"*"},"index":4},{"name":"isNotVerified","plug":"input","type":{"name":"*"},"index":5},{"name":"showAlert","plug":"input","type":{"name":"*"},"index":6}],"dynamicports":[],"children":[]},{"id":"9aa078d3-5fac-ca86-d84f-9f7962ced00f","type":"JavaScriptFunction","label":"signIn With Email And Password","x":97,"y":-217.33333333333331,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseAuth)) {\r\n console.error(\"Firebase Auth is not configured!\");\r\n Outputs.error = \"Firebase Auth is not configured\";\r\n Outputs.Failure();\r\n return; // Stops the function if Firebase Auth is not initialized\r\n}\r\n\r\n// Retrieve the email and password from Noodl inputs\r\nconst email = Inputs.email;\r\nconst password = Inputs.password;\r\n\r\nconsole.log(\"Attempting to sign in with email: \", email);\r\n\r\nif (email && password) {\r\n // Use the globally available signInWithEmailAndPassword function for signing in\r\n window.signInWithEmailAndPassword(Noodl.Variables.firebaseAuth, email, password)\r\n .then((userCredential) => {\r\n const user = userCredential.user;\r\n console.log(`User signed in successfully, emailVerified: ${user.emailVerified}`);\r\n\r\n // Update the currentUser object in Noodl.Objects\r\n Noodl.Objects.currentUser = {\r\n uid: user.uid,\r\n email: user.email,\r\n emailVerified: user.emailVerified,\r\n refreshToken: user.refreshToken,\r\n // providerData and other fields will be populated by onAuthStateChanged (get currenUser)\r\n };\r\n Outputs.loggedIn = true; // User is logged in regardless of email verif status to enable the sendEmailVerification function\r\n Outputs.Success();\r\n if (!user.emailVerified) {\r\n Outputs.error = \"Email not verified. Please check the email verification link sent to you during sign-up, or request a new link below.\";\r\n Outputs.isNotVerified = true; // Signal for triggering sendEmailVerification button\r\n console.log(\"User email not verified\");\r\n } else {\r\n Outputs.isNotVerified = false;\r\n console.log(\"User email verified\");\r\n }\r\n Outputs.Success();\r\n })\r\n .catch((error) => {\r\n console.error(\"Error signing in: \", error.code, error.message);\r\n console.log(`Error details - code: ${error.code}, message: ${error.message}`);\r\n Outputs.showAlert = true;\r\n\r\n// It is recommended to enable Email Enumeration Protection:\r\n// https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection#overview\r\n// This protection lets the API be intentionally vague about the inputs issue, making it harder for attackers to figure out any user's account credential.\r\n\r\n // Handle errors with Outputs.error\r\n let errorMessage;\r\n switch (error.code) {\r\n case \"auth/user-not-found\": // This error msg will only fire if Email Enumeration Protection is disabled\r\n errorMessage = \"Sign-in failed\"; // No \"User not found\" as explicit message to prevent attackers from determining whether an email is associated with an account\r\n break;\r\n case \"auth/wrong-password\": // This error msg will only fire if Email Enumeration Protection is disabled\r\n errorMessage = \"Wrong password\";\r\n break;\r\n case \"auth/invalid-email\": // This error msg will only fire if Email Enumeration Protection is disabled\r\n errorMessage = \"Invalid email address format, it may be missing the @ symbol, the domain, or having invalid characters in the email portion\";\r\n break;\r\n case \"auth/invalid-credential\":\r\n errorMessage = \"Invalid credential, please verify your inputs\";\r\n break;\r\n case \"auth/too-many-requests\":\r\n errorMessage = \"Sign-in blocked, too many requests. You can immediately restore it by resetting your password or you can try again later.\";\r\n break;\r\n default:\r\n errorMessage = \"Sign-in failed\";\r\n }\r\n console.log(\"Firebase error:\", errorMessage, error.code); // Debug: Ensure this logs correctly\r\n Outputs.error = errorMessage;\r\n Outputs.loggedIn = false;\r\n Outputs.showAlert = true;\r\n Outputs.Failure();\r\n });\r\n} else {\r\n console.log(\"Email and password are required.\");\r\n Outputs.error = \"Email and password are required\";\r\n Outputs.showAlert = true;\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"in-email","displayName":"email","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-password","displayName":"password","plug":"input","type":"*","group":"Inputs","index":5},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":7},{"name":"out-error","displayName":"error","plug":"output","type":"*","group":"Outputs","index":8},{"name":"out-loggedIn","displayName":"loggedIn","plug":"output","type":"*","group":"Outputs","index":9},{"name":"out-isNotVerified","displayName":"isNotVerified","plug":"output","type":"*","group":"Outputs","index":10},{"name":"out-showAlert","displayName":"showAlert","plug":"output","type":"*","group":"Outputs","index":11}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[]}},{"name":"/Firebase/User Auth/Firebase - User Sign-Out","id":"c476bea7-bae3-1fc1-856b-2d20f6133dd8","graph":{"connections":[{"fromId":"519c7c50-5605-bf6f-b883-f28d9d2a34f8","fromProperty":"Do","toId":"3f57786a-e516-35a5-0192-1354c116a2e0","toProperty":"run"},{"fromId":"3f57786a-e516-35a5-0192-1354c116a2e0","fromProperty":"out-Success","toId":"eceb7663-cbf3-2f9c-5c50-5411f9184cdc","toProperty":"Success"},{"fromId":"3f57786a-e516-35a5-0192-1354c116a2e0","fromProperty":"out-Failure","toId":"eceb7663-cbf3-2f9c-5c50-5411f9184cdc","toProperty":"Failure"}],"roots":[{"id":"519c7c50-5605-bf6f-b883-f28d9d2a34f8","type":"Component Inputs","x":230,"y":193,"parameters":{},"ports":[{"name":"Do","plug":"output","type":{"name":"*"},"index":1}],"dynamicports":[],"children":[]},{"id":"3f57786a-e516-35a5-0192-1354c116a2e0","type":"JavaScriptFunction","x":441,"y":188,"parameters":{"functionScript":"if (Boolean(Noodl.Variables.firebaseAuth)) {\r\n Noodl.Variables.firebaseAuth.signOut().then(() => {\r\n console.log(\"User signed out successfully.\");\r\n Noodl.Objects.currentUser.fill(null);\r\n Outputs.Success();\r\n // Update the UI or perform other actions post-sign-out\r\n // For example, resetting user-related variables or navigating to the login screen\r\n }).catch((error) => {\r\n console.error(\"Sign out error:\", error);\r\n // Handle any errors that occur during sign out\r\n Outputs.Failure();\r\n });\r\n} else {\r\n console.error(\"Firebase Auth is not configured or initialized!\");\r\n}","scriptOutputs":[{"id":"crhc","label":"Success"}],"outtype-Success":"signal"},"ports":[],"dynamicports":[{"name":"outtype-Success","displayName":"Type","editorName":"Success | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"},{"value":"signal","label":"Signal"}],"allowEditOnly":true},"default":"string","parent":"scriptOutputs","parentItemId":"crhc","index":4},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":6}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"eceb7663-cbf3-2f9c-5c50-5411f9184cdc","type":"Component Outputs","x":677.6666666666666,"y":192,"parameters":{},"ports":[{"name":"Success","plug":"input","type":{"name":"*"},"index":1},{"name":"Failure","plug":"input","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]}],"visualRoots":[]}},{"name":"/Firebase/User Auth/Firebase - User Sign-up","id":"b4d9b139-0488-ae01-6e40-998adf6e0405","graph":{"connections":[{"fromId":"eeb479d9-7a1e-f091-2996-1a246f88734b","fromProperty":"out-Success","toId":"a2aa1570-93e6-9478-6103-6728a9659397","toProperty":"Success"},{"fromId":"4ef4278e-2c61-d985-9298-fb6b6d166886","fromProperty":"email","toId":"eeb479d9-7a1e-f091-2996-1a246f88734b","toProperty":"in-email"},{"fromId":"4ef4278e-2c61-d985-9298-fb6b6d166886","fromProperty":"password","toId":"eeb479d9-7a1e-f091-2996-1a246f88734b","toProperty":"in-password"},{"fromId":"4ef4278e-2c61-d985-9298-fb6b6d166886","fromProperty":"Do","toId":"eeb479d9-7a1e-f091-2996-1a246f88734b","toProperty":"run"},{"fromId":"eeb479d9-7a1e-f091-2996-1a246f88734b","fromProperty":"out-Failure","toId":"a2aa1570-93e6-9478-6103-6728a9659397","toProperty":"Failure"},{"fromId":"eeb479d9-7a1e-f091-2996-1a246f88734b","fromProperty":"out-error","toId":"a2aa1570-93e6-9478-6103-6728a9659397","toProperty":"error"}],"roots":[{"id":"4ef4278e-2c61-d985-9298-fb6b6d166886","type":"Component Inputs","x":-146,"y":-188,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"email","plug":"output","type":{"name":"*"},"index":1},{"name":"password","plug":"output","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"a2aa1570-93e6-9478-6103-6728a9659397","type":"Component Outputs","x":407,"y":-218,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"error","plug":"input","type":{"name":"*"},"index":2}],"dynamicports":[],"children":[]},{"id":"eeb479d9-7a1e-f091-2996-1a246f88734b","type":"JavaScriptFunction","label":"createUser","x":97,"y":-217.33333333333331,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseAuth)) {\r\n console.error(\"Firebase Auth is not configured!\");\r\n Outputs.error = \"Firebase Auth is not configured\";\r\n Outputs.Failure();\r\n return; // Stops the function if Firebase Auth is not initialized\r\n}\r\n\r\nwindow.createUserWithEmailAndPassword(Noodl.Variables.firebaseAuth, Inputs.email, Inputs.password)\r\n .then((userCredential) => {\r\n console.log(\"User signed up\");\r\n Outputs.Success();\r\n })\r\n .catch((error) => {\r\n console.error(\"Error signing up: \", error.code, error.message);\r\n console.log(\"Caught error code:\", error.code); // Log the error code\r\n\r\n switch (error.code) {\r\n case \"auth/email-already-in-use\":\r\n Outputs.error = \"Email already in use - please use another one\";\r\n break;\r\n case \"auth/invalid-email\":\r\n Outputs.error = \"Invalid email address format, it may be missing the @ symbol, the domain, or having invalid characters in the email portion\";\r\n break;\r\n case \"auth/weak-password\":\r\n Outputs.error = \"Password too weak\";\r\n break;\r\n case \"auth/missing-password\":\r\n Outputs.error = \"Password missing\";\r\n break;\r\n default:\r\n Outputs.error = \"An error occurred during sign up.\";\r\n }\r\n Outputs.Failure();\r\n });","scriptInputs":[{"id":"0gjw","label":"email"},{"id":"bygp","label":"password"}]},"ports":[],"dynamicports":[{"name":"intype-email","displayName":"Type","editorName":"email | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"}],"allowEditOnly":true},"default":"string","parent":"scriptInputs","parentItemId":"0gjw","index":4},{"name":"in-email","displayName":"email","plug":"input","type":"string","group":"Inputs","index":5},{"name":"intype-password","displayName":"Type","editorName":"password | Type","plug":"input","type":{"name":"enum","enums":[{"value":"string","label":"String"},{"value":"boolean","label":"Boolean"},{"value":"number","label":"Number"},{"value":"object","label":"Object"},{"value":"date","label":"Date"},{"value":"array","label":"Array"},{"value":"color","label":"Color"}],"allowEditOnly":true},"default":"string","parent":"scriptInputs","parentItemId":"bygp","index":6},{"name":"in-password","displayName":"password","plug":"input","type":"string","group":"Inputs","index":7},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":8},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":9},{"name":"out-error","displayName":"error","plug":"output","type":"*","group":"Outputs","index":10}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[]}},{"name":"/Firebase/User Auth/Sign-out","id":"7e903bd6-dc28-7476-1420-5ac8b37102ac","graph":{"connections":[{"fromId":"f65f1de5-a6d8-bcd3-3054-622ec3e6ea13","fromProperty":"onClick","toId":"05a7a883-6880-765b-ad91-8eef4f0ac998","toProperty":"Do"},{"fromId":"05a7a883-6880-765b-ad91-8eef4f0ac998","fromProperty":"Success","toId":"96f30f70-82b3-08bb-3ac8-d08d7cfe5bd8","toProperty":"navigate"}],"roots":[{"id":"7bc418a0-3de3-7b4f-e551-6e8a5752aaf9","type":"Page","x":0,"y":0,"parameters":{},"ports":[],"dynamicports":[{"name":"title","displayName":"Title","type":"string","group":"General","plug":"input","default":"Sign-out","index":31},{"name":"urlPath","displayName":"Url Path","type":"string","group":"General","plug":"input","default":"sign-out","index":32}],"children":[{"id":"e365ced4-46cb-ee2c-cd5d-f4f00c928d43","type":"Group","parameters":{"marginTop":{"value":24,"unit":"px"},"marginLeft":{"value":24,"unit":"px"}},"ports":[],"dynamicports":[],"children":[{"id":"f65f1de5-a6d8-bcd3-3054-622ec3e6ea13","type":"net.noodl.controls.button","parameters":{"label":"Sign out"},"ports":[],"dynamicports":[],"children":[]}]}]},{"id":"40cb0116-7fab-e645-6e7e-3dee35dc4f03","type":"PageInputs","x":-100,"y":-50,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"96f30f70-82b3-08bb-3ac8-d08d7cfe5bd8","type":"RouterNavigate","label":"To Signin-Login","x":522.2222222222222,"y":96.66666666666669,"parameters":{"router":"Firebase Main","target":"/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd"},"ports":[],"dynamicports":[{"plug":"input","type":{"name":"component","title":"Choose page component","components":["/Firebase/Start Page","/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd","/Firebase/Password Reset/Reset Firebase Password","/Firebase/Verify & Update Email/Update Firebase Email","/Firebase/User Auth/Sign-out","/Firebase/Delete Account/Delete Account","/Firebase/example-page"],"allowEditOnly":true},"group":"General","displayName":"Target Page","name":"target","index":3}],"children":[]},{"id":"05a7a883-6880-765b-ad91-8eef4f0ac998","type":"/Firebase/User Auth/Firebase - User Sign-Out","x":283.7222222222222,"y":87.66666666666669,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":["7bc418a0-3de3-7b4f-e551-6e8a5752aaf9"]}},{"name":"/Firebase/User Auth/SignUp example with Email Validator","id":"85aa22c5-7613-f6d6-99d9-d90c516a7e33","graph":{"connections":[{"fromId":"71852757-aa3a-1db3-8bf0-3444115e13bb","fromProperty":"onTextChanged","toId":"877fb555-33a7-a5e7-86f1-9210aae85d6e","toProperty":"email"},{"fromId":"b1b8254f-d250-a654-8d18-b025d0ac1a6f","fromProperty":"onTextChanged","toId":"877fb555-33a7-a5e7-86f1-9210aae85d6e","toProperty":"password"},{"fromId":"877fb555-33a7-a5e7-86f1-9210aae85d6e","fromProperty":"Success","toId":"55505e35-bf91-ad7a-9b17-ed2d2e89ab04","toProperty":"Do"},{"fromId":"877fb555-33a7-a5e7-86f1-9210aae85d6e","fromProperty":"Success","toId":"71852757-aa3a-1db3-8bf0-3444115e13bb","toProperty":"clear"},{"fromId":"877fb555-33a7-a5e7-86f1-9210aae85d6e","fromProperty":"Success","toId":"b1b8254f-d250-a654-8d18-b025d0ac1a6f","toProperty":"clear"},{"fromId":"55505e35-bf91-ad7a-9b17-ed2d2e89ab04","fromProperty":"Success","toId":"bd7b5178-1a36-d2bd-a0f0-3f79ea26c5ff","toProperty":"show"},{"fromId":"500f8d95-1cc8-715c-7fbc-db21760345c4","fromProperty":"state","toId":"51897bca-3cce-02ff-b6f6-e2d14eb0179e","toProperty":"mounted"},{"fromId":"71852757-aa3a-1db3-8bf0-3444115e13bb","fromProperty":"onTextChanged","toId":"f0ea9b6c-0e86-53ba-3628-656c58cebd54","toProperty":"email"},{"fromId":"9e68c67e-fc71-9f10-7ebb-6b36615b9558","fromProperty":"onClick","toId":"f0ea9b6c-0e86-53ba-3628-656c58cebd54","toProperty":"Do"},{"fromId":"f0ea9b6c-0e86-53ba-3628-656c58cebd54","fromProperty":"valid","toId":"877fb555-33a7-a5e7-86f1-9210aae85d6e","toProperty":"Do"},{"fromId":"f0ea9b6c-0e86-53ba-3628-656c58cebd54","fromProperty":"invalid","toId":"500f8d95-1cc8-715c-7fbc-db21760345c4","toProperty":"on"}],"roots":[{"id":"e1a2603d-c9e8-5fa0-6b91-1ca2eec43be6","type":"Page","x":0,"y":0,"parameters":{"urlPath":"sign-up"},"ports":[],"dynamicports":[{"name":"title","displayName":"Title","type":"string","group":"General","plug":"input","default":"SignUp example with Email Validator","index":31},{"name":"urlPath","displayName":"Url Path","type":"string","group":"General","plug":"input","default":"signup-example-with-email-validator","index":32}],"children":[{"id":"f661edab-9be6-c071-cc41-54aadd6931b2","type":"Group","label":"User Form","parameters":{"flexDirection":"column","backgroundColor":"#FFFFFF","borderRadius":{"value":8,"unit":"px"},"sizeMode":"contentHeight","clip":true},"ports":[],"dynamicports":[],"children":[{"id":"6b9c68f8-8a4a-979b-fa50-a96703d72ffa","type":"Text","label":"","parameters":{"text":"Create account","marginBottom":{"value":16,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"71852757-aa3a-1db3-8bf0-3444115e13bb","type":"net.noodl.controls.textinput","label":"Email Input","parameters":{"label":"","type":"email","placeholder":"Email","marginBottom":{"value":8,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"51897bca-3cce-02ff-b6f6-e2d14eb0179e","type":"Text","parameters":{"text":"Email not valid","color":"Danger","fontSize":{"value":12,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"b1b8254f-d250-a654-8d18-b025d0ac1a6f","type":"net.noodl.controls.textinput","label":"Password Input","parameters":{"label":"","type":"password","marginBottom":{"value":16,"unit":"px"},"placeholder":"Password (6 characters min)"},"ports":[],"dynamicports":[],"children":[]},{"id":"9e68c67e-fc71-9f10-7ebb-6b36615b9558","type":"net.noodl.controls.button","parameters":{"label":"Sign up"},"ports":[],"dynamicports":[],"children":[]},{"id":"0e0a348c-7003-6d2b-8cb9-26e61b91564e","type":"Group","parameters":{"flexDirection":"row","sizeMode":"contentHeight","alignItems":"center","marginTop":{"value":16,"unit":"px"},"columnGap":{"value":16,"unit":"px"}},"ports":[],"dynamicports":[],"children":[{"id":"6ceedc22-a62c-49d4-f26d-4f85ffff7747","type":"Text","label":"","parameters":{"text":"Already have an account?","marginTop":{"value":0,"unit":"px"},"sizeMode":"contentSize"},"ports":[],"dynamicports":[],"children":[]}]}]}]},{"id":"5d578dd6-adc7-8edd-bf1d-45ce03b7d1e8","type":"PageInputs","x":-100,"y":-50,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"877fb555-33a7-a5e7-86f1-9210aae85d6e","type":"/Firebase/User Auth/Firebase - User Sign-up","x":532,"y":172.55555555555554,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"55505e35-bf91-ad7a-9b17-ed2d2e89ab04","type":"/Firebase/Email Verification/Firebase - Send Email Verification","x":747.0833333333333,"y":210.2685185185186,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"bd7b5178-1a36-d2bd-a0f0-3f79ea26c5ff","type":"NavigationShowPopup","x":937.95,"y":209.8685185185185,"parameters":{"target":"/Firebase/Email Verification/Firebase - Sent Email Verif Popup"},"ports":[],"dynamicports":[],"children":[]},{"id":"500f8d95-1cc8-715c-7fbc-db21760345c4","type":"Switch","x":532.8619047619047,"y":342.03015873015875,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"f0ea9b6c-0e86-53ba-3628-656c58cebd54","type":"/Firebase/User Auth/Email Format Validator","x":302.9374149659863,"y":423.4842025699169,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":["e1a2603d-c9e8-5fa0-6b91-1ca2eec43be6"]}},{"name":"/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd","id":"fcc77789-f529-8182-1bb4-cdde9a79c335","graph":{"connections":[{"fromId":"8636d35d-084e-8cdc-43bd-0a2ce9eca7d8","fromProperty":"onTextChanged","toId":"29bf3bbd-c499-bbe5-03db-f7e212af03cc","toProperty":"email"},{"fromId":"533b071a-293e-2e7c-d803-f05677065776","fromProperty":"onTextChanged","toId":"29bf3bbd-c499-bbe5-03db-f7e212af03cc","toProperty":"password"},{"fromId":"29bf3bbd-c499-bbe5-03db-f7e212af03cc","fromProperty":"Success","toId":"94a2aef0-4a06-4ec5-a99c-bc1592bf66e5","toProperty":"Do"},{"fromId":"29bf3bbd-c499-bbe5-03db-f7e212af03cc","fromProperty":"Success","toId":"8636d35d-084e-8cdc-43bd-0a2ce9eca7d8","toProperty":"clear"},{"fromId":"29bf3bbd-c499-bbe5-03db-f7e212af03cc","fromProperty":"Success","toId":"533b071a-293e-2e7c-d803-f05677065776","toProperty":"clear"},{"fromId":"94a2aef0-4a06-4ec5-a99c-bc1592bf66e5","fromProperty":"Success","toId":"cdd525ca-0387-330a-c825-1f10ae658d8c","toProperty":"show"},{"fromId":"95ec91c3-70b7-98d5-f65c-21c9a8d15c4a","fromProperty":"onClick","toId":"29bf3bbd-c499-bbe5-03db-f7e212af03cc","toProperty":"Do"},{"fromId":"29bf3bbd-c499-bbe5-03db-f7e212af03cc","fromProperty":"error","toId":"083ec5ee-124e-f1da-82a7-85dce6fce8a9","toProperty":"text"},{"fromId":"57296387-1b34-ecde-2d9a-a47670fa0729","fromProperty":"onClick","toId":"5ef7d2be-2714-8701-8b38-237ad1931979","toProperty":"Do"},{"fromId":"8636d35d-084e-8cdc-43bd-0a2ce9eca7d8","fromProperty":"onTextChanged","toId":"5ef7d2be-2714-8701-8b38-237ad1931979","toProperty":"email"},{"fromId":"533b071a-293e-2e7c-d803-f05677065776","fromProperty":"onTextChanged","toId":"5ef7d2be-2714-8701-8b38-237ad1931979","toProperty":"password"},{"fromId":"5ef7d2be-2714-8701-8b38-237ad1931979","fromProperty":"error","toId":"083ec5ee-124e-f1da-82a7-85dce6fce8a9","toProperty":"text"},{"fromId":"0f424cea-379a-18c6-f6dc-dcd9165274e1","fromProperty":"onClick","toId":"1981fccb-1aca-bea2-3dc4-602b6db20774","toProperty":"Do"},{"fromId":"1981fccb-1aca-bea2-3dc4-602b6db20774","fromProperty":"Success","toId":"f5c58de6-0926-2408-d064-e9b3a2336ee8","toProperty":"show"},{"fromId":"5ef7d2be-2714-8701-8b38-237ad1931979","fromProperty":"Success","toId":"e17c0022-6a85-4141-ed67-800b08f29e31","toProperty":"Do"},{"fromId":"5ef7d2be-2714-8701-8b38-237ad1931979","fromProperty":"showAlert","toId":"083ec5ee-124e-f1da-82a7-85dce6fce8a9","toProperty":"mounted"},{"fromId":"5ef7d2be-2714-8701-8b38-237ad1931979","fromProperty":"isNotVerified","toId":"0f424cea-379a-18c6-f6dc-dcd9165274e1","toProperty":"mounted"},{"fromId":"df31c84e-a174-c35a-579e-43804c3ed003","fromProperty":"checked","toId":"f68a3e2e-67cc-b099-b8cc-52abe6642814","toProperty":"to-Text"},{"fromId":"df31c84e-a174-c35a-579e-43804c3ed003","fromProperty":"onChange","toId":"f68a3e2e-67cc-b099-b8cc-52abe6642814","toProperty":"toggle"},{"fromId":"f68a3e2e-67cc-b099-b8cc-52abe6642814","fromProperty":"Type value","toId":"533b071a-293e-2e7c-d803-f05677065776","toProperty":"type"},{"fromId":"88307338-8e1c-ac70-4313-2626f489bbc1","fromProperty":"onClick","toId":"0a4270d3-d985-89f9-ea22-3f5302ec6fe5","toProperty":"Do"},{"fromId":"0a4270d3-d985-89f9-ea22-3f5302ec6fe5","fromProperty":"Success","toId":"f1dee4a2-4c6e-9cf3-4dd8-6228b87f21de","toProperty":"navigate"}],"roots":[{"id":"6a92ca43-ffff-5c5d-0613-4ed255d62735","type":"Page","x":0,"y":0,"parameters":{"urlPath":"user-auth"},"ports":[],"dynamicports":[{"name":"title","displayName":"Title","type":"string","group":"General","plug":"input","default":"SignUp-SignIn with Firebase Eml & Pwd","index":31},{"name":"urlPath","displayName":"Url Path","type":"string","group":"General","plug":"input","default":"signup-signin-with-firebase-eml-&-pwd","index":32}],"children":[{"id":"b25744e8-36da-8e7e-11df-46b0fbca86e1","type":"Group","label":"User Form","parameters":{"flexDirection":"column","backgroundColor":"#FFFFFF","borderRadius":{"value":8,"unit":"px"},"sizeMode":"contentHeight","clip":true},"ports":[],"dynamicports":[],"children":[{"id":"5bcf25a9-574b-6481-1f73-65dbd81e8736","type":"Text","label":"","parameters":{"text":"Create account or log in","marginBottom":{"value":16,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"8636d35d-084e-8cdc-43bd-0a2ce9eca7d8","type":"net.noodl.controls.textinput","label":"Email Input","parameters":{"label":"","type":"email","placeholder":"Email","marginBottom":{"value":8,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"083ec5ee-124e-f1da-82a7-85dce6fce8a9","type":"Text","label":"Error alert","parameters":{"text":"","color":"Danger","fontSize":{"value":12,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"0f424cea-379a-18c6-f6dc-dcd9165274e1","type":"net.noodl.controls.button","parameters":{"label":"Resend email verification","mounted":false},"ports":[],"dynamicports":[],"children":[]},{"id":"533b071a-293e-2e7c-d803-f05677065776","type":"net.noodl.controls.textinput","label":"Password Input","parameters":{"label":"","marginBottom":{"value":16,"unit":"px"},"placeholder":"Password (6 characters min)","type":"password"},"ports":[],"dynamicports":[],"children":[]},{"id":"df31c84e-a174-c35a-579e-43804c3ed003","type":"net.noodl.controls.checkbox","parameters":{"label":"Show password","marginBottom":{"value":12,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"668cda65-12bb-acc2-4b82-3508ae7b8a52","type":"Group","label":"Buttons","parameters":{"flexDirection":"row","justifyContent":"space-around"},"ports":[],"dynamicports":[],"children":[{"id":"95ec91c3-70b7-98d5-f65c-21c9a8d15c4a","type":"net.noodl.controls.button","parameters":{"label":"Sign up"},"ports":[],"dynamicports":[],"children":[]},{"id":"57296387-1b34-ecde-2d9a-a47670fa0729","type":"net.noodl.controls.button","label":"Log in","parameters":{"label":"Log in"},"ports":[],"dynamicports":[],"children":[]},{"id":"88307338-8e1c-ac70-4313-2626f489bbc1","type":"net.noodl.controls.button","label":"Google Sign-in","parameters":{"label":"Sign-in","useIcon":true,"iconSourceType":"icon","iconIconSource":{"class":"material-icons","code":"g_mobiledata","codeAsClass":false}},"ports":[],"dynamicports":[],"children":[]}]}]}]},{"id":"eff04e03-4654-d04c-a60e-516db7583f03","type":"PageInputs","x":-100,"y":-50,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"29bf3bbd-c499-bbe5-03db-f7e212af03cc","type":"/Firebase/User Auth/Firebase - User Sign-up","x":477,"y":104.55555555555551,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"94a2aef0-4a06-4ec5-a99c-bc1592bf66e5","type":"/Firebase/Email Verification/Firebase - Send Email Verification","x":685.0833333333333,"y":110.26851851851859,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"cdd525ca-0387-330a-c825-1f10ae658d8c","type":"NavigationShowPopup","label":"Confirm Sent","x":876.95,"y":109.8685185185185,"parameters":{"target":"/Firebase/Email Verification/Firebase - Sent Email Verif Popup"},"ports":[],"dynamicports":[],"children":[]},{"id":"5ef7d2be-2714-8701-8b38-237ad1931979","type":"/Firebase/User Auth/Firebase - User Sign-in","x":482.20414633073904,"y":491.6079931798307,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"1981fccb-1aca-bea2-3dc4-602b6db20774","type":"/Firebase/Email Verification/Firebase - Send Email Verification","x":-155.0142011252023,"y":422.27689582724105,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"f5c58de6-0926-2408-d064-e9b3a2336ee8","type":"NavigationShowPopup","label":"Confirm Sent","x":-344.5678670360111,"y":422.91689750692524,"parameters":{"target":"/Firebase/Email Verification/Firebase - Sent Email Verif Popup"},"ports":[],"dynamicports":[],"children":[]},{"id":"e17c0022-6a85-4141-ed67-800b08f29e31","type":"/Firebase/User Auth/Firebase - Get Current User","x":697.8402545861544,"y":492.6902662816473,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"8d137417-5f2a-3f61-d2a3-d354754bbe40","type":"Model2","x":-190.91907188115306,"y":230.79552384892384,"parameters":{"modelId":"currentUser"},"ports":[],"dynamicports":[],"children":[]},{"id":"f68a3e2e-67cc-b099-b8cc-52abe6642814","type":"States","x":-275.519071881153,"y":587.5955238489239,"parameters":{"states":"Password,Text","type-Show password":"string","type-Hide password":"string","value-Hide-Show password":"Text","value-Hide-Hide password":"Password","type-Text":"boolean","value-Show password-Text":true,"type-Password":"boolean","value-Hide password-Password":true,"useTransitions":false,"type-Type":"string","type-false":"boolean","value-Hide password-false":false,"value-Show password-false":true,"type-show":"boolean","value-Password-Type":"Password","value-Text-Type":"Text","currentState":"Password","value-Password-Password":true,"value-Text-Text":true,"value-Default-Password":true,"values":"Type value","value-Default-Value":"Password","type-Type value":"string","value-Password-Type value":"Password","value-Text-Type value":"Text"},"ports":[],"dynamicports":[{"type":{"name":"string","allowConnectionsOnly":true},"plug":"output","group":"Values","name":"Type value","index":6},{"type":{"name":"enum","enums":[{"label":"Number","value":"number"},{"label":"String","value":"string"},{"label":"Boolean","value":"boolean"},{"label":"Color","value":"color"},{"label":"Text Style","value":"textStyle"}],"allowEditOnly":true},"default":"number","plug":"input","group":"Types","displayName":"Type value","name":"type-Type value","index":7},{"plug":"input","type":"string","group":"Password Values","name":"value-Password-Type value","displayName":"Type value","editorName":"Password|Type value","index":8},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To Password","name":"to-Password","group":"Go to state","index":9},{"plug":"output","type":"boolean","displayName":"At Password","name":"at-Password","group":"Current state","index":10},{"plug":"output","type":"signal","displayName":"Has Reached Password","name":"reached-Password","group":"Current state","index":11},{"plug":"input","type":"string","group":"Text Values","name":"value-Text-Type value","displayName":"Type value","editorName":"Text|Type value","index":12},{"plug":"input","type":{"name":"signal","allowConnectionsOnly":true},"displayName":"To Text","name":"to-Text","group":"Go to state","index":13},{"plug":"output","type":"boolean","displayName":"At Text","name":"at-Text","group":"Current state","index":14},{"plug":"output","type":"signal","displayName":"Has Reached Text","name":"reached-Text","group":"Current state","index":15},{"plug":"input","type":{"name":"enum","enums":["Password","Text"]},"group":"States","displayName":"State","name":"currentState","default":"Password","index":16}],"children":[]},{"id":"0a4270d3-d985-89f9-ea22-3f5302ec6fe5","type":"/Firebase/User Auth/Firebase - SignIn with Google Auth","x":467.86525936413295,"y":989.8110837055592,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"f1dee4a2-4c6e-9cf3-4dd8-6228b87f21de","type":"RouterNavigate","x":711.0768984742367,"y":994.9488980659703,"parameters":{"router":"Firebase Main","target":"/Firebase/example-page"},"ports":[],"dynamicports":[{"plug":"input","type":{"name":"component","title":"Choose page component","components":["/Firebase/Start Page","/Firebase/User Auth/SignUp-SignIn with Firebase Eml & Pwd","/Firebase/Password Reset/Reset Firebase Password","/Firebase/Verify & Update Email/Update Firebase Email","/Firebase/User Auth/Sign-out","/Firebase/Delete Account/Delete Account","/Firebase/example-page"],"allowEditOnly":true},"group":"General","displayName":"Target Page","name":"target","index":3}],"children":[]}],"visualRoots":["6a92ca43-ffff-5c5d-0613-4ed255d62735"],"comments":[{"text":"For augmented email validation UX\ncheck the SignUp example page","width":260,"height":68,"fill":"transparent","x":478,"y":348,"id":"19638ebc-8fab-674d-f88e-9d4c435e4cfe","largeFont":false}]}},{"name":"/Firebase/Verify & Update Email/Firebase - Updated Email Popup","id":"2035f214-4505-7b2f-b115-74b8e466cc70","graph":{"connections":[{"fromId":"64ea1a71-b99b-0ec7-fb66-603017387ea3","fromProperty":"formatted","toId":"520eba37-fdb7-0fb8-055e-c71c35d7e05d","toProperty":"text"},{"fromId":"85e09022-fabe-1ecb-2c64-16fbf9e3b899","fromProperty":"email","toId":"64ea1a71-b99b-0ec7-fb66-603017387ea3","toProperty":"email"}],"roots":[{"id":"226ef980-7a3c-5e52-bed8-1a6d7284ed4c","type":"Group","x":177,"y":0,"parameters":{"backgroundColor":"Grey - 400","justifyContent":"flex-start","paddingTop":{"value":24,"unit":"px"}},"ports":[],"dynamicports":[],"children":[{"id":"520eba37-fdb7-0fb8-055e-c71c35d7e05d","type":"Text","label":"Updated email popup","parameters":{"text":"","textAlignX":"center"},"ports":[],"dynamicports":[],"children":[]}]},{"id":"64ea1a71-b99b-0ec7-fb66-603017387ea3","type":"String Format","x":0,"y":48,"parameters":{"format":"Email address updated to {email}\n(please verify the email with the link sent to you)","userEmail":""},"ports":[],"dynamicports":[{"name":"email","type":"string","plug":"input","index":2}],"children":[]},{"id":"85e09022-fabe-1ecb-2c64-16fbf9e3b899","type":"Component Inputs","x":-217,"y":46,"parameters":{},"ports":[{"name":"email","plug":"output","type":{"name":"*"},"index":0}],"dynamicports":[],"children":[]}],"visualRoots":["226ef980-7a3c-5e52-bed8-1a6d7284ed4c"]}},{"name":"/Firebase/Verify & Update Email/Firebase - Verif & Upd Email","id":"bc777331-589d-4f1a-79f3-d2b7440a8903","graph":{"connections":[{"fromId":"fd40f6cf-df58-3460-a0f9-c66fa31cdd0b","fromProperty":"email","toId":"4d8301bb-9fa7-4028-3221-723cb63cea02","toProperty":"in-email"},{"fromId":"fd40f6cf-df58-3460-a0f9-c66fa31cdd0b","fromProperty":"Do","toId":"4d8301bb-9fa7-4028-3221-723cb63cea02","toProperty":"run"},{"fromId":"4d8301bb-9fa7-4028-3221-723cb63cea02","fromProperty":"out-Failure","toId":"b6763506-2f36-ef2e-d9bf-6201f7b217b0","toProperty":"Failure"},{"fromId":"4d8301bb-9fa7-4028-3221-723cb63cea02","fromProperty":"out-Success","toId":"b6763506-2f36-ef2e-d9bf-6201f7b217b0","toProperty":"Success"},{"fromId":"4d8301bb-9fa7-4028-3221-723cb63cea02","fromProperty":"out-error","toId":"b6763506-2f36-ef2e-d9bf-6201f7b217b0","toProperty":"Error"},{"fromId":"4d8301bb-9fa7-4028-3221-723cb63cea02","fromProperty":"out-newEmail","toId":"b6763506-2f36-ef2e-d9bf-6201f7b217b0","toProperty":"newEmail"},{"fromId":"4d8301bb-9fa7-4028-3221-723cb63cea02","fromProperty":"out-requiresLogin","toId":"b6763506-2f36-ef2e-d9bf-6201f7b217b0","toProperty":"requiresLogin"},{"fromId":"4d8301bb-9fa7-4028-3221-723cb63cea02","fromProperty":"out-showAlert","toId":"b6763506-2f36-ef2e-d9bf-6201f7b217b0","toProperty":"showAlert"}],"roots":[{"id":"fd40f6cf-df58-3460-a0f9-c66fa31cdd0b","type":"Component Inputs","x":-187,"y":-97,"parameters":{},"ports":[{"name":"Do","plug":"output","type":"*","index":0},{"name":"email","plug":"output","type":{"name":"*"},"index":1}],"dynamicports":[],"children":[]},{"id":"b6763506-2f36-ef2e-d9bf-6201f7b217b0","type":"Component Outputs","x":301,"y":-110,"parameters":{},"ports":[{"name":"Success","plug":"input","type":"*","index":0},{"name":"Failure","plug":"input","type":"*","index":1},{"name":"Error","plug":"input","type":{"name":"*"},"index":2},{"name":"newEmail","plug":"input","type":{"name":"*"},"index":3},{"name":"requiresLogin","plug":"input","type":{"name":"*"},"index":4},{"name":"showAlert","plug":"input","type":{"name":"*"},"index":5}],"dynamicports":[],"children":[]},{"id":"4d8301bb-9fa7-4028-3221-723cb63cea02","type":"JavaScriptFunction","label":"verifyUpdateEmail","x":29,"y":-130.33333333333331,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseAuth)) {\r\n console.error(\"Firebase Auth is not configured!\");\r\n return; // Stops the function if Firebase Auth is not initialized\r\n}\r\n\r\n// Assuming Inputs.email contains the new email address to update to\r\nconst newEmail = Inputs.email;\r\n\r\nif (newEmail) {\r\n // Use the globally available updateEmail function\r\n window.verifyBeforeUpdateEmail(Noodl.Variables.firebaseAuth.currentUser, newEmail)\r\n .then(() => {\r\n console.log(\"Email updated successfully.\");\r\n Noodl.Objects.currentUser.email = newEmail; // Update the email in Noodl.Objects.currentUser\r\n Outputs.newEmail = newEmail; // Reflect the successful email update\r\n Outputs.showAlert = false;\r\n Outputs.Success();\r\n })\r\n .catch((error) => {\r\n console.error(\"Error updating email: \", error.code, error.message);\r\n // Handle specific errors with Outputs.error\r\n switch (error.code) {\r\n case \"auth/email-already-in-use\":\r\n Outputs.error = \"Email already in use\";\r\n break;\r\n case \"auth/invalid-email\":\r\n Outputs.error = \"Email update failed.\";\r\n break;\r\n case \"auth/requires-recent-login\":\r\n Outputs.error = \"Requires recent login. Please re-authenticate.\";\r\n Outputs.requiresLogin = true;\r\n break;\r\n case \"auth/operation-not-allowed\":\r\n Outputs.error = \"Not allowed.\";\r\n break;\r\n default:\r\n Outputs.error = \"Email update failed.\";\r\n }\r\n Outputs.showAlert = true;\r\n Outputs.Failure();\r\n });\r\n} else {\r\n console.log(\"New email address is required.\");\r\n Outputs.error = \"New email address is required\";\r\n Outputs.showAlert = true;\r\n Outputs.Failure();\r\n}"},"ports":[],"dynamicports":[{"name":"in-email","displayName":"email","plug":"input","type":"*","group":"Inputs","index":4},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":5},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-newEmail","displayName":"newEmail","plug":"output","type":"*","group":"Outputs","index":7},{"name":"out-showAlert","displayName":"showAlert","plug":"output","type":"*","group":"Outputs","index":8},{"name":"out-error","displayName":"error","plug":"output","type":"*","group":"Outputs","index":9},{"name":"out-requiresLogin","displayName":"requiresLogin","plug":"output","type":"*","group":"Outputs","index":10}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}}],"visualRoots":[],"comments":[{"text":"Recent firebase security upgrade enables the Email Enumeration feature by default.\nTherefore use function verifyBeforeUpdateEmail instead of updateEmail","width":174,"height":342,"fill":"transparent","x":17,"y":-279,"id":"d3d1db4c-2bff-8877-f2ae-515aff24e392"}]}},{"name":"/Firebase/Verify & Update Email/Update Firebase Email","id":"b21e0d27-d11a-6941-6caf-1ba82b3e0932","graph":{"connections":[{"fromId":"e9b3a813-5f1f-990f-48a7-6070887f66d6","fromProperty":"onTextChanged","toId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","toProperty":"email"},{"fromId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","fromProperty":"Success","toId":"665eab5c-245d-5cdc-3acb-5c9e5325055b","toProperty":"show"},{"fromId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","fromProperty":"newEmail","toId":"665eab5c-245d-5cdc-3acb-5c9e5325055b","toProperty":"popupParam-email"},{"fromId":"049dafdb-eaa7-2369-57e9-7f792c6ca68e","fromProperty":"onClick","toId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","toProperty":"Do"},{"fromId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","fromProperty":"Success","toId":"e9b3a813-5f1f-990f-48a7-6070887f66d6","toProperty":"clear"},{"fromId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","fromProperty":"Error","toId":"7f2ff4b7-e529-2346-003f-413872f6fa76","toProperty":"text"},{"fromId":"c908a1dd-ccba-af4d-84cd-e49b4eb7925a","fromProperty":"didMount","toId":"90892fe4-f8f3-bda7-783c-7110f804f8be","toProperty":"Do"},{"fromId":"df5c5036-7fe2-abf6-2c39-8c38df4ae08f","fromProperty":"onTextChanged","toId":"879f34e1-aec3-d15c-2f0c-431d6e27a0af","toProperty":"in-email"},{"fromId":"1353550f-7f0c-f445-1368-59e0a5630965","fromProperty":"onTextChanged","toId":"879f34e1-aec3-d15c-2f0c-431d6e27a0af","toProperty":"in-password"},{"fromId":"fc45fbdd-64f5-d85e-ecea-ed5ef7f3cbbd","fromProperty":"onClick","toId":"879f34e1-aec3-d15c-2f0c-431d6e27a0af","toProperty":"run"},{"fromId":"879f34e1-aec3-d15c-2f0c-431d6e27a0af","fromProperty":"out-Success","toId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","toProperty":"Do"},{"fromId":"a1849f89-cdfe-2b96-ed75-7bdca0101f70","fromProperty":"result","toId":"e9b3a813-5f1f-990f-48a7-6070887f66d6","toProperty":"mounted"},{"fromId":"a1849f89-cdfe-2b96-ed75-7bdca0101f70","fromProperty":"result","toId":"049dafdb-eaa7-2369-57e9-7f792c6ca68e","toProperty":"mounted"},{"fromId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","fromProperty":"requiresLogin","toId":"a1849f89-cdfe-2b96-ed75-7bdca0101f70","toProperty":"value"},{"fromId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","fromProperty":"requiresLogin","toId":"8bd6f449-9427-e443-f157-a5e59e9b120e","toProperty":"mounted"},{"fromId":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","fromProperty":"showAlert","toId":"7f2ff4b7-e529-2346-003f-413872f6fa76","toProperty":"mounted"}],"roots":[{"id":"c908a1dd-ccba-af4d-84cd-e49b4eb7925a","type":"Page","label":"Page Update Email","x":-268.25683817239747,"y":-192.8420108230763,"parameters":{},"ports":[],"dynamicports":[{"name":"title","displayName":"Title","type":"string","group":"General","plug":"input","default":"Update Firebase Email","index":31},{"name":"urlPath","displayName":"Url Path","type":"string","group":"General","plug":"input","default":"update-firebase-email","index":32}],"children":[{"id":"76bf38b9-a70e-7381-71a2-47046389e917","type":"Group","label":"Update Email form","parameters":{"flexDirection":"column","backgroundColor":"#FFFFFF","borderRadius":{"value":8,"unit":"px"},"sizeMode":"contentHeight","clip":true},"ports":[],"dynamicports":[],"children":[{"id":"7d740ba8-6b0d-b523-1e19-71562d48700d","type":"Text","label":"Update Email","parameters":{"text":"Update Email (may require re-authentication for security reasons)","marginBottom":{"value":16,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"e9b3a813-5f1f-990f-48a7-6070887f66d6","type":"net.noodl.controls.textinput","label":"Email Update Input","parameters":{"label":"","type":"email","placeholder":"New email","marginBottom":{"value":8,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"7f2ff4b7-e529-2346-003f-413872f6fa76","type":"Text","label":"Error alert","parameters":{"text":"","color":"Danger","fontSize":{"value":12,"unit":"px"}},"ports":[],"dynamicports":[],"children":[]},{"id":"049dafdb-eaa7-2369-57e9-7f792c6ca68e","type":"net.noodl.controls.button","parameters":{"label":"Update email"},"ports":[],"dynamicports":[],"children":[]},{"id":"8bd6f449-9427-e443-f157-a5e59e9b120e","type":"Group","label":"Eml-pwd inputs","parameters":{"mounted":false},"ports":[],"dynamicports":[],"children":[{"id":"df5c5036-7fe2-abf6-2c39-8c38df4ae08f","type":"net.noodl.controls.textinput","label":"Email Input","parameters":{"label":"","type":"email","placeholder":"Email","marginBottom":{"value":8,"unit":"px"},"useLabel":false,"mounted":true},"ports":[],"dynamicports":[],"children":[]},{"id":"1353550f-7f0c-f445-1368-59e0a5630965","type":"net.noodl.controls.textinput","label":"Password Input","parameters":{"placeholder":"Password","useLabel":false,"mounted":true},"ports":[],"dynamicports":[],"children":[]},{"id":"fc45fbdd-64f5-d85e-ecea-ed5ef7f3cbbd","type":"net.noodl.controls.button","parameters":{"label":"Authenticate","mounted":true},"ports":[],"dynamicports":[],"children":[]}]},{"id":"af10e809-94d4-d478-7c33-16a53f636b62","type":"Group","parameters":{"flexDirection":"row","sizeMode":"contentHeight","alignItems":"center","marginTop":{"value":16,"unit":"px"},"columnGap":{"value":16,"unit":"px"}},"ports":[],"dynamicports":[],"children":[{"id":"54333b12-10a7-315c-a2ea-7893da94f0d6","type":"net.noodl.controls.button","parameters":{"label":"Cancel"},"ports":[],"dynamicports":[],"children":[]}]}]}]},{"id":"61308ca9-3792-f080-72da-eee662001665","type":"PageInputs","x":-317.25683817239747,"y":-240.8420108230763,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"665eab5c-245d-5cdc-3acb-5c9e5325055b","type":"NavigationShowPopup","label":"Updated Email Popup","x":739.0703170987188,"y":226.75757730610925,"parameters":{"target":"/Firebase/Verify & Update Email/Firebase - Updated Email Popup"},"ports":[],"dynamicports":[{"name":"popupParam-email","displayName":"email","type":"string","plug":"input","group":"Params","index":3}],"children":[]},{"id":"1f9ec74f-35d7-249d-96be-33c05bd4e1b7","type":"/Firebase/Verify & Update Email/Firebase - Verif & Upd Email","x":522.7191683936228,"y":238.69146062551886,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"879f34e1-aec3-d15c-2f0c-431d6e27a0af","type":"JavaScriptFunction","label":"reauthenticateWithCredential","x":89.21856181058621,"y":488.8052584861023,"parameters":{"functionScript":"if (!Boolean(Noodl.Variables.firebaseAuth)) {\r\n console.error(\"Firebase Auth is not configured!\");\r\n Outputs.Failure();\r\n return; // Stops the function if Firebase Auth is not initialized\r\n}\r\n\r\nconst user = Noodl.Variables.firebaseAuth.currentUser;\r\nconst email = Inputs.email;\r\nconst password = Inputs.password;\r\n\r\n// Re-authenticate user by using the reauthenticateWithCredential method on the user object\r\nif (user) {\r\n const credential = window.EmailAuthProvider.credential(email, password);\r\n window.reauthenticateWithCredential(user, credential).then(() => {\r\n console.log(\"User re-authenticated.\");\r\n Outputs.Success();\r\n }).catch((error) => {\r\n console.error(\"Error re-authenticating user: \", error);\r\n switch (error.code) {\r\n case \"auth/user-mismatch\":\r\n Outputs.error = \"The provided credentials do not match the logged-in user.\";\r\n break;\r\n case \"auth/user-not-found\":\r\n Outputs.error = \"No user corresponding to the provided credentials could be found.\";\r\n break;\r\n case \"auth/invalid-credential\":\r\n Outputs.error = \"The provided credential is invalid.\";\r\n break;\r\n case \"auth/invalid-email\":\r\n Outputs.error = \"The email address is not valid.\";\r\n break;\r\n case \"auth/wrong-password\":\r\n Outputs.error = \"Wrong password.\";\r\n break;\r\n default:\r\n Outputs.error = \"An error occurred during re-authentication.\";\r\n }\r\n Outputs.Failure();\r\n });\r\n} else {\r\n console.log(\"No user is currently signed in.\");\r\n}"},"ports":[],"dynamicports":[{"name":"in-email","displayName":"email","plug":"input","type":"*","group":"Inputs","index":4},{"name":"in-password","displayName":"password","plug":"input","type":"*","group":"Inputs","index":5},{"name":"out-Failure","displayName":"Failure","plug":"output","type":"signal","group":"Outputs","index":6},{"name":"out-Success","displayName":"Success","plug":"output","type":"signal","group":"Outputs","index":7},{"name":"out-error","displayName":"error","plug":"output","type":"*","group":"Outputs","index":8}],"children":[],"metadata":{"merge":{"soureCodePorts":["functionScript"]}}},{"id":"90892fe4-f8f3-bda7-783c-7110f804f8be","type":"/Firebase/User Auth/Firebase - Get Current User","x":-59.752909133381934,"y":-192.60679978599399,"parameters":{},"ports":[],"dynamicports":[],"children":[]},{"id":"a1849f89-cdfe-2b96-ed75-7bdca0101f70","type":"Inverter","x":-8.266941452253434,"y":161.63598761354686,"parameters":{},"ports":[],"dynamicports":[],"children":[]}],"visualRoots":["c908a1dd-ccba-af4d-84cd-e49b4eb7925a"]}}],"settings":{"bodyScroll":true,"headCode":"<script type=\"module\">\r\n import { initializeApp } from \"https://www.gstatic.com/firebasejs/9.0.0/firebase-app.js\";\r\n import { getAuth, setPersistence, createUserWithEmailAndPassword, signInWithEmailAndPassword, browserLocalPersistence, browserSessionPersistence, inMemoryPersistence, onAuthStateChanged, sendEmailVerification, sendPasswordResetEmail, verifyBeforeUpdateEmail, updatePassword, EmailAuthProvider, reauthenticateWithCredential, signOut, GoogleAuthProvider, signInWithPopup } from \"https://www.gstatic.com/firebasejs/9.0.0/firebase-auth.js\";\r\n import { getFirestore, collection, addDoc, doc, deleteDoc, getDocs, query, where, orderBy, limit, getDoc, updateDoc, setDoc, serverTimestamp } from \"https://www.gstatic.com/firebasejs/9.0.0/firebase-firestore.js\";\r\n import { getStorage, ref, uploadBytes, getDownloadURL } from \"https://www.gstatic.com/firebasejs/9.0.0/firebase-storage.js\";\r\n\r\n // Expose Firebase initialization and auth functions to the global scope\r\n window.initializeApp = initializeApp;\r\n window.getAuth = getAuth;\r\n window.setPersistence = setPersistence;\r\n window.createUserWithEmailAndPassword = createUserWithEmailAndPassword;\r\n window.signInWithEmailAndPassword = signInWithEmailAndPassword;\r\n window.onAuthStateChanged = onAuthStateChanged;\r\n window.sendEmailVerification = sendEmailVerification;\r\n window.sendPasswordResetEmail = sendPasswordResetEmail;\r\n window.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;\r\n window.updatePassword = updatePassword;\r\n window.EmailAuthProvider = EmailAuthProvider;\r\n window.reauthenticateWithCredential = reauthenticateWithCredential;\r\n window.GoogleAuthProvider = GoogleAuthProvider;\r\n window.signInWithPopup = signInWithPopup;\r\n window.getFirestore = getFirestore;\r\n window.collection = collection;\r\n window.addDoc = addDoc;\r\n window.getDoc = getDoc;\r\n window.doc = doc;\r\n window.deleteDoc = deleteDoc;\r\n window.getDocs = getDocs;\r\n window.query = query;\r\n window.where = where;\r\n window.limit = limit;\r\n window.orderBy = orderBy;\r\n window.updateDoc = updateDoc;\r\n window.setDoc = setDoc;\r\n window.serverTimestamp = serverTimestamp;\r\n\r\n // Expose Auth persistence constants to the global scope\r\n window.browserLocalPersistence = browserLocalPersistence;\r\n window.browserSessionPersistence = browserSessionPersistence;\r\n window.inMemoryPersistence = inMemoryPersistence;\r\n\r\n // Expose Firebase Storage to global scope\r\n window.getStorage = getStorage;\r\n window.firebaseStorageRef = ref;\r\n window.uploadBytes = uploadBytes;\r\n window.getDownloadURL = getDownloadURL;\r\n</script>\r\n<script src=\"https://cdn.jsdelivr.net/npm/validator/validator.min.js\"></script>\r\n<script>\r\n window.validator = validator;\r\n</script>"},"rootNodeId":"246f9453-a119-ac78-171e-3806cf596ecc","version":"4","metadata":{"styles":{"text":{"Display":{"letterSpacing":"Auto","lineHeight":{"value":"120","unit":"%"},"textTransform":"none","fontSize":{"value":"40","unit":"px"},"fontFamily":"fonts/Roboto/Roboto-Regular.ttf","color":"#000000"},"Headline":{"fontFamily":"fonts/Roboto/Roboto-Regular.ttf","fontSize":{"value":"32","unit":"px"},"color":"#000000","letterSpacing":"Auto","lineHeight":{"value":"120","unit":"%"},"textTransform":"none"},"Title Large":{"fontFamily":"fonts/Roboto/Roboto-Bold.ttf","fontSize":{"value":"24","unit":"px"},"color":"#000000","letterSpacing":"Auto","lineHeight":{"value":"120%","unit":"px"},"textTransform":"none"},"Title Medium":{"fontFamily":"fonts/Roboto/Roboto-Medium.ttf","fontSize":{"value":"20","unit":"px"},"color":"#000000","letterSpacing":"Auto","lineHeight":{"value":"120","unit":"%"},"textTransform":"none"},"Title Small":{"fontFamily":"fonts/Roboto/Roboto-Bold.ttf","fontSize":{"value":"16","unit":"px"},"color":"#000000","letterSpacing":"Auto","lineHeight":{"value":"120","unit":"%"},"textTransform":"none"},"Label Large":{"fontFamily":"fonts/Roboto/Roboto-Medium.ttf","fontSize":{"value":"16","unit":"px"},"color":"#000000","letterSpacing":"Auto","lineHeight":{"value":"120","unit":"%"},"textTransform":"none"},"Label Medium":{"fontFamily":"fonts/Roboto/Roboto-Medium.ttf","fontSize":{"value":"14","unit":"px"},"color":"#000000","letterSpacing":"Auto","lineHeight":{"value":"120","unit":"%"},"textTransform":"none"},"Label Small":{"fontFamily":"fonts/Roboto/Roboto-Medium.ttf","fontSize":{"value":"12","unit":"px"},"color":"#000000","letterSpacing":"Auto","lineHeight":{"value":"120","unit":"%"},"textTransform":"none"},"Body Large":{"fontFamily":"fonts/Roboto/Roboto-Regular.ttf","fontSize":{"value":"20","unit":"px"},"color":"#000000","letterSpacing":"Auto","lineHeight":{"value":"150","unit":"%"},"textTransform":"none"},"Body Medium":{"fontFamily":"fonts/Roboto/Roboto-Regular.ttf","fontSize":{"value":"16","unit":"px"},"color":"#000000","letterSpacing":"Auto","lineHeight":{"value":"150","unit":"%"},"textTransform":"none"},"Body Small":{"letterSpacing":"Auto","lineHeight":{"value":"150","unit":"%"},"textTransform":"none","fontFamily":"fonts/Roboto/Roboto-Regular.ttf","fontSize":{"value":"14","unit":"px"},"color":"#000000"}},"colors":{"Primary":"#5836F5","Primary Dark":"#3F22B8","Primary Subtle":"#C9BFFC","Primary Light":"#F7F5FF","Grey - 900":"#1F1F1F","Grey - 800":"#383838","Grey - 700":"#4C4C4C","Grey - 600":"#757575","Grey - 500":"#A5A5A5","Grey - 400":"#CECECE","Grey - 300":"#E9E9E9","Grey - 200":"#F4F4F4","Grey - 100":"#FBFBFB","Success":"#49AD7F","Notice":"#F2C441","Danger":"#F75A4F","White":"#FFFFFF","Black":"#000000"}}},"variants":[{"typename":"Text","parameters":{"textStyle":"Body Medium"},"stateParamaters":{},"stateTransitions":{}},{"typename":"net.noodl.controls.button","parameters":{"height":{"value":40,"unit":"px"},"sizeMode":"contentWidth","backgroundColor":"Primary","iconIconSource":{"class":"material-icons","code":"home"},"iconSpacing":{"value":8,"unit":"px"},"borderRadius":{"value":4,"unit":"px"},"textStyle":"Label Medium","paddingTop":{"value":0,"unit":"px"},"paddingLeft":{"value":24,"unit":"px"},"paddingRight":{"value":24,"unit":"px"},"paddingBottom":{"value":0,"unit":"px"},"color":"#FFFFFF","minWidth":{"value":80,"unit":"px"},"useIcon":false,"iconSize":{"value":20,"unit":"px"}},"stateParamaters":{"hover":{"backgroundColor":"Primary Dark"},"pressed":{"backgroundColor":"Primary","color":"White"},"disabled":{"backgroundColor":"Grey - 300","color":"Grey - 600"}},"stateTransitions":{},"defaultStateTransitions":{"neutral":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"hover":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"pressed":{"curve":[0,0,0.58,1],"dur":0,"delay":0}}},{"typename":"net.noodl.controls.textinput","parameters":{"useLabel":true,"sizeMode":"explicit","height":{"value":40,"unit":"px"},"textStyle":"Body Medium","borderStyle":"solid","borderRadius":{"value":4,"unit":"px"},"borderWidth":{"value":1,"unit":"px"},"borderColor":"Grey - 700","labeltextStyle":"Label Small","paddingLeft":{"value":12,"unit":"px"},"paddingRight":{"value":8,"unit":"px"},"labelSpacing":{"value":4,"unit":"px"},"placeholder":"Type here","color":"Grey - 900","placeHolderOpacity":0.65,"enabled":true,"blockTouch":false,"useIcon":false,"iconIconSource":{"class":"material-icons","code":"home"},"iconSize":{"value":20,"unit":"px"},"iconSpacing":{"value":4,"unit":"px"},"iconColor":"Grey - 700","labelcolor":"Grey - 700"},"stateParamaters":{"hover":{"labelcolor":"Grey - 700","borderColor":"Grey - 700","borderStyle":"solid","color":"Grey - 900"},"focused":{"borderColor":"Primary","labelcolor":"Primary","borderWidth":{"value":1,"unit":"px"},"boxShadowEnabled":false,"boxShadowColor":"Primary","borderStyle":"solid"},"disabled":{"labelcolor":"Grey - 500","backgroundColor":"Grey - 200","borderWidth":{"value":1,"unit":"px"},"borderColor":"Grey - 500","color":"Grey - 600"}},"stateTransitions":{},"defaultStateTransitions":{"neutral":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"focused":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"hover":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"disabled":{"curve":[0,0,0.58,1],"dur":0,"delay":0}}},{"typename":"net.noodl.controls.options","parameters":{"sizeMode":"explicit","height":{"value":40,"unit":"px"},"borderWidth":{"value":1,"unit":"px"},"borderRadius":{"value":4,"unit":"px"},"borderColor":"Grey - 700","boxShadowColor":"Dark Gray","useIcon":true,"iconIconSource":{"class":"material-icons","code":"expand_more"},"iconPlacement":"right","iconSize":{"value":20,"unit":"px"},"paddingRight":{"value":12,"unit":"px"},"textStyle":"Body Medium","paddingLeft":{"value":12,"unit":"px"},"marginTop":{"value":0,"unit":"px"},"width":{"value":100,"unit":"%"},"iconColor":"Grey - 700","placeholderOpacity":0.65,"placeholder":"Select option","useLabel":true,"labelSpacing":{"value":4,"unit":"px"},"labeltextStyle":"Label Small","labelcolor":"Grey - 700","items":"[\n {\"Label\":\"Option 1\", \"Value\":\"1\"},\n {\"Label\":\"Option 2\", \"Value\":\"2\"},\n {\"Label\":\"Option 3\", \"Value\":\"3\"}\n]"},"stateParamaters":{"hover":{"borderColor":"Grey - 700","borderRadius":{"value":4,"unit":"px"},"iconColor":"Grey - 900","iconSize":{"value":20,"unit":"px"},"iconPlacement":"right","color":"Grey - 900","labelcolor":"Grey - 700"},"focused":{"borderColor":"Primary","boxShadowColor":"Primary","borderRadius":{"value":4,"unit":"px"},"useIcon":true,"iconColor":"Primary","iconIconSource":{"class":"material-icons","code":"keyboard_arrow_up"},"iconPlacement":"right","color":"Grey - 900","labelcolor":"Primary"},"pressed":{"borderRadius":{"value":4,"unit":"px"}},"disabled":{"labelcolor":"Grey - 500","iconColor":"Grey - 500","borderColor":"Grey - 500","color":"Grey - 600","backgroundColor":"Grey - 200"}},"stateTransitions":{},"defaultStateTransitions":{"neutral":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"focused":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"hover":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"pressed":{"curve":[0,0,0.58,1],"dur":0,"delay":0}}},{"typename":"net.noodl.controls.range","parameters":{"thumbColor":"Primary","thumbBorderRadius":{"value":100,"unit":"%"},"trackHeight":{"value":4,"unit":"px"},"trackActiveColor":"Primary","trackColor":"Primary Subtle","width":{"value":100,"unit":"%"},"trackBorderRadius":{"value":100,"unit":"px"},"thumbHeight":{"value":16,"unit":"px"},"thumbWidth":{"value":16,"unit":"px"}},"stateParamaters":{"hover":{"thumbColor":"Primary Dark","trackActiveColor":"Primary Dark"},"disabled":{"trackActiveColor":"Grey - 500","trackColor":"Grey - 300","thumbColor":"Grey - 500"}},"stateTransitions":{}},{"typename":"net.noodl.controls.checkbox","parameters":{"width":{"value":20,"unit":"px"},"height":{"value":20,"unit":"px"},"useIcon":false,"borderWidth":{"value":1,"unit":"px"},"useLabel":true,"labeltextStyle":"Body Medium","borderRadius":{"value":2,"unit":"px"},"borderColor":"Grey - 700","labelfontSize":{"value":16,"unit":"px"},"labelcolor":"Grey - 900","labelSpacing":{"value":12,"unit":"px"}},"stateParamaters":{"checked":{"useIcon":true,"iconIconSource":{"class":"material-icons","code":"check"},"backgroundColor":"Primary","borderColor":"Primary","iconSize":{"value":16,"unit":"px"}},"disabled":{"opacity":0.5},"hover":{"borderColor":"Grey - 700"},"pressed":{}},"stateTransitions":{},"defaultStateTransitions":{"neutral":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"hover":{"curve":[0,0,0.58,1],"dur":300,"delay":0},"checked":{"curve":[0,0,0.58,1],"dur":0,"delay":0}}},{"typename":"net.noodl.controls.radiobutton","parameters":{"width":{"value":20,"unit":"px"},"height":{"value":20,"unit":"px"},"useLabel":true,"labeltextStyle":"Body Large","borderWidth":{"value":1,"unit":"px"},"value":"0","useIcon":false,"fillColor":"transparent","borderColor":"Grey - 700","labelfontSize":{"value":16,"unit":"px"},"marginBottom":{"value":8,"unit":"px"},"labelcolor":"Grey - 900","labelSpacing":{"value":12,"unit":"px"}},"stateParamaters":{"checked":{"fillColor":"Primary","borderColor":"Primary","borderWidth":{"value":1,"unit":"px"},"backgroundColor":"transparent","width":{"value":20,"unit":"px"},"height":{"value":20,"unit":"px"},"fillSpacing":{"value":2,"unit":"px"}},"hover":{"backgroundColor":"transparent","borderColor":"Grey - 700","width":{"value":20,"unit":"px"},"height":{"value":20,"unit":"px"}},"disabled":{"borderColor":"Grey - 500","labelcolor":"Grey - 500","fillColor":"transparent"}},"stateTransitions":{},"defaultStateTransitions":{"neutral":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"hover":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"checked":{"curve":[0,0,0.58,1],"dur":0,"delay":0}}},{"name":"Text Button","typename":"net.noodl.controls.button","parameters":{"height":{"value":40,"unit":"px"},"sizeMode":"contentSize","backgroundColor":"transparent","iconIconSource":{"class":"material-icons","code":"home"},"iconSpacing":{"value":8,"unit":"px"},"borderRadius":{"value":4,"unit":"px"},"textStyle":"Label Medium","paddingTop":{"value":0,"unit":"px"},"paddingLeft":{"value":0,"unit":"px"},"paddingRight":{"value":0,"unit":"px"},"paddingBottom":{"value":0,"unit":"px"},"color":"Primary","minWidth":{"value":0,"unit":"px"},"useIcon":false,"iconSize":{"value":20,"unit":"px"},"label":"Sign up"},"stateParamaters":{"hover":{"backgroundColor":"Primary Dark"},"pressed":{"backgroundColor":"Primary","color":"White"},"disabled":{"backgroundColor":"Grey - 300","color":"Grey - 600"}},"stateTransitions":{},"defaultStateTransitions":{"neutral":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"hover":{"curve":[0,0,0.58,1],"dur":0,"delay":0},"pressed":{"curve":[0,0,0.58,1],"dur":0,"delay":0}}}]}