From 2118c6b8b3096fc4c0efbe189b2cbdaf82f55dbd Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Thu, 2 May 2024 12:46:42 +0000 Subject: [PATCH] build: building a new version --- .gitignore | 10 - README.md | 214 --- assets/scripts/admin/menus/.gitkeep | 0 assets/scripts/admin/menus/settings/index.js | 239 ---- assets/scripts/admin/menus/settings/table.js | 46 - assets/scripts/components/.gitkeep | 0 assets/scripts/theme/pages/.gitkeep | 0 assets/scripts/theme/pages/checkout/index.js | 1 - assets/styles/app.scss | 9 - composer.json | 36 - dist/scripts/admin/menus/settings/index.js | 2 + .../scripts/admin/menus/settings/index.js.map | 1 + dist/scripts/admin/menus/settings/table.js | 2 + .../scripts/admin/menus/settings/table.js.map | 1 + dist/scripts/theme/pages/checkout/index.js | 2 + .../scripts/theme/pages/checkout/index.js.map | 1 + dist/styles/app.css | 1149 +++++++++++++++++ package.json | 32 - tailwind.config.js | 13 - vendor/autoload.php | 25 + vendor/composer/ClassLoader.php | 579 +++++++++ vendor/composer/InstalledVersions.php | 359 +++++ vendor/composer/LICENSE | 21 + vendor/composer/autoload_classmap.php | 10 + vendor/composer/autoload_files.php | 10 + vendor/composer/autoload_namespaces.php | 9 + vendor/composer/autoload_psr4.php | 10 + vendor/composer/autoload_real.php | 48 + vendor/composer/autoload_static.php | 40 + vendor/composer/installed.json | 5 + vendor/composer/installed.php | 23 + 31 files changed, 2297 insertions(+), 600 deletions(-) delete mode 100644 .gitignore delete mode 100644 README.md delete mode 100644 assets/scripts/admin/menus/.gitkeep delete mode 100644 assets/scripts/admin/menus/settings/index.js delete mode 100644 assets/scripts/admin/menus/settings/table.js delete mode 100644 assets/scripts/components/.gitkeep delete mode 100644 assets/scripts/theme/pages/.gitkeep delete mode 100644 assets/scripts/theme/pages/checkout/index.js delete mode 100644 assets/styles/app.scss delete mode 100644 composer.json create mode 100644 dist/scripts/admin/menus/settings/index.js create mode 100644 dist/scripts/admin/menus/settings/index.js.map create mode 100644 dist/scripts/admin/menus/settings/table.js create mode 100644 dist/scripts/admin/menus/settings/table.js.map create mode 100644 dist/scripts/theme/pages/checkout/index.js create mode 100644 dist/scripts/theme/pages/checkout/index.js.map create mode 100644 dist/styles/app.css delete mode 100644 package.json delete mode 100644 tailwind.config.js create mode 100644 vendor/autoload.php create mode 100644 vendor/composer/ClassLoader.php create mode 100644 vendor/composer/InstalledVersions.php create mode 100644 vendor/composer/LICENSE create mode 100644 vendor/composer/autoload_classmap.php create mode 100644 vendor/composer/autoload_files.php create mode 100644 vendor/composer/autoload_namespaces.php create mode 100644 vendor/composer/autoload_psr4.php create mode 100644 vendor/composer/autoload_real.php create mode 100644 vendor/composer/autoload_static.php create mode 100644 vendor/composer/installed.json create mode 100644 vendor/composer/installed.php diff --git a/.gitignore b/.gitignore deleted file mode 100644 index ffdd7f95..00000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# ignore folders -vendor/ -dist/ -node_modules/ -.cache/ -.parcel-cache/ -.idea/ - -# ignore files -*.lock diff --git a/README.md b/README.md deleted file mode 100644 index c11489a8..00000000 --- a/README.md +++ /dev/null @@ -1,214 +0,0 @@ -# WC Payment Links - -**Description:** Payment links for WooCommerce - -## Anchors -- [Install dependencies](#install) -- [Build dependencies](#build) -- [Ignored folders and files](#ignore) -- [REST API](#api) -- [File Tree](#tree) - - - -

Installing the dependencies

- -**Install the plugin autoload and dependencies with the composer** -``` -composer install -``` - -**Install the node dependencies with the yarn or npm** -``` -yarn install -npm install -``` - -

Build dependencies

- -**Build production and watch the resource page changes** -``` -yarn watch -``` - -**Build production assets** -``` -yarn build -``` - -

Ignored folders and files

- -**Folders** -- vendor/ -- dist/ -- node_modules/ -- .cache/ -- .parcel-cache/ -- .idea/ - -**Files** -- *.lock - - -

REST API

- -### AUTHORIZATION -Use Basic Authentication para se autenticar e utilizar a REST API do plugin WC Payment Links; -
-Example: -```PHP -base64_encode(USER:PASSWORD) -``` -### GET -#### Endpoint: -``` -https://{domain}/wp-json/wc-payment-link/links/?{id} -``` - -Use the endpoint above to make a get request and search for the links registered on your website. You can also use the link ID as a parameter to search for a specific ID. - -If necessary, it is possible to provide more information in the body of the request: -```JSON -{ - "page": 1, - "per_page": 10, - "order":"ASC", - "order_by": "name" -} -``` - -### POST -#### Endpoint: -``` -https://{domain}/wp-json/wc-payment-link/links/ -``` -Use o método POST para cadastrar novos links usando a REST API. Você vai precisar enviar os dados do link través do corpo da requisição: -```JSON -{ - "name": "New Link", - "token": "3b356f26-6ea8-47ba-8649-d76c89e498be", - "coupon": "coupon-code", - "expire_at": "2024-02-22 00:00:00", - "products": [ - { - "product": 43, - "quantity": 4 - } - ] -} -``` - -### PUT -#### Endpoint: -``` -https://{domain}/wp-json/wc-payment-link/links/{id} -``` -Use o método PUT para atualizar os links já cadastrados usando a REST API. Você vai precisar adiocioar o ID do link como parâmetro de URL e enviar os dados do link través do corpo da requisição: -```JSON -{ - "name": "New Link 02", - "token": "3b356f26-6ea8-47ba-8649-d76c89e498be", - "coupon": "coupon-code", - "expire_at": "2024-02-22 00:00:00", - "products": [ - { - "product": 43, - "quantity": 4 - } - ] -} -``` - -### DELETE -#### Endpoint: -``` -https://{domain}/wp-json/wc-payment-link/links/{id} -``` -Use the DELETE method passing the id of the link you want to remove using the REST API. - -

File Tree

- -``` -. -├── LICENSE -├── README.md -├── app -│   ├── API -│   │   ├── Routes -│   │   │   ├── Links.php -│   │   │   └── Route.php -│   │   └── Routes.php -│   ├── Controllers -│   │   ├── Menus -│   │   │   └── Links.php -│   │   ├── Menus.php -│   │   ├── Pages -│   │   │   └── PaymentLink.php -│   │   └── Render -│   │   ├── AbstractRender.php -│   │   └── InterfaceRender.php -│   ├── Core -│   │   ├── Boot.php -│   │   ├── Config.php -│   │   ├── Export.php -│   │   ├── Functions.php -│   │   ├── Uninstall.php -│   │   └── Utils.php -│   ├── Exceptions -│   │   ├── ExpiredTokenException.php -│   │   └── InvalidTokenException.php -│   ├── Helpers -│   │   └── Helper.php -│   ├── Infrastructure -│   │   ├── Bootstrap.php -│   │   ├── Model.php -│   │   └── Repository.php -│   ├── Model -│   │   ├── LinkModel.php -│   │   └── ProductModel.php -│   ├── Repository -│   │   ├── LinkRepository.php -│   │   └── ProductRepository.php -│   ├── Services -│   │   └── WooCommerce -│   │   ├── Checkout -│   │   ├── Logs -│   │   │   └── Logger.php -│   │   ├── Orders -│   │   ├── Thankyou -│   │   ├── Webhooks -│   │   ├── Webhooks.php -│   │   └── WooCommerce.php -│   └── Views -│   ├── Admin -│   │   └── menus -│   │   └── settings -│   │   ├── index.php -│   │   └── modal.php -│   ├── Pages -│   │   └── checkout -│   │   └── index.php -│   └── WooCommerce -├── assets -│   ├── images -│   │   └── icons -│   ├── scripts -│   │   ├── admin -│   │   │   └── menus -│   │   │   └── settings -│   │   │   ├── index.js -│   │   │   └── table.js -│   │   ├── components -│   │   └── theme -│   │   └── pages -│   │   └── checkout -│   │   └── index.js -│   └── styles -│   └── app.css -├── composer.json -├── package.json -├── readme.txt -├── tailwind.config.js -└── wc-payment-link.php -``` - diff --git a/assets/scripts/admin/menus/.gitkeep b/assets/scripts/admin/menus/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/assets/scripts/admin/menus/settings/index.js b/assets/scripts/admin/menus/settings/index.js deleted file mode 100644 index 8be0dd0a..00000000 --- a/assets/scripts/admin/menus/settings/index.js +++ /dev/null @@ -1,239 +0,0 @@ -import {v4 as uuidv4} from 'uuid'; -import Table from './table.js'; -class Settings -{ - constructor() { - this.addPaymentLink(); - this.editPaymentLink(); - this.copyLink(); - this.handlerToken(); - this.handleModalProducts(); - - new Table(); - } - - handlerToken() { - const button = document.querySelector('#generate-token'); - - if (button) { - button.addEventListener('click', () => { - this.generateToken(); - }); - } - } - - generateToken() { - const token = document.querySelector('#token'); - - if (token) { - token.value = uuidv4(); - } - } - - copyLink() { - const elements = document.querySelectorAll('.copy-element'); - - elements.forEach((element) => { - element.addEventListener('click', () => { - const text = element.getAttribute('data-copy'); - - if (navigator?.clipboard?.writeText) { - navigator.clipboard.writeText(text); - } - }) - }); - } - - addPaymentLink() { - const button = document.querySelector('#add-payment-link'); - button.addEventListener('click', () => { - this.openModal(); - this.generateToken(); - }); - } - - editPaymentLink() { - const anchors = document.querySelectorAll('.open-link-form'); - const close = document.querySelector('#close-link-form'); - - anchors.forEach((anchor) => { - anchor.addEventListener('click', () => { - this.openModal(); - this.fillModalFields(anchor.getAttribute('data-link')); - }); - }); - - close.addEventListener('click', () => { - this.closeModal(); - }); - } - - openModal() { - const modal = document.querySelector('#link-form'); - - this.clearModal(modal); - this.clearModalProducts(); - - modal.classList.remove('hidden'); - } - - closeModal() { - const modal = document.querySelector('#link-form'); - - this.clearModal(modal); - this.clearModalProducts(); - modal.classList.add('hidden'); - } - - clearModal(modal) { - if (!modal) return; - - const fields = [ - 'name', - 'token', - 'expire_at', - 'expire_hour', - 'coupon', - 'link_id', - 'hidden_link_id', - 'link_url' - ]; - - fields.forEach((field) => { - const element = modal.querySelector(`#${field}`); - - switch (field) { - case 'link_id': - element.innerText = ''; - break; - case 'link_url': - element.removeAttribute('href'); - element.classList.add('hidden') - break; - default: - if (element) element.value = ''; - break; - } - }); - - ['product-checkbox','product-number'].forEach((field) => { - const elements = modal.querySelectorAll(`.${field}`); - elements.forEach((element) => { - element.value = ''; - - if (field === 'product-checkbox') { - element.checked = false; - } - }); - }) - } - - fillModalFields(fields) { - const object = JSON.parse(fields); - if (object) { - for (const key in object) { - const element = document.querySelector(`#${key}`); - - switch (key) { - case 'products': - this.fillModalProducts(object[key]); - break; - case 'link_id': - element.innerText = `#${object[key]}`; - document.querySelector(`#hidden_${key}`).value = object[key]; - break; - case 'link_url': - element.setAttribute('href', object[key]); - element.classList.remove('hidden') - break; - default: - if (element) element.value = object[key]; - break; - - } - } - } - } - - fillModalProducts(products) { - const productList = document.querySelector('#product-list'); - - if (productList) { - productList.value = JSON.stringify(products); - } - - products.forEach(product => { - const productsElements = document.querySelectorAll('.modal-product'); - productsElements.forEach(element => { - const checkbox = element.querySelector('.product-checkbox'); - const number = element.querySelector('.product-number'); - - if (parseInt(checkbox.getAttribute('data-id')) === product.product) { - checkbox.checked = true; - number.value = product.quantity - } - }); - }); - } - - clearModalProducts() { - const productList = document.querySelector('#product-list'); - if (productList) { - productList.value = ''; - } - } - - handleModalProducts() { - - const checkboxes = document.querySelectorAll('.product-checkbox'); - const numbers = document.querySelectorAll('.product-number'); - - [checkboxes, numbers].forEach((elements) => { - elements.forEach((element) => { - element.addEventListener('change', () => { - this.updateModalProducts(); - }); - }); - }) - - } - - updateModalProducts() { - const products = document.querySelectorAll('.modal-product'); - const list = []; - - products.forEach((product) => { - const checkbox = product.querySelector('.product-checkbox'); - const number = product.querySelector('.product-number'); - - if (checkbox?.checked) { - if (!number.value) number.value = 1; - - list.push({ - product: checkbox.getAttribute('data-id'), - quantity: number.value ? number.value : 0 - }); - - } else { - number.value = ''; - } - - checkbox.addEventListener("change", () => { - if (!checkbox.checked) { - number.value = ''; - } - }); - }) - - const productList = document.querySelector('#product-list'); - if (productList) { - productList.value = JSON.stringify(list); - } - - } - -} - -document.addEventListener('DOMContentLoaded', () => { - new Settings(); -}); diff --git a/assets/scripts/admin/menus/settings/table.js b/assets/scripts/admin/menus/settings/table.js deleted file mode 100644 index 0a26d58a..00000000 --- a/assets/scripts/admin/menus/settings/table.js +++ /dev/null @@ -1,46 +0,0 @@ -export default class Table -{ - constructor() { - this.orderTable(); - this.paginationTable(); - } - - orderTable() { - const ancors = document.querySelectorAll('.order-table'); - const urlParams = new URLSearchParams(window.location.search); - let sortOrder = urlParams.get('order') || 'DESC'; - - ancors.forEach((ancor) => { - const value = ancor.getAttribute('data-order'); - if (value) { - ancor.addEventListener('click', () => { - sortOrder = sortOrder === 'ASC' ? 'DESC' : 'ASC'; - this.queryURL([{"key": "orderby", "value": value}, {"key": "order", "value": sortOrder}]); - }) - } - }) - } - paginationTable() { - const ancors = document.querySelectorAll('.pagination'); - - ancors.forEach((ancor) => { - const value = ancor.getAttribute('data-page'); - if (value) { - ancor.addEventListener('click', () => { - this.queryURL([{"key": "table-page", "value": value}]); - }) - } - }) - } - - queryURL(paramsArray) { - const urlParams = new URLSearchParams(window.location.search); - - paramsArray.forEach(({ key, value }) => { - urlParams.delete(key); - urlParams.append(key, value); - }); - - window.location.replace(`${location.origin + location.pathname}?${urlParams.toString()}`); - } -} diff --git a/assets/scripts/components/.gitkeep b/assets/scripts/components/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/assets/scripts/theme/pages/.gitkeep b/assets/scripts/theme/pages/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/assets/scripts/theme/pages/checkout/index.js b/assets/scripts/theme/pages/checkout/index.js deleted file mode 100644 index adaeba36..00000000 --- a/assets/scripts/theme/pages/checkout/index.js +++ /dev/null @@ -1 +0,0 @@ -console.log('a') diff --git a/assets/styles/app.scss b/assets/styles/app.scss deleted file mode 100644 index a808cc40..00000000 --- a/assets/styles/app.scss +++ /dev/null @@ -1,9 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -.wpl-wrap .notice { - display: none; -} - -@import '~@fortawesome/fontawesome-free/css/all.css'; \ No newline at end of file diff --git a/composer.json b/composer.json deleted file mode 100644 index f40f9a5e..00000000 --- a/composer.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "devaguia/wc-payment-link", - "version": "1.0.3", - "description": "Payment links for WooCommerce", - "type": "wordpress-plugin", - "license": "GPL-3.0", - "support": { - "issues": "https://github.com/devaguia/wc-payment-link/issues", - "source": "https://github.com/devaguia/wc-payment-link" - }, - "keywords": [ - "wordpress", - "plugin", - "template", - "woocommerce" - ], - "authors": [ - { - "name": "Matheus Aguiar", - "email": "aguiartgv@gmail.com" - } - ], - "autoload": { - "psr-4": { - "WCPaymentLink\\": "app/" - }, - "files": [ - "app/Helpers/Helper.php" - ] - }, - "config": { - "allow-plugins": { - "pestphp/pest-plugin": true - } - } - } diff --git a/dist/scripts/admin/menus/settings/index.js b/dist/scripts/admin/menus/settings/index.js new file mode 100644 index 00000000..ba0939c6 --- /dev/null +++ b/dist/scripts/admin/menus/settings/index.js @@ -0,0 +1,2 @@ +(()=>{let e;var t={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let r=new Uint8Array(16),o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));var l=function(l,a,c){if(t.randomUUID&&!a&&!l)return t.randomUUID();let d=(l=l||{}).random||(l.rng||function(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(r)})();if(d[6]=15&d[6]|64,d[8]=63&d[8]|128,a){c=c||0;for(let e=0;e<16;++e)a[c+e]=d[e];return a}return function(e,t=0){return o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]}(d)};class a{constructor(){this.orderTable(),this.paginationTable()}orderTable(){let e=document.querySelectorAll(".order-table"),t=new URLSearchParams(window.location.search).get("order")||"DESC";e.forEach(e=>{let r=e.getAttribute("data-order");r&&e.addEventListener("click",()=>{t="ASC"===t?"DESC":"ASC",this.queryURL([{key:"orderby",value:r},{key:"order",value:t}])})})}paginationTable(){document.querySelectorAll(".pagination").forEach(e=>{let t=e.getAttribute("data-page");t&&e.addEventListener("click",()=>{this.queryURL([{key:"table-page",value:t}])})})}queryURL(e){let t=new URLSearchParams(window.location.search);e.forEach(({key:e,value:r})=>{t.delete(e),t.append(e,r)}),window.location.replace(`${location.origin+location.pathname}?${t.toString()}`)}}class c{constructor(){this.addPaymentLink(),this.editPaymentLink(),this.copyLink(),this.handlerToken(),this.handleModalProducts(),new a}handlerToken(){let e=document.querySelector("#generate-token");e&&e.addEventListener("click",()=>{this.generateToken()})}generateToken(){let e=document.querySelector("#token");e&&(e.value=l())}copyLink(){document.querySelectorAll(".copy-element").forEach(e=>{e.addEventListener("click",()=>{let t=e.getAttribute("data-copy");navigator?.clipboard?.writeText&&navigator.clipboard.writeText(t)})})}addPaymentLink(){document.querySelector("#add-payment-link").addEventListener("click",()=>{this.openModal(),this.generateToken()})}editPaymentLink(){let e=document.querySelectorAll(".open-link-form"),t=document.querySelector("#close-link-form");e.forEach(e=>{e.addEventListener("click",()=>{this.openModal(),this.fillModalFields(e.getAttribute("data-link"))})}),t.addEventListener("click",()=>{this.closeModal()})}openModal(){let e=document.querySelector("#link-form");this.clearModal(e),this.clearModalProducts(),e.classList.remove("hidden")}closeModal(){let e=document.querySelector("#link-form");this.clearModal(e),this.clearModalProducts(),e.classList.add("hidden")}clearModal(e){e&&(["name","token","expire_at","expire_hour","coupon","link_id","hidden_link_id","link_url"].forEach(t=>{let r=e.querySelector(`#${t}`);switch(t){case"link_id":r.innerText="";break;case"link_url":r.removeAttribute("href"),r.classList.add("hidden");break;default:r&&(r.value="")}}),["product-checkbox","product-number"].forEach(t=>{e.querySelectorAll(`.${t}`).forEach(e=>{e.value="","product-checkbox"===t&&(e.checked=!1)})}))}fillModalFields(e){let t=JSON.parse(e);if(t)for(let e in t){let r=document.querySelector(`#${e}`);switch(e){case"products":this.fillModalProducts(t[e]);break;case"link_id":r.innerText=`#${t[e]}`,document.querySelector(`#hidden_${e}`).value=t[e];break;case"link_url":r.setAttribute("href",t[e]),r.classList.remove("hidden");break;default:r&&(r.value=t[e])}}}fillModalProducts(e){let t=document.querySelector("#product-list");t&&(t.value=JSON.stringify(e)),e.forEach(e=>{document.querySelectorAll(".modal-product").forEach(t=>{let r=t.querySelector(".product-checkbox"),o=t.querySelector(".product-number");parseInt(r.getAttribute("data-id"))===e.product&&(r.checked=!0,o.value=e.quantity)})})}clearModalProducts(){let e=document.querySelector("#product-list");e&&(e.value="")}handleModalProducts(){[document.querySelectorAll(".product-checkbox"),document.querySelectorAll(".product-number")].forEach(e=>{e.forEach(e=>{e.addEventListener("change",()=>{this.updateModalProducts()})})})}updateModalProducts(){let e=document.querySelectorAll(".modal-product"),t=[];e.forEach(e=>{let r=e.querySelector(".product-checkbox"),o=e.querySelector(".product-number");r?.checked?(o.value||(o.value=1),t.push({product:r.getAttribute("data-id"),quantity:o.value?o.value:0})):o.value="",r.addEventListener("change",()=>{r.checked||(o.value="")})});let r=document.querySelector("#product-list");r&&(r.value=JSON.stringify(t))}}document.addEventListener("DOMContentLoaded",()=>{new c})})(); +//# sourceMappingURL=index.js.map diff --git a/dist/scripts/admin/menus/settings/index.js.map b/dist/scripts/admin/menus/settings/index.js.map new file mode 100644 index 00000000..dc4295d9 --- /dev/null +++ b/dist/scripts/admin/menus/settings/index.js.map @@ -0,0 +1 @@ +{"mappings":"A,C,SIGI,EDFJ,IAAA,EAAe,CACb,WAFiB,AAAkB,aAAlB,OAAO,QAA0B,OAAO,UAAA,EAAc,OAAO,UAAA,CAAW,IAAA,CAAK,OAGhG,ECCA,IAAM,EAAQ,IAAI,WAAW,ICEvB,EAAY,EAAE,CAEpB,IAAK,IAAI,EAAI,EAAG,EAAI,IAAK,EAAE,EACzB,EAAU,IAAA,CAAM,AAAA,CAAA,EAAI,GAAA,EAAO,QAAA,CAAS,IAAI,KAAA,CAAM,IHmBhD,IAAA,EAxBA,SAAY,CAAO,CAAE,CAAG,CAAE,CAAM,EAC9B,GAAI,AAAA,EAAO,UAAA,EAAc,CAAC,GAAO,CAAC,EAChC,OAAO,AAAA,EAAO,UADhB,GAKA,IAAM,EAAO,AADb,CAAA,EAAU,GAAW,CAAC,CAAA,EACD,MAAA,EAAW,AAAA,CAAA,EAAQ,GAAA,EEL3B,WAEb,GAAI,CAAC,GAIC,CAFJ,CAAA,EAAkB,AAAkB,aAAlB,OAAO,QAA0B,OAAO,eAAA,EAAmB,OAAO,eAAA,CAAgB,IA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c,iBACvC,GACA,CAAA,EAAY,KAAA,CAAQ,KAAK,SAAA,CAAU,EADvC,CAIJ,CAEJ,CAEA,SAAS,gBAAA,CAAiB,mBAAoB,KAC1C,IAAI,CACR,E,C","sources":["","assets/scripts/admin/menus/settings/index.js","node_modules/uuid/dist/esm-browser/v4.js","node_modules/uuid/dist/esm-browser/native.js","node_modules/uuid/dist/esm-browser/rng.js","node_modules/uuid/dist/esm-browser/stringify.js","node_modules/uuid/dist/esm-browser/validate.js","node_modules/uuid/dist/esm-browser/regex.js","assets/scripts/admin/menus/settings/table.js"],"sourcesContent":["(() => {\nconst $b488569ebaeb416e$var$randomUUID = typeof crypto !== \"undefined\" && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nvar $b488569ebaeb416e$export$2e2bcd8739ae039 = {\n randomUUID: $b488569ebaeb416e$var$randomUUID\n};\n\n\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet $d0da4566d2fd20fe$var$getRandomValues;\nconst $d0da4566d2fd20fe$var$rnds8 = new Uint8Array(16);\nfunction $d0da4566d2fd20fe$export$2e2bcd8739ae039() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!$d0da4566d2fd20fe$var$getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n $d0da4566d2fd20fe$var$getRandomValues = typeof crypto !== \"undefined\" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n if (!$d0da4566d2fd20fe$var$getRandomValues) throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");\n }\n return $d0da4566d2fd20fe$var$getRandomValues($d0da4566d2fd20fe$var$rnds8);\n}\n\n\nvar $e8c673fd2604883f$export$2e2bcd8739ae039 = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\n\n\nfunction $7d240e1718cbe118$var$validate(uuid) {\n return typeof uuid === \"string\" && (0, $e8c673fd2604883f$export$2e2bcd8739ae039).test(uuid);\n}\nvar $7d240e1718cbe118$export$2e2bcd8739ae039 = $7d240e1718cbe118$var$validate;\n\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */ const $8fb7ad22aed8f433$var$byteToHex = [];\nfor(let i = 0; i < 256; ++i)$8fb7ad22aed8f433$var$byteToHex.push((i + 0x100).toString(16).slice(1));\nfunction $8fb7ad22aed8f433$export$8fb373d660548968(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return $8fb7ad22aed8f433$var$byteToHex[arr[offset + 0]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 1]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 2]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 3]] + \"-\" + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 4]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 5]] + \"-\" + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 6]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 7]] + \"-\" + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 8]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 9]] + \"-\" + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 10]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 11]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 12]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 13]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 14]] + $8fb7ad22aed8f433$var$byteToHex[arr[offset + 15]];\n}\nfunction $8fb7ad22aed8f433$var$stringify(arr, offset = 0) {\n const uuid = $8fb7ad22aed8f433$export$8fb373d660548968(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n if (!(0, $7d240e1718cbe118$export$2e2bcd8739ae039)(uuid)) throw TypeError(\"Stringified UUID is invalid\");\n return uuid;\n}\nvar $8fb7ad22aed8f433$export$2e2bcd8739ae039 = $8fb7ad22aed8f433$var$stringify;\n\n\nfunction $27d7069422be255c$var$v4(options, buf, offset) {\n if ((0, $b488569ebaeb416e$export$2e2bcd8739ae039).randomUUID && !buf && !options) return (0, $b488569ebaeb416e$export$2e2bcd8739ae039).randomUUID();\n options = options || {};\n const rnds = options.random || (options.rng || (0, $d0da4566d2fd20fe$export$2e2bcd8739ae039))(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n if (buf) {\n offset = offset || 0;\n for(let i = 0; i < 16; ++i)buf[offset + i] = rnds[i];\n return buf;\n }\n return (0, $8fb7ad22aed8f433$export$8fb373d660548968)(rnds);\n}\nvar $27d7069422be255c$export$2e2bcd8739ae039 = $27d7069422be255c$var$v4;\n\n\nclass $d56ea750786f9579$export$2e2bcd8739ae039 {\n constructor(){\n this.orderTable();\n this.paginationTable();\n }\n orderTable() {\n const ancors = document.querySelectorAll(\".order-table\");\n const urlParams = new URLSearchParams(window.location.search);\n let sortOrder = urlParams.get(\"order\") || \"DESC\";\n ancors.forEach((ancor)=>{\n const value = ancor.getAttribute(\"data-order\");\n if (value) ancor.addEventListener(\"click\", ()=>{\n sortOrder = sortOrder === \"ASC\" ? \"DESC\" : \"ASC\";\n this.queryURL([\n {\n \"key\": \"orderby\",\n \"value\": value\n },\n {\n \"key\": \"order\",\n \"value\": sortOrder\n }\n ]);\n });\n });\n }\n paginationTable() {\n const ancors = document.querySelectorAll(\".pagination\");\n ancors.forEach((ancor)=>{\n const value = ancor.getAttribute(\"data-page\");\n if (value) ancor.addEventListener(\"click\", ()=>{\n this.queryURL([\n {\n \"key\": \"table-page\",\n \"value\": value\n }\n ]);\n });\n });\n }\n queryURL(paramsArray) {\n const urlParams = new URLSearchParams(window.location.search);\n paramsArray.forEach(({ key: key, value: value })=>{\n urlParams.delete(key);\n urlParams.append(key, value);\n });\n window.location.replace(`${location.origin + location.pathname}?${urlParams.toString()}`);\n }\n}\n\n\nclass $31ca146c92a128de$var$Settings {\n constructor(){\n this.addPaymentLink();\n this.editPaymentLink();\n this.copyLink();\n this.handlerToken();\n this.handleModalProducts();\n new (0, $d56ea750786f9579$export$2e2bcd8739ae039)();\n }\n handlerToken() {\n const button = document.querySelector(\"#generate-token\");\n if (button) button.addEventListener(\"click\", ()=>{\n this.generateToken();\n });\n }\n generateToken() {\n const token = document.querySelector(\"#token\");\n if (token) token.value = (0, $27d7069422be255c$export$2e2bcd8739ae039)();\n }\n copyLink() {\n const elements = document.querySelectorAll(\".copy-element\");\n elements.forEach((element)=>{\n element.addEventListener(\"click\", ()=>{\n const text = element.getAttribute(\"data-copy\");\n if (navigator?.clipboard?.writeText) navigator.clipboard.writeText(text);\n });\n });\n }\n addPaymentLink() {\n const button = document.querySelector(\"#add-payment-link\");\n button.addEventListener(\"click\", ()=>{\n this.openModal();\n this.generateToken();\n });\n }\n editPaymentLink() {\n const anchors = document.querySelectorAll(\".open-link-form\");\n const close = document.querySelector(\"#close-link-form\");\n anchors.forEach((anchor)=>{\n anchor.addEventListener(\"click\", ()=>{\n this.openModal();\n this.fillModalFields(anchor.getAttribute(\"data-link\"));\n });\n });\n close.addEventListener(\"click\", ()=>{\n this.closeModal();\n });\n }\n openModal() {\n const modal = document.querySelector(\"#link-form\");\n this.clearModal(modal);\n this.clearModalProducts();\n modal.classList.remove(\"hidden\");\n }\n closeModal() {\n const modal = document.querySelector(\"#link-form\");\n this.clearModal(modal);\n this.clearModalProducts();\n modal.classList.add(\"hidden\");\n }\n clearModal(modal) {\n if (!modal) return;\n const fields = [\n \"name\",\n \"token\",\n \"expire_at\",\n \"expire_hour\",\n \"coupon\",\n \"link_id\",\n \"hidden_link_id\",\n \"link_url\"\n ];\n fields.forEach((field)=>{\n const element = modal.querySelector(`#${field}`);\n switch(field){\n case \"link_id\":\n element.innerText = \"\";\n break;\n case \"link_url\":\n element.removeAttribute(\"href\");\n element.classList.add(\"hidden\");\n break;\n default:\n if (element) element.value = \"\";\n break;\n }\n });\n [\n \"product-checkbox\",\n \"product-number\"\n ].forEach((field)=>{\n const elements = modal.querySelectorAll(`.${field}`);\n elements.forEach((element)=>{\n element.value = \"\";\n if (field === \"product-checkbox\") element.checked = false;\n });\n });\n }\n fillModalFields(fields) {\n const object = JSON.parse(fields);\n if (object) for(const key in object){\n const element = document.querySelector(`#${key}`);\n switch(key){\n case \"products\":\n this.fillModalProducts(object[key]);\n break;\n case \"link_id\":\n element.innerText = `#${object[key]}`;\n document.querySelector(`#hidden_${key}`).value = object[key];\n break;\n case \"link_url\":\n element.setAttribute(\"href\", object[key]);\n element.classList.remove(\"hidden\");\n break;\n default:\n if (element) element.value = object[key];\n break;\n }\n }\n }\n fillModalProducts(products) {\n const productList = document.querySelector(\"#product-list\");\n if (productList) productList.value = JSON.stringify(products);\n products.forEach((product)=>{\n const productsElements = document.querySelectorAll(\".modal-product\");\n productsElements.forEach((element)=>{\n const checkbox = element.querySelector(\".product-checkbox\");\n const number = element.querySelector(\".product-number\");\n if (parseInt(checkbox.getAttribute(\"data-id\")) === product.product) {\n checkbox.checked = true;\n number.value = product.quantity;\n }\n });\n });\n }\n clearModalProducts() {\n const productList = document.querySelector(\"#product-list\");\n if (productList) productList.value = \"\";\n }\n handleModalProducts() {\n const checkboxes = document.querySelectorAll(\".product-checkbox\");\n const numbers = document.querySelectorAll(\".product-number\");\n [\n checkboxes,\n numbers\n ].forEach((elements)=>{\n elements.forEach((element)=>{\n element.addEventListener(\"change\", ()=>{\n this.updateModalProducts();\n });\n });\n });\n }\n updateModalProducts() {\n const products = document.querySelectorAll(\".modal-product\");\n const list = [];\n products.forEach((product)=>{\n const checkbox = product.querySelector(\".product-checkbox\");\n const number = product.querySelector(\".product-number\");\n if (checkbox?.checked) {\n if (!number.value) number.value = 1;\n list.push({\n product: checkbox.getAttribute(\"data-id\"),\n quantity: number.value ? number.value : 0\n });\n } else number.value = \"\";\n checkbox.addEventListener(\"change\", ()=>{\n if (!checkbox.checked) number.value = \"\";\n });\n });\n const productList = document.querySelector(\"#product-list\");\n if (productList) productList.value = JSON.stringify(list);\n }\n}\ndocument.addEventListener(\"DOMContentLoaded\", ()=>{\n new $31ca146c92a128de$var$Settings();\n});\n\n})();\n//# sourceMappingURL=index.js.map\n","import {v4 as uuidv4} from 'uuid';\nimport Table from './table.js';\nclass Settings\n{\n constructor() {\n this.addPaymentLink();\n this.editPaymentLink();\n this.copyLink();\n this.handlerToken();\n this.handleModalProducts();\n\n new Table();\n }\n\n handlerToken() {\n const button = document.querySelector('#generate-token');\n\n if (button) {\n button.addEventListener('click', () => {\n this.generateToken();\n });\n }\n }\n\n generateToken() {\n const token = document.querySelector('#token');\n\n if (token) {\n token.value = uuidv4();\n }\n }\n\n copyLink() {\n const elements = document.querySelectorAll('.copy-element');\n\n elements.forEach((element) => {\n element.addEventListener('click', () => {\n const text = element.getAttribute('data-copy');\n\n if (navigator?.clipboard?.writeText) {\n navigator.clipboard.writeText(text);\n }\n })\n });\n }\n\n addPaymentLink() {\n const button = document.querySelector('#add-payment-link');\n button.addEventListener('click', () => {\n this.openModal();\n this.generateToken();\n });\n }\n\n editPaymentLink() {\n const anchors = document.querySelectorAll('.open-link-form');\n const close = document.querySelector('#close-link-form');\n\n anchors.forEach((anchor) => {\n anchor.addEventListener('click', () => {\n this.openModal();\n this.fillModalFields(anchor.getAttribute('data-link'));\n });\n });\n\n close.addEventListener('click', () => {\n this.closeModal();\n });\n }\n\n openModal() {\n const modal = document.querySelector('#link-form');\n\n this.clearModal(modal);\n this.clearModalProducts();\n\n modal.classList.remove('hidden');\n }\n\n closeModal() {\n const modal = document.querySelector('#link-form');\n\n this.clearModal(modal);\n this.clearModalProducts();\n modal.classList.add('hidden');\n }\n\n clearModal(modal) {\n if (!modal) return;\n\n const fields = [\n 'name',\n 'token',\n 'expire_at',\n 'expire_hour',\n 'coupon',\n 'link_id',\n 'hidden_link_id',\n 'link_url'\n ];\n\n fields.forEach((field) => {\n const element = modal.querySelector(`#${field}`);\n\n switch (field) {\n case 'link_id':\n element.innerText = '';\n break;\n case 'link_url':\n element.removeAttribute('href');\n element.classList.add('hidden')\n break;\n default:\n if (element) element.value = '';\n break;\n }\n });\n\n ['product-checkbox','product-number'].forEach((field) => {\n const elements = modal.querySelectorAll(`.${field}`);\n elements.forEach((element) => {\n element.value = '';\n\n if (field === 'product-checkbox') {\n element.checked = false;\n }\n });\n })\n }\n\n fillModalFields(fields) {\n const object = JSON.parse(fields);\n if (object) {\n for (const key in object) {\n const element = document.querySelector(`#${key}`);\n\n switch (key) {\n case 'products':\n this.fillModalProducts(object[key]);\n break;\n case 'link_id':\n element.innerText = `#${object[key]}`;\n document.querySelector(`#hidden_${key}`).value = object[key];\n break;\n case 'link_url':\n element.setAttribute('href', object[key]);\n element.classList.remove('hidden')\n break;\n default:\n if (element) element.value = object[key];\n break;\n\n }\n }\n }\n }\n\n fillModalProducts(products) {\n const productList = document.querySelector('#product-list');\n\n if (productList) {\n productList.value = JSON.stringify(products);\n }\n\n products.forEach(product => {\n const productsElements = document.querySelectorAll('.modal-product');\n productsElements.forEach(element => {\n const checkbox = element.querySelector('.product-checkbox');\n const number = element.querySelector('.product-number');\n\n if (parseInt(checkbox.getAttribute('data-id')) === product.product) {\n checkbox.checked = true;\n number.value = product.quantity\n }\n });\n });\n }\n\n clearModalProducts() {\n const productList = document.querySelector('#product-list');\n if (productList) {\n productList.value = '';\n }\n }\n\n handleModalProducts() {\n\n const checkboxes = document.querySelectorAll('.product-checkbox');\n const numbers = document.querySelectorAll('.product-number');\n\n [checkboxes, numbers].forEach((elements) => {\n elements.forEach((element) => {\n element.addEventListener('change', () => {\n this.updateModalProducts();\n });\n });\n })\n\n }\n\n updateModalProducts() {\n const products = document.querySelectorAll('.modal-product');\n const list = [];\n\n products.forEach((product) => {\n const checkbox = product.querySelector('.product-checkbox');\n const number = product.querySelector('.product-number');\n\n if (checkbox?.checked) {\n if (!number.value) number.value = 1;\n\n list.push({\n product: checkbox.getAttribute('data-id'),\n quantity: number.value ? number.value : 0\n });\n \n } else {\n number.value = '';\n }\n\n checkbox.addEventListener(\"change\", () => {\n if (!checkbox.checked) {\n number.value = '';\n }\n });\n })\n\n const productList = document.querySelector('#product-list');\n if (productList) {\n productList.value = JSON.stringify(list);\n }\n\n }\n\n}\n\ndocument.addEventListener('DOMContentLoaded', () => {\n new Settings();\n});\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","export default class Table\n{\n constructor() {\n this.orderTable();\n this.paginationTable();\n }\n\n orderTable() {\n const ancors = document.querySelectorAll('.order-table');\n const urlParams = new URLSearchParams(window.location.search);\n let sortOrder = urlParams.get('order') || 'DESC';\n\n ancors.forEach((ancor) => {\n const value = ancor.getAttribute('data-order');\n if (value) {\n ancor.addEventListener('click', () => {\n sortOrder = sortOrder === 'ASC' ? 'DESC' : 'ASC';\n this.queryURL([{\"key\": \"orderby\", \"value\": value}, {\"key\": \"order\", \"value\": sortOrder}]);\n })\n }\n })\n }\n paginationTable() {\n const ancors = document.querySelectorAll('.pagination');\n\n ancors.forEach((ancor) => {\n const value = ancor.getAttribute('data-page');\n if (value) {\n ancor.addEventListener('click', () => {\n this.queryURL([{\"key\": \"table-page\", \"value\": value}]);\n })\n }\n })\n }\n\n queryURL(paramsArray) {\n const urlParams = new URLSearchParams(window.location.search);\n\n paramsArray.forEach(({ key, value }) => {\n urlParams.delete(key);\n urlParams.append(key, value);\n });\n\n window.location.replace(`${location.origin + location.pathname}?${urlParams.toString()}`);\n }\n}\n"],"names":["$d0da4566d2fd20fe$var$getRandomValues","$b488569ebaeb416e$export$2e2bcd8739ae039","randomUUID","crypto","bind","$d0da4566d2fd20fe$var$rnds8","Uint8Array","$8fb7ad22aed8f433$var$byteToHex","i","push","toString","slice","$27d7069422be255c$export$2e2bcd8739ae039","options","buf","offset","rnds","random","rng","getRandomValues","Error","arr","$d56ea750786f9579$export$2e2bcd8739ae039","constructor","orderTable","paginationTable","ancors","document","querySelectorAll","sortOrder","urlParams","URLSearchParams","window","location","search","get","forEach","ancor","value","getAttribute","addEventListener","queryURL","paramsArray","key","delete","append","replace","origin","pathname","$31ca146c92a128de$var$Settings","addPaymentLink","editPaymentLink","copyLink","handlerToken","handleModalProducts","button","querySelector","generateToken","token","elements","element","text","navigator","clipboard","writeText","openModal","anchors","close","anchor","fillModalFields","closeModal","modal","clearModal","clearModalProducts","classList","remove","add","fields","field","innerText","removeAttribute","checked","object","JSON","parse","fillModalProducts","setAttribute","products","productList","stringify","product","productsElements","checkbox","number","parseInt","quantity","updateModalProducts","list"],"version":3,"file":"index.js.map"} \ No newline at end of file diff --git a/dist/scripts/admin/menus/settings/table.js b/dist/scripts/admin/menus/settings/table.js new file mode 100644 index 00000000..490c20fc --- /dev/null +++ b/dist/scripts/admin/menus/settings/table.js @@ -0,0 +1,2 @@ + +//# sourceMappingURL=table.js.map diff --git a/dist/scripts/admin/menus/settings/table.js.map b/dist/scripts/admin/menus/settings/table.js.map new file mode 100644 index 00000000..d6b45418 --- /dev/null +++ b/dist/scripts/admin/menus/settings/table.js.map @@ -0,0 +1 @@ +{"mappings":"","sources":["assets/scripts/admin/menus/settings/table.js"],"sourcesContent":["export default class Table\n{\n constructor() {\n this.orderTable();\n this.paginationTable();\n }\n\n orderTable() {\n const ancors = document.querySelectorAll('.order-table');\n const urlParams = new URLSearchParams(window.location.search);\n let sortOrder = urlParams.get('order') || 'DESC';\n\n ancors.forEach((ancor) => {\n const value = ancor.getAttribute('data-order');\n if (value) {\n ancor.addEventListener('click', () => {\n sortOrder = sortOrder === 'ASC' ? 'DESC' : 'ASC';\n this.queryURL([{\"key\": \"orderby\", \"value\": value}, {\"key\": \"order\", \"value\": sortOrder}]);\n })\n }\n })\n }\n paginationTable() {\n const ancors = document.querySelectorAll('.pagination');\n\n ancors.forEach((ancor) => {\n const value = ancor.getAttribute('data-page');\n if (value) {\n ancor.addEventListener('click', () => {\n this.queryURL([{\"key\": \"table-page\", \"value\": value}]);\n })\n }\n })\n }\n\n queryURL(paramsArray) {\n const urlParams = new URLSearchParams(window.location.search);\n\n paramsArray.forEach(({ key, value }) => {\n urlParams.delete(key);\n urlParams.append(key, value);\n });\n\n window.location.replace(`${location.origin + location.pathname}?${urlParams.toString()}`);\n }\n}\n"],"names":[],"version":3,"file":"table.js.map"} \ No newline at end of file diff --git a/dist/scripts/theme/pages/checkout/index.js b/dist/scripts/theme/pages/checkout/index.js new file mode 100644 index 00000000..2be94712 --- /dev/null +++ b/dist/scripts/theme/pages/checkout/index.js @@ -0,0 +1,2 @@ +console.log("a"); +//# sourceMappingURL=index.js.map diff --git a/dist/scripts/theme/pages/checkout/index.js.map b/dist/scripts/theme/pages/checkout/index.js.map new file mode 100644 index 00000000..aed74fce --- /dev/null +++ b/dist/scripts/theme/pages/checkout/index.js.map @@ -0,0 +1 @@ +{"mappings":"ACAA,QAAQ,GAAA,CAAI","sources":["","assets/scripts/theme/pages/checkout/index.js"],"sourcesContent":["(() => {\nconsole.log(\"a\");\n\n})();\n//# sourceMappingURL=index.js.map\n","console.log('a')\n"],"names":["console","log"],"version":3,"file":"index.js.map"} \ No newline at end of file diff --git a/dist/styles/app.css b/dist/styles/app.css new file mode 100644 index 00000000..bfcb6964 --- /dev/null +++ b/dist/styles/app.css @@ -0,0 +1,1149 @@ +/* +! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com +*/ + +/* +1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) +2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) +*/ + +*, +::before, +::after { + box-sizing: border-box; + /* 1 */ + border-width: 0; + /* 2 */ + border-style: solid; + /* 2 */ + border-color: #e5e7eb; + /* 2 */ +} + +::before, +::after { + --tw-content: ''; +} + +/* +1. Use a consistent sensible line-height in all browsers. +2. Prevent adjustments of font size after orientation changes in iOS. +3. Use a more readable tab size. +4. Use the user's configured `sans` font-family by default. +5. Use the user's configured `sans` font-feature-settings by default. +6. Use the user's configured `sans` font-variation-settings by default. +7. Disable tap highlights on iOS +*/ + +html, +:host { + line-height: 1.5; + /* 1 */ + -webkit-text-size-adjust: 100%; + /* 2 */ + -moz-tab-size: 4; + /* 3 */ + -o-tab-size: 4; + tab-size: 4; + /* 3 */ + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + /* 4 */ + font-feature-settings: normal; + /* 5 */ + font-variation-settings: normal; + /* 6 */ + -webkit-tap-highlight-color: transparent; + /* 7 */ +} + +/* +1. Remove the margin in all browsers. +2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. +*/ + +body { + margin: 0; + /* 1 */ + line-height: inherit; + /* 2 */ +} + +/* +1. Add the correct height in Firefox. +2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) +3. Ensure horizontal rules are visible by default. +*/ + +hr { + height: 0; + /* 1 */ + color: inherit; + /* 2 */ + border-top-width: 1px; + /* 3 */ +} + +/* +Add the correct text decoration in Chrome, Edge, and Safari. +*/ + +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} + +/* +Remove the default font size and weight for headings. +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} + +/* +Reset links to optimize for opt-in styling instead of opt-out. +*/ + +a { + color: inherit; + text-decoration: inherit; +} + +/* +Add the correct font weight in Edge and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/* +1. Use the user's configured `mono` font-family by default. +2. Use the user's configured `mono` font-feature-settings by default. +3. Use the user's configured `mono` font-variation-settings by default. +4. Correct the odd `em` font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + /* 1 */ + font-feature-settings: normal; + /* 2 */ + font-variation-settings: normal; + /* 3 */ + font-size: 1em; + /* 4 */ +} + +/* +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/* +Prevent `sub` and `sup` elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) +2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +3. Remove gaps between table borders by default. +*/ + +table { + text-indent: 0; + /* 1 */ + border-color: inherit; + /* 2 */ + border-collapse: collapse; + /* 3 */ +} + +/* +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +3. Remove default padding in all browsers. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; + /* 1 */ + font-feature-settings: inherit; + /* 1 */ + font-variation-settings: inherit; + /* 1 */ + font-size: 100%; + /* 1 */ + font-weight: inherit; + /* 1 */ + line-height: inherit; + /* 1 */ + letter-spacing: inherit; + /* 1 */ + color: inherit; + /* 1 */ + margin: 0; + /* 2 */ + padding: 0; + /* 3 */ +} + +/* +Remove the inheritance of text transform in Edge and Firefox. +*/ + +button, +select { + text-transform: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Remove default button styles. +*/ + +button, +input:where([type='button']), +input:where([type='reset']), +input:where([type='submit']) { + -webkit-appearance: button; + /* 1 */ + background-color: transparent; + /* 2 */ + background-image: none; + /* 2 */ +} + +/* +Use the modern Firefox focus style for all focusable elements. +*/ + +:-moz-focusring { + outline: auto; +} + +/* +Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) +*/ + +:-moz-ui-invalid { + box-shadow: none; +} + +/* +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/* +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/* +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; + /* 1 */ + outline-offset: -2px; + /* 2 */ +} + +/* +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to `inherit` in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; + /* 1 */ + font: inherit; + /* 2 */ +} + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} + +/* +Removes the default spacing and border for appropriate elements. +*/ + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} + +fieldset { + margin: 0; + padding: 0; +} + +legend { + padding: 0; +} + +ol, +ul, +menu { + list-style: none; + margin: 0; + padding: 0; +} + +/* +Reset default styling for dialogs. +*/ + +dialog { + padding: 0; +} + +/* +Prevent resizing textareas horizontally by default. +*/ + +textarea { + resize: vertical; +} + +/* +1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) +2. Set the default placeholder color to the user's configured gray 400 color. +*/ + +input::-moz-placeholder, textarea::-moz-placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +input::placeholder, +textarea::placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +/* +Set the default cursor for buttons. +*/ + +button, +[role="button"] { + cursor: pointer; +} + +/* +Make sure disabled buttons don't get the pointer cursor. +*/ + +:disabled { + cursor: default; +} + +/* +1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) +2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) + This can trigger a poorly considered lint error in some tools but is included by design. +*/ + +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; + /* 1 */ + vertical-align: middle; + /* 2 */ +} + +/* +Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) +*/ + +img, +video { + max-width: 100%; + height: auto; +} + +/* Make elements with the HTML hidden attribute stay hidden by default */ + +[hidden] { + display: none; +} + +*, ::before, ::after { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +::backdrop { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.absolute { + position: absolute; +} + +.relative { + position: relative; +} + +.bottom-6 { + bottom: 1.5rem; +} + +.left-0 { + left: 0px; +} + +.left-2 { + left: 0.5rem; +} + +.top-\[100px\] { + top: 100px; +} + +.float-right { + float: right; +} + +.my-2 { + margin-top: 0.5rem; + margin-bottom: 0.5rem; +} + +.my-4 { + margin-top: 1rem; + margin-bottom: 1rem; +} + +.mb-2 { + margin-bottom: 0.5rem; +} + +.mb-5 { + margin-bottom: 1.25rem; +} + +.ml-0 { + margin-left: 0px; +} + +.ml-1 { + margin-left: 0.25rem; +} + +.ml-1\.5 { + margin-left: 0.375rem; +} + +.ml-2 { + margin-left: 0.5rem; +} + +.ml-4 { + margin-left: 1rem; +} + +.ml-\[5px\] { + margin-left: 5px; +} + +.mt-4 { + margin-top: 1rem; +} + +.mt-\[20px\] { + margin-top: 20px; +} + +.block { + display: block; +} + +.flex { + display: flex; +} + +.inline-flex { + display: inline-flex; +} + +.table { + display: table; +} + +.grid { + display: grid; +} + +.hidden { + display: none; +} + +.h-10 { + height: 2.5rem; +} + +.h-3 { + height: 0.75rem; +} + +.h-4 { + height: 1rem; +} + +.h-fit { + height: -moz-fit-content; + height: fit-content; +} + +.max-h-48 { + max-height: 12rem; +} + +.w-1\/2 { + width: 50%; +} + +.w-16 { + width: 4rem; +} + +.w-4 { + width: 1rem; +} + +.w-\[120px\] { + width: 120px; +} + +.w-\[180px\] { + width: 180px; +} + +.w-\[40px\] { + width: 40px; +} + +.w-\[60px\] { + width: 60px; +} + +.w-full { + width: 100%; +} + +.max-w-60 { + max-width: 15rem; +} + +.cursor-pointer { + cursor: pointer; +} + +.grid-cols-\[1fr_2fr_40px\] { + grid-template-columns: 1fr 2fr 40px; +} + +.grid-cols-\[20px_1fr_40px\] { + grid-template-columns: 20px 1fr 40px; +} + +.flex-row { + flex-direction: row; +} + +.items-center { + align-items: center; +} + +.justify-start { + justify-content: flex-start; +} + +.justify-center { + justify-content: center; +} + +.gap-2 { + gap: 0.5rem; +} + +.-space-x-px > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(-1px * var(--tw-space-x-reverse)); + margin-left: calc(-1px * calc(1 - var(--tw-space-x-reverse))); +} + +.overflow-auto { + overflow: auto; +} + +.overflow-x-auto { + overflow-x: auto; +} + +.overflow-y-scroll { + overflow-y: scroll; +} + +.whitespace-nowrap { + white-space: nowrap; +} + +.rounded { + border-radius: 0.25rem; +} + +.rounded-lg { + border-radius: 0.5rem; +} + +.rounded-md { + border-radius: 0.375rem; +} + +.rounded-l-lg { + border-top-left-radius: 0.5rem; + border-bottom-left-radius: 0.5rem; +} + +.rounded-r-lg { + border-top-right-radius: 0.5rem; + border-bottom-right-radius: 0.5rem; +} + +.border { + border-width: 1px; +} + +.border-0 { + border-width: 0px; +} + +.border-b { + border-bottom-width: 1px; +} + +.border-b-\[1px\] { + border-bottom-width: 1px; +} + +.border-none { + border-style: none; +} + +.border-gray-200 { + --tw-border-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-border-opacity)); +} + +.border-gray-300 { + --tw-border-opacity: 1; + border-color: rgb(209 213 219 / var(--tw-border-opacity)); +} + +.bg-\[\#fafafa\] { + --tw-bg-opacity: 1; + background-color: rgb(250 250 250 / var(--tw-bg-opacity)); +} + +.bg-black { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); +} + +.bg-blue-600 { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); +} + +.bg-gray-50 { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity)); +} + +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} + +.bg-opacity-0 { + --tw-bg-opacity: 0; +} + +.\!p-4 { + padding: 1rem !important; +} + +.p-8 { + padding: 2rem; +} + +.px-10 { + padding-left: 2.5rem; + padding-right: 2.5rem; +} + +.px-4 { + padding-left: 1rem; + padding-right: 1rem; +} + +.px-6 { + padding-left: 1.5rem; + padding-right: 1.5rem; +} + +.px-8 { + padding-left: 2rem; + padding-right: 2rem; +} + +.px-\[15px\] { + padding-left: 15px; + padding-right: 15px; +} + +.py-1 { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} + +.py-10 { + padding-top: 2.5rem; + padding-bottom: 2.5rem; +} + +.py-3 { + padding-top: 0.75rem; + padding-bottom: 0.75rem; +} + +.py-4 { + padding-top: 1rem; + padding-bottom: 1rem; +} + +.py-\[8px\] { + padding-top: 8px; + padding-bottom: 8px; +} + +.pb-1 { + padding-bottom: 0.25rem; +} + +.pb-4 { + padding-bottom: 1rem; +} + +.pt-1 { + padding-top: 0.25rem; +} + +.text-left { + text-align: left; +} + +.align-middle { + vertical-align: middle; +} + +.\!text-sm { + font-size: 0.875rem !important; + line-height: 1.25rem !important; +} + +.text-2xl { + font-size: 1.5rem; + line-height: 2rem; +} + +.text-3xl { + font-size: 1.875rem; + line-height: 2.25rem; +} + +.text-base { + font-size: 1rem; + line-height: 1.5rem; +} + +.text-lg { + font-size: 1.125rem; + line-height: 1.75rem; +} + +.text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} + +.text-xs { + font-size: 0.75rem; + line-height: 1rem; +} + +.font-bold { + font-weight: 700; +} + +.font-medium { + font-weight: 500; +} + +.uppercase { + text-transform: uppercase; +} + +.leading-tight { + line-height: 1.25; +} + +.text-black { + --tw-text-opacity: 1; + color: rgb(0 0 0 / var(--tw-text-opacity)); +} + +.text-blue-400 { + --tw-text-opacity: 1; + color: rgb(96 165 250 / var(--tw-text-opacity)); +} + +.text-blue-600 { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); +} + +.text-blue-950 { + --tw-text-opacity: 1; + color: rgb(23 37 84 / var(--tw-text-opacity)); +} + +.text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + +.text-gray-500 { + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity)); +} + +.text-gray-700 { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity)); +} + +.text-gray-900 { + --tw-text-opacity: 1; + color: rgb(17 24 39 / var(--tw-text-opacity)); +} + +.text-red-800 { + --tw-text-opacity: 1; + color: rgb(153 27 27 / var(--tw-text-opacity)); +} + +.text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.no-underline { + text-decoration-line: none; +} + +.shadow-md { + --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.shadow-xl { + --tw-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.outline-0 { + outline-width: 0px; +} + +.wpl-wrap .notice { + display: none; +} + +.hover\:cursor-pointer:hover { + cursor: pointer; +} + +.hover\:bg-\[\#316beb\]:hover { + --tw-bg-opacity: 1; + background-color: rgb(49 107 235 / var(--tw-bg-opacity)); +} + +.hover\:bg-gray-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} + +.hover\:text-blue-600:hover { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); +} + +.hover\:text-blue-800:hover { + --tw-text-opacity: 1; + color: rgb(30 64 175 / var(--tw-text-opacity)); +} + +.hover\:text-gray-700:hover { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity)); +} + +.hover\:text-red-600:hover { + --tw-text-opacity: 1; + color: rgb(220 38 38 / var(--tw-text-opacity)); +} + +.hover\:text-white:hover { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.focus\:border-blue-500:focus { + --tw-border-opacity: 1; + border-color: rgb(59 130 246 / var(--tw-border-opacity)); +} + +.focus\:ring-blue-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); +} + +.dark\:border-gray-700:is(.dark *) { + --tw-border-opacity: 1; + border-color: rgb(55 65 81 / var(--tw-border-opacity)); +} + +.dark\:bg-gray-800:is(.dark *) { + --tw-bg-opacity: 1; + background-color: rgb(31 41 55 / var(--tw-bg-opacity)); +} + +.dark\:text-gray-400:is(.dark *) { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + +.dark\:hover\:bg-gray-700:hover:is(.dark *) { + --tw-bg-opacity: 1; + background-color: rgb(55 65 81 / var(--tw-bg-opacity)); +} + +.dark\:hover\:text-white:hover:is(.dark *) { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + +@media (min-width: 640px) { + .sm\:rounded-lg { + border-radius: 0.5rem; + } +} \ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index 21d84faa..00000000 --- a/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "wc-payment-link", - "version": "1.0.3", - "description": "Payment links for WooCommerce", - "repository": "https://github.com/devaguia/wc-payment-link", - "author": "Matheus Aguiar", - "license": "GPL-3.0", - "devDependencies": { - "@parcel/transformer-sass": "2.9.3", - "@fortawesome/fontawesome-free": "^6.5.2", - "autoprefixer": "^10.4.14", - "imask": "7.1.3", - "node-wp-i18n": "1.2.7", - "parcel": "2.9.3", - "postcss-loader": "7.3.3", - "postcss-modules": "6.0.0", - "sass": "1.64.1", - "tailwindcss": "^3.3.5", - "webpack": "5.88.2", - "webpack-cli": "5.1.4", - "uuid": "^9.0.1" - }, - "scripts": { - "build": "yarn build:parcel && yarn build:tailwind", - "build:parcel": "parcel build ./assets/scripts/**/**/*.js --dist-dir ./dist/scripts/", - "build:tailwind": "npx tailwindcss -i ./assets/styles/app.scss -o ./dist/styles/app.css", - "dev:parcel": "parcel watch ./assets/scripts/**/**/**/*.js --dist-dir ./dist/scripts/", - "dev:tailwind": "npx tailwindcss -i ./assets/styles/app.css -o ./dist/styles/app.css --watch", - "i18n:textdomain": "wpi18n addtextdomain --exclude=dist,node_modules,assets,tests,vendor", - "i18n:pot": "wpi18n makepot --exclude=dist,node_modules,assets,tests,vendor" - } -} diff --git a/tailwind.config.js b/tailwind.config.js deleted file mode 100644 index 1d391cc8..00000000 --- a/tailwind.config.js +++ /dev/null @@ -1,13 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: [ - "./assets/**/*.js", - "./app/Views/**/**/**/*.php", - ], - darkMode: 'class', - theme: { - extend: {}, - }, - plugins: [], -} - diff --git a/vendor/autoload.php b/vendor/autoload.php new file mode 100644 index 00000000..f7ac0404 --- /dev/null +++ b/vendor/autoload.php @@ -0,0 +1,25 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + + // PSR-4 + /** + * @var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + $includeFile = self::$includeFile; + $includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } +} diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php new file mode 100644 index 00000000..51e734a7 --- /dev/null +++ b/vendor/composer/InstalledVersions.php @@ -0,0 +1,359 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..0fb0a2c1 --- /dev/null +++ b/vendor/composer/autoload_classmap.php @@ -0,0 +1,10 @@ + $vendorDir . '/composer/InstalledVersions.php', +); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php new file mode 100644 index 00000000..3305bafa --- /dev/null +++ b/vendor/composer/autoload_files.php @@ -0,0 +1,10 @@ + $baseDir . '/app/Helpers/Helper.php', +); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php new file mode 100644 index 00000000..15a2ff3a --- /dev/null +++ b/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($baseDir . '/app'), +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php new file mode 100644 index 00000000..4f19a0b8 --- /dev/null +++ b/vendor/composer/autoload_real.php @@ -0,0 +1,48 @@ +register(true); + + $filesToLoad = \Composer\Autoload\ComposerStaticInitc025d14b67f9dfd7342700e3e39ab945::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); + } + + return $loader; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php new file mode 100644 index 00000000..66932572 --- /dev/null +++ b/vendor/composer/autoload_static.php @@ -0,0 +1,40 @@ + __DIR__ . '/../..' . '/app/Helpers/Helper.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'W' => + array ( + 'WCPaymentLink\\' => 14, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'WCPaymentLink\\' => + array ( + 0 => __DIR__ . '/../..' . '/app', + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInitc025d14b67f9dfd7342700e3e39ab945::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitc025d14b67f9dfd7342700e3e39ab945::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitc025d14b67f9dfd7342700e3e39ab945::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json new file mode 100644 index 00000000..87fda747 --- /dev/null +++ b/vendor/composer/installed.json @@ -0,0 +1,5 @@ +{ + "packages": [], + "dev": true, + "dev-package-names": [] +} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php new file mode 100644 index 00000000..293ff89e --- /dev/null +++ b/vendor/composer/installed.php @@ -0,0 +1,23 @@ + array( + 'name' => 'devaguia/wc-payment-link', + 'pretty_version' => '1.0.3', + 'version' => '1.0.3.0', + 'reference' => null, + 'type' => 'wordpress-plugin', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + 'devaguia/wc-payment-link' => array( + 'pretty_version' => '1.0.3', + 'version' => '1.0.3.0', + 'reference' => null, + 'type' => 'wordpress-plugin', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +);