@libreform/libreform
Advanced tools
| { | ||
| "info": { | ||
| "_postman_id": "bc5ea88b-4152-4695-bd3f-e4d50549b4b8", | ||
| "name": "Libreform 2.0", | ||
| "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" | ||
| }, | ||
| "item": [ | ||
| { | ||
| "name": "Form", | ||
| "request": { | ||
| "method": "GET", | ||
| "header": [], | ||
| "url": { | ||
| "raw": "http://libreform.lndo.site/wp-json/wplf/v2/getForm?form=213", | ||
| "protocol": "http", | ||
| "host": [ | ||
| "libreform", | ||
| "lndo", | ||
| "site" | ||
| ], | ||
| "path": [ | ||
| "wp-json", | ||
| "wplf", | ||
| "v2", | ||
| "getForm" | ||
| ], | ||
| "query": [ | ||
| { | ||
| "key": "form", | ||
| "value": "213" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "response": [] | ||
| }, | ||
| { | ||
| "name": "Get forms", | ||
| "request": { | ||
| "method": "GET", | ||
| "header": [], | ||
| "url": { | ||
| "raw": "http://libreform.lndo.site/wp-json/wplf/v2/getForms?page=0", | ||
| "protocol": "http", | ||
| "host": [ | ||
| "libreform", | ||
| "lndo", | ||
| "site" | ||
| ], | ||
| "path": [ | ||
| "wp-json", | ||
| "wplf", | ||
| "v2", | ||
| "getForms" | ||
| ], | ||
| "query": [ | ||
| { | ||
| "key": "page", | ||
| "value": "0" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "response": [] | ||
| }, | ||
| { | ||
| "name": "Delete subs", | ||
| "request": { | ||
| "method": "DELETE", | ||
| "header": [], | ||
| "body": { | ||
| "mode": "raw", | ||
| "raw": "{\r\n \"form\": 1,\r\n \"submissionUuids\": [\"b714ca4b-6c77-4277-95c6-9d739b2a5f30\"]\r\n}", | ||
| "options": { | ||
| "raw": { | ||
| "language": "json" | ||
| } | ||
| } | ||
| }, | ||
| "url": { | ||
| "raw": "http://libreform.lndo.site/wp-json/wplf/v2/deleteSubmissions", | ||
| "protocol": "http", | ||
| "host": [ | ||
| "libreform", | ||
| "lndo", | ||
| "site" | ||
| ], | ||
| "path": [ | ||
| "wp-json", | ||
| "wplf", | ||
| "v2", | ||
| "deleteSubmissions" | ||
| ], | ||
| "query": [ | ||
| { | ||
| "key": "form", | ||
| "value": "213", | ||
| "disabled": true | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "response": [] | ||
| }, | ||
| { | ||
| "name": "Get submission", | ||
| "request": { | ||
| "method": "GET", | ||
| "header": [], | ||
| "url": { | ||
| "raw": "http://libreform.lndo.site/wp-json/wplf/v2/getSubmission?form=1&uuid=d3a0110e-d2dc-4935-b461-5273f031c1be", | ||
| "protocol": "http", | ||
| "host": [ | ||
| "libreform", | ||
| "lndo", | ||
| "site" | ||
| ], | ||
| "path": [ | ||
| "wp-json", | ||
| "wplf", | ||
| "v2", | ||
| "getSubmission" | ||
| ], | ||
| "query": [ | ||
| { | ||
| "key": "form", | ||
| "value": "1" | ||
| }, | ||
| { | ||
| "key": "uuid", | ||
| "value": "d3a0110e-d2dc-4935-b461-5273f031c1be" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "response": [] | ||
| }, | ||
| { | ||
| "name": "Render ", | ||
| "request": { | ||
| "method": "GET", | ||
| "header": [], | ||
| "url": { | ||
| "raw": "" | ||
| } | ||
| }, | ||
| "response": [] | ||
| } | ||
| ], | ||
| "protocolProfileBehavior": {} | ||
| } |
+5
-2
@@ -107,3 +107,6 @@ import { WPLF_Form } from './classes/wplf-form'; | ||
| export declare type GetFormResponse = ApiError | { | ||
| data: Form; | ||
| data: { | ||
| raw: Form; | ||
| rendered: string; | ||
| }; | ||
| }; | ||
@@ -140,3 +143,3 @@ export declare type GetFormApiResponse = ApiResponse<ResponseType.GetForm, GetFormResponse>; | ||
| export declare type ApiErrorApiResponse = ApiResponse<ResponseType.ApiError, ApiError>; | ||
| export declare type GenericApiResponse = GetFormApiResponse | GetSubmissionsApiResponse | RenderFormApiResponse | SubmitFormApiResponse | ApiErrorApiResponse; | ||
| export declare type GenericApiResponse = GetFormApiResponse | GetFormsApiResponse | GetSubmissionsApiResponse | GetSubmissionApiResponse | RenderFormApiResponse | DeleteSubmissionsApiResponse | SubmitFormApiResponse | ApiErrorApiResponse; | ||
| declare global { | ||
@@ -143,0 +146,0 @@ interface Window { |
@@ -1,2 +0,2 @@ | ||
| .wplf{box-sizing:border-box}.wplfform:focus{outline:0}.wplf *,.wplf *:before,.wplf *:after{box-sizing:inherit}.wplf-formRow{display:flex;flex-flow:column wrap;justify-content:space-evenly;max-width:100%}.wplf-formRow>*{flex:1 1 auto;margin:0.5rem 0}.wplf-formRow.wplf-fcaptcha{position:absolute;left:-1000000000px;bottom:-1000000000px}.wplf-formRow label strong{display:block}.wplf-formRow input{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding:0.5rem}.wplf-formRow input[type='checkbox'],.wplf-formRow input[type='radio']{width:1rem;height:1rem;line-height:0;flex-grow:0;flex-shrink:0}.wplf-formRow input[type='checkbox']+strong,.wplf-formRow input[type='radio']+strong{display:inline}.wplf-formRow button,.wplf-formRow input[type='button']{flex-grow:0}.wplf-formRow select{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding-left:0.5rem;padding-right:0.5rem}.wplf-formRow textarea{width:100%;height:10rem}@media (min-width: 600px){.wplf-formRow{max-width:100%;flex-flow:row nowrap;align-items:center}.wplf-formRow>*{margin-right:1rem}.wplf-formRow>*:last-child{margin-right:0}}.wplf-tabs__tab:not(.active){display:none}.wplf-tabs__tab.active{display:block}.wplf-tabs header{border-bottom:1px solid #ccd0d4;display:flex;flex-flow:row wrap;justify-content:space-between;text-align:center}@media (max-width: 480px){.wplf-tabs header{flex-flow:column wrap}}.wplf-tabs__tabSwitcher{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;padding:0.5rem 2rem;border:0;cursor:pointer;font-weight:700;color:inherit}.wplf-tabs__tabSwitcher:hover,.wplf-tabs__tabSwitcher.active,.wplf-tabs__tabSwitcher:focus{background:rgba(0,0,0,0.07)}.wplf-submissionModal{position:absolute;top:50%;left:50%;right:auto;bottom:auto;margin-right:-50%;transform:translate(-50%, -50%);width:90%;background-color:#f1f1f1}.wplf-submissionModal__overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.7);z-index:999999999999999999}.wplf-submissionModal__wrapper{display:flex;flex-flow:column nowrap;padding:2rem 2rem}.wplf-submissionModal__wrapper h2{margin-top:0}.wplf-submissionModal__wrapper table{text-align:left;border-collapse:collapse;width:100%}.wplf-submissionModal__wrapper tr{background:#f1f1f1}.wplf-submissionModal__wrapper tr:nth-child(even){background:#e2e2e2}.wplf-submissionModal__wrapper th,.wplf-submissionModal__wrapper td{padding:0.5rem 1rem;vertical-align:middle;border:1px solid #222}.wplf-submissionModal__buttons{margin-top:2rem;display:flex;flex-flow:row wrap;align-items:center;justify-content:space-between}.post-type-libreform #wp-content-wrap{display:none}.post-type-libreform #post-status-info{border-bottom:0}.post-type-libreform #titlediv .inside{margin-bottom:0.5rem}.libreform_page_wplfAddons #wpcontent{padding-left:0}@media (min-width: 600px){.wplf-formRow{max-width:100%}}.wplf-formFields__field{background:#f5f5f5;border:0;border-bottom:1px solid #ccd0d4;padding:0.5rem 1rem;position:relative}.wplf-formFields__field:last-child{border-bottom:0}.wplf-formFields__field strong{display:block}.wplf-formFields__field__type{font-size:0.75em}.wplf-formFields__field__alert{position:absolute;right:1rem;top:25px;background:red;color:white;padding:0.25rem;font-size:1.25rem;border-radius:100%;transform:translateY(-50%);width:20px;height:20px;line-height:20px;text-align:center;font-weight:700}#wplfFieldsMetabox .inside{padding:0;margin:0}.wplf-editor .CodeMirror,.wplf-editor .wplf-cmEditor{height:70vh;width:calc(100% - 2px);margin-bottom:1rem;border:1px solid #ccd0d4;border-top:0;overflow:hidden;box-shadow:0 1px 1px rgba(0,0,0,0.04)}.wplf-editor .cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.wplf-editor .cm-s-monokai div.CodeMirror-selected{background:#49483E}.wplf-editor .cm-s-monokai .CodeMirror-line::-moz-selection, .wplf-editor .cm-s-monokai .CodeMirror-line>span::-moz-selection, .wplf-editor .cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,0.99)}.wplf-editor .cm-s-monokai .CodeMirror-line::selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span::selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span>span::selection{background:rgba(73,72,62,0.99)}.wplf-editor .cm-s-monokai .CodeMirror-line::-moz-selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span::-moz-selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,0.99)}.wplf-editor .cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0px}.wplf-editor .cm-s-monokai .CodeMirror-guttermarker{color:white}.wplf-editor .cm-s-monokai .CodeMirror-guttermarker-subtle{color:#d0d0d0}.wplf-editor .cm-s-monokai .CodeMirror-linenumber{color:#d0d0d0}.wplf-editor .cm-s-monokai .CodeMirror-cursor{border-left:1px solid #f8f8f0}.wplf-editor .cm-s-monokai span.cm-comment{color:#75715e}.wplf-editor .cm-s-monokai span.cm-atom{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-number{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-comment.cm-attribute{color:#97b757}.wplf-editor .cm-s-monokai span.cm-comment.cm-def{color:#bc9262}.wplf-editor .cm-s-monokai span.cm-comment.cm-tag{color:#bc6283}.wplf-editor .cm-s-monokai span.cm-comment.cm-type{color:#5998a6}.wplf-editor .cm-s-monokai span.cm-property,.wplf-editor .cm-s-monokai span.cm-attribute{color:#a6e22e}.wplf-editor .cm-s-monokai span.cm-keyword{color:#f92672}.wplf-editor .cm-s-monokai span.cm-builtin{color:#66d9ef}.wplf-editor .cm-s-monokai span.cm-string{color:#e6db74}.wplf-editor .cm-s-monokai span.cm-variable{color:#f8f8f2}.wplf-editor .cm-s-monokai span.cm-variable-2{color:#9effff}.wplf-editor .cm-s-monokai span.cm-variable-3,.wplf-editor .cm-s-monokai span.cm-type{color:#66d9ef}.wplf-editor .cm-s-monokai span.cm-def{color:#fd971f}.wplf-editor .cm-s-monokai span.cm-bracket{color:#f8f8f2}.wplf-editor .cm-s-monokai span.cm-tag{color:#f92672}.wplf-editor .cm-s-monokai span.cm-header{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-link{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-error{background:#f92672;color:#f8f8f0}.wplf-editor .cm-s-monokai .CodeMirror-activeline-background{background:#373831}.wplf-editor .cm-s-monokai .CodeMirror-matchingbracket{text-decoration:underline;color:white !important}.wplf-tabs{background:#fff;box-shadow:0 1px 1px rgba(0,0,0,0.04);border:1px solid #ccd0d4}.wplf-tabs h2,.wplf-tabs h3,.wplf-tabs h4{padding-left:0 !important;padding-right:0 !important}.wplf-tabs section{padding:12px 12px 12px}.wplf-tabs code{display:block;padding:12px;white-space:pre;margin:1rem 0}.wplf-tabs .wplf-tabs__tabSwitcher{flex:1 1 auto;background:#32373c;color:#f1f1f1}.wplf-tabs .wplf-tabs__tabSwitcher.active,.wplf-tabs .wplf-tabs__tabSwitcher:focus,.wplf-tabs .wplf-tabs__tabSwitcher:hover{background:#0073aa}.wplf-tabs .wplf-selectors{padding:0}.wplf-tabs .wplf-selectors p,.wplf-tabs .wplf-selectors h2,.wplf-tabs .wplf-selectors h3,.wplf-tabs .wplf-selectors h4{margin:1rem 12px}.wplf-tabs .wplf-selectors__selector{padding-top:1rem;border-bottom:1px solid #000}.wplf-tabs .wplf-selectors__selector__name,.wplf-tabs .wplf-selectors__selector__description,.wplf-tabs .wplf-selectors__selector__usage{margin:1rem 12px}.wplf-tabs .wplf-selectors__selector__example{margin:0}.wplf-tabs .wplf-selectors__selector:first-child{border-top:1px solid #000}.wplf-tabs .wplf-selectors__selector:last-child{border-bottom:none}.wplf-tabs .wplf-settings{padding:0}.wplf-tabs .wplf-settings .wplf-formSettings{border:0}.wplf-tabs .wplf-settings .wplf-formSettings .CodeMirror,.wplf-tabs .wplf-settings .wplf-formSettings .wplf-cmEditor{height:300px;width:100%}.wplf-submissionList__header{display:table;width:100%}.wplf-submissionList__header>*{display:table-cell}.wplf-submissionList__submission{display:table;width:100%}.wplf-submissionList__submission>*{display:table-cell;vertical-align:middle;padding:2px 4px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.wplf-submissionList__submission>* strong{display:block;font-size:0.75em} | ||
| .wplf{box-sizing:border-box}.wplfform:focus{outline:0}.wplf *,.wplf *:before,.wplf *:after{box-sizing:inherit}.wplf-formRow{display:flex;flex-flow:column wrap;justify-content:space-evenly;max-width:100%}.wplf-formRow>*{flex:1 1 auto;margin:0.5rem 0}.wplf-formRow.wplf-fcaptcha{position:absolute;left:-1000000000px;bottom:-1000000000px}.wplf-formRow label strong{display:block}.wplf-formRow input{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding:0.5rem}.wplf-formRow input[type='checkbox'],.wplf-formRow input[type='radio']{width:1rem;height:1rem;line-height:0;flex-grow:0;flex-shrink:0}.wplf-formRow input[type='checkbox']+strong,.wplf-formRow input[type='radio']+strong{display:inline}.wplf-formRow button,.wplf-formRow input[type='button']{flex-grow:0}.wplf-formRow select{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding-left:0.5rem;padding-right:0.5rem}.wplf-formRow textarea{width:100%;height:10rem}@media (min-width: 600px){.wplf-formRow{max-width:100%;flex-flow:row nowrap;align-items:center}.wplf-formRow>*{margin-right:1rem}.wplf-formRow>*:last-child{margin-right:0}}.wplf-form{transition:0.3s linear}.wplf-form.submitting{opacity:0.7;cursor:not-allowed;pointer-events:none}.wplf-tabs__tab:not(.active){display:none}.wplf-tabs__tab.active{display:block}.wplf-tabs header{border-bottom:1px solid #ccd0d4;display:flex;flex-flow:row wrap;justify-content:space-between;text-align:center}@media (max-width: 480px){.wplf-tabs header{flex-flow:column wrap}}.wplf-tabs__tabSwitcher{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;padding:0.5rem 2rem;border:0;cursor:pointer;font-weight:700;color:inherit}.wplf-tabs__tabSwitcher:hover,.wplf-tabs__tabSwitcher.active,.wplf-tabs__tabSwitcher:focus{background:rgba(0,0,0,0.07)}.wplf-submissionModal{position:absolute;top:50%;left:50%;right:auto;bottom:auto;margin-right:-50%;transform:translate(-50%, -50%);width:90%;background-color:#f1f1f1}.wplf-submissionModal__overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.7);z-index:999999999999999999}.wplf-submissionModal__wrapper{display:flex;flex-flow:column nowrap;padding:2rem 2rem}.wplf-submissionModal__wrapper h2{margin-top:0}.wplf-submissionModal__wrapper table{text-align:left;border-collapse:collapse;width:100%}.wplf-submissionModal__wrapper tr{background:#f1f1f1}.wplf-submissionModal__wrapper tr:nth-child(even){background:#e2e2e2}.wplf-submissionModal__wrapper th,.wplf-submissionModal__wrapper td{padding:0.5rem 1rem;vertical-align:middle;border:1px solid #222}.wplf-submissionModal__buttons{margin-top:2rem;display:flex;flex-flow:row wrap;align-items:center;justify-content:space-between}.post-type-libreform #wp-content-wrap{display:none}.post-type-libreform #post-status-info{border-bottom:0}.post-type-libreform #titlediv .inside{margin-bottom:0.5rem}.libreform_page_wplfAddons #wpcontent{padding-left:0}@media (min-width: 600px){.wplf-formRow{max-width:100%}}.wplf-formFields__field{background:#f5f5f5;border:0;border-bottom:1px solid #ccd0d4;padding:0.5rem 1rem;position:relative}.wplf-formFields__field:last-child{border-bottom:0}.wplf-formFields__field strong{display:block}.wplf-formFields__field__type{font-size:0.75em}.wplf-formFields__field__alert{position:absolute;right:1rem;top:25px;background:red;color:white;padding:0.25rem;font-size:1.25rem;border-radius:100%;transform:translateY(-50%);width:20px;height:20px;line-height:20px;text-align:center;font-weight:700}#wplfFieldsMetabox .inside{padding:0;margin:0}.wplf-editor .CodeMirror,.wplf-editor .wplf-cmEditor{height:70vh;width:calc(100% - 2px);margin-bottom:1rem;border:1px solid #ccd0d4;border-top:0;overflow:hidden;box-shadow:0 1px 1px rgba(0,0,0,0.04)}.wplf-editor .cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.wplf-editor .cm-s-monokai div.CodeMirror-selected{background:#49483E}.wplf-editor .cm-s-monokai .CodeMirror-line::-moz-selection, .wplf-editor .cm-s-monokai .CodeMirror-line>span::-moz-selection, .wplf-editor .cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,0.99)}.wplf-editor .cm-s-monokai .CodeMirror-line::selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span::selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span>span::selection{background:rgba(73,72,62,0.99)}.wplf-editor .cm-s-monokai .CodeMirror-line::-moz-selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span::-moz-selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,0.99)}.wplf-editor .cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0px}.wplf-editor .cm-s-monokai .CodeMirror-guttermarker{color:white}.wplf-editor .cm-s-monokai .CodeMirror-guttermarker-subtle{color:#d0d0d0}.wplf-editor .cm-s-monokai .CodeMirror-linenumber{color:#d0d0d0}.wplf-editor .cm-s-monokai .CodeMirror-cursor{border-left:1px solid #f8f8f0}.wplf-editor .cm-s-monokai span.cm-comment{color:#75715e}.wplf-editor .cm-s-monokai span.cm-atom{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-number{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-comment.cm-attribute{color:#97b757}.wplf-editor .cm-s-monokai span.cm-comment.cm-def{color:#bc9262}.wplf-editor .cm-s-monokai span.cm-comment.cm-tag{color:#bc6283}.wplf-editor .cm-s-monokai span.cm-comment.cm-type{color:#5998a6}.wplf-editor .cm-s-monokai span.cm-property,.wplf-editor .cm-s-monokai span.cm-attribute{color:#a6e22e}.wplf-editor .cm-s-monokai span.cm-keyword{color:#f92672}.wplf-editor .cm-s-monokai span.cm-builtin{color:#66d9ef}.wplf-editor .cm-s-monokai span.cm-string{color:#e6db74}.wplf-editor .cm-s-monokai span.cm-variable{color:#f8f8f2}.wplf-editor .cm-s-monokai span.cm-variable-2{color:#9effff}.wplf-editor .cm-s-monokai span.cm-variable-3,.wplf-editor .cm-s-monokai span.cm-type{color:#66d9ef}.wplf-editor .cm-s-monokai span.cm-def{color:#fd971f}.wplf-editor .cm-s-monokai span.cm-bracket{color:#f8f8f2}.wplf-editor .cm-s-monokai span.cm-tag{color:#f92672}.wplf-editor .cm-s-monokai span.cm-header{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-link{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-error{background:#f92672;color:#f8f8f0}.wplf-editor .cm-s-monokai .CodeMirror-activeline-background{background:#373831}.wplf-editor .cm-s-monokai .CodeMirror-matchingbracket{text-decoration:underline;color:white !important}.wplf-tabs{background:#fff;box-shadow:0 1px 1px rgba(0,0,0,0.04);border:1px solid #ccd0d4}.wplf-tabs h2,.wplf-tabs h3,.wplf-tabs h4{padding-left:0 !important;padding-right:0 !important}.wplf-tabs section{padding:12px 12px 12px}.wplf-tabs code{display:block;padding:12px;white-space:pre;margin:1rem 0}.wplf-tabs .wplf-tabs__tabSwitcher{flex:1 1 auto;background:#32373c;color:#f1f1f1}.wplf-tabs .wplf-tabs__tabSwitcher.active,.wplf-tabs .wplf-tabs__tabSwitcher:focus,.wplf-tabs .wplf-tabs__tabSwitcher:hover{background:#0073aa}.wplf-tabs .wplf-selectors{padding:0}.wplf-tabs .wplf-selectors p,.wplf-tabs .wplf-selectors h2,.wplf-tabs .wplf-selectors h3,.wplf-tabs .wplf-selectors h4{margin:1rem 12px}.wplf-tabs .wplf-selectors__selector{padding-top:1rem;border-bottom:1px solid #000}.wplf-tabs .wplf-selectors__selector__name,.wplf-tabs .wplf-selectors__selector__description,.wplf-tabs .wplf-selectors__selector__usage{margin:1rem 12px}.wplf-tabs .wplf-selectors__selector__example{margin:0}.wplf-tabs .wplf-selectors__selector:first-child{border-top:1px solid #000}.wplf-tabs .wplf-selectors__selector:last-child{border-bottom:none}.wplf-tabs .wplf-settings{padding:0}.wplf-tabs .wplf-settings .wplf-formSettings{border:0}.wplf-tabs .wplf-settings .wplf-formSettings .CodeMirror,.wplf-tabs .wplf-settings .wplf-formSettings .wplf-cmEditor{height:300px;width:100%}.wplf-submissionList__header{display:table;width:100%}.wplf-submissionList__header>*{display:table-cell}.wplf-submissionList__submission{display:table;width:100%}.wplf-submissionList__submission>*{display:table-cell;vertical-align:middle;padding:2px 4px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.wplf-submissionList__submission>* strong{display:block;font-size:0.75em} | ||
+11
-3
@@ -1,5 +0,13 @@ | ||
| import WPLF_Admin from './classes/wplf-admin'; | ||
| import './types'; | ||
| import { WPLF_Admin } from './classes/wplf-admin'; | ||
| import { WPLF_Manager } from './classes/wplf-manager'; | ||
| import { WPLF_Tabs } from './classes/wplf-tabs'; | ||
| import { WPLF_Form } from './classes/wplf-form'; | ||
| import '../styles/wplf-admin.scss'; | ||
| declare const _default: WPLF_Admin; | ||
| declare const _default: { | ||
| api: import("./classes/wplf-api").Client; | ||
| manager: WPLF_Manager; | ||
| admin: WPLF_Admin; | ||
| WPLF_Tabs: typeof WPLF_Tabs; | ||
| WPLF_Form: typeof WPLF_Form; | ||
| }; | ||
| /** | ||
@@ -6,0 +14,0 @@ * This file is built into an UMD bundle. The default export will |
@@ -1,1 +0,1 @@ | ||
| .wplf{box-sizing:border-box}.wplfform:focus{outline:0}.wplf *,.wplf :after,.wplf :before{box-sizing:inherit}.wplf-formRow{display:flex;flex-flow:column wrap;justify-content:space-evenly;max-width:100%}.wplf-formRow>*{flex:1 1 auto;margin:.5rem 0}.wplf-formRow.wplf-fcaptcha{position:absolute;left:-1000000000px;bottom:-1000000000px}.wplf-formRow label strong{display:block}.wplf-formRow input{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding:.5rem}.wplf-formRow input[type=checkbox],.wplf-formRow input[type=radio]{width:1rem;height:1rem;line-height:0;flex-grow:0;flex-shrink:0}.wplf-formRow input[type=checkbox]+strong,.wplf-formRow input[type=radio]+strong{display:inline}.wplf-formRow button,.wplf-formRow input[type=button]{flex-grow:0}.wplf-formRow select{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding-left:.5rem;padding-right:.5rem}.wplf-formRow textarea{width:100%;height:10rem}@media (min-width:600px){.wplf-formRow{max-width:100%;flex-flow:row nowrap;align-items:center}.wplf-formRow>*{margin-right:1rem}.wplf-formRow>:last-child{margin-right:0}}.wplf-tabs__tab:not(.active){display:none}.wplf-tabs__tab.active{display:block}.wplf-tabs header{border-bottom:1px solid #ccd0d4;display:flex;flex-flow:row wrap;justify-content:space-between;text-align:center}@media (max-width:480px){.wplf-tabs header{flex-flow:column wrap}}.wplf-tabs__tabSwitcher{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;padding:.5rem 2rem;border:0;cursor:pointer;font-weight:700;color:inherit}.wplf-tabs__tabSwitcher.active,.wplf-tabs__tabSwitcher:focus,.wplf-tabs__tabSwitcher:hover{background:rgba(0,0,0,.07)}.wplf-submissionModal{position:absolute;top:50%;left:50%;right:auto;bottom:auto;margin-right:-50%;transform:translate(-50%,-50%);width:90%;background-color:#f1f1f1}.wplf-submissionModal__overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.7);z-index:1000000000000000000}.wplf-submissionModal__wrapper{display:flex;flex-flow:column nowrap;padding:2rem}.wplf-submissionModal__wrapper h2{margin-top:0}.wplf-submissionModal__wrapper table{text-align:left;border-collapse:collapse;width:100%}.wplf-submissionModal__wrapper tr{background:#f1f1f1}.wplf-submissionModal__wrapper tr:nth-child(2n){background:#e2e2e2}.wplf-submissionModal__wrapper td,.wplf-submissionModal__wrapper th{padding:.5rem 1rem;vertical-align:middle;border:1px solid #222}.wplf-submissionModal__buttons{margin-top:2rem;display:flex;flex-flow:row wrap;align-items:center;justify-content:space-between}.post-type-libreform #wp-content-wrap{display:none}.post-type-libreform #post-status-info{border-bottom:0}.post-type-libreform #titlediv .inside{margin-bottom:.5rem}.libreform_page_wplfAddons #wpcontent{padding-left:0}@media (min-width:600px){.wplf-formRow{max-width:100%}}.wplf-formFields__field{background:#f5f5f5;border:0;border-bottom:1px solid #ccd0d4;padding:.5rem 1rem;position:relative}.wplf-formFields__field:last-child{border-bottom:0}.wplf-formFields__field strong{display:block}.wplf-formFields__field__type{font-size:.75em}.wplf-formFields__field__alert{position:absolute;right:1rem;top:25px;background:red;color:#fff;padding:.25rem;font-size:1.25rem;border-radius:100%;transform:translateY(-50%);width:20px;height:20px;line-height:20px;text-align:center;font-weight:700}#wplfFieldsMetabox .inside{padding:0;margin:0}.wplf-editor .CodeMirror,.wplf-editor .wplf-cmEditor{height:70vh;width:calc(100% - 2px);margin-bottom:1rem;border:1px solid #ccd0d4;border-top:0;overflow:hidden;box-shadow:0 1px 1px rgba(0,0,0,.04)}.wplf-editor .cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.wplf-editor .cm-s-monokai div.CodeMirror-selected{background:#49483e}.wplf-editor .cm-s-monokai .CodeMirror-line::selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span::selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span>span::selection{background:rgba(73,72,62,.99)}.wplf-editor .cm-s-monokai .CodeMirror-line::-moz-selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span::-moz-selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,.99)}.wplf-editor .cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0}.wplf-editor .cm-s-monokai .CodeMirror-guttermarker{color:#fff}.wplf-editor .cm-s-monokai .CodeMirror-guttermarker-subtle,.wplf-editor .cm-s-monokai .CodeMirror-linenumber{color:#d0d0d0}.wplf-editor .cm-s-monokai .CodeMirror-cursor{border-left:1px solid #f8f8f0}.wplf-editor .cm-s-monokai span.cm-comment{color:#75715e}.wplf-editor .cm-s-monokai span.cm-atom,.wplf-editor .cm-s-monokai span.cm-number{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-comment.cm-attribute{color:#97b757}.wplf-editor .cm-s-monokai span.cm-comment.cm-def{color:#bc9262}.wplf-editor .cm-s-monokai span.cm-comment.cm-tag{color:#bc6283}.wplf-editor .cm-s-monokai span.cm-comment.cm-type{color:#5998a6}.wplf-editor .cm-s-monokai span.cm-attribute,.wplf-editor .cm-s-monokai span.cm-property{color:#a6e22e}.wplf-editor .cm-s-monokai span.cm-keyword{color:#f92672}.wplf-editor .cm-s-monokai span.cm-builtin{color:#66d9ef}.wplf-editor .cm-s-monokai span.cm-string{color:#e6db74}.wplf-editor .cm-s-monokai span.cm-variable{color:#f8f8f2}.wplf-editor .cm-s-monokai span.cm-variable-2{color:#9effff}.wplf-editor .cm-s-monokai span.cm-type,.wplf-editor .cm-s-monokai span.cm-variable-3{color:#66d9ef}.wplf-editor .cm-s-monokai span.cm-def{color:#fd971f}.wplf-editor .cm-s-monokai span.cm-bracket{color:#f8f8f2}.wplf-editor .cm-s-monokai span.cm-tag{color:#f92672}.wplf-editor .cm-s-monokai span.cm-header,.wplf-editor .cm-s-monokai span.cm-link{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-error{background:#f92672;color:#f8f8f0}.wplf-editor .cm-s-monokai .CodeMirror-activeline-background{background:#373831}.wplf-editor .cm-s-monokai .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.wplf-tabs{background:#fff;box-shadow:0 1px 1px rgba(0,0,0,.04);border:1px solid #ccd0d4}.wplf-tabs h2,.wplf-tabs h3,.wplf-tabs h4{padding-left:0!important;padding-right:0!important}.wplf-tabs section{padding:12px}.wplf-tabs code{display:block;padding:12px;white-space:pre;margin:1rem 0}.wplf-tabs .wplf-tabs__tabSwitcher{flex:1 1 auto;background:#32373c;color:#f1f1f1}.wplf-tabs .wplf-tabs__tabSwitcher.active,.wplf-tabs .wplf-tabs__tabSwitcher:focus,.wplf-tabs .wplf-tabs__tabSwitcher:hover{background:#0073aa}.wplf-tabs .wplf-selectors{padding:0}.wplf-tabs .wplf-selectors h2,.wplf-tabs .wplf-selectors h3,.wplf-tabs .wplf-selectors h4,.wplf-tabs .wplf-selectors p{margin:1rem 12px}.wplf-tabs .wplf-selectors__selector{padding-top:1rem;border-bottom:1px solid #000}.wplf-tabs .wplf-selectors__selector__description,.wplf-tabs .wplf-selectors__selector__name,.wplf-tabs .wplf-selectors__selector__usage{margin:1rem 12px}.wplf-tabs .wplf-selectors__selector__example{margin:0}.wplf-tabs .wplf-selectors__selector:first-child{border-top:1px solid #000}.wplf-tabs .wplf-selectors__selector:last-child{border-bottom:none}.wplf-tabs .wplf-settings{padding:0}.wplf-tabs .wplf-settings .wplf-formSettings{border:0}.wplf-tabs .wplf-settings .wplf-formSettings .CodeMirror,.wplf-tabs .wplf-settings .wplf-formSettings .wplf-cmEditor{height:300px;width:100%}.wplf-submissionList__header{display:table;width:100%}.wplf-submissionList__header>*{display:table-cell}.wplf-submissionList__submission{display:table;width:100%}.wplf-submissionList__submission>*{display:table-cell;vertical-align:middle;padding:2px 4px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.wplf-submissionList__submission>* strong{display:block;font-size:.75em} | ||
| .wplf{box-sizing:border-box}.wplfform:focus{outline:0}.wplf *,.wplf :after,.wplf :before{box-sizing:inherit}.wplf-formRow{display:flex;flex-flow:column wrap;justify-content:space-evenly;max-width:100%}.wplf-formRow>*{flex:1 1 auto;margin:.5rem 0}.wplf-formRow.wplf-fcaptcha{position:absolute;left:-1000000000px;bottom:-1000000000px}.wplf-formRow label strong{display:block}.wplf-formRow input{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding:.5rem}.wplf-formRow input[type=checkbox],.wplf-formRow input[type=radio]{width:1rem;height:1rem;line-height:0;flex-grow:0;flex-shrink:0}.wplf-formRow input[type=checkbox]+strong,.wplf-formRow input[type=radio]+strong{display:inline}.wplf-formRow button,.wplf-formRow input[type=button]{flex-grow:0}.wplf-formRow select{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding-left:.5rem;padding-right:.5rem}.wplf-formRow textarea{width:100%;height:10rem}@media (min-width:600px){.wplf-formRow{max-width:100%;flex-flow:row nowrap;align-items:center}.wplf-formRow>*{margin-right:1rem}.wplf-formRow>:last-child{margin-right:0}}.wplf-form{transition:.3s linear}.wplf-form.submitting{opacity:.7;cursor:not-allowed;pointer-events:none}.wplf-tabs__tab:not(.active){display:none}.wplf-tabs__tab.active{display:block}.wplf-tabs header{border-bottom:1px solid #ccd0d4;display:flex;flex-flow:row wrap;justify-content:space-between;text-align:center}@media (max-width:480px){.wplf-tabs header{flex-flow:column wrap}}.wplf-tabs__tabSwitcher{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;padding:.5rem 2rem;border:0;cursor:pointer;font-weight:700;color:inherit}.wplf-tabs__tabSwitcher.active,.wplf-tabs__tabSwitcher:focus,.wplf-tabs__tabSwitcher:hover{background:rgba(0,0,0,.07)}.wplf-submissionModal{position:absolute;top:50%;left:50%;right:auto;bottom:auto;margin-right:-50%;transform:translate(-50%,-50%);width:90%;background-color:#f1f1f1}.wplf-submissionModal__overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.7);z-index:1000000000000000000}.wplf-submissionModal__wrapper{display:flex;flex-flow:column nowrap;padding:2rem}.wplf-submissionModal__wrapper h2{margin-top:0}.wplf-submissionModal__wrapper table{text-align:left;border-collapse:collapse;width:100%}.wplf-submissionModal__wrapper tr{background:#f1f1f1}.wplf-submissionModal__wrapper tr:nth-child(2n){background:#e2e2e2}.wplf-submissionModal__wrapper td,.wplf-submissionModal__wrapper th{padding:.5rem 1rem;vertical-align:middle;border:1px solid #222}.wplf-submissionModal__buttons{margin-top:2rem;display:flex;flex-flow:row wrap;align-items:center;justify-content:space-between}.post-type-libreform #wp-content-wrap{display:none}.post-type-libreform #post-status-info{border-bottom:0}.post-type-libreform #titlediv .inside{margin-bottom:.5rem}.libreform_page_wplfAddons #wpcontent{padding-left:0}@media (min-width:600px){.wplf-formRow{max-width:100%}}.wplf-formFields__field{background:#f5f5f5;border:0;border-bottom:1px solid #ccd0d4;padding:.5rem 1rem;position:relative}.wplf-formFields__field:last-child{border-bottom:0}.wplf-formFields__field strong{display:block}.wplf-formFields__field__type{font-size:.75em}.wplf-formFields__field__alert{position:absolute;right:1rem;top:25px;background:red;color:#fff;padding:.25rem;font-size:1.25rem;border-radius:100%;transform:translateY(-50%);width:20px;height:20px;line-height:20px;text-align:center;font-weight:700}#wplfFieldsMetabox .inside{padding:0;margin:0}.wplf-editor .CodeMirror,.wplf-editor .wplf-cmEditor{height:70vh;width:calc(100% - 2px);margin-bottom:1rem;border:1px solid #ccd0d4;border-top:0;overflow:hidden;box-shadow:0 1px 1px rgba(0,0,0,.04)}.wplf-editor .cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.wplf-editor .cm-s-monokai div.CodeMirror-selected{background:#49483e}.wplf-editor .cm-s-monokai .CodeMirror-line::selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span::selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span>span::selection{background:rgba(73,72,62,.99)}.wplf-editor .cm-s-monokai .CodeMirror-line::-moz-selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span::-moz-selection,.wplf-editor .cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,.99)}.wplf-editor .cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0}.wplf-editor .cm-s-monokai .CodeMirror-guttermarker{color:#fff}.wplf-editor .cm-s-monokai .CodeMirror-guttermarker-subtle,.wplf-editor .cm-s-monokai .CodeMirror-linenumber{color:#d0d0d0}.wplf-editor .cm-s-monokai .CodeMirror-cursor{border-left:1px solid #f8f8f0}.wplf-editor .cm-s-monokai span.cm-comment{color:#75715e}.wplf-editor .cm-s-monokai span.cm-atom,.wplf-editor .cm-s-monokai span.cm-number{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-comment.cm-attribute{color:#97b757}.wplf-editor .cm-s-monokai span.cm-comment.cm-def{color:#bc9262}.wplf-editor .cm-s-monokai span.cm-comment.cm-tag{color:#bc6283}.wplf-editor .cm-s-monokai span.cm-comment.cm-type{color:#5998a6}.wplf-editor .cm-s-monokai span.cm-attribute,.wplf-editor .cm-s-monokai span.cm-property{color:#a6e22e}.wplf-editor .cm-s-monokai span.cm-keyword{color:#f92672}.wplf-editor .cm-s-monokai span.cm-builtin{color:#66d9ef}.wplf-editor .cm-s-monokai span.cm-string{color:#e6db74}.wplf-editor .cm-s-monokai span.cm-variable{color:#f8f8f2}.wplf-editor .cm-s-monokai span.cm-variable-2{color:#9effff}.wplf-editor .cm-s-monokai span.cm-type,.wplf-editor .cm-s-monokai span.cm-variable-3{color:#66d9ef}.wplf-editor .cm-s-monokai span.cm-def{color:#fd971f}.wplf-editor .cm-s-monokai span.cm-bracket{color:#f8f8f2}.wplf-editor .cm-s-monokai span.cm-tag{color:#f92672}.wplf-editor .cm-s-monokai span.cm-header,.wplf-editor .cm-s-monokai span.cm-link{color:#ae81ff}.wplf-editor .cm-s-monokai span.cm-error{background:#f92672;color:#f8f8f0}.wplf-editor .cm-s-monokai .CodeMirror-activeline-background{background:#373831}.wplf-editor .cm-s-monokai .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.wplf-tabs{background:#fff;box-shadow:0 1px 1px rgba(0,0,0,.04);border:1px solid #ccd0d4}.wplf-tabs h2,.wplf-tabs h3,.wplf-tabs h4{padding-left:0!important;padding-right:0!important}.wplf-tabs section{padding:12px}.wplf-tabs code{display:block;padding:12px;white-space:pre;margin:1rem 0}.wplf-tabs .wplf-tabs__tabSwitcher{flex:1 1 auto;background:#32373c;color:#f1f1f1}.wplf-tabs .wplf-tabs__tabSwitcher.active,.wplf-tabs .wplf-tabs__tabSwitcher:focus,.wplf-tabs .wplf-tabs__tabSwitcher:hover{background:#0073aa}.wplf-tabs .wplf-selectors{padding:0}.wplf-tabs .wplf-selectors h2,.wplf-tabs .wplf-selectors h3,.wplf-tabs .wplf-selectors h4,.wplf-tabs .wplf-selectors p{margin:1rem 12px}.wplf-tabs .wplf-selectors__selector{padding-top:1rem;border-bottom:1px solid #000}.wplf-tabs .wplf-selectors__selector__description,.wplf-tabs .wplf-selectors__selector__name,.wplf-tabs .wplf-selectors__selector__usage{margin:1rem 12px}.wplf-tabs .wplf-selectors__selector__example{margin:0}.wplf-tabs .wplf-selectors__selector:first-child{border-top:1px solid #000}.wplf-tabs .wplf-selectors__selector:last-child{border-bottom:none}.wplf-tabs .wplf-settings{padding:0}.wplf-tabs .wplf-settings .wplf-formSettings{border:0}.wplf-tabs .wplf-settings .wplf-formSettings .CodeMirror,.wplf-tabs .wplf-settings .wplf-formSettings .wplf-cmEditor{height:300px;width:100%}.wplf-submissionList__header{display:table;width:100%}.wplf-submissionList__header>*{display:table-cell}.wplf-submissionList__submission{display:table;width:100%}.wplf-submissionList__submission>*{display:table-cell;vertical-align:middle;padding:2px 4px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.wplf-submissionList__submission>* strong{display:block;font-size:.75em} |
@@ -1,2 +0,2 @@ | ||
| .wplf{box-sizing:border-box}.wplfform:focus{outline:0}.wplf *,.wplf *:before,.wplf *:after{box-sizing:inherit}.wplf-formRow{display:flex;flex-flow:column wrap;justify-content:space-evenly;max-width:100%}.wplf-formRow>*{flex:1 1 auto;margin:0.5rem 0}.wplf-formRow.wplf-fcaptcha{position:absolute;left:-1000000000px;bottom:-1000000000px}.wplf-formRow label strong{display:block}.wplf-formRow input{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding:0.5rem}.wplf-formRow input[type='checkbox'],.wplf-formRow input[type='radio']{width:1rem;height:1rem;line-height:0;flex-grow:0;flex-shrink:0}.wplf-formRow input[type='checkbox']+strong,.wplf-formRow input[type='radio']+strong{display:inline}.wplf-formRow button,.wplf-formRow input[type='button']{flex-grow:0}.wplf-formRow select{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding-left:0.5rem;padding-right:0.5rem}.wplf-formRow textarea{width:100%;height:10rem}@media (min-width: 600px){.wplf-formRow{max-width:100%;flex-flow:row nowrap;align-items:center}.wplf-formRow>*{margin-right:1rem}.wplf-formRow>*:last-child{margin-right:0}}.wplf-tabs__tab:not(.active){display:none}.wplf-tabs__tab.active{display:block}.wplf-tabs header{border-bottom:1px solid #ccd0d4;display:flex;flex-flow:row wrap;justify-content:space-between;text-align:center}@media (max-width: 480px){.wplf-tabs header{flex-flow:column wrap}}.wplf-tabs__tabSwitcher{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;padding:0.5rem 2rem;border:0;cursor:pointer;font-weight:700;color:inherit}.wplf-tabs__tabSwitcher:hover,.wplf-tabs__tabSwitcher.active,.wplf-tabs__tabSwitcher:focus{background:rgba(0,0,0,0.07)} | ||
| .wplf{box-sizing:border-box}.wplfform:focus{outline:0}.wplf *,.wplf *:before,.wplf *:after{box-sizing:inherit}.wplf-formRow{display:flex;flex-flow:column wrap;justify-content:space-evenly;max-width:100%}.wplf-formRow>*{flex:1 1 auto;margin:0.5rem 0}.wplf-formRow.wplf-fcaptcha{position:absolute;left:-1000000000px;bottom:-1000000000px}.wplf-formRow label strong{display:block}.wplf-formRow input{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding:0.5rem}.wplf-formRow input[type='checkbox'],.wplf-formRow input[type='radio']{width:1rem;height:1rem;line-height:0;flex-grow:0;flex-shrink:0}.wplf-formRow input[type='checkbox']+strong,.wplf-formRow input[type='radio']+strong{display:inline}.wplf-formRow button,.wplf-formRow input[type='button']{flex-grow:0}.wplf-formRow select{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding-left:0.5rem;padding-right:0.5rem}.wplf-formRow textarea{width:100%;height:10rem}@media (min-width: 600px){.wplf-formRow{max-width:100%;flex-flow:row nowrap;align-items:center}.wplf-formRow>*{margin-right:1rem}.wplf-formRow>*:last-child{margin-right:0}}.wplf-form{transition:0.3s linear}.wplf-form.submitting{opacity:0.7;cursor:not-allowed;pointer-events:none}.wplf-tabs__tab:not(.active){display:none}.wplf-tabs__tab.active{display:block}.wplf-tabs header{border-bottom:1px solid #ccd0d4;display:flex;flex-flow:row wrap;justify-content:space-between;text-align:center}@media (max-width: 480px){.wplf-tabs header{flex-flow:column wrap}}.wplf-tabs__tabSwitcher{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;padding:0.5rem 2rem;border:0;cursor:pointer;font-weight:700;color:inherit}.wplf-tabs__tabSwitcher:hover,.wplf-tabs__tabSwitcher.active,.wplf-tabs__tabSwitcher:focus{background:rgba(0,0,0,0.07)} | ||
@@ -1,5 +0,11 @@ | ||
| import WPLF from './classes/wplf'; | ||
| import { WPLF_Manager } from './classes/wplf-manager'; | ||
| import { WPLF_Tabs } from './classes/wplf-tabs'; | ||
| import { WPLF_Form } from './classes/wplf-form'; | ||
| import '../styles/wplf-frontend.scss'; | ||
| import './types'; | ||
| declare const _default: WPLF; | ||
| declare const _default: { | ||
| api: import("./classes/wplf-api").Client; | ||
| manager: WPLF_Manager; | ||
| WPLF_Tabs: typeof WPLF_Tabs; | ||
| WPLF_Form: typeof WPLF_Form; | ||
| }; | ||
| /** | ||
@@ -6,0 +12,0 @@ * This file is built into an UMD bundle. The default export will |
@@ -1,1 +0,1 @@ | ||
| .wplf{box-sizing:border-box}.wplfform:focus{outline:0}.wplf *,.wplf :after,.wplf :before{box-sizing:inherit}.wplf-formRow{display:flex;flex-flow:column wrap;justify-content:space-evenly;max-width:100%}.wplf-formRow>*{flex:1 1 auto;margin:.5rem 0}.wplf-formRow.wplf-fcaptcha{position:absolute;left:-1000000000px;bottom:-1000000000px}.wplf-formRow label strong{display:block}.wplf-formRow input{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding:.5rem}.wplf-formRow input[type=checkbox],.wplf-formRow input[type=radio]{width:1rem;height:1rem;line-height:0;flex-grow:0;flex-shrink:0}.wplf-formRow input[type=checkbox]+strong,.wplf-formRow input[type=radio]+strong{display:inline}.wplf-formRow button,.wplf-formRow input[type=button]{flex-grow:0}.wplf-formRow select{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding-left:.5rem;padding-right:.5rem}.wplf-formRow textarea{width:100%;height:10rem}@media (min-width:600px){.wplf-formRow{max-width:100%;flex-flow:row nowrap;align-items:center}.wplf-formRow>*{margin-right:1rem}.wplf-formRow>:last-child{margin-right:0}}.wplf-tabs__tab:not(.active){display:none}.wplf-tabs__tab.active{display:block}.wplf-tabs header{border-bottom:1px solid #ccd0d4;display:flex;flex-flow:row wrap;justify-content:space-between;text-align:center}@media (max-width:480px){.wplf-tabs header{flex-flow:column wrap}}.wplf-tabs__tabSwitcher{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;padding:.5rem 2rem;border:0;cursor:pointer;font-weight:700;color:inherit}.wplf-tabs__tabSwitcher.active,.wplf-tabs__tabSwitcher:focus,.wplf-tabs__tabSwitcher:hover{background:rgba(0,0,0,.07)} | ||
| .wplf{box-sizing:border-box}.wplfform:focus{outline:0}.wplf *,.wplf :after,.wplf :before{box-sizing:inherit}.wplf-formRow{display:flex;flex-flow:column wrap;justify-content:space-evenly;max-width:100%}.wplf-formRow>*{flex:1 1 auto;margin:.5rem 0}.wplf-formRow.wplf-fcaptcha{position:absolute;left:-1000000000px;bottom:-1000000000px}.wplf-formRow label strong{display:block}.wplf-formRow input{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding:.5rem}.wplf-formRow input[type=checkbox],.wplf-formRow input[type=radio]{width:1rem;height:1rem;line-height:0;flex-grow:0;flex-shrink:0}.wplf-formRow input[type=checkbox]+strong,.wplf-formRow input[type=radio]+strong{display:inline}.wplf-formRow button,.wplf-formRow input[type=button]{flex-grow:0}.wplf-formRow select{width:100%;height:2rem;line-height:1.4;font-size:1rem;padding-left:.5rem;padding-right:.5rem}.wplf-formRow textarea{width:100%;height:10rem}@media (min-width:600px){.wplf-formRow{max-width:100%;flex-flow:row nowrap;align-items:center}.wplf-formRow>*{margin-right:1rem}.wplf-formRow>:last-child{margin-right:0}}.wplf-form{transition:.3s linear}.wplf-form.submitting{opacity:.7;cursor:not-allowed;pointer-events:none}.wplf-tabs__tab:not(.active){display:none}.wplf-tabs__tab.active{display:block}.wplf-tabs header{border-bottom:1px solid #ccd0d4;display:flex;flex-flow:row wrap;justify-content:space-between;text-align:center}@media (max-width:480px){.wplf-tabs header{flex-flow:column wrap}}.wplf-tabs__tabSwitcher{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;padding:.5rem 2rem;border:0;cursor:pointer;font-weight:700;color:inherit}.wplf-tabs__tabSwitcher.active,.wplf-tabs__tabSwitcher:focus,.wplf-tabs__tabSwitcher:hover{background:rgba(0,0,0,.07)} |
@@ -1,1 +0,1 @@ | ||
| !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["React"],t):"object"==typeof exports?exports.WPLF=t(require("react")):e.WPLF=t(e.React)}(this,(function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=31)}([function(t,r){t.exports=e},function(e,t,r){"use strict";t.a=function(e){return Object.assign({backendUrl:null,fetchCredentials:"same-origin",requestHeaders:{"X-WP-Nonce":null},assetsDir:null,settings:{autoinit:!0,parseLibreformShortcodeInRestApi:!0,hasUnfilteredHtml:!0,debugLevel:"all"},post:null,i18n:{}},e.wplfData)}(window)},function(e,t,r){"use strict";var n=r(1).a.settings.debugLevel,a=window.console||{log(){},error(){}};t.a={notice:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];return"all"===n&&a.log("WPLF: ".concat(e),r)},error:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];return"none"!==n&&a.error("WPLF error: ".concat(e),r)}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return a}));var n,a,o=r(0),i=r.n(o);!function(e){e[e.Unsubmitted=0]="Unsubmitted",e[e.Submitting=1]="Submitting",e[e.Success=2]="Success",e[e.Error=3]="Error"}(n||(n={})),function(e){e.GetForm="getForm",e.GetForms="getForms",e.GetSubmissions="getSubmissions",e.GetSubmission="getSubmission",e.DeleteSubmissions="deleteSubmissions",e.RenderForm="renderForm",e.SubmitForm="submitForm",e.ApiError="apiError"}(a||(a={})),window.React=i.a},function(e,t,r){"use strict";t.a=function(e){return!!e&&("getAttribute"in e&&"tagName"in e)}},function(e,t,r){"use strict";var n=r(8),a=r.n(n),o=r(1);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t,r,n,a,o,i){try{var u=e[o](i),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function f(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){c(o,n,a,i,u,"next",e)}function u(e){c(o,n,a,i,u,"throw",e)}i(void 0)}))}}function l(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(){t&&t.abort&&t.abort()},i=f(regeneratorRuntime.mark((function n(){var i,s,c,f,l,h,d;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,t=new a.a,n.next=4,fetch(o.a.backendUrl+e,u({method:"GET",signal:t.signal,credentials:o.a.fetchCredentials||"same-origin",headers:o.a.requestHeaders||{}},r));case 4:return i=n.sent,s=i.headers,c=i.status,f=i.statusText,l=i.url,h=i.ok,n.next=8,i.json();case 8:return d=n.sent,t=null,n.abrupt("return",{headers:s,status:c,statusText:f,url:l,ok:h,data:d});case 13:if(n.prev=13,n.t0=n.catch(0),t=null,"AbortError"===n.t0.name){n.next=18;break}throw n.t0;case 18:return n.abrupt("return",n.t0);case 19:case"end":return n.stop()}}),n,null,[[0,13]])})))();return Object.assign(i,{abort:n})}var h=r(3);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){m(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t,r,n,a,o,i){try{var u=e[o](i),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){p(o,n,a,i,u,"next",e)}function u(e){p(o,n,a,i,u,"throw",e)}i(void 0)}))}}function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var y=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n,a,i,u,s,c,f,d;return t=e,(r=[{key:"requestRender",value:(d=v(regeneratorRuntime.mark((function e(t,r){var n,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new FormData).append("content",r),n.append("form",t.toString()),o.a.lang&&n.append("lang",o.a.lang),e.next=6,l("/renderForm",{method:"POST",body:n});case 6:if((a=e.sent).ok){e.next=9;break}throw new Error("Unable to render form");case 9:return i=b(b({},a),{},{kind:h.a.RenderForm}),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"requestForm",value:(f=v(regeneratorRuntime.mark((function e(t){var r,n,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="",o.a.lang&&(r="&lang=".concat(o.a.lang)),n="/getForm?form=".concat(t).concat(r),e.next=5,l(n,{method:"GET"});case 5:if((a=e.sent).ok){e.next=8;break}throw new Error("Unable to render form");case 8:return i=b(b({},a),{},{kind:h.a.GetForm}),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)}))),function(e){return f.apply(this,arguments)})},{key:"requestForms",value:(c=v(regeneratorRuntime.mark((function e(t){var r,n,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="",o.a.lang&&(r="&lang=".concat(o.a.lang)),n="/getForms?page=".concat(t).concat(r),e.next=5,l(n,{method:"GET"});case 5:if((a=e.sent).ok){e.next=8;break}throw new Error("Unable to render form");case 8:return i=b(b({},a),{},{kind:h.a.GetForms}),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)}))),function(e){return c.apply(this,arguments)})},{key:"deleteSubmissions",value:(s=v(regeneratorRuntime.mark((function e(t,r){var n,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l("/deleteSubmissions",{method:"DELETE",headers:b(b({},o.a.requestHeaders),{},{"Content-Type":"application/json"}),body:JSON.stringify({form:t,submissionUuids:r})});case 2:if((n=e.sent).ok){e.next=5;break}throw new Error("Unable to delete submissions");case 5:return a=b(b({},n),{},{kind:h.a.DeleteSubmissions}),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)}))),function(e,t){return s.apply(this,arguments)})},{key:"requestSubmissions",value:(u=v(regeneratorRuntime.mark((function e(t,r,n){var a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l("/getSubmissions?form=".concat(t,"&page=").concat(r,"&limit=").concat(n),{method:"GET"});case 2:if((a=e.sent).ok){e.next=5;break}throw new Error("Unable to get submissions");case 5:return o=b(b({},a),{},{kind:h.a.GetSubmissions}),e.abrupt("return",o);case 7:case"end":return e.stop()}}),e)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"requestSubmission",value:(i=v(regeneratorRuntime.mark((function e(t,r){var n,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l("/getSubmission?form=".concat(t,"&uuid=").concat(r),{method:"GET"});case 2:if((n=e.sent).ok){e.next=5;break}throw new Error("Unable to get submission");case 5:return a=b(b({},n),{},{kind:h.a.GetSubmission}),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)}))),function(e,t){return i.apply(this,arguments)})},{key:"sendSubmission",value:(a=v(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l("/submitForm",{method:"POST",body:t});case 2:if((r=e.sent).ok){e.next=5;break}throw new Error("Unable to send submission");case 5:return n=b(b({},r),{},{kind:h.a.SubmitForm}),e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)})}])&&g(t.prototype,r),n&&g(t,n),e}();t.a=new y},function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"number"==typeof e?e:t?parseFloat(e):parseInt(e,10)}function a(e){return!!(e&&e.length>0&&e.match(/^[0-9]*$/))}r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return a}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(2);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=new(function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"wplf";a(this,e),this.prefix=t}var t,r,i;return t=e,(r=[{key:"get",value:function(e,t){var r=localStorage.getItem(this.prefix+e);return null!==r?r?JSON.parse(r):r:(n.a.notice("No value found for ".concat(e,", falling back to default"),t),t)}},{key:"set",value:function(e,t){try{return localStorage.setItem(this.prefix+e,JSON.stringify(t)),!0}catch(r){return n.a.error(r,e,t),!1}}}])&&o(t.prototype,r),i&&o(t,i),e}()),u=r(4);function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var c=function(){function e(t){var r=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.remember=!1,this.name="",this.handleClick=function(e){var t=e.target;if(Object(u.a)(t)){var a=t.getAttribute("data-target");a?r.switchTab(a):n.a.notice("Unable to switch tab as data-target was empty")}e.preventDefault()},t instanceof Element!=!0)throw new Error("Tab element invalid or missing");if(this.root=t,this.name=this.root.getAttribute("data-name")||"",this.remember=null!==this.root.getAttribute("data-remember"),this.activeTab=this.root.getAttribute("data-default")||"",!this.name||!this.activeTab)throw new Error("Required attributes are missing");this.remember&&(this.activeTab=i.get(this.name,this.activeTab)),this.refresh()}var t,r,a;return t=e,(r=[{key:"refresh",value:function(){var e=this;this.getHandles().forEach((function(t){t.addEventListener("click",e.handleClick,{passive:!1})})),this.switchTab(this.activeTab)}},{key:"getTabs",value:function(){return Array.from(this.root.querySelectorAll('.wplf-tabs__tab[data-name="'.concat(this.name,'"]')))}},{key:"getHandles",value:function(){return Array.from(this.root.querySelectorAll('.wplf-tabs__tabSwitcher[data-name="'.concat(this.name,'"]')))}},{key:"switchTab",value:function(e){var t=this.getTabs(),r=this.getHandles(),n=t.filter((function(t){return t.getAttribute("data-tab")===e})),a=t.filter((function(t){return t.getAttribute("data-tab")!==e}));n.forEach((function(e){var t=e.getAttribute("data-tab"),n=r.filter((function(e){return e.getAttribute("data-target")===t}));e.classList.add("active"),n.forEach((function(e){e.classList.add("active")}))})),a.forEach((function(e){var t=e.getAttribute("data-tab"),n=r.filter((function(e){return e.getAttribute("data-target")===t}));e.classList.remove("active"),n.forEach((function(e){e.classList.remove("active")}))})),this.remember&&i.set(this.name,e)}}])&&s(t.prototype,r),a&&s(t,a),e}()},function(e,t,r){"use strict";const{AbortController:n,AbortSignal:a}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=n,e.exports.AbortSignal=a,e.exports.default=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return g}));var n=r(1),a=r(2),o=r(7),i=r(3),u=r(4),s=r(6),c=r(5);function f(e,t,r,n,a,o,i){try{var u=e[o](i),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var h=function(e,t){var r=e.form;r.reset&&r.reset()},d=function(e,t){Object(u.a)(e.form.parentNode)&&e.form.parentNode.querySelectorAll(".wplf-errorMessage, .wplf-successMessage").forEach((function(e){Object(u.a)(e.parentNode)&&e.parentNode.removeChild(e)}))},b=function(e,t){console.log(t);var r=t.data.data.message,n=void 0===r?"":r,a=document.createElement("div");a.classList.add("wplf-successMessage"),a.insertAdjacentHTML("afterbegin",n.replace(/\n/g,"<br />")),e.form.insertAdjacentElement("beforebegin",a),e.form.classList.add("submitted")},m=function(e,t){var r=t.error,n=document.createElement("div");n.classList.add("wplf-errorMessage"),n.insertAdjacentHTML("afterbegin",r.message),e.form.insertAdjacentElement("beforebegin",n)},p=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.submitState=i.b.Unsubmitted,this.submitHandler=null,this.callbacks={beforeSend:{default:d},success:{default:b,clearOnSuccess:h},error:{default:m}},this.tabs=[],this.key="",t instanceof HTMLElement!=!0)throw new Error("Form element invalid or missing");this.form=t,this.id=Object(s.a)(t.dataset.formId||0),this.slug=t.dataset.formSlug||"",this.key="_"+Math.random().toString(36).substr(2,9),this.tabs=Array.from(this.form.querySelectorAll(".wplf-tabs")).map((function(e){return new o.a(e)})),this.createSubmitHandler(),this.attachSubmitHandler();var r=t.querySelector('[name="_nojs"]');r&&Object(u.a)(r.parentNode)&&r.parentNode.removeChild(r)}var t,r,p;return t=e,(r=[{key:"getDefaultCallbacks",value:function(){return{beforeSend:{default:d},success:{default:b,clearOnSuccess:h},error:{default:m}}}},{key:"addCallback",value:function(e,t,r){var n=this.callbacks,a=n.beforeSend,o=n.success,i=n.error;switch(t){case"beforeSend":a[e]=r;break;case"success":o[e]=r;break;case"error":i[e]=r;break;default:throw new Error("Unknown callback type ".concat(t))}return this}},{key:"removeCallback",value:function(e,t){var r=this.callbacks,n=r.beforeSend,a=r.success,o=r.error;switch(t){case"beforeSend":delete n[e];break;case"success":delete a[e];break;case"error":delete o[e];break;default:throw new Error("Unknown callback ".concat(e," ").concat(t))}return this}},{key:"runCallback",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.callbacks,a=n.beforeSend,o=n.success,i=n.error;switch(e){case"beforeSend":Object.values(a).forEach((function(e){e(t,r)}));break;case"success":Object.values(o).forEach((function(e){e(t,r)}));break;case"error":Object.values(i).forEach((function(e){e(t,r)}));break;default:throw new Error("Unknown callback ".concat(name," ").concat(e))}}},{key:"attachSubmitHandler",value:function(){return this.submitHandler?(a.a.notice("Attaching form submit handler"),this.form.addEventListener("submit",this.submitHandler,{passive:!1})):a.a.error("Unable to attach submit handler, as it does not exist"),this}},{key:"removeSubmitHandler",value:function(){return this.submitHandler?(a.a.notice("Removing form submit handler"),this.form.removeEventListener("submit",this.submitHandler)):a.a.error("Unable to remove submit handler, as it does not exist"),this}},{key:"createSubmitHandler",value:function(e){var t=this;return e?(this.submitHandler=e,this):(this.submitHandler=function(){var e,r=(e=regeneratorRuntime.mark((function e(r){var o,u,s,f,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.preventDefault(),t.submitState!==i.b.Submitting){e.next=4;break}return a.a.notice("Preventing double doubmission"),e.abrupt("return");case 4:return e.prev=4,o=t.form,u=new FormData(o),n.a.lang&&u.append("lang",n.a.lang),t.submitState=i.b.Submitting,o.classList.add("submitting"),t.runCallback("beforeSend",{formData:u,form:o}),e.next=13,c.a.sendSubmission(u);case 13:if(s=e.sent,f=s.data,l=s.ok,!("error"in f)){e.next=20;break}throw a.a.error("Invalid submission!",s),new Error(f.error);case 20:if(l){e.next=24;break}throw new Error(n.a.i18n.formSubmissionRequestFailed);case 24:t.submitState=i.b.Success,t.runCallback("success",{data:f});case 26:e.next=32;break;case 28:e.prev=28,e.t0=e.catch(4),t.submitState=i.b.Error,t.runCallback("error",{error:e.t0});case 32:case"end":return e.stop()}}),e,null,[[4,28]])})),function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){f(o,n,a,i,u,"next",e)}function u(e){f(o,n,a,i,u,"throw",e)}i(void 0)}))});return function(e){return r.apply(this,arguments)}}(),this)}}])&&l(t.prototype,r),p&&l(t,p),e}();function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var g=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.forms={},this.WPLF_Form=p,this.WPLF_Tabs=o.a,this.api=c.a,n.a.settings.autoinit&&this.initialize()}var t,r,a;return t=e,(r=[{key:"initialize",value:function(){var e=this;Array.from(document.querySelectorAll("form.wplf")).map((function(t){e.attach(t)}))}},{key:"findFormsById",value:function(e){var t=this;return Object.keys(this.forms).reduce((function(r,n){var a=t.forms[n];return a?(e===a.id&&r.push(a),r):r}),[])}},{key:"findFormsBySlug",value:function(e){var t=this;return Object.keys(this.forms).reduce((function(r,n){var a=t.forms[n];return a&&a?(e===a.slug&&r.push(a),r):r}),[])}},{key:"attach",value:function(e){if(e instanceof p){var t=e;return this.forms[t.key]=t,t}var r=e;if(r instanceof Element!=1)throw new Error(n.a.i18n.unableToAttachWPLF);var a=new p(r);return this.forms[a.key]=a,a.form.removeAttribute("tabindex"),a.form.removeAttribute("style"),a}},{key:"detach",value:function(e){return this.forms[e.key].removeSubmitHandler(),delete this.forms[e.key],!0}}])&&v(t.prototype,r),a&&v(t,a),e}()},function(e,t,r){var n=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var a=t&&t.prototype instanceof p?t:p,o=Object.create(a.prototype),i=new P(n||[]);return o._invoke=function(e,t,r){var n=l;return function(a,o){if(n===d)throw new Error("Generator is already running");if(n===b){if("throw"===a)throw o;return T()}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var u=O(i,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=b,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var s=f(e,t,r);if("normal"===s.type){if(n=r.done?b:h,s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=b,r.method="throw",r.arg=s.arg)}}}(e,r,i),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l="suspendedStart",h="suspendedYield",d="executing",b="completed",m={};function p(){}function v(){}function g(){}var y={};y[o]=function(){return this};var w=Object.getPrototypeOf,k=w&&w(w(F([])));k&&k!==r&&n.call(k,o)&&(y=k);var S=g.prototype=p.prototype=Object.create(y);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function r(a,o,i,u){var s=f(e[a],e,o);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,u)}),(function(e){r("throw",e,i,u)})):t.resolve(l).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,u)}))}u(s.arg)}var a;this._invoke=function(e,n){function o(){return new t((function(t,a){r(e,n,t,a)}))}return a=a?a.then(o,o):o()}}function O(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var a=f(n,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var o=a.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function F(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,i=function r(){for(;++a<e.length;)if(n.call(e,a))return r.value=e[a],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}return{next:T}}function T(){return{value:t,done:!0}}return v.prototype=S.constructor=g,g.constructor=v,v.displayName=s(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,u,"GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},x(E.prototype),E.prototype[i]=function(){return this},e.AsyncIterator=E,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new E(c(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(S),s(S,u,"Generator"),S[o]=function(){return this},S.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=F,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function a(n,a){return u.type="throw",u.arg=e,r.next=n,a&&(r.method="next",r.arg=t),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;L(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},,,,,,,,,,,,,,,,,,,,,function(e,t,r){r(10),e.exports=r(32)},function(e,t,r){"use strict";r.r(t);var n=r(9);r(33),r(3);t.default=new n.a},function(e,t,r){}]).default})); | ||
| !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.WPLF=t():e.WPLF=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=32)}([,function(e,t,r){"use strict";t.a=function(e){return Object.assign({backendUrl:null,fetchCredentials:"same-origin",requestHeaders:{"X-WP-Nonce":null},assetsDir:null,settings:{autoinit:!0,parseLibreformShortcodeInRestApi:!0,hasUnfilteredHtml:!0,debugLevel:"all"},post:null,i18n:{}},e.wplfData)}(window)},function(e,t,r){"use strict";var n=r(1).a.settings.debugLevel,a=window.console||{log(){},error(){}};t.a={notice:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];return"all"===n&&a.log("WPLF: ".concat(e),r)},error:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];return"none"!==n&&a.error("WPLF error: ".concat(e),r)}}},function(e,t,r){"use strict";t.a=function(e){return!!e&&("getAttribute"in e&&"tagName"in e)}},function(e,t,r){"use strict";var n,a;r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return a})),function(e){e[e.Unsubmitted=0]="Unsubmitted",e[e.Submitting=1]="Submitting",e[e.Success=2]="Success",e[e.Error=3]="Error"}(n||(n={})),function(e){e.GetForm="getForm",e.GetForms="getForms",e.GetSubmissions="getSubmissions",e.GetSubmission="getSubmission",e.DeleteSubmissions="deleteSubmissions",e.RenderForm="renderForm",e.SubmitForm="submitForm",e.ApiError="apiError"}(a||(a={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return y}));var n=r(9),a=r.n(n),o=r(1);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function f(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){s(o,n,a,i,u,"next",e)}function u(e){s(o,n,a,i,u,"throw",e)}i(void 0)}))}}function l(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(){t&&t.abort&&t.abort()},i=f(regeneratorRuntime.mark((function n(){var i,c,s,f,l,h,d;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,t=new a.a,n.next=4,fetch(o.a.backendUrl+e,u({method:"GET",signal:t.signal,credentials:o.a.fetchCredentials||"same-origin",headers:o.a.requestHeaders||{}},r));case 4:return i=n.sent,c=i.headers,s=i.status,f=i.statusText,l=i.url,h=i.ok,n.next=8,i.json();case 8:return d=n.sent,t=null,n.abrupt("return",{headers:c,status:s,statusText:f,url:l,ok:h,data:d});case 13:if(n.prev=13,n.t0=n.catch(0),t=null,"AbortError"===n.t0.name){n.next=18;break}throw n.t0;case 18:return n.abrupt("return",n.t0);case 19:case"end":return n.stop()}}),n,null,[[0,13]])})))();return Object.assign(i,{abort:n})}var h=r(4);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){b(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){p(o,n,a,i,u,"next",e)}function u(e){p(o,n,a,i,u,"throw",e)}i(void 0)}))}}function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var y=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n,a,i,u,c,s,f,d;return t=e,(r=[{key:"requestRender",value:(d=v(regeneratorRuntime.mark((function e(t,r){var n,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new FormData).append("content",r),n.append("form",t.toString()),o.a.lang&&n.append("lang",o.a.lang),e.next=6,l("/renderForm",{method:"POST",body:n});case 6:return(a=e.sent).ok,i=m(m({},a),{},{kind:h.a.RenderForm}),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"requestForm",value:(f=v(regeneratorRuntime.mark((function e(t){var r,n,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="",o.a.lang&&(r="&lang=".concat(o.a.lang)),n="/getForm?form=".concat(t).concat(r),e.next=5,l(n,{method:"GET"});case 5:return(a=e.sent).ok,i=m(m({},a),{},{kind:h.a.GetForm}),e.abrupt("return",i);case 9:case"end":return e.stop()}}),e)}))),function(e){return f.apply(this,arguments)})},{key:"requestForms",value:(s=v(regeneratorRuntime.mark((function e(t){var r,n,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="",o.a.lang&&(r="&lang=".concat(o.a.lang)),n="/getForms?page=".concat(t).concat(r),e.next=5,l(n,{method:"GET"});case 5:return(a=e.sent).ok,i=m(m({},a),{},{kind:h.a.GetForms}),e.abrupt("return",i);case 9:case"end":return e.stop()}}),e)}))),function(e){return s.apply(this,arguments)})},{key:"deleteSubmissions",value:(c=v(regeneratorRuntime.mark((function e(t,r){var n,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l("/deleteSubmissions",{method:"DELETE",headers:m(m({},o.a.requestHeaders),{},{"Content-Type":"application/json"}),body:JSON.stringify({form:t,submissionUuids:r})});case 2:return(n=e.sent).ok,a=m(m({},n),{},{kind:h.a.DeleteSubmissions}),e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)}))),function(e,t){return c.apply(this,arguments)})},{key:"requestSubmissions",value:(u=v(regeneratorRuntime.mark((function e(t,r,n){var a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l("/getSubmissions?form=".concat(t,"&page=").concat(r,"&limit=").concat(n),{method:"GET"});case 2:return(a=e.sent).ok,o=m(m({},a),{},{kind:h.a.GetSubmissions}),e.abrupt("return",o);case 6:case"end":return e.stop()}}),e)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"requestSubmission",value:(i=v(regeneratorRuntime.mark((function e(t,r){var n,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l("/getSubmission?form=".concat(t,"&uuid=").concat(r),{method:"GET"});case 2:return(n=e.sent).ok,a=m(m({},n),{},{kind:h.a.GetSubmission}),e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)}))),function(e,t){return i.apply(this,arguments)})},{key:"sendSubmission",value:(a=v(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l("/submitForm",{method:"POST",body:t});case 2:return(r=e.sent).ok,n=m(m({},r),{},{kind:h.a.SubmitForm}),e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)})}])&&g(t.prototype,r),n&&g(t,n),e}())},function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"number"==typeof e?e:t?parseFloat(e):parseInt(e,10)}function a(e){return!!(e&&e.length>0&&e.match(/^[0-9]*$/))}r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return a}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(2);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=new(function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"wplf";a(this,e),this.prefix=t}var t,r,i;return t=e,(r=[{key:"get",value:function(e,t){var r=localStorage.getItem(this.prefix+e);return null!==r?r?JSON.parse(r):r:(n.a.notice("No value found for ".concat(e,", falling back to default"),t),t)}},{key:"set",value:function(e,t){try{return localStorage.setItem(this.prefix+e,JSON.stringify(t)),!0}catch(r){return n.a.error(r,e,t),!1}}}])&&o(t.prototype,r),i&&o(t,i),e}()),u=r(3);function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(t){var r=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.remember=!1,this.name="",this.handleClick=function(e){var t=e.target;if(Object(u.a)(t)){var a=t.getAttribute("data-target");a?r.switchTab(a):n.a.notice("Unable to switch tab as data-target was empty")}e.preventDefault()},t instanceof Element!=!0)throw new Error("Tab element invalid or missing");if(this.root=t,this.name=this.root.getAttribute("data-name")||"",this.remember=null!==this.root.getAttribute("data-remember"),this.activeTab=this.root.getAttribute("data-default")||"",!this.name||!this.activeTab)throw new Error("Required attributes are missing");this.remember&&(this.activeTab=i.get(this.name,this.activeTab)),this.refresh()}var t,r,a;return t=e,(r=[{key:"refresh",value:function(){var e=this;this.getHandles().forEach((function(t){t.addEventListener("click",e.handleClick,{passive:!1})})),this.switchTab(this.activeTab)}},{key:"getTabs",value:function(){return Array.from(this.root.querySelectorAll('.wplf-tabs__tab[data-name="'.concat(this.name,'"]')))}},{key:"getHandles",value:function(){return Array.from(this.root.querySelectorAll('.wplf-tabs__tabSwitcher[data-name="'.concat(this.name,'"]')))}},{key:"switchTab",value:function(e){var t=this.getTabs(),r=this.getHandles(),n=t.filter((function(t){return t.getAttribute("data-tab")===e})),a=t.filter((function(t){return t.getAttribute("data-tab")!==e}));n.forEach((function(e){var t=e.getAttribute("data-tab"),n=r.filter((function(e){return e.getAttribute("data-target")===t}));e.classList.add("active"),n.forEach((function(e){e.classList.add("active")}))})),a.forEach((function(e){var t=e.getAttribute("data-tab"),n=r.filter((function(e){return e.getAttribute("data-target")===t}));e.classList.remove("active"),n.forEach((function(e){e.classList.remove("active")}))})),this.remember&&i.set(this.name,e)}}])&&c(t.prototype,r),a&&c(t,a),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(1),a=r(2),o=r(7),i=r(4),u=r(3),c=r(6),s=r(5);function f(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var h=function(e,t){var r=e.form;r.reset&&r.reset()},d=function(e,t){Object(u.a)(e.form.parentNode)&&e.form.parentNode.querySelectorAll(".wplf-errorMessage, .wplf-successMessage").forEach((function(e){Object(u.a)(e.parentNode)&&e.parentNode.removeChild(e)}))},m=function(e,t){console.log(t);var r=t.data.data.message,n=void 0===r?"":r,a=document.createElement("div");a.classList.add("wplf-successMessage"),a.insertAdjacentHTML("afterbegin",n.replace(/\n/g,"<br />")),e.form.insertAdjacentElement("beforebegin",a),e.form.classList.add("submitted")},b=function(e,t){var r=t.error,n=document.createElement("div");n.classList.add("wplf-errorMessage"),n.insertAdjacentHTML("afterbegin",r.message),e.form.insertAdjacentElement("beforebegin",n)},p=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.submitState=i.b.Unsubmitted,this.submitHandler=null,this.callbacks={beforeSend:{default:d},success:{default:m,clearOnSuccess:h},error:{default:b}},this.tabs=[],this.key="",t instanceof HTMLElement!=!0)throw new Error("Form element invalid or missing");this.form=t,this.id=Object(c.a)(t.dataset.formId||0),this.slug=t.dataset.formSlug||"",this.key="_"+Math.random().toString(36).substr(2,9),this.tabs=Array.from(this.form.querySelectorAll(".wplf-tabs")).map((function(e){return new o.a(e)})),this.createSubmitHandler(),this.attachSubmitHandler();var r=t.querySelector('[name="_nojs"]');r&&Object(u.a)(r.parentNode)&&r.parentNode.removeChild(r)}var t,r,p;return t=e,(r=[{key:"getDefaultCallbacks",value:function(){return{beforeSend:{default:d},success:{default:m,clearOnSuccess:h},error:{default:b}}}},{key:"addCallback",value:function(e,t,r){var n=this.callbacks,a=n.beforeSend,o=n.success,i=n.error;switch(t){case"beforeSend":a[e]=r;break;case"success":o[e]=r;break;case"error":i[e]=r;break;default:throw new Error("Unknown callback type ".concat(t))}return this}},{key:"removeCallback",value:function(e,t){var r=this.callbacks,n=r.beforeSend,a=r.success,o=r.error;switch(t){case"beforeSend":delete n[e];break;case"success":delete a[e];break;case"error":delete o[e];break;default:throw new Error("Unknown callback ".concat(e," ").concat(t))}return this}},{key:"runCallback",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.callbacks,a=n.beforeSend,o=n.success,i=n.error;switch(e){case"beforeSend":Object.values(a).forEach((function(e){e(t,r)}));break;case"success":Object.values(o).forEach((function(e){e(t,r)}));break;case"error":Object.values(i).forEach((function(e){e(t,r)}));break;default:throw new Error("Unknown callback ".concat(name," ").concat(e))}}},{key:"attachSubmitHandler",value:function(){return this.submitHandler?(a.a.notice("Attaching form submit handler"),this.form.addEventListener("submit",this.submitHandler,{passive:!1})):a.a.error("Unable to attach submit handler, as it does not exist"),this}},{key:"removeSubmitHandler",value:function(){return this.submitHandler?(a.a.notice("Removing form submit handler"),this.form.removeEventListener("submit",this.submitHandler)):a.a.error("Unable to remove submit handler, as it does not exist"),this}},{key:"createSubmitHandler",value:function(e){var t=this;return e?(this.submitHandler=e,this):(this.submitHandler=function(){var e,r=(e=regeneratorRuntime.mark((function e(r){var o,u,c,f,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.preventDefault(),t.submitState!==i.b.Submitting){e.next=4;break}return a.a.notice("Preventing double doubmission"),e.abrupt("return");case 4:return e.prev=4,o=t.form,u=new FormData(o),n.a.lang&&u.append("lang",n.a.lang),t.submitState=i.b.Submitting,o.classList.add("submitting"),t.runCallback("beforeSend",{formData:u,form:o}),e.next=13,s.a.sendSubmission(u);case 13:if(c=e.sent,f=c.data,l=c.ok,o.classList.remove("submitting"),!("error"in f)){e.next=21;break}throw a.a.error("Invalid submission!",c),new Error(f.error);case 21:if(l){e.next=25;break}throw new Error(n.a.i18n.formSubmissionRequestFailed);case 25:t.submitState=i.b.Success,t.runCallback("success",{data:f});case 27:e.next=33;break;case 29:e.prev=29,e.t0=e.catch(4),t.submitState=i.b.Error,t.runCallback("error",{error:e.t0});case 33:case"end":return e.stop()}}),e,null,[[4,29]])})),function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){f(o,n,a,i,u,"next",e)}function u(e){f(o,n,a,i,u,"throw",e)}i(void 0)}))});return function(e){return r.apply(this,arguments)}}(),this)}}])&&l(t.prototype,r),p&&l(t,p),e}()},function(e,t,r){"use strict";const{AbortController:n,AbortSignal:a}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=n,e.exports.AbortSignal=a,e.exports.default=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(8),a=r(1);function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.forms={},a.a.settings.autoinit&&this.initialize()}var t,r,i;return t=e,(r=[{key:"initialize",value:function(){var e=this;Array.from(document.querySelectorAll(".wplf-form")).map((function(t){e.attach(t)}))}},{key:"findFormsById",value:function(e){var t=this;return Object.keys(this.forms).reduce((function(r,n){var a=t.forms[n];return a?(e===a.id&&r.push(a),r):r}),[])}},{key:"findFormsBySlug",value:function(e){var t=this;return Object.keys(this.forms).reduce((function(r,n){var a=t.forms[n];return a&&a?(e===a.slug&&r.push(a),r):r}),[])}},{key:"attach",value:function(e){if(e instanceof n.a){var t=e;return this.forms[t.key]=t,t}var r=e;if(r instanceof Element!=1)throw new Error(a.a.i18n.unableToAttachWPLF);var o=new n.a(r);return this.forms[o.key]=o,o.form.removeAttribute("tabindex"),o.form.removeAttribute("style"),o}},{key:"detach",value:function(e){return this.forms[e.key].removeSubmitHandler(),delete this.forms[e.key],!0}}])&&o(t.prototype,r),i&&o(t,i),e}()},function(e,t,r){var n=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var a=t&&t.prototype instanceof p?t:p,o=Object.create(a.prototype),i=new P(n||[]);return o._invoke=function(e,t,r){var n=l;return function(a,o){if(n===d)throw new Error("Generator is already running");if(n===m){if("throw"===a)throw o;return T()}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var u=E(i,r);if(u){if(u===b)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=f(e,t,r);if("normal"===c.type){if(n=r.done?m:h,c.arg===b)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=m,r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l="suspendedStart",h="suspendedYield",d="executing",m="completed",b={};function p(){}function v(){}function g(){}var y={};y[o]=function(){return this};var w=Object.getPrototypeOf,k=w&&w(w(F([])));k&&k!==r&&n.call(k,o)&&(y=k);var S=g.prototype=p.prototype=Object.create(y);function O(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(a,o,i,u){var c=f(e[a],e,o);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,u)}),(function(e){r("throw",e,i,u)})):t.resolve(l).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,u)}))}u(c.arg)}var a;this._invoke=function(e,n){function o(){return new t((function(t,a){r(e,n,t,a)}))}return a=a?a.then(o,o):o()}}function E(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method))return b;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return b}var a=f(n,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,b;var o=a.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,b):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function F(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,i=function r(){for(;++a<e.length;)if(n.call(e,a))return r.value=e[a],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}return{next:T}}function T(){return{value:t,done:!0}}return v.prototype=S.constructor=g,g.constructor=v,v.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,u,"GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},O(x.prototype),x.prototype[i]=function(){return this},e.AsyncIterator=x,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new x(s(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},O(S),c(S,u,"Generator"),S[o]=function(){return this},S.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=F,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function a(n,a){return u.type="throw",u.arg=e,r.next=n,a&&(r.method="next",r.arg=t),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,b):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),b},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;L(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),b}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},,,,,,,,,,,,,,,,,,,,,function(e,t,r){r(11),e.exports=r(33)},function(e,t,r){"use strict";r.r(t);var n=r(10),a=r(7),o=r(8),i=r(5);r(34);t.default={api:i.a,manager:new n.a,WPLF_Tabs:a.a,WPLF_Form:o.a}},function(e,t,r){}]).default})); |
+16
-9
@@ -1,12 +0,19 @@ | ||
| # WP Libre Form Actions | ||
| # Actions | ||
| TODO | ||
| The standard stuff. Add your actions with `add_action`. | ||
| classes/class-plugin.php | ||
| 255: do_action("wplf_beforeDeleteForm", $form, $submissionCount); | ||
| 307: do_action("wplf_deleteForm", new Form($post)); | ||
| **Note:** This list is generated with silver searcher: `ag -Q do_action >> docs/actions.md` | ||
| classes/entities/class-submission.php | ||
| 71: do_action('wplfAfterSubmission', $this); | ||
| 125: do_action('wplfValidateSubmission', $data, $this); | ||
| 208: do_action('wplfHoneypotTriggered', $data, $this); | ||
| Further descriptions of the actions have intentionally been left out. You better understand where the action runs and what it runs with before using the action. Documentations also go out of date, we might add a new parameter to an action, but forget to reflect it here. | ||
| ## List of filters | ||
| classes/class-plugin.php:287: do_action("wplfBeforeDeleteForm", $form, $submissionCount); | ||
| classes/class-plugin.php:339: do_action("wplfDeleteForm", new Form(\$post)); | ||
| classes/entities/class-form.php:301: do_action('wplfValidateSubmission', $formEntries, $this); | ||
| classes/entities/class-form.php:377: do_action('wplfHoneypotTriggered', $formEntries, $this); | ||
| classes/modules/io/class-submission-io.php:45: do_action('wplfAfterSubmission', $submission, \$form); |
+1
-1
@@ -55,3 +55,3 @@ # WP Libre Form API | ||
| const { WPLF_Form, WPLF_Tabs, api } = WPLF | ||
| const { WPLF_Form, WPLF_Tabs, api, manager } = WPLF | ||
| ``` | ||
@@ -58,0 +58,0 @@ |
+5
-11
@@ -174,3 +174,3 @@ # Architecture | ||
| Nothing yet. Runs on the addon page. | ||
| Runs on the addon page. | ||
@@ -197,2 +197,6 @@ #### `wplf-admin.ts` | ||
| #### `wplf-api.ts` | ||
| Used for communicating between client and the REST API | ||
| #### `wplf.ts` | ||
@@ -204,8 +208,2 @@ | ||
| #### `api-client.ts` | ||
| This should probably be a class, but it isn't. It works similarly to a class though. As the name implies, this is used for API requests. | ||
| Submissions, admin preview etc are all done through this. Requests can be aborted if necessary. | ||
| #### `ensure-num.ts` | ||
@@ -223,6 +221,2 @@ | ||
| #### `is-elementish.ts` | ||
| Another one of those little annoying things in TS. Because it's possible to break things by passing a faulty event to an event listener, TS won't compile without a special type guard that tells it that X is indeed an Element. | ||
| #### `log.ts` | ||
@@ -229,0 +223,0 @@ |
+69
-47
@@ -1,57 +0,79 @@ | ||
| # WP Libre Form Filters | ||
| # Filters | ||
| TODO | ||
| The standard stuff. Add your filters with `add_filter`. | ||
| classes/class-plugin.php | ||
| 42: if (apply_filters('wplfEnablePolylangSupport', true) && class_exists('Polylang')) { | ||
| 130: 'requestHeaders' => (object) apply_filters('wplfSubmissionHeaders', [ | ||
| 176: wp_localize_script('wplf-admin', 'wplfData', apply_filters('wplfAdminData', $this->getLocalizeScriptData(['codeMirror' => $cm]))); | ||
| 181: $data = apply_filters('wplfFrontendData', $this->getLocalizeScriptData()); | ||
| 551: $output = apply_filters('wplfAfterRender', $output, $form, $options); | ||
| **Note:** This list is generated with silver searcher: `ag -Q apply_filters >> docs/actions.md` | ||
| classes/entities/class-form.php | ||
| 154: $content = apply_filters('wplfBeforeRender', $content, $this->post, $options); | ||
| 232: return apply_filters('wplfAdditionalFields', $defaults, $this); | ||
| Further descriptions of the filters have intentionally been left out. If you're going to change values on the fly, you better understand what the code is doing with the value. Documentations also go out of date, we might add a new parameter to a filter, but forget to reflect it here. | ||
| classes/entities/class-submission.php | ||
| 61: $fields = apply_filters('wplfFieldsBeforeValidateSubmission', $fields); | ||
| 68: $this->fields = apply_filters('wplfFieldsAfterValidateSubmission', $fields); | ||
| 73: if (apply_filters('wplfUseDefaultAfterSubmission', true, $this)) { | ||
| 82: $data = apply_filters('wplfEmailNotificationData', $email, $this); | ||
| 90: $headers = apply_filters('wplfEmailNotificationHeaders', [ | ||
| 93: $attachments = apply_filters('wplfEmailNotificationAttachment', [], $this); | ||
| 116: $honeypotEnabled = apply_filters('wplfEnableHoneypot', true, $form); | ||
| 117: $requiredEnabled = apply_filters('wplfEnablRequiredValidation', true, $form); | ||
| 118: $additionalFieldsEnabled = apply_filters('wplfEnableAdditionalFieldsValidation', true, $form); | ||
| 184: $whitelist = apply_filters('wplfAllowedFormFields', array_merge($formFieldNames, $form->getAdditionalFields()), $form); | ||
| ## List of filters | ||
| classes/modules/class-addons.php | ||
| 159: return apply_filters('wplf_enabled_plugins', $this->plugins); | ||
| 194: return apply_filters('wplf_recommended_plugins', $list); | ||
| classes/entities/class-form.php:240: return apply_filters('wplfAdditionalFields', $defaults, $this); | ||
| classes/modules/class-io.php | ||
| 269: return apply_filters('wplfHistoryFields', (object) $historyFields, $form); | ||
| 426: $name = sanitize_file_name(apply_filters('wplfUploadedFileName', $defaultName, $uploadData, $form)); | ||
| 429: $filePath = apply_filters('wplfUploadedFilePath', $defaultPath, $uploadData, $form); | ||
| classes/entities/class-form.php:290: $formEntries = apply_filters('wplfFieldsBeforeValidateSubmission', $formEntries, \$this); | ||
| wp-libre-form.php | ||
| 108: if ( apply_filters( 'wplf_load_polylang', true ) && class_exists( 'Polylang' ) ) { | ||
| classes/entities/class-form.php:292: $honeypotEnabled = apply_filters('wplfEnableHoneypot', true, $this); | ||
| classes/modules/class-admin-interface.php | ||
| 539: <?=checked(apply_filters('wplfUpgradeFormByFefault', false, $form), true, false)?> | ||
| classes/entities/class-form.php:293: $requiredEnabled = apply_filters('wplfEnableRequiredValidation', true, $this); | ||
| classes/modules/class-selectors.php | ||
| 160: return apply_filters('wplfAllSelectors', $this->entries); | ||
| classes/entities/class-form.php:294: $additionalFieldsEnabled = apply_filters('wplfEnableAdditionalFieldsValidation', true, $this); | ||
| classes/class-cpt-wplf-form.php | ||
| 642: $template_content = apply_filters( 'wplf_import_html_template', null, $form_id ); | ||
| 782: $success = apply_filters( 'wplf_save_success_message', $success, $post_id ); | ||
| 901: $content = apply_filters( "wplf_{$form->post_name}_form", $content ); | ||
| 902: $content = apply_filters( "wplf_{$form->ID}_form", $content ); | ||
| 905: $content = apply_filters( 'wplf_form', $content, $id, $xclass, $attributes ); | ||
| 986: apply_filters( 'wplf_frontend_script_dependencies', array() ), | ||
| 994: wp_localize_script( 'wplf-form-js', 'ajax_object', apply_filters( 'wplf_ajax_object', array( | ||
| 995: 'ajax_url' => apply_filters( 'wplf_ajax_endpoint', "$admin_url?action=wplf_submit" ), | ||
| 996: 'ajax_credentials' => apply_filters( 'wplf_ajax_fetch_credentials_mode', 'same-origin' ), | ||
| 997: 'request_headers' => (object) apply_filters( 'wplf_ajax_request_headers', [] ), | ||
| 1070: return apply_filters( 'wplf-form-publicly-visible', false, $id ); | ||
| classes/entities/class-form.php:350: $whitelist = apply_filters('wplfAllowedFormFields', array_merge($formFieldNames, $this->getAdditionalFields()), $this); | ||
| classes/entities/class-submission.php:105: $data = apply_filters('wplfEmailNotificationData', $email, \$this); | ||
| classes/entities/class-submission.php:114: \$headers = apply_filters('wplfEmailNotificationHeaders', [ | ||
| classes/entities/class-submission.php:117: $attachments = apply_filters('wplfEmailNotificationAttachment', [], $this); | ||
| classes/class-plugin.php:45: if (apply_filters('wplfEnablePolylangSupport', true) && class_exists('Polylang')) { | ||
| classes/class-plugin.php:149: 'requestHeaders' => (object) apply_filters('wplfSubmissionHeaders', [ | ||
| classes/class-plugin.php:206: wp_localize_script('wplf-admin', 'wplfData', apply_filters('wplfAdminData', \$this->getLocalizeScriptData([ | ||
| classes/class-plugin.php:215: $data = apply_filters('wplfFrontendData', $this->getLocalizeScriptData()); | ||
| classes/class-plugin.php:621: $output = apply_filters('wplfAfterRender', $output, $form, $renderOptions); | ||
| classes/class-plugin.php:645: $submission = apply_filters('wplfFormRenderSubmission', $submission, $this, $options); | ||
| classes/class-plugin.php:646: $content = apply_filters('wplfImportFormTemplate', $options['content'] ?? $form->content, $form); | ||
| classes/class-plugin.php:657: $content = apply_filters('wplfBeforeRender', $content, $form, $options); | ||
| classes/modules/class-addons.php:165: return apply_filters('wplf_enabled_plugins', \$this->plugins); | ||
| classes/modules/class-addons.php:186: return apply_filters('wplf_recommended_plugins', \$list); | ||
| classes/modules/class-admin-interface.php:209: $importedContent = apply_filters('wplfImportFormTemplate', null, $form); | ||
| classes/modules/class-admin-interface.php:543: <?=checked($isNewPost || apply_filters('wplfUpgradeFormByFefault', false, $form), true, false)?> | ||
| classes/modules/io/class-submission-io.php:29: $entries = apply_filters('wplfFieldsAfterValidateSubmission', $entries, \$form); | ||
| classes/modules/io/class-submission-io.php:47: if (apply_filters('wplfUseDefaultAfterSubmission', true, $submission, $form)) { | ||
| classes/modules/io/class-submission-io.php:259: $name = sanitize_file_name(apply_filters('wplfUploadedFileName', $defaultName, $uploadData, $form)); | ||
| classes/modules/io/class-submission-io.php:262: $filePath = apply_filters('wplfUploadedFilePath', $defaultPath, $uploadData, $form); | ||
| classes/modules/io/class-submission-io.php:301: 'value' => json_encode(apply_filters('wplfSubmissionMeta', [ | ||
| classes/modules/class-selectors.php:62: $value = apply_filters('wplfSubmissionSelectorFileFieldValue', $str, $value, $formField); | ||
| classes/modules/class-selectors.php:67: \$value = apply_filters('wplfEmptySubmissionFieldValue', \_\_('(empty)', 'wplf')); | ||
| classes/modules/class-selectors.php:178: return apply_filters('wplfAllSelectors', \$this->entries); | ||
| classes/modules/class-rest-api.php:319: $useFallback = apply_filters('wplfSetNoJsFallback', isset($params['_nojs']), \$form); | ||
| classes/modules/class-rest-api.php:322: $allowFallback = apply_filters('wplfAllowNoJsFallback', true, $form); | ||
| classes/modules/io/class-form-io.php:158: return apply_filters('wplfHistoryFields', (object) $historyFields, $form); | ||
| docs/API.md:45: apply_filters('wplfFrontendData', libreform()->getLocalizeScriptData()) | ||
| lib/helpers.php:126: return apply_filters('wplfMainCapability', 'upload_files'); | ||
| index.php:28: require_once apply_filters('wplfPluginClassLocation', 'classes/class-plugin.php'); |
+82
-63
@@ -6,12 +6,12 @@ # JavaScript API | ||
| const { api, WPLF_Form, WPLF_Tabs } = WPLF | ||
| const { api, manager, WPLF_Form, WPLF_Tabs } = WPLF | ||
| ``` | ||
| ## WPLF | ||
| ## manager | ||
| The face of the JavaScript API. Responsible for managing forms. | ||
| ### `WPLF.findFormsById(id: number): WPLF_Form[]` | ||
| ### `manager.findFormsById(id: number): WPLF_Form[]` | ||
| #### `WPLF.findFormsBySlug(slug: string): WPLF_Form[]` | ||
| ### `manager.findFormsBySlug(slug: string): WPLF_Form[]` | ||
@@ -26,13 +26,13 @@ Returns an array populated with `WPLF_Form` instances. It's valid to have multiple instances of the form on one page. | ||
| ### `WPLF.initialize()` | ||
| ### `manager.initialize()` | ||
| Find all forms and make init them. This one runs automatically with the default settings. Run after dynamically loading forms or if you've disabled the autoinit. | ||
| Find all forms and init them. This one runs automatically with the default settings. Call after dynamically loading forms or if you've disabled the autoinit. | ||
| ### `WPLF.attach(form: Element | WPLF_Form)` | ||
| Calls `manager.attach()` for you. | ||
| Create WPLF_Form instance from element and make it visible to WPLF.findFormsById. | ||
| ### `manager.attach(form: Element | WPLF_Form)` | ||
| You will only need this if you load forms dynamically or you've disabled autoinit of forms. | ||
| Create `WPLF_Form` instance from element and attach the instance to `WPLF`. | ||
| You can also pass WPLF_Form directly. | ||
| You can also pass `WPLF_Form` directly. | ||
@@ -45,6 +45,48 @@ ```javascript | ||
| ### `WPLF.detach(form: WPLF_Form)` | ||
| ### `manager.detach(form: WPLF_Form)` | ||
| Destroy WPLF_Form instance and remove event listeners from the form. | ||
| ## api | ||
| The WPLF api client. Used for all interactions between the client and the server, with the exception of admin. | ||
| Methods return a promise that resolves into a fetch response or an error. Always use with try/catch! | ||
| ### `api.requestRender(id: string | number, content: string)` | ||
| Request REST API to render the form with the content provided. If no content is provided, defaults to the post_content. | ||
| **REQUIRES AUTHENTICATION AND EDITOR LEVEL PERMISSIONS.** | ||
| ### `api.requestForm(idOrSlug: string | number)` | ||
| Request the data of a single form from the API. | ||
| ### `api.requestForms(page: number)` | ||
| Request all forms. If there's a lot, pagination may be necessary. You'll find the pagination info in the response headers. | ||
| ### `api.deleteSubmissions(idOrSlug: string | number, submissionUuids: string[])` | ||
| Delete form submissions. Uses UUIDs to lessen the risk of enumeration. To delete a single submission, pass it's uuid in an array. | ||
| **REQUIRES AUTHENTICATION AND EDITOR LEVEL PERMISSIONS.** | ||
| ### `api.requestSubmissions(formIdOrSlug: string | number, page: number, limit: number)` | ||
| Request form submissions. If there's a lot, pagination is necessary. The pagination data can be found in the response headers. | ||
| **REQUIRES AUTHENTICATION AND EDITOR LEVEL PERMISSIONS.** | ||
| ### `api.requestSubmission(formIdOrSlug: string | number, uuid: string)` | ||
| Request form submission. | ||
| **REQUIRES AUTHENTICATION AND EDITOR LEVEL PERMISSIONS.** | ||
| ### `api.sendSubmission(body: FormData)` | ||
| Send the submission to the API. | ||
| ## WPLF_Form | ||
@@ -59,4 +101,2 @@ | ||
| ```javascript | ||
| const form = WPLF.findFormsById(1)[0] | ||
| // not like this: | ||
@@ -66,5 +106,33 @@ // WPLF_Form.createSubmitHandler(...) | ||
| // like this: | ||
| const form = WPLF.findFormsById(1)[0] | ||
| form.createSubmitHandler(...) | ||
| ``` | ||
| Most methods are chainable: | ||
| ```javascript | ||
| form | ||
| .removeCallback('default', 'beforeSend') | ||
| .addCallback('mycallback', 'beforeSend', myCallback) | ||
| .removeSubmitHandler() | ||
| .attachSubmitHandler() | ||
| function myCallback(wplfForm: WPLF_Form, params: List<any>) { | ||
| if (isElementish(wplfForm.form.parentNode)) { | ||
| const parentNode = wplfForm.form.parentNode | ||
| // Reset error and success messages, if there were any | ||
| const messages = parentNode.querySelectorAll( | ||
| '.wplf-errorMessage, .wplf-successMessage' | ||
| ) | ||
| messages.forEach((element: Element) => { | ||
| if (isElementish(element.parentNode)) { | ||
| element.parentNode.removeChild(element) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
| ``` | ||
| #### `WPLF_Form.addCallback(name: string, type: string, callback: FormCallback)` | ||
@@ -106,11 +174,4 @@ | ||
| Attach the submit handler to the form. If you created your own submit handler, **remember to assign it to the form instance first.** | ||
| Attach the submit handler to the form. | ||
| ```javascript | ||
| const handler = form.createSubmitHandler() | ||
| form.submitHandler = handler | ||
| form.attachSubmitHandler() | ||
| ``` | ||
| ### `WPLF_Form.runCallback(type: string, params: List<any> = {})` | ||
@@ -120,44 +181,2 @@ | ||
| ## api | ||
| The WPLF api client. Used for all interactions between the client and the server, with the exception of admin. | ||
| Methods return a promise that resolves into a fetch response or an error. Always use with try/catch! | ||
| ### `api.requestRender(id: string | number, content: string)` | ||
| Request REST API to render the form with the content provided. If no content is provided, defaults to the post_content. | ||
| **REQUIRES AUTHENTICATION AND EDITOR LEVEL PERMISSIONS.** | ||
| ### `api.requestForm(idOrSlug: string | number)` | ||
| Request the data of a single form from the API. | ||
| ### `api.requestForms(page: number)` | ||
| Request all forms. If there's a lot, pagination may be necessary. You'll find the pagination info in the response headers. | ||
| ### `api.deleteSubmissions(idOrSlug: string | number, submissionUuids: string[])` | ||
| Delete form submissions. Uses UUIDs to lessen the risk of enumeration. To delete a single submission, pass it's uuid in an array. | ||
| **REQUIRES AUTHENTICATION AND EDITOR LEVEL PERMISSIONS.** | ||
| ### `api.requestSubmissions(formIdOrSlug: string | number, page: number, limit: number)` | ||
| Request form submissions. If there's a lot, pagination is necessary. The pagination data can be found in the response headers. | ||
| **REQUIRES AUTHENTICATION AND EDITOR LEVEL PERMISSIONS.** | ||
| ### `api.requestSubmission(formIdOrSlug: string | number, uuid: string)` | ||
| Request form submission. | ||
| **REQUIRES AUTHENTICATION AND EDITOR LEVEL PERMISSIONS.** | ||
| ### `api.sendSubmission(body: FormData)` | ||
| Send the submission to the API. | ||
| ## WPLF_Tabs | ||
@@ -164,0 +183,0 @@ |
+2
-1
| { | ||
| "name": "@libreform/libreform", | ||
| "version": "2.0.0-beta.11", | ||
| "version": "2.0.0-beta.12", | ||
| "description": "WP Libre Form client", | ||
| "main": "dist/wplf-frontend.js", | ||
| "types": "dist/types.d.ts", | ||
| "scripts": { | ||
@@ -7,0 +8,0 @@ "clean": "rimraf dist/", |
+12
-20
@@ -29,12 +29,16 @@ # WP Libre Form | ||
| ## Try it | ||
| ## Server requirements | ||
| [TryoutWP](https://gettryout.com/) has provided us with a live demo, [which you can find here](http://gettryout.com/new/?template=libreform&provider=demo&redirect=wp-admin%2Fpost.php%3Fpost%3D4%26action%3Dedit). | ||
| - PHP 7.3 or newer | ||
| Please note that it reflects the current release, not the master branch. | ||
| ## Further reading | ||
| ## Server requirements | ||
| - [Architecture](docs/architecture.md) | ||
| - [API](docs/API.md) | ||
| - [Actions](docs/actions.md) | ||
| - [FAQ](docs/FAQ.md) | ||
| - [Filters](docs/filters.md) | ||
| - [Limitations](docs/limitations.md) | ||
| - [List of examples](docs/examples.md) | ||
| - PHP 7.3 or newer | ||
| ## New in 2.0 | ||
@@ -46,3 +50,3 @@ | ||
| As migrations tend to be a pain in the ass, I made sure that the new version works side by side with the old one. Everything has been renamed so they do not conflict with each other. | ||
| As migrations tend to be a pain in the ass, I made sure that the new version works side by side with the old one. Everything has been renamed so they do not conflict with each other. **In other words, you should be able to use both versions simultaneously.** | ||
@@ -58,4 +62,2 @@ Some key changes; | ||
| None of your existing code will work without modifications. | ||
| ## Screenshots | ||
@@ -97,14 +99,4 @@ | ||
| ~~This plugin is available on the [official WordPress.org plugin directory](https://wordpress.org/plugins/libre-form/).~~ Not yet though. | ||
| ~~This plugin is available on the [official WordPress.org plugin directory](https://wordpress.org/plugins/libre-form/).~~ 2.0 has not been submitted to the wp.org plugin directory yet. | ||
| You can also install the plugin by directly uploading a copy of this repository in your plugins folder. | ||
| ## Further reading | ||
| - [Architecture](docs/architecture.md) | ||
| - [API](docs/API.md) | ||
| - [Actions](docs/actions.md) | ||
| - [FAQ](docs/FAQ.md) | ||
| - [Filters](docs/filters.md) | ||
| - [Limitations](docs/limitations.md) | ||
| - [List of examples](docs/examples.md) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
634836
0.78%37
2.78%8772
1.33%99
-7.48%