monicka-booking 0.2.0__tar.gz → 0.2.2__tar.gz

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.
Files changed (46) hide show
  1. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/CHANGELOG.md +11 -0
  2. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/MANIFEST.in +1 -1
  3. {monicka_booking-0.2.0/src/monicka_booking.egg-info → monicka_booking-0.2.2}/PKG-INFO +1 -1
  4. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/pyproject.toml +1 -1
  5. monicka_booking-0.2.2/src/monicka_booking/__init__.py +1 -0
  6. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/client.py +2 -0
  7. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/static/monicka_booking/booking.css +2 -0
  8. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/static/monicka_booking/booking.js +5 -4
  9. monicka_booking-0.2.2/src/monicka_booking/static/monicka_booking/therapist-placeholder.svg +18 -0
  10. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/booking.html +1 -1
  11. {monicka_booking-0.2.0 → monicka_booking-0.2.2/src/monicka_booking.egg-info}/PKG-INFO +1 -1
  12. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/tests/test_plugin.py +16 -0
  13. monicka_booking-0.2.0/src/monicka_booking/__init__.py +0 -1
  14. monicka_booking-0.2.0/src/monicka_booking/static/monicka_booking/therapist-placeholder.svg +0 -13
  15. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/README.md +0 -0
  16. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/setup.cfg +0 -0
  17. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/admin.py +0 -0
  18. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/apps.py +0 -0
  19. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/migrations/0001_initial.py +0 -0
  20. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/migrations/0002_alter_bookingwidgetconfig_currency_label.py +0 -0
  21. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/migrations/0003_alter_bookingwidgetconfig_theme.py +0 -0
  22. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/migrations/__init__.py +0 -0
  23. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/models.py +0 -0
  24. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/static/monicka_booking/assessment.js +0 -0
  25. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/static/monicka_booking/fonts/OFL.txt +0 -0
  26. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/static/monicka_booking/fonts/Vazirmatn-Bold.ttf +0 -0
  27. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/static/monicka_booking/fonts/Vazirmatn-Regular.ttf +0 -0
  28. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/static/monicka_booking/fonts/Vazirmatn-SemiBold.ttf +0 -0
  29. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/static/monicka_booking/monicka-logo.png +0 -0
  30. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/assessment_access.html +0 -0
  31. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/assessment_complete.html +0 -0
  32. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/assessment_form.html +0 -0
  33. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/assessments.html +0 -0
  34. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/base.html +0 -0
  35. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/complete.html +0 -0
  36. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/error.html +0 -0
  37. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/gateway.html +0 -0
  38. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/host_layout.html +0 -0
  39. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/templates/monicka_booking/standalone.html +0 -0
  40. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/urls.py +0 -0
  41. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking/views.py +0 -0
  42. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking.egg-info/SOURCES.txt +0 -0
  43. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking.egg-info/dependency_links.txt +0 -0
  44. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking.egg-info/requires.txt +0 -0
  45. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/src/monicka_booking.egg-info/top_level.txt +0 -0
  46. {monicka_booking-0.2.0 → monicka_booking-0.2.2}/tests/test_booking_quality.py +0 -0
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2 — 2026-11-26
4
+
5
+ - Improve the therapist placeholder and mute upcoming steps in the Tolue Noor theme.
6
+ - Display Persian numerals for appointment durations and calendar dates, and show only the selected month's dates in the calendar.
7
+ - Add a backward arrow to the change-therapist button.
8
+ - Ensure fonts and SVG assets are included in source distributions.
9
+
10
+ ## 0.2.1 — 2026-11-26
11
+
12
+ - Treat unexpected non-object catalog responses as an upstream error, showing the existing unavailable state instead of failing with an exception.
13
+
3
14
  ## 0.2.0 — 2026-11-07
4
15
 
5
16
  - Add an opt-in Tolue Noor theme with patterned therapist cards and a direct-booking profile, using the host site's `pattern.webp` static asset.
@@ -1,5 +1,5 @@
1
1
  recursive-include src/monicka_booking/templates *.html
2
- recursive-include src/monicka_booking/static *.css *.js *.png
2
+ recursive-include src/monicka_booking/static *.css *.js *.png *.svg *.ttf *.txt
3
3
  recursive-include src/monicka_booking/migrations *.py
4
4
 
5
5
  include CHANGELOG.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monicka-booking
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Accessible Persian clinic booking pages for Monicka API
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "monicka-booking"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "Accessible Persian clinic booking pages for Monicka API"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -0,0 +1 @@
1
+ __version__ = "0.2.1"
@@ -45,6 +45,8 @@ class MonickaAPIClient:
45
45
 
46
46
  def catalog(self):
47
47
  data = self._request("GET", "/api/plugin/catalog/")
48
+ if not isinstance(data, dict):
49
+ raise MonickaAPIError(reason="invalid_catalog")
48
50
  if data.get("home_clinic_id") != self.config.primary_clinic_id:
49
51
  raise MonickaAPIError(reason="primary_clinic_id_mismatch")
50
52
  return data
@@ -12,6 +12,8 @@
12
12
  .monicka-booking .page-heading{width:auto;margin:0;background:transparent;color:var(--ink);overflow:visible;font-family:inherit}
13
13
  .monicka-booking .support{display:block;width:auto;min-height:0;margin:0;background:transparent;color:var(--ink);overflow:visible}
14
14
  .monicka-booking.theme-toluenoor{--page:#fff;--surface:#fff;--ink:#243e32;--accent:#325343;--soft:#eaf4ed;--border:#d8e3db}
15
+ .monicka-booking.theme-toluenoor .steps li.current~li{color:#737b77;border-color:#d5dbd7}
16
+ .monicka-booking .back-button{gap:.5em}.monicka-booking .day-empty{border:0;background:transparent}
15
17
  .monicka-booking.theme-toluenoor .panel,.monicka-booking.theme-toluenoor .therapist-card,.monicka-booking .toluenoor-profile{border-radius:24px;box-shadow:0 4px 8px #00000014,0 6px 20px #00000014}
16
18
  .monicka-booking .toluenoor-profile{overflow:hidden;background:#fff;margin:0 0 24px;text-align:center}
17
19
  .monicka-booking .toluenoor-profile__banner{height:130px;background-color:#325343;background-image:var(--monicka-pattern);background-position:center;background-size:cover}
@@ -10,6 +10,7 @@
10
10
  const $=id=>find(id), state={therapist:null,branch:null,date:null,duration:'',branchFilter:'',month:null,available:new Set()};
11
11
  const fa=new Intl.DateTimeFormat('fa-IR-u-ca-persian-nu-latn',{year:'numeric',month:'numeric',day:'numeric'});
12
12
  const faMonth=new Intl.DateTimeFormat('fa-IR-u-ca-persian',{year:'numeric',month:'long'});
13
+ const faNumber=new Intl.NumberFormat('fa-IR',{useGrouping:false});
13
14
  const parts=d=>Object.fromEntries(fa.formatToParts(d).map(p=>[p.type,p.value]));
14
15
  const jdate=d=>{const p=parts(d);return `${p.year}/${String(p.month).padStart(2,'0')}/${String(p.day).padStart(2,'0')}`};
15
16
  const jm=d=>{const p=parts(d);return {year:+p.year,month:+p.month}};
@@ -36,16 +37,16 @@
36
37
  });
37
38
  if(!list.children.length)list.textContent='درمانگری با این مشخصات پیدا نشد.';
38
39
  }
39
- function initFilters(){const branchFilter=$('branch-filter');if(branchFilter){branchFilter.onchange=()=>{state.branchFilter=branchFilter.value;renderTherapists()}}[...new Set(catalog.therapists.flatMap(t=>t.branches.flatMap(b=>b.allowed_durations)))].sort((a,b)=>a-b).forEach(n=>{const o=document.createElement('option');o.value=n;o.textContent=`${n} دقیقه`;$('duration-filter').append(o)});$('therapist-search').oninput=renderTherapists;$('duration-filter').onchange=()=>{state.duration=$('duration-filter').value;renderTherapists()};}
40
+ function initFilters(){const branchFilter=$('branch-filter');if(branchFilter){branchFilter.onchange=()=>{state.branchFilter=branchFilter.value;renderTherapists()}}[...new Set(catalog.therapists.flatMap(t=>t.branches.flatMap(b=>b.allowed_durations)))].sort((a,b)=>a-b).forEach(n=>{const o=document.createElement('option');o.value=n;o.textContent=`${faNumber.format(n)} دقیقه`;$('duration-filter').append(o)});$('therapist-search').oninput=renderTherapists;$('duration-filter').onchange=()=>{state.duration=$('duration-filter').value;renderTherapists()};}
40
41
  function selectTherapist(t,clinicId=null){state.therapist=t;const branches=clinicId===null?eligibleBranches(t):t.branches.filter(b=>b.clinic_id===clinicId);if(!branches.length)return;state.branch=branches[0];$('selected-therapist').textContent=`${t.full_name} · ${state.branch.clinic_name}`;const row=$('branch-row'),sel=$('branch-select');sel.replaceChildren();branches.forEach(b=>{const o=document.createElement('option');o.value=b.clinic_id;o.textContent=b.clinic_name;sel.append(o)});row.hidden=branches.length<2||clinicId!==null;sel.onchange=()=>{state.branch=branches.find(b=>b.clinic_id===+sel.value);state.date=null;$('slot-area').hidden=true;loadAvailability()};state.month=jm(new Date());show('calendar');loadAvailability();}
41
42
  function findFirstDay(m){const now=new Date();for(let i=-500;i<500;i++){const d=new Date(now);d.setDate(d.getDate()+i);const p=parts(d),x=jm(d);if(x.year===m.year&&x.month===m.month&&+p.day===1)return d}return null}
42
43
  function addMonth(m,n){const i=m.year*12+m.month-1+n;return {year:Math.floor(i/12),month:i%12+1}}
43
44
  function bounds(){const first=findFirstDay(state.month);if(!first)return null;const start=new Date(first);start.setDate(first.getDate()-((first.getDay()+1)%7));const days=Array.from({length:42},(_,i)=>{const d=new Date(start);d.setDate(start.getDate()+i);return d});return {first,days}}
44
45
  async function loadAvailability(){const b=bounds();if(!b)return;state.available.clear();const today=new Date();today.setHours(0,0,0,0);const begin=new Date(Math.max(b.first.getTime(),today.getTime()+86400000));const limit=new Date(today);limit.setDate(limit.getDate()+(+state.branch.booking_days||20));const end=new Date(Math.min(b.days[41].getTime(),limit.getTime()));if(begin<=end){try{const u=new URL(availabilityUrl,location.href);u.search=new URLSearchParams({clinic:state.branch.clinic_id,therapist:state.therapist.id,start:jdate(begin),end:jdate(end)});const r=await fetch(u,{headers:{Accept:'application/json'}});if(!r.ok)throw Error();(await r.json()).available_days.forEach(x=>state.available.add(x.date))}catch{say('روزهای آزاد بارگذاری نشد. دوباره تلاش کنید.')}}drawMonth(state.month)}
45
- function drawMonth(m){state.month=m;const b=bounds();if(!b)return;$('month-label').textContent=faMonth.format(b.first);const grid=root.querySelector('.calendar-grid');grid.querySelectorAll('.day').forEach(x=>x.remove());const today=new Date();today.setHours(0,0,0,0);const horizon=new Date(today);horizon.setDate(horizon.getDate()+(+state.branch.booking_days||20));b.days.forEach(d=>{const p=parts(d),x=jm(d),same=x.year===m.year&&x.month===m.month,j=jdate(d),button=document.createElement('button');button.type='button';button.className='day';button.textContent=p.day;button.setAttribute('role','gridcell');button.setAttribute('aria-label',`${p.day} ${faMonth.format(d)}`);const avail=state.available.has(j);button.disabled=!same||!avail||d<=today||d>horizon;button.classList.toggle('available',avail&&!button.disabled);button.setAttribute('aria-pressed',state.date===j?'true':'false');button.onclick=()=>selectDate(j);grid.append(button)});const monthIdx=m.year*12+m.month-1,now=jm(today),maxDays=+state.branch.booking_days||20,last=jm(horizon);$('previous-month').disabled=monthIdx<=now.year*12+now.month-1;$('next-month').disabled=monthIdx>=last.year*12+last.month-1;}
46
- async function selectDate(date){state.date=date;$('slot-area').hidden=false;$('slot-list').textContent='در حال دریافت ساعت‌های آزاد…';try{const u=new URL(slotsUrl,location.href);u.search=new URLSearchParams({clinic:state.branch.clinic_id,therapist:state.therapist.id,date});const r=await fetch(u,{headers:{Accept:'application/json'}});if(!r.ok)throw Error();const data=await r.json(),list=$('slot-list');list.replaceChildren();data.slots.filter(s=>!state.duration||s.duration_minutes===+state.duration).forEach(s=>(s.available_rooms||[]).forEach(room=>{const button=document.createElement('button');button.type='button';button.className='slot-button';button.textContent=`${new Intl.DateTimeFormat('fa-IR',{hour:'2-digit',minute:'2-digit',timeZone:'Asia/Tehran'}).format(new Date(s.start))} — ${s.duration_minutes} دقیقه`;button.onclick=()=>chooseSlot(s,button);list.append(button)}));if(!list.children.length)list.textContent='برای این روز ساعتی باقی نمانده است.'}catch{$('slot-list').textContent='دریافت ساعت‌ها ممکن نشد. دوباره تلاش کنید.'}}
46
+ function drawMonth(m){state.month=m;const b=bounds();if(!b)return;$('month-label').textContent=faMonth.format(b.first);const grid=root.querySelector('.calendar-grid');grid.querySelectorAll('.day').forEach(x=>x.remove());const today=new Date();today.setHours(0,0,0,0);const horizon=new Date(today);horizon.setDate(horizon.getDate()+(+state.branch.booking_days||20));b.days.forEach(d=>{const p=parts(d),x=jm(d),same=x.year===m.year&&x.month===m.month;if(!same){const empty=document.createElement('span');empty.className='day day-empty';empty.setAttribute('aria-hidden','true');grid.append(empty);return}const j=jdate(d),button=document.createElement('button');button.type='button';button.className='day';button.textContent=faNumber.format(+p.day);button.setAttribute('role','gridcell');button.setAttribute('aria-label',`${faNumber.format(+p.day)} ${faMonth.format(d)}`);const avail=state.available.has(j);button.disabled=!avail||d<=today||d>horizon;button.classList.toggle('available',avail&&!button.disabled);button.setAttribute('aria-pressed',state.date===j?'true':'false');button.onclick=()=>selectDate(j);grid.append(button)});const monthIdx=m.year*12+m.month-1,now=jm(today),last=jm(horizon);$('previous-month').disabled=monthIdx<=now.year*12+now.month-1;$('next-month').disabled=monthIdx>=last.year*12+last.month-1;}
47
+ async function selectDate(date){state.date=date;$('slot-area').hidden=false;$('slot-list').textContent='در حال دریافت ساعت‌های آزاد…';try{const u=new URL(slotsUrl,location.href);u.search=new URLSearchParams({clinic:state.branch.clinic_id,therapist:state.therapist.id,date});const r=await fetch(u,{headers:{Accept:'application/json'}});if(!r.ok)throw Error();const data=await r.json(),list=$('slot-list');list.replaceChildren();data.slots.filter(s=>!state.duration||s.duration_minutes===+state.duration).forEach(s=>(s.available_rooms||[]).forEach(room=>{const button=document.createElement('button');button.type='button';button.className='slot-button';button.textContent=`${new Intl.DateTimeFormat('fa-IR',{hour:'2-digit',minute:'2-digit',timeZone:'Asia/Tehran'}).format(new Date(s.start))} — ${faNumber.format(s.duration_minutes)} دقیقه`;button.onclick=()=>chooseSlot(s,button);list.append(button)}));if(!list.children.length)list.textContent='برای این روز ساعتی باقی نمانده است.'}catch{$('slot-list').textContent='دریافت ساعت‌ها ممکن نشد. دوباره تلاش کنید.'}}
47
48
  function feeLabel(rawBase,minutes,perMinute,minimum){const [whole='',fraction='']=String(rawBase).split('.'),cents=BigInt(whole)*100n+BigInt((fraction+'00').slice(0,2));let total=cents;if(perMinute&&minutes>minimum){const numerator=cents*BigInt(minutes);total=numerator/60n;const remainder=numerator%60n;if(remainder*2n>60n||(remainder*2n===60n&&total%2n===1n))total+=1n}const integer=(total/100n).toLocaleString('fa-IR'),decimal=new Intl.NumberFormat('fa-IR',{minimumIntegerDigits:2,useGrouping:false}).format(Number(total%100n));return `${integer}٫${decimal}`}
48
- function chooseSlot(s,button){root.querySelectorAll('.slot-button').forEach(b=>b.setAttribute('aria-pressed','false'));button.setAttribute('aria-pressed','true');$('form-clinic').value=state.branch.clinic_id;$('form-therapist').value=state.therapist.id;$('form-starts-at').value=s.start;$('form-duration').value=s.duration_minutes;const policy=state.therapist.branches.find(b=>b.clinic_id===state.branch.clinic_id),amount=feeLabel(policy.base_fee,s.duration_minutes,policy.calculate_per_minute,policy.minimum_length_of_appointments);$('booking-summary').textContent=`${state.therapist.full_name}، ${state.branch.clinic_name}، ${jdate(new Date(s.start))}، ${s.duration_minutes} دقیقه، مبلغ ${amount} ${currency}`;show('details')}
49
+ function chooseSlot(s,button){root.querySelectorAll('.slot-button').forEach(b=>b.setAttribute('aria-pressed','false'));button.setAttribute('aria-pressed','true');$('form-clinic').value=state.branch.clinic_id;$('form-therapist').value=state.therapist.id;$('form-starts-at').value=s.start;$('form-duration').value=s.duration_minutes;const policy=state.therapist.branches.find(b=>b.clinic_id===state.branch.clinic_id),amount=feeLabel(policy.base_fee,s.duration_minutes,policy.calculate_per_minute,policy.minimum_length_of_appointments);$('booking-summary').textContent=`${state.therapist.full_name}، ${state.branch.clinic_name}، ${jdate(new Date(s.start)).replace(/\d/g,digit=>faNumber.format(+digit))}، ${faNumber.format(s.duration_minutes)} دقیقه، مبلغ ${amount} ${currency}`;show('details')}
49
50
  $('previous-month').onclick=()=>{state.month=addMonth(state.month,-1);loadAvailability()};$('next-month').onclick=()=>{state.month=addMonth(state.month,1);loadAvailability()};root.querySelectorAll('[data-back]').forEach(b=>b.onclick=()=>show(b.dataset.back));$('add-participant').onclick=()=>{const row=document.createElement('div');row.className='participant-row';const name=document.createElement('label');name.textContent='نام همراه';const ni=document.createElement('input');ni.name='participant_name';ni.maxLength=200;name.append(ni);const phone=document.createElement('label');phone.textContent='شماره همراه';const pi=document.createElement('input');pi.name='participant_phone';pi.inputMode='tel';pi.pattern='[+0-9۰-۹٠-٩\\- ]{10,16}';phone.append(pi);row.append(name,phone);$('participants').append(row)};
50
51
  initFilters();renderTherapists();
51
52
  if(specialScope){const therapist=catalog.therapists.find(t=>t.id===specialScope.therapist_id);if(therapist)selectTherapist(therapist,specialScope.clinic_id)}
@@ -0,0 +1,18 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320" role="img" aria-labelledby="title">
2
+ <title id="title">تصویر پیش‌فرض درمانگر</title>
3
+ <defs>
4
+ <linearGradient id="background" x1="0" y1="0" x2="1" y2="1">
5
+ <stop offset="0" stop-color="#f5f8f5"/>
6
+ <stop offset="1" stop-color="#dce9e1"/>
7
+ </linearGradient>
8
+ <linearGradient id="portrait" x1="0" y1="0" x2="0" y2="1">
9
+ <stop offset="0" stop-color="#829e90"/>
10
+ <stop offset="1" stop-color="#607e6f"/>
11
+ </linearGradient>
12
+ </defs>
13
+ <circle cx="160" cy="160" r="160" fill="url(#background)"/>
14
+ <circle cx="160" cy="160" r="139" fill="#fff" fill-opacity=".26" stroke="#fff" stroke-opacity=".9" stroke-width="4"/>
15
+ <circle cx="160" cy="119" r="44" fill="url(#portrait)"/>
16
+ <path d="M86 239c6-39 33-62 74-62s68 23 74 62c-20 18-46 28-74 28s-54-10-74-28Z" fill="url(#portrait)"/>
17
+ <path d="M141 181l19 18 19-18" fill="none" stroke="#e9f1ec" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".7" stroke-width="5"/>
18
+ </svg>
@@ -29,7 +29,7 @@
29
29
  </div>
30
30
  </section>
31
31
  <section class="panel" id="step-calendar" aria-labelledby="calendar-title" {% if not special_mode %}hidden{% endif %}>
32
- <div class="section-top"><div><h2 id="calendar-title">انتخاب روز و ساعت</h2><p id="selected-therapist"></p></div>{% if not special_mode %}<button type="button" class="button secondary" data-back="therapist">تغییر درمانگر</button>{% endif %}</div>
32
+ <div class="section-top"><div><h2 id="calendar-title">انتخاب روز و ساعت</h2><p id="selected-therapist"></p></div>{% if not special_mode %}<button type="button" class="button secondary back-button" data-back="therapist"><span aria-hidden="true">→</span> تغییر درمانگر</button>{% endif %}</div>
33
33
  <div class="branch-row" id="branch-row" hidden><label for="branch-select">شعبه</label><select id="branch-select"></select></div>
34
34
  <div class="calendar-head"><button type="button" id="previous-month" class="button secondary" aria-label="ماه قبل">ماه قبل</button><h3 id="month-label" aria-live="polite"></h3><button type="button" id="next-month" class="button secondary" aria-label="ماه بعد">ماه بعد</button></div>
35
35
  <div class="calendar-grid" role="grid" aria-label="تقویم شمسی"><div class="weekday">شنبه</div><div class="weekday">یکشنبه</div><div class="weekday">دوشنبه</div><div class="weekday">سه‌شنبه</div><div class="weekday">چهارشنبه</div><div class="weekday">پنجشنبه</div><div class="weekday">جمعه</div></div>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monicka-booking
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Accessible Persian clinic booking pages for Monicka API
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -96,6 +96,22 @@ class BookingConfigTests(TestCase):
96
96
  self.assertEqual(raised.exception.status_code, 403)
97
97
  self.assertEqual(raised.exception.reason, "http_error")
98
98
 
99
+ def test_unexpected_catalog_json_becomes_a_safe_upstream_error(self):
100
+ client = MonickaAPIClient(BookingWidgetConfig(primary_clinic_id=1), api_key="secret")
101
+ for payload in (None, [], "unexpected", 1):
102
+ with self.subTest(payload=payload), patch.object(client, "_request", return_value=payload):
103
+ with self.assertRaises(MonickaAPIError) as raised:
104
+ client.catalog()
105
+ self.assertEqual(raised.exception.reason, "invalid_catalog")
106
+
107
+ @override_settings(MONICKA_API_KEY="secret")
108
+ def test_unexpected_catalog_json_shows_the_unavailable_page(self):
109
+ BookingWidgetConfig.objects.create(primary_clinic_id=1)
110
+ with patch.object(MonickaAPIClient, "_request", return_value=[]):
111
+ response = self.client.get(reverse("monicka_booking:booking"))
112
+ self.assertEqual(response.status_code, 200)
113
+ self.assertTrue(response.context["unavailable"])
114
+
99
115
 
100
116
  class BookingPageTests(TestCase):
101
117
  def _catalog(self):
@@ -1 +0,0 @@
1
- __version__ = "0.2.0"
@@ -1,13 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320" role="img" aria-labelledby="title">
2
- <title id="title">تصویر درمانگر</title>
3
- <defs>
4
- <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
5
- <stop offset="0" stop-color="#edf2ef"/>
6
- <stop offset="1" stop-color="#dce7e1"/>
7
- </linearGradient>
8
- </defs>
9
- <rect width="320" height="320" rx="36" fill="url(#bg)"/>
10
- <circle cx="160" cy="119" r="53" fill="#9aada4"/>
11
- <path d="M63 291c6-57 44-92 97-92s91 35 97 92" fill="#9aada4"/>
12
- <circle cx="160" cy="160" r="147" fill="none" stroke="#fff" stroke-opacity=".72" stroke-width="3"/>
13
- </svg>