[
  {
    "path": ".eslintrc.json",
    "content": "{\n  \"parserOptions\": {\n    \"ecmaVersion\": 2022,\n    \"sourceType\": \"module\"\n  },\n  \"extends\": [\"plugin:prettier/recommended\"],\n  \"plugins\": [\"prettier\"],\n  \"rules\": {\n    \"no-undef\": \"off\"\n  }\n}\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "* * *\n\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n* * *\n\n**Describe the bug**\nA clear and concise description of what the bug is.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n1\\. Go to '...'\n2\\. Click on '....'\n3\\. Scroll down to '....'\n4\\. See error\n\n**Expected behavior**\nA clear and concise description of what you expected to happen.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**Desktop (please complete the following information):**\n\n-   OS: [e.g. iOS]\n-   Browser [e.g. chrome, safari]\n-   Version [e.g. 22]\n\n**Smartphone (please complete the following information):**\n\n-   Device: [e.g. iPhone6]\n-   OS: [e.g. iOS8.1]\n-   Browser [e.g. stock browser, safari]\n-   Version [e.g. 22]\n\n**Additional context**\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "* * *\n\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n* * *\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/workflows/codeql.yml",
    "content": "name: \"CodeQL\"\n\non:\n  push:\n    branches: [ \"master\" ]\n  pull_request:\n    branches: [ \"master\" ]\n  schedule:\n    - cron: \"40 2 * * 3\"\n\njobs:\n  analyze:\n    name: Analyze\n    runs-on: ubuntu-latest\n    permissions:\n      actions: read\n      contents: read\n      security-events: write\n\n    strategy:\n      fail-fast: false\n      matrix:\n        language: [ javascript ]\n\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - name: Initialize CodeQL\n        uses: github/codeql-action/init@v3\n        with:\n          languages: ${{ matrix.language }}\n          queries: +security-and-quality\n\n      - name: Autobuild\n        uses: github/codeql-action/autobuild@v3\n\n      - name: Perform CodeQL Analysis\n        uses: github/codeql-action/analyze@v3\n        with:\n          category: \"/language:${{ matrix.language }}\"\n"
  },
  {
    "path": ".github/workflows/playwright.yml",
    "content": "name: Playwright Tests\non:\n  push:\n    branches: [ main, master ]\n  pull_request:\n    branches: [ main, master ]\njobs:\n  test:\n    timeout-minutes: 60\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - uses: actions/setup-node@v5\n      with:\n        node-version: 24\n    - name: Install pnpm\n      run: npm install -g pnpm\n    - name: Install dependencies\n      run: pnpm i\n      env:\n          CI: true\n          PUBLIC_GRAPHQL_URL: ${{ secrets.PUBLIC_GRAPHQL_URL }}\n          ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}\n          ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}\n    - name: Install Playwright Browsers\n      run: npx playwright install --with-deps\n    - name: Run Playwright tests\n      run: npx playwright test\n      env:\n          CI: true\n          PUBLIC_GRAPHQL_URL: ${{ secrets.PUBLIC_GRAPHQL_URL }}\n          ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}\n          ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}\n    - uses: actions/upload-artifact@v6\n      if: always()\n      with:\n        name: playwright-report\n        path: playwright-report/\n        retention-days: 30\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\n*.log*\n.nuxt\n.nitro\n.cache\n.output\n.env\ndist\n/test-results/\n/playwright-report/\n/playwright/.cache/\n"
  },
  {
    "path": ".npmrc",
    "content": "ignore-scripts=true\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nour General Public Licenses are intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU Affero General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU Affero General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU Affero General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Affero General Public License as published\n    by the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU AGPL, see\n<https://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "README.md",
    "content": "[![Playwright Tests](https://github.com/w3bdesign/nuxtjs-woocommerce/actions/workflows/playwright.yml/badge.svg)](https://github.com/w3bdesign/nuxtjs-woocommerce/actions/workflows/playwright.yml)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1835e693354349ffaa703c0bbaf2b52b)](https://app.codacy.com/gh/w3bdesign/nuxtjs-woocommerce?utm_source=github.com&utm_medium=referral&utm_content=w3bdesign/nuxtjs-woocommerce&utm_campaign=Badge_Grade)\n[![CodeFactor](https://www.codefactor.io/repository/github/w3bdesign/nuxtjs-woocommerce/badge)](https://www.codefactor.io/repository/github/w3bdesign/nuxtjs-woocommerce)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=w3bdesign_nuxtjs-woocommerce&metric=alert_status)](https://sonarcloud.io/dashboard?id=w3bdesign_nuxtjs-woocommerce)\n\n# Nuxt 3 Ecommerce site with WooCommerce backend\n\n<img src=\"https://user-images.githubusercontent.com/45217974/106988377-f129a080-676f-11eb-94b9-a44c86ea6c79.png\" alt=\"Project screenshot\" />\n\n## Table Of Contents (TOC)\n\n- [Features](#Features)\n- [Installation](#Installation)\n- [Troubleshooting](#Troubleshooting)\n- [TODO](#TODO)\n\n## Features\n\n- Nuxt 3 for server-side rendering and optimal performance\n- Vue 3 and Composition API with <script setup> syntax\n- Tailwind CSS for responsive and customizable design\n- Nuxt Apollo for efficient GraphQL integration\n- Pinia with pinia-plugin-persistedstate for robust state management\n- Support for simple and variable WooCommerce products\n- Stock quantity management for all product types\n- CSS animations and transitions for enhanced user experience\n- Form handling and validation with Formkit, Vee Validate, and Yup\n- Streamlined checkout process\n- Animated mobile menu for improved mobile usability\n- Swiper integration for dynamic Hero section\n- Basic Playwright tests integrated with Github Actions\n\n## Installation\n\n1.  Install and activate the following required plugins, in your WordPress plugin directory:\n\n- [woocommerce](https://wordpress.org/plugins/woocommerce) Ecommerce for WordPress.\n- [wp-graphql](https://wordpress.org/plugins/wp-graphql) Exposes GraphQL for WordPress.\n- [wp-graphql-woocommerce](https://github.com/wp-graphql/wp-graphql-woocommerce) Adds WooCommerce functionality to a WPGraphQL schema. Currently only confirmed to be working with version 0.62 of this plugin.\n- [wp-algolia-woo-indexer](https://github.com/w3bdesign/wp-algolia-woo-indexer) WordPress plugin coded by me. Sends WooCommerce products to Algolia. Required for search to work.\n\nOptional plugin:\n\n- [headless-wordpress](https://github.com/w3bdesign/headless-wp) Disables the frontend so only the backend is accessible.\n- [wp-graphql-cors](https://github.com/funkhaus/wp-graphql-cors) Ensures that CORS works correctly. Remember to add the domain to the store under `Extend \"Access-Control-Allow-Origin” header`\n\nThe current release has been tested and is confirmed working with the following plugin versions:\n\n- WordPress version 6.6.2\n- WooCommerce version 7.4.0\n- WP GraphQL version 1.13.8\n- WooGraphQL version 0.12.0\n- WPGraphQL CORS version 2.1\n\n2.  Make sure WooCommerce has some products already or import some sample products\n\n    The WooCommerce sample products CSV file is available at `wp-content/plugins/woocommerce/sample-data/sample_products.csv` or [Sample products](sample_products/)\n\n    Import the products at `WP Dashboard > Tools > Import > WooCommerce products(CSV)`\n\n3.  Clone or fork the repo and modify `.env` with the URL to the GraphQL endpoint (or set environment variables in the configuration UI for your deployment solution)\n\n4.  Start the server with `npm run dev`\n\n5.  Enable COD (Cash On Demand) payment method in WooCommerce\n\n6.  Add a product to the cart\n\n7.  Proceed to checkout\n\n8.  Fill in your details and place the order\n\n## Troubleshooting\n\n### I am getting a cart undefined error or other GraphQL errors\n\nCheck that you are using the 0.12.0 version of the [wp-graphql-woocommerce](https://github.com/wp-graphql/wp-graphql-woocommerce) plugin\n\n### I encounter a bug with add to cart\n\nTry logging off wp-admin and try again.\n\n### The products page isn't loading\n\nCheck the attributes of the products. Right now the application requires Size and Color.\n"
  },
  {
    "path": "apollo/mutations/ADD_TO_CART_MUTATION.gql",
    "content": "mutation ($input: AddToCartInput!) {\n  addToCart(input: $input) {\n    cartItem {\n      key\n      product {\n        node {\n          id\n          databaseId\n          name\n          description\n          type\n          onSale\n          slug\n          averageRating\n          reviewCount\n          image {\n            id\n            sourceUrl\n            altText\n          }\n          galleryImages {\n            nodes {\n              id\n              sourceUrl\n              altText\n            }\n          }\n        }\n      }\n      variation {\n        node {\n          id\n          databaseId\n          name\n          description\n          type\n          onSale\n          price\n          regularPrice\n          salePrice\n          image {\n            id\n            sourceUrl\n            altText\n          }\n          attributes {\n            nodes {\n              id\n              attributeId\n              name\n              value\n            }\n          }\n        }\n      }\n      quantity\n      total\n      subtotal\n      subtotalTax\n    }\n  }\n}\n"
  },
  {
    "path": "apollo/mutations/CHECKOUT_MUTATION.gql",
    "content": " mutation CHECKOUT_MUTATION($input: CheckoutInput!) {\n    checkout(input: $input) {\n      result\n      redirect\n    }\n  }\n\n"
  },
  {
    "path": "apollo/mutations/UPDATE_CART_MUTATION.gql",
    "content": "mutation ($input: UpdateItemQuantitiesInput!) {\n  updateItemQuantities(input: $input) {\n    items {\n      key\n      product {\n        node {\n          id\n          databaseId\n          name\n          description\n          type\n          onSale\n          slug\n          averageRating\n          reviewCount\n          image {\n            id\n            sourceUrl\n            altText\n          }\n          galleryImages {\n            nodes {\n              id\n              sourceUrl\n              altText\n            }\n          }\n        }\n      }\n\n      variation {\n        node {\n          id\n          databaseId\n          name\n          description\n          type\n          onSale\n          price\n          regularPrice\n          salePrice\n          image {\n            id\n            sourceUrl\n            altText\n          }\n          attributes {\n            nodes {\n              id\n              attributeId\n              name\n              value\n            }\n          }\n        }\n      }\n\n      quantity\n      total\n      subtotal\n      subtotalTax\n    }\n    removed {\n      key\n      product {\n        node {\n          id\n          databaseId\n        }\n      }\n\n      variation {\n        node {\n          id\n          databaseId\n        }\n      }\n    }\n\n    updated {\n      key\n      product {\n        node {\n          id\n          databaseId\n        }\n      }\n\n      variation {\n        node {\n          id\n          databaseId\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "apollo/queries/FETCH_ALL_CATEGORIES_QUERY.gql",
    "content": "{\n  productCategories(first: 20) {\n    nodes {\n      id\n      databaseId\n      name\n      slug\n    }\n  }\n}\n"
  },
  {
    "path": "apollo/queries/FETCH_ALL_PRODUCTS_QUERY.gql",
    "content": "{\n  products(first: 24) {\n    nodes {\n      databaseId\n      name\n      onSale\n      slug\n      image {\n        sourceUrl\n      }\n      ... on SimpleProduct {\n        databaseId\n        price\n        regularPrice\n        salePrice\n      }\n      ... on VariableProduct {\n        databaseId\n        price\n        regularPrice\n        salePrice\n        variations {\n          nodes {\n            price\n            regularPrice\n            salePrice\n          }\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "apollo/queries/GET_CART_QUERY.gql",
    "content": "{\n  cart {\n    contents {\n      nodes {\n        key\n        product {\n          node {\n            id\n            databaseId\n            name\n            description\n            type\n            onSale\n            slug\n            averageRating\n            reviewCount\n            image {\n              id\n              sourceUrl\n              srcSet\n              altText\n              title\n            }\n            galleryImages {\n              nodes {\n                id\n                sourceUrl\n                srcSet\n                altText\n                title\n              }\n            }\n          }\n        }\n        variation {\n          node {\n            id\n            databaseId\n            name\n            description\n            type\n            onSale\n            price\n            regularPrice\n            salePrice\n            image {\n              id\n              sourceUrl\n              srcSet\n              altText\n              title\n            }\n            attributes {\n              nodes {\n                id\n                name\n                value\n              }\n            }\n          }\n        }\n        quantity\n        total\n        subtotal\n        subtotalTax\n      }\n    }\n\n    subtotal\n    subtotalTax\n    shippingTax\n    shippingTotal\n    total\n    totalTax\n    feeTax\n    feeTotal\n    discountTax\n    discountTotal\n  }\n}\n"
  },
  {
    "path": "apollo/queries/GET_PRODUCTS_FROM_CATEGORY_QUERY.gql",
    "content": "query ProductsFromCategory($id: ID!) {\n  productCategory(id: $id, idType: ID) {\n    id\n    name\n    products(first: 50) {\n      nodes {\n        id\n        databaseId\n        onSale\n        averageRating\n        slug\n        description\n        image {\n          id\n          uri\n          title\n          srcSet\n          sourceUrl\n        }\n        name\n        ... on SimpleProduct {\n          salePrice\n          regularPrice\n          onSale\n          price\n          id\n        }\n        ... on VariableProduct {\n          salePrice\n          regularPrice\n          onSale\n          price\n          id\n        }\n        ... on ExternalProduct {\n          price\n          id\n          externalUrl\n        }\n        ... on GroupProduct {\n          products {\n            nodes {\n              ... on SimpleProduct {\n                id\n                price\n              }\n            }\n          }\n          id\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "apollo/queries/GET_SINGLE_PRODUCT_QUERY.gql",
    "content": "query Product($id: ID!) {\n  product(id: $id, idType: DATABASE_ID) {\n    databaseId\n    averageRating\n    name\n    slug\n    description\n    onSale\n    image {\n      databaseId\n      uri\n      title\n      srcSet\n      sourceUrl\n    }\n    ... on SimpleProduct {\n      price\n      salePrice\n      regularPrice\n      databaseId\n      stockQuantity\n    }\n    ... on VariableProduct {\n      price\n      salePrice\n      regularPrice\n      databaseId\n      allPaColors {\n        nodes {\n          name\n        }\n      }\n      allPaSizes {\n        nodes {\n          name\n        }\n      }\n      variations {\n        nodes {\n          databaseId\n          name\n          stockStatus\n          stockQuantity\n          purchasable\n          onSale\n          salePrice\n          regularPrice\n        }\n      }\n    }\n    ... on ExternalProduct {\n      price\n      databaseId\n      externalUrl\n    }\n    ... on GroupProduct {\n      products {\n        nodes {\n          ... on SimpleProduct {\n            databaseId\n            price\n          }\n        }\n      }\n      id\n    }\n  }\n}\n"
  },
  {
    "path": "app.vue",
    "content": "<template>\n  <!doctype html>\n  <Html lang=\"en\">\n    <title>Nuxt 3 Woocommerce</title>\n    <Body\n      class=\"antialiased duration-300 transition-colors text-gray-800 bg-white\"\n    >\n      <NuxtLayout>\n        <NuxtLoadingIndicator :height=\"5\" :duration=\"3000\" :throttle=\"400\" />\n        <NuxtPage />\n      </NuxtLayout>\n    </Body>\n  </Html>\n</template>\n\n<script setup>\nuseHead({\n  title: \"Index\",\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n\n<style>\n.page-enter-active {\n  transition: all 0.1s ease-out;\n}\n.page-leave-active {\n  transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);\n}\n.page-enter-from,\n.page-leave-to {\n  transform: translateY(20px);\n  opacity: 0;\n}\n\n.layout-enter-active {\n  transition: all 0.1s ease-out;\n}\n.layout-leave-active {\n  transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);\n}\n.layout-enter-from,\n.layout-leave-to {\n  transform: translateY(-20px);\n  opacity: 0;\n}\n</style>\n"
  },
  {
    "path": "assets/css/main.css",
    "content": "@tailwind base;\n@tailwind components;\n@tailwind utilities;"
  },
  {
    "path": "components/Cart/CartContents.vue",
    "content": "<template>\n  <div v-if=\"isLoading && cartItems.length === 0\">\n    <h2 class=\"mt-64 text-3xl text-center\">Loading cart...</h2>\n  </div>\n  <div v-else-if=\"error && cartItems.length === 0\">\n    <h2 class=\"mt-64 text-3xl text-center text-red-500\">\n      Error loading cart. Please try again.\n    </h2>\n  </div>\n  <div v-else-if=\"cartItems.length\">\n    <h1 class=\"h-10 p-6 text-3xl font-bold text-center\">\n      Cart\n      <span v-if=\"isLoading\" class=\"text-sm text-gray-500 ml-2\">(updating...)</span>\n    </h1>\n    <section class=\"mt-10\" :class=\"{ 'opacity-70': isLoading }\">\n      <CartItem\n        v-for=\"product in cartItems\"\n        :key=\"product.key\"\n        :product=\"product\"\n        @remove=\"handleRemoveProduct\"\n        @update-quantity=\"handleUpdateQuantity\"\n      />\n    </section>\n    <CommonButton v-if=\"showCheckoutButton\" link-to=\"/checkout\" center-button>\n      CHECKOUT\n    </CommonButton>\n  </div>\n  <h2 v-else class=\"mt-64 text-3xl text-center\">Cart is currently empty</h2>\n</template>\n\n<script setup>\n/**\n * Vue.js component for handling the logic of removing a product from the cart and updating the cart state.\n *\n * @module CartContents\n * @returns {Object} The Vue.js component object.\n */\nimport { computed } from \"vue\";\nimport { useCart } from \"@/store/useCart\";\n\nconst props = defineProps({\n  showCheckoutButton: {\n    type: Boolean,\n    default: false,\n  },\n});\n\nconst cart = useCart();\n\n// Use the store's reactive state directly\nconst isLoading = computed(() => cart.loading);\nconst error = computed(() => cart.error);\nconst cartItems = computed(() => cart.cart);\n\n/**\n * Handles the removal of a product.\n *\n * @param {string} key - The key of the product to be removed.\n */\nconst handleRemoveProduct = async (key) => {\n  try {\n    await cart.removeProductFromCart(key);\n  } catch (error) {}\n};\n\n/**\n * Handles updating the quantity of a cart item.\n *\n * @param {{ key: string, quantity: number }} payload\n */\nconst handleUpdateQuantity = async ({ key, quantity }) => {\n  try {\n    await cart.updateCartItemQuantity(key, quantity);\n  } catch (error) {\n    // Optionally, add user notification here\n  }\n};\n</script>\n\n<style scoped>\n.flex-container {\n  display: flex;\n  flex-wrap: wrap;\n  flex-direction: row;\n  justify-content: space-around;\n  align-items: center;\n  align-content: center;\n  max-width: 1380px;\n  @apply border border-gray-300 rounded-lg shadow;\n}\n\n.item {\n  @apply lg:m-2 xl:m-4 xl:w-1/6 lg:w-1/6 sm:m-2 w-auto;\n}\n\n.item-content {\n  @apply inline-block mt-4 w-20 h-12 md:w-full lg:w-full xl:w-full;\n}\n\n.removing {\n  @apply animate-spin cursor-not-allowed;\n}\n</style>\n"
  },
  {
    "path": "components/Cart/CartItem.vue",
    "content": "<template>\n  <div class=\"container mx-auto mt-4 flex-container\">\n    <div class=\"item\">\n      <span class=\"block mt-2 font-extrabold\">Remove: <br /></span>\n      <span class=\"item-content\">\n        <button\n          type=\"button\"\n          @click=\"emitRemove\"\n          :disabled=\"isRemoving\"\n          class=\"flex items-center justify-center w-10 h-10 p-2 rounded-full hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-red-400 transition disabled:opacity-50\"\n          aria-label=\"Remove item from cart\"\n        >\n          <nuxt-img\n            class=\"w-7 h-7\"\n            :class=\"{ removing: isRemoving }\"\n            alt=\"Remove icon\"\n            src=\"/svg/Remove.svg\"\n            aria-hidden=\"true\"\n            draggable=\"false\"\n          />\n        </button>\n      </span>\n    </div>\n    <div class=\"item\">\n      <span class=\"block mt-2 font-extrabold\">Name: <br /></span>\n      <span class=\"item-content\">{{ product.product.name }}</span>\n    </div>\n    <div class=\"item\">\n      <span class=\"block mt-2 font-extrabold\">Quantity: <br /></span>\n      <span class=\"item-content\">\n        <CommonInput\n          :model-value=\"localQuantity\"\n          :min=\"1\"\n          :loading=\"isUpdating\"\n          @update:modelValue=\"onQuantityChange\"\n        />\n      </span>\n    </div>\n    <div class=\"item\">\n      <span class=\"block mt-2 font-extrabold\">Subtotal: <br /></span>\n      <span class=\"item-content\">{{ formatPrice(product.total) }}</span>\n    </div>\n  </div>\n</template>\n\n<script setup>\n/**\n * Vue component representing a product item in a shopping cart.\n *\n * @component CartItem\n *\n * @prop {Object} product - The product object containing information about the product.\n * @prop {Object} product.product - The product details.\n * @prop {string} product.product.name - The name of the product.\n * @prop {number} product.quantity - The quantity of the product.\n * @prop {string} product.total - The subtotal of the product.\n * @prop {string} product.key - The unique key for the cart item.\n *\n * @emits CartItem#remove - Emitted when the remove button is clicked.\n */\n\nimport { ref, watch } from \"vue\";\nimport { formatPrice } from \"@/utils/functions\";\n\nconst props = defineProps({\n  product: {\n    type: Object,\n    required: true,\n  },\n});\n\nconst isRemoving = ref(false);\nconst isUpdating = ref(false);\nconst localQuantity = ref(props.product.quantity);\n\nwatch(\n  () => props.product.quantity,\n  (newVal) => {\n    localQuantity.value = newVal;\n  },\n);\n\nconst emit = defineEmits([\"remove\", \"update-quantity\"]);\n\n/**\n * Emits a \"remove\" event with the product's key as the payload.\n */\nconst emitRemove = () => {\n  isRemoving.value = true;\n  emit(\"remove\", props.product.key);\n};\n\nconst onQuantityChange = (newQuantity) => {\n  if (newQuantity === props.product.quantity || isUpdating.value) return;\n  isUpdating.value = true;\n  emit(\"update-quantity\", { key: props.product.key, quantity: newQuantity });\n  // UI disables controls while updating; parent resets isUpdating via prop or reactivity\n  setTimeout(() => {\n    isUpdating.value = false;\n  }, 1000);\n};\n</script>\n\n<style scoped>\n.flex-container {\n  display: flex;\n  flex-wrap: wrap;\n  flex-direction: row;\n  justify-content: space-around;\n  align-items: center;\n  align-content: center;\n  max-width: 1380px;\n  @apply border border-gray-300 rounded-lg shadow;\n}\n\n.item {\n  @apply lg:m-2 xl:m-4 xl:w-1/6 lg:w-1/6 sm:m-2 w-auto text-center;\n}\n\n.item-content {\n  @apply flex justify-center items-center mt-4 w-20 h-12 md:w-full lg:w-full xl:w-full;\n}\n\n.removing {\n  @apply animate-spin cursor-not-allowed;\n}\n</style>\n"
  },
  {
    "path": "components/Category/CategoryShowAll.vue",
    "content": "<template>\n  <div v-if=\"categories.productCategories\">\n    <section class=\"bg-white\">\n      <div class=\"flex justify-center align-middle flex-col md:flex-row\">\n        <template v-for=\"nodes in categories.productCategories\">\n          <template v-for=\"category in nodes\">\n            <div v-if=\"category.slug !== undefined\" :key=\"category.id\">\n              <NuxtLink\n                class=\"text-black cursor-pointer hover:underline\"\n                :to=\"{\n                  path: '/category/' + category.slug,\n                  query: { id: category.id },\n                }\"\n              >\n                <div\n                  class=\"cursor-pointer ml-4 mt-[5rem] md:mt-[20rem] w-full md:w-64 flex-row\"\n                >\n                  <div\n                    class=\"p-4 min-w-[10rem] flex items-center justify-center w-full h-16 text-center border border-gray-300 rounded-lg shadow hover:shadow-outline\"\n                  >\n                    <p class=\"text-lg\">\n                      {{ category.name }}\n                    </p>\n                  </div>\n                </div>\n              </NuxtLink>\n            </div>\n          </template>\n        </template>\n      </div>\n    </section>\n  </div>\n</template>\n\n<script setup>\nconst props = defineProps({\n  categories: {\n    type: Object,\n    required: true,\n  },\n});\n</script>\n"
  },
  {
    "path": "components/Checkout/CheckoutForm.vue",
    "content": "<template>\n  <section class=\"text-gray-700 container p-4 py-2 mx-auto mt-8\">\n    <Form :validation-schema=\"BILLING_SCHEMA\" @submit=\"handleSubmit\">\n      <div class=\"mx-auto lg:w-1/2 flex flex-wrap\">\n        <div\n          v-for=\"field in BILLING_FIELDS\"\n          :key=\"field.inputId\"\n          class=\"w-1/2 p-2\"\n        >\n          <label :for=\"field.inputId\">{{ field.label }}</label>\n          <Field v-slot=\"{ field, meta }\" :name=\"field.inputId\">\n            <input\n              v-bind=\"field\"\n              class=\"w-full px-4 py-2 mt-2 text-base bg-white border border-gray-400 rounded focus:outline-none focus:border-black\"\n              :class=\"[\n                meta.valid\n                  ? 'border-green-700 border-2'\n                  : 'border-red-500 border-2',\n              ]\"\n            />\n          </Field>\n          <ErrorMessage v-slot=\"{ message }\" :name=\"field.inputId\">\n            <span class=\"text-lg text-red-500 font-bold\">{{\n              upperCaseFirstChar(message)\n            }}</span>\n          </ErrorMessage>\n        </div>\n        <div class=\"w-full flex justify-center mt-6\">\n          <CommonButton>SUBMIT ORDER</CommonButton>\n        </div>\n      </div>\n    </Form>\n  </section>\n</template>\n\n<script setup>\nimport { Form, Field, ErrorMessage } from \"vee-validate\";\nimport { uid } from \"uid\";\n\nimport { BILLING_FIELDS, BILLING_SCHEMA } from \"./constants/BILLING_FIELDS\";\n\nimport CHECKOUT_MUTATION from \"@/apollo/mutations/CHECKOUT_MUTATION.gql\";\n\n/**\n * Returns an input string with its first character capitalized.\n *\n * @param {string} input - The string to capitalize the first character of.\n * @return {string} The input string with the first character capitalized.\n */\nconst upperCaseFirstChar = (input) =>\n  input.charAt(0).toUpperCase() + input.slice(1);\n\nconst paymentMethod = \"cod\";\n\n/**\n * Handles the submission of a checkout form with the provided user information.\n */\nconst handleSubmit = ({\n  firstName,\n  lastName,\n  address1,\n  address2,\n  city,\n  country,\n  state,\n  postcode,\n  email,\n  phone,\n  company,\n}) => {\n  const billing = {\n    firstName,\n    lastName,\n    address1,\n    address2,\n    city,\n    country,\n    state,\n    postcode,\n    email,\n    phone,\n    company,\n  };\n\n  const checkoutData = {\n    clientMutationId: uid(),\n    billing,\n    shipping: billing,\n    shipToDifferentAddress: false,\n    paymentMethod,\n    isPaid: false,\n    transactionId: \"hjkhjkhsdsdiui\",\n  };\n\n  const variables = { input: checkoutData };\n\n  const { mutate, onDone, onError } = useMutation(CHECKOUT_MUTATION, {\n    variables,\n  });\n\n  mutate(checkoutData);\n\n  onDone(async () => await navigateTo(\"/success\"));\n\n  onError(() => alert(\"Error, order not placed\"));\n};\n</script>\n"
  },
  {
    "path": "components/Checkout/constants/BILLING_FIELDS.js",
    "content": "import { object, string, number } from \"yup\";\n\nexport const BILLING_FIELDS = [\n  {\n    inputId: \"firstName\",\n    label: \"First name\",\n  },\n  {\n    inputId: \"lastName\",\n    label: \"Last name\",\n  },\n  {\n    inputId: \"address1\",\n    label: \"Address\",\n  },\n  {\n    inputId: \"postcode\",\n    label: \"Postcode\",\n  },\n  {\n    inputId: \"city\",\n    label: \"City\",\n  },\n  {\n    inputId: \"email\",\n    label: \"Email\",\n  },\n  {\n    inputId: \"phone\",\n    label: \"Phone\",\n  },\n];\n\nexport const BILLING_SCHEMA = object().shape({\n  firstName: string().required(),\n  lastName: string().required(),\n  address1: string().required(),\n  postcode: number().required().moreThan(1111),\n  city: string().required(),\n  email: string().required().email(),\n  phone: number().required().moreThan(11_111_111),\n});\n"
  },
  {
    "path": "components/Index/IndexHero.vue",
    "content": "<template>\n  <div>\n    <div class=\"swiper\">\n      <div class=\"swiper-wrapper\">\n        <div class=\"swiper-slide\">\n          <nuxt-img\n            class=\"mx-auto w-full\"\n            alt=\"Image slider slide #1\"\n            src=\"/images/Hero.jpg\"\n          />\n          <div\n            class=\"flex flex-col items-start justify-center w-full mx-auto tracking-wide lg:w-1/2\"\n          >\n            <span\n              class=\"w-full p-4 mt-4 text-center text-white bg-black text-md lg:text-2xl lg:-mt-64\"\n            >\n              Modern Interior Sample #1\n            </span>\n          </div>\n        </div>\n\n        <div class=\"swiper-slide\">\n          <nuxt-img\n            class=\"mx-auto w-full\"\n            alt=\"Image slider slide #1\"\n            src=\"/images/Hero2.jpg\"\n          />\n          <div\n            class=\"flex flex-col items-start justify-center w-full mx-auto tracking-wide lg:w-1/2\"\n          >\n            <span\n              class=\"w-full p-4 mt-4 text-center text-white bg-black text-md lg:text-2xl lg:-mt-64\"\n            >\n              Modern Interior Sample #2\n            </span>\n          </div>\n        </div>\n        <div class=\"swiper-slide\">\n          <nuxt-img\n            class=\"mx-auto w-full\"\n            alt=\"Image slider slide #1\"\n            src=\"/images/Hero3.jpg\"\n          />\n          <div\n            class=\"flex flex-col items-start justify-center w-full mx-auto tracking-wide lg:w-1/2\"\n          >\n            <span\n              class=\"w-full p-4 mt-4 text-center text-white bg-black text-md lg:text-2xl lg:-mt-64\"\n            >\n              Modern Interior Sample #3\n            </span>\n          </div>\n        </div>\n      </div>\n      <div class=\"swiper-pagination\"></div>\n      <div class=\"swiper-button-prev\"></div>\n      <div class=\"swiper-button-next\"></div>\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { onMounted } from \"vue\";\nimport Swiper from \"swiper\";\nimport { Navigation, Pagination } from \"swiper/modules\";\n\nimport \"swiper/css\";\nimport \"swiper/css/navigation\";\nimport \"swiper/css/pagination\";\n\nonMounted(() => {\n  new Swiper(\".swiper\", {\n    modules: [Navigation, Pagination],\n    pagination: {\n      el: \".swiper-pagination\",\n    },\n    navigation: {\n      nextEl: \".swiper-button-next\",\n      prevEl: \".swiper-button-prev\",\n    },\n  });\n});\n</script>\n\n<style scoped>\n#hero {\n  max-width: 1350px;\n}\n\n.swiper {\n  width: 100%;\n}\n</style>\n"
  },
  {
    "path": "components/Layout/LayoutCart.vue",
    "content": "<template>\n  <div class=\"mt-4 lg:mt-0\">\n    <div v-if=\"isLoading\">\n      <Icon\n        name=\"ri:loader-4-line\"\n        size=\"2em\"\n        class=\"text-gray-500 animate-spin\"\n      />\n    </div>\n    <div v-else-if=\"error\">\n      <span class=\"text-xl text-red-500\">\n        Error fetching cart. Please refresh the page.\n      </span>\n    </div>\n    <NuxtLink v-else to=\"/cart\">\n      <transition name=\"cart\">\n        <span\n          v-if=\"cartLength > 0\"\n          class=\"text-xl text-white no-underline lg:text-black is-active\"\n        >\n          <span class=\"hidden lg:block\">\n            <nuxt-img\n              alt=\"Cart icon\"\n              class=\"h-12 ml-4 lg:ml-2\"\n              aria-label=\"Cart\"\n              src=\"/svg/Cart.svg\"\n            />\n          </span>\n          <span class=\"block lg:hidden\">\n            <Icon\n              name=\"ri:shopping-cart-2-line\"\n              size=\"3em\"\n              class=\"text-white lg:text-black\"\n            />\n          </span>\n        </span>\n      </transition>\n      <transition name=\"cart\">\n        <div v-if=\"cartLength > 0\">\n          <span\n            class=\"absolute w-6 h-6 pb-2 ml-16 -mt-12 text-center text-black bg-white lg:text-white lg:bg-black rounded-full lg:ml-14\"\n          >\n            {{ cartLength }}\n          </span>\n          <span class=\"text-white lg:text-black\">\n            Total: {{ formatPrice(cartSubtotal) }}\n          </span>\n        </div>\n      </transition>\n    </NuxtLink>\n  </div>\n</template>\n\n<script setup>\nimport { computed } from \"vue\";\nimport { useCart } from \"@/store/useCart\";\nimport { formatPrice } from \"@/utils/functions\";\n\nconst cart = useCart();\n\n// Use the store's reactive state directly\nconst isLoading = computed(() => cart.loading);\nconst error = computed(() => cart.error);\nconst cartLength = computed(() => cart.cartQuantity);\nconst cartSubtotal = computed(() => cart.cartSubtotal);\n</script>\n"
  },
  {
    "path": "components/Layout/LayoutFooter.vue",
    "content": "<template>\n  <div class=\"container mx-auto mt-24 max-w-[84.375rem] mb-[6.5rem] md:mb-2\">\n    <footer\n      class=\"px-6 text-center bg-white border border-gray-300 rounded-lg shadow-lg\"\n    >\n      <div class=\"p-6\">Copyright reserved &copy; {{ todayDate }} Daniel</div>\n    </footer>\n  </div>\n</template>\n\n<script setup>\nimport { computed } from \"vue\";\n\nconst todayDate = computed(() => new Date().getFullYear());\n</script>\n"
  },
  {
    "path": "components/Layout/LayoutMobileMenu.vue",
    "content": "<template>\n  <div class=\"relative\">\n    <Transition\n      enter-active-class=\"animate__animated animate__fadeInLeft\"\n      leave-active-class=\"animate__animated animate__fadeOutRight\"\n    >\n      <div\n        v-if=\"expandedMenu\"\n        ref=\"mobileMenu\"\n        class=\"fixed left-0 w-screen z-10 bg-white overflow-y-auto mobile-menu\"\n      >\n        <ul>\n          <li class=\"text-xl linkStyle\">\n            <NuxtLink to=\"/\" @click=\"displayMobileMenu\"> Home </NuxtLink>\n          </li>\n          <li class=\"text-xl linkStyle\">\n            <NuxtLink to=\"/products\" @click=\"displayMobileMenu\">\n              Products\n            </NuxtLink>\n          </li>\n          <li class=\"text-xl linkStyle\">\n            <NuxtLink to=\"/categories\" @click=\"displayMobileMenu\">\n              Categories\n            </NuxtLink>\n          </li>\n          <li class=\"text-xl linkStyle\">\n            <NuxtLink to=\"/search\" @click=\"displayMobileMenu\">\n              Search\n            </NuxtLink>\n          </li>\n        </ul>\n      </div>\n    </Transition>\n    <div class=\"w-5/12 lg:hidden\" />\n    <div class=\"flex flex-row w-2/12 px-2 my-2 lg:hidden\">\n      <div class=\"self-center block w-full mr-4\">\n        <button\n          id=\"nav-toggle\"\n          class=\"mt-2 burger burger-squeeze\"\n          aria-haspopup=\"true\"\n          :aria-expanded=\"expandedMenu\"\n          aria-controls=\"menu\"\n          aria-label=\"Navigation\"\n          :class=\"{ open: expandedMenu }\"\n          @click=\"displayMobileMenu\"\n        >\n          <div class=\"burger-lines\" />\n        </button>\n      </div>\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { ref } from \"vue\";\n\nconst expandedMenu = useState(\"expandedMenu\", () => false);\nconst mobileMenu = ref(null);\n\nconst displayMobileMenu = () => {\n  expandedMenu.value = !expandedMenu.value;\n};\n</script>\n\n<style scoped>\n.mobile-menu {\n  top: 0;\n  bottom: 80px;\n  max-height: calc(100vh - 80px);\n}\n\n.linkStyle {\n  @apply w-auto p-4 m-4 font-bold text-center border border-gray-300 border-opacity-50 shadow-md rounded;\n}\n\n.linkStyleCart {\n  @apply w-auto p-4 m-4 font-bold text-center;\n}\n\n.burger {\n  height: 3em;\n  width: 3em;\n  position: relative;\n  font-size: 14px;\n  cursor: pointer;\n  transition: 0.5s all;\n  -webkit-tap-highlight-color: transparent;\n}\n\n.burger .burger-lines:after {\n  left: 0;\n  top: -1em;\n}\n\n.burger .burger-lines:before {\n  left: 1em;\n  top: 1em;\n}\n\n.burger:after {\n  content: \"\";\n  display: block;\n  position: absolute;\n  height: 150%;\n  width: 150%;\n  top: -25%;\n  left: -25%;\n}\n\n.burger .burger-lines {\n  top: 50%;\n  margin-top: -0.125em;\n}\n\n.burger .burger-lines,\n.burger .burger-lines:after,\n.burger .burger-lines:before {\n  pointer-events: none;\n  display: block;\n  content: \"\";\n  width: 100%;\n  border-radius: 0.25em;\n  background-color: #fff;\n  height: 0.25em;\n  position: absolute;\n  transform: rotate(0);\n}\n\n.burger.burger-squeeze .burger-lines,\n.burger.burger-squeeze .burger-lines:after,\n.burger.burger-squeeze .burger-lines:before {\n  transition:\n    0.2s top 0.2s,\n    0.1s left,\n    0.2s transform,\n    0.4s background-color 0.2s;\n}\n.burger.burger-squeeze .burger-lines:after,\n.burger.burger-squeeze .burger-lines:before {\n  width: 2em;\n}\n.burger.burger-squeeze.open .burger-lines,\n.burger.burger-squeeze.open .burger-lines:after,\n.burger.burger-squeeze.open .burger-lines:before {\n  transition:\n    0.2s background-color,\n    0.2s top,\n    0.2s left,\n    0.2s transform 0.15s;\n}\n.burger.burger-squeeze.open .burger-lines {\n  background-color: transparent;\n}\n.burger.burger-squeeze.open .burger-lines:before,\n.burger.burger-squeeze.open .burger-lines:after {\n  left: 0.5em;\n  top: 0px;\n}\n.burger.burger-squeeze.open .burger-lines:before {\n  transform: rotate(-45deg);\n}\n.burger.burger-squeeze.open .burger-lines:after {\n  transform: rotate(45deg);\n}\n</style>\n"
  },
  {
    "path": "components/Layout/LayoutNavItem.vue",
    "content": "<template>\n  <ul>\n    <li\n      class=\"inline-block py-2 text-xl font-semibold no-underline lg:text-base lg:px-4\"\n    >\n      <NuxtLink :to=\"to\">\n        <span class=\"text-xl text-white no-underline lg:text-black\">\n          {{ label }}\n        </span>\n      </NuxtLink>\n    </li>\n  </ul>\n</template>\n\n<script setup>\nconst props = defineProps({\n  to: {\n    type: String,\n    required: true,\n  },\n  label: {\n    type: String,\n    required: true,\n  },\n});\n</script>\n"
  },
  {
    "path": "components/Layout/LayoutNavbar.vue",
    "content": "<template>\n  <header\n    role=\"banner\"\n    class=\"container flex flex-col justify-center px-0 pt-4 md:pt-6 mx-auto mb-6 max-w-[1400px]\"\n  >\n    <div class=\"flex flex-wrap lg:px-4 items-center\">\n      <div class=\"pr-2 my-2 lg:w-3/12 md:w-10/12\">\n        <div class=\"ml-4 lg:ml-2 mt-6\">\n          <nuxt-img\n            alt=\"Logo\"\n            class=\"h-16 lg:h-18 ml-[55px] md:ml-0\"\n            aria-label=\"Nettbutikk logo\"\n            src=\"/svg/Logo.svg\"\n          />\n        </div>\n      </div>\n\n      <div class=\"hidden lg:w-1/12 lg:block\" />\n      <div\n        id=\"nav-content\"\n        class=\"hidden w-full mt-4 bg-black lg:w-8/12 lg:block lg:bg-white lg:mt-0 lg:text-right\"\n      >\n        <div class=\"px-6 lg:px-0 lg:pt-5 xl:pt-7\">\n          <div>\n            <nav\n              id=\"block-main\"\n              role=\"navigation\"\n              aria-labelledby=\"block-main-menu\"\n            >\n              <ul\n                class=\"items-center justify-end flex-1 pr-4 -mr-4 list-reset lg:flex\"\n              >\n                <LayoutNavItem to=\"/\" label=\"Home\" />\n                <LayoutNavItem to=\"/products\" label=\"Products\" />\n                <LayoutNavItem to=\"/categories\" label=\"Categories\" />\n                <LayoutNavItem to=\"/search\" label=\"Search\" />\n                <li\n                  class=\"inline-block py-2 text-xl font-semibold no-underline lg:text-base lg:px-4\"\n                >\n                  <LayoutCart />\n                </li>\n              </ul>\n            </nav>\n          </div>\n        </div>\n      </div>\n    </div>\n  </header>\n</template>\n"
  },
  {
    "path": "components/Layout/LayoutStickyFooter.vue",
    "content": "<template>\n  <nav\n    id=\"footer\"\n    class=\"fixed bottom-0 z-50 w-full md:hidden lg:hidden xl:hidden\"\n  >\n    <div\n      class=\"container flex flex-wrap items-center justify-between px-6 py-3 mx-auto mt-0 md:min-w-96 bg-blue-800\"\n    >\n      <LayoutMobileMenu />\n      <div\n        class=\"order-3 hidden w-full md:flex md:items-center md:w-auto md:order-1\"\n        id=\"menu\"\n      ></div>\n      <div class=\"flex items-center order-2 md:order-3\" id=\"nav-content\">\n        <LayoutCart />\n      </div>\n    </div>\n  </nav>\n</template>\n"
  },
  {
    "path": "components/Products/ProductsImage.vue",
    "content": "<template>\n  <nuxt-img\n    id=\"product-image\"\n    class=\"h-auto p-8 transition duration-500 ease-in-out transform md:p-0 hover:shadow-lg hover:scale-95\"\n    :alt=\"alt\"\n    :src=\"displayedImage\"\n    :width=\"width\"\n    :height=\"height\"\n  />\n</template>\n\n<script setup>\n/**\n * Vue.js component for displaying an image with configurable properties.\n *\n * @param {Object} props - Object containing the component's properties.\n * @param {String} props.alt - The alt text for the image (required).\n * @param {String} props.src - The source URL for the image (required).\n * @param {String} [props.width] - The width of the image.\n * @param {String} [props.height] - The height of the image.\n * @returns {Object} The Vue.js component object.\n */\n\nimport { computed } from \"vue\";\n\nconst props = defineProps({\n  alt: { type: String, required: true },\n  src: { type: String, required: true },\n  width: { type: String, required: false },\n  height: { type: String, required: false },\n});\n\nconst config = useRuntimeConfig();\n\nconst displayedImage = computed(() => {\n  return props.src || config.public.placeholderImage;\n});\n</script>\n"
  },
  {
    "path": "components/Products/ProductsPrice.vue",
    "content": "<template>\n  <div>\n    <div\n      v-if=\"onSale\"\n      class=\"flex\"\n      :class=\"shouldCenterPrice ? 'justify-center' : ''\"\n    >\n      <p class=\"pt-1 mt-4 text-gray-900\" :class=\"getFontSizeClass\">\n        {{ formatPrice(displayPrice) }}\n      </p>\n      <p\n        class=\"pt-1 pl-4 mt-4 text-gray-900 line-through\"\n        :class=\"getSaleFontSizeClass\"\n      >\n        {{ formatPrice(basePrice) }}\n      </p>\n    </div>\n    <p\n      v-else\n      class=\"flex pt-1 mt-4 text-2xl text-gray-900\"\n      :class=\"shouldCenterPrice ? 'justify-center' : ''\"\n    >\n      {{ formatPrice(displayPrice) }}\n    </p>\n  </div>\n</template>\n\n<script setup>\n/**\n * Displays the price of a product, with support for sale prices and variations.\n *\n * @param {Object} props - The component props.\n * @param {Object} props.product - The product to display the price for.\n * @param {string} [props.priceFontSize=\"normal\"] - The font size for the price display.\n * @param {boolean} [props.shouldCenterPrice=false] - Whether to center the price display.\n */\nimport { computed } from \"vue\";\nimport {\n  formatPrice,\n  filteredVariantPrice,\n  hasVariations,\n} from \"@/utils/functions\";\n\nconst props = defineProps({\n  product: Object,\n  priceFontSize: String,\n  shouldCenterPrice: Boolean,\n});\n\nconst onSale = computed(() => props.product.onSale);\n\nconst productHasVariations = computed(() => hasVariations(props.product));\n\nconst basePrice = computed(() => {\n  if (productHasVariations.value) {\n    return filteredVariantPrice(props.product.price);\n  } else {\n    return props.product.regularPrice;\n  }\n});\n\nconst displayPrice = computed(() => {\n  if (onSale.value) {\n    return productHasVariations.value\n      ? filteredVariantPrice(props.product.price)\n      : props.product.salePrice;\n  } else {\n    return props.product.price;\n  }\n});\n\nconst getFontSizeClass = computed(() => {\n  switch (props.priceFontSize) {\n    case \"small\":\n      return \"text-lg\";\n    case \"normal\":\n      return \"text-2xl\";\n    case \"big\":\n      return \"text-2xl\";\n    default:\n      return \"text-xl\";\n  }\n});\n\nconst getSaleFontSizeClass = computed(() => {\n  switch (props.priceFontSize) {\n    case \"small\":\n      return \"text-lg\";\n    case \"normal\":\n      return \"text-xl\";\n    case \"big\":\n      return \"text-xl\";\n    default:\n      return \"text-xl\";\n  }\n});\n</script>\n"
  },
  {
    "path": "components/Products/ProductsShowAll.vue",
    "content": "<template>\n  <div id=\"product-container\" class=\"flex flex-wrap items-center\">\n    <template v-for=\"product in products\" :key=\"product.id\">\n      <div class=\"flex flex-col mt-6 sm:w-1/2 md:w-1/3 lg:w-1/4 lg:mr-4\">\n        <NuxtLink\n          class=\"text-black cursor-pointer hover:underline\"\n          :to=\"productLink(product)\"\n        >\n          <ProductsImage :alt=\"product.name\" :src=\"productImage(product)\" />\n          <div class=\"flex justify-center pt-3\">\n            <p class=\"text-2xl font-bold text-center cursor-pointer\">\n              {{ product.name }}\n            </p>\n          </div>\n        </NuxtLink>\n        <ProductsPrice\n          :product=\"product\"\n          priceFontSize=\"normal\"\n          :shouldCenterPrice=\"true\"\n        />\n      </div>\n    </template>\n  </div>\n</template>\n\n<script setup>\nconst config = useRuntimeConfig();\n\nconst props = defineProps({\n  products: {\n    type: Array,\n    required: true,\n  },\n});\n\n/**\n * Returns the path and query parameters for a product link.\n *\n * @param {Object} product - Object containing product information.\n * @param {string} product.slug - The product's URL slug.\n * @param {number} product.databaseId - The product's database ID.\n * @return {Object} An object containing the product's path and query parameters.\n */\nconst productLink = (product) => {\n  return {\n    path: \"/product/\" + product.slug,\n    query: { id: product.databaseId },\n  };\n};\n\n/**\n * Returns the source URL of a product image or a placeholder image if the product does not have an image.\n *\n * @param {Object} product - The product object containing the image source URL.\n * @return {string} The source URL of the product image or a placeholder image if the product does not have an image.\n */\nconst productImage = (product) =>\n  product.image ? product.image.sourceUrl : config.public.placeholderImage;\n</script>\n\n<style scoped>\na:hover {\n  border: none;\n}\n</style>\n"
  },
  {
    "path": "components/Products/ProductsSingleProduct.vue",
    "content": "<template>\n  <div class=\"product-single-container\">\n    <template v-if=\"product\">\n      <section>\n        <div class=\"container flex flex-wrap items-center pt-4 pb-12 mx-auto\">\n          <div\n            class=\"grid grid-cols-1 gap-4 mt-8 lg:grid-cols-2 xl:grid-cols-2 md:grid-cols-2 sm:grid-cols-2\"\n          >\n            <ProductsImage :alt=\"product.name\" :src=\"product.image.sourceUrl\" />\n            <div class=\"ml-8\">\n              <p class=\"text-3xl font-bold text-left\">\n                {{ product.name }}\n              </p>\n              <ProductsPrice\n                :product=\"product\"\n                :shouldCenterPrice=\"false\"\n                priceFontSize=\"big\"\n              />\n              <p class=\"pt-1 mt-6 text-2xl text-gray-900\">\n                {{ stripHTML(product.description) }}\n              </p>\n              <p\n                v-if=\"product.stockQuantity\"\n                class=\"pt-1 mt-4 text-2xl text-gray-900\"\n              >\n                {{ product.stockQuantity }} in stock\n              </p>\n              <p\n                v-if=\"product.variations\"\n                class=\"pt-1 mt-4 text-xl text-gray-900\"\n              >\n                <span class=\"py-2\">Varianter</span>\n                <select\n                  id=\"variant\"\n                  name=\"variant\"\n                  class=\"block w-64 px-6 py-2 bg-white border border-gray-500 rounded-lg focus:outline-none focus:shadow-outline\"\n                  v-model=\"selectedVariation\"\n                >\n                  <option\n                    v-for=\"(variation, index) in product.variations.nodes\"\n                    :key=\"variation.databaseId\"\n                    :value=\"variation.databaseId\"\n                    :selected=\"index === 0\"\n                  >\n                    {{ filteredVariantName(product.name, variation.name) }}\n                    ({{ variation.stockQuantity }} in stock)\n                  </option>\n                </select>\n              </p>\n              <div class=\"pt-1 mt-2\">\n                <CommonButton\n                  @common-button-click=\"addProductToCart(product)\"\n                  :is-loading=\"isLoading\"\n                >\n                  ADD TO CART\n                </CommonButton>\n              </div>\n            </div>\n          </div>\n        </div>\n      </section>\n      <CommonToast ref=\"toast\" />\n    </template>\n  </div>\n</template>\n\n<script setup>\n/**\n * Component that displays a single product.\n *\n * @component\n * @example\n * <single-product id=\"1\" slug=\"example-product\"></single-product>\n * @prop {string} id - The ID of the product to display.\n * @prop {string} slug - The slug of the product to display.\n */\n\nimport { ref, watch, computed } from \"vue\";\n\nimport { stripHTML, filteredVariantName } from \"@/utils/functions\";\n\nimport { useCart } from \"@/store/useCart\";\n\nconst cart = useCart();\n\nconst isLoading = computed(() => cart.loading);\n\nconst toast = ref(null);\n\nconst props = defineProps({\n  product: { type: Object, required: true },\n});\n\nconst selectedVariation = ref();\n\nwatch(\n  () => props.product,\n  (productValue) => {\n    if (productValue && productValue.variations?.nodes?.length > 0) {\n      selectedVariation.value = productValue.variations?.nodes[0].databaseId;\n    }\n  },\n  { immediate: true },\n);\n\n/**\n * Adds a product to the cart by calling the addToCart mutation with the given product.\n *\n * @param {object} product - The product to add to the cart.\n * @return {Promise<void>} A Promise that resolves when the product has been successfully added to the cart.\n */\nconst addProductToCart = async (product) => {\n  try {\n    await cart.addToCart(product);\n    toast.value.show();\n  } catch (error) {\n    console.error(\"Error adding product to cart\");\n  }\n};\n</script>\n"
  },
  {
    "path": "components/Spinner/SpinnerLoading.vue",
    "content": "<template>\n  <div class=\"container mx-auto\">\n    <h1 class=\"h-32 mt-24 text-5xl text-center animate-bounce text-bold\">\n      Loading ...\n    </h1>\n  </div>\n</template>\n"
  },
  {
    "path": "components/common/CommonButton.vue",
    "content": "<template>\n  <div v-if=\"linkTo\" :class=\"{ center: centerButton }\">\n    <NuxtLink :to=\"linkTo\" class=\"button-link\">\n      <button\n        :disabled=\"isLoading\"\n        :class=\"{ disabled: isLoading }\"\n        @click.stop=\"$emit('CommonButtonClick')\"\n        type=\"submit\"\n      >\n        <slot />\n        <svg\n          v-if=\"isLoading\"\n          class=\"absolute -mt-6 -ml-2 animate-spin\"\n          width=\"25\"\n          height=\"25\"\n          viewBox=\"0 0 24 24\"\n          fill=\"none\"\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          <path\n            fill-rule=\"evenodd\"\n            clip-rule=\"evenodd\"\n            d=\"M12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0ZM4.14355 13.5165C4.85219 17.2096 8.10023 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C8.0886 4 4.83283 6.80704 4.13728 10.5165L6.72824 10.5071C7.37819 8.20738 9.49236 6.52222 12.0001 6.52222C15.0254 6.52222 17.4779 8.9747 17.4779 12C17.4779 15.0253 15.0254 17.4778 12.0001 17.4778C9.49752 17.4778 7.3869 15.7995 6.73228 13.5071L4.14355 13.5165ZM9.52234 12C9.52234 13.3684 10.6317 14.4778 12.0001 14.4778C13.3685 14.4778 14.4779 13.3684 14.4779 12C14.4779 10.6316 13.3685 9.52222 12.0001 9.52222C10.6317 9.52222 9.52234 10.6316 9.52234 12Z\"\n            fill=\"white\"\n          />\n        </svg>\n      </button>\n    </NuxtLink>\n  </div>\n  <div v-else :class=\"{ center: centerButton }\">\n    <button\n      :disabled=\"isLoading\"\n      :class=\"{ disabled: isLoading }\"\n      @click.stop=\"$emit('CommonButtonClick')\"\n      type=\"submit\"\n    >\n      <slot />\n      <svg\n        v-if=\"isLoading\"\n        class=\"absolute -mt-6 -ml-2 animate-spin\"\n        width=\"25\"\n        height=\"25\"\n        viewBox=\"0 0 24 24\"\n        fill=\"none\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n      >\n        <path\n          fill-rule=\"evenodd\"\n          clip-rule=\"evenodd\"\n          d=\"M12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0ZM4.14355 13.5165C4.85219 17.2096 8.10023 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C8.0886 4 4.83283 6.80704 4.13728 10.5165L6.72824 10.5071C7.37819 8.20738 9.49236 6.52222 12.0001 6.52222C15.0254 6.52222 17.4779 8.9747 17.4779 12C17.4779 15.0253 15.0254 17.4778 12.0001 17.4778C9.49752 17.4778 7.3869 15.7995 6.73228 13.5071L4.14355 13.5165ZM9.52234 12C9.52234 13.3684 10.6317 14.4778 12.0001 14.4778C13.3685 14.4778 14.4779 13.3684 14.4779 12C14.4779 10.6316 13.3685 9.52222 12.0001 9.52222C10.6317 9.52222 9.52234 10.6316 9.52234 12Z\"\n          fill=\"white\"\n        />\n      </svg>\n    </button>\n  </div>\n</template>\n\n<script setup>\n/**\n * Vue.js component that renders a button.\n *\n * @component CommonButton\n * @example\n * <CommonButton @common-button-click=\"functionName\" is-loading=\"true\" center-button=\"false\" link-to=\"/link\">Common button</CommonButton>\n */\n\ndefineEmits([\"CommonButtonClick\"]);\n\ndefineProps({\n  isLoading: {\n    type: Boolean,\n    required: false,\n    default: false,\n  },\n  linkTo: {\n    type: String,\n    required: false,\n    default: \"\",\n  },\n  centerButton: { type: Boolean, required: false, default: false },\n});\n</script>\n\n<style scoped>\nbutton.disabled {\n  @apply bg-blue-500 text-white font-bold py-2 px-4 rounded opacity-50 cursor-not-allowed;\n}\n\n.disabled {\n  @apply bg-blue-500 text-white font-bold py-2 px-4 rounded opacity-50 cursor-not-allowed;\n}\n\nbutton {\n  @apply relative w-48 h-12 px-4 py-2 mt-4 transition ease-in-out delay-75 duration-300 font-bold text-white bg-blue-500 rounded hover:bg-blue-800;\n}\n\n.button-link {\n  border-bottom: none;\n}\n\n.center {\n  @apply flex justify-center;\n}\n</style>\n"
  },
  {
    "path": "components/common/CommonInput.vue",
    "content": "<template>\n  <div class=\"flex items-center gap-2\">\n    <button\n      aria-label=\"Decrease quantity by one\"\n      class=\"minus-button text-xl w-8 h-[34px] flex items-center justify-center rounded bg-gray-100 hover:bg-gray-200 transition disabled:text-gray-300 disabled:cursor-not-allowed\"\n      :disabled=\"loading || value <= min\"\n      @click=\"updateValue(value - 1)\"\n      type=\"button\"\n    >\n      -\n    </button>\n    <input\n      type=\"tel\"\n      pattern=\"\\d*\"\n      maxlength=\"3\"\n      :value=\"value\"\n      @input=\"onInput\"\n      class=\"quantity product-qty border-0 h-[34px] max-w-[50px] text-center bg-white focus:ring-2 focus:ring-blue-500 focus:outline-none text-lg\"\n      :disabled=\"loading\"\n      aria-label=\"Quantity\"\n      autocomplete=\"off\"\n      inputmode=\"numeric\"\n    />\n    <button\n      aria-label=\"Increase quantity by one\"\n      class=\"plus-button text-xl w-8 h-[34px] flex items-center justify-center rounded bg-gray-100 hover:bg-gray-200 transition disabled:text-gray-300 disabled:cursor-not-allowed\"\n      :disabled=\"loading || (max !== null && value >= max)\"\n      @click=\"updateValue(value + 1)\"\n      type=\"button\"\n    >\n      +\n    </button>\n  </div>\n</template>\n\n<script setup>\nimport { computed } from \"vue\";\n\nconst props = defineProps({\n  modelValue: {\n    type: Number,\n    required: true,\n  },\n  min: {\n    type: Number,\n    default: 1,\n  },\n  max: {\n    type: Number,\n    default: null,\n  },\n  loading: {\n    type: Boolean,\n    default: false,\n  },\n});\n\nconst emit = defineEmits([\"update:modelValue\"]);\n\nconst value = computed(() => props.modelValue);\n\nfunction updateValue(newValue) {\n  if (props.loading) return;\n  if (props.max !== null && newValue > props.max) return;\n  if (newValue < props.min) return;\n  emit(\"update:modelValue\", newValue);\n}\n\nfunction onInput(e) {\n  const newValue = Number(e.target.value.replace(/\\D/g, \"\"));\n  if (props.max !== null && newValue > props.max) return;\n  if (newValue < props.min) return;\n  emit(\"update:modelValue\", newValue);\n}\n</script>\n"
  },
  {
    "path": "components/common/CommonToast.vue",
    "content": "<template>\n  <Teleport to=\"body\">\n    <transition name=\"toast\">\n      <div v-if=\"isVisible\" class=\"toast-container\">\n        <div class=\"toast-content\">\n          {{ message }}\n        </div>\n      </div>\n    </transition>\n  </Teleport>\n</template>\n\n<script setup>\nimport { ref } from \"vue\";\n\nconst props = defineProps({\n  message: {\n    type: String,\n    default: \"Product added to cart\",\n  },\n  duration: {\n    type: Number,\n    default: 3000,\n  },\n});\n\nconst isVisible = ref(false);\n\nconst show = () => {\n  isVisible.value = true;\n  setTimeout(() => {\n    isVisible.value = false;\n  }, props.duration);\n};\n\ndefineExpose({ show });\n</script>\n\n<style scoped>\n.toast-container {\n  position: fixed;\n  top: 20px;\n  right: 20px;\n  z-index: 9999;\n}\n\n.toast-content {\n  background-color: #4caf50;\n  color: white;\n  padding: 16px;\n  border-radius: 4px;\n  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n}\n\n.toast-enter-active,\n.toast-leave-active {\n  transition: all 0.5s ease;\n}\n\n.toast-enter-from,\n.toast-leave-to {\n  opacity: 0;\n  transform: translateX(30px);\n}\n\n.toast-enter-to,\n.toast-leave-from {\n  opacity: 1;\n  transform: translateX(0);\n}\n</style>\n"
  },
  {
    "path": "error.vue",
    "content": "<template>\n  <main>\n    <h1>Page not found</h1>\n    <ul role=\"list\">\n      There was an error locating the page\n    </ul>\n  </main>\n</template>\n"
  },
  {
    "path": "layouts/default.vue",
    "content": "<template>\n  <div class=\"flex flex-col min-h-screen\">\n    <LayoutNavbar />\n    <div class=\"container mx-auto max-w-[84.375rem] flex-grow\">\n      <main>\n        <slot />\n      </main>\n    </div>\n    <LayoutFooter />\n    <LayoutStickyFooter />\n  </div>\n</template>\n\n<style>\n.home-enter-active,\n.home-leave-active {\n  transition: opacity 0.5s;\n}\n\n.home-enter,\n.home-leave-active {\n  opacity: 0;\n}\n\n.cart-enter-active,\n.cart-leave-active {\n  transition: all 0.5s;\n}\n\n.cart-enter,\n.cart-leave-active {\n  opacity: 0;\n  transform: translateX(-50px);\n  transform: translateY(-50px);\n}\n</style>\n"
  },
  {
    "path": "nuxt.config.js",
    "content": "import { defineNuxtConfig } from \"nuxt/config\";\n\nexport default defineNuxtConfig({\n  compatibilityDate: \"2025-07-01\",\n  ssr: true,\n  components: true,\n  css: [\"~/assets/css/main.css\", \"~/assets/css/animate.min.css\"],\n  modules: [\n    \"@pinia/nuxt\",\n    \"pinia-plugin-persistedstate/nuxt\",\n    \"@nuxtjs/apollo\",\n    \"@formkit/nuxt\",\n    \"@nuxtjs/algolia\",\n    \"nuxt-icon\",\n    \"@nuxt/image\",\n  ],\n  plugins: [\"~/plugins/apollo\", \"~/plugins/cartUpdater\"],\n  runtimeConfig: {\n    public: {\n      graphqlURL: process.env.PUBLIC_GRAPHQL_URL,\n      indexName: process.env.PUBLIC_ALGOLIA_INDEX_NAME,\n      placeholderImage: process.env.PUBLIC_PLACEHOLDER_SMALL_IMAGE_URL,\n      currencyLocale: process.env.PUBLIC_CURRENCY_LOCALE,\n      currency: process.env.PUBLIC_CURRENCY,\n    },\n  },\n  postcss: {\n    plugins: {\n      tailwindcss: {},\n      autoprefixer: {},\n    },\n  },\n  app: {\n    head: {\n      charset: \"utf-8\",\n      viewport: \"width=500, initial-scale=1\",\n      meta: [{ name: \"description\", content: \"Nuxt 3 - Woocommerce\" }],\n      link: [{ rel: \"icon\", type: \"image/svg+xml\", href: \"/favicon.svg\" }],\n    },\n    // global transition\n    pageTransition: { name: \"page\", mode: \"out-in\" },\n    layoutTransition: { name: \"layout\", mode: \"out-in\" },\n  },\n  algolia: {\n    apiKey: process.env.ALGOLIA_SEARCH_API_KEY,\n    applicationId: process.env.ALGOLIA_APPLICATION_ID,\n    instantSearch: { theme: \"algolia\" },\n  },\n  apollo: {\n    authType: \"Session\",\n    authHeader: \"woocommerce-session\",\n    tokenStorage: \"cookie\",\n    tokenName: \"woocommerce-session\",\n    clients: {\n      default: {\n        httpEndpoint: process.env.PUBLIC_GRAPHQL_URL,\n        httpLinkOptions: {\n          credentials: \"include\",\n        },\n      },\n    },\n  },\n});\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"private\": true,\n  \"version\": \"1.1.2\",\n  \"scripts\": {\n    \"build\": \"nuxt build\",\n    \"dev\": \"nuxt dev\",\n    \"generate\": \"nuxt generate\",\n    \"preview\": \"nuxt preview\",\n    \"postinstall\": \"nuxt prepare\",\n    \"format\": \"prettier --write \\\"**/*.{js,ts,vue}\\\"\",\n    \"refresh\": \"rm -rf node_modules && rm pnpm-lock.yaml && pnpm i && pnpm run format\"\n  },\n  \"devDependencies\": {\n    \"@oxc-parser/binding-linux-x64-gnu\": \"^0.124.0\",\n    \"@playwright/test\": \"^1.59.1\",\n    \"autoprefixer\": \"^10.5.0\",\n    \"nuxt\": \"^3.21.2\",\n    \"nuxt-icon\": \"^0.6.10\",\n    \"prettier\": \"^3.8.1\",\n    \"tailwindcss\": \"^3.4.19\"\n  },\n  \"dependencies\": {\n    \"@formkit/nuxt\": \"^1.7.2\",\n    \"@nuxt/image\": \"1.11.0\",\n    \"@nuxtjs/algolia\": \"^1.11.2\",\n    \"@nuxtjs/apollo\": \"5.0.0-alpha.16\",\n    \"@pinia/nuxt\": \"^0.11.3\",\n    \"graphql\": \"^16.13.2\",  \n    \"pinia\": \"^3.0.4\",\n    \"pinia-plugin-persistedstate\": \"^4.7.1\",\n    \"postcss\": \"^8.5.9\",\n    \"swiper\": \"^12.1.3\",\n    \"uid\": \"^2.0.2\",\n    \"vee-validate\": \"^4.15.1\",\n    \"vite\": \"7.3.1\",\n    \"vue\": \"^3.5.31\",\n    \"yup\": \"^1.7.1\"\n  }\n}\n"
  },
  {
    "path": "pages/cart.vue",
    "content": "<template>\n  <div>\n    <CartContents :show-checkout-button=\"true\" />\n  </div>\n</template>\n\n<script setup>\nuseHead({\n  title: \"Cart\",\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n"
  },
  {
    "path": "pages/categories.vue",
    "content": "<template>\n  <div class=\"flex justify-center items-center\">\n    <CategoryShowAll :categories=\"categories\" />\n  </div>\n</template>\n\n<script setup>\nimport FETCH_ALL_CATEGORIES_QUERY from \"@/apollo/queries/FETCH_ALL_CATEGORIES_QUERY.gql\";\nconst variables = { limit: 99 };\nconst { data: categories } = await useAsyncQuery(\n  FETCH_ALL_CATEGORIES_QUERY,\n  variables,\n);\n\nuseHead({\n  title: \"Categories\",\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n"
  },
  {
    "path": "pages/category/[category].vue",
    "content": "<template>\n  <ProductsShowAll :products=\"products\" />\n</template>\n\n<script setup>\nimport GET_PRODUCTS_FROM_CATEGORY_QUERY from \"@/apollo/queries/GET_PRODUCTS_FROM_CATEGORY_QUERY.gql\";\nconst route = useRoute();\n\nconst { data } = await useAsyncQuery(GET_PRODUCTS_FROM_CATEGORY_QUERY, {\n  id: route.query.id,\n});\nconst products = computed(\n  () => data.value?.productCategory?.products?.nodes || [],\n);\n\nuseHead({\n  title: route.params.category,\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n"
  },
  {
    "path": "pages/checkout.vue",
    "content": "<template>\n  <div>\n    <CartContents />\n    <CheckoutForm />\n  </div>\n</template>\n\n<script setup>\nuseHead({\n  title: \"Checkout\",\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n"
  },
  {
    "path": "pages/index.vue",
    "content": "<template>\n  <div>\n    <IndexHero />\n    <ProductsShowAll :products=\"products\" />\n  </div>\n</template>\n\n<script setup>\nimport FETCH_ALL_PRODUCTS_QUERY from \"@/apollo/queries/FETCH_ALL_PRODUCTS_QUERY.gql\";\n\nconst { data } = await useAsyncQuery(FETCH_ALL_PRODUCTS_QUERY);\nconst products = computed(() => data.value?.products?.nodes || []);\n\nuseHead({\n  title: \"Index\",\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n"
  },
  {
    "path": "pages/product/[product].vue",
    "content": "<template>\n  <ProductsSingleProduct :product=\"data.product\" v-if=\"data && data.product\" />\n</template>\n\n<script setup>\nimport GET_SINGLE_PRODUCT_QUERY from \"@/apollo/queries/GET_SINGLE_PRODUCT_QUERY.gql\";\n\nconst route = useRoute();\n\nconst variables = { id: route.query.id };\nconst { data } = await useAsyncQuery(GET_SINGLE_PRODUCT_QUERY, variables);\n\nuseHead({\n  title: route.params.product,\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n"
  },
  {
    "path": "pages/products.vue",
    "content": "<template>\n  <ProductsShowAll :products=\"products\" />\n</template>\n\n<script setup>\nimport FETCH_ALL_PRODUCTS_QUERY from \"@/apollo/queries/FETCH_ALL_PRODUCTS_QUERY.gql\";\n\nconst { data } = await useAsyncQuery(FETCH_ALL_PRODUCTS_QUERY);\nconst products = computed(() => data.value?.products?.nodes || []);\n\nuseHead({\n  title: \"Products\",\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n"
  },
  {
    "path": "pages/search.vue",
    "content": "<template>\n  <div>\n    <AisInstantSearch :index-name=\"indexName\" :search-client=\"algolia\">\n      <AisSearchBox />\n      <AisStats />\n      <AisRefinementList attribute=\"pa_color\" />\n      <AisHits :class-names=\"{ 'ais-Hits-item': 'CustomHitsItem' }\">\n        <template #item=\"{ item }\">\n          <NuxtLink\n            :to=\"{\n              path: '/product/' + convertProductNameToSlug(item.product_name),\n              query: { id: item.objectID },\n            }\"\n          >\n            <p class=\"p-2 text-2xl font-bold text-center\">\n              {{ item.product_name }}\n            </p>\n            <p\n              class=\"p-2 transition duration-700 ease-in-out transform cursor-pointer hover:scale-95\"\n            >\n              <nuxt-img :src=\"item.product_image\" alt=\"item.product_name\" />\n            </p>\n            <p class=\"p-2 text-xl font-bold text-center\">\n              {{ item.sale_price ? item.sale_price : item.regular_price }} kr\n            </p>\n          </NuxtLink>\n        </template>\n      </AisHits>\n      <br />\n      <AisPagination />\n    </AisInstantSearch>\n  </div>\n</template>\n\n<script setup>\nimport {\n  AisInstantSearch,\n  AisSearchBox,\n  AisRefinementList,\n  AisStats,\n  AisPagination,\n  AisHits,\n} from \"vue-instantsearch/vue3/es/index.js\";\n\nconst config = useRuntimeConfig();\n\nconst indexName = config.public.indexName || \"dfweb\";\nconst algolia = useAlgoliaRef();\n\nconst convertProductNameToSlug = (productName) =>\n  productName.replace(/ /g, \"-\").toLowerCase();\n\nuseHead({\n  title: \"Search\",\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n\n<style>\n@media (max-width: 767px) {\n  .CustomHitsItem {\n    padding: 10px;\n    width: 100%;\n  }\n}\n\n@media (min-width: 768px) {\n  .CustomHitsItem {\n    width: 47%;\n  }\n}\n\n@media (min-width: 1024px) {\n  .CustomHitsItem {\n    width: 32%;\n  }\n}\n</style>\n"
  },
  {
    "path": "pages/success.vue",
    "content": "<template>\n  <div>\n    <h1>Thank you for your order!</h1>\n    <h2>Please check your email for an order confirmation</h2>\n  </div>\n</template>\n\n<script setup>\nimport { useCart } from \"@/store/useCart\";\n\nconst cart = useCart();\n\nonBeforeMount(() => {\n  cart.clearCart();\n});\n\nuseHead({\n  title: \"Order placed\",\n  titleTemplate: \"%s - Nuxt 3 Woocommerce\",\n  meta: [\n    { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n    {\n      hid: \"description\",\n      name: \"description\",\n      content: \"Nuxt 3 Woocommerce\",\n    },\n  ],\n  link: [{ rel: \"icon\", type: \"image/x-icon\", href: \"/favicon.ico\" }],\n});\n</script>\n\n<style scoped>\nh1 {\n  @apply h-10 p-6 text-3xl font-bold text-center;\n}\n\nh2 {\n  @apply h-10 p-6 text-2xl font-bold text-center mt-4;\n}\n</style>\n"
  },
  {
    "path": "playwright.config.ts",
    "content": "import { defineConfig, devices } from \"@playwright/test\";\n\n/**\n * Read environment variables from file.\n * https://github.com/motdotla/dotenv\n */\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: \"./tests\",\n  /* Run tests in files in parallel */\n  fullyParallel: true,\n  /* Fail the build on CI if you accidentally left test.only in the source code. */\n  forbidOnly: !!process.env.CI,\n  /* Retry on CI only */\n  retries: process.env.CI ? 2 : 0,\n  /* Opt out of parallel tests on CI. */\n  workers: process.env.CI ? 1 : undefined,\n  /* Reporter to use. See https://playwright.dev/docs/test-reporters */\n  reporter: \"html\",\n  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    // baseURL: 'http://127.0.0.1:3000',\n\n    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */\n    trace: \"on-first-retry\",\n  },\n\n  /* Configure projects for major browsers */\n  projects: [\n    {\n      name: \"chromium\",\n      use: { ...devices[\"Desktop Chrome\"] },\n    },\n\n    {\n      name: \"firefox\",\n      use: { ...devices[\"Desktop Firefox\"] },\n    },\n\n    {\n      name: \"webkit\",\n      use: { ...devices[\"Desktop Safari\"] },\n    },\n\n    /* Test against mobile viewports. */\n    // {\n    //   name: 'Mobile Chrome',\n    //   use: { ...devices['Pixel 5'] },\n    // },\n    // {\n    //   name: 'Mobile Safari',\n    //   use: { ...devices['iPhone 12'] },\n    // },\n\n    /* Test against branded browsers. */\n    // {\n    //   name: 'Microsoft Edge',\n    //   use: { ...devices['Desktop Edge'], channel: 'msedge' },\n    // },\n    // {\n    //   name: 'Google Chrome',\n    //   use: { ...devices['Desktop Chrome'], channel: 'chrome' },\n    // },\n  ],\n\n  /* Run your local dev server before starting the tests */\n  // webServer: {\n  //   command: 'npm run start',\n  //   url: 'http://127.0.0.1:3000',\n  //   reuseExistingServer: !process.env.CI,\n  // },\n\n  /* Run your local dev server before starting the tests */\n  webServer: {\n    reuseExistingServer: true,\n    command: \"npm run dev\",\n    port: 3000,\n  },\n});\n"
  },
  {
    "path": "plugins/apollo.js",
    "content": "import {\n  createHttpLink,\n  ApolloLink,\n  InMemoryCache,\n  ApolloClient,\n} from \"@apollo/client/core\";\n\nimport { provideApolloClient } from \"@vue/apollo-composable\";\n\nexport default defineNuxtPlugin((nuxtApp) => {\n  const cookie = useCookie(\"woo-session\", {\n    maxAge: 1_209_600, // 14 days\n    sameSite: \"lax\",\n  });\n  const config = useRuntimeConfig();\n\n  const httpLink = createHttpLink({\n    uri: config.public.graphqlURL,\n  });\n\n  const middleware = new ApolloLink((operation, forward) => {\n    /**\n     * If session data exist in local storage, set value as session header.\n     */\n\n    if (process.client && cookie.value) {\n      operation.setContext(() => ({\n        headers: {\n          \"woocommerce-session\": `Session ${cookie.value}`,\n        },\n      }));\n    }\n\n    return forward(operation);\n  });\n\n  const afterware = new ApolloLink((operation, forward) =>\n    forward(operation).map((response) => {\n      /**\n       * Check for session header and update session in local storage accordingly.\n       */\n      const context = operation.getContext();\n\n      const {\n        response: { headers },\n      } = context;\n\n      const session = headers.get(\"woocommerce-session\") || cookie.value;\n\n      if (process.client && session) {\n        if (session !== cookie.value) {\n          cookie.value = session;\n        }\n      }\n      return response;\n    }),\n  );\n\n  // Cache implementation\n  const cache = new InMemoryCache({\n    typePolicies: {\n      Query: {\n        fields: {\n          cart: {\n            merge(existing, incoming) {\n              return incoming;\n            },\n          },\n        },\n      },\n    },\n  });\n\n  // Create the apollo client\n  const apolloClient = new ApolloClient({\n    link: middleware.concat(afterware.concat(httpLink)),\n    cache,\n    defaultOptions: {\n      watchQuery: {\n        fetchPolicy: \"cache-and-network\",\n      },\n    },\n  });\n\n  provideApolloClient(apolloClient);\n\n  nuxtApp.hook(\"apollo:auth\", ({ token }) => {\n    token.value = cookie.value;\n  });\n});\n"
  },
  {
    "path": "plugins/cartUpdater.js",
    "content": "import { useCart } from \"@/store/useCart\";\n\nexport default defineNuxtPlugin(() => {\n  useCart();\n});\n"
  },
  {
    "path": "renovate.json",
    "content": "{\n  \"extends\": [\n    \"config:recommended\"\n  ],\n  \"ignorePresets\": [\n    \":prHourlyLimit2\",\n    \":prConcurrentLimit20\"\n  ],\n  \"packageRules\": [\n    {\n      \"rangeStrategy\": \"bump\",\n      \"matchDepTypes\": [\n        \"dependencies\",\n        \"devDependencies\",\n        \"optionalDependencies\",\n        \"peerDependencies\"\n      ]\n    },\n    {\n      \"matchUpdateTypes\": [\n        \"minor\",\n        \"pin\",\n        \"digest\"\n      ],\n      \"automerge\": true,\n      \"matchDepTypes\": [\n        \"dependencies\",\n        \"devDependencies\",\n        \"optionalDependencies\",\n        \"peerDependencies\"\n      ]\n    },\n    {\n      \"matchUpdateTypes\": [\n        \"patch\",\n        \"lockFileMaintenance\"\n      ],\n      \"automerge\": false,\n      \"automergeType\": \"branch\",\n      \"matchDepTypes\": [\n        \"dependencies\",\n        \"devDependencies\",\n        \"optionalDependencies\",\n        \"peerDependencies\"\n      ]\n    }\n  ],\n  \"minimumReleaseAge\": \"3 days\"\n}\n"
  },
  {
    "path": "store/useCart.js",
    "content": "import { defineStore } from \"pinia\";\nimport { computed, ref, watch } from \"vue\";\nimport { useQuery, useMutation } from \"@vue/apollo-composable\";\n\nimport ADD_TO_CART_MUTATION from \"@/apollo/mutations/ADD_TO_CART_MUTATION.gql\";\nimport UPDATE_CART_MUTATION from \"@/apollo/mutations/UPDATE_CART_MUTATION.gql\";\nimport GET_CART_QUERY from \"@/apollo/queries/GET_CART_QUERY.gql\";\n\nexport const useCart = defineStore(\n  \"cartState\",\n  () => {\n    const cart = ref([]);\n    const cartTotals = ref({});\n\n    const {\n      result: cartData,\n      loading,\n      error,\n      refetch: refetchCart,\n    } = useQuery(\n      GET_CART_QUERY,\n      {},\n      {\n        fetchPolicy: \"cache-and-network\",\n        notifyOnNetworkStatusChange: true,\n      },\n    );\n\n    watch(\n      cartData,\n      (newCartData) => {\n        if (newCartData && newCartData.cart) {\n          updateCartState(newCartData.cart);\n        } else if (newCartData && newCartData.cart === null) {\n          updateCartState(null);\n        }\n      },\n      { immediate: true },\n    );\n\n    const updateCartState = (newCart) => {\n      if (!newCart) {\n        cart.value = [];\n        cartTotals.value = {};\n        return;\n      }\n      cart.value = newCart.contents.nodes.map((item) => ({\n        key: item.key,\n        product: item.product.node,\n        variation: item.variation ? item.variation.node : null,\n        quantity: item.quantity,\n        total: item.total,\n        subtotal: item.subtotal,\n        subtotalTax: item.subtotalTax,\n      }));\n\n      cartTotals.value = {\n        subtotal: newCart.subtotal,\n        subtotalTax: newCart.subtotalTax,\n        shippingTax: newCart.shippingTax,\n        shippingTotal: newCart.shippingTotal,\n        total: newCart.total,\n        totalTax: newCart.totalTax,\n        feeTax: newCart.feeTax,\n        feeTotal: newCart.feeTotal,\n        discountTax: newCart.discountTax,\n        discountTotal: newCart.discountTotal,\n      };\n    };\n\n    const { mutate: addToCartMutation, loading: addToCartLoading } =\n      useMutation(ADD_TO_CART_MUTATION);\n    const { mutate: updateCartMutation, loading: updateCartLoading } =\n      useMutation(UPDATE_CART_MUTATION);\n\n    const addToCart = async (product, quantity = 1) => {\n      try {\n        await addToCartMutation({\n          input: {\n            productId: product.databaseId,\n            quantity: quantity,\n          },\n        });\n        // Force refetch to ensure cache is updated\n        await refetchCart();\n      } catch (err) {\n        console.error(\"Error adding to cart:\", err);\n        // Still refetch on error to ensure consistency\n        await refetchCart();\n      }\n    };\n\n    const updateCartItemQuantity = async (key, quantity) => {\n      try {\n        await updateCartMutation({\n          input: {\n            items: Array.isArray(key) ? key : [{ key, quantity }],\n          },\n        });\n        // Force refetch to ensure cache is updated\n        await refetchCart();\n      } catch (err) {\n        console.error(\"Error updating cart item quantity:\", err);\n        // Still refetch on error to ensure consistency\n        await refetchCart();\n      }\n    };\n\n    const removeProductFromCart = async (key) => {\n      try {\n        const isLastItem = cart.value.length === 1 && cart.value[0].key === key;\n        await updateCartItemQuantity(key, 0);\n        if (isLastItem) {\n          updateCartState(null); // Clear cart locally to update UI instantly\n          await navigateTo(\"/\");\n        }\n      } catch (err) {\n        console.error(\"Error removing product from cart:\", err);\n      }\n    };\n\n    const clearCart = async () => {\n      if (!cart.value.length) return;\n      const itemKeys = cart.value.map((item) => ({\n        key: item.key,\n        quantity: 0,\n      }));\n      await updateCartItemQuantity(itemKeys);\n      updateCartState(null); // Clear cart locally\n    };\n\n    const cartQuantity = computed(() => {\n      return cart.value.reduce((total, item) => total + item.quantity, 0);\n    });\n\n    const cartSubtotal = computed(() => {\n      return cartTotals.value.subtotal || \"0\";\n    });\n\n    const cartTotal = computed(() => {\n      return cartTotals.value.total || \"0\";\n    });\n\n    return {\n      cart,\n      loading: computed(\n        () =>\n          loading.value || addToCartLoading.value || updateCartLoading.value,\n      ),\n      error,\n      cartTotals,\n      addToCart,\n      updateCartItemQuantity,\n      removeProductFromCart,\n      clearCart,\n      cartQuantity,\n      cartSubtotal,\n      cartTotal,\n      refetch: refetchCart,\n    };\n  },\n  {\n    persist: {\n      storage: piniaPluginPersistedstate.localStorage,\n      paths: [\"cart\", \"cartTotals\"],\n    },\n  },\n);\n"
  },
  {
    "path": "tailwind.config.js",
    "content": "/** @type {import('tailwindcss').Config} */\nmodule.exports = {\n  content: [\n    \"./components/**/*.{js,vue}\",\n    \"./layouts/**/*.vue\",\n    \"./pages/**/*.vue\",\n    \"./plugins/**/*.js\",\n    \"./nuxt.config.js\",\n    \"./app.vue\",\n  ],\n  theme: {\n    extend: {},\n  },\n};\n"
  },
  {
    "path": "tests/index.spec.ts",
    "content": "import { test, expect } from \"@playwright/test\";\n\ntest(\"Has Index title\", async ({ page }) => {\n  await page.goto(\"/\");\n  // Wait for the page to be fully loaded by checking for a reliable element\n  await page.waitForSelector(\"main\", { state: \"visible\" });\n  // Expect a title \"to contain\" a substring.\n  await expect(page).toHaveTitle(/Index - Nuxt 3 Woocommerce/);\n});\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"extends\": \"./.nuxt/tsconfig.json\",\n  \"compilerOptions\": {\n    \"allowJs\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"src/*\"]\n    }\n  }\n}\n"
  },
  {
    "path": "utils/functions.js",
    "content": "import { uid } from \"uid\";\n\n/**\n * Checks if the given data object has any variations by accessing the product's variations nodes array.\n *\n * @param {Object} data - The data object to check for variations\n * @return {Boolean} Returns true if there are any variations, false otherwise.\n */\nexport function hasVariations(data) {\n  // Use optional chaining to access the nodes array safely, and nullish coalescing to default to an empty array\n  const variationsNodes = data?.product?.variations?.nodes ?? [];\n  return variationsNodes.length > 0;\n}\n\n/**\n * Formats a given price into a string with a currency symbol and locale.\n *\n * @param {string} price - The price to format.\n * @param {string} currency - The currency to use. Defaults to \"NOK\".\n * @param {string} currencyLocale - The locale to use for the currency symbol. Defaults to \"nb-NO\".\n * @return {string} The formatted price as a string with the currency symbol and locale.\n */\nexport function formatPrice(price, currency, currencyLocale) {\n  // Set default values\n  const currencyPrice = currency || \"NOK\";\n  const currencySymbol = currencyLocale || \"nb-NO\";\n\n  if (!price) {\n    return;\n  }\n\n  // Convert the price string to a numerical float value\n  const numericPrice = parseFloat(price.replace(/[^\\d.]/g, \"\"));\n\n  return new Intl.NumberFormat(currencySymbol, {\n    style: \"currency\",\n    currency: currencyPrice,\n    minimumFractionDigits: 0,\n    maximumFractionDigits: 0,\n  }).format(numericPrice);\n}\n\n/**\n * Strips HTML from the inputted string\n * @param {String} description Input text to strip HTML from\n */\nexport function stripHTML(string) {\n  return string.replace(/<\\/?[^>]+(>|$)/gi, \"\");\n}\n\n/**\n * Filter variant price. Changes \"kr198.00 - kr299.00\" to kr299.00 or kr198 depending on the side variable\n * @param {String} side Which side of the string to return (which side of the \"-\" symbol)\n * @param {String} price The inputted price that we need to convert\n */\nexport const filteredVariantPrice = (price, side) => {\n  if (side === \"right\") {\n    return price.substring(price.length, price.indexOf(\"-\")).replace(\"-\", \"\");\n  }\n  return price.substring(0, price.indexOf(\"-\")).replace(\"-\", \"\");\n};\n\n/**\n * Strips product name from variant name\n * @param {String} productName Text to strip out\n * @param {String} input Input text to strip product name from\n */\nexport function filteredVariantName(productName, input) {\n  return input.replace(`${productName} -`, \"\");\n}\n\n/**\n * Prepares the checkout object based on the input data from the checkout form\n * @param {Object} form Form data to process\n */\nexport function createCheckoutData(form) {\n  return {\n    clientMutationId: uid(),\n    billing: {\n      firstName: form.firstName,\n      lastName: form.lastName,\n      address1: form.address1,\n      address2: form.address2,\n      city: form.city,\n      country: form.country,\n      state: form.state,\n      postcode: form.postcode,\n      email: form.email,\n      phone: form.phone,\n      company: form.company,\n    },\n    shipping: {\n      firstName: form.firstName,\n      lastName: form.lastName,\n      address1: form.address1,\n      address2: form.address2,\n      city: form.city,\n      country: form.country,\n      state: form.state,\n      postcode: form.postcode,\n      email: form.email,\n      phone: form.phone,\n      company: form.company,\n    },\n    shipToDifferentAddress: false,\n    paymentMethod: form.paymentMethod,\n    isPaid: false,\n    transactionId: \"test\",\n  };\n}\n\n/**\n * Get specific cookie from document.cookie\n * @param {String} cName Name of cookie to return\n */\nexport function getCookie(cName) {\n  const name = `${cName}=`;\n  const cDecoded = decodeURIComponent(document.cookie);\n  const cArr = cDecoded.split(\"; \");\n  let res;\n  cArr.forEach((val) => {\n    if (val.indexOf(name) === 0) {\n      res = val.substring(name.length);\n    }\n  });\n  return res;\n}\n"
  }
]