@ohos-ports/shopify 4.8.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +11 -0
- package/dist/acorn-7M27BPGP.js +16 -0
- package/dist/analytics-3IIUBZ3B.js +1 -0
- package/dist/analytics-OOT5AB52.js +1 -0
- package/dist/angular-DW5TQVCM.js +4 -0
- package/dist/assets/graphiql/favicon.ico +0 -0
- package/dist/assets/graphiql/style.css +58 -0
- package/dist/assets/hydrogen/bundle/analyzer.html +2056 -0
- package/dist/assets/hydrogen/i18n/domains.ts +21 -0
- package/dist/assets/hydrogen/i18n/mock-i18n-types.ts +5 -0
- package/dist/assets/hydrogen/i18n/subdomains.ts +20 -0
- package/dist/assets/hydrogen/i18n/subfolders.ts +22 -0
- package/dist/assets/hydrogen/routes/locale-check.ts +16 -0
- package/dist/assets/hydrogen/starter/.cursor/rules/hydrogen-react-router.mdc +52 -0
- package/dist/assets/hydrogen/starter/.graphqlrc.ts +29 -0
- package/dist/assets/hydrogen/starter/AGENTS.md +5 -0
- package/dist/assets/hydrogen/starter/CHANGELOG.md +2839 -0
- package/dist/assets/hydrogen/starter/CLAUDE.md +1 -0
- package/dist/assets/hydrogen/starter/README.md +45 -0
- package/dist/assets/hydrogen/starter/app/assets/favicon.svg +28 -0
- package/dist/assets/hydrogen/starter/app/components/AddToCartButton.tsx +37 -0
- package/dist/assets/hydrogen/starter/app/components/Aside.tsx +101 -0
- package/dist/assets/hydrogen/starter/app/components/CartLineItem.tsx +197 -0
- package/dist/assets/hydrogen/starter/app/components/CartMain.tsx +109 -0
- package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +300 -0
- package/dist/assets/hydrogen/starter/app/components/Footer.tsx +129 -0
- package/dist/assets/hydrogen/starter/app/components/Header.tsx +231 -0
- package/dist/assets/hydrogen/starter/app/components/MockShopNotice.tsx +20 -0
- package/dist/assets/hydrogen/starter/app/components/PageLayout.tsx +174 -0
- package/dist/assets/hydrogen/starter/app/components/PaginatedResourceSection.tsx +61 -0
- package/dist/assets/hydrogen/starter/app/components/ProductForm.tsx +150 -0
- package/dist/assets/hydrogen/starter/app/components/ProductImage.tsx +23 -0
- package/dist/assets/hydrogen/starter/app/components/ProductItem.tsx +44 -0
- package/dist/assets/hydrogen/starter/app/components/ProductPrice.tsx +27 -0
- package/dist/assets/hydrogen/starter/app/components/SearchForm.tsx +68 -0
- package/dist/assets/hydrogen/starter/app/components/SearchFormPredictive.tsx +76 -0
- package/dist/assets/hydrogen/starter/app/components/SearchResults.tsx +161 -0
- package/dist/assets/hydrogen/starter/app/components/SearchResultsPredictive.tsx +304 -0
- package/dist/assets/hydrogen/starter/app/entry.client.tsx +21 -0
- package/dist/assets/hydrogen/starter/app/entry.server.tsx +53 -0
- package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerAddressMutations.ts +64 -0
- package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerDetailsQuery.ts +40 -0
- package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerOrderQuery.ts +90 -0
- package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerOrdersQuery.ts +63 -0
- package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerUpdateMutation.ts +25 -0
- package/dist/assets/hydrogen/starter/app/lib/context.ts +65 -0
- package/dist/assets/hydrogen/starter/app/lib/fragments.ts +242 -0
- package/dist/assets/hydrogen/starter/app/lib/orderFilters.ts +90 -0
- package/dist/assets/hydrogen/starter/app/lib/redirect.ts +23 -0
- package/dist/assets/hydrogen/starter/app/lib/search.ts +79 -0
- package/dist/assets/hydrogen/starter/app/lib/session.ts +72 -0
- package/dist/assets/hydrogen/starter/app/lib/variants.ts +46 -0
- package/dist/assets/hydrogen/starter/app/root.tsx +209 -0
- package/dist/assets/hydrogen/starter/app/routes/$.tsx +11 -0
- package/dist/assets/hydrogen/starter/app/routes/[robots.txt].tsx +78 -0
- package/dist/assets/hydrogen/starter/app/routes/[sitemap.xml].tsx +16 -0
- package/dist/assets/hydrogen/starter/app/routes/_index.tsx +177 -0
- package/dist/assets/hydrogen/starter/app/routes/account.$.tsx +9 -0
- package/dist/assets/hydrogen/starter/app/routes/account._index.tsx +5 -0
- package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +516 -0
- package/dist/assets/hydrogen/starter/app/routes/account.orders.$id.tsx +222 -0
- package/dist/assets/hydrogen/starter/app/routes/account.orders._index.tsx +222 -0
- package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +133 -0
- package/dist/assets/hydrogen/starter/app/routes/account.tsx +97 -0
- package/dist/assets/hydrogen/starter/app/routes/account_.authorize.tsx +5 -0
- package/dist/assets/hydrogen/starter/app/routes/account_.login.tsx +17 -0
- package/dist/assets/hydrogen/starter/app/routes/account_.logout.tsx +11 -0
- package/dist/assets/hydrogen/starter/app/routes/blogs.$blogHandle.$articleHandle.tsx +129 -0
- package/dist/assets/hydrogen/starter/app/routes/blogs.$blogHandle._index.tsx +175 -0
- package/dist/assets/hydrogen/starter/app/routes/blogs._index.tsx +109 -0
- package/dist/assets/hydrogen/starter/app/routes/cart.$lines.tsx +70 -0
- package/dist/assets/hydrogen/starter/app/routes/cart.tsx +113 -0
- package/dist/assets/hydrogen/starter/app/routes/collections.$handle.tsx +161 -0
- package/dist/assets/hydrogen/starter/app/routes/collections._index.tsx +133 -0
- package/dist/assets/hydrogen/starter/app/routes/collections.all.tsx +122 -0
- package/dist/assets/hydrogen/starter/app/routes/discount.$code.tsx +48 -0
- package/dist/assets/hydrogen/starter/app/routes/pages.$handle.tsx +88 -0
- package/dist/assets/hydrogen/starter/app/routes/policies.$handle.tsx +93 -0
- package/dist/assets/hydrogen/starter/app/routes/policies._index.tsx +69 -0
- package/dist/assets/hydrogen/starter/app/routes/products.$handle.tsx +232 -0
- package/dist/assets/hydrogen/starter/app/routes/search.tsx +426 -0
- package/dist/assets/hydrogen/starter/app/routes/sitemap.$type.$page[.xml].tsx +23 -0
- package/dist/assets/hydrogen/starter/app/routes.ts +9 -0
- package/dist/assets/hydrogen/starter/app/styles/app.css +645 -0
- package/dist/assets/hydrogen/starter/app/styles/reset.css +139 -0
- package/dist/assets/hydrogen/starter/customer-accountapi.generated.d.ts +543 -0
- package/dist/assets/hydrogen/starter/env.d.ts +7 -0
- package/dist/assets/hydrogen/starter/eslint.config.js +247 -0
- package/dist/assets/hydrogen/starter/guides/predictiveSearch/predictiveSearch.jpg +0 -0
- package/dist/assets/hydrogen/starter/guides/predictiveSearch/predictiveSearch.md +394 -0
- package/dist/assets/hydrogen/starter/guides/search/search.jpg +0 -0
- package/dist/assets/hydrogen/starter/guides/search/search.md +335 -0
- package/dist/assets/hydrogen/starter/package.json +62 -0
- package/dist/assets/hydrogen/starter/public/.gitkeep +0 -0
- package/dist/assets/hydrogen/starter/react-router.config.ts +13 -0
- package/dist/assets/hydrogen/starter/server.ts +59 -0
- package/dist/assets/hydrogen/starter/storefrontapi.generated.d.ts +1342 -0
- package/dist/assets/hydrogen/starter/tsconfig.json +43 -0
- package/dist/assets/hydrogen/starter/vite.config.ts +44 -0
- package/dist/assets/hydrogen/tailwind/package.json +11 -0
- package/dist/assets/hydrogen/tailwind/tailwind.css +6 -0
- package/dist/assets/hydrogen/vanilla-extract/package.json +8 -0
- package/dist/assets/hydrogen/virtual-routes/assets/debug-network.css +609 -0
- package/dist/assets/hydrogen/virtual-routes/assets/favicon-dark.svg +20 -0
- package/dist/assets/hydrogen/virtual-routes/assets/favicon.svg +28 -0
- package/dist/assets/hydrogen/virtual-routes/assets/inter-variable-font.woff2 +0 -0
- package/dist/assets/hydrogen/virtual-routes/assets/jetbrainsmono-variable-font.woff2 +0 -0
- package/dist/assets/hydrogen/virtual-routes/assets/styles.css +249 -0
- package/dist/assets/hydrogen/virtual-routes/components/FlameChartWrapper.jsx +123 -0
- package/dist/assets/hydrogen/virtual-routes/components/HydrogenLogoBaseBW.jsx +32 -0
- package/dist/assets/hydrogen/virtual-routes/components/HydrogenLogoBaseColor.jsx +47 -0
- package/dist/assets/hydrogen/virtual-routes/components/IconBanner.jsx +292 -0
- package/dist/assets/hydrogen/virtual-routes/components/IconClose.jsx +38 -0
- package/dist/assets/hydrogen/virtual-routes/components/IconDiscard.jsx +44 -0
- package/dist/assets/hydrogen/virtual-routes/components/IconError.jsx +61 -0
- package/dist/assets/hydrogen/virtual-routes/components/IconGithub.jsx +23 -0
- package/dist/assets/hydrogen/virtual-routes/components/IconTwitter.jsx +21 -0
- package/dist/assets/hydrogen/virtual-routes/components/Layout.jsx +7 -0
- package/dist/assets/hydrogen/virtual-routes/components/RequestDetails.jsx +171 -0
- package/dist/assets/hydrogen/virtual-routes/components/RequestTable.jsx +91 -0
- package/dist/assets/hydrogen/virtual-routes/components/RequestWaterfall.jsx +151 -0
- package/dist/assets/hydrogen/virtual-routes/layout.jsx +33 -0
- package/dist/assets/hydrogen/virtual-routes/lib/useDebugNetworkServer.jsx +178 -0
- package/dist/assets/hydrogen/virtual-routes/routes/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.jsx +37 -0
- package/dist/assets/hydrogen/virtual-routes/routes/graphiql.jsx +5 -0
- package/dist/assets/hydrogen/virtual-routes/routes/index.jsx +265 -0
- package/dist/assets/hydrogen/virtual-routes/routes/subrequest-profiler.jsx +243 -0
- package/dist/assets/hydrogen/virtual-routes/virtual-root-with-layout.jsx +63 -0
- package/dist/assets/hydrogen/virtual-routes/virtual-root.jsx +67 -0
- package/dist/assets/hydrogen/vite/package.json +13 -0
- package/dist/assets/hydrogen/vite/vite.config.js +43 -0
- package/dist/assets/speedscope/SourceCodePro-Regular.ttf.f546cbe0.woff2 +0 -0
- package/dist/assets/speedscope/demangle-cpp.1768f4cc.js +4 -0
- package/dist/assets/speedscope/favicon-16x16.f74b3187.png +0 -0
- package/dist/assets/speedscope/favicon-32x32.bc503437.png +0 -0
- package/dist/assets/speedscope/file-format-schema.json +324 -0
- package/dist/assets/speedscope/import.bcbb2033.js +123 -0
- package/dist/assets/speedscope/index.html +2 -0
- package/dist/assets/speedscope/perf-vertx-stacks-01-collapsed-all.2681da68.txt +199 -0
- package/dist/assets/speedscope/release.txt +3 -0
- package/dist/assets/speedscope/reset.8c46b7a1.css +2 -0
- package/dist/assets/speedscope/source-code-pro.52b1676f.css +2 -0
- package/dist/assets/speedscope/source-code-pro.LICENSE.md +93 -0
- package/dist/assets/speedscope/source-map.438fa06b.js +24 -0
- package/dist/assets/speedscope/speedscope.6f107512.js +193 -0
- package/dist/babel-I2RLWM7N.js +15 -0
- package/dist/bootstrap.d.ts +5 -0
- package/dist/bootstrap.js +3 -0
- package/dist/chokidar-5RWEYTNQ.js +1 -0
- package/dist/chunk-2AK44UYM.js +1 -0
- package/dist/chunk-2CIZE537.js +3 -0
- package/dist/chunk-2EAFYCCS.js +16 -0
- package/dist/chunk-2KD4LHRT.js +5 -0
- package/dist/chunk-2KGPH7YG.js +2 -0
- package/dist/chunk-2O224ZPO.js +3 -0
- package/dist/chunk-2XDUJQQN.js +12 -0
- package/dist/chunk-36ROOKQB.js +1 -0
- package/dist/chunk-3DCN3N23.js +4 -0
- package/dist/chunk-3JXPOOFV.js +836 -0
- package/dist/chunk-4QBJ5JBX.js +18 -0
- package/dist/chunk-4ZNV5YSL.js +1 -0
- package/dist/chunk-5HBIIYSK.js +1 -0
- package/dist/chunk-5L63PRJL.js +2 -0
- package/dist/chunk-5N6HNQQ5.js +8 -0
- package/dist/chunk-5SEEDOQ5.js +1 -0
- package/dist/chunk-636CTEW7.js +1 -0
- package/dist/chunk-67Z34HN5.js +5 -0
- package/dist/chunk-6BDAJ6UD.js +5 -0
- package/dist/chunk-6CXG3XLP.js +1 -0
- package/dist/chunk-6MWWJZFN.js +19 -0
- package/dist/chunk-6QDOCBD4.js +6 -0
- package/dist/chunk-6RQOEPEC.js +1 -0
- package/dist/chunk-72ZY3KTF.js +1 -0
- package/dist/chunk-742XXXGL.js +6 -0
- package/dist/chunk-773TIA5M.js +2 -0
- package/dist/chunk-7HFHL5SO.js +2 -0
- package/dist/chunk-7ISJRIPT.js +1 -0
- package/dist/chunk-7LWUHQIF.js +1 -0
- package/dist/chunk-7T6M7FAC.js +103 -0
- package/dist/chunk-7UNQOKZW.js +1 -0
- package/dist/chunk-7Y7AZRL3.js +10 -0
- package/dist/chunk-A6BMJISP.js +8 -0
- package/dist/chunk-AAK376RT.js +2 -0
- package/dist/chunk-AEUCDGTB.js +294 -0
- package/dist/chunk-AWUX36VG.js +1 -0
- package/dist/chunk-B4OMIONW.js +5 -0
- package/dist/chunk-BOAGJ6P5.js +1 -0
- package/dist/chunk-BWJIZYAG.js +1 -0
- package/dist/chunk-BZ73NV3L.js +2 -0
- package/dist/chunk-C3RUVXG2.js +6 -0
- package/dist/chunk-C4YLE3NS.js +64 -0
- package/dist/chunk-CEYIZC3M.js +2 -0
- package/dist/chunk-CIWKN4HF.js +7 -0
- package/dist/chunk-CRALWNNO.js +1 -0
- package/dist/chunk-CTNBSUVU.js +83 -0
- package/dist/chunk-CULTZLC4.js +1 -0
- package/dist/chunk-CX5CC6P5.js +1 -0
- package/dist/chunk-CX75OKZK.js +1 -0
- package/dist/chunk-DASVZTAX.js +359 -0
- package/dist/chunk-DPNZWBT5.js +1 -0
- package/dist/chunk-DX3JLOUA.js +4 -0
- package/dist/chunk-E55KS3GZ.js +1 -0
- package/dist/chunk-E5FXOLQO.js +17 -0
- package/dist/chunk-E6N4PZZR.js +7 -0
- package/dist/chunk-EB574SY6.js +6 -0
- package/dist/chunk-ET2CGROE.js +451 -0
- package/dist/chunk-EX5GVHGE.js +1 -0
- package/dist/chunk-F3NYCSXT.js +273 -0
- package/dist/chunk-F3TMLDLC.js +1 -0
- package/dist/chunk-F6X6OXXB.js +3 -0
- package/dist/chunk-FDBHQLFK.js +1 -0
- package/dist/chunk-FDYW3UQC.js +1 -0
- package/dist/chunk-FEDVVYK2.js +1 -0
- package/dist/chunk-FFSDGRAN.js +1 -0
- package/dist/chunk-FJ6F4XRV.js +28 -0
- package/dist/chunk-FKIVKNOV.js +2 -0
- package/dist/chunk-FOREMLFZ.js +1 -0
- package/dist/chunk-FUYDGK33.js +2 -0
- package/dist/chunk-FX3L344E.js +1 -0
- package/dist/chunk-G5XIGN5D.js +593 -0
- package/dist/chunk-GAYKYEIM.js +1 -0
- package/dist/chunk-GB3YC4TI.js +1 -0
- package/dist/chunk-GCN4O7HM.js +1 -0
- package/dist/chunk-GCY7LPEF.js +6 -0
- package/dist/chunk-GNBRCK7L.js +3 -0
- package/dist/chunk-GRPKF5ZB.js +1 -0
- package/dist/chunk-GRSF7456.js +1 -0
- package/dist/chunk-H2TQ4ODI.js +1 -0
- package/dist/chunk-H6XEESUN.js +4 -0
- package/dist/chunk-HB347DXT.js +2 -0
- package/dist/chunk-HFSCXTJQ.js +97 -0
- package/dist/chunk-HHN6KZXX.js +1 -0
- package/dist/chunk-HP64ZTEJ.js +6 -0
- package/dist/chunk-I5A6BPCP.js +1 -0
- package/dist/chunk-IARCMH7G.js +5 -0
- package/dist/chunk-IBI5UCJO.js +1 -0
- package/dist/chunk-IKUSLRGD.js +1 -0
- package/dist/chunk-IT4HYLTY.js +1 -0
- package/dist/chunk-IWOTLFOY.js +32 -0
- package/dist/chunk-J3JPJCWP.js +1 -0
- package/dist/chunk-J4T73EAS.js +8 -0
- package/dist/chunk-JD5P5RAJ.js +1 -0
- package/dist/chunk-JG4HH54Q.js +1 -0
- package/dist/chunk-JIYSCWCG.js +1 -0
- package/dist/chunk-JJZNUFPD.js +44 -0
- package/dist/chunk-JLGA3B7P.js +1 -0
- package/dist/chunk-JWRK5KLD.js +560 -0
- package/dist/chunk-JX7FYWPO.js +1 -0
- package/dist/chunk-K42WBNJQ.js +18 -0
- package/dist/chunk-KDU7VW3L.js +11 -0
- package/dist/chunk-KWVOJWO7.js +1 -0
- package/dist/chunk-LANUJ7LX.js +16 -0
- package/dist/chunk-LD6ZCTZ3.js +9 -0
- package/dist/chunk-LFOBYEWG.js +1 -0
- package/dist/chunk-LQ7ENG4V.js +1 -0
- package/dist/chunk-LUKQ5HLC.js +1 -0
- package/dist/chunk-M2XHIN57.js +4 -0
- package/dist/chunk-MNOQAXJW.js +3 -0
- package/dist/chunk-MPW2YJWU.js +31 -0
- package/dist/chunk-MYQUYU4U.js +2 -0
- package/dist/chunk-N65F7ET2.js +1 -0
- package/dist/chunk-N6RBRPGW.js +7 -0
- package/dist/chunk-N75VOJHO.js +15 -0
- package/dist/chunk-NBFMP5XQ.js +1 -0
- package/dist/chunk-NE3ZFSMS.js +1 -0
- package/dist/chunk-NGLMZYS7.js +278 -0
- package/dist/chunk-NHAUJWEG.js +1 -0
- package/dist/chunk-NILETICC.js +11 -0
- package/dist/chunk-NNZXKFOS.js +7 -0
- package/dist/chunk-NQK2VCDA.js +1 -0
- package/dist/chunk-NROVZETL.js +1 -0
- package/dist/chunk-NW6NUGN7.js +1 -0
- package/dist/chunk-O7DZXO3O.js +15 -0
- package/dist/chunk-OBYQSIYU.js +25 -0
- package/dist/chunk-OEG3N5PG.js +15 -0
- package/dist/chunk-OGBZTY2G.js +5 -0
- package/dist/chunk-OMHR423H.js +1 -0
- package/dist/chunk-OV6SRRXR.js +5 -0
- package/dist/chunk-OVV5YGKN.js +1 -0
- package/dist/chunk-OZL5FTT7.js +1 -0
- package/dist/chunk-OZMQ2EJB.js +1 -0
- package/dist/chunk-P2OI2P2M.js +1 -0
- package/dist/chunk-P57P7UAN.js +3 -0
- package/dist/chunk-PATTG7YZ.js +1 -0
- package/dist/chunk-PG5YNPJB.js +26 -0
- package/dist/chunk-PP4L2JJ6.js +3 -0
- package/dist/chunk-Q5JX23QU.js +1 -0
- package/dist/chunk-Q5KVMLBK.js +4 -0
- package/dist/chunk-Q5LIJGT7.js +12 -0
- package/dist/chunk-Q6ADIMJM.js +6 -0
- package/dist/chunk-Q7BOSHWX.js +7 -0
- package/dist/chunk-QERQARMC.js +1 -0
- package/dist/chunk-QOV43E26.js +1 -0
- package/dist/chunk-QTFUYKMF.js +1 -0
- package/dist/chunk-QTJCCOAG.js +20 -0
- package/dist/chunk-R6ICQT2D.js +1 -0
- package/dist/chunk-R7T3LYJL.js +3 -0
- package/dist/chunk-RJ5VF3QY.js +2 -0
- package/dist/chunk-RXQJCJDV.js +1 -0
- package/dist/chunk-S2TLBBSS.js +5 -0
- package/dist/chunk-S5FOQY35.js +1 -0
- package/dist/chunk-SYLHT42O.js +1 -0
- package/dist/chunk-T4AA6TSF.js +15 -0
- package/dist/chunk-T4QWK5GG.js +10 -0
- package/dist/chunk-T7KHS6RF.js +1 -0
- package/dist/chunk-T7PJDT5O.js +6 -0
- package/dist/chunk-TEY4LRY7.js +1 -0
- package/dist/chunk-TFBRVLDN.js +1 -0
- package/dist/chunk-TOLPNBZK.js +4 -0
- package/dist/chunk-TR4OWSEX.js +77 -0
- package/dist/chunk-TU47HMTL.js +1 -0
- package/dist/chunk-TUVDJ3PG.js +2 -0
- package/dist/chunk-TYMYIUIQ.js +1 -0
- package/dist/chunk-U2DWBZK2.js +1 -0
- package/dist/chunk-U53OLUOE.js +3 -0
- package/dist/chunk-UAETNFN4.js +1 -0
- package/dist/chunk-UAFEFKAQ.js +5 -0
- package/dist/chunk-ULRJDKWQ.js +1 -0
- package/dist/chunk-UOHNRH6E.js +7 -0
- package/dist/chunk-UZARYOLN.js +1 -0
- package/dist/chunk-VASGXHYA.js +1 -0
- package/dist/chunk-VD4XJ6BX.js +1 -0
- package/dist/chunk-VE35YELD.js +1 -0
- package/dist/chunk-VFM2KQRM.js +19 -0
- package/dist/chunk-VJEKDBGZ.js +1 -0
- package/dist/chunk-VKWPEFWQ.js +1 -0
- package/dist/chunk-VSDRNYA5.js +1 -0
- package/dist/chunk-VUMUCNI7.js +1 -0
- package/dist/chunk-VVZSYHDG.js +4 -0
- package/dist/chunk-VXEYO3ZP.js +1 -0
- package/dist/chunk-VYDSOAV4.js +9 -0
- package/dist/chunk-W6ST525S.js +99 -0
- package/dist/chunk-WBYAGS6B.js +6 -0
- package/dist/chunk-WGAFCKGD.js +1 -0
- package/dist/chunk-WYBTC356.js +1 -0
- package/dist/chunk-XF2KTEID.js +1 -0
- package/dist/chunk-XH5YGJQR.js +1 -0
- package/dist/chunk-XHKWITLA.js +1705 -0
- package/dist/chunk-XOCB4KNX.js +2 -0
- package/dist/chunk-XUUAKGEX.js +1 -0
- package/dist/chunk-XUYVJEZG.js +3 -0
- package/dist/chunk-Y47C3LSX.js +3 -0
- package/dist/chunk-Y5PRPHLQ.js +6 -0
- package/dist/chunk-YD2VQEN5.js +1 -0
- package/dist/chunk-YESGYUEL.js +1 -0
- package/dist/chunk-YEVGLC5X.js +1 -0
- package/dist/chunk-YFINLODF.js +375 -0
- package/dist/chunk-YKL3BLWC.js +46 -0
- package/dist/chunk-YLQ3LNNY.js +99 -0
- package/dist/chunk-YLXPYXQP.js +1 -0
- package/dist/chunk-YNDIZCD2.js +7 -0
- package/dist/chunk-YPWHD3NL.js +1 -0
- package/dist/chunk-YSAFHVV6.js +8 -0
- package/dist/chunk-YY6TFARF.js +1 -0
- package/dist/chunk-YZMY2CTU.js +10 -0
- package/dist/chunk-Z4AFEO36.js +1 -0
- package/dist/chunk-Z5WPP6ME.js +1 -0
- package/dist/chunk-Z65E4UAP.js +1 -0
- package/dist/chunk-ZDF5N422.js +1 -0
- package/dist/chunk-ZDRIQC7O.js +1 -0
- package/dist/chunk-ZH44BDUR.js +5 -0
- package/dist/chunk-ZI7LK3LW.js +11 -0
- package/dist/chunk-ZL5LU4U2.js +32 -0
- package/dist/chunk-ZYX7UHCQ.js +1 -0
- package/dist/chunk-ZZRFG6ME.js +317 -0
- package/dist/cli/commands/app/app-logs/sources.js +1 -0
- package/dist/cli/commands/app/build.js +1 -0
- package/dist/cli/commands/app/bulk/cancel.js +1 -0
- package/dist/cli/commands/app/bulk/execute.js +1 -0
- package/dist/cli/commands/app/bulk/status.js +1 -0
- package/dist/cli/commands/app/config/link.js +1 -0
- package/dist/cli/commands/app/config/pull.js +1 -0
- package/dist/cli/commands/app/config/use.js +1 -0
- package/dist/cli/commands/app/config/validate.js +1 -0
- package/dist/cli/commands/app/demo/watcher.js +1 -0
- package/dist/cli/commands/app/deploy.js +1 -0
- package/dist/cli/commands/app/dev/clean.js +1 -0
- package/dist/cli/commands/app/dev.js +1 -0
- package/dist/cli/commands/app/doctor/instructions.js +1 -0
- package/dist/cli/commands/app/doctor.js +1 -0
- package/dist/cli/commands/app/env/pull.js +1 -0
- package/dist/cli/commands/app/env/show.js +1 -0
- package/dist/cli/commands/app/execute.js +1 -0
- package/dist/cli/commands/app/function/build.js +1 -0
- package/dist/cli/commands/app/function/info.js +1 -0
- package/dist/cli/commands/app/function/replay.js +1 -0
- package/dist/cli/commands/app/function/run.js +1 -0
- package/dist/cli/commands/app/function/schema.js +1 -0
- package/dist/cli/commands/app/function/typegen.js +1 -0
- package/dist/cli/commands/app/generate/extension.js +1 -0
- package/dist/cli/commands/app/graphiql.js +1 -0
- package/dist/cli/commands/app/import-custom-data-definitions.js +1 -0
- package/dist/cli/commands/app/import-extensions.js +1 -0
- package/dist/cli/commands/app/info.js +1 -0
- package/dist/cli/commands/app/init.js +1 -0
- package/dist/cli/commands/app/logs.js +1 -0
- package/dist/cli/commands/app/release.js +1 -0
- package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -0
- package/dist/cli/commands/app/subscription-migrations/list.js +1 -0
- package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -0
- package/dist/cli/commands/app/subscription-migrations/status.js +1 -0
- package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -0
- package/dist/cli/commands/app/versions/list.js +1 -0
- package/dist/cli/commands/app/webhook/trigger.js +1 -0
- package/dist/cli/commands/auth/login.d.ts +8 -0
- package/dist/cli/commands/auth/login.js +1 -0
- package/dist/cli/commands/auth/logout.d.ts +5 -0
- package/dist/cli/commands/auth/logout.js +1 -0
- package/dist/cli/commands/cache/clear.d.ts +6 -0
- package/dist/cli/commands/cache/clear.js +1 -0
- package/dist/cli/commands/config/autoupgrade/constants.d.ts +4 -0
- package/dist/cli/commands/config/autoupgrade/constants.js +1 -0
- package/dist/cli/commands/config/autoupgrade/off.d.ts +7 -0
- package/dist/cli/commands/config/autoupgrade/off.js +1 -0
- package/dist/cli/commands/config/autoupgrade/on.d.ts +7 -0
- package/dist/cli/commands/config/autoupgrade/on.js +1 -0
- package/dist/cli/commands/config/autoupgrade/status.d.ts +7 -0
- package/dist/cli/commands/config/autoupgrade/status.js +1 -0
- package/dist/cli/commands/debug/command-flags.d.ts +9 -0
- package/dist/cli/commands/debug/command-flags.js +1 -0
- package/dist/cli/commands/doc/fetch.d.ts +12 -0
- package/dist/cli/commands/doc/fetch.js +1 -0
- package/dist/cli/commands/doc/search.d.ts +13 -0
- package/dist/cli/commands/doc/search.js +1 -0
- package/dist/cli/commands/docs/generate.d.ts +21 -0
- package/dist/cli/commands/docs/generate.js +1 -0
- package/dist/cli/commands/doctor-release/doctor-release.d.ts +6 -0
- package/dist/cli/commands/doctor-release/doctor-release.js +1 -0
- package/dist/cli/commands/doctor-release/theme/index.d.ts +14 -0
- package/dist/cli/commands/doctor-release/theme/index.js +1 -0
- package/dist/cli/commands/help.d.ts +13 -0
- package/dist/cli/commands/help.js +1 -0
- package/dist/cli/commands/kitchen-sink/async.d.ts +11 -0
- package/dist/cli/commands/kitchen-sink/async.js +1 -0
- package/dist/cli/commands/kitchen-sink/index.d.ts +12 -0
- package/dist/cli/commands/kitchen-sink/index.js +1 -0
- package/dist/cli/commands/kitchen-sink/prompts.d.ts +11 -0
- package/dist/cli/commands/kitchen-sink/prompts.js +1 -0
- package/dist/cli/commands/kitchen-sink/static.d.ts +11 -0
- package/dist/cli/commands/kitchen-sink/static.js +1 -0
- package/dist/cli/commands/notifications/generate.d.ts +6 -0
- package/dist/cli/commands/notifications/generate.js +1 -0
- package/dist/cli/commands/notifications/list.d.ts +9 -0
- package/dist/cli/commands/notifications/list.js +1 -0
- package/dist/cli/commands/organization/list.js +1 -0
- package/dist/cli/commands/search.d.ts +14 -0
- package/dist/cli/commands/search.js +1 -0
- package/dist/cli/commands/send-analytics.d.ts +5 -0
- package/dist/cli/commands/send-analytics.js +1 -0
- package/dist/cli/commands/theme/check.js +1 -0
- package/dist/cli/commands/theme/console.js +1 -0
- package/dist/cli/commands/theme/delete.js +1 -0
- package/dist/cli/commands/theme/dev.js +1 -0
- package/dist/cli/commands/theme/duplicate.js +1 -0
- package/dist/cli/commands/theme/info.js +1 -0
- package/dist/cli/commands/theme/init.js +1 -0
- package/dist/cli/commands/theme/language-server.js +1 -0
- package/dist/cli/commands/theme/list.js +1 -0
- package/dist/cli/commands/theme/metafields/pull.js +1 -0
- package/dist/cli/commands/theme/open.js +1 -0
- package/dist/cli/commands/theme/package.js +1 -0
- package/dist/cli/commands/theme/preview.js +1 -0
- package/dist/cli/commands/theme/profile.js +1 -0
- package/dist/cli/commands/theme/publish.js +1 -0
- package/dist/cli/commands/theme/pull.js +1 -0
- package/dist/cli/commands/theme/push.js +1 -0
- package/dist/cli/commands/theme/rename.js +1 -0
- package/dist/cli/commands/theme/share.js +1 -0
- package/dist/cli/commands/upgrade.d.ts +7 -0
- package/dist/cli/commands/upgrade.js +1 -0
- package/dist/cli/commands/version.d.ts +5 -0
- package/dist/cli/commands/version.js +1 -0
- package/dist/cli/help.d.ts +38 -0
- package/dist/cli/help.js +2 -0
- package/dist/cli/services/commands/doc/fetch.d.ts +1 -0
- package/dist/cli/services/commands/doc/fetch.js +45 -0
- package/dist/cli/services/commands/doc/search.d.ts +1 -0
- package/dist/cli/services/commands/doc/search.js +47 -0
- package/dist/cli/services/commands/notifications.d.ts +2 -0
- package/dist/cli/services/commands/notifications.js +106 -0
- package/dist/cli/services/commands/search.d.ts +1 -0
- package/dist/cli/services/commands/search.js +7 -0
- package/dist/cli/services/commands/version.d.ts +1 -0
- package/dist/cli/services/commands/version.js +6 -0
- package/dist/cli/services/doctor-release/context.d.ts +16 -0
- package/dist/cli/services/doctor-release/context.js +11 -0
- package/dist/cli/services/doctor-release/theme/runner.d.ts +7 -0
- package/dist/cli/services/doctor-release/theme/runner.js +37 -0
- package/dist/cli/services/doctor-release/theme/tests/init.d.ts +11 -0
- package/dist/cli/services/doctor-release/theme/tests/init.js +34 -0
- package/dist/cli/services/doctor-release/theme/tests/push.d.ts +10 -0
- package/dist/cli/services/doctor-release/theme/tests/push.js +44 -0
- package/dist/cli/services/kitchen-sink/async.d.ts +1 -0
- package/dist/cli/services/kitchen-sink/async.js +65 -0
- package/dist/cli/services/kitchen-sink/prompts.d.ts +1 -0
- package/dist/cli/services/kitchen-sink/prompts.js +168 -0
- package/dist/cli/services/kitchen-sink/static.d.ts +1 -0
- package/dist/cli/services/kitchen-sink/static.js +201 -0
- package/dist/command-registry.d.ts +8 -0
- package/dist/command-registry.js +1 -0
- package/dist/conf-store-ASDCTDQ4.js +1 -0
- package/dist/configs/all.yml +280 -0
- package/dist/configs/nothing.yml +3 -0
- package/dist/configs/recommended.yml +258 -0
- package/dist/configs/theme-app-extension.yml +24 -0
- package/dist/custom-oclif-loader-BWAMUFQ4.js +1 -0
- package/dist/data/app_block_entry.json +13 -0
- package/dist/data/default_setting_values.json +24 -0
- package/dist/data/filters.json +6177 -0
- package/dist/data/latest.json +2 -0
- package/dist/data/local_block_entry.json +25 -0
- package/dist/data/manifest_theme.json +19 -0
- package/dist/data/manifest_theme_app_extension.json +10 -0
- package/dist/data/objects.json +20621 -0
- package/dist/data/preset.json +72 -0
- package/dist/data/preset_blocks.json +91 -0
- package/dist/data/section.json +208 -0
- package/dist/data/setting.json +1538 -0
- package/dist/data/settings.json +10 -0
- package/dist/data/shopify_system_translations.json +2766 -0
- package/dist/data/tags.json +1276 -0
- package/dist/data/targetted_block_entry.json +15 -0
- package/dist/data/theme_block.json +91 -0
- package/dist/data/theme_block_entry.json +14 -0
- package/dist/data/theme_settings.json +83 -0
- package/dist/data/translations.json +63 -0
- package/dist/deprecations-VBQV7Q4O.js +1 -0
- package/dist/devtools-37DE4MUR.js +1 -0
- package/dist/devtools-WAWU5KQL.js +1 -0
- package/dist/dist-FZLOAKU7.js +1 -0
- package/dist/dist-HTY6UHG5.js +1 -0
- package/dist/environments-HSTNEQRG.js +1 -0
- package/dist/error-2LZYKRMA.js +1 -0
- package/dist/error-handler-PIGEJ7BT.js +1 -0
- package/dist/estree-JV5M77BA.js +44 -0
- package/dist/flow-N4JYPYMQ.js +20 -0
- package/dist/fs-BJHNJDDK.js +1 -0
- package/dist/glimmer-JEV3BXHR.js +37 -0
- package/dist/graphql-DTF6MHYF.js +28 -0
- package/dist/hooks/did-you-mean.d.ts +1 -0
- package/dist/hooks/did-you-mean.js +1 -0
- package/dist/hooks/hydrogen-init.d.ts +7 -0
- package/dist/hooks/hydrogen-init.js +1 -0
- package/dist/hooks/plugin-plugins.d.ts +1 -0
- package/dist/hooks/plugin-plugins.js +1 -0
- package/dist/hooks/postrun.d.ts +1 -0
- package/dist/hooks/postrun.js +1 -0
- package/dist/hooks/prerun.d.ts +1 -0
- package/dist/hooks/prerun.js +2 -0
- package/dist/hooks/public-metadata.d.ts +1 -0
- package/dist/hooks/public-metadata.js +1 -0
- package/dist/hooks/sensitive-metadata.d.ts +1 -0
- package/dist/hooks/sensitive-metadata.js +1 -0
- package/dist/hooks/tunnel-provider.d.ts +1 -0
- package/dist/hooks/tunnel-provider.js +1 -0
- package/dist/hooks/tunnel-start.d.ts +1 -0
- package/dist/hooks/tunnel-start.js +1 -0
- package/dist/html-LVOJ3RQS.js +25 -0
- package/dist/http-proxy-node16-A6AKKRQH.js +38 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +120 -0
- package/dist/is-global-6SCOAJVG.js +1 -0
- package/dist/latest-version-LDWU5F7A.js +49 -0
- package/dist/lib-2BR2WN7L.js +1 -0
- package/dist/lib-M72BVWQ3.js +1 -0
- package/dist/lib-O5EZ4NVT.js +1 -0
- package/dist/lib-P3APEIHY.js +1 -0
- package/dist/local-PZWPRFU7.js +1 -0
- package/dist/markdown-J6CE6POI.js +62 -0
- package/dist/meriyah-PNQQZQYI.js +5 -0
- package/dist/metadata-VVBHB3HL.js +1 -0
- package/dist/morph-BMYYMQNX.js +30489 -0
- package/dist/multipart-parser-5NSSTW27.js +2 -0
- package/dist/node-package-manager-ETYQN7OM.js +1 -0
- package/dist/notifications-system-652OG5KL.js +1 -0
- package/dist/npa-A4YSCQ5Q.js +1 -0
- package/dist/open-KLSGXBIW.js +1 -0
- package/dist/os-7D6NT4O3.js +1 -0
- package/dist/out-53ABAVL7.js +1 -0
- package/dist/output-74VDGYJD.js +1 -0
- package/dist/path-MBXP7ZIC.js +1 -0
- package/dist/postcss-Q36SHOML.js +61 -0
- package/dist/prettier-EGVCP5CY.js +1 -0
- package/dist/source-map-E7FCCJL7.js +1 -0
- package/dist/system-P5QIJALL.js +1 -0
- package/dist/templates/ui-extensions/html/error.html.liquid +41 -0
- package/dist/templates/ui-extensions/html/post_purchase/index.html.liquid +44 -0
- package/dist/templates/ui-extensions/html/post_purchase/tunnel-error.html.liquid +41 -0
- package/dist/templates/ui-extensions/html/tunnel-error.html.liquid +55 -0
- package/dist/toml_patch_bg.wasm +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/typescript-5R4Y7PXE.js +1 -0
- package/dist/typescript-WYPDGPSV.js +21 -0
- package/dist/ui-H5I5YVKV.js +1 -0
- package/dist/upgrade-34HSYBXI.js +1 -0
- package/dist/vendor/esbuild-ohos/lib/main.js +2538 -0
- package/dist/vendor/esbuild-ohos/package.json +7 -0
- package/dist/version-EKXEAF6Q.js +1 -0
- package/dist/version-J2PYO6M5.js +1 -0
- package/dist/workerd-X4TGHEG3.js +18 -0
- package/dist/yaml-6KWCJ64X.js +159 -0
- package/dist/yoga.wasm +0 -0
- package/oclif.manifest.json +10100 -0
- package/package.json +153 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {useLoaderData, Link} from 'react-router';
|
|
2
|
+
import type {Route} from './+types/policies._index';
|
|
3
|
+
import type {PoliciesQuery, PolicyItemFragment} from 'storefrontapi.generated';
|
|
4
|
+
|
|
5
|
+
export async function loader({context}: Route.LoaderArgs) {
|
|
6
|
+
const data: PoliciesQuery = await context.storefront.query(POLICIES_QUERY);
|
|
7
|
+
|
|
8
|
+
const shopPolicies = data.shop;
|
|
9
|
+
const policies: PolicyItemFragment[] = [
|
|
10
|
+
shopPolicies?.privacyPolicy,
|
|
11
|
+
shopPolicies?.shippingPolicy,
|
|
12
|
+
shopPolicies?.termsOfService,
|
|
13
|
+
shopPolicies?.refundPolicy,
|
|
14
|
+
shopPolicies?.subscriptionPolicy,
|
|
15
|
+
].filter((policy): policy is PolicyItemFragment => policy != null);
|
|
16
|
+
|
|
17
|
+
if (!policies.length) {
|
|
18
|
+
throw new Response('No policies found', {status: 404});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return {policies};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default function Policies() {
|
|
25
|
+
const {policies} = useLoaderData<typeof loader>();
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div className="policies">
|
|
29
|
+
<h1>Policies</h1>
|
|
30
|
+
<div>
|
|
31
|
+
{policies.map((policy) => (
|
|
32
|
+
<fieldset key={policy.id}>
|
|
33
|
+
<Link to={`/policies/${policy.handle}`}>{policy.title}</Link>
|
|
34
|
+
</fieldset>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const POLICIES_QUERY = `#graphql
|
|
42
|
+
fragment PolicyItem on ShopPolicy {
|
|
43
|
+
id
|
|
44
|
+
title
|
|
45
|
+
handle
|
|
46
|
+
}
|
|
47
|
+
query Policies ($country: CountryCode, $language: LanguageCode)
|
|
48
|
+
@inContext(country: $country, language: $language) {
|
|
49
|
+
shop {
|
|
50
|
+
privacyPolicy {
|
|
51
|
+
...PolicyItem
|
|
52
|
+
}
|
|
53
|
+
shippingPolicy {
|
|
54
|
+
...PolicyItem
|
|
55
|
+
}
|
|
56
|
+
termsOfService {
|
|
57
|
+
...PolicyItem
|
|
58
|
+
}
|
|
59
|
+
refundPolicy {
|
|
60
|
+
...PolicyItem
|
|
61
|
+
}
|
|
62
|
+
subscriptionPolicy {
|
|
63
|
+
id
|
|
64
|
+
title
|
|
65
|
+
handle
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
` as const;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import {redirect, useLoaderData} from 'react-router';
|
|
2
|
+
import type {Route} from './+types/products.$handle';
|
|
3
|
+
import {
|
|
4
|
+
getSelectedProductOptions,
|
|
5
|
+
Analytics,
|
|
6
|
+
useOptimisticVariant,
|
|
7
|
+
getProductOptions,
|
|
8
|
+
getAdjacentAndFirstAvailableVariants,
|
|
9
|
+
useSelectedOptionInUrlParam,
|
|
10
|
+
} from '@shopify/hydrogen';
|
|
11
|
+
import {ProductPrice} from '~/components/ProductPrice';
|
|
12
|
+
import {ProductImage} from '~/components/ProductImage';
|
|
13
|
+
import {ProductForm} from '~/components/ProductForm';
|
|
14
|
+
import {redirectIfHandleIsLocalized} from '~/lib/redirect';
|
|
15
|
+
|
|
16
|
+
export const meta: Route.MetaFunction = ({data}) => {
|
|
17
|
+
return [
|
|
18
|
+
{title: `Hydrogen | ${data?.product.title ?? ''}`},
|
|
19
|
+
{
|
|
20
|
+
rel: 'canonical',
|
|
21
|
+
href: `/products/${data?.product.handle}`,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export async function loader(args: Route.LoaderArgs) {
|
|
27
|
+
// Start fetching non-critical data without blocking time to first byte
|
|
28
|
+
const deferredData = loadDeferredData(args);
|
|
29
|
+
|
|
30
|
+
// Await the critical data required to render initial state of the page
|
|
31
|
+
const criticalData = await loadCriticalData(args);
|
|
32
|
+
|
|
33
|
+
return {...deferredData, ...criticalData};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Load data necessary for rendering content above the fold. This is the critical data
|
|
38
|
+
* needed to render the page. If it's unavailable, the whole page should 400 or 500 error.
|
|
39
|
+
*/
|
|
40
|
+
async function loadCriticalData({context, params, request}: Route.LoaderArgs) {
|
|
41
|
+
const {handle} = params;
|
|
42
|
+
const {storefront} = context;
|
|
43
|
+
|
|
44
|
+
if (!handle) {
|
|
45
|
+
throw new Error('Expected product handle to be defined');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const [{product}] = await Promise.all([
|
|
49
|
+
storefront.query(PRODUCT_QUERY, {
|
|
50
|
+
variables: {handle, selectedOptions: getSelectedProductOptions(request)},
|
|
51
|
+
}),
|
|
52
|
+
// Add other queries here, so that they are loaded in parallel
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
if (!product?.id) {
|
|
56
|
+
throw new Response(null, {status: 404});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// The API handle might be localized, so redirect to the localized handle
|
|
60
|
+
redirectIfHandleIsLocalized(request, {handle, data: product});
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
product,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Load data for rendering content below the fold. This data is deferred and will be
|
|
69
|
+
* fetched after the initial page load. If it's unavailable, the page should still 200.
|
|
70
|
+
* Make sure to not throw any errors here, as it will cause the page to 500.
|
|
71
|
+
*/
|
|
72
|
+
function loadDeferredData({context, params}: Route.LoaderArgs) {
|
|
73
|
+
// Put any API calls that is not critical to be available on first page render
|
|
74
|
+
// For example: product reviews, product recommendations, social feeds.
|
|
75
|
+
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default function Product() {
|
|
80
|
+
const {product} = useLoaderData<typeof loader>();
|
|
81
|
+
|
|
82
|
+
// Optimistically selects a variant with given available variant information
|
|
83
|
+
const selectedVariant = useOptimisticVariant(
|
|
84
|
+
product.selectedOrFirstAvailableVariant,
|
|
85
|
+
getAdjacentAndFirstAvailableVariants(product),
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// Sets the search param to the selected variant without navigation
|
|
89
|
+
// only when no search params are set in the url
|
|
90
|
+
useSelectedOptionInUrlParam(selectedVariant.selectedOptions);
|
|
91
|
+
|
|
92
|
+
// Get the product options array
|
|
93
|
+
const productOptions = getProductOptions({
|
|
94
|
+
...product,
|
|
95
|
+
selectedOrFirstAvailableVariant: selectedVariant,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const {title, descriptionHtml} = product;
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div className="product">
|
|
102
|
+
<ProductImage image={selectedVariant?.image} />
|
|
103
|
+
<div className="product-main">
|
|
104
|
+
<h1>{title}</h1>
|
|
105
|
+
<ProductPrice
|
|
106
|
+
price={selectedVariant?.price}
|
|
107
|
+
compareAtPrice={selectedVariant?.compareAtPrice}
|
|
108
|
+
/>
|
|
109
|
+
<br />
|
|
110
|
+
<ProductForm
|
|
111
|
+
productOptions={productOptions}
|
|
112
|
+
selectedVariant={selectedVariant}
|
|
113
|
+
/>
|
|
114
|
+
<br />
|
|
115
|
+
<br />
|
|
116
|
+
<p>
|
|
117
|
+
<strong>Description</strong>
|
|
118
|
+
</p>
|
|
119
|
+
<br />
|
|
120
|
+
<div dangerouslySetInnerHTML={{__html: descriptionHtml}} />
|
|
121
|
+
<br />
|
|
122
|
+
</div>
|
|
123
|
+
<Analytics.ProductView
|
|
124
|
+
data={{
|
|
125
|
+
products: [
|
|
126
|
+
{
|
|
127
|
+
id: product.id,
|
|
128
|
+
title: product.title,
|
|
129
|
+
price: selectedVariant?.price.amount || '0',
|
|
130
|
+
vendor: product.vendor,
|
|
131
|
+
variantId: selectedVariant?.id || '',
|
|
132
|
+
variantTitle: selectedVariant?.title || '',
|
|
133
|
+
quantity: 1,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const PRODUCT_VARIANT_FRAGMENT = `#graphql
|
|
143
|
+
fragment ProductVariant on ProductVariant {
|
|
144
|
+
availableForSale
|
|
145
|
+
compareAtPrice {
|
|
146
|
+
amount
|
|
147
|
+
currencyCode
|
|
148
|
+
}
|
|
149
|
+
id
|
|
150
|
+
image {
|
|
151
|
+
__typename
|
|
152
|
+
id
|
|
153
|
+
url
|
|
154
|
+
altText
|
|
155
|
+
width
|
|
156
|
+
height
|
|
157
|
+
}
|
|
158
|
+
price {
|
|
159
|
+
amount
|
|
160
|
+
currencyCode
|
|
161
|
+
}
|
|
162
|
+
product {
|
|
163
|
+
title
|
|
164
|
+
handle
|
|
165
|
+
}
|
|
166
|
+
selectedOptions {
|
|
167
|
+
name
|
|
168
|
+
value
|
|
169
|
+
}
|
|
170
|
+
sku
|
|
171
|
+
title
|
|
172
|
+
unitPrice {
|
|
173
|
+
amount
|
|
174
|
+
currencyCode
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
` as const;
|
|
178
|
+
|
|
179
|
+
const PRODUCT_FRAGMENT = `#graphql
|
|
180
|
+
fragment Product on Product {
|
|
181
|
+
id
|
|
182
|
+
title
|
|
183
|
+
vendor
|
|
184
|
+
handle
|
|
185
|
+
descriptionHtml
|
|
186
|
+
description
|
|
187
|
+
encodedVariantExistence
|
|
188
|
+
encodedVariantAvailability
|
|
189
|
+
options {
|
|
190
|
+
name
|
|
191
|
+
optionValues {
|
|
192
|
+
name
|
|
193
|
+
firstSelectableVariant {
|
|
194
|
+
...ProductVariant
|
|
195
|
+
}
|
|
196
|
+
swatch {
|
|
197
|
+
color
|
|
198
|
+
image {
|
|
199
|
+
previewImage {
|
|
200
|
+
url
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {
|
|
207
|
+
...ProductVariant
|
|
208
|
+
}
|
|
209
|
+
adjacentVariants (selectedOptions: $selectedOptions) {
|
|
210
|
+
...ProductVariant
|
|
211
|
+
}
|
|
212
|
+
seo {
|
|
213
|
+
description
|
|
214
|
+
title
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
${PRODUCT_VARIANT_FRAGMENT}
|
|
218
|
+
` as const;
|
|
219
|
+
|
|
220
|
+
const PRODUCT_QUERY = `#graphql
|
|
221
|
+
query Product(
|
|
222
|
+
$country: CountryCode
|
|
223
|
+
$handle: String!
|
|
224
|
+
$language: LanguageCode
|
|
225
|
+
$selectedOptions: [SelectedOptionInput!]!
|
|
226
|
+
) @inContext(country: $country, language: $language) {
|
|
227
|
+
product(handle: $handle) {
|
|
228
|
+
...Product
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
${PRODUCT_FRAGMENT}
|
|
232
|
+
` as const;
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import {useLoaderData} from 'react-router';
|
|
2
|
+
import type {Route} from './+types/search';
|
|
3
|
+
import {getPaginationVariables, Analytics} from '@shopify/hydrogen';
|
|
4
|
+
import {SearchForm} from '~/components/SearchForm';
|
|
5
|
+
import {SearchResults} from '~/components/SearchResults';
|
|
6
|
+
import {
|
|
7
|
+
type RegularSearchReturn,
|
|
8
|
+
type PredictiveSearchReturn,
|
|
9
|
+
getEmptyPredictiveSearchResult,
|
|
10
|
+
} from '~/lib/search';
|
|
11
|
+
import type {
|
|
12
|
+
RegularSearchQuery,
|
|
13
|
+
PredictiveSearchQuery,
|
|
14
|
+
} from 'storefrontapi.generated';
|
|
15
|
+
|
|
16
|
+
export const meta: Route.MetaFunction = () => {
|
|
17
|
+
return [{title: `Hydrogen | Search`}];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export async function loader({request, context}: Route.LoaderArgs) {
|
|
21
|
+
const url = new URL(request.url);
|
|
22
|
+
const isPredictive = url.searchParams.has('predictive');
|
|
23
|
+
const searchPromise: Promise<PredictiveSearchReturn | RegularSearchReturn> =
|
|
24
|
+
isPredictive
|
|
25
|
+
? predictiveSearch({request, context})
|
|
26
|
+
: regularSearch({request, context});
|
|
27
|
+
|
|
28
|
+
searchPromise.catch((error: Error) => {
|
|
29
|
+
console.error(error);
|
|
30
|
+
return {term: '', result: null, error: error.message};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return await searchPromise;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Renders the /search route
|
|
38
|
+
*/
|
|
39
|
+
export default function SearchPage() {
|
|
40
|
+
const {type, term, result, error} = useLoaderData<typeof loader>();
|
|
41
|
+
if (type === 'predictive') return null;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div className="search">
|
|
45
|
+
<h1>Search</h1>
|
|
46
|
+
<SearchForm>
|
|
47
|
+
{({inputRef}) => (
|
|
48
|
+
<>
|
|
49
|
+
<input
|
|
50
|
+
defaultValue={term}
|
|
51
|
+
name="q"
|
|
52
|
+
placeholder="Search…"
|
|
53
|
+
ref={inputRef}
|
|
54
|
+
type="search"
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
<button type="submit">Search</button>
|
|
58
|
+
</>
|
|
59
|
+
)}
|
|
60
|
+
</SearchForm>
|
|
61
|
+
{error && <p style={{color: 'red'}}>{error}</p>}
|
|
62
|
+
{!term || !result?.total ? (
|
|
63
|
+
<SearchResults.Empty />
|
|
64
|
+
) : (
|
|
65
|
+
<SearchResults result={result} term={term}>
|
|
66
|
+
{({articles, pages, products, term}) => (
|
|
67
|
+
<div>
|
|
68
|
+
<SearchResults.Products products={products} term={term} />
|
|
69
|
+
<SearchResults.Pages pages={pages} term={term} />
|
|
70
|
+
<SearchResults.Articles articles={articles} term={term} />
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
</SearchResults>
|
|
74
|
+
)}
|
|
75
|
+
<Analytics.SearchView data={{searchTerm: term, searchResults: result}} />
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Regular search query and fragments
|
|
82
|
+
* (adjust as needed)
|
|
83
|
+
*/
|
|
84
|
+
const SEARCH_PRODUCT_FRAGMENT = `#graphql
|
|
85
|
+
fragment SearchProduct on Product {
|
|
86
|
+
__typename
|
|
87
|
+
handle
|
|
88
|
+
id
|
|
89
|
+
publishedAt
|
|
90
|
+
title
|
|
91
|
+
trackingParameters
|
|
92
|
+
vendor
|
|
93
|
+
selectedOrFirstAvailableVariant(
|
|
94
|
+
selectedOptions: []
|
|
95
|
+
ignoreUnknownOptions: true
|
|
96
|
+
caseInsensitiveMatch: true
|
|
97
|
+
) {
|
|
98
|
+
id
|
|
99
|
+
image {
|
|
100
|
+
url
|
|
101
|
+
altText
|
|
102
|
+
width
|
|
103
|
+
height
|
|
104
|
+
}
|
|
105
|
+
price {
|
|
106
|
+
amount
|
|
107
|
+
currencyCode
|
|
108
|
+
}
|
|
109
|
+
compareAtPrice {
|
|
110
|
+
amount
|
|
111
|
+
currencyCode
|
|
112
|
+
}
|
|
113
|
+
selectedOptions {
|
|
114
|
+
name
|
|
115
|
+
value
|
|
116
|
+
}
|
|
117
|
+
product {
|
|
118
|
+
handle
|
|
119
|
+
title
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
` as const;
|
|
124
|
+
|
|
125
|
+
const SEARCH_PAGE_FRAGMENT = `#graphql
|
|
126
|
+
fragment SearchPage on Page {
|
|
127
|
+
__typename
|
|
128
|
+
handle
|
|
129
|
+
id
|
|
130
|
+
title
|
|
131
|
+
trackingParameters
|
|
132
|
+
}
|
|
133
|
+
` as const;
|
|
134
|
+
|
|
135
|
+
const SEARCH_ARTICLE_FRAGMENT = `#graphql
|
|
136
|
+
fragment SearchArticle on Article {
|
|
137
|
+
__typename
|
|
138
|
+
handle
|
|
139
|
+
id
|
|
140
|
+
title
|
|
141
|
+
trackingParameters
|
|
142
|
+
}
|
|
143
|
+
` as const;
|
|
144
|
+
|
|
145
|
+
const PAGE_INFO_FRAGMENT = `#graphql
|
|
146
|
+
fragment PageInfoFragment on PageInfo {
|
|
147
|
+
hasNextPage
|
|
148
|
+
hasPreviousPage
|
|
149
|
+
startCursor
|
|
150
|
+
endCursor
|
|
151
|
+
}
|
|
152
|
+
` as const;
|
|
153
|
+
|
|
154
|
+
// NOTE: https://shopify.dev/docs/api/storefront/latest/queries/search
|
|
155
|
+
export const SEARCH_QUERY = `#graphql
|
|
156
|
+
query RegularSearch(
|
|
157
|
+
$country: CountryCode
|
|
158
|
+
$endCursor: String
|
|
159
|
+
$first: Int
|
|
160
|
+
$language: LanguageCode
|
|
161
|
+
$last: Int
|
|
162
|
+
$term: String!
|
|
163
|
+
$startCursor: String
|
|
164
|
+
) @inContext(country: $country, language: $language) {
|
|
165
|
+
articles: search(
|
|
166
|
+
query: $term,
|
|
167
|
+
types: [ARTICLE],
|
|
168
|
+
first: $first,
|
|
169
|
+
) {
|
|
170
|
+
nodes {
|
|
171
|
+
...on Article {
|
|
172
|
+
...SearchArticle
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
pages: search(
|
|
177
|
+
query: $term,
|
|
178
|
+
types: [PAGE],
|
|
179
|
+
first: $first,
|
|
180
|
+
) {
|
|
181
|
+
nodes {
|
|
182
|
+
...on Page {
|
|
183
|
+
...SearchPage
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
products: search(
|
|
188
|
+
after: $endCursor,
|
|
189
|
+
before: $startCursor,
|
|
190
|
+
first: $first,
|
|
191
|
+
last: $last,
|
|
192
|
+
query: $term,
|
|
193
|
+
sortKey: RELEVANCE,
|
|
194
|
+
types: [PRODUCT],
|
|
195
|
+
unavailableProducts: HIDE,
|
|
196
|
+
) {
|
|
197
|
+
nodes {
|
|
198
|
+
...on Product {
|
|
199
|
+
...SearchProduct
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
pageInfo {
|
|
203
|
+
...PageInfoFragment
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
${SEARCH_PRODUCT_FRAGMENT}
|
|
208
|
+
${SEARCH_PAGE_FRAGMENT}
|
|
209
|
+
${SEARCH_ARTICLE_FRAGMENT}
|
|
210
|
+
${PAGE_INFO_FRAGMENT}
|
|
211
|
+
` as const;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Regular search fetcher
|
|
215
|
+
*/
|
|
216
|
+
async function regularSearch({
|
|
217
|
+
request,
|
|
218
|
+
context,
|
|
219
|
+
}: Pick<
|
|
220
|
+
Route.LoaderArgs,
|
|
221
|
+
'request' | 'context'
|
|
222
|
+
>): Promise<RegularSearchReturn> {
|
|
223
|
+
const {storefront} = context;
|
|
224
|
+
const url = new URL(request.url);
|
|
225
|
+
const variables = getPaginationVariables(request, {pageBy: 8});
|
|
226
|
+
const term = String(url.searchParams.get('q') || '');
|
|
227
|
+
|
|
228
|
+
// Search articles, pages, and products for the `q` term
|
|
229
|
+
const {
|
|
230
|
+
errors,
|
|
231
|
+
...items
|
|
232
|
+
}: {errors?: Array<{message: string}>} & RegularSearchQuery =
|
|
233
|
+
await storefront.query(SEARCH_QUERY, {
|
|
234
|
+
variables: {...variables, term},
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
if (!items) {
|
|
238
|
+
throw new Error('No search data returned from Shopify API');
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const total = Object.values(items).reduce(
|
|
242
|
+
(acc: number, {nodes}: {nodes: Array<unknown>}) => acc + nodes.length,
|
|
243
|
+
0,
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
const error = errors
|
|
247
|
+
? errors.map(({message}: {message: string}) => message).join(', ')
|
|
248
|
+
: undefined;
|
|
249
|
+
|
|
250
|
+
return {type: 'regular', term, error, result: {total, items}};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Predictive search query and fragments
|
|
255
|
+
* (adjust as needed)
|
|
256
|
+
*/
|
|
257
|
+
const PREDICTIVE_SEARCH_ARTICLE_FRAGMENT = `#graphql
|
|
258
|
+
fragment PredictiveArticle on Article {
|
|
259
|
+
__typename
|
|
260
|
+
id
|
|
261
|
+
title
|
|
262
|
+
handle
|
|
263
|
+
blog {
|
|
264
|
+
handle
|
|
265
|
+
}
|
|
266
|
+
image {
|
|
267
|
+
url
|
|
268
|
+
altText
|
|
269
|
+
width
|
|
270
|
+
height
|
|
271
|
+
}
|
|
272
|
+
trackingParameters
|
|
273
|
+
}
|
|
274
|
+
` as const;
|
|
275
|
+
|
|
276
|
+
const PREDICTIVE_SEARCH_COLLECTION_FRAGMENT = `#graphql
|
|
277
|
+
fragment PredictiveCollection on Collection {
|
|
278
|
+
__typename
|
|
279
|
+
id
|
|
280
|
+
title
|
|
281
|
+
handle
|
|
282
|
+
image {
|
|
283
|
+
url
|
|
284
|
+
altText
|
|
285
|
+
width
|
|
286
|
+
height
|
|
287
|
+
}
|
|
288
|
+
trackingParameters
|
|
289
|
+
}
|
|
290
|
+
` as const;
|
|
291
|
+
|
|
292
|
+
const PREDICTIVE_SEARCH_PAGE_FRAGMENT = `#graphql
|
|
293
|
+
fragment PredictivePage on Page {
|
|
294
|
+
__typename
|
|
295
|
+
id
|
|
296
|
+
title
|
|
297
|
+
handle
|
|
298
|
+
trackingParameters
|
|
299
|
+
}
|
|
300
|
+
` as const;
|
|
301
|
+
|
|
302
|
+
const PREDICTIVE_SEARCH_PRODUCT_FRAGMENT = `#graphql
|
|
303
|
+
fragment PredictiveProduct on Product {
|
|
304
|
+
__typename
|
|
305
|
+
id
|
|
306
|
+
title
|
|
307
|
+
handle
|
|
308
|
+
trackingParameters
|
|
309
|
+
selectedOrFirstAvailableVariant(
|
|
310
|
+
selectedOptions: []
|
|
311
|
+
ignoreUnknownOptions: true
|
|
312
|
+
caseInsensitiveMatch: true
|
|
313
|
+
) {
|
|
314
|
+
id
|
|
315
|
+
image {
|
|
316
|
+
url
|
|
317
|
+
altText
|
|
318
|
+
width
|
|
319
|
+
height
|
|
320
|
+
}
|
|
321
|
+
price {
|
|
322
|
+
amount
|
|
323
|
+
currencyCode
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
` as const;
|
|
328
|
+
|
|
329
|
+
const PREDICTIVE_SEARCH_QUERY_FRAGMENT = `#graphql
|
|
330
|
+
fragment PredictiveQuery on SearchQuerySuggestion {
|
|
331
|
+
__typename
|
|
332
|
+
text
|
|
333
|
+
styledText
|
|
334
|
+
trackingParameters
|
|
335
|
+
}
|
|
336
|
+
` as const;
|
|
337
|
+
|
|
338
|
+
// NOTE: https://shopify.dev/docs/api/storefront/latest/queries/predictiveSearch
|
|
339
|
+
const PREDICTIVE_SEARCH_QUERY = `#graphql
|
|
340
|
+
query PredictiveSearch(
|
|
341
|
+
$country: CountryCode
|
|
342
|
+
$language: LanguageCode
|
|
343
|
+
$limit: Int!
|
|
344
|
+
$limitScope: PredictiveSearchLimitScope!
|
|
345
|
+
$term: String!
|
|
346
|
+
$types: [PredictiveSearchType!]
|
|
347
|
+
) @inContext(country: $country, language: $language) {
|
|
348
|
+
predictiveSearch(
|
|
349
|
+
limit: $limit,
|
|
350
|
+
limitScope: $limitScope,
|
|
351
|
+
query: $term,
|
|
352
|
+
types: $types,
|
|
353
|
+
) {
|
|
354
|
+
articles {
|
|
355
|
+
...PredictiveArticle
|
|
356
|
+
}
|
|
357
|
+
collections {
|
|
358
|
+
...PredictiveCollection
|
|
359
|
+
}
|
|
360
|
+
pages {
|
|
361
|
+
...PredictivePage
|
|
362
|
+
}
|
|
363
|
+
products {
|
|
364
|
+
...PredictiveProduct
|
|
365
|
+
}
|
|
366
|
+
queries {
|
|
367
|
+
...PredictiveQuery
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
${PREDICTIVE_SEARCH_ARTICLE_FRAGMENT}
|
|
372
|
+
${PREDICTIVE_SEARCH_COLLECTION_FRAGMENT}
|
|
373
|
+
${PREDICTIVE_SEARCH_PAGE_FRAGMENT}
|
|
374
|
+
${PREDICTIVE_SEARCH_PRODUCT_FRAGMENT}
|
|
375
|
+
${PREDICTIVE_SEARCH_QUERY_FRAGMENT}
|
|
376
|
+
` as const;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Predictive search fetcher
|
|
380
|
+
*/
|
|
381
|
+
async function predictiveSearch({
|
|
382
|
+
request,
|
|
383
|
+
context,
|
|
384
|
+
}: Pick<
|
|
385
|
+
Route.ActionArgs,
|
|
386
|
+
'request' | 'context'
|
|
387
|
+
>): Promise<PredictiveSearchReturn> {
|
|
388
|
+
const {storefront} = context;
|
|
389
|
+
const url = new URL(request.url);
|
|
390
|
+
const term = String(url.searchParams.get('q') || '').trim();
|
|
391
|
+
const limit = Number(url.searchParams.get('limit') || 10);
|
|
392
|
+
const type = 'predictive';
|
|
393
|
+
|
|
394
|
+
if (!term) return {type, term, result: getEmptyPredictiveSearchResult()};
|
|
395
|
+
|
|
396
|
+
// Predictively search articles, collections, pages, products, and queries (suggestions)
|
|
397
|
+
const {
|
|
398
|
+
predictiveSearch: items,
|
|
399
|
+
errors,
|
|
400
|
+
}: PredictiveSearchQuery & {errors?: Array<{message: string}>} =
|
|
401
|
+
await storefront.query(PREDICTIVE_SEARCH_QUERY, {
|
|
402
|
+
variables: {
|
|
403
|
+
// customize search options as needed
|
|
404
|
+
limit,
|
|
405
|
+
limitScope: 'EACH',
|
|
406
|
+
term,
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
if (errors) {
|
|
411
|
+
throw new Error(
|
|
412
|
+
`Shopify API errors: ${errors.map(({message}: {message: string}) => message).join(', ')}`,
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (!items) {
|
|
417
|
+
throw new Error('No predictive search data returned from Shopify API');
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const total = Object.values(items).reduce(
|
|
421
|
+
(acc: number, item: Array<unknown>) => acc + item.length,
|
|
422
|
+
0,
|
|
423
|
+
);
|
|
424
|
+
|
|
425
|
+
return {type, term, result: {items, total}};
|
|
426
|
+
}
|