PageSourceSearch

https://www.sellpy.se/market/ContainerSubscriptionPage.Cc7hRKJj.bundle.js

js sellpy.se collected 2026-09-24 17:38:10 UTC 11,845 bytes, 25 lines download raw bytes

1var $=Object.defineProperty,A=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var D=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var q=(e,t,n)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h=(e,t)=>{for(var n in t||(t={}))R.call(t,n)&&q(e,n,t[n]);if(D)for(var n of D(t))O.call(t,n)&&q(e,n,t[n]);return e},x=(e,t)=>A(e,_(t));var j=(e,t,n)=>new Promise((f,m)=>{var p=o=>{try{l(n.next(o))}catch(c){m(c)}},y=o=>{try{l(n.throw(o))}catch(c){m(c)}},l=o=>o.done?f(o.value):Promise.resolve(o.value).then(p,y);l((n=n.apply(e,t)).next())});import{j as i,b as V,I as P,P as b,d as W,c as N,A as U,a as B}from"./npm.sellpy-design-system.sUaPRvy7.bundle.js";import{D as L}from"./npm.luxon.3NOFZn7k.bundle.js";import{r as C}from"./npm.react-hook-form.C-gy3V91.bundle.js";import{S as F}from"./react-select.esm.9aFuoZGu.bundle.js";import{b as z}from"./npm.react-router.eGoWS0aR.bundle.js";import{aP as S,as as H,d as Q,ax as G,S as K,al as Y,am as J}from"./index.OKbXaoKY.bundle.js";import{g as X}from"./containerSubscription.query.CfBcmyRR.bundle.js";import{A as Z}from"./AddressDisplay.xGgPUvwI.bundle.js";import{g as ee}from"./npm.styled-components.CXmCnM24.bundle.js";import{h as ne,i as I}from"./npm.apollo-client.D2roezfX.bundle.js";import{u as ie}from"./useContainerPrice.DwKa-x7V.bundle.js";import{z as te}from"./utils.Bj4bPQRb.bundle.js";import{u as k}from"./npm.react-i18next.DBIOEc1H.bundle.js";import{ab as ae,aD as re}from"./npm.sellpy-commons.CqmbWWp3.bundle.js";import"./npm.react-dom.DRhp71ng.bundle.js";import"./objectSpread2.DneueB1Q.bundle.js";import"./npm.i18next.B74d65Th.bundle.js";import"./npm.sentry-react.D1FVWAhI.bundle.js";import"./npm.zod.DEnjmUYT.bundle.js";import"./npm.lodash.B-mb_ip_.bundle.js";import"./npm.parse.B9RAjAGR.bundle.js";import"./npm.swr.CGFXCyXz.bundle.js";import"./npm.algolia.BDObKZ-5.bundle.js";import"./translations.FODGUIZZ.bundle.js";import"./npm.graphql.ClDiDpi3.bundle.js";import"./npm.immutable.3wsaRX37.bundle.js";import"./colorManagement.DjDKmvV5.bundle.js";import"./errors.DbzKVgYe.bundle.js";try{let e=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2d3f08e3-032f-4705-b57c-764bf07a8afa",e._sentryDebugIdIdentifier="sentry-dbid-2d3f08e3-032f-4705-b57c-764bf07a8afa")}catch(e){}{let e=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=Object.assign({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:sellpy-market":!0})}const se=`mutation editContainerSubscription($id: String!, $frequency: String, $amount: Int) {
2  editContainerSubscription(id: $id, frequency: $frequency, amount: $amount) {
3    objectId
4    active
5    amount
6    frequency
7    lastDelivery
8  }
9}
10
11mutation cancelContainerSubscription($id: String!) {
12  cancelSubscription(id: $id) {
13    objectId
14    active
15    amount
16    frequency
17    lastDelivery
18  }
19}
20`,E={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"editContainerSubscription"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"frequency"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"amount"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"editContainerSubscription"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}},{kind:"Argument",name:{kind:"Name",value:"frequency"},value:{kind:"Variable",name:{kind:"Name",value:"frequency"}}},{kind:"Argument",name:{kind:"Name",value:"amount"},value:{kind:"Variable",name:{kind:"Name",value:"amount"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"objectId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"active"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"frequency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastDelivery"},arguments:[],directives:[]}]}}]}},{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"cancelContainerSubscription"}
20,variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancelSubscription"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"objectId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"active"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"frequency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastDelivery"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:432,source:{name:"GraphQL request",locationOffset:{line:1,column:1},body:se}}},T=(e,t)=>{const n=(a,r)=>{if(a.kind==="FragmentSpread")r.add(a.name.value);else if(a.kind==="VariableDefinition"){const s=a.type;s.kind==="NamedType"&&r.add(s.name.value)}return a&&"selectionSet"in a&&a.selectionSet&&a.selectionSet.selections.forEach(s=>{n(s,r)}),a&&"variableDefinitions"in a&&a.variableDefinitions&&a.variableDefinitions.forEach(s=>{n(s,r)}),a&&"definitions"in a&&a.definitions&&a.definitions.forEach(s=>{n(s,r)}),r},f=a=>{const r={};return a.definitions.forEach(function(s){"name"in s&&s.name&&(r[s.name.value]=n(s,new Set))}),r},m=(a,r)=>{for(let s=0;s<a.definitions.length;s++){const d=a.definitions[s];if(d&&"name"in d&&d.name&&d.name.value==r)return d}},p=f(e),y=Object.assign({},e,{definitions:[m(e,t)]}),l=p[t]||new Set,o=new Set;let c=new Set;for(l.forEach(a=>{c.add(a)});c.size>0;){const a=c;c=new Set,a.forEach(r=>{o.has(r)||(o.add(r),(p[r]||new Set).forEach(d=>{c.add(d)}))})}return o.forEach(a=>{const r=m(e,a);r&&y.definitions.push(r)}),y},oe=T(E,"editContainerSubscription"),le=T(E,"cancelContainerSubscription"),ce={top:"flex-start",center:"center",bottom:"flex-end"},de=ee.div`
21  display: flex;
22  margin: 1.5em 0;
23  align-items: ${({position:e})=>e};
24`,ue=({main:e,sub:t,checkmarkPosition:n="center",style:f})=>i.jsxs(de,{position:ce[n],style:h({},f),children:[i.jsx(V,{name:P.CHECKMARK,style:{fontSize:"2rem"}}),i.jsxs("div",{style:{marginLeft:12},children:[i.jsx(b,{design:"body2",noMargin:!0,children:e}),i.jsx(b,{design:"body1",noMargin:!0,children:t})]})]}),He=()=>{const{t:e}=k("containerSubscription");return i.jsx("div",{style:{display:"flex",alignItems:"center",flexDirection:"column",backgroundColor:"#FFF"},children:i.jsxs("div",{style:{maxWidth:"130rem",display:"flex",width:"100%",alignSelf:"center",flexDirection:"column"},children:[i.jsx(W,{design:"h2",style:{margin:"3rem 1rem 1rem 1rem"},children:e("title")}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",flexDirection:"row-reverse"},children:[i.jsx(be,{style:{flex:"1 0 300px",margin:"0.5rem"}}),i.jsx(me,{style:{flex:"3 0 300px",margin:"0.5rem"}})]})]})})},me=({style:e})=>{var d;const{t}=k("containerSubscription"),n=z(),f=(d=H())==null?void 0:d.address,m=Q(),{data:p,loading:y}=ne(X,{variables:{userId:m},skip:!m}),l=G(p==null?void 0:p.containerSubscriptions),o=l&&l.active,c=o?"active":"inactive",a=ie(),r=ae(a||te()),[s]=I(le);return l?i.jsxs(S,{style:e,children:[i.jsx(N,{design:"h4",children:t(`status.${c}`)}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",flexWrap:"wrap"},children:[i.jsx(b,{design:"body3",style:{minWidth:"280px",marginBottom:"1em"},children:t(`statusBody.${c}`,{containerPrice:r})}),o&&i.jsx(U,{onClick:()=>s({variables:{id:l.objectId}}),style:{minWidth:"150px",marginBottom:"1em"},children:t(`toggle.${l.active}`)})]}),o&&i.jsx(b,{design:"body3",children:t("description.compose",{count:l.amount,frequencyString:t(`description.${l.frequency}`)})}),o&&i.jsx(Z,{address:f,buttonMessage:t("changeAddress"),toggle:()=>{n("/profile")},style:{width:"auto"}}),o&&i.jsx(fe,{subscription:l})]}):y?i.jsx(pe,{style:e}):i.jsx(ye,{style:e,containerPrice:r})},M={quarter:{value:"3 month",frequency:{months:3}},halfYear:{value:"6 month",frequency:{months:6}},year:{value:"1 year",frequency:{year:1}}},fe=({subscription:e,style:t})=>{const{t:n}=k("containerSubscription"),[f,m]=C.useState(e.amount),[p,y]=C.useState(e.frequency),[l]=I(oe),o=({fieldName:u,newValue:v})=>{const g=Object.entries(M).find(([,w])=>u==="amount"?w.value===e.frequency:w.value===v)[0];return l({variables:{id:e.objectId,[u]:v}}).then(()=>Y({header:n("toast.header"),body:n("toast.body",{amount:u==="amount"?v:e.amount,frequency:n(`toastMessageFrequency.${g}`)}),type:J.SUCCESS}))},c=v=>j(null,[v],function*({value:u}){m(u);try{yield o({fieldName:"amount",newValue:u})}catch(g){throw m(e.amount),g}}),a=[{label:n("amount.one"),value:1},{label:n("amount.two"),value:2},{label:n("amount.three"),value:3}],r=L.fromISO(e.lastDelivery),s=v=>j(null,[v],function*({value:u}){y(u);try{yield o({fieldName:"frequency",newValue:u})}catch(g){throw y(e.frequency),g}}),d=Object.entries(M).map(([u,v])=>({label:i.jsxs("span",{children:[i.jsx(b,{noMargin:!0,inline:!0,style:{textTransform:"capitalize"},children:n(`frequency.${u}`)})," ",v.value!=="never"&&i.jsxs(b,{noMargin:!0,inline:!0,italic:!0,children:[n("frequency.postfix")," ",r.plus(v.frequency).toLocaleStr
24ing(re.SHORT.FUTURE)]})]}),value:v.value}));return i.jsxs("div",{style:t,children:[i.jsx(b,{design:"body3",children:n("amount.label")}),i.jsx(F,{options:a,defaultValue:a[f-1],onChange:c,disabled:!e.active}),i.jsx(b,{design:"body3",children:n("frequency.label",{count:f})}),i.jsx(F,{options:d,defaultValue:d.find(u=>u.value===p),onChange:s,disabled:!e.active})]})},pe=({style:e})=>i.jsx(S,{style:x(h({},e),{display:"flex",flexDirection:"column"}),children:i.jsx(K,{})}),ye=({style:e,containerPrice:t})=>{const{t:n}=k("containerSubscription");return i.jsxs(S,{style:x(h({},e),{display:"flex",flexDirection:"column"}),children:[i.jsx(N,{design:"h4",children:n("noSubscription.title")}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",flexWrap:"wrap"},children:[i.jsx(b,{design:"body3",style:{minWidth:"280px",marginBottom:"1em"},children:n("noSubscription.sub_v2",{containerPrice:t})}),i.jsx(B,{design:"body3",color:"blue",to:"/order-bag",style:{minWidth:"150px",marginBottom:"1em"},children:n("noSubscription.link")})]})]})},be=({style:e})=>{const{t}=k("containerSubscription");return i.jsxs(S,{style:x(h({},e),{display:"flex",flexDirection:"column"}),children:[i.jsx(N,{design:"h4",center:!0,children:t("infotext.title")}),[...Array(3).keys()].map(n=>i.jsx(ue,{main:t(`infotext.paragraphs.paragraph${n}.main`),sub:t(`infotext.paragraphs.paragraph${n}.sub`),style:{margin:"0.75rem 0"}},`subscriptionInfo${n}`))]})};export{He as default};
25//# sourceMappingURL=ContainerSubscriptionPage.Cc7hRKJj.bundle.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.