diff --git a/admin-dev/themes/new-theme/js/pages/address/index.ts b/admin-dev/themes/new-theme/js/pages/address/index.ts index d0bd0654f5bf1..25246d7ff4f14 100644 --- a/admin-dev/themes/new-theme/js/pages/address/index.ts +++ b/admin-dev/themes/new-theme/js/pages/address/index.ts @@ -23,10 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import ChoiceTable from '@components/choice-table'; - -const {$} = window; - $(() => { const addressGrid = new window.prestashop.component.Grid('address'); @@ -39,6 +35,9 @@ $(() => { addressGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension()); addressGrid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension()); - // needed for address required fields form - new ChoiceTable(); + window.prestashop.component.initComponents( + [ + 'ChoiceTable', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/api-client/index.ts b/admin-dev/themes/new-theme/js/pages/api-client/index.ts index 71361bdef16de..1935b8073d4ef 100644 --- a/admin-dev/themes/new-theme/js/pages/api-client/index.ts +++ b/admin-dev/themes/new-theme/js/pages/api-client/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const grid = new window.prestashop.component.Grid('api_client'); diff --git a/admin-dev/themes/new-theme/js/pages/attachment/index.ts b/admin-dev/themes/new-theme/js/pages/attachment/index.ts index 40b63fa81457b..6f5d4e1d74e2a 100644 --- a/admin-dev/themes/new-theme/js/pages/attachment/index.ts +++ b/admin-dev/themes/new-theme/js/pages/attachment/index.ts @@ -23,10 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '@components/translatable-input'; - -const {$} = window; - $(() => { const attachmentGrid = new window.prestashop.component.Grid('attachment'); @@ -39,5 +35,9 @@ $(() => { attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension()); attachmentGrid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension()); - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/attribute/index.ts b/admin-dev/themes/new-theme/js/pages/attribute/index.ts index bcabb696e4d71..1340c01b39eae 100644 --- a/admin-dev/themes/new-theme/js/pages/attribute/index.ts +++ b/admin-dev/themes/new-theme/js/pages/attribute/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const grid = new window.prestashop.component.Grid('attribute'); diff --git a/admin-dev/themes/new-theme/js/pages/backup/index.ts b/admin-dev/themes/new-theme/js/pages/backup/index.ts index cdf0bdd7c0c9c..de2aaf305764d 100644 --- a/admin-dev/themes/new-theme/js/pages/backup/index.ts +++ b/admin-dev/themes/new-theme/js/pages/backup/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const backupGrid = new window.prestashop.component.Grid('backup'); diff --git a/admin-dev/themes/new-theme/js/pages/carrier/form/index.ts b/admin-dev/themes/new-theme/js/pages/carrier/form/index.ts index 5001b06120008..ad3fc46e4d1b4 100644 --- a/admin-dev/themes/new-theme/js/pages/carrier/form/index.ts +++ b/admin-dev/themes/new-theme/js/pages/carrier/form/index.ts @@ -24,7 +24,6 @@ */ import NavbarHandler from '@components/navbar-handler'; -import ChoiceTable from '@js/components/choice-table'; import CarrierFormManager from '@pages/carrier/form/carrier-form-manager'; import CarrierRanges from '@pages/carrier/form/carrier-range-modal'; import CarrierFormMap from './carrier-form-map'; @@ -35,13 +34,12 @@ $(() => { 'TranslatableInput', 'EventEmitter', 'MultipleZoneChoice', + 'ChoiceTable', ]); // Initialize the ranges selection modal new CarrierRanges(window.prestashop.instance.eventEmitter); - new ChoiceTable(); - new NavbarHandler($(CarrierFormMap.navigationBar)); // Initialize the carrier form manager diff --git a/admin-dev/themes/new-theme/js/pages/cart-rule/index.ts b/admin-dev/themes/new-theme/js/pages/cart-rule/index.ts index 668fc92abf4a4..63679bf3b474f 100644 --- a/admin-dev/themes/new-theme/js/pages/cart-rule/index.ts +++ b/admin-dev/themes/new-theme/js/pages/cart-rule/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const cartRuleGrid = new window.prestashop.component.Grid('cart_rule'); diff --git a/admin-dev/themes/new-theme/js/pages/cart/index.ts b/admin-dev/themes/new-theme/js/pages/cart/index.ts index 3981705972a5c..4dd53de0e5f8d 100644 --- a/admin-dev/themes/new-theme/js/pages/cart/index.ts +++ b/admin-dev/themes/new-theme/js/pages/cart/index.ts @@ -24,9 +24,6 @@ * */ - -const {$} = window; - $(() => { const grid = new window.prestashop.component.Grid('cart'); grid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension()); diff --git a/admin-dev/themes/new-theme/js/pages/catalog-price-rule/index.ts b/admin-dev/themes/new-theme/js/pages/catalog-price-rule/index.ts index 621ef48abcd06..12e30638047c5 100644 --- a/admin-dev/themes/new-theme/js/pages/catalog-price-rule/index.ts +++ b/admin-dev/themes/new-theme/js/pages/catalog-price-rule/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const priceRuleGrid = new window.prestashop.component.Grid('catalog_price_rule'); diff --git a/admin-dev/themes/new-theme/js/pages/category/index.ts b/admin-dev/themes/new-theme/js/pages/category/index.ts index 6b88edd82f775..25ac5c749b352 100644 --- a/admin-dev/themes/new-theme/js/pages/category/index.ts +++ b/admin-dev/themes/new-theme/js/pages/category/index.ts @@ -28,7 +28,6 @@ import CategoryPositionExtension from '@components/grid/extension/column/catalog import DeleteCategoryRowActionExtension from '@components/grid/extension/action/row/category/delete-category-row-action-extension'; import DeleteCategoriesBulkActionExtension from '@components/grid/extension/action/bulk/category/delete-categories-bulk-action-extension'; /* eslint-enable */ -import ChoiceTable from '@components/choice-table'; import textToLinkRewriteCopier from '@components/text-to-link-rewrite-copier'; import FormSubmitButton from '@components/form-submit-button'; import ShowcaseCard from '@components/showcase-card/showcase-card'; @@ -63,11 +62,11 @@ $(() => { 'TinyMCEEditor', 'TranslatableInput', 'TextWithRecommendedLengthCounter', + 'ChoiceTable', ], ); const translatorInput = window.prestashop.instance.translatableInput; - new ChoiceTable(); textToLinkRewriteCopier({ sourceElementSelector: 'input[name^="category[name]"]', diff --git a/admin-dev/themes/new-theme/js/pages/cms-page/form/index.ts b/admin-dev/themes/new-theme/js/pages/cms-page/form/index.ts index eb2b5ef88943b..fa44d326ce738 100644 --- a/admin-dev/themes/new-theme/js/pages/cms-page/form/index.ts +++ b/admin-dev/themes/new-theme/js/pages/cms-page/form/index.ts @@ -23,7 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import ChoiceTree from '@components/form/choice-tree'; import textToLinkRewriteCopier from '@components/text-to-link-rewrite-copier'; import Serp from '@app/utils/serp/index'; import TextWithRecommendedLengthCounter from '@components/form/text-with-recommended-length-counter'; @@ -31,7 +30,7 @@ import TextWithRecommendedLengthCounter from '@components/form/text-with-recomme const {$} = window; $(() => { - new ChoiceTree('#cms_page_page_category_id'); + new window.prestashop.component.ChoiceTree('#cms_page_page_category_id'); window.prestashop.component.initComponents( [ @@ -72,7 +71,7 @@ $(() => { destinationElementSelector: `${translatorInput.localeInputSelector}:not(.d-none) input.js-copier-destination-friendly-url`, }); - new ChoiceTree('#cms_page_shop_association').enableAutoCheckChildren(); + new window.prestashop.component.ChoiceTree('#cms_page_shop_association').enableAutoCheckChildren(); new TextWithRecommendedLengthCounter(); }); diff --git a/admin-dev/themes/new-theme/js/pages/cms-page/index.ts b/admin-dev/themes/new-theme/js/pages/cms-page/index.ts index 583f459bf77f0..868b100584d89 100644 --- a/admin-dev/themes/new-theme/js/pages/cms-page/index.ts +++ b/admin-dev/themes/new-theme/js/pages/cms-page/index.ts @@ -23,10 +23,7 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import ChoiceTree from '@components/form/choice-tree'; -import TranslatableInput from '@components/translatable-input'; import textToLinkRewriteCopier from '@components/text-to-link-rewrite-copier'; -import TaggableField from '@components/taggable-field'; import ShowcaseCard from '@components/showcase-card/showcase-card'; import ShowcaseCardCloseExtension from '@components/showcase-card/extension/showcase-card-close-extension'; @@ -47,7 +44,13 @@ $(() => { cmsCategory.addExtension(new window.prestashop.component.GridExtensions.PositionExtension(cmsCategory)); cmsCategory.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension()); - const translatorInput = new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); + + const translatorInput = window.prestashop.instance.translatableInput; textToLinkRewriteCopier({ sourceElementSelector: 'input[name^="cms_page_category[name]"]', @@ -55,12 +58,12 @@ $(() => { destinationElementSelector: `${translatorInput.localeInputSelector}:not(.d-none) input[name^="cms_page_category[friendly_url]"]`, }); - new ChoiceTree('#cms_page_category_parent_category'); + new window.prestashop.component.ChoiceTree('#cms_page_category_parent_category'); - const shopChoiceTree = new ChoiceTree('#cms_page_category_shop_association'); + const shopChoiceTree = new window.prestashop.component.ChoiceTree('#cms_page_category_shop_association'); shopChoiceTree.enableAutoCheckChildren(); - new TaggableField({ + new window.prestashop.component.TaggableField({ tokenFieldSelector: 'input[name^="cms_page_category[meta_keywords]"]', options: { createTokensOnBlur: true, diff --git a/admin-dev/themes/new-theme/js/pages/contacts/ContactsPage.ts b/admin-dev/themes/new-theme/js/pages/contacts/ContactsPage.ts index 9fa4b68578129..6525263b86d66 100644 --- a/admin-dev/themes/new-theme/js/pages/contacts/ContactsPage.ts +++ b/admin-dev/themes/new-theme/js/pages/contacts/ContactsPage.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '@components/translatable-input'; -import ChoiceTree from '@components/form/choice-tree'; - /** * Responsible for actions in Contacts listing page. */ @@ -43,8 +40,12 @@ export default class ContactsPage { contactGrid.addExtension(new window.prestashop.component.GridExtensions.BulkActionCheckboxExtension()); contactGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension()); - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); - new ChoiceTree('#contact_shop_association').enableAutoCheckChildren(); + new window.prestashop.component.ChoiceTree('#contact_shop_association').enableAutoCheckChildren(); } } diff --git a/admin-dev/themes/new-theme/js/pages/country/form/index.ts b/admin-dev/themes/new-theme/js/pages/country/form/index.ts index 821570e158917..8e5baede7055d 100644 --- a/admin-dev/themes/new-theme/js/pages/country/form/index.ts +++ b/admin-dev/themes/new-theme/js/pages/country/form/index.ts @@ -25,12 +25,16 @@ import ZipCodeManager from '@pages/country/components/zip-code-manager'; import FormSubmitButton from '@components/form-submit-button'; -import TranslatableInput from '@components/translatable-input'; const {$} = window; $(() => { + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); + new FormSubmitButton(); - new TranslatableInput(); new ZipCodeManager(); }); diff --git a/admin-dev/themes/new-theme/js/pages/country/index.ts b/admin-dev/themes/new-theme/js/pages/country/index.ts index 2d72eb141a5e6..8412e1a789a0e 100644 --- a/admin-dev/themes/new-theme/js/pages/country/index.ts +++ b/admin-dev/themes/new-theme/js/pages/country/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const countryGrid = new window.prestashop.component.Grid('country'); diff --git a/admin-dev/themes/new-theme/js/pages/credit-slip/index.ts b/admin-dev/themes/new-theme/js/pages/credit-slip/index.ts index 988301b43ea39..6bf4cd39a7665 100644 --- a/admin-dev/themes/new-theme/js/pages/credit-slip/index.ts +++ b/admin-dev/themes/new-theme/js/pages/credit-slip/index.ts @@ -23,10 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '../../components/translatable-input'; - -const {$} = window; - $(() => { const creditSlipGrid = new window.prestashop.component.Grid('credit_slip'); @@ -36,5 +32,9 @@ $(() => { creditSlipGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension()); creditSlipGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension()); - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/customer-groups/index.ts b/admin-dev/themes/new-theme/js/pages/customer-groups/index.ts index 75749e18a04ee..83537f427900f 100644 --- a/admin-dev/themes/new-theme/js/pages/customer-groups/index.ts +++ b/admin-dev/themes/new-theme/js/pages/customer-groups/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const customerGroups = new window.prestashop.component.Grid('customer_groups'); diff --git a/admin-dev/themes/new-theme/js/pages/customer-thread/index.ts b/admin-dev/themes/new-theme/js/pages/customer-thread/index.ts index 64af07431da1d..e2b9d59e02beb 100644 --- a/admin-dev/themes/new-theme/js/pages/customer-thread/index.ts +++ b/admin-dev/themes/new-theme/js/pages/customer-thread/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const grid = new window.prestashop.component.Grid('customer_thread'); diff --git a/admin-dev/themes/new-theme/js/pages/customer/form.ts b/admin-dev/themes/new-theme/js/pages/customer/form.ts index 118df82fecdcf..0895431190df5 100644 --- a/admin-dev/themes/new-theme/js/pages/customer/form.ts +++ b/admin-dev/themes/new-theme/js/pages/customer/form.ts @@ -23,12 +23,14 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import ChoiceTable from '@components/choice-table'; import CustomerForm from './CustomerForm'; $(() => { new CustomerForm(); - // needed for "Group access" input in Add/Edit customer forms - new ChoiceTable(); + window.prestashop.component.initComponents( + [ + 'ChoiceTable', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/employee/EmployeeForm.ts b/admin-dev/themes/new-theme/js/pages/employee/EmployeeForm.ts index 1ab60895c02ef..9cc55cc1f1fca 100644 --- a/admin-dev/themes/new-theme/js/pages/employee/EmployeeForm.ts +++ b/admin-dev/themes/new-theme/js/pages/employee/EmployeeForm.ts @@ -43,7 +43,7 @@ export default class EmployeeForm { constructor() { this.shopChoiceTreeSelector = employeeFormMap.shopChoiceTree; - this.shopChoiceTree = new ChoiceTree(this.shopChoiceTreeSelector); + this.shopChoiceTree = new window.prestashop.component.ChoiceTree(this.shopChoiceTreeSelector); this.employeeProfileSelector = employeeFormMap.profileSelect; this.tabsDropdownSelector = employeeFormMap.defaultPageSelect; diff --git a/admin-dev/themes/new-theme/js/pages/feature/feature-value/form.ts b/admin-dev/themes/new-theme/js/pages/feature/feature-value/form.ts index 2e36830fa28e2..14e9301edff81 100644 --- a/admin-dev/themes/new-theme/js/pages/feature/feature-value/form.ts +++ b/admin-dev/themes/new-theme/js/pages/feature/feature-value/form.ts @@ -23,8 +23,10 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '@components/translatable-input'; - $(() => { - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/feature/feature-value/index.ts b/admin-dev/themes/new-theme/js/pages/feature/feature-value/index.ts index 71b6a9cc065e6..9d2293c35605b 100644 --- a/admin-dev/themes/new-theme/js/pages/feature/feature-value/index.ts +++ b/admin-dev/themes/new-theme/js/pages/feature/feature-value/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const grid = new window.prestashop.component.Grid('feature_value'); diff --git a/admin-dev/themes/new-theme/js/pages/feature/form.ts b/admin-dev/themes/new-theme/js/pages/feature/form.ts index 92de0614854b7..9af48316f38c9 100644 --- a/admin-dev/themes/new-theme/js/pages/feature/form.ts +++ b/admin-dev/themes/new-theme/js/pages/feature/form.ts @@ -23,10 +23,11 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '../../components/translatable-input'; -import ChoiceTree from '../../components/form/choice-tree'; - $(() => { - new TranslatableInput(); - new ChoiceTree('#feature_shop_association').enableAutoCheckChildren(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); + new window.prestashop.component.ChoiceTree('#feature_shop_association').enableAutoCheckChildren(); }); diff --git a/admin-dev/themes/new-theme/js/pages/invoices/index.ts b/admin-dev/themes/new-theme/js/pages/invoices/index.ts index eca690c354076..8c7001da19add 100644 --- a/admin-dev/themes/new-theme/js/pages/invoices/index.ts +++ b/admin-dev/themes/new-theme/js/pages/invoices/index.ts @@ -24,17 +24,16 @@ */ import initDatePickers from '@app/utils/datepicker'; -import TranslatableInput from '@components/translatable-input'; const {$} = window; $(() => { initDatePickers(); - new TranslatableInput(); window.prestashop.component.initComponents( [ 'MultistoreConfigField', + 'TranslatableInput', ], ); }); diff --git a/admin-dev/themes/new-theme/js/pages/language/index.ts b/admin-dev/themes/new-theme/js/pages/language/index.ts index 16ac54bae5db6..06ddd62110ad4 100644 --- a/admin-dev/themes/new-theme/js/pages/language/index.ts +++ b/admin-dev/themes/new-theme/js/pages/language/index.ts @@ -23,10 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import ChoiceTree from '@components/form/choice-tree'; - -const {$} = window; - $(() => { const grid = new window.prestashop.component.Grid('language'); @@ -42,5 +38,5 @@ $(() => { grid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension()); // needed for shop association input in form - new ChoiceTree('#language_shop_association').enableAutoCheckChildren(); + new window.prestashop.component.ChoiceTree('#language_shop_association').enableAutoCheckChildren(); }); diff --git a/admin-dev/themes/new-theme/js/pages/logs/index.ts b/admin-dev/themes/new-theme/js/pages/logs/index.ts index c092e5f92987f..36046db9c5a0c 100644 --- a/admin-dev/themes/new-theme/js/pages/logs/index.ts +++ b/admin-dev/themes/new-theme/js/pages/logs/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const grid = new window.prestashop.component.Grid('logs'); diff --git a/admin-dev/themes/new-theme/js/pages/manufacturer/index.ts b/admin-dev/themes/new-theme/js/pages/manufacturer/index.ts index ce87331589f0b..c84b26bf62bd5 100644 --- a/admin-dev/themes/new-theme/js/pages/manufacturer/index.ts +++ b/admin-dev/themes/new-theme/js/pages/manufacturer/index.ts @@ -29,7 +29,7 @@ const {$} = window; $(() => { ['manufacturer', 'manufacturer_address'].forEach((gridName) => { - const grid = new Grid(gridName); + const grid = new window.prestashop.component.Grid(gridName); grid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension()); grid.addExtension(new window.prestashop.component.GridExtensions.ReloadListExtension()); grid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension()); diff --git a/admin-dev/themes/new-theme/js/pages/merchandise-return/index.ts b/admin-dev/themes/new-theme/js/pages/merchandise-return/index.ts index 7949426106f55..53c35b229afe3 100644 --- a/admin-dev/themes/new-theme/js/pages/merchandise-return/index.ts +++ b/admin-dev/themes/new-theme/js/pages/merchandise-return/index.ts @@ -23,14 +23,11 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '../../components/translatable-input'; - -const {$} = window; - $(() => { window.prestashop.component.initComponents( [ 'MultistoreConfigField', + 'TranslatableInput', ], ); @@ -38,6 +35,4 @@ $(() => { grid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension()); grid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension()); grid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension()); - - new TranslatableInput(); }); diff --git a/admin-dev/themes/new-theme/js/pages/meta/index.ts b/admin-dev/themes/new-theme/js/pages/meta/index.ts index 24ffd8f2b064a..a2f598e700e9a 100644 --- a/admin-dev/themes/new-theme/js/pages/meta/index.ts +++ b/admin-dev/themes/new-theme/js/pages/meta/index.ts @@ -25,8 +25,6 @@ import ShowcaseCard from '@components/showcase-card/showcase-card'; import ShowcaseCardCloseExtension from '@components/showcase-card/extension/showcase-card-close-extension'; -import TaggableField from '@components/taggable-field'; -import TranslatableInput from '@components/translatable-input'; import MetaPageNameOptionHandler from '@pages/meta/meta-page-name-option-handler'; import TextWithRecommendedLengthCounter from '@components/form/text-with-recommended-length-counter'; @@ -48,19 +46,19 @@ $(() => { const helperBlock = new ShowcaseCard('seo-urls-showcase-card'); helperBlock.addExtension(new ShowcaseCardCloseExtension()); - new TaggableField({ + new window.prestashop.component.TaggableField({ tokenFieldSelector: 'input.js-taggable-field', options: { createTokensOnBlur: true, }, }); - new TranslatableInput(); new MetaPageNameOptionHandler(); window.prestashop.component.initComponents( [ 'MultistoreConfigField', + 'TranslatableInput', ], ); diff --git a/admin-dev/themes/new-theme/js/pages/monitoring/index.ts b/admin-dev/themes/new-theme/js/pages/monitoring/index.ts index 15d183c0ac9e5..8630047c762c9 100644 --- a/admin-dev/themes/new-theme/js/pages/monitoring/index.ts +++ b/admin-dev/themes/new-theme/js/pages/monitoring/index.ts @@ -50,7 +50,7 @@ $(() => { 'product_without_description', 'product_without_price', ].forEach((gridName) => { - const grid = new Grid(gridName); + const grid = new window.prestashop.component.Grid(gridName); grid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension()); grid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension()); diff --git a/admin-dev/themes/new-theme/js/pages/order-return-states/form.ts b/admin-dev/themes/new-theme/js/pages/order-return-states/form.ts index 718cd47b92c48..677495e5badec 100644 --- a/admin-dev/themes/new-theme/js/pages/order-return-states/form.ts +++ b/admin-dev/themes/new-theme/js/pages/order-return-states/form.ts @@ -24,11 +24,14 @@ */ import initColorPickers from '@app/utils/colorpicker'; -import TranslatableInput from '@components/translatable-input'; const {$} = window; $(() => { initColorPickers(); - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/order-states/form.ts b/admin-dev/themes/new-theme/js/pages/order-states/form.ts index 1655c95066753..8883ea2886653 100644 --- a/admin-dev/themes/new-theme/js/pages/order-states/form.ts +++ b/admin-dev/themes/new-theme/js/pages/order-states/form.ts @@ -25,14 +25,17 @@ import initColorPickers from '@app/utils/colorpicker'; import TranslatableChoice from '@components/form/translatable-choice'; -import TranslatableInput from '@components/translatable-input'; import FormMap from '@pages/order-states/form-map'; const {$} = window; $(() => { initColorPickers(); - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); new TranslatableChoice(); let templatePreviewWindow: null | Record = null; diff --git a/admin-dev/themes/new-theme/js/pages/order-states/index.ts b/admin-dev/themes/new-theme/js/pages/order-states/index.ts index fb359ea3ee17e..a7412af48f942 100644 --- a/admin-dev/themes/new-theme/js/pages/order-states/index.ts +++ b/admin-dev/themes/new-theme/js/pages/order-states/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const orderStatesGrid = new window.prestashop.component.Grid('order_states'); diff --git a/admin-dev/themes/new-theme/js/pages/order/delivery/index.ts b/admin-dev/themes/new-theme/js/pages/order/delivery/index.ts index d65ccdab10f63..14e9301edff81 100644 --- a/admin-dev/themes/new-theme/js/pages/order/delivery/index.ts +++ b/admin-dev/themes/new-theme/js/pages/order/delivery/index.ts @@ -23,10 +23,10 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '@components/translatable-input'; - -const {$} = window; - $(() => { - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/order_message/form.ts b/admin-dev/themes/new-theme/js/pages/order_message/form.ts index ea1ff3d39faef..14e9301edff81 100644 --- a/admin-dev/themes/new-theme/js/pages/order_message/form.ts +++ b/admin-dev/themes/new-theme/js/pages/order_message/form.ts @@ -22,10 +22,11 @@ * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '@components/translatable-input'; - -const {$} = window; $(() => { - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/order_message/index.ts b/admin-dev/themes/new-theme/js/pages/order_message/index.ts index a9ab1155f3f34..5689884ac8e3b 100644 --- a/admin-dev/themes/new-theme/js/pages/order_message/index.ts +++ b/admin-dev/themes/new-theme/js/pages/order_message/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const orderMessageGrid = new window.prestashop.component.Grid('order_message'); diff --git a/admin-dev/themes/new-theme/js/pages/outstanding/index.ts b/admin-dev/themes/new-theme/js/pages/outstanding/index.ts index 7de022a09630e..0da304dda836e 100644 --- a/admin-dev/themes/new-theme/js/pages/outstanding/index.ts +++ b/admin-dev/themes/new-theme/js/pages/outstanding/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const outstandingGrid = new window.prestashop.component.Grid('outstanding'); outstandingGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension()); diff --git a/admin-dev/themes/new-theme/js/pages/product-preferences/index.ts b/admin-dev/themes/new-theme/js/pages/product-preferences/index.ts index 93942315312a1..34ab1da3a4324 100644 --- a/admin-dev/themes/new-theme/js/pages/product-preferences/index.ts +++ b/admin-dev/themes/new-theme/js/pages/product-preferences/index.ts @@ -23,7 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '@components/translatable-input'; import StockManagementOptionHandler from '@pages/product-preferences/stock-management-option-handler'; import CatalogModeOptionHandler from '@pages/product-preferences/catalog-mode-option-handler'; import * as pageMap from '@pages/product-preferences/product-preferences-page-map'; @@ -31,7 +30,11 @@ import * as pageMap from '@pages/product-preferences/product-preferences-page-ma const {$} = window; $(() => { - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); new StockManagementOptionHandler(); new CatalogModeOptionHandler(pageMap); }); diff --git a/admin-dev/themes/new-theme/js/pages/product/edit/manager/product-seo-manager.ts b/admin-dev/themes/new-theme/js/pages/product/edit/manager/product-seo-manager.ts index 09b0d92ad1e99..ebcb08a4e170c 100644 --- a/admin-dev/themes/new-theme/js/pages/product/edit/manager/product-seo-manager.ts +++ b/admin-dev/themes/new-theme/js/pages/product/edit/manager/product-seo-manager.ts @@ -26,7 +26,6 @@ import Serp from '@app/utils/serp'; import {EventEmitter} from 'events'; import RedirectOptionManager from '@pages/product/edit/manager/redirect-option-manager'; import ProductMap from '@pages/product/product-map'; -import TaggableField from '@components/taggable-field'; import TranslatableInput from '@components/translatable-input'; const {$} = window; @@ -80,7 +79,7 @@ export default class ProductSEOManager { previewUrl, ); - new TaggableField({ + new window.prestashop.component.TaggableField({ tokenFieldSelector: ProductMap.seo.tagFields, options: { createTokensOnBlur: true, diff --git a/admin-dev/themes/new-theme/js/pages/profiles/ProfilesPage.ts b/admin-dev/themes/new-theme/js/pages/profiles/ProfilesPage.ts index bcb6b4d431bce..a9c5e44361cd7 100644 --- a/admin-dev/themes/new-theme/js/pages/profiles/ProfilesPage.ts +++ b/admin-dev/themes/new-theme/js/pages/profiles/ProfilesPage.ts @@ -23,8 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '@components/translatable-input'; - /** * Responsible for actions in Profiles listing page. */ @@ -43,6 +41,10 @@ export default class ProfilesPage { profilesGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension()); profilesGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension()); - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); } } diff --git a/admin-dev/themes/new-theme/js/pages/search-engine/index.ts b/admin-dev/themes/new-theme/js/pages/search-engine/index.ts index 4dc9e41ef8e2a..cdffafd305992 100644 --- a/admin-dev/themes/new-theme/js/pages/search-engine/index.ts +++ b/admin-dev/themes/new-theme/js/pages/search-engine/index.ts @@ -23,8 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -const {$} = window; - $(() => { const searchEngineGrid = new window.prestashop.component.Grid('search_engine'); diff --git a/admin-dev/themes/new-theme/js/pages/search/index.ts b/admin-dev/themes/new-theme/js/pages/search/index.ts index a5bffe63245be..a12107e992b0f 100644 --- a/admin-dev/themes/new-theme/js/pages/search/index.ts +++ b/admin-dev/themes/new-theme/js/pages/search/index.ts @@ -23,10 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '@components/translatable-input'; - -const {$} = window; - /** * Responsible for actions in admin search listing page to list aliases. */ @@ -44,5 +40,9 @@ $(() => { aliasGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension()); aliasGrid.addExtension(new window.prestashop.component.GridExtensions.ColumnTogglingExtension()); - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/sql-manager/index.ts b/admin-dev/themes/new-theme/js/pages/sql-manager/index.ts index 3686222ff4e24..d1cbd1090f8ba 100644 --- a/admin-dev/themes/new-theme/js/pages/sql-manager/index.ts +++ b/admin-dev/themes/new-theme/js/pages/sql-manager/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - class SqlManagerPage { constructor() { const requestSqlGrid = new window.prestashop.component.Grid('sql_request'); diff --git a/admin-dev/themes/new-theme/js/pages/state/index.ts b/admin-dev/themes/new-theme/js/pages/state/index.ts index 7b3d85d90de41..544328937ad39 100644 --- a/admin-dev/themes/new-theme/js/pages/state/index.ts +++ b/admin-dev/themes/new-theme/js/pages/state/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - class StatePage { constructor() { const stateGrid = new window.prestashop.component.Grid('state'); diff --git a/admin-dev/themes/new-theme/js/pages/store/index.ts b/admin-dev/themes/new-theme/js/pages/store/index.ts index cfeac240438e1..863db2e00e46c 100644 --- a/admin-dev/themes/new-theme/js/pages/store/index.ts +++ b/admin-dev/themes/new-theme/js/pages/store/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const grid = new window.prestashop.component.Grid('store'); diff --git a/admin-dev/themes/new-theme/js/pages/supplier/index.ts b/admin-dev/themes/new-theme/js/pages/supplier/index.ts index 42c2082a9b437..36521a2ee9456 100644 --- a/admin-dev/themes/new-theme/js/pages/supplier/index.ts +++ b/admin-dev/themes/new-theme/js/pages/supplier/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const supplierGrid = new window.prestashop.component.Grid('supplier'); supplierGrid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension()); diff --git a/admin-dev/themes/new-theme/js/pages/tax/index.ts b/admin-dev/themes/new-theme/js/pages/tax/index.ts index 4c6fe950822f3..0c5e6ac842f77 100644 --- a/admin-dev/themes/new-theme/js/pages/tax/index.ts +++ b/admin-dev/themes/new-theme/js/pages/tax/index.ts @@ -24,7 +24,6 @@ */ import TaxMap from '@pages/tax/tax-map'; -import TranslatableInput from '@components/translatable-input'; import DisplayInCartOptionHandler from '@pages/tax/display-in-cart-option-handler'; const {$} = window; @@ -44,11 +43,11 @@ $(() => { taxGrid.addExtension(new window.prestashop.component.GridExtensions.LinkRowActionExtension()); new DisplayInCartOptionHandler(); - new TranslatableInput(); window.prestashop.component.initComponents( [ 'MultistoreConfigField', + 'TranslatableInput', ], ); diff --git a/admin-dev/themes/new-theme/js/pages/title/form.ts b/admin-dev/themes/new-theme/js/pages/title/form.ts index 2e36830fa28e2..14e9301edff81 100644 --- a/admin-dev/themes/new-theme/js/pages/title/form.ts +++ b/admin-dev/themes/new-theme/js/pages/title/form.ts @@ -23,8 +23,10 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import TranslatableInput from '@components/translatable-input'; - $(() => { - new TranslatableInput(); + window.prestashop.component.initComponents( + [ + 'TranslatableInput', + ], + ); }); diff --git a/admin-dev/themes/new-theme/js/pages/title/index.ts b/admin-dev/themes/new-theme/js/pages/title/index.ts index 27c5dbf3c02c2..d4f39ff23a592 100644 --- a/admin-dev/themes/new-theme/js/pages/title/index.ts +++ b/admin-dev/themes/new-theme/js/pages/title/index.ts @@ -23,9 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ - -const {$} = window; - $(() => { const title = new window.prestashop.component.Grid('title'); diff --git a/admin-dev/themes/new-theme/js/pages/zone/index.ts b/admin-dev/themes/new-theme/js/pages/zone/index.ts index e05205afaf753..9b84c49e97f9b 100644 --- a/admin-dev/themes/new-theme/js/pages/zone/index.ts +++ b/admin-dev/themes/new-theme/js/pages/zone/index.ts @@ -23,10 +23,6 @@ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -import ChoiceTree from '@components/form/choice-tree'; - -const {$} = window; - $(() => { const grid = new window.prestashop.component.Grid('zone'); @@ -43,5 +39,5 @@ $(() => { grid.addExtension(new window.prestashop.component.GridExtensions.ColumnTogglingExtension()); grid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension()); - new ChoiceTree('#zone_shop_association').enableAutoCheckChildren(); + new window.prestashop.component.ChoiceTree('#zone_shop_association').enableAutoCheckChildren(); });