plugin updates

This commit is contained in:
Tony Volpe
2024-06-17 15:33:26 -04:00
parent 3751a5a1a6
commit e4e274a9a7
2674 changed files with 0 additions and 507851 deletions

View File

@@ -1,50 +0,0 @@
import $ from 'jquery';
import { domElements } from '../constants/selectors';
export default class ThickBoxModal {
openTriggerSelector: string;
inlineContentId: string;
windowCssClass: string;
contentCssClass: string;
constructor(
openTriggerSelector: string,
inlineContentId: string,
windowCssClass: string,
contentCssClass: string
) {
this.openTriggerSelector = openTriggerSelector;
this.inlineContentId = inlineContentId;
this.windowCssClass = windowCssClass;
this.contentCssClass = contentCssClass;
$(openTriggerSelector).on('click', this.init.bind(this));
}
close() {
//@ts-expect-error global
window.tb_remove();
}
init(e: Event) {
//@ts-expect-error global
window.tb_show(
'',
`#TB_inline?inlineId=${this.inlineContentId}&modal=true`
);
// thickbox doesn't respect the width and height url parameters https://core.trac.wordpress.org/ticket/17249
// We override thickboxes css with !important in the css
$(domElements.thickboxModalWindow).addClass(this.windowCssClass);
// have to modify the css of the thickbox content container as well
$(domElements.thickboxModalContent).addClass(this.contentCssClass);
// we unbind previous handlers because a thickbox modal is a single global object.
// Everytime it is re-opened, it still has old handlers bound
$(domElements.thickboxModalClose)
.off('click')
.on('click', this.close);
e.preventDefault();
}
}

View File

@@ -1,23 +0,0 @@
import $ from 'jquery';
const portalId = '6275621';
const formId = '0e8807f8-2ac3-4664-b742-44552bfa09e2';
const formSubmissionUrl = `https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`;
export function submitFeedbackForm(formSelector: string) {
const formSubmissionPayload = {
fields: $(formSelector).serializeArray(),
skipValidation: true,
};
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: formSubmissionUrl,
contentType: 'application/json',
data: JSON.stringify(formSubmissionPayload),
success: resolve,
error: reject,
});
});
}