PageSourceSearch

https://manage.wrappedgiftcards.com/assets/StoreCreditSettingsPage-Cwxqp9Vn.js

js wrappedgiftcards.com collected 2026-10-05 06:34:09 UTC 8,973 bytes, 1 lines download raw bytes

1import{c as N,r as n,V as l,j as e}from"./index-DygRWEw_.js";import{S as y}from"./StoreCreditProgramService-DQPV_GYO.js";import{S as d}from"./StoreCreditExpiryType-BD_JQS92.js";import{S}from"./StoreCreditUpsellComponent-Ee_X99y2.js";import{S as E}from"./SettingsBreadcrumb-B5FIk2cQ.js";import{C}from"./CopyButton-5GvyjI4P.js";import"./SparklesIcon-CDUROoqv.js";import"./CurrencyDollarIcon-D2nsafOI.js";import"./ShieldCheckIcon-BNtXAXm0.js";import"./CheckCircleIcon-CrJ1r7C0.js";import"./ChevronLeftIcon-D2z52xRD.js";import"./ClipboardDocumentCheckIcon-DVGFZR-I.js";import"./ClipboardDocumentIcon-B4LVcmkC.js";function _(){var p,u,h;const r=N(),o=(p=r==null?void 0:r.profile)==null?void 0:p.isStoreCreditEnabled,f=((u=r==null?void 0:r.profile)==null?void 0:u.userRole)==="Owner"||((h=r==null?void 0:r.profile)==null?void 0:h.userRole)==="Admin",[s,c]=n.useState({defaultExpiryType:d.NONE,defaultExpiresInNumDays:365,allowPerTransactionExpiryOverride:!0,sendExpiryReminders:!0,expiryReminderDaysBefore:14}),[b,x]=n.useState(!0),[m,g]=n.useState(!1);n.useEffect(()=>{if(document.title="Wrapped | Store Credit Settings",!o){x(!1);return}y.storeCreditProgramSettingsGet().then(t=>{t&&c(t)}).catch(()=>l.error("Could not load settings.")).finally(()=>x(!1))},[o]);const j=async()=>{g(!0);try{const t=await y.storeCreditProgramSaveSettingsPost(s);t.isSuccessful?l.success("Settings saved"):l.error(t.message??"Could not save settings.")}catch{l.error("Could not save settings.")}finally{g(!1)}},a=(t,v)=>c(k=>({...k,[t]:v})),i="block w-full rounded-md border-0 py-1.5 px-3 text-gray-900 dark:text-gray-100 dark:bg-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-700 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm";return o?e.jsx(e.Fragment,{children:e.jsx("div",{className:"py-6 min-h-screen w-full bg-transparent dark:bg-gray-900",children:e.jsxs("div",{className:"px-4 sm:px-6 lg:px-8 max-w-2xl",children:[e.jsx(E,{currentPage:"Store credit"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mt-2 mb-6",children:"Store credit settings"}),b?e.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading settings..."}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm rounded-lg px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"When credit expires"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Store credit expires per transaction, not per customer. Each amount you issue has its own life, and when a customer spends, the credit closest to expiring is used first."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Default"}),e.jsxs("select",{value:s.defaultExpiryType,onChange:t=>a("defaultExpiryType",t.target.value),className:`${i} mt-1`,children:[e.jsx("option",{value:d.NONE,children:"Credit never expires"}),e.jsx("option",{value:d.DAYS_SINCE_EARNED,children:"Expires a set time after it's issued"})]})]}),s.defaultExpiryType===d.DAYS_SINCE_EARNED&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Lasts for (days)"}),e.jsx("input",{type:"number",step:"1",min:"1",value:s.defaultExpiresInNumDays??0,onChange:t=>a("defaultExpiresInNumDays",Number(t.target.value)),className:`${i} mt-1`}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Applies to credit issued from now on. Credit a customer already has keeps the expiry it was given."})]}),e.jsxs("label",{className:"flex items-start gap-2 text-sm text-gray-700 dark:text-gray-300",children:[e.jsx("input",{type:"checkbox",checked:s.allowPerTransactionExpiryOverride??!1,onChange:t=>a("allowPerTransactionExpiryOverride",t.target.checked),className:"mt-0.5"}),e.jsx("span",{children:"Let staff set a different expiry when issuing credit by hand. Off, everything follows the default above."})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm rounded-lg px-6 py-5 space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"Reminders"}),e.jsxs("label",{className:"flex items-start gap-2 text-sm text-gray-700 dark:text-gray-300",children:[e.jsx("input",{type:"checkbox",checked:s.sendExpiryReminders??!1,onChange:t=>a("sendExpiryReminders",t.target.checked),className:"mt-0.5"}),e.jsx("span",{children:"Email customers before their credit expires"})]}),s.sendExpiryReminders&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Days beforehand"}),e.jsx("input",{type:"number",step:"1",min:"1",value:s.expiryReminderDaysBefore??14,onChange:t=>a("expiryReminderDaysBefore",Number(t.target.value)),className:`${i} mt-1`})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm rounded-lg px-6 py-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"Let customers sign themselves up"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Publishes a page anyone with the link can join through. Put it on a QR card by the till, or in your email footer."})]}),e.jsxs("label",{className:"flex items-start gap-2 text-sm text-gray-700 dark:text-gray-300",children:[e.jsx("input",{type:"checkbox",checked:s.publicSignupEnabled??!1,onChange:t=>a("publicSignupEnabled",t.target.checked),className:"mt-0.5"}),e.jsx("span",{children:"Turn the signup page on"})]}),s.publicSignupEnabled&&e.jsxs(e.Fragment,{children:[s.signupUrl&&e.jsx("div",{className:"rounded-md bg-gray-50 px-3 py-2 dark:bg-gray-900/50",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-1 break-all font-mono text-sm text-gray-900 dark:text-gray-200",children:s.signupUrl}),e.jsx(C,{value:s.signupUrl,label:"Link"}),e.jsx("a",{href:s.signupUrl,target:"_blank",rel:"noreferrer",className:"flex-none text-sm font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400",children:"Preview"})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Credit for joining"}),e.jsx("input",{type:"number",step:"0.01",min:"0",value:s.welcomeCreditAmount??0,onChange:t=>a("welcomeCreditAmount",Number(t.target.value)),className:`${i} mt-1`}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Paid once they confirm their email, not when they submit the form. Leave at 0 for no joining bonus."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Look"}),e.jsxs("select",{value:s.signupPageTheme??"dark",onChange:t=>a("signupPageTheme",t.target.value),className:`${i} mt-1`,children:[e.jsx("option",{value:"dark",children:"Dark"}),e.jsx("option",{value:"light",children:"Light"})]}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Your logo and brand colour are used either way."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Headline"}),e.jsx("input",{type:"text",value:s.signupPageTitle??"",onChange:t=>a("signupPageTitle",t.target.value),placeholder:"Join us",className:`${i} mt-1`})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Body"}),e.jsx("textarea",{rows:2,value:s.signupPageDescription??"",onChange:t=>a("signupPageDescription",t.target.value),placeholder:"Get a store credit card you can keep in your phone. No app, no password.",className:`${i} mt-1`})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Button"}),e.jsx("input",{type:"text",value:s.signupPageCtaText??"",onChange:t=>a("signupPageCtaText",t.target.value),placeholder:"Get my card",className:`${i} mt-1`})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Welcome message"}),e.jsx("input",{type:"text",value:s.signupPageWelcomeTitle??"",onChange:t=>a("signupPageWelcomeTitle",t.target.value),placeholder:"Welcome, {name}!",className:`${i} mt-1`}),e.jsxs("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[e.jsx("span",{className:"font-mono",children:"{name}"})," is replaced with their first name."]})]})]})]}),e.jsx("div",{className:"flex justify-end pb-10",children:e.jsx("button",{type:"button",onClick:j,disabled:m||!f,className:"rounded-md bg-blue-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-blue-500 disabled:opacity-50",children:m?"Saving...":"Save settings"})})]})]})})}):e.jsx(S,{})}export{_ as default};

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.