@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
|
@@ -0,0 +1,710 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42929,10878,97057,95379,51628,e=>{"use strict";var t=e.i(91398),a=e.i(3326);e.i(51523);var s=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 U=e.i(8918);let L=(e,t,a)=>{let s=e[a],i=[];return(s?.values.filter(e=>e.length).forEach(e=>{let a={};a[s.key]=e,t.length>0?t.forEach(e=>{i.push({...e,...a})}):i.push(a)}),e.length>a+1)?L(e,i,a+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 B=e.i(21623),Q=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:a,vectors:s})=>e({variables:{productId:t,proxyId:a,vectors:s},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),ea=e.i(98949),es=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:s,locale:i}){let{createProduct:l}=(0,ed.f)(),{addProductAssignment:r}=G(),{formatMessage:d}=(0,a.X)();return async({title:a,type:n})=>{let o=[{title:a,slug:a.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}),s?.(u),{success:!0}}};var eo=e.i(10685),ec=e.i(57561);let eu=({proxyProduct:e,vectors:i,onSuccess:l})=>{let{formatMessage:r}=(0,a.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,ea.f)({submit:m,successMessage:f,enableReinitialize:!0,initialValues:{title:u,type:s.f.SimpleProduct}});return(0,t.jsxs)(es.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(s.f).map(([e,t])=>[t,e]))})]}),o(s.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,a.X)(),[u,m]=(0,S.useState)(""),{addProductAssignment:f}=G(),{removeProductAssignment:p}=(()=>{let[e]=(0,Z.f)(Y);return{removeProductAssignment:async({proxyId:t,vectors:a})=>e({variables:{proxyId:t,vectors:a},refetchQueries:["ProductAssignments"]})}})(),{hasRole:x}=(0,$.f)(),{setModal:g}=(0,W.f)(),{products:h}=(0,J.f)({queryString:u,limit:50,sort:[{key:"created",value:s.B.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)(U.f.Row,{children:[e.map((e,a)=>(0,t.jsx)(U.f.Cell,{className:"font-medium",children:e},`${e}`)),(0,t.jsx)(U.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(s.C.ManageProducts)&&(0,t.jsx)(B.f,{onClick:M,children:(0,t.jsx)(et.f,{className:"h-5 w-5"})})]})})}),(0,t.jsx)(U.f.Cell,{children:i&&i._id&&(0,t.jsx)(B.f,{variant:"danger",size:"xs",rounded:"full",icon:(0,t.jsx)(Q.f,{className:"h-5 w-5"}),onClick:y})})]})};var ef=e.i(82078);let ep=({proxyId:e,disabled:s=!1})=>{let{formatMessage:i}=(0,a.X)(),{product:l,loading:r}=(({productId:e=null,slug:t=null}={})=>{let a=(0,q.Q)(t),{data:s,loading:i,error:l}=(0,R.f)(O,{skip:!e&&!a,variables:{productId:e||a}});return{product:s?.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?L(e,[],0):[]},[c]),m=(0,S.useMemo)(()=>n.map(e=>{let t={};return o.forEach(a=>{let s=e.vectors.find(e=>e.variation?.key===a);t[a]=s?.option?.value??""}),t}),[n,o]),f=(0,S.useMemo)(()=>{let e=[...u,...m],t=new Set;return e.filter(e=>{let a=Object.values(e).join("::");return!t.has(a)&&(t.add(a),!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,a])=>e[t]===a));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)(U.f,{children:[(0,t.jsxs)(U.f.Row,{children:[o.map(e=>(0,t.jsx)(U.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)(U.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)(U.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:a,columns:i,product:d})=>(0,t.jsx)(em,{columns:i,disabled:s,loading:r,product:l,variationProduct:d,columnKeys:o,proxyId:e},a))]})]}),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),eh=e.i(23239);let ev=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
|
+
ercMetadataProperties
|
|
101
|
+
}
|
|
102
|
+
contractStandard
|
|
103
|
+
contractAddress
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`,eb=E.a`
|
|
108
|
+
query SmartContractStandards {
|
|
109
|
+
smartContractStandards: __type(name: "SmartContractStandard") {
|
|
110
|
+
options: enumValues {
|
|
111
|
+
value: name
|
|
112
|
+
label: name
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`,ey=E.a`
|
|
117
|
+
mutation UpdateProductTokenization(
|
|
118
|
+
$productId: ID!
|
|
119
|
+
$tokenization: UpdateProductTokenizationInput!
|
|
120
|
+
) {
|
|
121
|
+
updateProductTokenization(
|
|
122
|
+
productId: $productId
|
|
123
|
+
tokenization: $tokenization
|
|
124
|
+
) {
|
|
125
|
+
_id
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
`,ej=({productId:e,disabled:i=!1})=>{let{formatMessage:l}=(0,a.X)(),{hasRole:r}=(0,$.f)(),{smartContractStandards:d}=(()=>{let{data:e,loading:t,error:a}=(0,R.f)(eb);return{smartContractStandards:e?.smartContractStandards?.options||[],loading:t,error:a}})(),{updateProductTokenization:n}=(()=>{let[e]=(0,Z.f)(ey);return{updateProductTokenization:async({productId:t,tokenization:{contractAddress:a,contractStandard:s,tokenId:i,supply:l,ercMetadataProperties:r}})=>e({variables:{productId:t,tokenization:{contractAddress:a,contractStandard:s,tokenId:i,supply:parseInt(l,10),ercMetadataProperties:r}},refetchQueries:["Product","Products"]})}})(),{product:o,loading:c}=(({productId:e=null,slug:t=null}={})=>{let a=(0,q.Q)(t),{data:s,loading:i,error:l}=(0,R.f)(ev,{skip:!e&&!t,variables:{productId:e||a}});return{product:s?.product,loading:i,error:l}})({productId:e}),u=async({contractAddress:t,contractStandard:a,tokenId:s,supply:i,ercMetadataProperties:l})=>(await n({productId:e,tokenization:{contractAddress:t||void 0,contractStandard:a,tokenId:s||void 0,supply:i,ercMetadataProperties:l?JSON.parse(l):void 0}}),{success:!0}),m=l({id:"token_updated",defaultMessage:"Token update successfully!"}),f=(0,ea.f)({disabled:i,submit:u,successMessage:m,initialValues:{contractAddress:"",contractStandard:"",tokenId:"",supply:"",ercMetadataProperties:null}});return(0,S.useEffect)(()=>{if(!c){let e=o?.contractConfiguration?.ercMetadataProperties;f.api.setValues({contractAddress:o?.contractAddress||"",contractStandard:o?.contractStandard||"",tokenId:o?.contractConfiguration?.tokenId||"",supply:o?.contractConfiguration?.supply||"",ercMetadataProperties:e?JSON.stringify(e,null,2):null})}},[c]),(0,t.jsx)(ex.f,{documentationLabel:l({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,t.jsx)(a.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)(es.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"}),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"}),(0,t.jsx)(eh.f,{name:"ercMetadataProperties",required:!1,rows:6,label:l({id:"erc_metadata_properties",defaultMessage:"ERC metadata properties"})})]}),r(s.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 ew=e.i(31494),eN=e.i(83788),eM=e.i(13534),eP=e.i(70475);let e_=({id:e,selectedView:a="",disableAll:s=!1,...i})=>{if("texts"===a)return(0,t.jsx)(g.f,{children:(0,t.jsx)(v.f,{productId:e,disabled:s})});if("media"===a)return(0,t.jsx)(eN.f,{children:(0,t.jsx)(g.f,{children:(0,t.jsx)(b.f,{productId:e})})});if("commerce"===a)return(0,t.jsx)(h.f,{productId:e,disabled:s});if("supply"===a)return(0,t.jsx)(j.f,{productId:e,disabled:s});if("warehousing"===a)return(0,t.jsx)(N.f,{productId:e,disabled:s});if("fulfillment"===a)return(0,t.jsx)(M.f,{productId:e});if("variations"===a)return(0,t.jsx)(g.f,{children:(0,t.jsx)(w.f,{productId:e,disabled:s})});if("bundled_products"===a)return(0,t.jsx)(g.f,{children:(0,t.jsx)(I.f,{productId:e,disabled:s})});if("subscriptions"===a)return(0,t.jsx)(y.f,{productId:e,disabled:s});if("reviews"===a)return(0,t.jsx)(_.f,{productId:e});if("assignments"===a)return(0,t.jsx)(g.f,{children:(0,t.jsx)(ep,{proxyId:e,disabled:s})});if("token"===a)return(0,t.jsx)(ej,{productId:e,disabled:s});if("extended"===a)return(0,t.jsx)(ew.f,{data:i});if(a?.startsWith("plugin:")){let s=a.replace("plugin:","");return(0,t.jsx)(eP.f,{slot:"product:tabs",entityId:e,children:(a,i)=>i.component===s?(0,t.jsx)(a,{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,a.X)(),{hasRole:v}=(0,$.f)(),{updateProduct:b}=(0,k.f)(),{shopInfo:y}=(0,ec.f)(),{getSlotPlugins:j}=(0,eM.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(s.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)(e_,{disableAll:e?.status===s.X.Deleted,id:e?._id,...g})})]})}],42929);var eI=e.i(87284);e.s(["f",0,({media:e=[],onEditMedia:a})=>(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(a&&a(t))},children:(0,t.jsx)(eI.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 eC=e.i(62199);let ek=E.a`
|
|
129
|
+
mutation PublishProduct($productId: ID!) {
|
|
130
|
+
publishProduct(productId: $productId) {
|
|
131
|
+
...ProductDetailFragment
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
${eC.f}
|
|
135
|
+
`;e.s(["f",0,()=>{let[e]=(0,Z.f)(ek);return{publishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],95379);let e$=E.a`
|
|
136
|
+
mutation UnpublishProduct($productId: ID!) {
|
|
137
|
+
unpublishProduct(productId: $productId) {
|
|
138
|
+
...ProductDetailFragment
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
${eC.f}
|
|
142
|
+
`;e.s(["f",0,()=>{let[e]=(0,Z.f)(e$);return{unPublishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],51628)},88604,e=>{"use strict";var t=e.i(59080),a=e.i(76204);let s=t.a`
|
|
143
|
+
mutation RemoveProduct($productId: ID!) {
|
|
144
|
+
removeProduct(productId: $productId) {
|
|
145
|
+
_id
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
`;e.s(["f",0,()=>{let[e]=(0,a.f)(s);return{removeProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},41418,e=>{"use strict";var t=e.i(59080),a=e.i(76204),s=e.i(62199);let i=t.a`
|
|
149
|
+
mutation UpdateProduct($productId: ID!, $product: UpdateProductInput!) {
|
|
150
|
+
updateProduct(productId: $productId, product: $product) {
|
|
151
|
+
...ProductDetailFragment
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
${s.f}
|
|
155
|
+
`;e.s(["f",0,()=>{let[e]=(0,a.f)(i);return{updateProduct:async({productId:t,product:{tags:a,sequence:s,meta:i}})=>e({variables:{productId:t,product:{tags:a,sequence:s,meta:i}},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},30311,e=>{"use strict";var t=e.i(91398),a=e.i(3326);e.i(51523);var s=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,a.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}),U=R?.status||"DRAFT",L=(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"===U,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(s.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"===U,selectedTitle:_({id:"not_published",defaultMessage:"Not published"}),bgColor:"amber",disable:"ACTIVE"===U&&!C(s.C.ManageProducts),onClick:async()=>{if(C(s.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)}})},B=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},a)=>(0,t.jsx)("li",{children:e.replace("Product","")},a))}),(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,{variant:"detail"}):(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"===U&&(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"===U&&(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:[U&&"DELETED"!==U&&(0,t.jsx)(m.f,{options:L,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(s.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"===U&&C(s.C.ManageProducts)&&(0,t.jsx)(g.f,{variant:"danger",icon:(0,t.jsx)(N.f,{className:"h-5 w-5"}),text:"Delete",onClick:B})]})]}),(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(s.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=>{"use strict";var t=e.i(91788);let a=t.forwardRef(function({title:e,titleId:a,...s},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":a},s),e?t.createElement("title",{id:a},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,a],43054);let s=t.forwardRef(function({title:e,titleId:a,...s},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":a},s),e?t.createElement("title",{id:a},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,s],95336);let i=t.forwardRef(function({title:e,titleId:a,...s},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":a},s),e?t.createElement("title",{id:a},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:a,...s},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":a},s),e?t.createElement("title",{id:a},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(3326),o=e.i(58971),c=e.i(5505),u=e.i(98520),m=e.i(79093),f=e.i(69211),p=e.i(63094),x=e.i(21128),g=e.i(98949),h=e.i(59080),v=e.i(32171);let b=h.a`
|
|
156
|
+
fragment ProductCatalogPriceFragment on ProductCatalogPrice {
|
|
157
|
+
isTaxable
|
|
158
|
+
isNetPrice
|
|
159
|
+
country {
|
|
160
|
+
_id
|
|
161
|
+
isoCode
|
|
162
|
+
name
|
|
163
|
+
flagEmoji
|
|
164
|
+
}
|
|
165
|
+
currency {
|
|
166
|
+
_id
|
|
167
|
+
isoCode
|
|
168
|
+
isActive
|
|
169
|
+
}
|
|
170
|
+
amount
|
|
171
|
+
minQuantity
|
|
172
|
+
}
|
|
173
|
+
`,y=h.a`
|
|
174
|
+
query ProductCatalogPrices($productId: ID!) {
|
|
175
|
+
productCatalogPrices(productId: $productId) {
|
|
176
|
+
...ProductCatalogPriceFragment
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
${b}
|
|
180
|
+
`;var j=e.i(76204),w=e.i(62199),N=e.i(25520);let M=h.a`
|
|
181
|
+
mutation UpdateProductCommerce(
|
|
182
|
+
$productId: ID!
|
|
183
|
+
$commerce: UpdateProductCommerceInput!
|
|
184
|
+
) {
|
|
185
|
+
updateProductCommerce(productId: $productId, commerce: $commerce) {
|
|
186
|
+
...ProductDetailFragment
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
${w.f}
|
|
190
|
+
`;var P=e.i(58021),_=e.i(1504),I=e.i(30434),C=e.i(10685),k=e.i(16984),$=e.i(21623),S=e.i(82226);let T=({name:e,defaultCountryValue:t,defaultCurrencyValue:a,countries:s,currencies:i})=>{let{formatMessage:l}=(0,n.X)(),{hasRole:c}=(0,o.f)(),{watch:u,getValues:m,trigger:f}=(0,P.useFormContext)(),{fields:p,append:x,remove:g}=(0,P.useFieldArray)({name:e});u(e);let h=()=>m(e),v=()=>{let t=p.map((t,a)=>`${e}.${a}.minQuantity`);setTimeout(()=>f(t),0)};return(0,r.jsxs)("div",{children:[p.map((n,o)=>{let u=[(0,S.D)(o,h),(0,S.P)(o,h)];return(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)(k.f,{className:"w-full",disabled:!c(d.C.ManageProducts),validators:u,name:`${e}.${o}.minQuantity`,id:`${e}.${o}.minQuantity`,type:"number",min:0,hideLabel:!0,onChange:v,label:l({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)(k.f,{type:"number",className:"w-full",disabled:!c(d.C.ManageProducts),name:`${e}.${o}.amount`,id:`${e}.${o}.amount`,required:!0,hideLabel:!0,label:l({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)(I.f,{name:`${e}.${o}.isTaxable`,labelClassName:"lg:sr-only items-center ",disabled:!c(d.C.ManageProducts),label:l({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)(I.f,{name:`${e}.${o}.isNetPrice`,labelClassName:"lg:sr-only items-center",disabled:!c(d.C.ManageProducts),label:l({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)(C.f,{defaultValue:t,className:"w-full lg:ml-4 lg:mr-4",label:l({id:"country",defaultMessage:"Country"}),name:`${e}.${o}.countryCode`,id:`${e}.${o}.countryCode`,disabled:!c(d.C.ManageProducts),required:!0,options:(0,_.f)(s,"isoCode","isoCode"),hideLabel:!0,onChange:v}),(0,r.jsx)(C.f,{defaultValue:a,className:"w-full lg:mr-8 ",label:l({id:"currency",defaultMessage:"Currency"}),disabled:!c(d.C.ManageProducts),name:`${e}.${o}.currencyCode`,id:`${e}.${o}.currencyCode`,required:!0,options:(0,_.f)(i,"isoCode","isoCode"),hideLabel:!0,onChange:v,placeholder:l({id:"country_currency",defaultMessage:"Currency"})})]}),c(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:()=>{g(o),v()},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)}),c(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)($.f,{variant:"tertiary",text:l({id:"add_price_row",defaultMessage:"Add Price Row"}),className:"w-full items-center justify-center",onClick:()=>x({minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:a,countryCode:t})})})]})},V=({name:e="pricing",defaultCountryValue:t,defaultCurrencyValue:a,countries:s,currencies:i})=>{let{formatMessage:l}=(0,n.X)();return(0,r.jsxs)(r.Fragment,{children:[(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:l({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)("span",{className:"w-full lg:ml-5",children:l({id:"price",defaultMessage:"Price"})})]}),(0,r.jsxs)("span",{className:"flex w-full",children:[(0,r.jsx)("span",{className:"w-full lg:ml-8",children:l({id:"vat_suspect",defaultMessage:"Vat Suspect"})}),(0,r.jsx)("span",{className:"w-full lg:ml-12",children:l({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:l({id:"country",defaultMessage:"Country"})}),(0,r.jsx)("span",{className:"w-full",children:l({id:"currency",defaultMessage:"Currency"})})]})]}),(0,r.jsx)(T,{name:e,defaultCountryValue:t,defaultCurrencyValue:a,countries:s,currencies:i})]})};e.s(["f",0,({productId:e,disabled:t=!1})=>{let{formatMessage:a}=(0,n.X)(),{catalogPrices:s}=(({productId:e})=>{let{data:t,loading:a,error:s}=(0,v.f)(y,{skip:!e,variables:{productId:e}});return{catalogPrices:t?.productCatalogPrices||[],loading:a,error:s}})({productId:e}),{hasRole:i}=(0,o.f)(),{updateProductCommerce:l}=(()=>{let[e]=(0,j.f)(M),{currencies:t}=(0,m.f)();return{updateProductCommerce:async({productId:a,commerce:{pricing:s}})=>e({variables:{productId:a,commerce:{pricing:(0,N.m)(s,t)}},refetchQueries:["Products"]})}})(),{countries:h}=(0,u.f)(),{currencies:b}=(0,m.f)(),w=h?.find(({isBase:e})=>e),P=w?.isoCode,_=w?.defaultCurrency?.isoCode,I=async({pricing:t})=>(await l({productId:e,commerce:{pricing:t}}),{success:!0}),C=a({id:"saved",defaultMessage:"Saved"}),k=((e=[],t=[])=>t.length?(0,N.b)(e.map(({country:e,currency:t,...a})=>({...a,countryCode:e.isoCode,currencyCode:t.isoCode})),t):[])(s,b),$=(0,g.f)({disabled:t,submit:I,successMessage:C,enableReinitialize:!0,initialValues:{pricing:[...k?.length?k:[{minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:_,countryCode:P}]]}});return(0,r.jsx)("div",{children:(0,r.jsxs)("div",{className:"mt-5 md:col-span-3 lg:mt-0",children:[(0,r.jsx)(c.U,{children:(0,r.jsxs)(f.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.jsx)(V,{name:"pricing",defaultCountryValue:P,defaultCurrencyValue:_,countries:h,currencies:b})]}),(0,r.jsx)(p.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)(x.f,{className:"mx-6",label:a({id:"save",defaultMessage:"Save"})})})]})}),(0,r.jsx)("p",{className:"mt-6 mb-10 text-sm text-text-muted",children:a({id:"product_commerce_info",defaultMessage:"Every country and currency needs one price with a min quantity of 0 (or empty), and no two prices may share the same min quantity, currency and country"})})]})})}],42532);var D=e.i(70693),E=e.i(14336);let R=h.a`
|
|
191
|
+
mutation UpdateProductTexts($productId: ID!, $texts: [ProductTextInput!]!) {
|
|
192
|
+
updateProductTexts(productId: $productId, texts: $texts) {
|
|
193
|
+
...ProductTextsFragment
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
${E.f}
|
|
197
|
+
`;var q=e.i(60195),A=e.i(83094),O=e.i(13120),U=e.i(53296),L=e.i(57561),F=e.i(48539);e.s(["f",0,({productId:e,disabled:a=!1})=>{let{selectedLocale:s,setSelectedLocale:i,languageDialectList:l}=(0,L.f)(),{formatMessage:u}=(0,n.X)(),{hasRole:m}=(0,o.f)(),{defaultLocale:p,shopInfo:b,loading:y}=(0,F.f)(),{translatedTexts:w}=(({productId:e})=>{let{customProperties:t}=(0,D.f)(),{data:a,loading:s,error:i}=(0,v.f)(((e="")=>h.a`
|
|
198
|
+
query TranslatedProductTexts($productId: ID!) {
|
|
199
|
+
translatedProductTexts(productId: $productId) {
|
|
200
|
+
...ProductTextsFragment
|
|
201
|
+
${e}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
${E.f}
|
|
205
|
+
`)(t?.ProductTexts),{skip:!e,variables:{productId:e}});return{translatedTexts:a?.translatedProductTexts||[],loading:s,error:i}})({productId:e}),N=u({id:"saved",defaultMessage:"Saved"}),{updateProductTexts:M}=(()=>{let[e]=(0,j.f)(R);return{updateProductTexts:async({productId:t,texts:a})=>e({variables:{productId:t,texts:a},refetchQueries:["TranslatedProductTexts"]})}})(),P=async({slug:t,title:a,subtitle:i,vendor:l,description:r,brand:d,labels:n})=>(await M({productId:e,texts:[{locale:s,slug:t,title:a,subtitle:i,vendor:l,description:r,brand:d,labels:n}]}),{success:!0}),_=(0,g.f)({disabled:a,submit:P,successMessage:N,initialValues:{slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[]}});return(0,t.useEffect)(()=>{let e=w?.find(e=>e.locale===s);_.api.setValues({slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[],...e||{}})},[w,s]),(0,t.useEffect)(()=>{if(b&&w?.length&&!w?.find(({locale:e})=>e===s))if(p&&w?.find(({locale:e})=>e===p))i(p);else if(p&&w?.find(({locale:e})=>e===p.split("-")[0]))i(p.split("-")[0]);else{let e=w?.find(({locale:e})=>e&&l?.find(({isoCode:t})=>t===e));i(e?.locale)}},[y,w]),(0,r.jsx)(q.f,{documentationLabel:u({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(n.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)(c.U,{children:(0,r.jsxs)(f.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)(k.f,{name:"slug",disabled:!m(d.C.ManageProducts),required:!0,id:"slug",label:u({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)(k.f,{name:"title",disabled:!m(d.C.ManageProducts),required:!0,id:"title",label:u({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)(k.f,{name:"subtitle",disabled:!m(d.C.ManageProducts),id:"subtitle",label:u({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)(k.f,{name:"vendor",disabled:!m(d.C.ManageProducts),id:"vendor",label:u({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)(k.f,{name:"brand",disabled:!m(d.C.ManageProducts),id:"brand",label:u({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)(O.f,{name:"labels",id:"labels",disabled:!m(d.C.ManageProducts),label:u({id:"labels",defaultMessage:"Labels"}),placeholder:u({id:"label",defaultMessage:"Label"}),buttonText:u({id:"add",defaultMessage:"Add"}),autoComplete:"on",className:"text-sm"}),(0,r.jsx)(U.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)(A.f,{name:"description",id:"description",disabled:!m(d.C.ManageProducts),label:u({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)(x.f,{label:u({id:"save",defaultMessage:"Save"})})})]})})})}],10785);var B=e.i(28401),Q=e.i(59295),z=e.i(6277),X=e.i(33006),K=e.i(93994),W=e.i(64479);let Z=h.a`
|
|
206
|
+
mutation PrepareProductMediaUpload($mediaName: String!, $productId: ID!) {
|
|
207
|
+
prepareProductMediaUpload(mediaName: $mediaName, productId: $productId) {
|
|
208
|
+
_id
|
|
209
|
+
putURL
|
|
210
|
+
expires
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
`;var H=e.i(1880);let G=h.a`
|
|
214
|
+
fragment ProductMediaFragment on ProductMedia {
|
|
215
|
+
_id
|
|
216
|
+
tags
|
|
217
|
+
file {
|
|
218
|
+
_id
|
|
219
|
+
name
|
|
220
|
+
type
|
|
221
|
+
size
|
|
222
|
+
url
|
|
223
|
+
}
|
|
224
|
+
sortKey
|
|
225
|
+
texts {
|
|
226
|
+
_id
|
|
227
|
+
locale
|
|
228
|
+
title
|
|
229
|
+
subtitle
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
`,J=h.a`
|
|
233
|
+
query ProductMedia($productId: ID, $slug: String) {
|
|
234
|
+
product(productId: $productId, slug: $slug) {
|
|
235
|
+
_id
|
|
236
|
+
media {
|
|
237
|
+
...ProductMediaFragment
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
${G}
|
|
242
|
+
`;var Y=e.i(2194),ee=e.i(90062);let et=h.a`
|
|
243
|
+
fragment ProductMediaTextsFragment on ProductMediaTexts {
|
|
244
|
+
_id
|
|
245
|
+
locale
|
|
246
|
+
title
|
|
247
|
+
subtitle
|
|
248
|
+
}
|
|
249
|
+
`,ea=h.a`
|
|
250
|
+
query TranslatedProductMediaTexts($productMediaId: ID!) {
|
|
251
|
+
translatedProductMediaTexts(productMediaId: $productMediaId) {
|
|
252
|
+
...ProductMediaTextsFragment
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
${et}
|
|
256
|
+
`,es=h.a`
|
|
257
|
+
mutation UpdateProductMediaTexts(
|
|
258
|
+
$productMediaId: ID!
|
|
259
|
+
$texts: [ProductMediaTextInput!]!
|
|
260
|
+
) {
|
|
261
|
+
updateProductMediaTexts(productMediaId: $productMediaId, texts: $texts) {
|
|
262
|
+
...ProductMediaTextsFragment
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
${et}
|
|
266
|
+
`;var ei=e.i(15971);let el=h.a`
|
|
267
|
+
mutation RemoveProductMedia($productMediaId: ID!) {
|
|
268
|
+
removeProductMedia(productMediaId: $productMediaId) {
|
|
269
|
+
_id
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
`;var er=e.i(6607);let ed=({media:e,id:a})=>{let{setModal:s}=(0,er.f)(),{removeProductMedia:i}=(()=>{let[e]=(0,j.f)(el);return{removeProductMedia:async({productMediaId:t})=>e({variables:{productMediaId:t},refetchQueries:["ProductMedia"]})}})(),{formatMessage:l}=(0,n.X)(),{selectedLocale:c}=(0,L.f)(),{updateProductMediaTexts:u}=(()=>{let[e]=(0,j.f)(es);return{updateProductMediaTexts:async({productMediaId:t,texts:a})=>e({variables:{productMediaId:t,texts:a},refetchQueries:["TranslatedProductMediaTexts"]})}})(),[m,f]=(0,t.useState)(!1),{hasRole:p}=(0,o.f)(),{translatedMediaTexts:x}=(({productMediaId:e})=>{let{data:t,loading:a,error:s}=(0,v.f)(ea,{skip:!e,variables:{productMediaId:e}});return{translatedMediaTexts:t?.translatedProductMediaTexts||[],loading:a,error:s}})({productMediaId:e._id}),g=x?.find(e=>e.locale===c)||{},h=async e=>{await s((0,r.jsx)(ei.f,{onCancelClick:async()=>s(""),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()=>{s(""),await i({productMediaId:e}),B.toast.success(l({id:"product_media_deleted",defaultMessage:"Media deleted successfully"}))},okText:l({id:"delete_product_media",defaultMessage:"Delete media"})}))},b=async({title:t,subtitle:a})=>(await u({productMediaId:e._id,texts:[{title:t,locale:c,subtitle:a}]}),f(!1),!0);return(0,r.jsx)(ee.f,{id:a,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)?b:void 0})},en=({medias:e,items:t})=>{let{formatMessage:a}=(0,n.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:a({id:"product_media",defaultMessage:"Product Media"})}),(0,r.jsx)("div",{className:"flow-root",children:(0,r.jsx)(z.V,{items:t,strategy:z.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 a=Object.values(e).find(e=>e._id===t);return(0,r.jsx)(ed,{id:t,media:a},a._id)}):(0,r.jsx)(Y.f,{message:a({id:"media",defaultMessage:"Media"})})})})})]})})},eo=h.a`
|
|
273
|
+
mutation ReOrderProductMedia($sortKeys: [ReorderProductMediaInput!]!) {
|
|
274
|
+
reorderProductMedia(sortKeys: $sortKeys) {
|
|
275
|
+
_id
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
`;e.s(["f",0,({productId:e})=>{let{productMedia:t}=(({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{data:s,loading:i,error:l}=(0,v.f)(J,{skip:!e&&!a,variables:{productId:e||a}});return{productMedia:s?.product?.media||[],loading:i,error:l}})({productId:e}),{formatMessage:a}=(0,n.X)(),{hasRole:s}=(0,o.f)(),{addProductMedia:i}=(()=>{let[e]=(0,j.f)(Z),{confirmMediaUpload:t}=(0,W.f)({refetchQueries:["Product"]});return{addProductMedia:async({productId:a,media:s})=>{let{data:i}=await e({variables:{productId:a,mediaName:s.name}}),{prepareProductMediaUpload:l}=i;return await (0,K.f)(s,l.putURL),t({mediaUploadTicketId:l._id,size:s?.size,type:s.type})}}})(),{reOrderProductMedia:l}=(()=>{let[e]=(0,j.f)(eo);return{reOrderProductMedia:async({sortKeys:t})=>e({variables:{sortKeys:t},refetchQueries:["ProductMedia"]})}})(),c=t?.map(e=>e._id),u=async t=>{try{await i({productId:e,media:t}),B.toast.success(a({id:"product_media_upload",defaultMessage:"Media uploaded successfully"}))}catch(e){B.toast.error(a({id:"fail_upload",defaultMessage:"Media upload failed"}))}},m=async e=>{let{active:t,over:s}=e;if(t.id!==s.id){let e=c.indexOf(t.id),i=c.indexOf(s.id),r=(0,z.e)(c,e,i).map((e,t)=>({productMediaId:e,sortKey:t}));try{await l({sortKeys:r}),B.toast.success(a({id:"link_reorder",defaultMessage:"Link reorder successfully"}))}catch(e){B.toast.error(a({id:"fail_reorder",defaultMessage:"Reordering failed, Try again!"}))}}else B.toast.info(a({id:"reorder_original",defaultMessage:"Reorder to original location"}))},f=(0,Q.n)((0,Q.J)(Q.k,{activationConstraint:{distance:5}}),(0,Q.J)(Q.y,{coordinateGetter:z.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:[s(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)(X.f,{onlyDragAndDrop:!0,addMedia:u})}),(0,r.jsx)(Q.H,{sensors:f,collisionDetection:Q.P,onDragEnd:m,children:(0,r.jsx)(en,{medias:t,items:c})})]})}],1330);let ec=h.a`
|
|
279
|
+
fragment ProductPlanConfigurationFragment on ProductPlanConfiguration {
|
|
280
|
+
usageCalculationType
|
|
281
|
+
billingInterval
|
|
282
|
+
trialInterval
|
|
283
|
+
trialIntervalCount
|
|
284
|
+
billingIntervalCount
|
|
285
|
+
minimumCommitmentPeriods
|
|
286
|
+
}
|
|
287
|
+
`,eu=h.a`
|
|
288
|
+
query ProductPlan($productId: ID, $slug: String) {
|
|
289
|
+
product(productId: $productId, slug: $slug) {
|
|
290
|
+
_id
|
|
291
|
+
... on PlanProduct {
|
|
292
|
+
plan {
|
|
293
|
+
...ProductPlanConfigurationFragment
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
${ec}
|
|
299
|
+
`,em=h.a`
|
|
300
|
+
query ProductPlanConfigurationOptions {
|
|
301
|
+
usageCalculationTypes: __type(name: "ProductPlanUsageCalculationType") {
|
|
302
|
+
options: enumValues {
|
|
303
|
+
value: name
|
|
304
|
+
label: description
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
configurationIntervals: __type(name: "ProductPlanConfigurationInterval") {
|
|
308
|
+
options: enumValues {
|
|
309
|
+
value: name
|
|
310
|
+
label: description
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
`,ef=h.a`
|
|
315
|
+
mutation UpdateProductPlan($productId: ID!, $plan: UpdateProductPlanInput!) {
|
|
316
|
+
updateProductPlan(productId: $productId, plan: $plan) {
|
|
317
|
+
_id
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
`;e.s(["f",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,n.X)(),{configurationIntervals:i,usageCalculationTypes:l}=(()=>{let{data:e,loading:t,error:a}=(0,v.f)(em),s=e?.usageCalculationTypes?.options||[];return{configurationIntervals:e?.configurationIntervals?.options||[],usageCalculationTypes:s,loading:t,error:a}})(),{plan:u,loading:m}=(({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{data:s,loading:i,error:l}=(0,v.f)(eu,{skip:!e&&!a,variables:{productId:e||a}}),r=s?.product;return{plan:r?.plan,loading:i,error:l}})({productId:e}),{hasRole:p}=(0,o.f)(),{updateProductPlan:h}=(()=>{let[e]=(0,j.f)(ef);return{updateProductPlan:async({productId:t,plan:{usageCalculationType:a,billingInterval:s,billingIntervalCount:i=null,trialInterval:l=null,trialIntervalCount:r=null,minimumCommitmentPeriods:d=null}})=>e({variables:{productId:t,plan:{usageCalculationType:a,billingInterval:s,billingIntervalCount:i,trialInterval:l,trialIntervalCount:r,minimumCommitmentPeriods:d}},refetchQueries:["Products"]})}})(),b=s({id:"enrollment_updated_successfully",defaultMessage:"Enrollment saved successfully"}),y=async({trialInterval:t,trialIntervalCount:a,billingInterval:s,billingIntervalCount:i,usageCalculationType:l,minimumCommitmentPeriods:r})=>(await h({productId:e,plan:{billingInterval:s,usageCalculationType:l,billingIntervalCount:i,trialInterval:t,trialIntervalCount:a,minimumCommitmentPeriods:r?parseInt(r,10):null}}),{success:!0}),w=(0,g.f)({disabled:a,submit:y,successMessage:b,initialValues:{trialInterval:"",trialIntervalCount:"",billingInterval:"",billingIntervalCount:"",usageCalculationType:"",minimumCommitmentPeriods:""},getSubmitErrorMessage:e=>e?.message?.includes("Status of the product does not allow this operation")?s({id:"subscription_product_type_not_valid",defaultMessage:"Status of the product does not allow this operation"}):e?.message||""});return(0,t.useEffect)(()=>{u&&!m&&w.api.setValues(u)},[u]),(0,r.jsx)(q.f,{documentationLabel:s({id:"subscription",defaultMessage:"Subscription"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(n.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)(c.U,{children:(0,r.jsx)(f.f,{form:w,children:(0,r.jsxs)("div",{className:"relative max-w-full space-y-6 rounded-md sm:p-6",children:[(0,r.jsx)(C.f,{required:!0,className:"mt-2.5 w-full py-1.5 text-sm font-medium text-slate-500",label:s({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),placeholder:s({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),name:"usageCalculationType",options:(0,_.f)(l,"value","value")}),(0,r.jsxs)("div",{className:"w-full items-end justify-end sm:flex",children:[(0,r.jsx)(C.f,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",required:!0,label:s({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),placeholder:s({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),name:"billingInterval",options:(0,_.f)(i,"value","value")}),(0,r.jsx)(k.f,{name:"billingIntervalCount",id:"billing_unit",type:"number",required:!0,label:s({id:"billing_unit",defaultMessage:"Billing Unit"}),placeholder:s({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)(C.f,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",label:s({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),placeholder:s({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),name:"trialInterval",options:(0,_.f)(i,"value","value")}),(0,r.jsx)(k.f,{type:"number",name:"trialIntervalCount",id:"trialIntervalCount ",label:s({id:"trial_unit",defaultMessage:"Trial Unit"}),placeholder:s({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)(k.f,{type:"number",name:"minimumCommitmentPeriods",id:"minimumCommitmentPeriods",label:s({id:"minimum_commitment_periods",defaultMessage:"Minimum commitment periods"}),placeholder:s({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)(x.f,{label:s({id:"save",defaultMessage:"Save"})})})]})})})})}],73356);var ep=e.i(60959);let ex=h.a`
|
|
321
|
+
query ProductSupply($productId: ID, $slug: String) {
|
|
322
|
+
product(productId: $productId, slug: $slug) {
|
|
323
|
+
_id
|
|
324
|
+
... on SimpleProduct {
|
|
325
|
+
dimensions {
|
|
326
|
+
...ProductDimensionFragment
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
${ep.f}
|
|
332
|
+
`,eg=h.a`
|
|
333
|
+
mutation UpdateProductSupply(
|
|
334
|
+
$productId: ID!
|
|
335
|
+
$supply: UpdateProductSupplyInput!
|
|
336
|
+
) {
|
|
337
|
+
updateProductSupply(productId: $productId, supply: $supply) {
|
|
338
|
+
_id
|
|
339
|
+
... on SimpleProduct {
|
|
340
|
+
dimensions {
|
|
341
|
+
...ProductDimensionFragment
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
${ep.f}
|
|
347
|
+
`;e.s(["f",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,n.X)(),i=s({id:"saved",defaultMessage:"Saved"}),{hasRole:l}=(0,o.f)(),{updateProductSupply:u}=(()=>{let[e]=(0,j.f)(eg);return{updateProductSupply:async({productId:t,supply:{weightInGram:a=null,heightInMillimeters:s=null,lengthInMillimeters:i=null,widthInMillimeters:l=null}})=>e({variables:{productId:t,supply:{weightInGram:a||null,heightInMillimeters:s||null,lengthInMillimeters:i||null,widthInMillimeters:l||null}},refetchQueries:["Products"]})}})(),{dimensions:m}=(({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{data:s,loading:i,error:l}=(0,v.f)(ex,{skip:!e&&!t,variables:{productId:e||a}}),r=s?.product;return{dimensions:r?.dimensions||{},loading:i,error:l}})({productId:e}),p=async({weight:t,length:a,width:s,height:i})=>(await u({productId:e,supply:{weightInGram:t,lengthInMillimeters:a,heightInMillimeters:i,widthInMillimeters:s}}),{success:!0}),h=(0,g.f)({disabled:a,submit:p,getSubmitErrorMessage:e=>(e.message.includes("supply.weightInGram")&&e.message.includes("Expected type Int")?h.api.setFieldError("weight","Invalid value, only integer is accepted"):e.message.includes("supply.heightInMillimeters")&&e.message.includes("Expected type Int")?h.api.setFieldError("height","Invalid value, only integer is accepted"):e.message.includes("supply.lengthInMillimeters")&&e.message.includes("Expected type Int")&&h.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&&h.api.setValues(m)},[m]),(0,r.jsx)("div",{className:"mt-5 md:col-span-2 md:mt-0",children:(0,r.jsx)(c.U,{children:(0,r.jsxs)(f.f,{form:h,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)(k.f,{validators:[(0,S.j)()],type:"number",name:"weight",disabled:!l(d.C.ManageProducts),id:"weight",label:s({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)(k.f,{validators:[(0,S.j)()],name:"length",disabled:!l(d.C.ManageProducts),id:"length",type:"number",label:s({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)(k.f,{validators:[(0,S.j)()],type:"number",name:"width",disabled:!l(d.C.ManageProducts),id:"width ",label:s({id:"width",defaultMessage:"Width (Millimeter)"}),className:"text-sm "})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(k.f,{validators:[(0,S.j)()],name:"height",disabled:!l(d.C.ManageProducts),type:"number",id:"height",label:s({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)(x.f,{label:s({id:"save",defaultMessage:"Save"}),full:!0})})]})})})}],50099);var eh=e.i(37369),ev=e.i(53576);let eb=h.a`
|
|
348
|
+
mutation CreateProductVariation(
|
|
349
|
+
$productId: ID!
|
|
350
|
+
$variation: CreateProductVariationInput!
|
|
351
|
+
$texts: [ProductVariationTextInput!]
|
|
352
|
+
) {
|
|
353
|
+
createProductVariation(
|
|
354
|
+
productId: $productId
|
|
355
|
+
variation: $variation
|
|
356
|
+
texts: $texts
|
|
357
|
+
) {
|
|
358
|
+
_id
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
`,ey=h.a`
|
|
362
|
+
fragment ProductVariationFragment on ProductVariation {
|
|
363
|
+
_id
|
|
364
|
+
type
|
|
365
|
+
key
|
|
366
|
+
texts(forceLocale: $locale) {
|
|
367
|
+
_id
|
|
368
|
+
locale
|
|
369
|
+
title
|
|
370
|
+
subtitle
|
|
371
|
+
}
|
|
372
|
+
options {
|
|
373
|
+
_id
|
|
374
|
+
texts(forceLocale: $locale) {
|
|
375
|
+
_id
|
|
376
|
+
locale
|
|
377
|
+
title
|
|
378
|
+
subtitle
|
|
379
|
+
}
|
|
380
|
+
value
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
`,ej=h.a`
|
|
384
|
+
query ProductVariations($productId: ID, $slug: String, $locale: Locale) {
|
|
385
|
+
product(productId: $productId, slug: $slug) {
|
|
386
|
+
_id
|
|
387
|
+
... on ConfigurableProduct {
|
|
388
|
+
variations {
|
|
389
|
+
...ProductVariationFragment
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
${ey}
|
|
395
|
+
`,ew=h.a`
|
|
396
|
+
query ProductVariationType {
|
|
397
|
+
variationTypes: __type(name: "ProductVariationType") {
|
|
398
|
+
options: enumValues {
|
|
399
|
+
value: name
|
|
400
|
+
label: description
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
`,eN=({helpKey:e,helpText:t,helpValues:a,...s})=>(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(k.f,{...s}),(e||t)&&(0,r.jsx)(U.f,{messageKey:e||`${s.name}_help`,defaultMessage:t,values:a,className:"mt-1"})]});var eM=e.i(95789);let eP=h.a`
|
|
405
|
+
mutation RemoveProductVariation($productVariationId: ID!) {
|
|
406
|
+
removeProductVariation(productVariationId: $productVariationId) {
|
|
407
|
+
_id
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
`;var e_=e.i(42469);let eI=h.a`
|
|
411
|
+
mutation UpdateProductVariationTexts(
|
|
412
|
+
$productVariationId: ID!
|
|
413
|
+
$productVariationOptionValue: String
|
|
414
|
+
$texts: [ProductVariationTextInput!]!
|
|
415
|
+
) {
|
|
416
|
+
updateProductVariationTexts(
|
|
417
|
+
productVariationId: $productVariationId
|
|
418
|
+
productVariationOptionValue: $productVariationOptionValue
|
|
419
|
+
texts: $texts
|
|
420
|
+
) {
|
|
421
|
+
_id
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
`,eC=()=>{let[e]=(0,j.f)(eI);return{updateProductVariationTexts:async({productVariationId:t,productVariationOptionValue:a,texts:s})=>e({variables:{productVariationId:t,productVariationOptionValue:a,texts:s},refetchQueries:["ProductVariations"]})}},ek=({variation:e,onCancel:t,onSuccess:a})=>{let{updateProductVariationTexts:s}=eC(),{formatMessage:i}=(0,n.X)(),{selectedLocale:l}=(0,L.f)(),d=async({title:t,subtitle:i})=>(await s({productVariationId:e._id,texts:[{title:t,subtitle:i,locale:l}]}),a(),{success:!0}),o=(0,g.f)({submit:d,initialValues:{title:e?.texts?.title??"",subtitle:e?.texts?.subtitle??""}});return(0,r.jsx)(f.f,{form:o,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)(k.f,{className:"mt-0 py-1",name:"title",required:!0,label:i({id:"title",defaultMessage:"Title"})})}),e?.type&&(0,r.jsx)(e_.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)(k.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)($.f,{onClick:t,type:"button",variant:"secondary",size:"sm",text:i({id:"cancel",defaultMessage:"Cancel"})}),(0,r.jsx)($.f,{onClick:()=>o.api.submitForm(),type:"submit",variant:"primary",size:"sm",text:i({id:"save",defaultMessage:"Save"})})]})]})})};var e$=e.i(86712),eS=e.i(64481),eT=e.i(37650),eV=e.i(24557);let eD=({type:e,variation:a,onEdit:s,onDelete:i})=>{let[l,d]=(0,t.useState)(!1),{formatMessage:o}=(0,n.X)(),{buttonRef:c,menuRef:u,menuPosition:m}=((e,a)=>{let s=(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=>{s.current&&!s.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a]),(0,t.useEffect)(()=>{if(e&&i.current){let e=i.current.getBoundingClientRect(),t=e.bottom+4,a=e.right-192;a<8&&(a=8),t+80>window.innerHeight-8&&(t=e.top-80-4),r({top:t,left:a})}},[e]),{buttonRef:i,menuRef:s,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:a?.texts?.title}),e&&(0,r.jsx)(e_.f,{text:e,color:"slate",className:"rounded-md uppercase text-xs font-medium flex-shrink-0"}),a?.texts?.subtitle&&(0,r.jsx)("div",{className:"text-sm text-text-muted truncate",children:a?.texts?.subtitle}),a?.options?.length>0&&(0,r.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:a.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:["(",a?.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)(e$.f,{className:"w-5 h-5 text-text-muted"})}),l&&(0,r.jsx)(eS.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(),s(),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)(eT.f,{className:"mr-3 h-5 w-5"}),o({id:"edit",defaultMessage:"Edit"})]}),(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),i(a._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)(eV.f,{className:"mr-3 h-5 w-5"}),o({id:"delete",defaultMessage:"Delete"})]})]})})})]})]})})},eE=({type:e,variation:a,onDelete:s})=>{let[i,l]=(0,t.useState)(!1);return i?(0,r.jsx)(ek,{variation:a,onCancel:()=>l(!1),onSuccess:()=>l(!1)}):(0,r.jsx)(eD,{type:e,variation:a,onEdit:()=>l(!0),onDelete:s})},eR=h.a`
|
|
425
|
+
mutation CreateProductVariationOption(
|
|
426
|
+
$productVariationId: ID!
|
|
427
|
+
$option: String!
|
|
428
|
+
$texts: [ProductVariationTextInput!]
|
|
429
|
+
) {
|
|
430
|
+
createProductVariationOption(
|
|
431
|
+
productVariationId: $productVariationId
|
|
432
|
+
option: $option
|
|
433
|
+
texts: $texts
|
|
434
|
+
) {
|
|
435
|
+
_id
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
`,eq=h.a`
|
|
439
|
+
mutation RemoveProductVariationOption(
|
|
440
|
+
$productVariationId: ID!
|
|
441
|
+
$productVariationOptionValue: String!
|
|
442
|
+
) {
|
|
443
|
+
removeProductVariationOption(
|
|
444
|
+
productVariationId: $productVariationId
|
|
445
|
+
productVariationOptionValue: $productVariationOptionValue
|
|
446
|
+
) {
|
|
447
|
+
_id
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
`,eA=({onSubmit:e})=>{let{formatMessage:t}=(0,n.X)(),{hasRole:a}=(0,o.f)(),s=t({id:"variation_option_added",defaultMessage:"Variation option added successfully!"}),i=(0,g.f)({submit:e,successMessage:s,initialValues:{value:"",title:""}});return(0,r.jsxs)(f.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)(eN,{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)(eN,{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})})]}),a(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"text-right mt-2 px-6 pb-6",children:(0,r.jsx)(x.f,{className:"py-2.5",label:t({id:"add_variation_option",defaultMessage:"Add option"})})})]})};var eO=e.i(3095);let eU=({option:e,onDelete:a,variationId:s})=>{let{formatMessage:i}=(0,n.X)(),{selectedLocale:l}=(0,L.f)(),[d,o]=(0,t.useState)(!1),c=i({id:"variation_option_updated",defaultMessage:"Variation option updated successfully!"}),{updateProductVariationTexts:u}=eC(),m=async({title:t,subtitle:a})=>{let i=await u({productVariationId:s,productVariationOptionValue:e.value,texts:[{title:t,subtitle:a,locale:l}]});return o(!1),{data:i,success:!0}},p=(0,g.f)({submit:m,successMessage:c,initialValues:{title:e?.texts?.title,subtitle:e?.texts?.subtitle}});return(0,r.jsx)(f.f,{form:p,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)(e_.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)(k.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)(k.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:()=>o(!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)(eO.f,{onEdit:()=>{o(!0)},onDelete:()=>{a(e.value)},showEdit:!0,showDelete:!0})})]})})})})},eL=({variationId:e,options:t})=>{let{createProductVariationOption:a}=(()=>{let[e]=(0,j.f)(eR);return{createProductVariationOption:async({productVariationId:t,option:a,texts:s})=>e({variables:{productVariationId:t,option:a,texts:s},refetchQueries:["ProductVariations","Product"]})}})(),{formatMessage:s}=(0,n.X)(),{selectedLocale:i}=(0,L.f)(),{setModal:l}=(0,er.f)(),{removeProductVariationOption:d}=(()=>{let[e]=(0,j.f)(eq);return{removeProductVariationOption:async({productVariationId:t,productVariationOptionValue:a})=>e({variables:{productVariationId:t,productVariationOptionValue:a},refetchQueries:["ProductVariations"]})}})(),o=async t=>{await l((0,r.jsx)(ei.f,{message:s({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}),B.toast.success(s({id:"product_variation_option_deleted",defaultMessage:"Variation option deleted successfully"}))},okText:s({id:"delete_variation_option",defaultMessage:"Delete option"})}))},c=async({value:t,title:s})=>(await a({productVariationId:e,option:t,texts:[{title:s,locale:i}]}),{success:!0});return(0,r.jsxs)("div",{className:"relative overflow-visible",children:[(0,r.jsx)(eA,{onSubmit:c}),t.length?t.map(t=>(0,r.jsx)(eU,{variationId:e,option:t,onDelete:o},t._id)):(0,r.jsx)(Y.f,{message:s({id:"option",defaultMessage:"Option"})})]})},eF=({productVariationId:e,variation:t})=>{let{formatMessage:a}=(0,n.X)(),{setModal:s}=(0,er.f)(),{options:i}=t,{removeProductVariation:l}=(()=>{let[e]=(0,j.f)(eP);return{removeProductVariation:async({productVariationId:t})=>e({variables:{productVariationId:t},refetchQueries:["ProductVariations"]})}})(),d=async()=>{await s((0,r.jsx)(ei.f,{onCancelClick:async()=>s(""),message:a({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()=>{s(""),await l({productVariationId:e}),B.toast.success(a({id:"product_variation_deleted",defaultMessage:"Variation deleted successfully"}))},okText:a({id:"delete_product_variation",defaultMessage:"Delete variation"})}))},o=[{header:(0,r.jsx)(eE,{onDelete:d,variation:t,...t}),body:(0,r.jsx)(eL,{variationId:t._id,options:i},e)}];return(0,r.jsx)(eM.f,{"data-variationid":t._id,data:o,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})},eB=({onSubmit:e,disabled:t,formatMessage:a})=>{let{variationTypes:s}=(()=>{let{data:e,loading:t,error:a}=(0,v.f)(ew);return{variationTypes:e?.variationTypes?.options||[],loading:t,error:a}})(),{hasRole:i}=(0,o.f)(),l=a({id:"product_variation_added",defaultMessage:"Product variation added successfully"}),n=(0,g.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:a({id:"product_variations_explanation_title",defaultMessage:"About Product Variations"})}),(0,r.jsx)("p",{className:"text-sm text-text-secondary",children:a({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)(f.f,{form:n,children:[(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(eN,{name:"title",id:"title",label:a({id:"title",defaultMessage:"Title"}),helpText:a({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)(eN,{name:"key",id:"key",label:a({id:"key",defaultMessage:"Key"}),helpText:a({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)(C.f,{required:!0,className:"w-full",label:a({id:"type",defaultMessage:"Type"}),placeholder:a({id:"type",defaultMessage:"Type"}),name:"type",options:(0,_.f)(s,"value","value")}),(0,r.jsx)(U.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)(x.f,{label:a({id:"add_variation",defaultMessage:"Add variation"})})})]})]})};e.s(["f",0,({productId:e,disabled:t=!1})=>{let{createProductVariation:a}=(()=>{let[e]=(0,j.f)(eb);return{createProductVariation:async({productId:t,variation:{key:a,type:s},texts:i})=>e({variables:{productId:t,variation:{key:a,type:s},texts:i},refetchQueries:["ProductVariations"]})}})(),{selectedLocale:s}=(0,L.f)(),{formatMessage:i}=(0,n.X)(),{setModal:l}=(0,er.f)(),{variations:d,loading:o}=(({productId:e=null,slug:t=null,locale:a=null}={})=>{let s=(0,H.Q)(t),{data:i,loading:l,error:r}=(0,v.f)(ej,{skip:!e&&!s,variables:{productId:e||s,locale:a}}),d=i?.product;return{variations:d?.variations,loading:l,error:r}})({productId:e,locale:s}),c=async({title:t,key:i,type:r})=>(await a({productId:e,variation:{key:i,type:r},texts:[{title:t,locale:s}]}),l(""),{success:!0});return o?(0,r.jsx)(ev.f,{variant:"list"}):(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)($.f,{className:"m-1",onClick:()=>{l((0,r.jsx)(eB,{onSubmit:c,disabled:t,formatMessage:i}))},disabled:t,variant:"secondary",icon:(0,r.jsx)(eh.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)(eF,{productVariationId:e._id,variation:e},e._id)):(0,r.jsx)(Y.f,{message:i({id:"variations",defaultMessage:"Variations"})})})]})}],77035);let eQ=h.a`
|
|
451
|
+
query ProductWarehousing($productId: ID, $slug: String) {
|
|
452
|
+
product(productId: $productId, slug: $slug) {
|
|
453
|
+
_id
|
|
454
|
+
... on SimpleProduct {
|
|
455
|
+
sku
|
|
456
|
+
baseUnit
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
`,ez=h.a`
|
|
461
|
+
mutation UpdateProductWarehousing(
|
|
462
|
+
$productId: ID!
|
|
463
|
+
$warehousing: UpdateProductWarehousingInput!
|
|
464
|
+
) {
|
|
465
|
+
updateProductWarehousing(productId: $productId, warehousing: $warehousing) {
|
|
466
|
+
_id
|
|
467
|
+
... on SimpleProduct {
|
|
468
|
+
sku
|
|
469
|
+
baseUnit
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
`;e.s(["f",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,n.X)(),{product:i}=(({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{data:s,loading:i,error:l}=(0,v.f)(eQ,{skip:!e&&!a,variables:{productId:e||a}});return{product:s?.product||{},loading:i,error:l}})({productId:e}),{hasRole:l}=(0,o.f)(),{updateProductWarehousing:u}=(()=>{let[e]=(0,j.f)(ez);return{updateProductWarehousing:async({productId:t,warehousing:{sku:a=null,baseUnit:s=null}})=>e({variables:{productId:t,warehousing:{sku:a,baseUnit:s}},refetchQueries:["Products"]})}})(),m=s({id:"saved",defaultMessage:"Saved"}),p=async({sku:t,baseUnit:a})=>({data:await u({productId:e,warehousing:{baseUnit:a,sku:t}}),success:!0}),h=(0,g.f)({disabled:a,submit:p,successMessage:m,initialValues:{sku:"",baseUnit:""}});return(0,t.useEffect)(()=>{Object.keys(i).length&&h.api.setValues({...i})},[i]),(0,r.jsx)("div",{className:"mt-5 md:mt-0",children:(0,r.jsx)(c.U,{children:(0,r.jsxs)(f.f,{className:"rounded",form:h,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)(k.f,{name:"sku",disabled:!l(d.C.ManageProducts),id:"sku",label:s({id:"sku",defaultMessage:"SKU"}),className:"mb-4 text-sm"}),(0,r.jsx)(k.f,{name:"baseUnit",id:"baseUnit",disabled:!l(d.C.ManageProducts),label:s({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)(x.f,{label:s({id:"save",defaultMessage:"Save"})})})]})})})}],56902);var eX=e.i(56417),eK=e.i(27028),eW=e.i(3883),eZ=e.i(84818);let eH=h.a`
|
|
474
|
+
query ProductFulfillmentSimulation(
|
|
475
|
+
$productId: ID
|
|
476
|
+
$deliveryProviderType: DeliveryProviderType
|
|
477
|
+
$quantity: Int
|
|
478
|
+
$referenceDate: Timestamp
|
|
479
|
+
) {
|
|
480
|
+
product(productId: $productId) {
|
|
481
|
+
_id
|
|
482
|
+
... on SimpleProduct {
|
|
483
|
+
simulatedDispatches(
|
|
484
|
+
deliveryProviderType: $deliveryProviderType
|
|
485
|
+
quantity: $quantity
|
|
486
|
+
referenceDate: $referenceDate
|
|
487
|
+
) {
|
|
488
|
+
shipping
|
|
489
|
+
earliestDelivery
|
|
490
|
+
deliveryProvider {
|
|
491
|
+
_id
|
|
492
|
+
type
|
|
493
|
+
isActive
|
|
494
|
+
interface {
|
|
495
|
+
_id
|
|
496
|
+
label
|
|
497
|
+
version
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
warehousingProvider {
|
|
501
|
+
_id
|
|
502
|
+
type
|
|
503
|
+
isActive
|
|
504
|
+
interface {
|
|
505
|
+
_id
|
|
506
|
+
label
|
|
507
|
+
version
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
simulatedStocks(
|
|
512
|
+
deliveryProviderType: $deliveryProviderType
|
|
513
|
+
referenceDate: $referenceDate
|
|
514
|
+
) {
|
|
515
|
+
quantity
|
|
516
|
+
deliveryProvider {
|
|
517
|
+
_id
|
|
518
|
+
type
|
|
519
|
+
interface {
|
|
520
|
+
_id
|
|
521
|
+
label
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
warehousingProvider {
|
|
525
|
+
_id
|
|
526
|
+
interface {
|
|
527
|
+
_id
|
|
528
|
+
label
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
`,eG=(e,t)=>e?.deliveryProvider?._id===t?.deliveryProvider?._id&&e?.warehousingProvider?._id===t?.warehousingProvider?._id,eJ="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",eY=e=>[e?.interface?.label,e?.interface?.version].filter(Boolean).join(" ")||e?._id||null;e.s(["f",0,({productId:e})=>{let{formatMessage:a}=(0,n.X)(),{formatDateTime:s}=(0,eZ.f)(),[i,l]=(0,t.useState)(1),[o,c]=(0,t.useState)(null),[u,m]=(0,t.useState)(""),{dispatches:f,unroutedStocks:p,loading:x,error:g}=(({productId:e,deliveryProviderType:a=null,quantity:s=null,referenceDate:i=null})=>{let{data:l,loading:r,error:d}=(0,v.f)(eH,{skip:!e,variables:{productId:e,deliveryProviderType:a,quantity:s,referenceDate:i},errorPolicy:"all"}),{dispatches:n,unroutedStocks:o}=(0,t.useMemo)(()=>{let e=l?.product||{},t=(e?.simulatedDispatches||[]).filter(e=>!a||e?.deliveryProvider?.type===a),s=(e?.simulatedStocks||[]).filter(e=>!a||!e?.deliveryProvider?.type||e?.deliveryProvider?.type===a);return{dispatches:t.map(e=>({...e,stockQuantity:s.find(t=>eG(t,e))?.quantity??null})),unroutedStocks:s.filter(e=>!t.some(t=>eG(e,t)))}},[l,a]);return{dispatches:n,unroutedStocks:o,loading:r,error:d}})({productId:e,quantity:i,referenceDate:o?new Date(o).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)(U.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:a({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:eJ})]}),(0,r.jsx)(eW.f,{id:"simulation-reference-date",label:a({id:"simulate_as_of",defaultMessage:"Simulate as of"}),value:o,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:a({id:"delivery_type",defaultMessage:"Delivery type"})}),(0,r.jsxs)("select",{id:"simulation-delivery-type",value:u,onChange:e=>m(e.target.value),className:eJ,children:[(0,r.jsx)("option",{value:"",children:a({id:"all_types",defaultMessage:"All types"})}),Object.values(d.F).map(e=>(0,r.jsx)("option",{value:e,children:a({id:e,defaultMessage:e,description:"Delivery provider type"})},e))]})]})]}),x?(0,r.jsx)(ev.f,{variant:"list"}):!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)(eX.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:eY(e?.deliveryProvider)||a({id:"unknown_delivery_provider",defaultMessage:"Unknown delivery provider"})})]}),e?.deliveryProvider?.type&&(0,r.jsx)(e_.f,{text:a({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:a({id:"warehouse",defaultMessage:"Warehouse"})}),(0,r.jsxs)("dd",{className:"flex items-center gap-1 text-text-primary truncate",children:[(0,r.jsx)(eK.f,{className:"h-4 w-4 shrink-0 text-text-muted"}),eY(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:a({id:"ships",defaultMessage:"Ships"})}),(0,r.jsx)("dd",{className:"text-text-primary",children:s(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:a({id:"earliest_delivery",defaultMessage:"Earliest delivery"})}),(0,r.jsx)("dd",{className:"text-text-primary",children:s(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:a({id:"stock",defaultMessage:"Stock"})}),(0,r.jsx)("dd",{className:"font-semibold text-text-primary",children:a({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:a({id:"stock_without_dispatch_route",defaultMessage:"Stock without a dispatch route"})}),(0,r.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:a({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:[eY(e?.warehousingProvider)||"n/a",e?.deliveryProvider&&` — ${eY(e.deliveryProvider)}`]}),(0,r.jsx)("span",{className:"font-semibold text-text-primary",children:a({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)(Y.f,{message:a({id:"dispatch_routes",defaultMessage:"dispatch routes"}),Icon:(0,r.jsx)(eX.f,{className:"h-6 w-6"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-text-muted",children:a({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:[a({id:"fulfillment_simulation_error",defaultMessage:"Fulfillment simulation failed"}),": ",g.message]})]})}],72264);var e0=d;let e1=h.a`
|
|
536
|
+
fragment ProductReviewDetailFragment on ProductReview {
|
|
537
|
+
_id
|
|
538
|
+
created
|
|
539
|
+
updated
|
|
540
|
+
deleted
|
|
541
|
+
author {
|
|
542
|
+
_id
|
|
543
|
+
username
|
|
544
|
+
name
|
|
545
|
+
profile {
|
|
546
|
+
displayName
|
|
547
|
+
address {
|
|
548
|
+
firstName
|
|
549
|
+
lastName
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
isGuest
|
|
553
|
+
avatar {
|
|
554
|
+
_id
|
|
555
|
+
|
|
556
|
+
url
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
product {
|
|
560
|
+
_id
|
|
561
|
+
texts(forceLocale: $forceLocale) {
|
|
562
|
+
_id
|
|
563
|
+
title
|
|
564
|
+
subtitle
|
|
565
|
+
}
|
|
566
|
+
media {
|
|
567
|
+
_id
|
|
568
|
+
file {
|
|
569
|
+
_id
|
|
570
|
+
url
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
rating
|
|
575
|
+
title
|
|
576
|
+
review
|
|
577
|
+
upVote: voteCount(type: UPVOTE)
|
|
578
|
+
downVote: voteCount(type: DOWNVOTE)
|
|
579
|
+
voteReport: voteCount(type: REPORT)
|
|
580
|
+
ownVotes {
|
|
581
|
+
timestamp
|
|
582
|
+
type
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
`,e5=h.a`
|
|
586
|
+
query ProductReviewByProduct(
|
|
587
|
+
$productId: ID
|
|
588
|
+
$slug: String
|
|
589
|
+
$limit: Int
|
|
590
|
+
$offset: Int
|
|
591
|
+
$sort: [SortOptionInput!]
|
|
592
|
+
$forceLocale: Locale
|
|
593
|
+
) {
|
|
594
|
+
product(productId: $productId, slug: $slug) {
|
|
595
|
+
_id
|
|
596
|
+
reviews(limit: $limit, offset: $offset, sort: $sort) {
|
|
597
|
+
...ProductReviewDetailFragment
|
|
598
|
+
}
|
|
599
|
+
reviewsCount
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
${e1}
|
|
603
|
+
`;var e2=e.i(66859),e3=e.i(39833),e4=e.i(84339);let e6=t.forwardRef(function({title:e,titleId:a,...s},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":a},s),e?t.createElement("title",{id:a},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"}))}),e9=({productReviews:e})=>{let{formatMessage:t}=(0,n.X)(),a=e.reduce((e,t)=>e+t.upVote,0),s=e.reduce((e,t)=>e+t.downVote,0),i=a?a/(a+s)*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)(e6,{className:`
|
|
604
|
+
${t?"text-amber-400":"text-slate-300 dark:text-slate-600"}
|
|
605
|
+
h-5 w-5 shrink-0
|
|
606
|
+
`,"aria-hidden":"true"},e)})})}),(0,r.jsx)("div",{className:"ml-2 text-sm",children:(0,r.jsx)(n.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:a}),(0,r.jsxs)("div",{"aria-hidden":"true",className:"ml-2 flex flex-1 items-center",children:[(0,r.jsx)(e4.f,{className:`
|
|
607
|
+
${a>0?"text-emerald-500":"text-slate-500"}
|
|
608
|
+
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"}),a>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:[s,(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)(e3.f,{className:`
|
|
609
|
+
${s>0?"text-rose-500":"text-slate-500"}
|
|
610
|
+
h-5 w-5 shrink-0
|
|
611
|
+
`,"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-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 e7=e.i(87213);let e8=({onSubmit:e,onSubmitSuccess:t=null,defaultValue:a={},isEdit:s=!1})=>{let{formatMessage:i}=(0,n.X)(),{hasRole:l}=(0,o.f)(),c=i({id:"product_review_added",defaultMessage:"Review added successfully!"}),u=i({id:"product_review_updated",defaultMessage:"Review updated successfully!"}),m=(0,g.f)({submit:e,onSubmitSuccess:t,successMessage:s?u:c,initialValues:{title:"",review:"",rating:1,...a}});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)(f.f,{form:m,children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(k.f,{name:"title",disabled:!l(d.C.ReviewProduct),id:"title",label:i({id:"title",defaultMessage:"Title"}),autoComplete:"off",required:!0}),(0,r.jsx)(e7.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)(x.f,{label:i(s?{id:"update_review",defaultMessage:"Update Review"}:{id:"add_review",defaultMessage:"Add Review"}),className:"px-6 py-2"})})]})]})},te=h.a`
|
|
612
|
+
mutation CreateProductReview(
|
|
613
|
+
$productId: ID!
|
|
614
|
+
$productReview: ProductReviewInput!
|
|
615
|
+
$forceLocale: Locale
|
|
616
|
+
) {
|
|
617
|
+
createProductReview(productId: $productId, productReview: $productReview) {
|
|
618
|
+
_id
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
`;e.s(["f",0,({productId:e})=>{let{productReviews:t,loadMore:a,reviewsCount:s}=(({productId:e=null,slug:t=null,limit:a=10,offset:s=0,sort:i=[{key:"created",value:e0.B.Desc}]}={})=>{let{selectedLocale:l}=(0,L.f)(),{data:r,loading:d,error:n,fetchMore:o}=(0,v.f)(e5,{skip:!e,variables:{productId:e,slug:t,limit:a,offset:s,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,j.f)(te);return{createProductReview:async({productId:t,productReview:{title:a,rating:s,review:i}})=>e({variables:{productId:t,productReview:{title:a,rating:s,review:i}},refetchQueries:["ProductReviewByProduct","ProductReviewByUser"]})}})(),{formatMessage:l}=(0,n.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)(e9,{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)(e8,{onSubmit:async({title:t,review:a,rating:s})=>await i({productId:e,productReview:{title:t,review:a,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)(e2.f,{review:e},e._id))})})]})]})}),s>t?.length?(0,r.jsx)($.f,{text:l({id:"load-more-reviews",defaultMessage:"Load reviews"}),onClick:a}):null]})}],19051);var tt=e.i(47542);let ta=h.a`
|
|
622
|
+
mutation CreateProductBundleItem(
|
|
623
|
+
$productId: ID!
|
|
624
|
+
$item: CreateProductBundleItemInput!
|
|
625
|
+
) {
|
|
626
|
+
createProductBundleItem(productId: $productId, item: $item) {
|
|
627
|
+
_id
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
`;var ts=e.i(24112),ti=e.i(5270);let tl={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"]};tl.node;let tr=(0,ti.f)(tl);var td=e.i(38994);let tn=function({onSuccess:e}){let{selectedLocale:t}=(0,L.f)(),{createProduct:a}=(0,td.f)(),{formatMessage:s}=(0,n.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 a({product:{type:l||d.f.SimpleProduct},texts:n}),c=o?.createProduct;if(!c?._id)throw Error(s({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return e?.(c,r),{success:!0}}},to=({bundleProduct:e,onSuccess:a})=>{let{formatMessage:s}=(0,n.X)(),{hasRole:i}=(0,o.f)(),l=tn({onSuccess:a}),c=(0,t.useMemo)(()=>{let t=e?.texts?.title??"";return`${t} - New Bundle Item`},[e]),u=async({title:e,type:t,quantity:a})=>{try{return await l({title:e,type:t,quantity:a}),{success:!0}}catch(e){return{success:!1,error:{message:e?.message}}}},m=s({id:"bundle-item-scaffolded-success",defaultMessage:"New product scaffolded and added to bundle successfully"}),p=(0,g.f)({submit:u,successMessage:m,enableReinitialize:!0,initialValues:{title:c,type:d.f.SimpleProduct,quantity:1}});return(0,r.jsxs)(f.f,{className:"mt-4 rounded-md border border-border-subtle",form:p,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:s({id:"scaffold_bundle_item_title",defaultMessage:"Scaffold New Bundle Item"})}),(0,r.jsx)(k.f,{name:"title",id:"title",label:s({id:"name",defaultMessage:"Name"}),required:!0,className:"block w-full rounded-md border-border-default text-sm"}),(0,r.jsx)(C.f,{className:"mt-1 w-full",label:s({id:"type",defaultMessage:"Type"}),placeholder:s({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)(k.f,{name:"quantity",type:"number",required:!0,label:s({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)(x.f,{label:s({id:"scaffold_and_add",defaultMessage:"Scaffold & Add"})})})]})},tc=({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{customProperties:s,hydrateFragment:i}=(0,D.f)(),{data:l,loading:r,error:d}=(0,v.f)(((e="")=>h.a`
|
|
631
|
+
query Product($productId: ID, $slug: String) {
|
|
632
|
+
product(productId: $productId, slug: $slug) {
|
|
633
|
+
...ProductDetailFragment
|
|
634
|
+
${e}
|
|
635
|
+
texts {
|
|
636
|
+
_id
|
|
637
|
+
title
|
|
638
|
+
subtitle
|
|
639
|
+
description
|
|
640
|
+
}
|
|
641
|
+
... on SimpleProduct {
|
|
642
|
+
texts {
|
|
643
|
+
_id
|
|
644
|
+
title
|
|
645
|
+
subtitle
|
|
646
|
+
description
|
|
647
|
+
}
|
|
648
|
+
proxies {
|
|
649
|
+
__typename
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
... on ConfigurableProduct {
|
|
653
|
+
texts {
|
|
654
|
+
_id
|
|
655
|
+
title
|
|
656
|
+
subtitle
|
|
657
|
+
description
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
... on PlanProduct {
|
|
661
|
+
texts {
|
|
662
|
+
_id
|
|
663
|
+
title
|
|
664
|
+
subtitle
|
|
665
|
+
description
|
|
666
|
+
}
|
|
667
|
+
proxies {
|
|
668
|
+
__typename
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
... on BundleProduct {
|
|
672
|
+
texts {
|
|
673
|
+
_id
|
|
674
|
+
title
|
|
675
|
+
subtitle
|
|
676
|
+
description
|
|
677
|
+
}
|
|
678
|
+
proxies {
|
|
679
|
+
__typename
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
${w.f}
|
|
685
|
+
`)(s?.Product),{skip:!e&&!a,variables:{productId:e||a}}),n=i(s?.Product,l?.product);return{product:l?.product,loading:r,error:d,extendedData:n}};e.s(["f",0,tc],84278);let tu=({productId:e,disabled:a=!1})=>{let{product:s}=tc({productId:e}),{setModal:i}=(0,er.f)(),[l,c]=(0,t.useState)(""),{createProductBundleItem:u}=(()=>{let[e]=(0,j.f)(ta);return{createProductBundleItem:async({productId:t,item:a})=>e({variables:{productId:t,item:a},refetchQueries:["ProductBundleItems"]})}})(),{hasRole:m}=(0,o.f)(),{formatMessage:p}=(0,n.X)(),{products:h,loading:v}=(0,ts.f)({queryString:l,includeDrafts:!0,limit:50,sort:[{key:"created",value:d.B.Desc}]}),b=async({productId:t,quantity:a})=>(await u({item:{productId:t,quantity:a},productId:e}),{success:!0}),y=p({id:"bundle_item_added",defaultMessage:"Bundle product added successfully"}),w=(0,g.f)({disabled:a,submit:b,successMessage:y,onSubmitSuccess:()=>(w.api.resetForm(),null),initialValues:{productId:"",quantity:1}}),N=(0,t.useCallback)(async()=>{await i((0,r.jsx)(to,{bundleProduct:s,onSuccess:async(t,a=1)=>{await u({item:{productId:t._id,quantity:a},productId:e}),i("")}}))},[s]);return(0,r.jsxs)(f.f,{form:w,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)(tt.f,{name:"productId",onFilter:c,queryString:l,label:p({id:"product",defaultMessage:"Product"}),data:((e=[])=>e.map(({_id:e,status:t,texts:a,media:s})=>({id:e,tag:t,...a,image:s?.length?s[0]?.file?.url:null})))(h),isLoading:v,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)($.f,{className:"flex items-center justify-center p-2 rounded-md",onClick:N,children:(0,r.jsx)(tr,{className:"h-5 w-5"})})})]}),(0,r.jsx)(k.f,{name:"quantity",type:"number",required:!0,label:p({id:"quantity",defaultMessage:"Quantity"})}),m(d.C.ManageProducts)&&(0,r.jsx)(x.f,{label:p({id:"submit",defaultMessage:"Submit"}),className:"mt-2"})]})};var tm=e.i(54529);let tf=h.a`
|
|
686
|
+
query ProductBundleItems(
|
|
687
|
+
$productId: ID
|
|
688
|
+
$slug: String
|
|
689
|
+
$forceLocale: Locale
|
|
690
|
+
) {
|
|
691
|
+
product(productId: $productId, slug: $slug) {
|
|
692
|
+
_id
|
|
693
|
+
... on BundleProduct {
|
|
694
|
+
bundleItems {
|
|
695
|
+
product {
|
|
696
|
+
...ProductBriefFragment
|
|
697
|
+
}
|
|
698
|
+
quantity
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
${tm.f}
|
|
704
|
+
`,tp=h.a`
|
|
705
|
+
mutation RemoveBundleItem($productId: ID!, $index: Int!) {
|
|
706
|
+
removeBundleItem(productId: $productId, index: $index) {
|
|
707
|
+
_id
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
`;var tx=e.i(41158),tg=e.i(87284),th=e.i(76069);let tv=({item:e,onDelete:t,index:a})=>{let{product:s,quantity:i}=e;return(0,r.jsx)(tx.default,{href:`/products?slug=${(0,H.U)(s)}`,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:[s.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)(tg.f,{className:"mx-auto w-auto",src:s.media[0]?.file?.url,width:160,height:100,alt:s?.texts?.title||s?.texts?.subtitle})})}):(0,r.jsx)(th.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:s?.texts?.title}),(0,r.jsx)("p",{className:"text-xs text-slate-600 dark:text-slate-200",children:s?.texts?.subtitle})]}),(0,r.jsx)("div",{className:"ml-auto",children:(0,r.jsx)(e_.f,{text:i,color:"slate",square:!0})})]}),(0,r.jsx)(eO.f,{onDelete:()=>{t(a)},showDelete:!0})]})})},tb=({productId:e})=>{let{formatMessage:t}=(0,n.X)(),{setModal:a}=(0,er.f)(),{selectedLocale:s}=(0,L.f)(),{bundleItems:i,loading:l}=(({productId:e=null,slug:t=null}={})=>{let{selectedLocale:a}=(0,L.f)(),s=(0,H.Q)(t),{data:i,loading:l,error:r}=(0,v.f)(tf,{skip:!e&&!s,variables:{productId:e||s,forceLocale:a},context:{headers:{forceLocale:a}}});return{bundleItems:i?.product?.bundleItems||[],loading:l,error:r}})({productId:e,forceLocale:s}),{removeBundleItem:d}=(()=>{let[e]=(0,j.f)(tp);return{removeBundleItem:async({productId:t,index:a})=>e({variables:{productId:t,index:a},refetchQueries:["ProductBundleItems"]})}})(),o=async s=>{await a((0,r.jsx)(ei.f,{onCancelClick:async()=>a(""),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()=>{a(""),await d({productId:e,index:s}),B.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)(ev.f,{variant:"list"}):i.length?(0,r.jsx)(r.Fragment,{children:i.map((e,t)=>(0,r.jsx)(tv,{index:t,item:e,onDelete:o},e.product._id))}):(0,r.jsx)(Y.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)(tu,{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)(tb,{productId:e})})})]})})],11907)}]);
|