diff --git a/.github/docs/npm-run-build-errors.png b/.github/docs/npm-run-build-errors.png new file mode 100644 index 000000000..f1e40e0bf Binary files /dev/null and b/.github/docs/npm-run-build-errors.png differ diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1174a0d93..df88c917a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,17 +26,39 @@ jobs: - name: Run Composer run: composer install --no-dev - # Confirm that expected files exist, to prevent deployment to wordpress.org - # if e.g. composer install fails. - - name: Check ConvertKit Library Exists - id: check_files - uses: andstor/file-existence-action@v1 - with: - files: "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-traits.php, vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php, vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-log.php, vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php, vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-review-request.php" + # Build the frontend CSS and JS assets + - name: Run npm + run: | + npm install + npm run build + + # Confirm that expected files exist + # if e.g. `composer install` or `npm run build` fails + - name: Check Kit WordPress Libraries and Assets Exists + working-directory: ${{ env.PLUGIN_DIR }} + run: | + set -e + + files=( + "resources/frontend/css/frontend.css" + "resources/frontend/js/dist/frontend.min.asset.php" + "resources/frontend/js/dist/frontend.min.js" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-traits.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-log.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-review-request.php" + ) + + for file in "${files[@]}"; do + echo "Checking: $file" + test -f "$file" || { echo "❌ Missing required file: $file"; exit 1; } + done + + echo "✅ All required files exist." # Deploy to wordpress.org, if expected files exist. - name: WordPress Plugin Deploy - if: steps.check_files.outputs.files_exists == 'true' id: deploy uses: 10up/action-wordpress-plugin-deploy@stable with: diff --git a/.github/workflows/tests-backward-compat.yml b/.github/workflows/tests-backward-compat.yml index 9948399c0..93f1ca084 100644 --- a/.github/workflows/tests-backward-compat.yml +++ b/.github/workflows/tests-backward-compat.yml @@ -270,6 +270,38 @@ jobs: working-directory: ${{ env.PLUGIN_DIR }} run: composer update + # Build the frontend CSS and JS assets + - name: Run npm + working-directory: ${{ env.PLUGIN_DIR }} + run: | + npm install + npm run build + + # Confirm that expected files exist + # if e.g. `composer install` or `npm run build` fails + - name: Check Kit WordPress Libraries and Assets Exists + working-directory: ${{ env.PLUGIN_DIR }} + run: | + set -e + + files=( + "resources/frontend/css/frontend.css" + "resources/frontend/js/dist/frontend.min.asset.php" + "resources/frontend/js/dist/frontend.min.js" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-traits.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-log.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-review-request.php" + ) + + for file in "${files[@]}"; do + echo "Checking: $file" + test -f "$file" || { echo "❌ Missing required file: $file"; exit 1; } + done + + echo "✅ All required files exist." + - name: Build PHP Autoloader working-directory: ${{ env.PLUGIN_DIR }} run: composer dump-autoload diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1192af838..5897b2574 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -292,6 +292,38 @@ jobs: working-directory: ${{ env.PLUGIN_DIR }} run: composer update + # Build the frontend CSS and JS assets + - name: Run npm + working-directory: ${{ env.PLUGIN_DIR }} + run: | + npm install + npm run build + + # Confirm that expected files exist + # if e.g. `composer install` or `npm run build` fails + - name: Check Kit WordPress Libraries and Assets Exists + working-directory: ${{ env.PLUGIN_DIR }} + run: | + set -e + + files=( + "resources/frontend/css/frontend.css" + "resources/frontend/js/dist/frontend.min.asset.php" + "resources/frontend/js/dist/frontend.min.js" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-traits.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-log.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php" + "vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-review-request.php" + ) + + for file in "${files[@]}"; do + echo "Checking: $file" + test -f "$file" || { echo "❌ Missing required file: $file"; exit 1; } + done + + echo "✅ All required files exist." + - name: Build PHP Autoloader working-directory: ${{ env.PLUGIN_DIR }} run: composer dump-autoload @@ -396,6 +428,12 @@ jobs: - name: Run Composer run: composer install --no-dev + # Build the frontend CSS and JS assets. + - name: Run npm + run: | + npm install + npm run build + # Configure AWS Credentials - name: Configure AWS credentials id: credentials @@ -408,7 +446,7 @@ jobs: # Create ZIP file - name: Create ZIP File run: | - zip -r ${{ env.PLUGIN_SLUG }}.zip . -x ".git/*" ".github/*" ".scripts/*" ".wordpress-org/*" "log/*" "tests/*" "*.md" "*.yml" "*.json" "*.neon" "*.lock" "*.xml" "*.dist" "*.example" "*.testing" "vendor/convertkit/convertkit-wordpress-libraries/.git/*" + zip -r ${{ env.PLUGIN_SLUG }}.zip . -x ".git/*" ".github/*" ".scripts/*" ".wordpress-org/*" "log/*" "node_modules/*" "tests/*" "*.md" "*.yml" "*.json" "*.neon" "*.lock" "*.xml" "*.dist" ".eslintrc.js" "*.example" "*.testing" "vendor/convertkit/convertkit-wordpress-libraries/.git/*" # Exchange API Keys and Secrets for OAuth Tokens. - name: Exchange API Key and Secret for OAuth Tokens diff --git a/.gitignore b/.gitignore index 28246c431..6c7bafbac 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,8 @@ log.txt package-lock.json phpstan.neon node_modules -resources/frontend/css/*.map +resources/frontend/css/ +resources/frontend/js/dist/ tests/_output tests/_wordpress tests/Support/_generated diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 3fd608b46..ab973bbd7 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -60,10 +60,6 @@ Typically, packages listed in this section would be internal development tools f - PHPStan - Codeception -### Build - -Run `npm run build` to compile frontend CSS and JS in one step. - ### CSS Run `npm run watch:css` to compile frontend CSS to `resources/frontend/css/frontend.css` when working on SCSS in the `resources/frontend/scss` folder. @@ -72,6 +68,22 @@ Run `npm run watch:css` to compile frontend CSS to `resources/frontend/css/front Run `npm run watch:js` to compile frontend JS to `resources/frontend/js/dist/frontend-min.js` when working on JS in the `resources/frontend/js` folder. +### Build + +Run `npm run build` to: +- fix CSS to WordPress Coding Standards (`npm run fix:css`) +- lint CSS to check WordPress Coding Standards met after any fixes (`npm run lint:css`) +- fix JS to WordPress Coding Standards (`npm run fix:js`) +- lint JS to check WordPress Coding Standards met after any fixes (`npm run lint:js`) +- compile frontend CSS from `resources/frontend/scss` to `resources/frontend/css/frontend.css` (`npm run build:css`) +- compile frontend JS from `resources/frontend/js` to `resources/frontend/js/dist` (`npm run build:js`) + +If the build process fails, review the terminal and make applicable changes: + +![npm run build errors](/.github/docs/npm-run-build-errors.png?raw=true) + +GitHub actions will run this step for you on testing and deployment, but it's a useful command in development if you need a single command to cover CSS + JS. + ## Committing Work Remember to commit your changes to your branch relatively frequently, with a meaningful, short summary that explains what the change(s) do. diff --git a/SETUP.md b/SETUP.md index 58507ae8c..2368806c5 100644 --- a/SETUP.md +++ b/SETUP.md @@ -97,6 +97,10 @@ This sets up: - JS compilation and minification - SASS compilation and minification +### Build JS and CSS + +Run `npm run build` to build the frontend CSS and JS. + ### Configure wp-config.php In the root of your WordPress installation, find the `wp-config.php` file. diff --git a/TESTING.md b/TESTING.md index c80f99cb8..6d307d76c 100644 --- a/TESTING.md +++ b/TESTING.md @@ -34,7 +34,7 @@ The following Composer commands can be used: | `composer fix-js-coding-standards` | `composer fix-js` | Fixes JS files to meet WordPress JS Coding Standards | | `composer build-js` | `composer build-js` | Builds the frontend JS file | | `composer watch-js` | `composer watch-js` | Builds the frontend JS file when changes are made to frontend JS files | -| `composer build` | `composer build` | Builds frontend CSS and JS | +| `composer build` | `composer build` | Fixes, lints and builds frontend CSS and JS | | `composer static-analysis` | `composer phpstan` | Runs PHPStan static analysis with increased memory limit | | `composer test` | `composer test` | Builds and runs end-to-end tests with `fail-fast` enabled | | `composer test-integration` | `composer test-integration` | Builds and runs integration tests with `fail-fast` enabled | @@ -47,7 +47,7 @@ The following npm commands can be used, if preferred: | `npm run watch:css` | Builds the frontend CSS file when changes are made to SCSS files | | `npm run build:js` | Builds the frontend JS file | | `npm run watch:js` | Builds the frontend JS file when changes are made to frontend JS files | -| `npm run build` | Builds frontend CSS and JS | +| `npm run build` | Fixes, lints and builds frontend CSS and JS | ## Write (or modify) a test diff --git a/composer.json b/composer.json index 792daf7df..800f2ab5c 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,10 @@ "lint-js": "npm run lint:js", "fix-js": "npm run fix:js", "build": [ + "npm run fix:css", + "npm run lint:css", + "npm run fix:js", + "npm run lint:js", "npm run build:css", "npm run build:js" ], diff --git a/package.json b/package.json index eafd3f5f8..abb3e621f 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "watch:js": "wp-scripts start resources/frontend/js/frontend.js --output-path=resources/frontend/js/dist --output-filename=frontend.min.js", "lint:js": "wp-scripts lint-js 'resources/frontend/js/*.js' --max-warnings=0", "fix:js": "wp-scripts lint-js 'resources/frontend/js/*.js' --fix", - "build": "npm run build:css && npm run build:js" + "build": "npm run fix:css && npm run lint:css && npm run fix:js && npm run lint:js && npm run build:css && npm run build:js" }, "prettier": "@wordpress/prettier-config", "devDependencies": { diff --git a/resources/frontend/css/frontend.css b/resources/frontend/css/frontend.css deleted file mode 100644 index 03c9274a7..000000000 --- a/resources/frontend/css/frontend.css +++ /dev/null @@ -1 +0,0 @@ -.convertkit-broadcasts-pagination{display:grid;grid-template-areas:"prev next";grid-template-columns:repeat(2, 1fr);grid-column-gap:20px;padding:20px 0 0 0}.convertkit-broadcasts-pagination li{list-style:none;margin:0}.convertkit-broadcasts-pagination li.convertkit-broadcasts-pagination-prev{grid-area:prev;text-align:left}.convertkit-broadcasts-pagination li.convertkit-broadcasts-pagination-next{grid-area:next;text-align:right}.convertkit-broadcasts-list,.convertkit-broadcasts-pagination{list-style:none;margin:0;padding:0}.editor-styles-wrapper .convertkit-broadcasts-list,.editor-styles-wrapper .convertkit-broadcasts-pagination{list-style:none;margin:0;padding:0}.convertkit-broadcasts-list li{list-style:none;margin:0;padding:5px 0;display:grid;grid-template-areas:"date title" "image text";grid-template-columns:150px auto;grid-column-gap:20px}.convertkit-broadcasts-list li time{display:inline-block;grid-area:date}.convertkit-broadcasts-list li .convertkit-broadcast-title{display:inline-block;grid-area:title}.convertkit-broadcasts-list li .convertkit-broadcast-image{display:inline-block;grid-area:image}.convertkit-broadcasts-list li .convertkit-broadcast-image img{max-width:100%;height:auto}.convertkit-broadcasts-list li .convertkit-broadcast-text{display:inline-block;grid-area:text;font-size:16px}.convertkit-broadcasts-list li .convertkit-broadcast-read-more{display:block;margin:10px 0 0 0}.convertkit-broadcasts{margin-bottom:20px}@media only screen and (min-width: 482px){.convertkit-broadcasts{margin-bottom:30px}}.convertkit-broadcasts.has-background,.convertkit-broadcasts[data-background-color]{padding:20px}.convertkit-broadcasts.convertkit-broadcasts-loading{background-color:#e3e3e3 !important;background-image:url(../images/spinner.gif);background-position:center;background-repeat:no-repeat}.editor-styles-wrapper .convertkit-broadcasts.has-background{padding:20px}.editor-styles-wrapper .convertkit-broadcasts.convertkit-broadcasts-loading{background-color:#e3e3e3 !important;background-image:url(../images/spinner.gif);background-position:center;background-repeat:no-repeat}.convertkit-broadcasts[data-display-order=broadcast-date] .convertkit-broadcasts-list li{grid-template-areas:"title date" "text image";grid-template-columns:auto 150px}.convertkit-broadcasts[data-display-grid="1"] .convertkit-broadcasts-list{display:grid;grid-template-columns:repeat(3, 1fr);grid-column-gap:20px;grid-row-gap:20px;align-items:start}@media screen and (max-width: 768px){.convertkit-broadcasts[data-display-grid="1"] .convertkit-broadcasts-list{grid-template-columns:repeat(2, 1fr)}}@media screen and (max-width: 478px){.convertkit-broadcasts[data-display-grid="1"] .convertkit-broadcasts-list{grid-template-columns:repeat(1, 1fr)}}.convertkit-broadcasts[data-display-grid="1"] .convertkit-broadcasts-list li{grid-template-areas:"image" "date" "title" "text";grid-template-columns:none;grid-row-gap:10px}.convertkit-broadcasts[data-display-grid="1"][data-display-order=broadcast-date] .convertkit-broadcasts-list li{grid-template-areas:"image" "title" "text" "date"}.convertkit-broadcasts[data-display-order=broadcast-date] .convertkit-broadcasts-list li time{text-align:right}.convertkit-broadcasts[data-display-grid="1"][data-display-order=broadcast-date] .convertkit-broadcasts-list li time{text-align:left}@media screen and (max-width: 478px){.convertkit-broadcasts-list li{grid-template-areas:"image image" "date date" "title title" "text text";grid-row-gap:10px}.convertkit-broadcasts[data-display-image="1"] .convertkit-broadcasts-list li{margin:0 0 20px 0}}body.convertkit-broadcast.elementor-default table,body.convertkit-broadcast.elementor-default table tbody,body.convertkit-broadcast.elementor-default table tbody td{border:none}body.convertkit-broadcast.elementor-default table tbody>tr:nth-child(odd)>td,body.convertkit-broadcast.elementor-default table tbody>tr:nth-child(odd)>th{background:none}.convertkit-product,.convertkit-button{margin-bottom:20px}@media only screen and (min-width: 482px){.convertkit-product,.convertkit-button{margin-bottom:30px}}.convertkit-product a,.convertkit-product span,.convertkit-button a,.convertkit-button span{display:block;padding:calc(.667em + 2px) calc(1.333em + 2px);cursor:pointer;text-align:center;text-decoration:none;word-break:break-word;box-sizing:border-box}.wp-block-convertkit-form-builder-field input,.wp-block-convertkit-form-builder-field textarea{width:100%;margin:0 0 20px 0;padding:10px;box-sizing:border-box;font-family:inherit}.wp-block-convertkit-form-builder-field label span.convertkit-form-builder-field-required{color:red}form .convertkit-form-builder-subscribed-message{width:100%;margin:0 0 20px 0;box-sizing:border-box}form.formkit-form[data-format=inline]{margin-left:auto;margin-right:auto;margin-bottom:20px}@media only screen and (min-width: 482px){form.formkit-form[data-format=inline]{margin-bottom:30px}}.formkit-sticky-bar{z-index:999999 !important}#convertkit-restrict-content *,#convertkit-restrict-content-modal *{box-sizing:border-box}#convertkit-restrict-content h3,#convertkit-restrict-content-modal h3{margin:0 0 20px 0;padding:0;font-size:24px;line-height:40px;font-style:normal}#convertkit-restrict-content h4,#convertkit-restrict-content-modal h4{margin:0 0 5px 0;padding:0;font-size:18px;line-height:30px;font-style:normal}#convertkit-restrict-content p,#convertkit-restrict-content-modal p{margin:0 0 20px 0;padding:0;font-size:16px;line-height:28px}#convertkit-restrict-content small,#convertkit-restrict-content-modal small{display:block;font-size:13px;line-height:22px;color:#111}#convertkit-restrict-content{width:100%;background:#f9f7f4;color:#373f45;margin:30px auto;padding:40px;text-align:center;box-sizing:border-box;border-radius:8px}#convertkit-restrict-content .convertkit-product a{display:inline-block;text-decoration:none;height:42px;line-height:42px;font-size:15px;margin:0;padding:0 20px !important;border:none;border-radius:3px}.convertkit-restrict-content-notice{display:inline-block;margin:0 0 20px 0;padding:0 0 0 30px;color:#d3434a;font-size:12px;line-height:24px;font-weight:400;background-image:url(../images/error.svg);background-repeat:no-repeat;background-size:24px 24px}form.convertkit-restrict-content-form input[type=submit]{height:42px;line-height:42px;font-size:15px;margin:0;padding:0 20px !important;border:none;border-radius:3px}form.convertkit-restrict-content-form div#convertkit-restrict-content-email-field{display:grid;grid-template-areas:"email button";grid-template-columns:3fr 1fr;grid-column-gap:5px;text-align:left;max-width:500px;height:56px;margin:0 auto 20px auto;padding:6px 10px;background-image:url(../images/email.svg);background-repeat:no-repeat;background-color:#fff;background-size:15px 15px;background-position:18px 20px;border:1px solid #fff;border-radius:3px}form.convertkit-restrict-content-form div#convertkit-restrict-content-email-field.convertkit-restrict-content-error{border-color:#d3434a}form.convertkit-restrict-content-form div#convertkit-restrict-content-email-field input[type=email]{grid-area:email;text-indent:35px;height:42px;line-height:42px;margin:0;padding:0;font-size:15px;background:none;border:none}form.convertkit-restrict-content-form div#convertkit-restrict-content-email-field input[type=submit]{grid-area:button}form.convertkit-restrict-content-form div#convertkit-subscriber-code-container{width:427px;height:100px;border:1px solid #dce1e5;border-radius:4px;margin:0 auto 20px auto;overflow:hidden;background:#dce1e5}form.convertkit-restrict-content-form div#convertkit-subscriber-code-container.convertkit-restrict-content-error{border-color:#d3434a}form.convertkit-restrict-content-form div#convertkit-subscriber-code-container input#convertkit-subscriber-code{--otp-digits: 6;--otp-height: 98px;--otp-number-width: 70px;--otp-letter-spacing: 41px;--otp-text-indent: 20px;--otp-border-color: #dce1e5;--otp-text-color: #697177;--otp-font-size: 50px;--_otp-digit: 0;all:unset;text-align:left;margin:0;padding:0;background:linear-gradient(90deg, #dce1e5 var(--otp-number-width), transparent 0),linear-gradient(90deg, #fff var(--otp-number-width), transparent 0);background-position:calc(var(--_otp-digit)*(var(--otp-number-width) + 1px)) 0,0 0;background-repeat:no-repeat,repeat-x;background-size:calc(var(--otp-number-width) + 1px) 100%;inline-size:calc(var(--otp-digits)*(var(--otp-number-width) + 1px));letter-spacing:var(--otp-letter-spacing);text-indent:var(--otp-text-indent);width:calc(var(--otp-number-width)*var(--otp-digits) + var(--otp-digits));height:var(--otp-height);color:var(--otp-text-color);font-size:var(--otp-font-size);font-family:monospace;font-weight:400}#convertkit-restrict-content-modal-background{display:none;position:fixed;width:100%;height:100%;z-index:999998;top:0;left:0;background:rgba(9,13,22,.8)}#convertkit-restrict-content-modal{box-sizing:border-box;display:none;position:fixed;z-index:999999;width:730px;height:328px;top:calc(50% - 164px);left:calc(50% - 365px);margin:0;padding:80px 115px;background:#fff;border:1px solid #fff;border-radius:8px;text-align:center}#convertkit-restrict-content-modal form.convertkit-restrict-content-form div#convertkit-restrict-content-email-field{background-color:#f4f6f8}#convertkit-restrict-content-modal #convertkit-restrict-content-modal-close{position:absolute;top:25px;right:25px;text-indent:-9999px;background-image:url(../images/cross.svg);background-repeat:no-repeat;background-size:12px 12px;background-color:rgba(0,0,0,0);border:none;cursor:pointer}#convertkit-restrict-content-modal-loading{box-sizing:border-box;display:none;position:absolute;z-index:1000000;width:100%;height:100%;top:0;left:0;margin:0;padding:0;background:url(../images/spinner.gif) center no-repeat hsla(0,0%,100%,.8);border:none;border-radius:8px;text-align:center}@media screen and (max-width: 730px){#convertkit-restrict-content{padding:20px}#convertkit-restrict-content .convertkit-restrict-content-actions{padding:10px}#convertkit-restrict-content input[type=email],#convertkit-restrict-content input[type=text],#convertkit-restrict-content input#convertkit-subscriber-code{width:100%}form.convertkit-restrict-content-form div#convertkit-restrict-content-email-field{grid-template-areas:"email email" "button button";max-width:100%;height:auto}form.convertkit-restrict-content-form div#convertkit-restrict-content-email-field input[type=submit]{margin-top:10px}form.convertkit-restrict-content-form div#convertkit-subscriber-code-container{width:213px;height:50px}form.convertkit-restrict-content-form div#convertkit-subscriber-code-container input#convertkit-subscriber-code{--otp-height: 49px;--otp-number-width: 35px;--otp-letter-spacing: 20px;--otp-text-indent: 10px;--otp-font-size: 25px}#convertkit-restrict-content-modal{width:90%;height:auto;left:5%;padding:40px}} diff --git a/resources/frontend/js/dist/frontend.min.asset.php b/resources/frontend/js/dist/frontend.min.asset.php deleted file mode 100644 index 4ae57eb6f..000000000 --- a/resources/frontend/js/dist/frontend.min.asset.php +++ /dev/null @@ -1 +0,0 @@ - array(), 'version' => '27c29088bdf910a921c1'); diff --git a/resources/frontend/js/dist/frontend.min.js b/resources/frontend/js/dist/frontend.min.js deleted file mode 100644 index afeeda6b8..000000000 --- a/resources/frontend/js/dist/frontend.min.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var t={184:()=>{document.addEventListener("DOMContentLoaded",function(){document.addEventListener("click",function(t){if(t.target.matches("ul.convertkit-broadcasts-pagination a")){t.preventDefault();const e=t.target.closest("div.convertkit-broadcasts");!function(t,e){convertkit_broadcasts.debug&&(console.log("convertKitBroadcastsRender()"),console.log(e)),t.classList.add("convertkit-broadcasts-loading");const n=new URLSearchParams(e),o=`${convertkit_broadcasts.ajax_url}?${n.toString()}`;fetch(o).then(function(t){return convertkit_broadcasts.debug&&console.log(t),t.json()}).then(function(e){convertkit_broadcasts.debug&&console.log(e),t.classList.remove("convertkit-broadcasts-loading"),t.innerHTML=e}).catch(function(e){convertkit.debug&&console.error(e),t.classList.remove("convertkit-broadcasts-loading")})}(e,{display_date:e.dataset.displayDate,date_format:e.dataset.dateFormat,display_image:e.dataset.displayImage,display_description:e.dataset.displayDescription,display_read_more:e.dataset.displayReadMore,read_more_label:e.dataset.readMoreLabel,limit:e.dataset.limit,paginate:e.dataset.paginate,paginate_label_prev:e.dataset.paginateLabelPrev,paginate_label_next:e.dataset.paginateLabelNext,link_color:e.dataset.linkColor,page:t.target.dataset.page})}})})},509:()=>{function t(t,e){const n=new CustomEvent(t,{detail:e});document.dispatchEvent(n)}window.convertKitRecaptchaFormSubmit=function(t){document.querySelector('[type="submit"][data-callback="convertKitRecaptchaFormSubmit"]').closest("form").submit()},document.addEventListener("DOMContentLoaded",function(){!function(e){const n=new URL(e),o=n.searchParams.get("ck_subscriber_id");if(null===o)return;n.searchParams.delete("ck_subscriber_id");const r=document.getElementsByTagName("title")[0].innerHTML;let c=n.searchParams.toString();c.length>0&&(c="?"+c),window.history.replaceState(null,r,n.pathname+c+n.hash),t("kit_subscriber_id_removed_from_url",{id:o})}(window.location.href),document.addEventListener("click",function(e){if(!(e.target.matches(".formkit-submit")||e.target.parentElement&&e.target.parentElement.matches(".formkit-submit")))return void(convertkit.debug&&console.log("not a ck form"));const n=document.querySelector('input[name="email_address"]').value;n.length?/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n.toLowerCase())?(function(){const t=(new Date).getTime();for(let e=0;e<1e7&&!((new Date).getTime()-t>2e3);e++);}(),function(e){convertkit.debug&&(console.log("convertStoreSubscriberEmailAsIDInCookie"),console.log(e)),fetch(convertkit.ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-WP-Nonce":convertkit.nonce},body:new URLSearchParams({email:e})}).then(function(t){return convertkit.debug&&console.log(t),t.json()}).then(function(n){convertkit.debug&&console.log(n),t("convertkit_user_subscribed",{id:n.id,email:e})}).catch(function(t){convertkit.debug&&console.error(t)})}(n)):convertkit.debug&&console.log("email not an email address"):convertkit.debug&&console.log("email empty")}),document.querySelectorAll('script[data-kit-limit-per-session="1"]').length>0&&(document.cookie="ck_non_inline_form_displayed=1; path=/",convertkit.debug&&console.log("Set `ck_non_inline_form_displayed` cookie for non-inline form limit"))})},688:()=>{function t(){const t=document.querySelector("#convertkit-subscriber-code");null!==t&&t.addEventListener("input",function(){t.style.setProperty("--_otp-digit",t.value.length),6===t.value.length&&(t.setSelectionRange(0,0),t.blur(),document.querySelector("#convertkit-restrict-content-form").requestSubmit())})}document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".convertkit-restrict-content-modal-open").forEach(function(t){t.addEventListener("click",function(t){t.preventDefault(),document.querySelector("#convertkit-restrict-content-modal-background").style.display="block",document.querySelector("#convertkit-restrict-content-modal").style.display="block"})}),document.addEventListener("submit",function(e){e.target.matches("form#convertkit-restrict-content-form")&&(e.preventDefault(),function(e){if(document.querySelectorAll('input[type="text"], input[type="email"], input[type="submit"]').forEach(function(t){t.setAttribute("disabled","disabled")}),document.querySelector("#convertkit-restrict-content-modal-loading").style.display="block",null!==document.querySelector("input#convertkit-subscriber-code"))return n=convertkit_restrict_content.nonce,o=e.target.querySelector('input[name="subscriber_code"]').value,r=e.target.querySelector('input[name="token"]').value,c=e.target.querySelector('input[name="convertkit_post_id"]').value,fetch(convertkit_restrict_content.subscriber_verification_url,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":n},body:JSON.stringify({subscriber_code:o,token:r,convertkit_post_id:c})}).then(function(t){return convertkit_restrict_content.debug&&console.log(t),t.json()}).then(function(e){if(convertkit_restrict_content.debug&&console.log(e),!e.success)return document.querySelector("#convertkit-restrict-content-modal-content").innerHTML=e.data,document.querySelector("#convertkit-restrict-content-modal-loading").style.display="none",void t();window.location=e.url}).catch(function(t){convertkit_restrict_content.debug&&console.error(t)}),!1;var n,o,r,c;!function(e,n,o,r,c){fetch(convertkit_restrict_content.subscriber_authentication_url,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":e},body:JSON.stringify({convertkit_email:n,convertkit_resource_type:o,convertkit_resource_id:r,convertkit_post_id:c})}).then(function(t){return convertkit_restrict_content.debug&&console.log(t),t.json()}).then(function(e){convertkit_restrict_content.debug&&console.log(e),void 0!==e.code?document.querySelector("#convertkit-restrict-content-modal-content").innerHTML=e.message:document.querySelector("#convertkit-restrict-content-modal-content").innerHTML=e.data,document.querySelector("#convertkit-restrict-content-modal-loading").style.display="none",t()}).catch(function(t){convertkit_restrict_content.debug&&console.error(t)})}(convertkit_restrict_content.nonce,e.target.querySelector('input[name="convertkit_email"]').value,e.target.querySelector('input[name="convertkit_resource_type"]').value,e.target.querySelector('input[name="convertkit_resource_id"]').value,e.target.querySelector('input[name="convertkit_post_id"]').value)}(e))});const e=document.querySelector("#convertkit-restrict-content-modal-close");null!==e&&e.addEventListener("click",function(t){t.preventDefault(),document.querySelector("#convertkit-restrict-content-modal-background").style.display="none",document.querySelector("#convertkit-restrict-content-modal-loading").style.display="none",document.querySelector("#convertkit-restrict-content-modal").style.display="none"})})}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var c=e[o]={exports:{}};return t[o](c,c.exports,n),c.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";n(184),n(509),n(688)})()})(); \ No newline at end of file