Updated: 2026-02-27
This version runs on jQuery 4.0.0 and includes a 10-scenario real-life demo hub, schema-driven themed demos, strict validation, quote persistence, local autosave/share state, and print/PDF/CSV export from live summary.
index.php - scenario hub listing 10 real-life demo typesscenario-demo.php - runtime page for each scenario (?scenario=slug)scenario-demo.js - schema configs + runtime logic for all scenariosscenario-demo.css - themed styling variants per scenariobuilder.php - visual schema builder + live rendererlegacy-demo.html - retained legacy demodemo.css - previous single-demo stylesheet (retained)builder.css - visual builder page stylinglib-pcc/jquery-4.0.0.min.js - jQuery runtimelib-pcc/jquery.pcc.js - plugin logiclib-pcc/jquery.pcc.min.js - synchronized plugin buildlib-pcc/pcc.css - plugin UI styles (summary/actions/wizard/modal)send_email.php - secured email endpointquote_storage.php - SQLite quote storage layerquote_api.php - save/load quote JSON APIadmin_quotes.php - quote records admin viewerCHANGELOG.md - plugin release historyMIGRATION_GUIDE.md - upgrade notes for integrators<script>wpcc_domain = 'https://yourdomain.com/PCC';</script>
<script>wpcc_csrf_token = 'server-generated-token';</script>
<script src="lib-pcc/jquery-4.0.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="lib-pcc/jquery.pcc.js"></script>
<link rel="stylesheet" href="lib-pcc/pcc.css" />
<script>jQuery(function($){ $('#my-form').pcc(); });</script>
If jsPDF is not loaded, PDF action falls back to print mode.
Each calculator form must use class pcc-form with an ID. The summary container must be that ID plus -show.
<form id="myquote" class="pcc-form" data-curr=" USD">...</form> <div id="myquote-show" class="wpcc-preview"></div>
data-title - line item labeldata-cost - fixed cost or thisdata-mult - multiplierdata-tax-rate, data-discount-fixed, data-discount-percent, data-coupons JSONPCC supports required fields, numeric bounds, length bounds, regex, type checks, and custom messages per field.
data-required="1"data-min, data-max (numeric bounds)data-minlen, data-maxlendata-pattern (JavaScript regex body)data-validate="email|number"data-msg-required, data-msg-min, data-msg-maxdata-msg-minlen, data-msg-maxlendata-msg-pattern, data-msg-email, data-msg-number<input
name="client_phone"
data-title="Phone Number"
data-required="1"
data-pattern="^[0-9+()\\-\\s]{10,20}$"
data-msg-required="Phone number is required."
data-msg-pattern="Use a valid phone format."
/>
Invalid fields/groups get .pcc-invalid and are blocked before wizard next step or email send.
data-wizard="1" on form..pcc-step and optional data-step-title.<form class="pcc-form" id="quote" data-wizard="1"> <section class="pcc-step" data-step-title="Scope">...</section> <section class="pcc-step" data-step-title="Contact">...</section> </form>
quote_api.php?action=save.pcc_state payload for browser-to-browser restore.quote_id.All exports are generated from the live summary output (#formid-show).
data-show-if supports field=value, field!=value, OR with |, and multiple clauses with ;.data-coupons JSON map.data-show-if="timeline=2500;project_scope!=8500"
PCC now exposes a public API for host projects:
$('#my-form').pcc(); // init
$('#my-form').pcc('recalc');
$('#my-form').pcc('validate');
$('#my-form').pcc('getState');
$('#my-form').pcc('setState', stateObj);
$('#my-form').pcc('goToStep', 2);
$('#my-form').pcc('undo');
$('#my-form').pcc('redo');
$('#my-form').pcc('destroy');
Utility object: $.pcc.version, $.pcc.defaults, $.pcc.registerAdapter(name, binder), $.pcc.recalcAll().
Plugin emits extension events for host apps and no-core-edit customization.
pcc:beforeCalcpcc:afterCalcpcc:validationFailpcc:stepChangepcc:stateChange$('#my-form').on('pcc:afterCalc', function (e, payload) {
console.log(payload.finalTotal);
});
data-formula with field references: {field_name}.min, max, abs, round, ceil, floor, pow.&&, ||, (), and comparisons >, <, >=, <=, !=, =.<input data-formula="({floor_area}*0.3)+({room_count}*120)" />
<div data-show-if="(timeline=2500 || project_scope=22000) && floor_area>=1000"></div>
$.pcc.validateSchema(schema) to validate config.$.pcc.schemaToHtml(schema) to generate markup string.$.pcc.renderSchema(target, schema, options) to render and initialize live form.builder.php provides visual field/step editing and JSON transport workflow.const result = $.pcc.renderSchema('#preview', schemaConfig, {
skipRestore: true,
autosave: false
});
Builder supports copy JSON, download JSON (Blob API), import JSON, and render back to interactive form.
ruleDebugger: true or form attribute data-rule-debugger="1".data-pcc-repeater + data-pcc-repeat-item with built-in add/remove actions.Ctrl/Cmd+Z, Ctrl/Cmd+Y, Shift+Ctrl/Cmd+Z).data-locale / options.theme map -> --pcc-* CSS vars).POST quote_api.php?action=save with CSRF token stores quote payload.GET quote_api.php?action=get"e_id=... returns quote JSON.admin_quotes.php lists saved quotes and shows quote detail.SQLite database file is auto-created at data/pcc_quotes.sqlite.
send_email.php validates CSRF, honeypot, and request timing.