@unchainedshop/admin-ui 5.0.0-alpha.11 → 5.0.0-alpha.14
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 +1 -1
- package/dist/{chunk-WPLOTFGW.js → chunk-2HTCKO4E.js} +12 -3
- package/dist/{chunk-I64TXIE7.js → chunk-5UHBGLFV.js} +40 -2
- package/dist/{chunk-PJLYVMUM.js → chunk-6WMH7PLC.js} +2 -2
- package/dist/{chunk-QHR23GVH.js → chunk-CUYIP5XG.js} +1 -1
- package/dist/{chunk-5WPFHQZN.js → chunk-E6HDJYA6.js} +3 -3
- package/dist/{chunk-FDHXLNZQ.js → chunk-EAVP6XZQ.js} +1 -1
- package/dist/{chunk-HJKRGBDG.js → chunk-EKWWSFDK.js} +1 -1
- package/dist/{chunk-Q6S3LBUF.js → chunk-JC6PXYZP.js} +7 -1
- package/dist/{chunk-BOMSMJF2.js → chunk-JGER2LQO.js} +1 -0
- package/dist/{chunk-ICJH36K4.js → chunk-M2242FCR.js} +1 -1
- package/dist/{chunk-3L6EZQ6P.js → chunk-NFJE5EJG.js} +1 -1
- package/dist/{chunk-BMDNY67T.js → chunk-NUGWX3KO.js} +3361 -1769
- package/dist/{chunk-E77YIMGR.js → chunk-XZ2V6XTD.js} +2 -2
- package/dist/components/ui/Loading.d.ts +8 -1
- package/dist/components/ui/Loading.d.ts.map +1 -1
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/form.js +798 -379
- package/dist/gql/operation-types.d.ts +51 -18
- package/dist/gql/operation-types.d.ts.map +1 -1
- package/dist/gql/schema-types.d.ts +28 -2
- package/dist/gql/schema-types.d.ts.map +1 -1
- package/dist/hooks.js +5 -5
- package/dist/modal.js +5 -5
- package/dist/modules/UnchainedContext/UnchainedContext.d.ts +1 -0
- package/dist/modules/UnchainedContext/UnchainedContext.d.ts.map +1 -1
- package/dist/modules/UnchainedContext/useUnchainedContext.d.ts +1 -0
- package/dist/modules/UnchainedContext/useUnchainedContext.d.ts.map +1 -1
- package/dist/modules/accounts.js +48 -2
- package/dist/modules/assortment.js +2 -2
- package/dist/modules/common/components/SearchWithTags.d.ts +10 -0
- package/dist/modules/common/components/SearchWithTags.d.ts.map +1 -0
- package/dist/modules/common/hooks/useShopInfo.d.ts +1 -0
- package/dist/modules/common/hooks/useShopInfo.d.ts.map +1 -1
- package/dist/modules/country.js +1 -1
- package/dist/modules/currency.js +1 -1
- package/dist/modules/delivery-provider.js +1 -1
- package/dist/modules/enrollment.js +25 -11
- package/dist/modules/event.js +1 -1
- package/dist/modules/filter.js +1 -1
- package/dist/modules/forms/lib/validators.d.ts +3 -1
- package/dist/modules/forms/lib/validators.d.ts.map +1 -1
- package/dist/modules/language.js +1 -1
- package/dist/modules/order/fragments/OrderDetailFragment.d.ts.map +1 -1
- package/dist/modules/order.js +1 -2
- package/dist/modules/payment-providers.js +1 -1
- package/dist/modules/product/hooks/useProductsCount.d.ts +1 -1
- package/dist/modules/product/hooks/useProductsCount.d.ts.map +1 -1
- package/dist/modules/product-review.js +2 -2
- package/dist/modules/product.js +437 -25
- package/dist/modules/quotation.js +2 -1
- package/dist/modules/token.js +1 -1
- package/dist/modules/warehousing-providers.js +1 -1
- package/dist/modules/work.js +1 -1
- package/dist/plugins.js +1 -1
- package/dist/providers.js +5 -5
- package/dist/shims/admin-ui-plugins.js +1 -1
- package/dist/shims/apollo-client-react.js +1 -1
- package/dist/shims/apollo-client.js +1 -1
- package/dist/shims/next-head.js +1 -1
- package/dist/shims/next-image.js +1 -1
- package/dist/shims/next-link.js +1 -1
- package/dist/shims/next-router.js +1 -1
- package/dist/shims/react-dom-client.js +1 -1
- package/dist/shims/react-dom.js +1 -1
- package/dist/shims/react-hook-form.js +1 -1
- package/dist/shims/react-intl.js +1 -1
- package/dist/shims/react-jsx-runtime.js +1 -1
- package/dist/shims/react-toastify.js +1 -1
- package/dist/shims/react.js +1 -1
- package/dist/theme.js +1 -1
- package/dist/ui.js +9627 -8204
- package/out/403/index.html +3 -3
- package/out/404/index.html +3 -3
- package/out/404.html +3 -3
- package/out/423/index.html +3 -3
- package/out/500/index.html +3 -3
- package/out/_next/static/WEaZ5SW9HLnJWzXs84JMH/_buildManifest.js +266 -0
- package/out/_next/static/chunks/0-kvzk5p0hp-4.js +11 -0
- package/out/_next/static/chunks/0-nzk-g6k41e-.js +119 -0
- package/out/_next/static/chunks/00p6gl0n0kga2.js +46 -0
- package/out/_next/static/chunks/01otzjqxk372n.js +1 -0
- package/out/_next/static/chunks/0389l__ljgq-b.js +1 -0
- package/out/_next/static/chunks/039xltalow0bh.js +1 -0
- package/out/_next/static/chunks/03awz8e25u6-9.js +33 -0
- package/out/_next/static/chunks/04_r4qnsjmy81.js +4 -0
- package/out/_next/static/chunks/04egfa7kckou_.js +165 -0
- package/out/_next/static/chunks/04kydtjv2qqb1.js +39 -0
- package/out/_next/static/chunks/05ghb-a4hshp1.js +24 -0
- package/out/_next/static/chunks/06gqojz2tfk7h.js +33 -0
- package/out/_next/static/chunks/{2ajr0rk0_yax6.js → 06kqbwwnuu3te.js} +1 -1
- package/out/_next/static/chunks/0728622u98g6r.js +1 -0
- package/out/_next/static/chunks/08e3-wndual-j.js +183 -0
- package/out/_next/static/chunks/08gngcgmdigfl.js +7 -0
- package/out/_next/static/chunks/{01xy3u9ybz9ts.js → 08htfpcq8k2ct.js} +2 -2
- package/out/_next/static/chunks/09irjy-7k1922.js +1 -0
- package/out/_next/static/chunks/0_ppdn6x6ci0v.js +31 -0
- package/out/_next/static/chunks/0ao00r36i0nko.js +4 -0
- package/out/_next/static/chunks/0az9r1m1m5nw7.js +5 -0
- package/out/_next/static/chunks/0bahbwxzev843.js +8 -0
- package/out/_next/static/chunks/0ejd4so6pfsb9.js +8 -0
- package/out/_next/static/chunks/0f0aouv41459l.js +99 -0
- package/out/_next/static/chunks/0f4mwm9gegsvc.js +8 -0
- package/out/_next/static/chunks/0ffdde8s4b7e2.js +5 -0
- package/out/_next/static/chunks/0ftb36h7poyeo.js +235 -0
- package/out/_next/static/chunks/0gclli_nyb0px.js +4 -0
- package/out/_next/static/chunks/0hv62tllrjbgx.js +5 -0
- package/out/_next/static/chunks/0ik3suboifvvc.js +1 -0
- package/out/_next/static/chunks/0iohwbogpxe5r.js +1 -0
- package/out/_next/static/chunks/0jsbw2npug66o.js +54 -0
- package/out/_next/static/chunks/0lgoprkr2wj68.js +12 -0
- package/out/_next/static/chunks/0mpgc4f7hc1dd.js +7 -0
- package/out/_next/static/chunks/0o4aj3bm49d_h.js +61 -0
- package/out/_next/static/chunks/0oauw10y-zu7q.js +14 -0
- package/out/_next/static/chunks/0p55j-ysba0wq.js +63 -0
- package/out/_next/static/chunks/0pnifxx4n6jz4.js +30 -0
- package/out/_next/static/chunks/0rj53mrsrvu49.js +5 -0
- package/out/_next/static/chunks/0s2jvi6_qj0lc.js +16 -0
- package/out/_next/static/chunks/0uef4ugmc_g10.js +1 -0
- package/out/_next/static/chunks/0v2f0xq8mp63h.js +1 -0
- package/out/_next/static/chunks/0wvck3kmtd8h3.js +5 -0
- package/out/_next/static/chunks/0y-xf7e4lgmru.js +4 -0
- package/out/_next/static/chunks/0zlzflyq18hhy.js +4 -0
- package/out/_next/static/chunks/12cy_5m_0fj96.js +44 -0
- package/out/_next/static/chunks/12z0--swhgre2.js +33 -0
- package/out/_next/static/chunks/139wqbl161pdw.js +12 -0
- package/out/_next/static/chunks/13sl42_jx13hh.js +7 -0
- package/out/_next/static/chunks/14jd75j8ij4u2.js +3 -0
- package/out/_next/static/chunks/14wav1vmqi2oo.js +371 -0
- package/out/_next/static/chunks/15oodwh44nrve.js +43 -0
- package/out/_next/static/chunks/15ullli2vlj87.js +8 -0
- package/out/_next/static/chunks/177p92k5pdloo.js +1 -0
- package/out/_next/static/chunks/17g3a6iz0s59f.js +837 -0
- package/out/_next/static/chunks/19-1z6h5eeq_w.js +134 -0
- package/out/_next/static/chunks/19-fs9eq1syvw.js +103 -0
- package/out/_next/static/chunks/195cwzh3q1i0h.js +7 -0
- package/out/_next/static/chunks/1cz2fp89ssu5d.js +4 -0
- package/out/_next/static/chunks/1e2jykfql801f.js +16 -0
- package/out/_next/static/chunks/1fou9xz0_rm6d.js +5 -0
- package/out/_next/static/chunks/1gl4h7w9t850f.js +1 -0
- package/out/_next/static/chunks/1in8spfokcjsp.js +8 -0
- package/out/_next/static/chunks/1k1b69hvwr-0g.js +5 -0
- package/out/_next/static/chunks/1kdcu-0jkya-b.js +61 -0
- package/out/_next/static/chunks/1kyjdq0bnkw10.js +95 -0
- package/out/_next/static/chunks/1l2ix83845lui.js +5 -0
- package/out/_next/static/chunks/{1iamjw8qh1m4o.js → 1mx0p6r-9c5u_.js} +1 -1
- package/out/_next/static/chunks/1ossmsdseqyeu.js +147 -0
- package/out/_next/static/chunks/1p5lt4tkyouxz.js +4 -0
- package/out/_next/static/chunks/1pm7k55e4pfpm.js +59 -0
- package/out/_next/static/chunks/1pqyz1opm5_7r.js +1 -0
- package/out/_next/static/chunks/1qd4fupa708s4.js +5 -0
- package/out/_next/static/chunks/1r61kgm2ct0nf.js +74 -0
- package/out/_next/static/chunks/1rmlm4404fsge.js +15 -0
- package/out/_next/static/chunks/1s3ool53utm9o.js +39 -0
- package/out/_next/static/chunks/1sc2ug6_szd_d.js +2 -0
- package/out/_next/static/chunks/1t1ecrjkykbv1.js +4 -0
- package/out/_next/static/chunks/{12yd8t4k6c0t1.js → 1t8jj0-6g8uyd.js} +1 -1
- package/out/_next/static/chunks/1tej7js0fwv1h.js +11 -0
- package/out/_next/static/chunks/1th8knz7txt9f.js +5 -0
- package/out/_next/static/chunks/1tosw188dr9d6.js +44 -0
- package/out/_next/static/chunks/1tuf110jbpl_r.js +1 -0
- package/out/_next/static/chunks/1tzkeg4c-br-z.js +17 -0
- package/out/_next/static/chunks/1u7l4tos3wysc.js +5 -0
- package/out/_next/static/chunks/1v0ag3k96c56s.js +1 -0
- package/out/_next/static/chunks/1w6iuc_ba9g-3.js +3 -0
- package/out/_next/static/chunks/1x7cm_fuwp9m8.js +1 -0
- package/out/_next/static/chunks/1yv22tvuqofr_.js +296 -0
- package/out/_next/static/chunks/1yvl8l5yx1rj8.js +4 -0
- package/out/_next/static/chunks/2-s-hteo3lrnj.js +21 -0
- package/out/_next/static/chunks/20au-bdji0nu2.js +14 -0
- package/out/_next/static/chunks/20p146xfq-xrq.js +5 -0
- package/out/_next/static/chunks/20t2g2u3jhtvy.js +5 -0
- package/out/_next/static/chunks/21zghy5-42i1e.js +1 -0
- package/out/_next/static/chunks/{43uqmej6-s4am.js → 231mhpexhdm2g.js} +3 -3
- package/out/_next/static/chunks/{3m_9ozv0orvze.js → 249b4cg2ev597.js} +3 -3
- package/out/_next/static/chunks/24zfmgc4cu-n1.js +9 -0
- package/out/_next/static/chunks/25b_pi2_ro9yy.js +5 -0
- package/out/_next/static/chunks/25ite4-jpq_mo.js +4 -0
- package/out/_next/static/chunks/25vdihxswn7dy.js +1 -0
- package/out/_next/static/chunks/2693w1263bb3s.js +5 -0
- package/out/_next/static/chunks/26guwpx1_pkxv.js +1 -0
- package/out/_next/static/chunks/26yarz_db5ms0.js +5 -0
- package/out/_next/static/chunks/28xbb7hkhkoup.js +1 -0
- package/out/_next/static/chunks/299pou8yuoq6b.js +116 -0
- package/out/_next/static/chunks/29x7cj-318eaa.js +1 -0
- package/out/_next/static/chunks/2_cq751vth7u7.js +81 -0
- package/out/_next/static/chunks/2a2cayocu5mc3.js +1 -0
- package/out/_next/static/chunks/2a9dpzjx5mfjp.js +4 -0
- package/out/_next/static/chunks/2apnv1hcv-4zc.js +23 -0
- package/out/_next/static/chunks/2bugi3kot5jtu.js +1 -0
- package/out/_next/static/chunks/2dn2ma73q9ye0.js +5 -0
- package/out/_next/static/chunks/2ege1545af18d.js +4 -0
- package/out/_next/static/chunks/2fnn6q9fmhu3s.js +4 -0
- package/out/_next/static/chunks/2ga95n_v_6_7b.js +175 -0
- package/out/_next/static/chunks/2gfljy_oo0nnr.js +12 -0
- package/out/_next/static/chunks/2gfot_-pkeohl.js +103 -0
- package/out/_next/static/chunks/2gfzt_fdr-h96.js +81 -0
- package/out/_next/static/chunks/2h4bxz0oww5pk.js +4 -0
- package/out/_next/static/chunks/2hc3d38gb0q-v.js +1 -0
- package/out/_next/static/chunks/2hci18oosfv5d.js +5 -0
- package/out/_next/static/chunks/{3fpgg_wy6j2ph.js → 2ipcn3vy6d4_6.js} +1 -1
- package/out/_next/static/chunks/2j4g1tyyp8ta1.js +1 -0
- package/out/_next/static/chunks/2mt78e61hd_4p.js +100 -0
- package/out/_next/static/chunks/2rri_ex6s-d8g.js +4 -0
- package/out/_next/static/chunks/2sc6dwzzc2t7n.js +5 -0
- package/out/_next/static/chunks/2texlu369byon.js +1 -0
- package/out/_next/static/chunks/2tq8sqd3-wavo.js +6 -0
- package/out/_next/static/chunks/2u2obxhc_n6xk.js +119 -0
- package/out/_next/static/chunks/{0m73vd78oga92.js → 2u4cc_r_qo0s4.js} +14 -14
- package/out/_next/static/chunks/2u6n7ohruqpxp.js +1 -0
- package/out/_next/static/chunks/2u9myo1sjc-q0.js +276 -0
- package/out/_next/static/chunks/2ubbeh02scr2l.js +7 -0
- package/out/_next/static/chunks/2v_bdu-atp2qq.js +5 -0
- package/out/_next/static/chunks/2vyv371s8n48m.js +41 -0
- package/out/_next/static/chunks/2xd_5hafdvicw.js +5 -0
- package/out/_next/static/chunks/{2yw5sk06gdixu.js → 2y8uau15r3p-o.js} +1 -1
- package/out/_next/static/chunks/2ym9q2u0yw0m8.js +326 -0
- package/out/_next/static/chunks/2zb-xmda5rbn0.js +1 -0
- package/out/_next/static/chunks/2zsvxbghbsuz1.js +4 -0
- package/out/_next/static/chunks/3-grp4-_b_uin.js +5 -0
- package/out/_next/static/chunks/31i76bjr7wp3u.js +5 -0
- package/out/_next/static/chunks/32g5gxee1kcdc.js +28 -0
- package/out/_next/static/chunks/32thgoqghnqfk.js +5 -0
- package/out/_next/static/chunks/33svzh7wrh2ca.js +147 -0
- package/out/_next/static/chunks/33v1m9okpss0r.js +5 -0
- package/out/_next/static/chunks/34gspkpv7wikw.js +8 -0
- package/out/_next/static/chunks/34wf3lz_fft3k.js +2 -0
- package/out/_next/static/chunks/{1jmdpa0tc5puj.js → 35zhvtyq31ani.js} +3 -3
- package/out/_next/static/chunks/36vqjcd_y2j30.js +1 -0
- package/out/_next/static/chunks/{3btkj1_irjkq7.js → 36x7q29atus_r.js} +6 -6
- package/out/_next/static/chunks/38043sp-g7lor.js +43 -0
- package/out/_next/static/chunks/{1so6ouxrq_ffa.js → 393--hagnnm97.js} +3 -3
- package/out/_next/static/chunks/395bs5xmcnl_3.js +31 -0
- package/out/_next/static/chunks/3_0q-dmk8few_.css +1 -0
- package/out/_next/static/chunks/3_adkt8r_brx4.js +165 -0
- package/out/_next/static/chunks/3_jqu6hq_bq0s.js +23 -0
- package/out/_next/static/chunks/3_tuio1shb_8w.js +4 -0
- package/out/_next/static/chunks/3_u_uxeaysv2y.js +6 -0
- package/out/_next/static/chunks/3e9x78_cfl4gs.js +59 -0
- package/out/_next/static/chunks/3ek1bahoqa_ll.js +5 -0
- package/out/_next/static/chunks/3i7obrooylax2.js +1 -0
- package/out/_next/static/chunks/3ij_85v4doyfu.js +2 -0
- package/out/_next/static/chunks/3jfe0uesrzz7a.js +1 -0
- package/out/_next/static/chunks/3jgmo9q79w1-c.js +290 -0
- package/out/_next/static/chunks/3jp_xvjzuj3ts.js +33 -0
- package/out/_next/static/chunks/3l9ixfzewn8ct.js +5 -0
- package/out/_next/static/chunks/3ltrxqm61t2um.js +1 -0
- package/out/_next/static/chunks/3nrrzhhoy8amt.js +4 -0
- package/out/_next/static/chunks/3qt1oiw306jtf.js +5 -0
- package/out/_next/static/chunks/3s5_6nq23zb_5.js +7 -0
- package/out/_next/static/chunks/3s_74oi_rqb7q.js +5 -0
- package/out/_next/static/chunks/3skconxcf6r_s.js +156 -0
- package/out/_next/static/chunks/3t48n1yk76zoa.js +1 -0
- package/out/_next/static/chunks/3t_520l4ihlg3.js +54 -0
- package/out/_next/static/chunks/{3j25u7rzawm9f.js → 3ud-crkzgoj7q.js} +8 -8
- package/out/_next/static/chunks/3uekb_s0jaboj.js +1 -0
- package/out/_next/static/chunks/3wr9v36meolw7.js +710 -0
- package/out/_next/static/chunks/3xun85a44o067.js +1 -0
- package/out/_next/static/chunks/3yktizlgzr6vc.js +4 -0
- package/out/_next/static/chunks/407elvwrmcfn6.js +5 -0
- package/out/_next/static/chunks/40j4nxaeofft-.js +1 -0
- package/out/_next/static/chunks/42ijceja_327z.js +54 -0
- package/out/_next/static/chunks/440jwge6wnjj6.js +1 -0
- package/out/_next/static/chunks/449x6nw2kd7l6.js +119 -0
- package/out/_next/static/chunks/44xnlcqhabyj6.js +174 -0
- package/out/_next/static/chunks/{turbopack-2c3mg3r-05n1w.js → turbopack-077hmtqrhcoji.js} +1 -1
- package/out/_offline/index.html +3 -3
- package/out/account/forgot-password/index.html +3 -3
- package/out/account/index.html +3 -3
- package/out/assortments/AssortmentDetailPage/index.html +3 -3
- package/out/assortments/index.html +3 -3
- package/out/assortments/new/index.html +3 -3
- package/out/copilot/index.html +3 -3
- package/out/country/CountryDetailPage/index.html +3 -3
- package/out/country/index.html +3 -3
- package/out/country/new/index.html +3 -3
- package/out/currency/CurrencyDetailPage/index.html +3 -3
- package/out/currency/index.html +3 -3
- package/out/currency/new/index.html +3 -3
- package/out/delivery-provider/DeliveryProviderDetailPage/index.html +3 -3
- package/out/delivery-provider/index.html +3 -3
- package/out/delivery-provider/new/index.html +3 -3
- package/out/enrollments/EnrollmentDetailPage/index.html +3 -3
- package/out/enrollments/index.html +3 -3
- package/out/events/EventDetailPage/index.html +3 -3
- package/out/events/index.html +3 -3
- package/out/exports/index.html +3 -3
- package/out/ext/[[...slug]]/index.html +3 -3
- package/out/external/index.html +3 -3
- package/out/filters/FilterDetailPage/index.html +3 -3
- package/out/filters/index.html +3 -3
- package/out/filters/new/index.html +3 -3
- package/out/index.html +3 -3
- package/out/install/index.html +3 -3
- package/out/language/LanguageDetailPage/index.html +3 -3
- package/out/language/index.html +3 -3
- package/out/language/new/index.html +3 -3
- package/out/log-in/index.html +3 -3
- package/out/login-code/index.html +12 -0
- package/out/orders/OrderDetailPage/index.html +3 -3
- package/out/orders/index.html +3 -3
- package/out/payment-provider/PaymentProviderDetailPage/index.html +3 -3
- package/out/payment-provider/index.html +3 -3
- package/out/payment-provider/new/index.html +3 -3
- package/out/products/ProductDetailPage/index.html +3 -3
- package/out/products/index.html +3 -3
- package/out/products/new/index.html +3 -3
- package/out/quotations/QuotationDetailPage/index.html +3 -3
- package/out/quotations/index.html +3 -3
- package/out/reset-password/index.html +3 -3
- package/out/sign-up/index.html +3 -3
- package/out/styleguide/index.html +3 -3
- package/out/tokens/TokenDetailPage/index.html +3 -3
- package/out/tokens/index.html +3 -3
- package/out/users/UserDetailPage/index.html +3 -3
- package/out/users/index.html +3 -3
- package/out/users/new/index.html +3 -3
- package/out/verify-email/index.html +3 -3
- package/out/warehousing-provider/WarehousingProviderDetailPage/index.html +3 -3
- package/out/warehousing-provider/index.html +3 -3
- package/out/warehousing-provider/new/index.html +3 -3
- package/out/works/WorkDetailPage/index.html +3 -3
- package/out/works/WorkQueueListView/index.html +3 -3
- package/out/works/index.html +3 -3
- package/out/works/management/index.html +3 -3
- package/package.json +10 -10
- package/src/modules/accounts/hooks/logOut.ts +26 -0
- package/src/modules/accounts/hooks/useAddEmail.ts +34 -0
- package/src/modules/accounts/hooks/useAddWeb3Address.ts +38 -0
- package/src/modules/accounts/hooks/useAddWebAuthnCredentials.ts +48 -0
- package/src/modules/accounts/hooks/useBulkUserOperations.ts +91 -0
- package/src/modules/accounts/hooks/useChangePassword.ts +36 -0
- package/src/modules/accounts/hooks/useCreateUser.ts +74 -0
- package/src/modules/accounts/hooks/useCreateWebAuthnCredentialCreationOptions.ts +31 -0
- package/src/modules/accounts/hooks/useCreateWebAuthnCredentialRequestOptions.ts +30 -0
- package/src/modules/accounts/hooks/useCurrentUser.ts +44 -0
- package/src/modules/accounts/hooks/useDeleteUser.ts +26 -0
- package/src/modules/accounts/hooks/useEnrollUser.ts +48 -0
- package/src/modules/accounts/hooks/useForgotPassword.ts +35 -0
- package/src/modules/accounts/hooks/useGenerateLoginCredentials.ts +80 -0
- package/src/modules/accounts/hooks/useGenerateWebAuthCredentials.ts +102 -0
- package/src/modules/accounts/hooks/useLoginWithLoginCode.ts +45 -0
- package/src/modules/accounts/hooks/useLoginWithPassword.ts +65 -0
- package/src/modules/accounts/hooks/useLoginWithWebAuthn.ts +38 -0
- package/src/modules/accounts/hooks/useLogoutAllSessions.ts +27 -0
- package/src/modules/accounts/hooks/useRemoveBookmark.ts +36 -0
- package/src/modules/accounts/hooks/useRemoveEmail.ts +40 -0
- package/src/modules/accounts/hooks/useRemoveWeb3Address.ts +38 -0
- package/src/modules/accounts/hooks/useRemoveWebAuthCredentials.ts +36 -0
- package/src/modules/accounts/hooks/useRequestLoginCode.ts +31 -0
- package/src/modules/accounts/hooks/useResetPassword.ts +46 -0
- package/src/modules/accounts/hooks/useSendVerificationEmail.ts +35 -0
- package/src/modules/accounts/hooks/useSetPassword.ts +38 -0
- package/src/modules/accounts/hooks/useSetRoles.ts +40 -0
- package/src/modules/accounts/hooks/useSetUserTags.ts +48 -0
- package/src/modules/accounts/hooks/useSetUsername.ts +40 -0
- package/src/modules/accounts/hooks/useUpdateUserAvatar.ts +49 -0
- package/src/modules/accounts/hooks/useUpdateUserProfile.ts +40 -0
- package/src/modules/accounts/hooks/useUser.ts +201 -0
- package/src/modules/accounts/hooks/useUserBookmarks.ts +51 -0
- package/src/modules/accounts/hooks/useUserExport.ts +107 -0
- package/src/modules/accounts/hooks/useUserWebAuthnCredentials.ts +44 -0
- package/src/modules/accounts/hooks/useUsers.ts +82 -0
- package/src/modules/accounts/hooks/useUsersCount.ts +50 -0
- package/src/modules/accounts/hooks/useValidateEmailVerificationToken.ts +34 -0
- package/src/modules/accounts/hooks/useValidateResetPasswordToken.ts +35 -0
- package/src/modules/accounts/hooks/useVerifyEmail.ts +41 -0
- package/src/modules/accounts/hooks/useVerifyWeb3Address.ts +40 -0
- package/src/modules/accounts/index.ts +2 -0
- package/src/modules/assortment/fragments/AssortmentChildrenFragment.ts +16 -0
- package/src/modules/assortment/fragments/AssortmentFragment.ts +31 -0
- package/src/modules/assortment/fragments/AssortmentLinkFragment.ts +18 -0
- package/src/modules/assortment/fragments/AssortmentMediaFragment.ts +19 -0
- package/src/modules/assortment/fragments/AssortmentMediaTextsFragment.ts +12 -0
- package/src/modules/assortment/fragments/AssortmentTextsFragment.ts +14 -0
- package/src/modules/assortment/hooks/useAddAssortmentFilter.ts +46 -0
- package/src/modules/assortment/hooks/useAddAssortmentLink.ts +46 -0
- package/src/modules/assortment/hooks/useAddAssortmentMedia.ts +52 -0
- package/src/modules/assortment/hooks/useAddAssortmentProduct.ts +46 -0
- package/src/modules/assortment/hooks/useAssortment.ts +56 -0
- package/src/modules/assortment/hooks/useAssortmentChildren.ts +58 -0
- package/src/modules/assortment/hooks/useAssortmentExport.ts +60 -0
- package/src/modules/assortment/hooks/useAssortmentFilters.ts +51 -0
- package/src/modules/assortment/hooks/useAssortmentLinks.ts +54 -0
- package/src/modules/assortment/hooks/useAssortmentMedia.ts +57 -0
- package/src/modules/assortment/hooks/useAssortmentPaths.ts +39 -0
- package/src/modules/assortment/hooks/useAssortmentProducts.ts +62 -0
- package/src/modules/assortment/hooks/useAssortments.ts +103 -0
- package/src/modules/assortment/hooks/useAssortmentsCount.ts +51 -0
- package/src/modules/assortment/hooks/useBulkAssortmentOperations.ts +100 -0
- package/src/modules/assortment/hooks/useCreateAssortment.ts +55 -0
- package/src/modules/assortment/hooks/usePrepareAssortmentImport.ts +211 -0
- package/src/modules/assortment/hooks/useRemoveAssortment.ts +36 -0
- package/src/modules/assortment/hooks/useRemoveAssortmentFilter.ts +36 -0
- package/src/modules/assortment/hooks/useRemoveAssortmentLink.ts +36 -0
- package/src/modules/assortment/hooks/useRemoveAssortmentMedia.ts +36 -0
- package/src/modules/assortment/hooks/useRemoveAssortmentProduct.ts +36 -0
- package/src/modules/assortment/hooks/useReorderAssortmentFilters.ts +39 -0
- package/src/modules/assortment/hooks/useReorderAssortmentLinks.ts +37 -0
- package/src/modules/assortment/hooks/useReorderAssortmentMedia.ts +37 -0
- package/src/modules/assortment/hooks/useReorderAssortmentProducts.ts +39 -0
- package/src/modules/assortment/hooks/useTranslatedAssortmentMediaTexts.ts +41 -0
- package/src/modules/assortment/hooks/useTranslatedAssortmentTexts.ts +40 -0
- package/src/modules/assortment/hooks/useUpdateAssortment.ts +43 -0
- package/src/modules/assortment/hooks/useUpdateAssortmentMediaTexts.ts +45 -0
- package/src/modules/assortment/hooks/useUpdateAssortmentTexts.ts +42 -0
- package/src/modules/common/fragments/AddressFragment.ts +16 -0
- package/src/modules/common/hooks/useApp.ts +11 -0
- package/src/modules/common/hooks/useBulkActionConfirmation.tsx +68 -0
- package/src/modules/common/hooks/useBulkResultHandler.ts +83 -0
- package/src/modules/common/hooks/useBulkSelection.ts +86 -0
- package/src/modules/common/hooks/useCSVExport.ts +94 -0
- package/src/modules/common/hooks/useCSVImport.ts +69 -0
- package/src/modules/common/hooks/useChatEndpointChecker.ts +25 -0
- package/src/modules/common/hooks/useConfirmMediaUpload.ts +45 -0
- package/src/modules/common/hooks/useDashboardMetrics.ts +42 -0
- package/src/modules/common/hooks/useLocalStorage.ts +34 -0
- package/src/modules/common/hooks/useOrderAnalytics.ts +139 -0
- package/src/modules/common/hooks/useOrderItemsAnalytics.ts +107 -0
- package/src/modules/common/hooks/useOutsideClick.ts +29 -0
- package/src/modules/common/hooks/usePortal.ts +54 -0
- package/src/modules/common/hooks/useScrollRestoration.ts +123 -0
- package/src/modules/common/hooks/useShopConfiguration.ts +83 -0
- package/src/modules/common/hooks/useShopInfo.ts +66 -0
- package/src/modules/common/hooks/useStatusTypes.ts +29 -0
- package/src/modules/common/hooks/useSystemRoles.ts +29 -0
- package/src/modules/common/hooks/useTheme.ts +14 -0
- package/src/modules/copilot/hooks/useAvailableTools.ts +92 -0
- package/src/modules/copilot/hooks/useChatManager.ts +169 -0
- package/src/modules/copilot/hooks/useToolTextNormalizer.ts +84 -0
- package/src/modules/country/fragments/CountryFragment.ts +17 -0
- package/src/modules/country/hooks/useCountries.ts +66 -0
- package/src/modules/country/hooks/useCountry.ts +34 -0
- package/src/modules/country/hooks/useCreateCountry.ts +41 -0
- package/src/modules/country/hooks/useRemoveCountry.ts +38 -0
- package/src/modules/country/hooks/useUpdateCountry.ts +42 -0
- package/src/modules/currency/fragments/CurrencyFragment.ts +13 -0
- package/src/modules/currency/hooks/useCreateCurrency.ts +48 -0
- package/src/modules/currency/hooks/useCurrencies.ts +68 -0
- package/src/modules/currency/hooks/useCurrency.ts +34 -0
- package/src/modules/currency/hooks/useRemoveCurrency.ts +38 -0
- package/src/modules/currency/hooks/useUpdateCurrency.ts +47 -0
- package/src/modules/delivery-provider/hooks/useCreateDeliveryProvider.ts +67 -0
- package/src/modules/delivery-provider/hooks/useDeliveryInterfacesByType.ts +38 -0
- package/src/modules/delivery-provider/hooks/useDeliveryProvider.ts +60 -0
- package/src/modules/delivery-provider/hooks/useDeliveryProviderTypes.ts +34 -0
- package/src/modules/delivery-provider/hooks/useDeliveryProviders.ts +59 -0
- package/src/modules/delivery-provider/hooks/useRemoveDeliveryProvider.ts +38 -0
- package/src/modules/delivery-provider/hooks/useUpdateDeliveryProvider.ts +68 -0
- package/src/modules/enrollment/fragments/EnrollmentDetailFragment.ts +111 -0
- package/src/modules/enrollment/fragments/EnrollmentFragment.ts +66 -0
- package/src/modules/enrollment/hooks/useActivateEnrollment.ts +36 -0
- package/src/modules/enrollment/hooks/useEnrollment.ts +39 -0
- package/src/modules/enrollment/hooks/useEnrollments.ts +70 -0
- package/src/modules/enrollment/hooks/useSendEnrollmentEmail.ts +35 -0
- package/src/modules/enrollment/hooks/useSuspendEnrollment.ts +31 -0
- package/src/modules/enrollment/hooks/useTerminateEnrollment.ts +48 -0
- package/src/modules/enrollment/hooks/useUpdateEnrollmentExpires.ts +38 -0
- package/src/modules/enrollment/hooks/useUpdateEnrollmentPlan.ts +45 -0
- package/src/modules/enrollment/hooks/useUserEnrollments.ts +61 -0
- package/src/modules/event/fragments/EventFragment.ts +12 -0
- package/src/modules/event/hooks/useEvent.ts +32 -0
- package/src/modules/event/hooks/useEventTypes.ts +29 -0
- package/src/modules/event/hooks/useEvents.ts +77 -0
- package/src/modules/filter/fragments/FilterFragment.ts +24 -0
- package/src/modules/filter/fragments/FilterOptionFragment.ts +16 -0
- package/src/modules/filter/fragments/FilterTextsFragment.ts +12 -0
- package/src/modules/filter/hooks/useBulkFilterOperations.ts +59 -0
- package/src/modules/filter/hooks/useCreateFilter.ts +44 -0
- package/src/modules/filter/hooks/useCreateFilterOption.ts +42 -0
- package/src/modules/filter/hooks/useFilter.ts +44 -0
- package/src/modules/filter/hooks/useFilterExport.ts +35 -0
- package/src/modules/filter/hooks/useFilterOptions.ts +40 -0
- package/src/modules/filter/hooks/useFilterTypes.ts +34 -0
- package/src/modules/filter/hooks/useFilters.ts +78 -0
- package/src/modules/filter/hooks/useFiltersCount.ts +37 -0
- package/src/modules/filter/hooks/usePrepareFilterImport.ts +142 -0
- package/src/modules/filter/hooks/useRemoveFilter.ts +34 -0
- package/src/modules/filter/hooks/useRemoveFilterOption.ts +40 -0
- package/src/modules/filter/hooks/useTranslatedFilterTexts.ts +40 -0
- package/src/modules/filter/hooks/useUpdateFilter.ts +38 -0
- package/src/modules/filter/hooks/useUpdateFilterTexts.ts +48 -0
- package/src/modules/forms/hooks/useField.ts +151 -0
- package/src/modules/forms/hooks/useForm.ts +210 -0
- package/src/modules/forms/hooks/useFormContext.ts +7 -0
- package/src/modules/language/fragments/LanguageFragment.ts +13 -0
- package/src/modules/language/hooks/useCreateLanguage.ts +40 -0
- package/src/modules/language/hooks/useLanguage.ts +34 -0
- package/src/modules/language/hooks/useLanguages.ts +64 -0
- package/src/modules/language/hooks/useRemoveLanguage.ts +38 -0
- package/src/modules/language/hooks/useUpdateLanguage.ts +42 -0
- package/src/modules/modal/hooks/useModal.ts +8 -0
- package/src/modules/order/fragments/OrderDetailFragment.ts +254 -0
- package/src/modules/order/fragments/OrderFragment.ts +42 -0
- package/src/modules/order/hooks/useConfirmOrder.ts +36 -0
- package/src/modules/order/hooks/useDeliverOrder.ts +36 -0
- package/src/modules/order/hooks/useOrder.ts +35 -0
- package/src/modules/order/hooks/useOrders.ts +105 -0
- package/src/modules/order/hooks/usePayOrder.ts +36 -0
- package/src/modules/order/hooks/useRejectOrder.ts +36 -0
- package/src/modules/order/hooks/useRemoveOrder.ts +36 -0
- package/src/modules/order/hooks/useUserCart.ts +71 -0
- package/src/modules/order/hooks/useUserOrders.ts +65 -0
- package/src/modules/payment-providers/fragments/PaymentProviderFragment.ts +21 -0
- package/src/modules/payment-providers/hooks/useCreatePaymentProvider.ts +43 -0
- package/src/modules/payment-providers/hooks/usePaymentInterfacesByType.ts +38 -0
- package/src/modules/payment-providers/hooks/usePaymentProvider.ts +39 -0
- package/src/modules/payment-providers/hooks/usePaymentProviderTypes.ts +34 -0
- package/src/modules/payment-providers/hooks/usePaymentProviders.ts +42 -0
- package/src/modules/payment-providers/hooks/useRemovePaymentProvider.ts +38 -0
- package/src/modules/payment-providers/hooks/useUpdatePaymentProvider.ts +47 -0
- package/src/modules/product/fragments/ProductAssignmentFragment.ts +39 -0
- package/src/modules/product/fragments/ProductBriefFragment.ts +57 -0
- package/src/modules/product/fragments/ProductCatalogPriceFragment.ts +23 -0
- package/src/modules/product/fragments/ProductDetailFragment.ts +51 -0
- package/src/modules/product/fragments/ProductDimensionFragment.ts +12 -0
- package/src/modules/product/fragments/ProductMediaFragment.ts +24 -0
- package/src/modules/product/fragments/ProductMediaTextsFragment.ts +12 -0
- package/src/modules/product/fragments/ProductPlanConfigurationFragment.ts +14 -0
- package/src/modules/product/fragments/ProductTextsFragment.ts +17 -0
- package/src/modules/product/fragments/ProductVariationFragment.ts +27 -0
- package/src/modules/product/fragments/TokenFragment.ts +24 -0
- package/src/modules/product/hooks/useAddProductAssignment.ts +46 -0
- package/src/modules/product/hooks/useAddProductMedia.ts +47 -0
- package/src/modules/product/hooks/useBulkProductOperations.ts +123 -0
- package/src/modules/product/hooks/useCreateProduct.ts +72 -0
- package/src/modules/product/hooks/useCreateProductBundleItem.ts +40 -0
- package/src/modules/product/hooks/useCreateProductVariation.ts +46 -0
- package/src/modules/product/hooks/useCreateProductVariationOption.ts +46 -0
- package/src/modules/product/hooks/useExportToken.ts +51 -0
- package/src/modules/product/hooks/useMenuPosition.ts +34 -0
- package/src/modules/product/hooks/usePrepareProductImport.ts +350 -0
- package/src/modules/product/hooks/useProduct.ts +93 -0
- package/src/modules/product/hooks/useProductAssignments.ts +71 -0
- package/src/modules/product/hooks/useProductBundleItems.ts +61 -0
- package/src/modules/product/hooks/useProductCatalogPrices.ts +39 -0
- package/src/modules/product/hooks/useProductExport.ts +90 -0
- package/src/modules/product/hooks/useProductFulfillmentSimulation.ts +137 -0
- package/src/modules/product/hooks/useProductMedia.ts +44 -0
- package/src/modules/product/hooks/useProductPlan.ts +50 -0
- package/src/modules/product/hooks/useProductPlanConfigurationOptions.ts +42 -0
- package/src/modules/product/hooks/useProductReviews.ts +62 -0
- package/src/modules/product/hooks/useProductSupply.ts +52 -0
- package/src/modules/product/hooks/useProductTokenization.ts +52 -0
- package/src/modules/product/hooks/useProductVariationTypes.ts +34 -0
- package/src/modules/product/hooks/useProductVariations.ts +50 -0
- package/src/modules/product/hooks/useProductWarehousing.ts +45 -0
- package/src/modules/product/hooks/useProducts.ts +111 -0
- package/src/modules/product/hooks/useProductsCount.ts +54 -0
- package/src/modules/product/hooks/usePublishProduct.ts +39 -0
- package/src/modules/product/hooks/useReOrderProductMedia.ts +36 -0
- package/src/modules/product/hooks/useRemoveBundleItem.ts +37 -0
- package/src/modules/product/hooks/useRemoveProduct.ts +36 -0
- package/src/modules/product/hooks/useRemoveProductAssignment.ts +40 -0
- package/src/modules/product/hooks/useRemoveProductMedia.ts +36 -0
- package/src/modules/product/hooks/useRemoveProductVariation.ts +36 -0
- package/src/modules/product/hooks/useRemoveProductVariationOption.ts +43 -0
- package/src/modules/product/hooks/useScaffoldBundleItem.ts +38 -0
- package/src/modules/product/hooks/useScaffoldVariationProduct.ts +50 -0
- package/src/modules/product/hooks/useSmartContractStandards.ts +34 -0
- package/src/modules/product/hooks/useTranslatedProductMediaTexts.ts +39 -0
- package/src/modules/product/hooks/useTranslatedProductTexts.ts +42 -0
- package/src/modules/product/hooks/useUnPublishProduct.ts +39 -0
- package/src/modules/product/hooks/useUpdateProduct.ts +46 -0
- package/src/modules/product/hooks/useUpdateProductCommerce.ts +50 -0
- package/src/modules/product/hooks/useUpdateProductMediaTexts.ts +42 -0
- package/src/modules/product/hooks/useUpdateProductPlan.ts +54 -0
- package/src/modules/product/hooks/useUpdateProductSupply.ts +60 -0
- package/src/modules/product/hooks/useUpdateProductTexts.ts +39 -0
- package/src/modules/product/hooks/useUpdateProductTokenization.ts +58 -0
- package/src/modules/product/hooks/useUpdateProductVariationTexts.ts +50 -0
- package/src/modules/product/hooks/useUpdateProductWarehousing.ts +50 -0
- package/src/modules/product/hooks/useUserTokens.ts +48 -0
- package/src/modules/product/index.ts +3 -0
- package/src/modules/product-review/fragments/ProductReviewDetailFragment.ts +55 -0
- package/src/modules/product-review/hooks/useAddProductReviewVote.ts +55 -0
- package/src/modules/product-review/hooks/useCreateProductReview.ts +47 -0
- package/src/modules/product-review/hooks/useProductReviewsByProductId.ts +70 -0
- package/src/modules/product-review/hooks/useRemoveProductReview.ts +38 -0
- package/src/modules/product-review/hooks/useRemoveProductReviewVote.ts +43 -0
- package/src/modules/product-review/hooks/useUserProductReviews.ts +92 -0
- package/src/modules/quotation/fragments/QuotationDetailFragment.ts +71 -0
- package/src/modules/quotation/fragments/QuotationFragment.ts +54 -0
- package/src/modules/quotation/hooks/useMakeQuotationProposal.ts +41 -0
- package/src/modules/quotation/hooks/useQuotation.ts +37 -0
- package/src/modules/quotation/hooks/useQuotations.ts +61 -0
- package/src/modules/quotation/hooks/useRejectQuotation.ts +41 -0
- package/src/modules/quotation/hooks/useUserQuotations.ts +60 -0
- package/src/modules/quotation/hooks/useVerifyQuotation.ts +41 -0
- package/src/modules/search/fragments/GlobalSearchFragment.ts +20 -0
- package/src/modules/search/hooks/useGlobalSearch.ts +168 -0
- package/src/modules/token/hooks/useInvalidateTicket.ts +27 -0
- package/src/modules/token/hooks/useToken.ts +64 -0
- package/src/modules/token/hooks/useTokens.ts +72 -0
- package/src/modules/warehousing-providers/fragments/WarehousingProviderFragment.ts +21 -0
- package/src/modules/warehousing-providers/hooks/useCreateWarehousingProvider.ts +46 -0
- package/src/modules/warehousing-providers/hooks/useRemoveWarehousingProvider.ts +38 -0
- package/src/modules/warehousing-providers/hooks/useUpdateWarehousingProvider.ts +47 -0
- package/src/modules/warehousing-providers/hooks/useWarehousingInterfacesByType.ts +38 -0
- package/src/modules/warehousing-providers/hooks/useWarehousingProvider.ts +39 -0
- package/src/modules/warehousing-providers/hooks/useWarehousingProviderTypes.ts +34 -0
- package/src/modules/warehousing-providers/hooks/useWarehousingProviders.ts +41 -0
- package/src/modules/work/fragments/WorkFragment.ts +24 -0
- package/src/modules/work/hooks/useActiveWorkTypes.ts +29 -0
- package/src/modules/work/hooks/useAddWork.ts +62 -0
- package/src/modules/work/hooks/useAllocateWork.ts +40 -0
- package/src/modules/work/hooks/useRecentExports.ts +129 -0
- package/src/modules/work/hooks/useRegisteredWorkTypes.ts +27 -0
- package/src/modules/work/hooks/useRemoveWork.ts +36 -0
- package/src/modules/work/hooks/useWork.ts +42 -0
- package/src/modules/work/hooks/useWorkQueue.ts +98 -0
- package/src/sdk/README.md +2 -2
- package/out/_next/static/BPoacQET3TJr2q9E370Ez/_buildManifest.js +0 -262
- package/out/_next/static/chunks/02ir8k2vqhw7u.js +0 -4
- package/out/_next/static/chunks/03mdkmx9pb3yx.js +0 -28
- package/out/_next/static/chunks/03spbldywp99b.js +0 -31
- package/out/_next/static/chunks/0531sa8v36e39.js +0 -1
- package/out/_next/static/chunks/065ltxdt7s8b2.js +0 -134
- package/out/_next/static/chunks/06b1jza2fvc6f.js +0 -4
- package/out/_next/static/chunks/0701uizxsgs75.js +0 -4
- package/out/_next/static/chunks/09olk50zbo5r6.js +0 -5
- package/out/_next/static/chunks/09pabifvs84zb.js +0 -12
- package/out/_next/static/chunks/0_pn7w49dpkak.js +0 -5
- package/out/_next/static/chunks/0a_gulnq-c7to.js +0 -709
- package/out/_next/static/chunks/0agx-csdwbk-x.js +0 -5
- package/out/_next/static/chunks/0clmvy-auef0p.js +0 -14
- package/out/_next/static/chunks/0czktxcs2aa12.js +0 -1
- package/out/_next/static/chunks/0d_qylr054ab-.js +0 -5
- package/out/_next/static/chunks/0e2znhpcecrqs.js +0 -175
- package/out/_next/static/chunks/0ef4vp3ehm369.js +0 -4
- package/out/_next/static/chunks/0fggi8jpi5gjk.js +0 -165
- package/out/_next/static/chunks/0gyabz3vqllr6.js +0 -83
- package/out/_next/static/chunks/0j05dboa5_xkw.js +0 -5
- package/out/_next/static/chunks/0kr4ift9_1a3s.js +0 -1
- package/out/_next/static/chunks/0l8tmlevl_6p0.js +0 -1
- package/out/_next/static/chunks/0o91usftba97q.js +0 -54
- package/out/_next/static/chunks/0oi1kpp0levnm.js +0 -1
- package/out/_next/static/chunks/0p86ng98eiz5q.js +0 -11
- package/out/_next/static/chunks/0pw1zl8_l93xl.js +0 -5
- package/out/_next/static/chunks/0py8-umjmwiwi.js +0 -156
- package/out/_next/static/chunks/0q0m2pv-3b2e2.js +0 -4
- package/out/_next/static/chunks/0r57e83u39trg.js +0 -5
- package/out/_next/static/chunks/0r9a_mcjh1k24.js +0 -6
- package/out/_next/static/chunks/0rgtc82y8z7_x.js +0 -5
- package/out/_next/static/chunks/0rxhx_x-7dojh.js +0 -182
- package/out/_next/static/chunks/0s6u_6w75ggbw.js +0 -297
- package/out/_next/static/chunks/0teb3b5h78855.js +0 -44
- package/out/_next/static/chunks/0thsuuvsozjop.js +0 -54
- package/out/_next/static/chunks/0v6x3uondh5hw.js +0 -5
- package/out/_next/static/chunks/0v_uz3j8jolmq.js +0 -4
- package/out/_next/static/chunks/0vwmp6qrw7odm.js +0 -7
- package/out/_next/static/chunks/0w6t6v_jzrudq.js +0 -4
- package/out/_next/static/chunks/0w7gz501ry22r.js +0 -4
- package/out/_next/static/chunks/0xgn-89s97a5w.js +0 -1
- package/out/_next/static/chunks/0xqtemh7t38y9.js +0 -119
- package/out/_next/static/chunks/1-1rj15j67dqt.js +0 -1
- package/out/_next/static/chunks/10drou7w-k58p.js +0 -4
- package/out/_next/static/chunks/11w7hldkge7sg.js +0 -8
- package/out/_next/static/chunks/130c8cta7pec6.js +0 -1
- package/out/_next/static/chunks/13qi39a_b6gkv.js +0 -1
- package/out/_next/static/chunks/15142badc5ufq.js +0 -4
- package/out/_next/static/chunks/155boltbcvwo-.js +0 -63
- package/out/_next/static/chunks/15_nwd8p454gd.js +0 -1
- package/out/_next/static/chunks/15s4qkdyz56pg.js +0 -115
- package/out/_next/static/chunks/15vdx0kewzv-6.js +0 -33
- package/out/_next/static/chunks/16shuavdpgni8.js +0 -327
- package/out/_next/static/chunks/170j06y4-47o4.js +0 -5
- package/out/_next/static/chunks/18a5kibvycb6u.js +0 -1
- package/out/_next/static/chunks/1_bckhq06wfmb.js +0 -4
- package/out/_next/static/chunks/1_ymf_rfke1aw.js +0 -6
- package/out/_next/static/chunks/1a1m389awxw4k.js +0 -1
- package/out/_next/static/chunks/1albq_5cppsa1.js +0 -5
- package/out/_next/static/chunks/1bhibqf8k2-z1.js +0 -117
- package/out/_next/static/chunks/1bxesp6kakz8_.js +0 -353
- package/out/_next/static/chunks/1d80ahah359g5.js +0 -174
- package/out/_next/static/chunks/1dbjry-rs_5we.js +0 -1
- package/out/_next/static/chunks/1dlr1eig6zpl1.js +0 -12
- package/out/_next/static/chunks/1gq8ickcg_vmv.js +0 -147
- package/out/_next/static/chunks/1gyrsx1nip-lm.js +0 -2
- package/out/_next/static/chunks/1hma23kynopdj.js +0 -3
- package/out/_next/static/chunks/1i996uxxmc736.js +0 -234
- package/out/_next/static/chunks/1ivhp-mi-5l--.js +0 -57
- package/out/_next/static/chunks/1ktkks-wpk8q-.js +0 -1
- package/out/_next/static/chunks/1kz62r46jwi0y.js +0 -5
- package/out/_next/static/chunks/1lex3myb5hmsw.js +0 -1
- package/out/_next/static/chunks/1lha1nklxo2g7.js +0 -1
- package/out/_next/static/chunks/1mwmcucidjio0.js +0 -8
- package/out/_next/static/chunks/1mzejejof4s6g.js +0 -147
- package/out/_next/static/chunks/1os6pvhjeb16o.js +0 -1
- package/out/_next/static/chunks/1p937fyqa7ssz.js +0 -1
- package/out/_next/static/chunks/1po7d3udj6iv4.js +0 -5
- package/out/_next/static/chunks/1qxxbcidu-hmv.js +0 -1
- package/out/_next/static/chunks/1re4i2t_po4sr.js +0 -95
- package/out/_next/static/chunks/1s4oi1bw8zl5d.js +0 -31
- package/out/_next/static/chunks/1sb04cqudnfpj.js +0 -4
- package/out/_next/static/chunks/1uom050rz5iol.js +0 -272
- package/out/_next/static/chunks/1uymuiqrms2h8.js +0 -103
- package/out/_next/static/chunks/1wijj_fal57co.js +0 -2
- package/out/_next/static/chunks/1wpen9t3_zbte.js +0 -1
- package/out/_next/static/chunks/1wpv1sl7vwg04.js +0 -99
- package/out/_next/static/chunks/1y3poj860g968.js +0 -24
- package/out/_next/static/chunks/1yk0pxcl4urkd.js +0 -4
- package/out/_next/static/chunks/1z2rl3h7scna4.js +0 -7
- package/out/_next/static/chunks/1zyhq82pkterc.js +0 -61
- package/out/_next/static/chunks/2-4610weysas_.js +0 -1
- package/out/_next/static/chunks/2-zr9-ri30va5.css +0 -1
- package/out/_next/static/chunks/20j8cdot33hql.js +0 -13
- package/out/_next/static/chunks/21fo9zerxyx-l.js +0 -59
- package/out/_next/static/chunks/22sxsq82r3cwy.js +0 -41
- package/out/_next/static/chunks/23nwkbry8kz0-.js +0 -1
- package/out/_next/static/chunks/259ckrmoldaqg.js +0 -5
- package/out/_next/static/chunks/25y2dqqrhstuq.js +0 -5
- package/out/_next/static/chunks/28myh-gi8t3t7.js +0 -7
- package/out/_next/static/chunks/29y82c6-u55hj.js +0 -5
- package/out/_next/static/chunks/2ahlen2u4lbnm.js +0 -16
- package/out/_next/static/chunks/2c3ehieqiwiw8.js +0 -119
- package/out/_next/static/chunks/2c5gq6izeq6nx.js +0 -81
- package/out/_next/static/chunks/2cj8g3fxmitaa.js +0 -1
- package/out/_next/static/chunks/2d9lzme_uzwvq.js +0 -1
- package/out/_next/static/chunks/2dqoft2pp4355.js +0 -1
- package/out/_next/static/chunks/2gso7_8v7owco.js +0 -1
- package/out/_next/static/chunks/2hc4nowrexhn3.js +0 -100
- package/out/_next/static/chunks/2hoi6cb1lromr.js +0 -4
- package/out/_next/static/chunks/2hw2_8kkf_2fg.js +0 -1
- package/out/_next/static/chunks/2kd4p_esjbozz.js +0 -21
- package/out/_next/static/chunks/2lwhn1ypqwukz.js +0 -11
- package/out/_next/static/chunks/2oz432iieo_c6.js +0 -43
- package/out/_next/static/chunks/2qjnhmz4c5fq1.js +0 -23
- package/out/_next/static/chunks/2rdjgc7_za785.js +0 -9
- package/out/_next/static/chunks/2ru66cyp0hbxn.js +0 -103
- package/out/_next/static/chunks/2ung-az_h871_.js +0 -4
- package/out/_next/static/chunks/2v4rvvdyh028e.js +0 -1
- package/out/_next/static/chunks/2vsl3-revotpl.js +0 -43
- package/out/_next/static/chunks/2wbc_9uwtsjbp.js +0 -15
- package/out/_next/static/chunks/2xixk0t9e9mnw.js +0 -1
- package/out/_next/static/chunks/2y6i_xssusr93.js +0 -1
- package/out/_next/static/chunks/2y_t26eglpeka.js +0 -4
- package/out/_next/static/chunks/3-hgyqm9mhcm9.js +0 -33
- package/out/_next/static/chunks/364y5vueeinvz.js +0 -276
- package/out/_next/static/chunks/366b9y413lk4d.js +0 -33
- package/out/_next/static/chunks/36vauyb71ot_b.js +0 -61
- package/out/_next/static/chunks/394m309ssmlo3.js +0 -5
- package/out/_next/static/chunks/39pveojee3ma1.js +0 -33
- package/out/_next/static/chunks/3_--novhq2u1q.js +0 -807
- package/out/_next/static/chunks/3apnk6kuvwze8.js +0 -5
- package/out/_next/static/chunks/3b0868kyqqkn3.js +0 -5
- package/out/_next/static/chunks/3dcwbsiechj8e.js +0 -7
- package/out/_next/static/chunks/3dyd0ilb-ee5w.js +0 -8
- package/out/_next/static/chunks/3eftzknnu45-s.js +0 -1
- package/out/_next/static/chunks/3ejsx4af27cct.js +0 -7
- package/out/_next/static/chunks/3es4yddhl8uwc.js +0 -7
- package/out/_next/static/chunks/3inp15oicq85k.js +0 -1
- package/out/_next/static/chunks/3kd-t_qz3nxh7.js +0 -30
- package/out/_next/static/chunks/3kl8vv7w9jkjr.js +0 -23
- package/out/_next/static/chunks/3kmfx3f7oyfdm.js +0 -5
- package/out/_next/static/chunks/3koj4-48a7p_9.js +0 -4
- package/out/_next/static/chunks/3l7glrtu8ueuo.js +0 -4
- package/out/_next/static/chunks/3lgq9oa_2erwo.js +0 -5
- package/out/_next/static/chunks/3muxcxam24i5z.js +0 -1
- package/out/_next/static/chunks/3nimt7ngr5zv6.js +0 -46
- package/out/_next/static/chunks/3pwezwpggrz59.js +0 -74
- package/out/_next/static/chunks/3r02t7a7jknrv.js +0 -7
- package/out/_next/static/chunks/3s40iuaou1rt4.js +0 -1
- package/out/_next/static/chunks/3selzn479n73i.js +0 -16
- package/out/_next/static/chunks/3srflqnqdfd60.js +0 -5
- package/out/_next/static/chunks/3t57k35xu2eo8.js +0 -5
- package/out/_next/static/chunks/3tu90a7do336z.js +0 -12
- package/out/_next/static/chunks/3ukgj2jzxf10n.js +0 -5
- package/out/_next/static/chunks/3vosu-lpiis6v.js +0 -5
- package/out/_next/static/chunks/3xaz8fvw2x6b3.js +0 -5
- package/out/_next/static/chunks/3xgjhwzul66dp.js +0 -4
- package/out/_next/static/chunks/3zze6y1x00k__.js +0 -165
- package/out/_next/static/chunks/40730dyt912zu.js +0 -5
- package/out/_next/static/chunks/40f26tfp8txip.js +0 -5
- package/out/_next/static/chunks/40kc42ezz2dri.js +0 -1
- package/out/_next/static/chunks/41f60q88qcigi.js +0 -39
- package/out/_next/static/chunks/41l5iphw-rna3.js +0 -44
- package/out/_next/static/chunks/423kk9x5t9_b8.js +0 -5
- package/out/_next/static/chunks/42k5e3tr3uyzs.js +0 -54
- package/out/_next/static/chunks/4481d7yj7bm2q.js +0 -5
- package/out/_next/static/chunks/448is1kpt9eaa.js +0 -39
- package/out/_next/static/chunks/44fkzg2e80pqt.js +0 -8
- /package/out/_next/static/{BPoacQET3TJr2q9E370Ez → WEaZ5SW9HLnJWzXs84JMH}/_clientMiddlewareManifest.js +0 -0
- /package/out/_next/static/{BPoacQET3TJr2q9E370Ez → WEaZ5SW9HLnJWzXs84JMH}/_ssgManifest.js +0 -0
|
@@ -1,709 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42929,10878,97057,95379,51628,e=>{var t=e.i(91398),s=e.i(69322);e.i(51523);var a=e.i(19518),i=e.i(25705),l=e.i(50243),r=e.i(94330),d=e.i(43054),n=e.i(95336),o=e.i(16113),c=e.i(82191),u=e.i(31004),m=e.i(76929),f=e.i(27927),p=e.i(61113),x=e.i(49740),g=e.i(11056),h=e.i(42532),v=e.i(10785),b=e.i(1330),y=e.i(73356),j=e.i(50099),w=e.i(77035),N=e.i(56902),M=e.i(72264),P=e.i(56779),_=e.i(19051),I=e.i(11907),C=e.i(34948),k=e.i(41418),$=e.i(58971),S=e.i(91788),T=e.i(44112),V=e.i(5505),D=e.i(53296),E=e.i(59080),R=e.i(32171),q=e.i(1880);let A=E.a`
|
|
2
|
-
fragment ProductAssignmentFragment on ProductVariationAssignment {
|
|
3
|
-
_id
|
|
4
|
-
vectors {
|
|
5
|
-
_id
|
|
6
|
-
option {
|
|
7
|
-
_id
|
|
8
|
-
value
|
|
9
|
-
texts {
|
|
10
|
-
_id
|
|
11
|
-
title
|
|
12
|
-
subtitle
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
variation {
|
|
16
|
-
_id
|
|
17
|
-
key
|
|
18
|
-
texts {
|
|
19
|
-
_id
|
|
20
|
-
locale
|
|
21
|
-
title
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
product {
|
|
26
|
-
_id
|
|
27
|
-
texts {
|
|
28
|
-
_id
|
|
29
|
-
title
|
|
30
|
-
slug
|
|
31
|
-
subtitle
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`,O=E.a`
|
|
36
|
-
query ProductAssignments($productId: ID, $slug: String) {
|
|
37
|
-
product(productId: $productId, slug: $slug) {
|
|
38
|
-
_id
|
|
39
|
-
... on ConfigurableProduct {
|
|
40
|
-
texts {
|
|
41
|
-
_id
|
|
42
|
-
subtitle
|
|
43
|
-
slug
|
|
44
|
-
title
|
|
45
|
-
}
|
|
46
|
-
variations {
|
|
47
|
-
_id
|
|
48
|
-
key
|
|
49
|
-
texts {
|
|
50
|
-
_id
|
|
51
|
-
title
|
|
52
|
-
}
|
|
53
|
-
options {
|
|
54
|
-
_id
|
|
55
|
-
value
|
|
56
|
-
texts {
|
|
57
|
-
_id
|
|
58
|
-
title
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
assignments(includeInactive: true) {
|
|
63
|
-
...ProductAssignmentFragment
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
${A}
|
|
69
|
-
`;var L=e.i(8918);let U=(e,t,s)=>{let a=e[s],i=[];return(a?.values.filter(e=>e.length).forEach(e=>{let s={};s[a.key]=e,t.length>0?t.forEach(e=>{i.push({...e,...s})}):i.push(s)}),e.length>s+1)?U(e,i,s+1):Array.from(new Set(i.map(e=>JSON.stringify(e)))).map(e=>JSON.parse(e))},F=({_id:e,texts:t})=>({value:e,label:t?.title});var Q=e.i(21623),B=e.i(24557),z=e.i(24994),X=e.i(2765),K=e.i(15971),W=e.i(6607),Z=e.i(76204);let H=E.a`
|
|
70
|
-
mutation AddProductAssignment(
|
|
71
|
-
$proxyId: ID!
|
|
72
|
-
$productId: ID!
|
|
73
|
-
$vectors: [ProductAssignmentVectorInput!]!
|
|
74
|
-
) {
|
|
75
|
-
addProductAssignment(
|
|
76
|
-
proxyId: $proxyId
|
|
77
|
-
productId: $productId
|
|
78
|
-
vectors: $vectors
|
|
79
|
-
) {
|
|
80
|
-
_id
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`,G=()=>{let[e]=(0,Z.f)(H);return{addProductAssignment:async({productId:t,proxyId:s,vectors:a})=>e({variables:{productId:t,proxyId:s,vectors:a},refetchQueries:["ProductAssignments"]})}};var J=e.i(24112);let Y=E.a`
|
|
84
|
-
mutation RemoveProductAssignment(
|
|
85
|
-
$proxyId: ID!
|
|
86
|
-
$vectors: [ProductAssignmentVectorInput!]!
|
|
87
|
-
) {
|
|
88
|
-
removeProductAssignment(proxyId: $proxyId, vectors: $vectors) {
|
|
89
|
-
_id
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
`;var ee=e.i(41158),et=e.i(57748),es=e.i(98949),ea=e.i(69211),ei=e.i(16984),el=e.i(21128);let er={SimpleProduct:"SIMPLE_PRODUCT",BundleProduct:"BUNDLE_PRODUCT",PlanProduct:"PLAN_PRODUCT",ConfigurableProduct:"CONFIGURABLE_PRODUCT",TokenizedProduct:"TOKENIZED_PRODUCT"};e.s(["f",0,er],10878);var ed=e.i(38994);let en=function({proxyProduct:e,vectors:t,onSuccess:a,locale:i}){let{createProduct:l}=(0,ed.f)(),{addProductAssignment:r}=G(),{formatMessage:d}=(0,s.X)();return async({title:s,type:n})=>{let o=[{title:s,slug:s.toLowerCase().replace(/\s+/g,"-"),locale:i}],{data:c}=await l({product:{type:n||er.SimpleProduct},texts:o}),u=c?.createProduct,m=u?._id;if(!m)throw Error(d({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return await r({productId:m,proxyId:e?._id,vectors:t}),a?.(u),{success:!0}}};var eo=e.i(10685),ec=e.i(57561);let eu=({proxyProduct:e,vectors:i,onSuccess:l})=>{let{formatMessage:r}=(0,s.X)(),{selectedLocale:d}=(0,ec.f)(),n=en({onSuccess:l,proxyProduct:e,vectors:i,locale:d}),{hasRole:o}=(0,$.f)(),c=(0,S.useMemo)(()=>i.map(({value:e})=>e),[i]),u=(0,S.useMemo)(()=>{let t=e?.texts?.title??"";return`${c.join("-")} ${t}`.trim()},[c,e]),m=async({title:e,type:t})=>{try{return await n({title:e,type:t}),{success:!0}}catch(e){return{success:!1,error:{message:e?.message}}}},f=r({id:"product-scaffolded-success",defaultMessage:"Product scaffolded successfully"}),p=(0,es.f)({submit:m,successMessage:f,enableReinitialize:!0,initialValues:{title:u,type:a.f.SimpleProduct}});return(0,t.jsxs)(ea.f,{className:"mt-3 rounded-md",form:p,children:[(0,t.jsxs)("div",{className:"p-5 pb-7 sm:max-w-full flex flex-col gap-3",children:[(0,t.jsx)(ei.f,{name:"title",id:"title",label:r({id:"name",defaultMessage:"Name"}),required:!0,className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(eo.f,{className:"mt-1 w-full",label:r({id:"type",defaultMessage:"Type"}),placeholder:r({id:"type",defaultMessage:"Type"}),required:!0,name:"type",options:Object.fromEntries(Object.entries(a.f).map(([e,t])=>[t,e]))})]}),o(a.C.ManageProducts)&&(0,t.jsx)("div",{className:"border-t border-t-border-subtle bg-surface-subtle p-5 text-right",children:(0,t.jsx)(el.f,{label:r({id:"scaffold_product",defaultMessage:"Scaffold"})})})]})},em=({columns:e,variationProduct:i,product:l,loading:r,disabled:d,proxyId:n,columnKeys:o})=>{let{formatMessage:c}=(0,s.X)(),[u,m]=(0,S.useState)(""),{addProductAssignment:f}=G(),{removeProductAssignment:p}=(()=>{let[e]=(0,Z.f)(Y);return{removeProductAssignment:async({proxyId:t,vectors:s})=>e({variables:{proxyId:t,vectors:s},refetchQueries:["ProductAssignments"]})}})(),{hasRole:x}=(0,$.f)(),{setModal:g}=(0,W.f)(),{products:h}=(0,J.f)({queryString:u,limit:50,sort:[{key:"created",value:a.A.Desc}]}),v=(0,S.useMemo)(()=>e.map((e,t)=>({key:o[t],value:e})).filter(({value:e})=>e),[e,o]),b=(0,S.useCallback)(async e=>{e&&"string"==typeof e&&await f({proxyId:n,productId:e,vectors:v})},[v,f,n]),y=(0,S.useCallback)(async()=>{await g((0,t.jsx)(K.f,{onCancelClick:async()=>g(""),message:c({id:"delete_product_assignment",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this assignment? "}),onOkClick:async()=>{g(""),await p({proxyId:n,vectors:v})},okText:c({id:"delete_variation_assignment",defaultMessage:"Delete assignment"})}))},[n,v,c,g,p]),j=(0,S.useMemo)(()=>(0,X.f)(200)(m),[]),w=!i&&l?.variations?.length!==e?.length,N=(0,S.useMemo)(()=>h?.map(F).filter(({value:e})=>e!==n)||[],[h,n]),M=async()=>{await g((0,t.jsx)(eu,{proxyProduct:l,vectors:v,onSuccess:()=>{g(null)}}))};return(0,t.jsxs)(L.f.Row,{children:[e.map((e,s)=>(0,t.jsx)(L.f.Cell,{className:"font-medium",children:e},`${e}`)),(0,t.jsx)(L.f.Cell,{children:i?(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)(ee.default,{href:`/products?slug=${(0,q.U)(i)}`,children:(0,t.jsx)("span",{className:"text-green-700 dark:text-green-300 font-medium",children:i?.texts?.title})})}):w?(0,t.jsx)("div",{className:"mt-1 text-sm text-rose-600 italic",children:c({id:"assign_product_needs_variations",defaultMessage:"Please configure all variation options before assigning a product."})}):(0,t.jsx)("div",{className:"relative w-full",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(z.f,{name:"productId",placeholder:c({id:"search_product",defaultMessage:"Search product"}),isLoading:r,disabled:d,onChange:b,onSearch:j,options:N,className:"mt-1 w-full"})}),x(a.C.ManageProducts)&&(0,t.jsx)(Q.f,{onClick:M,children:(0,t.jsx)(et.f,{className:"h-5 w-5"})})]})})}),(0,t.jsx)(L.f.Cell,{children:i&&i._id&&(0,t.jsx)(Q.f,{variant:"danger",size:"xs",rounded:"full",icon:(0,t.jsx)(B.f,{className:"h-5 w-5"}),onClick:y})})]})};var ef=e.i(82078);let ep=({proxyId:e,disabled:a=!1})=>{let{formatMessage:i}=(0,s.X)(),{product:l,loading:r}=(({productId:e=null,slug:t=null}={})=>{let s=(0,q.Q)(t),{data:a,loading:i,error:l}=(0,R.f)(O,{skip:!e&&!s,variables:{productId:e||s}});return{product:a?.product,loading:i,error:l}})({productId:e}),d=l&&l?.variations||[],n=l&&l.assignments||[],o=(0,S.useMemo)(()=>d.filter(({options:e})=>e.length).map(({key:e})=>e),[d]),c=(0,S.useMemo)(()=>d.map(({key:e,options:t})=>({values:t?.map(e=>e.value),key:e})),[d]),u=(0,S.useMemo)(()=>{let e=c.filter(({values:e})=>e?.length);return e.length>0?U(e,[],0):[]},[c]),m=(0,S.useMemo)(()=>n.map(e=>{let t={};return o.forEach(s=>{let a=e.vectors.find(e=>e.variation?.key===s);t[s]=a?.option?.value??""}),t}),[n,o]),f=(0,S.useMemo)(()=>{let e=[...u,...m],t=new Set;return e.filter(e=>{let s=Object.values(e).join("::");return!t.has(s)&&(t.add(s),!0)})},[u,m]),p=(0,S.useMemo)(()=>n.map(e=>{let t={};return e.vectors.forEach(e=>{e?.variation?.key&&e?.option?.value&&(t[e.variation.key]=e.option.value)}),{keys:t,product:e.product}}),[n]),x=(0,S.useMemo)(()=>f.map(e=>{let t=p.find(({keys:t})=>Object.entries(t).every(([t,s])=>e[t]===s));return{_id:Object.values(e).join("::"),product:t?.product,columns:Object.values(e),columnsText:Object.values(e)}}),[f,p]),g=(0,S.useMemo)(()=>d.length>0,[d]),h=(0,S.useMemo)(()=>d.some(e=>e.options&&e.options.length>0),[d]);return(0,t.jsxs)(V.U,{children:[(0,t.jsx)(ef.f,{title:i({id:"product_assignments_explanation_title",defaultMessage:"About Product Assignments"}),description:i({id:"product_assignments_explanation_text",defaultMessage:"Product assignments allow you to link specific products to each unique combination of variation options. For example, if you have a t-shirt with 'Size' and 'Color' variations, you can assign different product SKUs to each combination like 'Large + Red' or 'Small + Blue'. This is useful for managing inventory, pricing, and product details for each specific variant."})}),!g&&(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 dark:bg-gray-800 mb-4",children:(0,t.jsx)(T.f,{className:"w-8 h-8 text-gray-400"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-text-primary mb-2",children:i({id:"no_variations_configured",defaultMessage:"No variations configured yet. Please add variations and their options in the Variations tab first."})})]}),g&&h&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(D.f,{messageKey:"assignment_matrix_help",defaultMessage:"Each row represents a unique combination of your product variations. Assign a specific product to each combination to create a complete product catalog."})}),(0,t.jsxs)(L.f,{children:[(0,t.jsxs)(L.f.Row,{children:[o.map(e=>(0,t.jsx)(L.f.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:d.find(t=>t.key===e)?.texts?.title||e},e)),(0,t.jsx)(L.f.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:i({id:"assigned_product_column_header",defaultMessage:"Assigned Product"})}),(0,t.jsx)(L.f.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:i({id:"actions_column_header",defaultMessage:"Actions"})})]}),x.length>0&&x.map(({_id:s,columns:i,product:d})=>(0,t.jsx)(em,{columns:i,disabled:a,loading:r,product:l,variationProduct:d,columnKeys:o,proxyId:e},s))]})]}),g&&!h&&(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-yellow-100 dark:bg-yellow-900/30 mb-4",children:(0,t.jsx)(T.f,{className:"w-8 h-8 text-yellow-600 dark:text-yellow-400"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-text-primary mb-2",children:i({id:"assign_product_needs_variations",defaultMessage:"Please configure all variation options before assigning a product."})}),(0,t.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:i({id:"assignment_matrix_help",defaultMessage:"Each row represents a unique combination of your product variations. Assign a specific product to each combination to create a complete product catalog."})})]})]})};var ex=e.i(60195),eg=e.i(1504);let eh=E.a`
|
|
93
|
-
query ProductTokenization($productId: ID, $slug: String) {
|
|
94
|
-
product(productId: $productId, slug: $slug) {
|
|
95
|
-
_id
|
|
96
|
-
... on TokenizedProduct {
|
|
97
|
-
contractConfiguration {
|
|
98
|
-
tokenId
|
|
99
|
-
supply
|
|
100
|
-
}
|
|
101
|
-
contractStandard
|
|
102
|
-
contractAddress
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
`,ev=E.a`
|
|
107
|
-
query SmartContractStandards {
|
|
108
|
-
smartContractStandards: __type(name: "SmartContractStandard") {
|
|
109
|
-
options: enumValues {
|
|
110
|
-
value: name
|
|
111
|
-
label: name
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
`,eb=E.a`
|
|
116
|
-
mutation UpdateProductTokenization(
|
|
117
|
-
$productId: ID!
|
|
118
|
-
$tokenization: UpdateProductTokenizationInput!
|
|
119
|
-
) {
|
|
120
|
-
updateProductTokenization(
|
|
121
|
-
productId: $productId
|
|
122
|
-
tokenization: $tokenization
|
|
123
|
-
) {
|
|
124
|
-
_id
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
`,ey=({productId:e,disabled:i=!1})=>{let{formatMessage:l}=(0,s.X)(),{hasRole:r}=(0,$.f)(),{smartContractStandards:d}=(()=>{let{data:e,loading:t,error:s}=(0,R.f)(ev);return{smartContractStandards:e?.smartContractStandards?.options||[],loading:t,error:s}})(),{updateProductTokenization:n}=(()=>{let[e]=(0,Z.f)(eb);return{updateProductTokenization:async({productId:t,tokenization:{contractAddress:s,contractStandard:a,tokenId:i,supply:l}})=>e({variables:{productId:t,tokenization:{contractAddress:s,contractStandard:a,tokenId:i,supply:parseInt(l,10)}},refetchQueries:["Product","Products"]})}})(),{product:o,loading:c}=(({productId:e=null,slug:t=null}={})=>{let s=(0,q.Q)(t),{data:a,loading:i,error:l}=(0,R.f)(eh,{skip:!e&&!t,variables:{productId:e||s}});return{product:a?.product,loading:i,error:l}})({productId:e}),u=async({contractAddress:t,contractStandard:s,tokenId:a,supply:i})=>(await n({productId:e,tokenization:{contractAddress:t,contractStandard:s,tokenId:a||"",supply:i}}),{success:!0}),m=l({id:"token_updated",defaultMessage:"Token update successfully!"}),f=(0,es.f)({disabled:i,submit:u,successMessage:m,initialValues:{contractAddress:"",contractStandard:"",tokenId:"",supply:""}});return(0,S.useEffect)(()=>{c||f.api.setValues({contractAddress:o?.contractAddress||"",contractStandard:o?.contractStandard||"",tokenId:o?.contractConfiguration?.tokenId||"",supply:o?.contractConfiguration?.supply||""})},[c]),(0,t.jsx)(ex.f,{documentationLabel:l({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,t.jsx)(s.L,{id:"tokenized_product_text_form_description",defaultMessage:"<b>Contract standards </b> <ol> \n <dt><b> ERC721 </b></dt> <dd> Buying multiple Products leads to multiple Tokens (make sure to set the tokenId to 0 to make it auto generate new id's) </dd>\n <dt> <b> ERC1155 </b></dt> <dd> Buying multiple Products leads to a new token with balance 3 of token with tokenId assigned </dd>\n <dt> <b> Contract address </b></dt> <dd> Address of a token on a given network </dd> </ol>",values:{ol:e=>(0,t.jsxs)("ol",{children:[e," "]}),dt:e=>(0,t.jsxs)("dt",{className:"bold",children:[e," "]}),dd:e=>(0,t.jsxs)("dd",{children:[e," "]}),b:e=>(0,t.jsxs)("b",{children:[e," "]})}}),children:(0,t.jsx)(V.U,{children:(0,t.jsxs)(ea.f,{form:f,children:[(0,t.jsxs)("div",{className:"p-5 pb-7 sm:max-w-full flex flex-col gap-y-5",children:[(0,t.jsx)(eo.f,{className:"w-full",label:l({id:"contract-standard",defaultMessage:"Contract standard"}),placeholder:l({id:"contract-standard",defaultMessage:"Contract standard"}),required:!0,name:"contractStandard",options:(0,eg.f)(d,"label","value")}),(0,t.jsx)(ei.f,{name:"contractAddress",id:"contractAddress",label:l({id:"contract-address-label",defaultMessage:"Contract Address"}),placeholder:l({id:"contract-address-label",defaultMessage:"Contract Address"}),required:!0,className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(ei.f,{name:"supply",id:"supply",type:"number",label:l({id:"token-supply",defaultMessage:"Supply"}),placeholder:l({id:"token-supply",defaultMessage:"Supply"}),required:!0,className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(ei.f,{name:"tokenId",id:"tokenId",label:l({id:"token-id-label",defaultMessage:"Token Serial Number"}),placeholder:l({id:"token-id-label",defaultMessage:"Token Serial Number"}),className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"})]}),r(a.C.ManageProducts)&&(0,t.jsx)("div",{className:"space-y-6 border-t border-t-border-subtle bg-surface-subtle p-5 text-right",children:(0,t.jsx)(el.f,{label:l({id:"update_token",defaultMessage:"Update token"})})})]})})})};var ej=e.i(31494),ew=e.i(83788),eN=e.i(13534),eM=e.i(70475);let eP=({id:e,selectedView:s="",disableAll:a=!1,...i})=>{if("texts"===s)return(0,t.jsx)(g.f,{children:(0,t.jsx)(v.f,{productId:e,disabled:a})});if("media"===s)return(0,t.jsx)(ew.f,{children:(0,t.jsx)(g.f,{children:(0,t.jsx)(b.f,{productId:e})})});if("commerce"===s)return(0,t.jsx)(h.f,{productId:e,disabled:a});if("supply"===s)return(0,t.jsx)(j.f,{productId:e,disabled:a});if("warehousing"===s)return(0,t.jsx)(N.f,{productId:e,disabled:a});if("fulfillment"===s)return(0,t.jsx)(M.f,{productId:e});if("variations"===s)return(0,t.jsx)(g.f,{children:(0,t.jsx)(w.f,{productId:e,disabled:a})});if("bundled_products"===s)return(0,t.jsx)(g.f,{children:(0,t.jsx)(I.f,{productId:e,disabled:a})});if("subscriptions"===s)return(0,t.jsx)(y.f,{productId:e,disabled:a});if("reviews"===s)return(0,t.jsx)(_.f,{productId:e});if("assignments"===s)return(0,t.jsx)(g.f,{children:(0,t.jsx)(ep,{proxyId:e,disabled:a})});if("token"===s)return(0,t.jsx)(ey,{productId:e,disabled:a});if("extended"===s)return(0,t.jsx)(ej.f,{data:i});if(s?.startsWith("plugin:")){let a=s.replace("plugin:","");return(0,t.jsx)(eM.f,{slot:"product:tabs",entityId:e,children:(s,i)=>i.component===a?(0,t.jsx)(s,{entityId:e}):null})}return(0,t.jsx)(g.f,{children:(0,t.jsx)(v.f,{productId:e})})};e.s(["f",0,({product:e,extendedData:g={}})=>{let{formatMessage:h}=(0,s.X)(),{hasRole:v}=(0,$.f)(),{updateProduct:b}=(0,k.f)(),{shopInfo:y}=(0,ec.f)(),{getSlotPlugins:j}=(0,eN.L)(),{__typename:w}=e||{},N=[{id:"texts",title:h({id:"general_text",defaultMessage:"Text"}),Icon:(0,t.jsx)(i.f,{className:"h-5 w-5"})},{id:"media",title:h({id:"media",defaultMessage:"Media"}),Icon:(0,t.jsx)(l.f,{className:"h-5 w-5"})},"ConfigurableProduct"!==w&&{id:"commerce",title:h({id:"commerce",defaultMessage:"Commerce"}),Icon:(0,t.jsx)(r.f,{className:"h-5 w-5"})},"SimpleProduct"===w&&{id:"supply",title:h({id:"supply",defaultMessage:"Supply"}),Icon:(0,t.jsx)(d.f,{className:"h-5 w-5"})},"SimpleProduct"===w&&{id:"warehousing",title:h({id:"warehousing",defaultMessage:"Warehousing"}),Icon:(0,t.jsx)(n.f,{className:"h-5 w-5"})},"SimpleProduct"===w&&{id:"fulfillment",title:h({id:"fulfillment",defaultMessage:"Fulfillment"}),Icon:(0,t.jsx)(x.f,{className:"h-5 w-5"})},"ConfigurableProduct"===w&&{id:"variations",title:h({id:"variations",defaultMessage:"Variations"}),Icon:(0,t.jsx)(o.f,{className:"h-5 w-5"})},"BundleProduct"===w&&{id:"bundled_products",title:h({id:"bundled_items",defaultMessage:"Bundled items"}),Icon:(0,t.jsx)(c.f,{className:"h-5 w-5"})},"PlanProduct"===w&&{id:"subscriptions",title:h({id:"subscriptions",defaultMessage:"Subscriptions"}),Icon:(0,t.jsx)(u.f,{className:"h-5 w-5"})},"ConfigurableProduct"===w&&{id:"assignments",title:h({id:"assignments",defaultMessage:"Assignments"}),Icon:(0,t.jsx)(f.f,{className:"h-5 w-5"})},"TokenizedProduct"===w&&{id:"token",title:h({id:"token",defaultMessage:"Token"}),Icon:(0,t.jsx)(f.f,{className:"h-5 w-5"})},{id:"reviews",title:h({id:"reviews",defaultMessage:"Reviews"}),Icon:(0,t.jsx)(p.f,{className:"h-5 w-5"})},null!==g&&{id:"extended",title:h({id:"extended-fields",defaultMessage:"Extended"}),Icon:(0,t.jsx)(m.f,{className:"h-5 w-5"})}].filter(e=>e),M=j("product:tabs").map(({config:e})=>({id:`plugin:${e.component}`,title:e.label,Icon:(0,t.jsx)(m.f,{className:"h-5 w-5"})}));N.push(...M);let _=async({tags:t})=>(await b({productId:e?._id,product:{tags:t}}),!0);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mt-5 flex flex-wrap items-center justify-between gap-10",children:(0,t.jsx)(C.f,{defaultValue:e?.tags,onSubmit:_,enableEdit:v(a.C.ManageProducts),availableTagOptions:y?.adminUiConfig?.productTags.filter(t=>!(e?.tags||[])?.includes(t)).map(e=>({value:e,label:e}))})}),(0,t.jsx)(P.f,{tabItems:N,defaultTab:"texts",children:(0,t.jsx)(eP,{disableAll:e?.status===a.X.Deleted,id:e?._id,...g})})]})}],42929);var e_=e.i(87284);e.s(["f",0,({media:e=[],onEditMedia:s})=>(0,t.jsx)("div",{className:"my-5",children:(0,t.jsx)("div",{className:"flex gap-3 overflow-x-auto",children:e.map(e=>(0,t.jsx)("div",{className:"relative flex-shrink-0 group",children:(0,t.jsx)("div",{className:"w-16 h-16 bg-surface-raised rounded-lg overflow-hidden cursor-pointer border border-border-subtle",onClick:()=>{var t;return t=e._id,void(s&&s(t))},children:(0,t.jsx)(e_.f,{src:e?.file?.url,alt:e.texts?.[0]?.title||e?.file?.url,width:128,height:128,className:"w-full h-full object-cover"})})},e._id))})})],97057);var eI=e.i(62199);let eC=E.a`
|
|
128
|
-
mutation PublishProduct($productId: ID!) {
|
|
129
|
-
publishProduct(productId: $productId) {
|
|
130
|
-
...ProductDetailFragment
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
${eI.f}
|
|
134
|
-
`;e.s(["f",0,()=>{let[e]=(0,Z.f)(eC);return{publishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],95379);let ek=E.a`
|
|
135
|
-
mutation UnpublishProduct($productId: ID!) {
|
|
136
|
-
unpublishProduct(productId: $productId) {
|
|
137
|
-
...ProductDetailFragment
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
${eI.f}
|
|
141
|
-
`;e.s(["f",0,()=>{let[e]=(0,Z.f)(ek);return{unPublishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],51628)},88604,e=>{var t=e.i(59080),s=e.i(76204);let a=t.a`
|
|
142
|
-
mutation RemoveProduct($productId: ID!) {
|
|
143
|
-
removeProduct(productId: $productId) {
|
|
144
|
-
_id
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
`;e.s(["f",0,()=>{let[e]=(0,s.f)(a);return{removeProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},41418,e=>{var t=e.i(59080),s=e.i(76204),a=e.i(62199);let i=t.a`
|
|
148
|
-
mutation UpdateProduct($productId: ID!, $product: UpdateProductInput!) {
|
|
149
|
-
updateProduct(productId: $productId, product: $product) {
|
|
150
|
-
...ProductDetailFragment
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
${a.f}
|
|
154
|
-
`;e.s(["f",0,()=>{let[e]=(0,s.f)(i);return{updateProduct:async({productId:t,product:{tags:s,sequence:a,meta:i}})=>e({variables:{productId:t,product:{tags:s,sequence:a,meta:i}},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},30311,e=>{var t=e.i(91398),s=e.i(69322);e.i(51523);var a=e.i(19518),i=e.i(28401),l=e.i(50595),r=e.i(53576),d=e.i(25327),n=e.i(84818),o=e.i(42929),c=e.i(97057),u=e.i(84278),m=e.i(92276),f=e.i(95379),p=e.i(51628),x=e.i(41418),g=e.i(21623),h=e.i(88604),v=e.i(6607),b=e.i(15971),y=e.i(41215),j=e.i(3828),w=e.i(58971),N=e.i(24608),M=e.i(91788),P=e.i(34728);e.s(["default",0,({slug:e})=>{let{formatMessage:_}=(0,s.X)(),{formatDateTime:I}=(0,n.f)(),{hasRole:C}=(0,w.f)(),{publishProduct:k}=(0,f.f)(),{unPublishProduct:$}=(0,p.f)(),{removeProduct:S}=(0,h.f)(),{updateProduct:T}=(0,x.f)(),{setModal:V}=(0,v.f)(),D=(0,j.useRouter)(),{push:E}=(0,j.useRouter)(),{product:R,loading:q,error:A,extendedData:O}=(0,u.f)({slug:e}),L=R?.status||"DRAFT",U=(0,M.useMemo)(()=>[{id:"published",title:_({id:"published",defaultMessage:"Published"}),description:_({id:"publish_product_description",defaultMessage:"Product will be searchable and is available for orders"}),current:"ACTIVE"===L,selectedTitle:_({id:"published",defaultMessage:"Published"}),onClick:async()=>{try{await k({productId:R?._id}),i.toast.success(_({id:"product_published",defaultMessage:"Published successfully "}))}catch(t){console.error("Failed to publish product:",t);let e=t?.message||"Unknown error";i.toast.error(`${_({id:"product_publish_error",defaultMessage:"Failed to publish product"})}: ${e}`)}},bgColor:"green",disable:!C(a.C.ManageProducts)},{id:"draft",title:_({id:"draft",defaultMessage:"Draft"}),description:_({id:"draft_product_description",defaultMessage:"Product will not be discoverable and can not be orderose"}),current:"DRAFT"===L,selectedTitle:_({id:"not_published",defaultMessage:"Not published"}),bgColor:"amber",disable:"ACTIVE"===L&&!C(a.C.ManageProducts),onClick:async()=>{if(C(a.C.ManageProducts))try{await $({productId:R?._id}),i.toast.success(_({id:"product_drafted",defaultMessage:"Drafted successfully "}))}catch(t){console.error("Failed to unpublish product:",t);let e=t?.message||"Unknown error";i.toast.error(`${_({id:"product_unpublish_error",defaultMessage:"Failed to unpublish product"})}: ${e}`)}}}],[R]);if(A)return console.error("Error loading product:",A),(0,t.jsx)("div",{className:"mt-5 max-w-full",children:(0,t.jsx)("div",{className:"text-center py-8",children:(0,t.jsx)("p",{className:"text-danger",children:_({id:"product_load_error",defaultMessage:"Failed to load product"})})})});let F=async e=>{e.target.value&&await T({productId:R?._id,product:{sequence:parseInt(e.target.value,10)}})},Q=async()=>{"proxies"in R&&R.proxies?.length?await V((0,t.jsx)(P.f,{headerText:_({id:"product_delete_blocked_header",defaultMessage:"Remove links before deleting"}),message:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{children:_({id:"product_delete_blocked_intro",defaultMessage:"This product is linked to the following product types:"})}),(0,t.jsx)("ul",{className:"list-disc list-inside text-sm text-text-secondary",children:"proxies"in R&&R.proxies.map(({__typename:e},s)=>(0,t.jsx)("li",{children:e.replace("Product","")},s))}),(0,t.jsx)("p",{children:_({id:"product_delete_blocked_action",defaultMessage:"Please unlink it before trying to delete it."})})]}),buttonText:_({id:"ok",defaultMessage:"Ok"}),onOkClick:()=>V(null)})):await V((0,t.jsx)(b.f,{onCancelClick:()=>V(""),message:_({id:"delete_product_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it and it is nonreversible. Are you sure you want to delete this product?"}),onOkClick:async()=>{V("");try{await S({productId:R?._id}),i.toast.success(_({id:"product_deleted_success",defaultMessage:"Deleted successfully"})),D.push("/products")}catch(e){await V((0,t.jsx)(b.f,{onCancelClick:()=>V(""),headerText:_({id:"error",defaultMessage:"Error"}),message:e instanceof y.f?e.message:e,icon:(0,t.jsx)("div",{className:"mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-rose-100 dark:bg-rose-900/30 sm:mx-0 sm:h-10 sm:w-10",children:(0,t.jsx)(N.f,{className:"h-6 w-6 text-danger",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})}),okText:_({id:"ok",defaultMessage:"Ok"}),onOkClick:async()=>{V("")}}))}}}))};return R||q?q?(0,t.jsx)(r.f,{}):(0,t.jsxs)("div",{className:"mt-5 max-w-full",children:[(0,t.jsx)(l.f,{routeName:e,depth:3,currentPageTitle:R?.texts?.title}),"DELETED"===L&&(0,t.jsx)("div",{className:"mb-4 rounded-md border border-rose-300 bg-rose-50 p-4 text-sm text-rose-800 dark:border-rose-700 dark:bg-rose-900/30 dark:text-rose-300",children:_({id:"product_deleted_notice",defaultMessage:"This product has been deleted and is no longer active. Some actions may be restricted."})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"items-center flex-wrap flex gap-5 min-w-full justify-between",children:[(0,t.jsx)(d.f,{headerText:(0,t.jsxs)(t.Fragment,{children:[R?.texts?.title||"Untitled Product","DELETED"===L&&(0,t.jsx)("span",{className:"ml-3 rounded bg-rose-100 px-2 py-1 text-xs font-semibold text-rose-800 dark:bg-rose-900/40 dark:text-rose-300",children:_({id:"deleted_status",defaultMessage:"Deleted"})})]}),title:`${R?.texts?.title||"Product"} (${R?._id})`}),(0,t.jsxs)("div",{className:"publish-and-order flex flex-wrap gap-3",children:[L&&"DELETED"!==L&&(0,t.jsx)(m.f,{options:U,type:_({id:"product",defaultMessage:"Product"})}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-md dark:border-slate-600 px-4 py-2 text-sm font-medium leading-5 shadow-xs bg-surface h-[38px]",children:[(0,t.jsx)("label",{htmlFor:"sequence-input",className:"text-text-secondary font-medium cursor-pointer",children:_({id:"sequence",defaultMessage:"Display Order"})}),(0,t.jsx)("input",{type:"number",id:"sequence-input",disabled:!C(a.C.ManageProducts),className:"text-center w-12 bg-transparent border border-border-default rounded focus:ring-2 focus:ring-focus-ring focus:border-transparent focus:outline-none text-sm font-semibold text-text-primary px-2 py-1 transition-all",defaultValue:R?.sequence,onBlur:F})]}),"DRAFT"===L&&C(a.C.ManageProducts)&&(0,t.jsx)(g.f,{variant:"danger",icon:(0,t.jsx)(N.f,{className:"h-5 w-5"}),text:"Delete",onClick:Q})]})]}),(0,t.jsxs)("div",{className:"mt-8 flex flex-wrap gap-3 gap-x-10 text-text-secondary",children:[(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsx)("span",{className:"mr-2 text-xs text-text-muted",children:"ID:"}),(0,t.jsx)("span",{className:"text-sm font-mono",children:R?._id})]}),(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsx)("span",{className:"text-xs text-text-muted",children:"Type:"}),(0,t.jsx)("p",{className:"text-sm font-mono",children:R?.__typename})]}),R?.created&&(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[_({id:"created",defaultMessage:"Created"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:I(R.created,{dateStyle:"medium",timeStyle:"short"})})]}),R?.updated&&(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[_({id:"updated",defaultMessage:"Updated"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:I(R.updated,{dateStyle:"medium",timeStyle:"short"})})]}),R?.published&&(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[_({id:"published",defaultMessage:"Published"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:I(R.published,{dateStyle:"medium",timeStyle:"short"})})]})]})]}),(0,t.jsx)(c.f,{productId:R?._id,media:R?.media||[],onEditMedia:e=>{D.push({pathname:D.pathname,query:{...D.query,tab:"media"}},void 0,{shallow:!0})},canEdit:C(a.C.ManageProducts)}),(0,t.jsx)(o.f,{product:R,extendedData:O})]}):(E("/404"),null)}])},43054,95336,16113,82191,42532,10785,1330,73356,50099,77035,56902,72264,19051,84278,11907,e=>{var t=e.i(91788);let s=t.forwardRef(function({title:e,titleId:s,...a},i){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},e):null,t.createElement("path",{d:"M12 9a1 1 0 0 1-1-1V3c0-.552.45-1.007.997-.93a7.004 7.004 0 0 1 5.933 5.933c.078.547-.378.997-.93.997h-5Z"}),t.createElement("path",{d:"M8.003 4.07C8.55 3.994 9 4.449 9 5v5a1 1 0 0 0 1 1h5c.552 0 1.008.45.93.997A7.001 7.001 0 0 1 2 11a7.002 7.002 0 0 1 6.003-6.93Z"}))});e.s(["f",0,s],43054);let a=t.forwardRef(function({title:e,titleId:s,...a},i){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},e):null,t.createElement("path",{d:"M2 3a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H2Z"}),t.createElement("path",{fillRule:"evenodd",d:"M2 7.5h16l-.811 7.71a2 2 0 0 1-1.99 1.79H4.802a2 2 0 0 1-1.99-1.79L2 7.5ZM7 11a1 1 0 0 1 1-1h4a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1Z",clipRule:"evenodd"}))});e.s(["f",0,a],95336);let i=t.forwardRef(function({title:e,titleId:s,...a},i){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},e):null,t.createElement("path",{fillRule:"evenodd",d:"M3.5 2A1.5 1.5 0 0 0 2 3.5V15a3 3 0 1 0 6 0V3.5A1.5 1.5 0 0 0 6.5 2h-3Zm11.753 6.99L9.5 14.743V6.257l1.51-1.51a1.5 1.5 0 0 1 2.122 0l2.121 2.121a1.5 1.5 0 0 1 0 2.122ZM8.364 18H16.5a1.5 1.5 0 0 0 1.5-1.5v-3a1.5 1.5 0 0 0-1.5-1.5h-2.136l-6 6ZM5 16a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"}))});e.s(["f",0,i],16113);let l=t.forwardRef(function({title:e,titleId:s,...a},i){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},e):null,t.createElement("path",{fillRule:"evenodd",d:"M1 2.75A.75.75 0 0 1 1.75 2h16.5a.75.75 0 0 1 0 1.5H18v8.75A2.75 2.75 0 0 1 15.25 15h-1.072l.798 3.06a.75.75 0 0 1-1.452.38L13.41 18H6.59l-.114.44a.75.75 0 0 1-1.452-.38L5.823 15H4.75A2.75 2.75 0 0 1 2 12.25V3.5h-.25A.75.75 0 0 1 1 2.75ZM7.373 15l-.391 1.5h6.037l-.392-1.5H7.373Zm7.49-8.931a.75.75 0 0 1-.175 1.046 19.326 19.326 0 0 0-3.398 3.098.75.75 0 0 1-1.097.04L8.5 8.561l-2.22 2.22A.75.75 0 1 1 5.22 9.72l2.75-2.75a.75.75 0 0 1 1.06 0l1.664 1.663a20.786 20.786 0 0 1 3.122-2.74.75.75 0 0 1 1.046.176Z",clipRule:"evenodd"}))});e.s(["f",0,l],82191);var r=e.i(91398);e.i(51523);var d=e.i(19518),n=e.i(58021),o=e.i(69322),c=e.i(58971),u=e.i(5505),m=e.i(1504),f=e.i(98520),p=e.i(79093),x=e.i(30434),g=e.i(69211),h=e.i(63094),v=e.i(10685),b=e.i(21128),y=e.i(16984),j=e.i(21623),w=e.i(98949),N=e.i(82226),M=e.i(59080),P=e.i(32171);let _=M.a`
|
|
155
|
-
fragment ProductCatalogPriceFragment on ProductCatalogPrice {
|
|
156
|
-
isTaxable
|
|
157
|
-
isNetPrice
|
|
158
|
-
country {
|
|
159
|
-
_id
|
|
160
|
-
isoCode
|
|
161
|
-
name
|
|
162
|
-
flagEmoji
|
|
163
|
-
}
|
|
164
|
-
currency {
|
|
165
|
-
_id
|
|
166
|
-
isoCode
|
|
167
|
-
isActive
|
|
168
|
-
}
|
|
169
|
-
amount
|
|
170
|
-
minQuantity
|
|
171
|
-
}
|
|
172
|
-
`,I=M.a`
|
|
173
|
-
query ProductCatalogPrices($productId: ID!) {
|
|
174
|
-
productCatalogPrices(productId: $productId) {
|
|
175
|
-
...ProductCatalogPriceFragment
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
${_}
|
|
179
|
-
`;var C=e.i(76204),k=e.i(62199);let $=M.a`
|
|
180
|
-
mutation UpdateProductCommerce(
|
|
181
|
-
$productId: ID!
|
|
182
|
-
$commerce: UpdateProductCommerceInput!
|
|
183
|
-
) {
|
|
184
|
-
updateProductCommerce(productId: $productId, commerce: $commerce) {
|
|
185
|
-
...ProductDetailFragment
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
${k.f}
|
|
189
|
-
`,S=({defaultCountryValue:e,defaultCurrencyValue:t,countries:s,currencies:a})=>{let{formatMessage:i}=(0,o.X)(),{hasRole:l}=(0,c.f)(),{watch:u,getValues:f,trigger:p}=(0,n.useFormContext)(),{fields:g,append:h,remove:b}=(0,n.useFieldArray)({name:"pricing"});u("pricing");let w=()=>f("pricing"),M=()=>{let e=g.map((e,t)=>`pricing.${t}.minQuantity`);setTimeout(()=>p(e),0)};return(0,r.jsxs)("div",{children:[g.map((n,o)=>{let c=[(0,N.D)(o,w)];return 0===o&&c.push((0,N.P)(w)),(0,r.jsxs)("div",{className:"relative max-w-full border-b dark:border-slate-700 pt-1 pb-5 mb-3 align-baseline lg:flex",children:[(0,r.jsxs)("div",{className:"flex w-full gap-x-2",children:[(0,r.jsx)(y.f,{className:"w-full",disabled:!l(d.C.ManageProducts),validators:c,name:`pricing.${o}.minQuantity`,id:`pricing.${o}.minQuantity`,type:"number",min:0,hideLabel:!0,onChange:M,label:i({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)(y.f,{type:"number",className:"w-full",disabled:!l(d.C.ManageProducts),name:`pricing.${o}.amount`,id:`pricing.${o}.amount`,required:!0,hideLabel:!0,label:i({id:"price",defaultMessage:"Price "})})]}),(0,r.jsxs)("div",{className:"flex w-full gap-x-2 pt-3 pb-2",children:[(0,r.jsx)("div",{className:"w-full lg:ml-8 lg:items-center",children:(0,r.jsx)(x.f,{name:`pricing.${o}.isTaxable`,labelClassName:"lg:sr-only items-center ",disabled:!l(d.C.ManageProducts),label:i({id:"vat_suspect",defaultMessage:"Vat Suspect"}),className:"mr-2 h-4 w-4 rounded-sm border-border-default bg-white dark:!bg-slate-900 text-slate-950 focus:ring-focus-ring lg:items-center",type:"checkbox"})}),(0,r.jsx)("div",{className:"w-full lg:ml-8",children:(0,r.jsx)(x.f,{name:`pricing.${o}.isNetPrice`,labelClassName:"lg:sr-only items-center",disabled:!l(d.C.ManageProducts),label:i({id:"net_price",defaultMessage:"Net Price"}),hideLabel:!0,className:"mr-2 h-4 w-4 justify-between rounded-sm border-border-default bg-white dark:!bg-slate-900 text-slate-950 focus:ring-focus-ring lg:items-center",type:"checkbox"})})]}),(0,r.jsxs)("div",{className:"flex w-full gap-x-2 mt-1",children:[(0,r.jsx)(v.f,{defaultValue:e,className:"w-full lg:ml-4 lg:mr-4",label:i({id:"country",defaultMessage:"Country"}),name:`pricing.${o}.countryCode`,id:`pricing.${o}.countryCode`,disabled:!l(d.C.ManageProducts),required:!0,options:(0,m.f)(s,"isoCode","isoCode"),hideLabel:!0}),(0,r.jsx)(v.f,{defaultValue:t,className:"w-full lg:mr-8 ",label:i({id:"currency",defaultMessage:"Currency"}),disabled:!l(d.C.ManageProducts),name:`pricing.${o}.currencyCode`,id:`pricing.${o}.currencyCode`,required:!0,options:(0,m.f)(a,"isoCode","isoCode"),hideLabel:!0,placeholder:i({id:"country_currency",defaultMessage:"Currency"})})]}),l(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"absolute -top-2 right-0 mt-0 mr-0 shrink-0 pb-1 md:mr-0 lg:mt-6 lg:py-0 lg:px-0 ",children:(0,r.jsx)("button",{className:"items-center rounded-full bg-surface-input px-1 py-1 text-sm text-rose-500 dark:text-rose-400 hover:bg-rose-50 focus:outline-hidden focus:ring-0 focus:ring-rose-500 focus:ring-offset-2",type:"button",onClick:()=>b(o),children:(0,r.jsxs)("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,r.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),(0,r.jsx)("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),(0,r.jsx)("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})})})]},n.id)}),l(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(j.f,{variant:"tertiary",text:i({id:"add_price_row",defaultMessage:"Add Price Row"}),className:"w-full items-center justify-center",onClick:()=>h({minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:t,countryCode:e})})})]})};e.s(["f",0,({productId:e,disabled:t=!1})=>{let{formatMessage:s}=(0,o.X)(),{catalogPrices:a}=(({productId:e})=>{let{data:t,loading:s,error:a}=(0,P.f)(I,{skip:!e,variables:{productId:e}});return{catalogPrices:t?.productCatalogPrices||[],loading:s,error:a}})({productId:e}),{hasRole:i}=(0,c.f)(),{updateProductCommerce:l}=(()=>{let[e]=(0,C.f)($),{currencies:t}=(0,p.f)();return{updateProductCommerce:async({productId:s,commerce:{pricing:a}})=>e({variables:{productId:s,commerce:{pricing:a.map(e=>{let s=t.find(({isoCode:t})=>t===e.currencyCode),a=((e,t)=>{if(!e||t<0)return 0;let s=e.trim();if(!/^-?\d*\.?\d*$/.test(s))return 0;let a=s.indexOf(".");return -1===a?Number(s)*10**t:Number((s.slice(0,a)||"0")+s.slice(a+1).slice(0,t).padEnd(t,"0"))})(e.amount.toString(),s.decimals);return{...e,amount:a}})}},refetchQueries:["Products"]})}})(),{countries:n}=(0,f.f)(),{currencies:m}=(0,p.f)(),x=n?.find(({isBase:e})=>e),v=x?.isoCode,y=x?.defaultCurrency?.isoCode,j=async({pricing:t})=>(await l({productId:e,commerce:{pricing:t}}),{success:!0}),N=s({id:"saved",defaultMessage:"Saved"}),M=((e=[],t=[])=>t.length?e.map(e=>{let s=t.find(({isoCode:t})=>t.toLowerCase()===e.currency.isoCode.toLowerCase());return{countryCode:e.country.isoCode,currencyCode:e.currency.isoCode,isTaxable:!!e.isTaxable,isNetPrice:!!e.isNetPrice,amount:((e,t)=>{if(t<0)return"0";if(0===t)return e.toString();let s=e.toString();if("0"===s)return"0."+"0".repeat(t);let a=s.startsWith("-"),i=a?s.slice(1):s;if(i.length<=t){let e=i.padStart(t,"0");return`${a?"-":""}0.${e}`}let l=i.length-t,r=i.slice(0,l),d=i.slice(l);return`${a?"-":""}${r}.${d}`})(e.amount,s?.decimals),minQuantity:e.minQuantity}}):[])(a,m),_=(0,w.f)({disabled:t,submit:j,successMessage:N,enableReinitialize:!0,initialValues:{pricing:[...M?.length?M:[{minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:y,countryCode:v}]]}});return(0,r.jsx)("div",{children:(0,r.jsxs)("div",{className:"mt-5 md:col-span-3 lg:mt-0",children:[(0,r.jsx)(u.U,{children:(0,r.jsxs)(g.f,{className:"mt-3 rounded-md",form:_,disabled:!i(d.C.ManageProducts),children:[(0,r.jsxs)("div",{className:"relative max-w-full p-3 sm:px-5",children:[(0,r.jsx)("div",{className:"max-w-full justify-between align-baseline"}),(0,r.jsxs)("label",{className:"sr-only flex w-full font-sans text-sm text-text-muted lg:not-sr-only",children:[(0,r.jsxs)("span",{className:"flex w-full",children:[(0,r.jsx)("span",{className:"w-full",children:s({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)("span",{className:"w-full lg:ml-5",children:s({id:"price",defaultMessage:"Price"})})]}),(0,r.jsxs)("span",{className:"flex w-full",children:[(0,r.jsx)("span",{className:"w-full lg:ml-8",children:s({id:"vat_suspect",defaultMessage:"Vat Suspect"})}),(0,r.jsx)("span",{className:"w-full lg:ml-12",children:s({id:"net_price",defaultMessage:"Net Price"})})]}),(0,r.jsxs)("span",{className:"mr-5 flex w-full",children:[(0,r.jsx)("span",{className:"ml-10 w-full",children:s({id:"country",defaultMessage:"Country"})}),(0,r.jsx)("span",{className:"w-full",children:s({id:"currency",defaultMessage:"Currency"})})]})]}),(0,r.jsx)(S,{defaultCountryValue:v,defaultCurrencyValue:y,countries:n,currencies:m})]}),(0,r.jsx)(h.f,{displayFieldErrors:!0}),i(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"-mx-6 p-6 bg-surface-subtle text-right",children:(0,r.jsx)(b.f,{className:"mx-6",label:s({id:"save",defaultMessage:"Save"})})})]})}),(0,r.jsx)("p",{className:"mt-6 mb-10 text-sm text-text-muted",children:s({id:"product_commerce_info",defaultMessage:"One price should have a min quantity of 0 (or empty) and no two prices should share the same min quantity, currency and country"})})]})})}],42532);var T=e.i(70693),V=e.i(14336);let D=M.a`
|
|
190
|
-
mutation UpdateProductTexts($productId: ID!, $texts: [ProductTextInput!]!) {
|
|
191
|
-
updateProductTexts(productId: $productId, texts: $texts) {
|
|
192
|
-
...ProductTextsFragment
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
${V.f}
|
|
196
|
-
`;var E=e.i(60195),R=e.i(83094),q=e.i(13120),A=e.i(53296),O=e.i(57561),L=e.i(48539);e.s(["f",0,({productId:e,disabled:s=!1})=>{let{selectedLocale:a,setSelectedLocale:i,languageDialectList:l}=(0,O.f)(),{formatMessage:n}=(0,o.X)(),{hasRole:m}=(0,c.f)(),{defaultLocale:f,shopInfo:p,loading:x}=(0,L.f)(),{translatedTexts:h}=(({productId:e})=>{let{customProperties:t}=(0,T.f)(),{data:s,loading:a,error:i}=(0,P.f)(((e="")=>M.a`
|
|
197
|
-
query TranslatedProductTexts($productId: ID!) {
|
|
198
|
-
translatedProductTexts(productId: $productId) {
|
|
199
|
-
...ProductTextsFragment
|
|
200
|
-
${e}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
${V.f}
|
|
204
|
-
`)(t?.ProductTexts),{skip:!e,variables:{productId:e}});return{translatedTexts:s?.translatedProductTexts||[],loading:a,error:i}})({productId:e}),v=n({id:"saved",defaultMessage:"Saved"}),{updateProductTexts:j}=(()=>{let[e]=(0,C.f)(D);return{updateProductTexts:async({productId:t,texts:s})=>e({variables:{productId:t,texts:s},refetchQueries:["TranslatedProductTexts"]})}})(),N=async({slug:t,title:s,subtitle:i,vendor:l,description:r,brand:d,labels:n})=>(await j({productId:e,texts:[{locale:a,slug:t,title:s,subtitle:i,vendor:l,description:r,brand:d,labels:n}]}),{success:!0}),_=(0,w.f)({disabled:s,submit:N,successMessage:v,initialValues:{slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[]}});return(0,t.useEffect)(()=>{let e=h?.find(e=>e.locale===a);_.api.setValues({slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[],...e||{}})},[h,a]),(0,t.useEffect)(()=>{if(p&&h?.length&&!h?.find(({locale:e})=>e===a))if(f&&h?.find(({locale:e})=>e===f))i(f);else if(f&&h?.find(({locale:e})=>e===f.split("-")[0]))i(f.split("-")[0]);else{let e=h?.find(({locale:e})=>e&&l?.find(({isoCode:t})=>t===e));i(e?.locale)}},[x,h]),(0,r.jsx)(E.f,{documentationLabel:n({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(o.L,{id:"product_text_form_description",defaultMessage:"<ul> <li><strong>Slug:</strong> The unique part of your product URL (e.g., 'my-awesome-product'). Keep it short and descriptive.</li>\n <li><strong>Localization:</strong> Switch languages using the dropdown at the top left to translate content for different markets.</li>\n <li><strong>Description:</strong> Supports Markdown and HTML formatting. Use double backslash (\\\\\\\\) for line breaks.</li>\n <li><strong>Labels:</strong> Eye-catching badges that appear on your product (e.g., 'New Arrival', '50% Off', 'Limited Edition'). Perfect for promotions and highlighting special features. Each language can have unique labels.</li>\n <li><strong>Key Difference:</strong> Labels are customer-facing promotional badges, while Tags are internal keywords for organization and filtering.</li>\n </ul>",values:{ul:e=>(0,r.jsxs)("ul",{className:"space-y-2",children:[e," "]}),li:e=>(0,r.jsxs)("li",{className:"text-sm",children:[e," "]},Math.random()),strong:e=>(0,r.jsx)("strong",{className:"font-semibold text-text-secondary",children:e})}}),children:(0,r.jsx)(u.U,{children:(0,r.jsxs)(g.f,{form:_,disabled:!m(d.C.ManageProducts),children:[(0,r.jsxs)("div",{className:"relative text-text-muted px-4 py-5 sm:p-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-6 gap-6",children:[(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{name:"slug",disabled:!m(d.C.ManageProducts),required:!0,id:"slug",label:n({id:"slug",defaultMessage:"Slug"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{name:"title",disabled:!m(d.C.ManageProducts),required:!0,id:"title",label:n({id:"title",defaultMessage:"Title"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{name:"subtitle",disabled:!m(d.C.ManageProducts),id:"subtitle",label:n({id:"subtitle",defaultMessage:"Subtitle"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{name:"vendor",disabled:!m(d.C.ManageProducts),id:"vendor",label:n({id:"vendor",defaultMessage:"Vendor"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{name:"brand",disabled:!m(d.C.ManageProducts),id:"brand",label:n({id:"brand",defaultMessage:"Brand"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsxs)("div",{className:"col-span-6 sm:col-span-3",children:[(0,r.jsx)(q.f,{name:"labels",id:"labels",disabled:!m(d.C.ManageProducts),label:n({id:"labels",defaultMessage:"Labels"}),placeholder:n({id:"label",defaultMessage:"Label"}),buttonText:n({id:"add",defaultMessage:"Add"}),autoComplete:"on",className:"text-sm"}),(0,r.jsx)(A.f,{messageKey:"product_labels_help",defaultMessage:"Add promotional badges like 'New Arrival', '50% Off', or 'Limited Edition' that customers will see on your product. Perfect for highlighting deals and special features.",className:"mt-3"})]})]}),(0,r.jsx)("div",{className:"col-span-6 mt-6 sm:col-span-3",children:(0,r.jsx)(R.f,{name:"description",id:"description",disabled:!m(d.C.ManageProducts),label:n({id:"description",defaultMessage:"Description"})})})]}),m(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"border-t-slate-100 border-t border-t-border-subtle bg-surface-subtle px-4 py-5 text-right sm:px-6",children:(0,r.jsx)(b.f,{label:n({id:"save",defaultMessage:"Save"})})})]})})})}],10785);var U=e.i(28401),F=e.i(59295),Q=e.i(6277),B=e.i(33006),z=e.i(93994),X=e.i(64479);let K=M.a`
|
|
205
|
-
mutation PrepareProductMediaUpload($mediaName: String!, $productId: ID!) {
|
|
206
|
-
prepareProductMediaUpload(mediaName: $mediaName, productId: $productId) {
|
|
207
|
-
_id
|
|
208
|
-
putURL
|
|
209
|
-
expires
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
`;var W=e.i(1880);let Z=M.a`
|
|
213
|
-
fragment ProductMediaFragment on ProductMedia {
|
|
214
|
-
_id
|
|
215
|
-
tags
|
|
216
|
-
file {
|
|
217
|
-
_id
|
|
218
|
-
name
|
|
219
|
-
type
|
|
220
|
-
size
|
|
221
|
-
url
|
|
222
|
-
}
|
|
223
|
-
sortKey
|
|
224
|
-
texts {
|
|
225
|
-
_id
|
|
226
|
-
locale
|
|
227
|
-
title
|
|
228
|
-
subtitle
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
`,H=M.a`
|
|
232
|
-
query ProductMedia($productId: ID, $slug: String) {
|
|
233
|
-
product(productId: $productId, slug: $slug) {
|
|
234
|
-
_id
|
|
235
|
-
media {
|
|
236
|
-
...ProductMediaFragment
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
${Z}
|
|
241
|
-
`;var G=e.i(2194),J=e.i(90062);let Y=M.a`
|
|
242
|
-
fragment ProductMediaTextsFragment on ProductMediaTexts {
|
|
243
|
-
_id
|
|
244
|
-
locale
|
|
245
|
-
title
|
|
246
|
-
subtitle
|
|
247
|
-
}
|
|
248
|
-
`,ee=M.a`
|
|
249
|
-
query TranslatedProductMediaTexts($productMediaId: ID!) {
|
|
250
|
-
translatedProductMediaTexts(productMediaId: $productMediaId) {
|
|
251
|
-
...ProductMediaTextsFragment
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
${Y}
|
|
255
|
-
`,et=M.a`
|
|
256
|
-
mutation UpdateProductMediaTexts(
|
|
257
|
-
$productMediaId: ID!
|
|
258
|
-
$texts: [ProductMediaTextInput!]!
|
|
259
|
-
) {
|
|
260
|
-
updateProductMediaTexts(productMediaId: $productMediaId, texts: $texts) {
|
|
261
|
-
...ProductMediaTextsFragment
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
${Y}
|
|
265
|
-
`;var es=e.i(15971);let ea=M.a`
|
|
266
|
-
mutation RemoveProductMedia($productMediaId: ID!) {
|
|
267
|
-
removeProductMedia(productMediaId: $productMediaId) {
|
|
268
|
-
_id
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
`;var ei=e.i(6607);let el=({media:e,id:s})=>{let{setModal:a}=(0,ei.f)(),{removeProductMedia:i}=(()=>{let[e]=(0,C.f)(ea);return{removeProductMedia:async({productMediaId:t})=>e({variables:{productMediaId:t},refetchQueries:["ProductMedia"]})}})(),{formatMessage:l}=(0,o.X)(),{selectedLocale:n}=(0,O.f)(),{updateProductMediaTexts:u}=(()=>{let[e]=(0,C.f)(et);return{updateProductMediaTexts:async({productMediaId:t,texts:s})=>e({variables:{productMediaId:t,texts:s},refetchQueries:["TranslatedProductMediaTexts"]})}})(),[m,f]=(0,t.useState)(!1),{hasRole:p}=(0,c.f)(),{translatedMediaTexts:x}=(({productMediaId:e})=>{let{data:t,loading:s,error:a}=(0,P.f)(ee,{skip:!e,variables:{productMediaId:e}});return{translatedMediaTexts:t?.translatedProductMediaTexts||[],loading:s,error:a}})({productMediaId:e._id}),g=x?.find(e=>e.locale===n)||{},h=async e=>{await a((0,r.jsx)(es.f,{onCancelClick:async()=>a(""),message:l({id:"delete_product_media_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this media? "}),onOkClick:async()=>{a(""),await i({productMediaId:e}),U.toast.success(l({id:"product_media_deleted",defaultMessage:"Media deleted successfully"}))},okText:l({id:"delete_product_media",defaultMessage:"Delete media"})}))},v=async({title:t,subtitle:s})=>(await u({productMediaId:e._id,texts:[{title:t,locale:n,subtitle:s}]}),f(!1),!0);return(0,r.jsx)(J.f,{id:s,media:e,mediaText:g,isEdit:m,onDelete:p(d.C.ManageProducts)?h:void 0,onEdit:p(d.C.ManageProducts)?f:void 0,onUpdate:p(d.C.ManageProducts)?v:void 0})},er=({medias:e,items:t})=>{let{formatMessage:s}=(0,o.X)();return(0,r.jsx)("div",{className:"rounded-md lg:col-span-6 px-6",children:(0,r.jsxs)("div",{className:"mx-auto overflow-hidden",children:[(0,r.jsx)("h2",{className:"sr-only",children:s({id:"product_media",defaultMessage:"Product Media"})}),(0,r.jsx)("div",{className:"flow-root",children:(0,r.jsx)(Q.V,{items:t,strategy:Q.W,children:(0,r.jsx)("ul",{className:"flex flex-col gap-3 rounded-md transition-[background-color] ease-in-out delay-200 ",children:e?.length?t.map(t=>{let s=Object.values(e).find(e=>e._id===t);return(0,r.jsx)(el,{id:t,media:s},s._id)}):(0,r.jsx)(G.f,{message:s({id:"media",defaultMessage:"Media"})})})})})]})})},ed=M.a`
|
|
272
|
-
mutation ReOrderProductMedia($sortKeys: [ReorderProductMediaInput!]!) {
|
|
273
|
-
reorderProductMedia(sortKeys: $sortKeys) {
|
|
274
|
-
_id
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
`;e.s(["f",0,({productId:e})=>{let{productMedia:t}=(({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{data:a,loading:i,error:l}=(0,P.f)(H,{skip:!e&&!s,variables:{productId:e||s}});return{productMedia:a?.product?.media||[],loading:i,error:l}})({productId:e}),{formatMessage:s}=(0,o.X)(),{hasRole:a}=(0,c.f)(),{addProductMedia:i}=(()=>{let[e]=(0,C.f)(K),{confirmMediaUpload:t}=(0,X.f)({refetchQueries:["Product"]});return{addProductMedia:async({productId:s,media:a})=>{let{data:i}=await e({variables:{productId:s,mediaName:a.name}}),{prepareProductMediaUpload:l}=i;return await (0,z.f)(a,l.putURL),t({mediaUploadTicketId:l._id,size:a?.size,type:a.type})}}})(),{reOrderProductMedia:l}=(()=>{let[e]=(0,C.f)(ed);return{reOrderProductMedia:async({sortKeys:t})=>e({variables:{sortKeys:t},refetchQueries:["ProductMedia"]})}})(),n=t?.map(e=>e._id),u=async t=>{try{await i({productId:e,media:t}),U.toast.success(s({id:"product_media_upload",defaultMessage:"Media uploaded successfully"}))}catch(e){U.toast.error(s({id:"fail_upload",defaultMessage:"Media upload failed"}))}},m=async e=>{let{active:t,over:a}=e;if(t.id!==a.id){let e=n.indexOf(t.id),i=n.indexOf(a.id),r=(0,Q.e)(n,e,i).map((e,t)=>({productMediaId:e,sortKey:t}));try{await l({sortKeys:r}),U.toast.success(s({id:"link_reorder",defaultMessage:"Link reorder successfully"}))}catch(e){U.toast.error(s({id:"fail_reorder",defaultMessage:"Reordering failed, Try again!"}))}}else U.toast.info(s({id:"reorder_original",defaultMessage:"Reorder to original location"}))},f=(0,F.n)((0,F.J)(F.k,{activationConstraint:{distance:5}}),(0,F.J)(F.y,{coordinateGetter:Q.j}));return(0,r.jsxs)("div",{className:"mx-auto mt-5 space-y-5 lg:space-y-0 max-w-full py-6 lg:grid lg:grid-cols-12 lg:gap-4",children:[a(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"mx-auto w-full px-6 lg:col-span-6 lg:col-start-1",children:(0,r.jsx)(B.f,{onlyDragAndDrop:!0,addMedia:u})}),(0,r.jsx)(F.H,{sensors:f,collisionDetection:F.P,onDragEnd:m,children:(0,r.jsx)(er,{medias:t,items:n})})]})}],1330);let en=M.a`
|
|
278
|
-
fragment ProductPlanConfigurationFragment on ProductPlanConfiguration {
|
|
279
|
-
usageCalculationType
|
|
280
|
-
billingInterval
|
|
281
|
-
trialInterval
|
|
282
|
-
trialIntervalCount
|
|
283
|
-
billingIntervalCount
|
|
284
|
-
minimumCommitmentPeriods
|
|
285
|
-
}
|
|
286
|
-
`,eo=M.a`
|
|
287
|
-
query ProductPlan($productId: ID, $slug: String) {
|
|
288
|
-
product(productId: $productId, slug: $slug) {
|
|
289
|
-
_id
|
|
290
|
-
... on PlanProduct {
|
|
291
|
-
plan {
|
|
292
|
-
...ProductPlanConfigurationFragment
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
${en}
|
|
298
|
-
`,ec=M.a`
|
|
299
|
-
query ProductPlanConfigurationOptions {
|
|
300
|
-
usageCalculationTypes: __type(name: "ProductPlanUsageCalculationType") {
|
|
301
|
-
options: enumValues {
|
|
302
|
-
value: name
|
|
303
|
-
label: description
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
configurationIntervals: __type(name: "ProductPlanConfigurationInterval") {
|
|
307
|
-
options: enumValues {
|
|
308
|
-
value: name
|
|
309
|
-
label: description
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
`,eu=M.a`
|
|
314
|
-
mutation UpdateProductPlan($productId: ID!, $plan: UpdateProductPlanInput!) {
|
|
315
|
-
updateProductPlan(productId: $productId, plan: $plan) {
|
|
316
|
-
_id
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
`;e.s(["f",0,({productId:e,disabled:s=!1})=>{let{formatMessage:a}=(0,o.X)(),{configurationIntervals:i,usageCalculationTypes:l}=(()=>{let{data:e,loading:t,error:s}=(0,P.f)(ec),a=e?.usageCalculationTypes?.options||[];return{configurationIntervals:e?.configurationIntervals?.options||[],usageCalculationTypes:a,loading:t,error:s}})(),{plan:n,loading:f}=(({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{data:a,loading:i,error:l}=(0,P.f)(eo,{skip:!e&&!s,variables:{productId:e||s}}),r=a?.product;return{plan:r?.plan,loading:i,error:l}})({productId:e}),{hasRole:p}=(0,c.f)(),{updateProductPlan:x}=(()=>{let[e]=(0,C.f)(eu);return{updateProductPlan:async({productId:t,plan:{usageCalculationType:s,billingInterval:a,billingIntervalCount:i=null,trialInterval:l=null,trialIntervalCount:r=null,minimumCommitmentPeriods:d=null}})=>e({variables:{productId:t,plan:{usageCalculationType:s,billingInterval:a,billingIntervalCount:i,trialInterval:l,trialIntervalCount:r,minimumCommitmentPeriods:d}},refetchQueries:["Products"]})}})(),h=a({id:"enrollment_updated_successfully",defaultMessage:"Enrollment saved successfully"}),j=async({trialInterval:t,trialIntervalCount:s,billingInterval:a,billingIntervalCount:i,usageCalculationType:l,minimumCommitmentPeriods:r})=>(await x({productId:e,plan:{billingInterval:a,usageCalculationType:l,billingIntervalCount:i,trialInterval:t,trialIntervalCount:s,minimumCommitmentPeriods:r?parseInt(r,10):null}}),{success:!0}),N=(0,w.f)({disabled:s,submit:j,successMessage:h,initialValues:{trialInterval:"",trialIntervalCount:"",billingInterval:"",billingIntervalCount:"",usageCalculationType:"",minimumCommitmentPeriods:""},getSubmitErrorMessage:e=>e?.message?.includes("Status of the product does not allow this operation")?a({id:"subscription_product_type_not_valid",defaultMessage:"Status of the product does not allow this operation"}):e?.message||""});return(0,t.useEffect)(()=>{n&&!f&&N.api.setValues(n)},[n]),(0,r.jsx)(E.f,{documentationLabel:a({id:"subscription",defaultMessage:"Subscription"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(o.L,{id:"product_subscription_form_description",defaultMessage:"<ul><li> Information that will be used to calculate price of a subscription based product </li>\n <li>The price specified in commerce section will be used when calculating fees on each interval. </li>\n <li>Price will not be included for the specified trial period </li> </ul>",values:{ul:e=>(0,r.jsxs)("ul",{className:"space-y-1",children:[e," "]}),li:e=>(0,r.jsx)("li",{children:e})}}),children:(0,r.jsx)(u.U,{children:(0,r.jsx)(g.f,{form:N,children:(0,r.jsxs)("div",{className:"relative max-w-full space-y-6 rounded-md sm:p-6",children:[(0,r.jsx)(v.f,{required:!0,className:"mt-2.5 w-full py-1.5 text-sm font-medium text-slate-500",label:a({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),placeholder:a({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),name:"usageCalculationType",options:(0,m.f)(l,"value","value")}),(0,r.jsxs)("div",{className:"w-full items-end justify-end sm:flex",children:[(0,r.jsx)(v.f,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",required:!0,label:a({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),placeholder:a({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),name:"billingInterval",options:(0,m.f)(i,"value","value")}),(0,r.jsx)(y.f,{name:"billingIntervalCount",id:"billing_unit",type:"number",required:!0,label:a({id:"billing_unit",defaultMessage:"Billing Unit"}),placeholder:a({id:"billing_unit",defaultMessage:"Billing Unit"}),className:"mt-1 w-full text-sm font-medium text-slate-500 sm:ml-1"})]}),(0,r.jsxs)("div",{className:"max-w-full items-end justify-end sm:flex",children:[(0,r.jsx)(v.f,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",label:a({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),placeholder:a({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),name:"trialInterval",options:(0,m.f)(i,"value","value")}),(0,r.jsx)(y.f,{type:"number",name:"trialIntervalCount",id:"trialIntervalCount ",label:a({id:"trial_unit",defaultMessage:"Trial Unit"}),placeholder:a({id:"trial_unit",defaultMessage:"Trial Unit"}),required:!0,className:"mt-1 w-full text-sm font-medium text-slate-500 sm:ml-1"})]}),(0,r.jsx)(y.f,{type:"number",name:"minimumCommitmentPeriods",id:"minimumCommitmentPeriods",label:a({id:"minimum_commitment_periods",defaultMessage:"Minimum commitment periods"}),placeholder:a({id:"minimum_commitment_periods_placeholder",defaultMessage:"e.g. 12 for a 12-period contract"}),className:"mt-1 w-full text-sm font-medium text-slate-500"}),p(d.C.CreateEnrollment)&&(0,r.jsx)("div",{className:"-mx-6 -mb-6 mt-6 border-t-slate-100 border-t space-y-6 bg-slate-50 dark:bg-slate-500 text-right sm:p-6",children:(0,r.jsx)(b.f,{label:a({id:"save",defaultMessage:"Save"})})})]})})})})}],73356);var em=e.i(60959);let ef=M.a`
|
|
320
|
-
query ProductSupply($productId: ID, $slug: String) {
|
|
321
|
-
product(productId: $productId, slug: $slug) {
|
|
322
|
-
_id
|
|
323
|
-
... on SimpleProduct {
|
|
324
|
-
dimensions {
|
|
325
|
-
...ProductDimensionFragment
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
${em.f}
|
|
331
|
-
`,ep=M.a`
|
|
332
|
-
mutation UpdateProductSupply(
|
|
333
|
-
$productId: ID!
|
|
334
|
-
$supply: UpdateProductSupplyInput!
|
|
335
|
-
) {
|
|
336
|
-
updateProductSupply(productId: $productId, supply: $supply) {
|
|
337
|
-
_id
|
|
338
|
-
... on SimpleProduct {
|
|
339
|
-
dimensions {
|
|
340
|
-
...ProductDimensionFragment
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
${em.f}
|
|
346
|
-
`;e.s(["f",0,({productId:e,disabled:s=!1})=>{let{formatMessage:a}=(0,o.X)(),i=a({id:"saved",defaultMessage:"Saved"}),{hasRole:l}=(0,c.f)(),{updateProductSupply:n}=(()=>{let[e]=(0,C.f)(ep);return{updateProductSupply:async({productId:t,supply:{weightInGram:s=null,heightInMillimeters:a=null,lengthInMillimeters:i=null,widthInMillimeters:l=null}})=>e({variables:{productId:t,supply:{weightInGram:s||null,heightInMillimeters:a||null,lengthInMillimeters:i||null,widthInMillimeters:l||null}},refetchQueries:["Products"]})}})(),{dimensions:m}=(({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{data:a,loading:i,error:l}=(0,P.f)(ef,{skip:!e&&!t,variables:{productId:e||s}}),r=a?.product;return{dimensions:r?.dimensions||{},loading:i,error:l}})({productId:e}),f=async({weight:t,length:s,width:a,height:i})=>(await n({productId:e,supply:{weightInGram:t,lengthInMillimeters:s,heightInMillimeters:i,widthInMillimeters:a}}),{success:!0}),p=(0,w.f)({disabled:s,submit:f,getSubmitErrorMessage:e=>(e.message.includes("supply.weightInGram")&&e.message.includes("Expected type Int")?p.api.setFieldError("weight","Invalid value, only integer is accepted"):e.message.includes("supply.heightInMillimeters")&&e.message.includes("Expected type Int")?p.api.setFieldError("height","Invalid value, only integer is accepted"):e.message.includes("supply.lengthInMillimeters")&&e.message.includes("Expected type Int")&&p.api.setFieldError("length","Invalid value, only integer is accepted"),null),successMessage:i,initialValues:{weight:"",length:"",width:"",height:""}});return(0,t.useEffect)(()=>{Object.keys(m).length&&p.api.setValues(m)},[m]),(0,r.jsx)("div",{className:"mt-5 md:col-span-2 md:mt-0",children:(0,r.jsx)(u.U,{children:(0,r.jsxs)(g.f,{form:p,disabled:!l(d.C.ManageProducts),children:[(0,r.jsx)("div",{className:"relative px-4 py-5 sm:p-6",children:(0,r.jsxs)("div",{className:"grid grid-cols-6 gap-6",children:[(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{validators:[(0,N.j)()],type:"number",name:"weight",disabled:!l(d.C.ManageProducts),id:"weight",label:a({id:"weight_gram",defaultMessage:"Weight (Gram)"}),className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{validators:[(0,N.j)()],name:"length",disabled:!l(d.C.ManageProducts),id:"length",type:"number",label:a({id:"length_millimeter",defaultMessage:"Length (Millimeter)"}),className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{validators:[(0,N.j)()],type:"number",name:"width",disabled:!l(d.C.ManageProducts),id:"width ",label:a({id:"width",defaultMessage:"Width (Millimeter)"}),className:"text-sm "})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{validators:[(0,N.j)()],name:"height",disabled:!l(d.C.ManageProducts),type:"number",id:"height",label:a({id:"height",defaultMessage:"Height (Millimeter)"}),className:"text-sm "})})]})}),l(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"border-t-slate-100 border-t border-t-border-subtle space-y-6 bg-surface-subtle text-right sm:p-6",children:(0,r.jsx)(b.f,{label:a({id:"save",defaultMessage:"Save"}),full:!0})})]})})})}],50099);var ex=e.i(37369),eg=e.i(53576);let eh=M.a`
|
|
347
|
-
mutation CreateProductVariation(
|
|
348
|
-
$productId: ID!
|
|
349
|
-
$variation: CreateProductVariationInput!
|
|
350
|
-
$texts: [ProductVariationTextInput!]
|
|
351
|
-
) {
|
|
352
|
-
createProductVariation(
|
|
353
|
-
productId: $productId
|
|
354
|
-
variation: $variation
|
|
355
|
-
texts: $texts
|
|
356
|
-
) {
|
|
357
|
-
_id
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
`,ev=M.a`
|
|
361
|
-
fragment ProductVariationFragment on ProductVariation {
|
|
362
|
-
_id
|
|
363
|
-
type
|
|
364
|
-
key
|
|
365
|
-
texts(forceLocale: $locale) {
|
|
366
|
-
_id
|
|
367
|
-
locale
|
|
368
|
-
title
|
|
369
|
-
subtitle
|
|
370
|
-
}
|
|
371
|
-
options {
|
|
372
|
-
_id
|
|
373
|
-
texts(forceLocale: $locale) {
|
|
374
|
-
_id
|
|
375
|
-
locale
|
|
376
|
-
title
|
|
377
|
-
subtitle
|
|
378
|
-
}
|
|
379
|
-
value
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
`,eb=M.a`
|
|
383
|
-
query ProductVariations($productId: ID, $slug: String, $locale: Locale) {
|
|
384
|
-
product(productId: $productId, slug: $slug) {
|
|
385
|
-
_id
|
|
386
|
-
... on ConfigurableProduct {
|
|
387
|
-
variations {
|
|
388
|
-
...ProductVariationFragment
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
${ev}
|
|
394
|
-
`,ey=M.a`
|
|
395
|
-
query ProductVariationType {
|
|
396
|
-
variationTypes: __type(name: "ProductVariationType") {
|
|
397
|
-
options: enumValues {
|
|
398
|
-
value: name
|
|
399
|
-
label: description
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
`,ej=({helpKey:e,helpText:t,helpValues:s,...a})=>(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(y.f,{...a}),(e||t)&&(0,r.jsx)(A.f,{messageKey:e||`${a.name}_help`,defaultMessage:t,values:s,className:"mt-1"})]});var ew=e.i(95789);let eN=M.a`
|
|
404
|
-
mutation RemoveProductVariation($productVariationId: ID!) {
|
|
405
|
-
removeProductVariation(productVariationId: $productVariationId) {
|
|
406
|
-
_id
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
`;var eM=e.i(42469);let eP=M.a`
|
|
410
|
-
mutation UpdateProductVariationTexts(
|
|
411
|
-
$productVariationId: ID!
|
|
412
|
-
$productVariationOptionValue: String
|
|
413
|
-
$texts: [ProductVariationTextInput!]!
|
|
414
|
-
) {
|
|
415
|
-
updateProductVariationTexts(
|
|
416
|
-
productVariationId: $productVariationId
|
|
417
|
-
productVariationOptionValue: $productVariationOptionValue
|
|
418
|
-
texts: $texts
|
|
419
|
-
) {
|
|
420
|
-
_id
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
`,e_=()=>{let[e]=(0,C.f)(eP);return{updateProductVariationTexts:async({productVariationId:t,productVariationOptionValue:s,texts:a})=>e({variables:{productVariationId:t,productVariationOptionValue:s,texts:a},refetchQueries:["ProductVariations"]})}},eI=({variation:e,onCancel:t,onSuccess:s})=>{let{updateProductVariationTexts:a}=e_(),{formatMessage:i}=(0,o.X)(),{selectedLocale:l}=(0,O.f)(),d=async({title:t,subtitle:i})=>(await a({productVariationId:e._id,texts:[{title:t,subtitle:i,locale:l}]}),s(),{success:!0}),n=(0,w.f)({submit:d,initialValues:{title:e?.texts?.title??"",subtitle:e?.texts?.subtitle??""}});return(0,r.jsx)(g.f,{form:n,className:"variation-update-form bg-surface px-4 py-3 border-b border-border-subtle w-full overflow-x-hidden overflow-y-visible relative hover:outline hover:outline-2 hover:outline-slate-400 dark:hover:outline-slate-500 transition-all","data-variationid":e._id,children:(0,r.jsxs)("div",{className:"flex items-center justify-between w-full gap-4",tabIndex:-1,children:[(0,r.jsxs)("div",{className:"flex items-center gap-4 flex-1 min-w-0 overflow-hidden flex-wrap",children:[(0,r.jsx)("div",{className:"flex-shrink-0 min-w-[180px]",children:(0,r.jsx)(y.f,{className:"mt-0 py-1",name:"title",required:!0,label:i({id:"title",defaultMessage:"Title"})})}),e?.type&&(0,r.jsx)(eM.f,{text:e.type,color:"slate",className:"rounded-md uppercase text-xs font-medium flex-shrink-0"}),(0,r.jsx)("div",{className:"text-sm text-text-muted truncate min-w-[200px]",children:(0,r.jsx)(y.f,{className:"mt-0 py-1",name:"subtitle",label:i({id:"subtitle",defaultMessage:"Subtitle"})})}),e?.options?.length>0&&(0,r.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:e.options.map((e,t)=>(0,r.jsx)("span",{className:"inline-flex text-nowrap items-center px-2 py-0.5 rounded-lg text-xs font-medium bg-slate-100 dark:bg-slate-900 text-text-secondary border border-border-subtle",children:e?.texts?.title||e.value},e.value||t))}),(0,r.jsxs)("div",{className:"text-sm text-text-muted font-mono flex-shrink-0",children:["(",e?.key,")"]})]}),(0,r.jsxs)("div",{className:"flex space-x-2 flex-shrink-0",children:[(0,r.jsx)(j.f,{onClick:t,type:"button",variant:"secondary",size:"sm",text:i({id:"cancel",defaultMessage:"Cancel"})}),(0,r.jsx)(j.f,{onClick:()=>n.api.submitForm(),type:"submit",variant:"primary",size:"sm",text:i({id:"save",defaultMessage:"Save"})})]})]})})};var eC=e.i(86712),ek=e.i(64481),e$=e.i(37650),eS=e.i(24557);let eT=({type:e,variation:s,onEdit:a,onDelete:i})=>{let[l,d]=(0,t.useState)(!1),{formatMessage:n}=(0,o.X)(),{buttonRef:c,menuRef:u,menuPosition:m}=((e,s)=>{let a=(0,t.useRef)(null),i=(0,t.useRef)(null),[l,r]=(0,t.useState)({top:0,left:0});return(0,t.useEffect)(()=>{let e=e=>{a.current&&!a.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]),(0,t.useEffect)(()=>{if(e&&i.current){let e=i.current.getBoundingClientRect(),t=e.bottom+4,s=e.right-192;s<8&&(s=8),t+80>window.innerHeight-8&&(t=e.top-80-4),r({top:t,left:s})}},[e]),{buttonRef:i,menuRef:a,menuPosition:l}})(l,d);return(0,r.jsx)("div",{className:"variation-display bg-surface px-4 py-3 border-b border-border-subtle w-full overflow-x-hidden overflow-y-visible relative hover:outline hover:outline-2 hover:outline-slate-400 dark:hover:outline-slate-500 transition-all",children:(0,r.jsxs)("div",{className:"flex items-center justify-between w-full gap-4",tabIndex:-1,children:[(0,r.jsxs)("div",{className:"flex items-center gap-4 flex-1 min-w-0 overflow-hidden",children:[(0,r.jsx)("div",{className:"flex-shrink-0 text-lg font-semibold text-text-primary truncate",children:s?.texts?.title}),e&&(0,r.jsx)(eM.f,{text:e,color:"slate",className:"rounded-md uppercase text-xs font-medium flex-shrink-0"}),s?.texts?.subtitle&&(0,r.jsx)("div",{className:"text-sm text-text-muted truncate",children:s?.texts?.subtitle}),s?.options?.length>0&&(0,r.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:s.options.map((e,t)=>(0,r.jsx)("span",{className:"inline-flex text-nowrap items-center px-2 py-0.5 rounded-lg text-xs font-medium bg-slate-100 dark:bg-slate-900 text-text-secondary border border-border-subtle",children:e?.texts?.title||e.value},e.value||t))}),(0,r.jsxs)("div",{className:"text-sm text-text-muted font-mono flex-shrink-0",children:["(",s?.key,")"]})]}),(0,r.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,r.jsx)("button",{ref:c,type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),d(e=>!e)},className:"flex items-center justify-center w-8 h-8 rounded-md hover:bg-surface-raised transition-colors",children:(0,r.jsx)(eC.f,{className:"w-5 h-5 text-text-muted"})}),l&&(0,r.jsx)(ek.f,{children:(0,r.jsx)("div",{ref:u,className:"fixed w-48 bg-surface rounded-md shadow-xl border border-border-subtle z-[9999]",style:{top:m.top,left:m.left,boxShadow:"0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},children:(0,r.jsxs)("div",{className:"py-1",children:[(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),a(),d(!1)},className:"flex items-center w-full px-4 py-2 text-sm text-text-secondary hover:bg-surface-raised transition-colors",children:[(0,r.jsx)(e$.f,{className:"mr-3 h-5 w-5"}),n({id:"edit",defaultMessage:"Edit"})]}),(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),i(s._id),d(!1)},className:"flex items-center w-full px-4 py-2 text-sm text-danger hover:bg-rose-50 dark:hover:bg-rose-900/20 transition-colors",children:[(0,r.jsx)(eS.f,{className:"mr-3 h-5 w-5"}),n({id:"delete",defaultMessage:"Delete"})]})]})})})]})]})})},eV=({type:e,variation:s,onDelete:a})=>{let[i,l]=(0,t.useState)(!1);return i?(0,r.jsx)(eI,{variation:s,onCancel:()=>l(!1),onSuccess:()=>l(!1)}):(0,r.jsx)(eT,{type:e,variation:s,onEdit:()=>l(!0),onDelete:a})},eD=M.a`
|
|
424
|
-
mutation CreateProductVariationOption(
|
|
425
|
-
$productVariationId: ID!
|
|
426
|
-
$option: String!
|
|
427
|
-
$texts: [ProductVariationTextInput!]
|
|
428
|
-
) {
|
|
429
|
-
createProductVariationOption(
|
|
430
|
-
productVariationId: $productVariationId
|
|
431
|
-
option: $option
|
|
432
|
-
texts: $texts
|
|
433
|
-
) {
|
|
434
|
-
_id
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
`,eE=M.a`
|
|
438
|
-
mutation RemoveProductVariationOption(
|
|
439
|
-
$productVariationId: ID!
|
|
440
|
-
$productVariationOptionValue: String!
|
|
441
|
-
) {
|
|
442
|
-
removeProductVariationOption(
|
|
443
|
-
productVariationId: $productVariationId
|
|
444
|
-
productVariationOptionValue: $productVariationOptionValue
|
|
445
|
-
) {
|
|
446
|
-
_id
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
`,eR=({onSubmit:e})=>{let{formatMessage:t}=(0,o.X)(),{hasRole:s}=(0,c.f)(),a=t({id:"variation_option_added",defaultMessage:"Variation option added successfully!"}),i=(0,w.f)({submit:e,successMessage:a,initialValues:{value:"",title:""}});return(0,r.jsxs)(g.f,{form:i,className:"variation-option-form relative overflow-visible",children:[(0,r.jsx)("div",{className:"mb-4 px-2 sm:px-4 pt-2",children:(0,r.jsx)("div",{className:"p-3 bg-surface-subtle/20 rounded-lg border border-border-subtle",children:(0,r.jsx)("p",{className:"text-sm text-text-secondary",children:t({id:"variation_options_explanation",defaultMessage:'Add individual choices for this variation (e.g., "Red", "Blue", "Green" for a Color variation)'})})})}),(0,r.jsxs)("div",{className:"grid lg:grid-cols-2 gap-3 px-2 sm:px-4 sm:pb-4",children:[(0,r.jsx)("div",{className:"col-span-1",children:(0,r.jsx)(ej,{className:"mt-2 pt-1",name:"title",label:t({id:"title",defaultMessage:"Title"}),helpText:t({id:"variation_option_title_help",defaultMessage:'Display name customers see (e.g., "Red", "Large", "Cotton")'}),required:!0})}),(0,r.jsx)("div",{className:"col-span-1",children:(0,r.jsx)(ej,{className:"mt-2 pt-1",name:"value",label:t({id:"value",defaultMessage:"Value"}),helpText:t({id:"variation_option_value_help",defaultMessage:'Internal identifier (e.g., "red", "large", "cotton")'}),required:!0})})]}),s(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"text-right mt-2 px-6 pb-6",children:(0,r.jsx)(b.f,{className:"py-2.5",label:t({id:"add_variation_option",defaultMessage:"Add option"})})})]})};var eq=e.i(3095);let eA=({option:e,onDelete:s,variationId:a})=>{let{formatMessage:i}=(0,o.X)(),{selectedLocale:l}=(0,O.f)(),[d,n]=(0,t.useState)(!1),c=i({id:"variation_option_updated",defaultMessage:"Variation option updated successfully!"}),{updateProductVariationTexts:u}=e_(),m=async({title:t,subtitle:s})=>{let i=await u({productVariationId:a,productVariationOptionValue:e.value,texts:[{title:t,subtitle:s,locale:l}]});return n(!1),{data:i,success:!0}},f=(0,w.f)({submit:m,successMessage:c,initialValues:{title:e?.texts?.title,subtitle:e?.texts?.subtitle}});return(0,r.jsx)(g.f,{form:f,className:"last:pb-2 variation-option-update-form relative overflow-visible",children:(0,r.jsx)("div",{className:"my-2 rounded-sm border dark:border-slate-700 mx-4 ",children:(0,r.jsx)("div",{className:"p-2 bg-surface-input dark:text-slate-200",children:(0,r.jsxs)("div",{className:"flex gap-2 w-full items-center justify-between",children:[(0,r.jsx)(eM.f,{text:e?.value,color:"slate",className:"rounded-md"}),(0,r.jsxs)("div",{className:"flex items-center gap-4 w-full",children:[(0,r.jsx)("p",{className:"truncate text-sm font-medium text-slate-900 dark:text-slate-400",children:d?(0,r.jsx)(y.f,{className:"mt-0",name:"title",required:!0,label:i({id:"title",defaultMessage:"Title"})}):e?.texts?.title}),(0,r.jsx)("p",{className:"truncate text-sm text-slate-500",children:d?(0,r.jsx)(y.f,{className:"mt-0",name:"subtitle",label:i({id:"subtitle",defaultMessage:"Subtitle"})}):e?.texts?.subtitle})]}),(0,r.jsx)("div",{className:"flex items-center justify-end ml-auto",children:d?(0,r.jsxs)("div",{className:"flex space-x-2 py-2",children:[(0,r.jsx)("button",{onClick:()=>n(!d),"aria-label":i({id:"cancel",defaultMessage:"Cancel"}),type:"button",className:"inline-flex items-center justify-center font-medium shadow-sm focus:outline-hidden focus:ring-2 focus:ring-offset-2 transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50 px-3 py-2 text-sm h-8 rounded-md border border-border-default bg-surface text-text-secondary hover:bg-surface-raised focus:ring-focus-ring",children:i({id:"cancel",defaultMessage:"Cancel"})}),(0,r.jsx)("button",{type:"submit","aria-label":i({id:"save",defaultMessage:"Save"}),className:"inline-flex items-center justify-center font-medium shadow-sm focus:outline-hidden focus:ring-2 focus:ring-offset-2 transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50 px-3 py-2 text-sm h-8 rounded-md border border-accent bg-accent text-text-on-accent hover:bg-accent-hover focus:ring-focus-ring",children:i({id:"save",defaultMessage:"Save"})})]}):(0,r.jsx)(eq.f,{onEdit:()=>{n(!0)},onDelete:()=>{s(e.value)},showEdit:!0,showDelete:!0})})]})})})})},eO=({variationId:e,options:t})=>{let{createProductVariationOption:s}=(()=>{let[e]=(0,C.f)(eD);return{createProductVariationOption:async({productVariationId:t,option:s,texts:a})=>e({variables:{productVariationId:t,option:s,texts:a},refetchQueries:["ProductVariations","Product"]})}})(),{formatMessage:a}=(0,o.X)(),{selectedLocale:i}=(0,O.f)(),{setModal:l}=(0,ei.f)(),{removeProductVariationOption:d}=(()=>{let[e]=(0,C.f)(eE);return{removeProductVariationOption:async({productVariationId:t,productVariationOptionValue:s})=>e({variables:{productVariationId:t,productVariationOptionValue:s},refetchQueries:["ProductVariations"]})}})(),n=async t=>{await l((0,r.jsx)(es.f,{message:a({id:"delete_variation_option_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this option? "}),onCancelClick:()=>l(""),onOkClick:async()=>{l(""),await d({productVariationId:e,productVariationOptionValue:t}),U.toast.success(a({id:"product_variation_option_deleted",defaultMessage:"Variation option deleted successfully"}))},okText:a({id:"delete_variation_option",defaultMessage:"Delete option"})}))},c=async({value:t,title:a})=>(await s({productVariationId:e,option:t,texts:[{title:a,locale:i}]}),{success:!0});return(0,r.jsxs)("div",{className:"relative overflow-visible",children:[(0,r.jsx)(eR,{onSubmit:c}),t.length?t.map(t=>(0,r.jsx)(eA,{variationId:e,option:t,onDelete:n},t._id)):(0,r.jsx)(G.f,{message:a({id:"option",defaultMessage:"Option"})})]})},eL=({productVariationId:e,variation:t})=>{let{formatMessage:s}=(0,o.X)(),{setModal:a}=(0,ei.f)(),{options:i}=t,{removeProductVariation:l}=(()=>{let[e]=(0,C.f)(eN);return{removeProductVariation:async({productVariationId:t})=>e({variables:{productVariationId:t},refetchQueries:["ProductVariations"]})}})(),d=async()=>{await a((0,r.jsx)(es.f,{onCancelClick:async()=>a(""),message:s({id:"delete_product_variation_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this variation? "}),onOkClick:async()=>{a(""),await l({productVariationId:e}),U.toast.success(s({id:"product_variation_deleted",defaultMessage:"Variation deleted successfully"}))},okText:s({id:"delete_product_variation",defaultMessage:"Delete variation"})}))},n=[{header:(0,r.jsx)(eV,{onDelete:d,variation:t,...t}),body:(0,r.jsx)(eO,{variationId:t._id,options:i},e)}];return(0,r.jsx)(ew.f,{"data-variationid":t._id,data:n,containerCSS:"w-full max-w-full !my-0 !border-0 !shadow-none relative",bodyCSS:"bg-surface-subtle !border-t-0 relative overflow-visible",itemContainerCSS:"!mt-0 !mb-0 !border-0",headerCSS:"w-full flex items-center justify-between !p-0 !bg-transparent !border-0",hideChevron:!0})},eU=({onSubmit:e,disabled:t,formatMessage:s})=>{let{variationTypes:a}=(()=>{let{data:e,loading:t,error:s}=(0,P.f)(ey);return{variationTypes:e?.variationTypes?.options||[],loading:t,error:s}})(),{hasRole:i}=(0,c.f)(),l=s({id:"product_variation_added",defaultMessage:"Product variation added successfully"}),n=(0,w.f)({disabled:t,submit:e,successMessage:l,initialValues:{title:"",key:"",type:""}});return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-2",children:s({id:"product_variations_explanation_title",defaultMessage:"About Product Variations"})}),(0,r.jsx)("p",{className:"text-sm text-text-secondary",children:s({id:"product_variations_explanation",defaultMessage:"Variations allow customers to choose different options for your product (like color, size, material). Each variation can have multiple options that customers can select from."})})]}),(0,r.jsxs)(g.f,{form:n,children:[(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(ej,{name:"title",id:"title",label:s({id:"title",defaultMessage:"Title"}),helpText:s({id:"product_variation_title_help",defaultMessage:'The display name customers will see (e.g., "Color", "Size", "Material")'}),required:!0,autoComplete:"on",className:"w-full"}),(0,r.jsx)(ej,{name:"key",id:"key",label:s({id:"key",defaultMessage:"Key"}),helpText:s({id:"product_variation_key_help",defaultMessage:'Unique identifier used internally (e.g., "color", "size"). Use lowercase without spaces.'}),required:!0,autoComplete:"on",className:"w-full"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(v.f,{required:!0,className:"w-full",label:s({id:"type",defaultMessage:"Type"}),placeholder:s({id:"type",defaultMessage:"Type"}),name:"type",options:(0,m.f)(a,"value","value")}),(0,r.jsx)(A.f,{messageKey:"product_variation_type_help",defaultMessage:"COLOR: For predefined options like colors or sizes. TEXT: For free-form input like custom text or measurements.",className:"mt-1"})]})]}),i(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"flex justify-end mt-6 py-6 -mb-6 bg-slate-100 -mx-6 pe-5 border-t border-border-subtle bg-surface-subtle",children:(0,r.jsx)(b.f,{label:s({id:"add_variation",defaultMessage:"Add variation"})})})]})]})};e.s(["f",0,({productId:e,disabled:t=!1})=>{let{createProductVariation:s}=(()=>{let[e]=(0,C.f)(eh);return{createProductVariation:async({productId:t,variation:{key:s,type:a},texts:i})=>e({variables:{productId:t,variation:{key:s,type:a},texts:i},refetchQueries:["ProductVariations"]})}})(),{selectedLocale:a}=(0,O.f)(),{formatMessage:i}=(0,o.X)(),{setModal:l}=(0,ei.f)(),{variations:d,loading:n}=(({productId:e=null,slug:t=null,locale:s=null}={})=>{let a=(0,W.Q)(t),{data:i,loading:l,error:r}=(0,P.f)(eb,{skip:!e&&!a,variables:{productId:e||a,locale:s}}),d=i?.product;return{variations:d?.variations,loading:l,error:r}})({productId:e,locale:a}),c=async({title:t,key:i,type:r})=>(await s({productId:e,variation:{key:i,type:r},texts:[{title:t,locale:a}]}),l(""),{success:!0});return n?(0,r.jsx)(eg.f,{}):(0,r.jsxs)("div",{className:"mt-6 overflow-hidden rounded-md w-full max-w-full",children:[(0,r.jsx)("div",{className:"mb-6 flex justify-end items-center",children:(0,r.jsx)(j.f,{className:"m-1",onClick:()=>{l((0,r.jsx)(eU,{onSubmit:c,disabled:t,formatMessage:i}))},disabled:t,variant:"secondary",icon:(0,r.jsx)(ex.f,{className:"w-5 h-5"}),text:i({id:"add_variation",defaultMessage:"Add variation"})})}),(0,r.jsx)("div",{className:"flex flex-col border border-border-subtle rounded-md overflow-x-hidden overflow-y-visible w-full relative",children:d?.length?d?.map(e=>(0,r.jsx)(eL,{productVariationId:e._id,variation:e},e._id)):(0,r.jsx)(G.f,{message:i({id:"variations",defaultMessage:"Variations"})})})]})}],77035);let eF=M.a`
|
|
450
|
-
query ProductWarehousing($productId: ID, $slug: String) {
|
|
451
|
-
product(productId: $productId, slug: $slug) {
|
|
452
|
-
_id
|
|
453
|
-
... on SimpleProduct {
|
|
454
|
-
sku
|
|
455
|
-
baseUnit
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
`,eQ=M.a`
|
|
460
|
-
mutation UpdateProductWarehousing(
|
|
461
|
-
$productId: ID!
|
|
462
|
-
$warehousing: UpdateProductWarehousingInput!
|
|
463
|
-
) {
|
|
464
|
-
updateProductWarehousing(productId: $productId, warehousing: $warehousing) {
|
|
465
|
-
_id
|
|
466
|
-
... on SimpleProduct {
|
|
467
|
-
sku
|
|
468
|
-
baseUnit
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
`;e.s(["f",0,({productId:e,disabled:s=!1})=>{let{formatMessage:a}=(0,o.X)(),{product:i}=(({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{data:a,loading:i,error:l}=(0,P.f)(eF,{skip:!e&&!s,variables:{productId:e||s}});return{product:a?.product||{},loading:i,error:l}})({productId:e}),{hasRole:l}=(0,c.f)(),{updateProductWarehousing:n}=(()=>{let[e]=(0,C.f)(eQ);return{updateProductWarehousing:async({productId:t,warehousing:{sku:s=null,baseUnit:a=null}})=>e({variables:{productId:t,warehousing:{sku:s,baseUnit:a}},refetchQueries:["Products"]})}})(),m=a({id:"saved",defaultMessage:"Saved"}),f=async({sku:t,baseUnit:s})=>({data:await n({productId:e,warehousing:{baseUnit:s,sku:t}}),success:!0}),p=(0,w.f)({disabled:s,submit:f,successMessage:m,initialValues:{sku:"",baseUnit:""}});return(0,t.useEffect)(()=>{Object.keys(i).length&&p.api.setValues({...i})},[i]),(0,r.jsx)("div",{className:"mt-5 md:mt-0",children:(0,r.jsx)(u.U,{children:(0,r.jsxs)(g.f,{className:"rounded",form:p,disabled:!l(d.C.ManageProducts),children:[(0,r.jsx)("div",{className:"relative px-4 pb-5 sm:p-6",children:(0,r.jsxs)("div",{className:"w-full justify-between align-baseline lg:flex gap-6",children:[(0,r.jsx)(y.f,{name:"sku",disabled:!l(d.C.ManageProducts),id:"sku",label:a({id:"sku",defaultMessage:"SKU"}),className:"mb-4 text-sm"}),(0,r.jsx)(y.f,{name:"baseUnit",id:"baseUnit",disabled:!l(d.C.ManageProducts),label:a({id:"baseUnit",defaultMessage:"Base Unit"}),className:"text-sm"})]})}),l(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"border-t-slate-100 border-t border-t-border-subtle space-y-6 bg-surface-subtle text-right sm:p-6",children:(0,r.jsx)(b.f,{label:a({id:"save",defaultMessage:"Save"})})})]})})})}],56902);var eB=e.i(56417),ez=e.i(27028),eX=e.i(3883),eK=e.i(84818);let eW=M.a`
|
|
473
|
-
query ProductFulfillmentSimulation(
|
|
474
|
-
$productId: ID
|
|
475
|
-
$deliveryProviderType: DeliveryProviderType
|
|
476
|
-
$quantity: Int
|
|
477
|
-
$referenceDate: Timestamp
|
|
478
|
-
) {
|
|
479
|
-
product(productId: $productId) {
|
|
480
|
-
_id
|
|
481
|
-
... on SimpleProduct {
|
|
482
|
-
simulatedDispatches(
|
|
483
|
-
deliveryProviderType: $deliveryProviderType
|
|
484
|
-
quantity: $quantity
|
|
485
|
-
referenceDate: $referenceDate
|
|
486
|
-
) {
|
|
487
|
-
shipping
|
|
488
|
-
earliestDelivery
|
|
489
|
-
deliveryProvider {
|
|
490
|
-
_id
|
|
491
|
-
type
|
|
492
|
-
isActive
|
|
493
|
-
interface {
|
|
494
|
-
_id
|
|
495
|
-
label
|
|
496
|
-
version
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
warehousingProvider {
|
|
500
|
-
_id
|
|
501
|
-
type
|
|
502
|
-
isActive
|
|
503
|
-
interface {
|
|
504
|
-
_id
|
|
505
|
-
label
|
|
506
|
-
version
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
simulatedStocks(
|
|
511
|
-
deliveryProviderType: $deliveryProviderType
|
|
512
|
-
referenceDate: $referenceDate
|
|
513
|
-
) {
|
|
514
|
-
quantity
|
|
515
|
-
deliveryProvider {
|
|
516
|
-
_id
|
|
517
|
-
type
|
|
518
|
-
interface {
|
|
519
|
-
_id
|
|
520
|
-
label
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
warehousingProvider {
|
|
524
|
-
_id
|
|
525
|
-
interface {
|
|
526
|
-
_id
|
|
527
|
-
label
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
`,eZ=(e,t)=>e?.deliveryProvider?._id===t?.deliveryProvider?._id&&e?.warehousingProvider?._id===t?.warehousingProvider?._id,eH="w-full rounded-md border-1 border-border-default bg-surface-input px-3 py-2 text-sm shadow-xs text-text-primary focus:outline-hidden focus:ring-2 focus:ring-focus-ring",eG=e=>[e?.interface?.label,e?.interface?.version].filter(Boolean).join(" ")||e?._id||null;e.s(["f",0,({productId:e})=>{let{formatMessage:s}=(0,o.X)(),{formatDateTime:a}=(0,eK.f)(),[i,l]=(0,t.useState)(1),[n,c]=(0,t.useState)(null),[u,m]=(0,t.useState)(""),{dispatches:f,unroutedStocks:p,loading:x,error:g}=(({productId:e,deliveryProviderType:s=null,quantity:a=null,referenceDate:i=null})=>{let{data:l,loading:r,error:d}=(0,P.f)(eW,{skip:!e,variables:{productId:e,deliveryProviderType:s,quantity:a,referenceDate:i},errorPolicy:"all"}),{dispatches:n,unroutedStocks:o}=(0,t.useMemo)(()=>{let e=l?.product||{},t=(e?.simulatedDispatches||[]).filter(e=>!s||e?.deliveryProvider?.type===s),a=(e?.simulatedStocks||[]).filter(e=>!s||!e?.deliveryProvider?.type||e?.deliveryProvider?.type===s);return{dispatches:t.map(e=>({...e,stockQuantity:a.find(t=>eZ(t,e))?.quantity??null})),unroutedStocks:a.filter(e=>!t.some(t=>eZ(e,t)))}},[l,s]);return{dispatches:n,unroutedStocks:o,loading:r,error:d}})({productId:e,quantity:i,referenceDate:n?new Date(n).getTime():null,deliveryProviderType:u||null});return(0,r.jsxs)("div",{className:"mt-5 md:mt-0 space-y-6",children:[(0,r.jsx)("div",{children:(0,r.jsx)(A.f,{messageKey:"fulfillment_preview_description",defaultMessage:"Preview which delivery and warehousing providers the engine would use to fulfill this product, exactly as calculated during checkout."})}),(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 max-w-2xl",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("label",{htmlFor:"simulation-quantity",className:"text-sm font-medium text-text-secondary",children:s({id:"quantity",defaultMessage:"Quantity"})}),(0,r.jsx)("input",{type:"number",id:"simulation-quantity",min:1,value:i,onChange:e=>l(Math.max(1,Number(e.target.value))),className:eH})]}),(0,r.jsx)(eX.f,{id:"simulation-reference-date",label:s({id:"simulate_as_of",defaultMessage:"Simulate as of"}),value:n,onChange:c}),(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("label",{htmlFor:"simulation-delivery-type",className:"text-sm font-medium text-text-secondary",children:s({id:"delivery_type",defaultMessage:"Delivery type"})}),(0,r.jsxs)("select",{id:"simulation-delivery-type",value:u,onChange:e=>m(e.target.value),className:eH,children:[(0,r.jsx)("option",{value:"",children:s({id:"all_types",defaultMessage:"All types"})}),Object.values(d.F).map(e=>(0,r.jsx)("option",{value:e,children:s({id:e,defaultMessage:e,description:"Delivery provider type"})},e))]})]})]}),x?(0,r.jsx)(eg.f,{}):!g||f.length||p.length?f.length||p.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:f.map((e,t)=>(0,r.jsxs)("div",{className:"rounded-lg border border-border-default bg-surface p-4 shadow-xs",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)(eB.f,{className:"h-5 w-5 shrink-0 text-text-muted"}),(0,r.jsx)("span",{className:"truncate text-sm font-semibold text-text-primary",children:eG(e?.deliveryProvider)||s({id:"unknown_delivery_provider",defaultMessage:"Unknown delivery provider"})})]}),e?.deliveryProvider?.type&&(0,r.jsx)(eM.f,{text:s({id:e.deliveryProvider.type,defaultMessage:e.deliveryProvider.type,description:"Delivery provider type"}),color:"sky",square:!0})]}),(0,r.jsxs)("dl",{className:"mt-4 space-y-2 text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("dt",{className:"text-text-muted",children:s({id:"warehouse",defaultMessage:"Warehouse"})}),(0,r.jsxs)("dd",{className:"flex items-center gap-1 text-text-primary truncate",children:[(0,r.jsx)(ez.f,{className:"h-4 w-4 shrink-0 text-text-muted"}),eG(e?.warehousingProvider)||"n/a"]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("dt",{className:"text-text-muted",children:s({id:"ships",defaultMessage:"Ships"})}),(0,r.jsx)("dd",{className:"text-text-primary",children:a(e?.shipping,{dateStyle:"medium",timeStyle:"short"})})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("dt",{className:"text-text-muted",children:s({id:"earliest_delivery",defaultMessage:"Earliest delivery"})}),(0,r.jsx)("dd",{className:"text-text-primary",children:a(e?.earliestDelivery,{dateStyle:"medium",timeStyle:"short"})})]}),e?.stockQuantity!==null&&(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("dt",{className:"text-text-muted",children:s({id:"stock",defaultMessage:"Stock"})}),(0,r.jsx)("dd",{className:"font-semibold text-text-primary",children:s({id:"units_available",defaultMessage:"{quantity} units available"},{quantity:e.stockQuantity})})]})]})]},`${e?.deliveryProvider?._id}-${e?.warehousingProvider?._id}-${t}`))}),p.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-text-primary",children:s({id:"stock_without_dispatch_route",defaultMessage:"Stock without a dispatch route"})}),(0,r.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:s({id:"stock_without_dispatch_route_hint",defaultMessage:"Inventory is reported for these provider combinations, but the engine could not calculate a dispatch for them."})}),(0,r.jsx)("ul",{className:"mt-3 space-y-2",children:p.map((e,t)=>(0,r.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-md border border-border-subtle bg-surface-subtle px-3 py-2 text-sm",children:[(0,r.jsxs)("span",{className:"truncate text-text-secondary",children:[eG(e?.warehousingProvider)||"n/a",e?.deliveryProvider&&` — ${eG(e.deliveryProvider)}`]}),(0,r.jsx)("span",{className:"font-semibold text-text-primary",children:s({id:"units_available",defaultMessage:"{quantity} units available"},{quantity:e?.quantity??0})})]},`${e?.deliveryProvider?._id}-${e?.warehousingProvider?._id}-${t}`))})]})]}):(0,r.jsxs)("div",{children:[(0,r.jsx)(G.f,{message:s({id:"dispatch_routes",defaultMessage:"dispatch routes"}),Icon:(0,r.jsx)(eB.f,{className:"h-6 w-6"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-text-muted",children:s({id:"fulfillment_preview_empty_hint",defaultMessage:"The engine could not simulate any dispatch for this product. Customers will not see delivery options for it. Verify that at least one delivery provider and one warehousing provider are configured, active and free of configuration errors."})})]}):(0,r.jsxs)("div",{className:"text-sm text-danger",children:[s({id:"fulfillment_simulation_error",defaultMessage:"Fulfillment simulation failed"}),": ",g.message]})]})}],72264);var eJ=d;let eY=M.a`
|
|
535
|
-
fragment ProductReviewDetailFragment on ProductReview {
|
|
536
|
-
_id
|
|
537
|
-
created
|
|
538
|
-
updated
|
|
539
|
-
deleted
|
|
540
|
-
author {
|
|
541
|
-
_id
|
|
542
|
-
username
|
|
543
|
-
name
|
|
544
|
-
profile {
|
|
545
|
-
displayName
|
|
546
|
-
address {
|
|
547
|
-
firstName
|
|
548
|
-
lastName
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
isGuest
|
|
552
|
-
avatar {
|
|
553
|
-
_id
|
|
554
|
-
|
|
555
|
-
url
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
product {
|
|
559
|
-
_id
|
|
560
|
-
texts(forceLocale: $forceLocale) {
|
|
561
|
-
_id
|
|
562
|
-
title
|
|
563
|
-
subtitle
|
|
564
|
-
}
|
|
565
|
-
media {
|
|
566
|
-
_id
|
|
567
|
-
file {
|
|
568
|
-
_id
|
|
569
|
-
url
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
rating
|
|
574
|
-
title
|
|
575
|
-
review
|
|
576
|
-
upVote: voteCount(type: UPVOTE)
|
|
577
|
-
downVote: voteCount(type: DOWNVOTE)
|
|
578
|
-
voteReport: voteCount(type: REPORT)
|
|
579
|
-
ownVotes {
|
|
580
|
-
timestamp
|
|
581
|
-
type
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
`,e0=M.a`
|
|
585
|
-
query ProductReviewByProduct(
|
|
586
|
-
$productId: ID
|
|
587
|
-
$slug: String
|
|
588
|
-
$limit: Int
|
|
589
|
-
$offset: Int
|
|
590
|
-
$sort: [SortOptionInput!]
|
|
591
|
-
$forceLocale: Locale
|
|
592
|
-
) {
|
|
593
|
-
product(productId: $productId, slug: $slug) {
|
|
594
|
-
_id
|
|
595
|
-
reviews(limit: $limit, offset: $offset, sort: $sort) {
|
|
596
|
-
...ProductReviewDetailFragment
|
|
597
|
-
}
|
|
598
|
-
reviewsCount
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
${eY}
|
|
602
|
-
`;var e1=e.i(66859),e5=e.i(39833),e2=e.i(84339);let e3=t.forwardRef(function({title:e,titleId:s,...a},i){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},e):null,t.createElement("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z",clipRule:"evenodd"}))}),e4=({productReviews:e})=>{let{formatMessage:t}=(0,o.X)(),s=e.reduce((e,t)=>e+t.upVote,0),a=e.reduce((e,t)=>e+t.downVote,0),i=s?s/(s+a)*100:0,l=i?100-i:0;return(0,r.jsxs)("div",{className:"lg:col-span-4",children:[(0,r.jsx)("h2",{className:"text-2xl",children:t({id:"customer_reviews",defaultMessage:"Customer Reviews"})}),(0,r.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,r.jsx)("div",{children:(0,r.jsx)("div",{title:`${i}`,className:"flex items-center",children:[0,1,2,3,4].map(e=>{let t=i>=20*e;return(0,r.jsx)(e3,{className:`
|
|
603
|
-
${t?"text-amber-400":"text-slate-300 dark:text-slate-600"}
|
|
604
|
-
h-5 w-5 shrink-0
|
|
605
|
-
`,"aria-hidden":"true"},e)})})}),(0,r.jsx)("div",{className:"ml-2 text-sm",children:(0,r.jsx)(o.L,{id:"review_summary",defaultMessage:"<div> Based on <cta> {total} </cta> reviews</div>",values:{div:e=>(0,r.jsx)("div",{children:e}),cta:e=>(0,r.jsx)("b",{className:"font-semibold",children:e}),total:e.length}})})]}),(0,r.jsxs)("div",{className:"mt-6",children:[(0,r.jsx)("h3",{className:"sr-only",children:t({id:"review_data",defaultMessage:"Review data"})}),(0,r.jsxs)("dl",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center text-sm",children:[(0,r.jsxs)("dt",{className:"flex flex-1 items-center",children:[(0,r.jsx)("p",{className:"font-medium",children:s}),(0,r.jsxs)("div",{"aria-hidden":"true",className:"ml-2 flex flex-1 items-center",children:[(0,r.jsx)(e2.f,{className:`
|
|
606
|
-
${s>0?"text-emerald-500":"text-slate-500"}
|
|
607
|
-
h-5 w-5 shrink-0`,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative ml-3 flex-1",children:[(0,r.jsx)("div",{className:"h-3 rounded-full border border-border-default bg-surface-subtle"}),s>0?(0,r.jsx)("div",{className:"absolute inset-y-0 rounded-full border border-emerald-500 bg-emerald-500",style:{width:`calc(${i}%)`}}):null]})]})]}),(0,r.jsxs)("dd",{className:"ml-3 w-10 text-right text-sm tabular-nums",children:[Math.round(i),"%"]})]}),(0,r.jsxs)("div",{className:"flex items-center text-sm",children:[(0,r.jsxs)("dt",{className:"flex flex-1 items-center",children:[(0,r.jsxs)("p",{className:"font-medium",children:[a,(0,r.jsx)("span",{className:"sr-only",children:t({id:"star_reviews",defaultMessage:"Star reviews"})})]}),(0,r.jsxs)("div",{"aria-hidden":"true",className:"ml-2 flex flex-1 items-center",children:[(0,r.jsx)(e5.f,{className:`
|
|
608
|
-
${a>0?"text-rose-500":"text-slate-500"}
|
|
609
|
-
h-5 w-5 shrink-0
|
|
610
|
-
`,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative ml-3 flex-1",children:[(0,r.jsx)("div",{className:"h-3 rounded-full border border-border-default bg-surface-subtle"}),a>0?(0,r.jsx)("div",{className:"absolute inset-y-0 rounded-full border border-rose-500 bg-rose-500",style:{width:`calc(${l}%)`}}):null]})]})]}),(0,r.jsxs)("dd",{className:"ml-3 w-10 text-right text-sm tabular-nums",children:[Math.round(l),"%"]})]})]})]})]})};var e6=e.i(87213);let e9=({onSubmit:e,onSubmitSuccess:t=null,defaultValue:s={},isEdit:a=!1})=>{let{formatMessage:i}=(0,o.X)(),{hasRole:l}=(0,c.f)(),n=i({id:"product_review_added",defaultMessage:"Review added successfully!"}),u=i({id:"product_review_updated",defaultMessage:"Review updated successfully!"}),m=(0,w.f)({submit:e,onSubmitSuccess:t,successMessage:a?u:n,initialValues:{title:"",review:"",rating:1,...s}});return(0,r.jsxs)("div",{className:"bg-surface rounded-md shadow-sm overflow-hidden p-6 mb-6",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-4",children:i({id:"write_review",defaultMessage:"Write a Review"})}),(0,r.jsxs)(g.f,{form:m,children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(y.f,{name:"title",disabled:!l(d.C.ReviewProduct),id:"title",label:i({id:"title",defaultMessage:"Title"}),autoComplete:"off",required:!0}),(0,r.jsx)(e6.f,{rows:4,name:"review",disabled:!l(d.C.ReviewProduct),id:"review",label:i({id:"review",defaultMessage:"Review"}),placeholder:i({id:"review_placeholder",defaultMessage:"Share your thoughts about this product..."})})]}),l(d.C.ReviewProduct)&&(0,r.jsx)("div",{className:"mt-6 flex justify-end",children:(0,r.jsx)(b.f,{label:i(a?{id:"update_review",defaultMessage:"Update Review"}:{id:"add_review",defaultMessage:"Add Review"}),className:"px-6 py-2"})})]})]})},e7=M.a`
|
|
611
|
-
mutation CreateProductReview(
|
|
612
|
-
$productId: ID!
|
|
613
|
-
$productReview: ProductReviewInput!
|
|
614
|
-
$forceLocale: Locale
|
|
615
|
-
) {
|
|
616
|
-
createProductReview(productId: $productId, productReview: $productReview) {
|
|
617
|
-
_id
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
`;e.s(["f",0,({productId:e})=>{let{productReviews:t,loadMore:s,reviewsCount:a}=(({productId:e=null,slug:t=null,limit:s=10,offset:a=0,sort:i=[{key:"created",value:eJ.A.Desc}]}={})=>{let{selectedLocale:l}=(0,O.f)(),{data:r,loading:d,error:n,fetchMore:o}=(0,P.f)(e0,{skip:!e,variables:{productId:e,slug:t,limit:s,offset:a,sort:i,forceLocale:l}}),c=r?.product,u=c?.reviews||[];return{productReviews:u,loading:d,error:n,reviewsCount:c?.reviewsCount||0,loadMore:()=>{o({variables:{offset:u?.length}})}}})({productId:e}),{createProductReview:i}=(()=>{let[e]=(0,C.f)(e7);return{createProductReview:async({productId:t,productReview:{title:s,rating:a,review:i}})=>e({variables:{productId:t,productReview:{title:s,rating:a,review:i}},refetchQueries:["ProductReviewByProduct","ProductReviewByUser"]})}})(),{formatMessage:l}=(0,o.X)();return(0,r.jsxs)("div",{className:"sm:max-w-full",children:[(0,r.jsx)("div",{className:"text-text-primary",children:(0,r.jsxs)("div",{className:"mx-auto p-2 lg:grid lg:max-w-7xl lg:grid-cols-12 lg:gap-x-8",children:[(0,r.jsx)(e4,{productReviews:t}),(0,r.jsxs)("div",{className:"mt-16 lg:col-span-7 lg:col-start-6 lg:mt-0",children:[e&&(0,r.jsx)(e9,{onSubmit:async({title:t,review:s,rating:a})=>await i({productId:e,productReview:{title:t,review:s,rating:10}})}),(0,r.jsx)("h3",{className:"sr-only",children:l({id:"recent_reviews",defaultMessage:"Recent reviews"})}),(0,r.jsx)("div",{className:"flow-root",children:(0,r.jsx)("div",{className:"-my-3",children:t.map(e=>(0,r.jsx)(e1.f,{review:e},e._id))})})]})]})}),a>t?.length?(0,r.jsx)(j.f,{text:l({id:"load-more-reviews",defaultMessage:"Load reviews"}),onClick:s}):null]})}],19051);var e8=e.i(47542);let te=M.a`
|
|
621
|
-
mutation CreateProductBundleItem(
|
|
622
|
-
$productId: ID!
|
|
623
|
-
$item: CreateProductBundleItemInput!
|
|
624
|
-
) {
|
|
625
|
-
createProductBundleItem(productId: $productId, item: $item) {
|
|
626
|
-
_id
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
`;var tt=e.i(24112),ts=e.i(5270);let ta={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};ta.node;let ti=(0,ts.f)(ta);var tl=e.i(38994);let tr=function({onSuccess:e}){let{selectedLocale:t}=(0,O.f)(),{createProduct:s}=(0,tl.f)(),{formatMessage:a}=(0,o.X)();return async({title:i,type:l,quantity:r=1})=>{let n=[{title:i,slug:i.toLowerCase().replace(/\s+/g,"-"),locale:t}],{data:o}=await s({product:{type:l||d.f.SimpleProduct},texts:n}),c=o?.createProduct;if(!c?._id)throw Error(a({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return e?.(c,r),{success:!0}}},td=({bundleProduct:e,onSuccess:s})=>{let{formatMessage:a}=(0,o.X)(),{hasRole:i}=(0,c.f)(),l=tr({onSuccess:s}),n=(0,t.useMemo)(()=>{let t=e?.texts?.title??"";return`${t} - New Bundle Item`},[e]),u=async({title:e,type:t,quantity:s})=>{try{return await l({title:e,type:t,quantity:s}),{success:!0}}catch(e){return{success:!1,error:{message:e?.message}}}},m=a({id:"bundle-item-scaffolded-success",defaultMessage:"New product scaffolded and added to bundle successfully"}),f=(0,w.f)({submit:u,successMessage:m,enableReinitialize:!0,initialValues:{title:n,type:d.f.SimpleProduct,quantity:1}});return(0,r.jsxs)(g.f,{className:"mt-4 rounded-md border border-border-subtle",form:f,children:[(0,r.jsxs)("div",{className:"p-5 flex flex-col gap-3",children:[(0,r.jsx)("h3",{className:"text-md font-semibold text-slate-800 dark:text-slate-100",children:a({id:"scaffold_bundle_item_title",defaultMessage:"Scaffold New Bundle Item"})}),(0,r.jsx)(y.f,{name:"title",id:"title",label:a({id:"name",defaultMessage:"Name"}),required:!0,className:"block w-full rounded-md border-border-default text-sm"}),(0,r.jsx)(v.f,{className:"mt-1 w-full",label:a({id:"type",defaultMessage:"Type"}),placeholder:a({id:"type",defaultMessage:"Type"}),required:!0,name:"type",options:Object.fromEntries(Object.entries(d.f).filter(([,e])=>e!==d.f.ConfigurableProduct&&e!==d.f.BundleProduct).map(([e,t])=>[t,e]))}),(0,r.jsx)(y.f,{name:"quantity",type:"number",required:!0,label:a({id:"quantity",defaultMessage:"Quantity"})})]}),i(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"border-t border-border-subtle bg-surface-subtle p-5 text-right",children:(0,r.jsx)(b.f,{label:a({id:"scaffold_and_add",defaultMessage:"Scaffold & Add"})})})]})},tn=({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{customProperties:a,hydrateFragment:i}=(0,T.f)(),{data:l,loading:r,error:d}=(0,P.f)(((e="")=>M.a`
|
|
630
|
-
query Product($productId: ID, $slug: String) {
|
|
631
|
-
product(productId: $productId, slug: $slug) {
|
|
632
|
-
...ProductDetailFragment
|
|
633
|
-
${e}
|
|
634
|
-
texts {
|
|
635
|
-
_id
|
|
636
|
-
title
|
|
637
|
-
subtitle
|
|
638
|
-
description
|
|
639
|
-
}
|
|
640
|
-
... on SimpleProduct {
|
|
641
|
-
texts {
|
|
642
|
-
_id
|
|
643
|
-
title
|
|
644
|
-
subtitle
|
|
645
|
-
description
|
|
646
|
-
}
|
|
647
|
-
proxies {
|
|
648
|
-
__typename
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
... on ConfigurableProduct {
|
|
652
|
-
texts {
|
|
653
|
-
_id
|
|
654
|
-
title
|
|
655
|
-
subtitle
|
|
656
|
-
description
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
... on PlanProduct {
|
|
660
|
-
texts {
|
|
661
|
-
_id
|
|
662
|
-
title
|
|
663
|
-
subtitle
|
|
664
|
-
description
|
|
665
|
-
}
|
|
666
|
-
proxies {
|
|
667
|
-
__typename
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
... on BundleProduct {
|
|
671
|
-
texts {
|
|
672
|
-
_id
|
|
673
|
-
title
|
|
674
|
-
subtitle
|
|
675
|
-
description
|
|
676
|
-
}
|
|
677
|
-
proxies {
|
|
678
|
-
__typename
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
${k.f}
|
|
684
|
-
`)(a?.Product),{skip:!e&&!s,variables:{productId:e||s}}),n=i(a?.Product,l?.product);return{product:l?.product,loading:r,error:d,extendedData:n}};e.s(["f",0,tn],84278);let to=({productId:e,disabled:s=!1})=>{let{product:a}=tn({productId:e}),{setModal:i}=(0,ei.f)(),[l,n]=(0,t.useState)(""),{createProductBundleItem:u}=(()=>{let[e]=(0,C.f)(te);return{createProductBundleItem:async({productId:t,item:s})=>e({variables:{productId:t,item:s},refetchQueries:["ProductBundleItems"]})}})(),{hasRole:m}=(0,c.f)(),{formatMessage:f}=(0,o.X)(),{products:p,loading:x}=(0,tt.f)({queryString:l,includeDrafts:!0,limit:50,sort:[{key:"created",value:d.A.Desc}]}),h=async({productId:t,quantity:s})=>(await u({item:{productId:t,quantity:s},productId:e}),{success:!0}),v=f({id:"bundle_item_added",defaultMessage:"Bundle product added successfully"}),N=(0,w.f)({disabled:s,submit:h,successMessage:v,onSubmitSuccess:()=>(N.api.resetForm(),null),initialValues:{productId:"",quantity:1}}),M=(0,t.useCallback)(async()=>{await i((0,r.jsx)(td,{bundleProduct:a,onSuccess:async(t,s=1)=>{await u({item:{productId:t._id,quantity:s},productId:e}),i("")}}))},[a]);return(0,r.jsxs)(g.f,{form:N,children:[(0,r.jsxs)("div",{className:"flex items-end gap-2 w-full",children:[(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(e8.f,{name:"productId",onFilter:n,queryString:l,label:f({id:"product",defaultMessage:"Product"}),data:((e=[])=>e.map(({_id:e,status:t,texts:s,media:a})=>({id:e,tag:t,...s,image:a?.length?a[0]?.file?.url:null})))(p),isLoading:x,className:"w-full text-sm font-medium text-slate-500",required:!0})}),m(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"pb-3",children:(0,r.jsx)(j.f,{className:"flex items-center justify-center p-2 rounded-md",onClick:M,children:(0,r.jsx)(ti,{className:"h-5 w-5"})})})]}),(0,r.jsx)(y.f,{name:"quantity",type:"number",required:!0,label:f({id:"quantity",defaultMessage:"Quantity"})}),m(d.C.ManageProducts)&&(0,r.jsx)(b.f,{label:f({id:"submit",defaultMessage:"Submit"}),className:"mt-2"})]})};var tc=e.i(54529);let tu=M.a`
|
|
685
|
-
query ProductBundleItems(
|
|
686
|
-
$productId: ID
|
|
687
|
-
$slug: String
|
|
688
|
-
$forceLocale: Locale
|
|
689
|
-
) {
|
|
690
|
-
product(productId: $productId, slug: $slug) {
|
|
691
|
-
_id
|
|
692
|
-
... on BundleProduct {
|
|
693
|
-
bundleItems {
|
|
694
|
-
product {
|
|
695
|
-
...ProductBriefFragment
|
|
696
|
-
}
|
|
697
|
-
quantity
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
${tc.f}
|
|
703
|
-
`,tm=M.a`
|
|
704
|
-
mutation RemoveBundleItem($productId: ID!, $index: Int!) {
|
|
705
|
-
removeBundleItem(productId: $productId, index: $index) {
|
|
706
|
-
_id
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
`;var tf=e.i(41158),tp=e.i(87284),tx=e.i(76069);let tg=({item:e,onDelete:t,index:s})=>{let{product:a,quantity:i}=e;return(0,r.jsx)(tf.default,{href:`/products?slug=${(0,W.U)(a)}`,children:(0,r.jsxs)("div",{className:" group flex w-full items-center justify-between border-b border-border-subtle hover:border-slate-300 dark:hover:border-slate-600 hover:bg-slate-50/80 dark:hover:bg-slate-700/50 transition-all duration-200 ease-in-out hover:shadow-sm last:border-none",children:[(0,r.jsxs)("div",{className:"flex w-full items-center space-x-6 py-4",children:[a.media?.length?(0,r.jsx)("div",{className:"flex w-20 flex-col items-center",children:(0,r.jsx)("div",{className:"relative m-1 mr-2 mt-1 flex items-center justify-center rounded-full ",children:(0,r.jsx)(tp.f,{className:"mx-auto w-auto",src:a.media[0]?.file?.url,width:160,height:100,alt:a?.texts?.title||a?.texts?.subtitle})})}):(0,r.jsx)(tx.f,{className:"h-10 w-10"}),(0,r.jsxs)("div",{className:"shrink grow basis-1/2",children:[(0,r.jsx)("h3",{className:"text-lg text-text-secondary",children:a?.texts?.title}),(0,r.jsx)("p",{className:"text-xs text-slate-600 dark:text-slate-200",children:a?.texts?.subtitle})]}),(0,r.jsx)("div",{className:"ml-auto",children:(0,r.jsx)(eM.f,{text:i,color:"slate",square:!0})})]}),(0,r.jsx)(eq.f,{onDelete:()=>{t(s)},showDelete:!0})]})})},th=({productId:e})=>{let{formatMessage:t}=(0,o.X)(),{setModal:s}=(0,ei.f)(),{selectedLocale:a}=(0,O.f)(),{bundleItems:i,loading:l}=(({productId:e=null,slug:t=null}={})=>{let{selectedLocale:s}=(0,O.f)(),a=(0,W.Q)(t),{data:i,loading:l,error:r}=(0,P.f)(tu,{skip:!e&&!a,variables:{productId:e||a,forceLocale:s},context:{headers:{forceLocale:s}}});return{bundleItems:i?.product?.bundleItems||[],loading:l,error:r}})({productId:e,forceLocale:a}),{removeBundleItem:d}=(()=>{let[e]=(0,C.f)(tm);return{removeBundleItem:async({productId:t,index:s})=>e({variables:{productId:t,index:s},refetchQueries:["ProductBundleItems"]})}})(),n=async a=>{await s((0,r.jsx)(es.f,{onCancelClick:async()=>s(""),message:t({id:"delete_bundle_item_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this bundle item? "}),onOkClick:async()=>{s(""),await d({productId:e,index:a}),U.toast.success(t({id:"bundle_item_deleted",defaultMessage:"Bundle item deleted successfully"}))},okText:t({id:"delete_bundle_item",defaultMessage:"Delete item"})}))};return l?(0,r.jsx)(eg.f,{}):i.length?(0,r.jsx)(r.Fragment,{children:i.map((e,t)=>(0,r.jsx)(tg,{index:t,item:e,onDelete:n},e.product._id))}):(0,r.jsx)(G.f,{message:t({id:"bundle",defaultMessage:"Bundle product"})})};e.s(["f",0,({productId:e,disabled:t=!1})=>(0,r.jsx)("div",{className:"mt-6 rounded-md",children:(0,r.jsxs)("div",{className:"lg:grid lg:grid-cols-9",children:[(0,r.jsx)("div",{className:"mb-5 lg:col-span-4 lg:pr-5",children:(0,r.jsx)(to,{productId:e,disabled:t})}),(0,r.jsx)("div",{className:"col-span-5 ml-auto rounded-md bg-surface px-8 shadow-md dark:shadow-none lg:w-full",children:(0,r.jsx)("div",{className:"py-4",children:(0,r.jsx)(th,{productId:e})})})]})})],11907)}])})();
|