Skip to content

Commit

Permalink
Added lead form
Browse files Browse the repository at this point in the history
Added lead form
  • Loading branch information
ZoomREI authored Nov 20, 2024
2 parents e6dd54f + a226c58 commit 7ccafa7
Show file tree
Hide file tree
Showing 34 changed files with 5,371 additions and 6 deletions.
3 changes: 3 additions & 0 deletions wp-content/plugins/carrot-blocks/includes/image-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ function cb_get_image_url($image_name, $size = null, $extension = 'webp')
if ($extension !== 'svg') {
$extensions_to_try[] = 'svg';
}
if ($extension !== 'gif') {
$extensions_to_try[] = 'gif';
}

foreach ($extensions_to_try as $ext) {
// If size is specified, attempt to get that size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,38 @@ async function copySVGs(srcDir, destDir) {
}
}

async function copyGIFs(srcDir, destDir) {
try {
const files = await fs.readdir(srcDir);
const gifFiles = files.filter((file) => file.endsWith(".gif"));

await Promise.all(
gifFiles.map(async (gif) => {
const srcFilePath = path.join(srcDir, gif);
const destFilePath = path.join(destDir, gif);
const lastModified = (await fs.stat(srcFilePath)).mtimeMs;
const relativeGifPath = path.relative(__dirname, srcFilePath);

// Skip copying if file is up-to-date
if (
manifest[relativeGifPath] &&
manifest[relativeGifPath].lastModified === lastModified
) {
console.log(`Skipped copying ${gif}, already up-to-date.`);
return;
}

// Copy file and update manifest
await fs.copyFile(srcFilePath, destFilePath);
manifest[relativeGifPath] = { lastModified };
console.log(`Copied ${gif} to ${destDir}`);
}),
);
} catch (error) {
console.error("Error copying GIFs:", error);
}
}

async function renameFileIfNeeded(filePath) {
const dir = path.dirname(filePath);
const originalName = path.basename(filePath);
Expand Down Expand Up @@ -120,6 +152,7 @@ async function processImages() {

await fs.mkdir(outputDir, { recursive: true });
await copySVGs(inputDir, outputDir);
await copyGIFs(inputDir, outputDir);

const images = await fs.readdir(inputDir);

Expand Down
87 changes: 87 additions & 0 deletions wp-content/plugins/chris-buys-blocks/build/lead-form/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "doctor-homes/lead-form",
"version": "0.1.0",
"title": "Lead Form V2",
"category": "widgets",
"icon": "feedback",
"description": "Form block built for the front-page.",
"supports": {
"html": false
},
"textdomain": "doctor-homes-blocks",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"render": "file:./render.php",
"viewScript": "file:./view.js",
"attributes": {
"btnText": {
"type": "string",
"default": "Get My Offer"
},
"redirectUrl": {
"type": "string",
"default": "/step-2"
},
"webhooks": {
"type": "array",
"default": [
{
"url": "https://workflow-automation.podio.com/catch/2kt203ir6i3uk64",
"usePreset": true,
"fieldsPreset": "cms",
"fieldsMapping": []
},
{
"url": "https://server-side-tagging-ued2wljvbq-uc.a.run.app/lead",
"usePreset": true,
"fieldsPreset": "sgtm",
"fieldsMapping": []
}
]
},
"redirectQuery": {
"type": "array",
"default": [
{
"key": "full-name",
"field": "fullName"
},
{
"key": "phone",
"field": "phone"
},
{
"key": "email",
"field": "email"
},
{
"key": "propaddress",
"field": "propertyAddress"
},
{
"key": "propstreet",
"field": "street"
},
{
"key": "propcity",
"field": "city"
},
{
"key": "propstate",
"field": "state"
},
{
"key": "propzip",
"field": "zipcode"
},
{
"key": "propcountry",
"field": "country"
}
]
}
},
"style": "file:./style-index.css"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '30a800ac0a9348acf017');
Loading

0 comments on commit 7ccafa7

Please sign in to comment.