@zappie/checkout-fields 0.0.0-stage → 0.1.1
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/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/address.js +2 -0
- package/dist/address.js.map +6 -0
- package/dist/contact.js +2 -0
- package/dist/contact.js.map +6 -0
- package/dist/delivery-map.js +2 -0
- package/dist/delivery-map.js.map +6 -0
- package/dist/escape.js +2 -0
- package/dist/escape.js.map +6 -0
- package/dist/index.d.ts +220 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +6 -0
- package/dist/live-map.js +2 -0
- package/dist/live-map.js.map +6 -0
- package/dist/order-time.js +2 -0
- package/dist/order-time.js.map +6 -0
- package/dist/region.js +2 -0
- package/dist/region.js.map +6 -0
- package/dist/schedule.js +2 -0
- package/dist/schedule.js.map +6 -0
- package/package.json +40 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @zappie/checkout-fields
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [1d7831f]
|
|
8
|
+
- Updated dependencies [897ac37]
|
|
9
|
+
- @zappie/sdk@0.24.0
|
|
10
|
+
- @zappie/foundations@0.22.3
|
|
11
|
+
|
|
12
|
+
## 0.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- b7848ed: `@zappie/checkout-fields` is the behaviour of a checkout's fields above `useCheckoutFlow`, with no markup beyond the map: `useAddressPicker` and `useAddressSuggestions` for the address search, `DeliveryAddressMap` for the live or static map of the address, `useContactDraft` and `contactProblemText` for the contact details, `useScheduleStrip` and `scheduledLabel` for the schedule's days, `useRegionSearch`, `useEscapeClose` and `orderTimeChoice`.
|
|
17
|
+
|
|
18
|
+
The kit's address picker uses it, so `address-utils.ts` and `use-address-picker.ts` are no longer copied into a project, and `zappie add address-picker` installs the package. The SDK's Vite plugin pre-bundles the package in development. The starter picks its address and words its phone problem with it.
|
|
19
|
+
|
|
20
|
+
`zappie diff --apply` names the packages a new item version needs that the project doesn't have. `zappie doctor` accepts a later 0.x minor of a Zappie package for an item's requirement, so an item that asks for `^0.1.0` is met by 0.21.0.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [b7848ed]
|
|
25
|
+
- @zappie/sdk@0.23.1
|
|
26
|
+
- @zappie/foundations@0.22.2
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zappie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zappie/checkout-fields
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The behaviour of a checkout's fields, above `useCheckoutFlow` from `@zappie/foundations/checkout`: the address search and its map, the contact details dialog, the schedule's days, the delivery area search and the When section. You bring the markup and the styles.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @zappie/checkout-fields @zappie/foundations @zappie/sdk react
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Use it
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import {
|
|
13
|
+
DeliveryAddressMap,
|
|
14
|
+
useAddressPicker,
|
|
15
|
+
useAddressSuggestions,
|
|
16
|
+
} from "@zappie/checkout-fields";
|
|
17
|
+
|
|
18
|
+
const state = useAddressPicker(places, branch.id, onPick);
|
|
19
|
+
const { suggestions, searching } = useAddressSuggestions(
|
|
20
|
+
state.search,
|
|
21
|
+
state.query,
|
|
22
|
+
{
|
|
23
|
+
enabled: !state.selected,
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`DeliveryAddressMap` shows the live delivery map when the store has a Maps key, loaded in its own chunk, and the static map of the address otherwise.
|
package/dist/address.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{useCallback,useEffect,useMemo,useRef,useState}from"react";function deliveryAddress(place){return{line1:place.line1,...place.city?{city:place.city}:{},placeId:place.place_id,coordinates:{lat:place.lat,lng:place.lng}}}function locationError(error){const position=typeof error==="object"&&error!==null&&"code"in error?error:void 0;if(position?.code===1){return"Location access is off. Search for your address instead."}if(position?.code===2||position?.code===3){return"We couldn't find your location. Search for your address instead."}return error instanceof Error?error.message:"We couldn't find your location. Search for your address instead."}function useAddressPicker(places,branchId,onChange){const search=useMemo(()=>places.createAddressSearch({branchId}),[branchId,places]);const revision=useRef(0);const[query,setQueryState]=useState("");const[selected,setSelected]=useState(null);const[finding,setFinding]=useState(false);const[error,setError]=useState(null);useEffect(()=>()=>search.dispose(),[search]);const choose=useCallback(address=>{revision.current++;setSelected(address);setQueryState(address.line1);setError(null);onChange(address)},[onChange]);const setQuery=useCallback(value=>{revision.current++;setQueryState(value);setError(null)},[]);const clear=useCallback(()=>{revision.current++;setSelected(null);setQueryState("");setError(null)},[]);const pick=useCallback(id=>{const current=++revision.current;return search.select(id).then(place=>{if(revision.current===current){choose(deliveryAddress(place))}},()=>{if(revision.current===current){setError("We couldn't open that address. Try another one.")}})},[choose,search]);const locate=useCallback(()=>{const current=++revision.current;setFinding(true);setError(null);const fail=failure=>{if(revision.current===current){setError(locationError(failure));setFinding(false)}};navigator.geolocation.getCurrentPosition(({coords})=>{void places.reverse(coords.latitude,coords.longitude).then(place=>{if(revision.current===current){choose(deliveryAddress(place));setFinding(false)}},fail)},fail,{enableHighAccuracy:false,timeout:1e4,maximumAge:6e4})},[choose,places]);const canLocate=typeof navigator!=="undefined"&&Boolean(navigator.geolocation);return{search,query,setQuery,selected,choose,pick,clear,canLocate,locate,finding,error}}function useAddressSuggestions(search,query,{enabled=true,minLength=3,debounceMs=250}={}){const[suggestions,setSuggestions]=useState([]);const[searching,setSearching]=useState(false);const text=query.trim();useEffect(()=>{if(!enabled||text.length<minLength){setSuggestions([]);setSearching(false);return}let live=true;setSearching(true);const timer=window.setTimeout(()=>{void search.suggest(text).then(found=>{if(live){setSuggestions(found.map(entry=>({id:entry.place_id,text:entry.text})))}}).catch(()=>void 0).finally(()=>{if(live){setSearching(false)}})},debounceMs);return()=>{live=false;window.clearTimeout(timer)}},[debounceMs,enabled,minLength,search,text]);return{suggestions,searching}}export{deliveryAddress,locationError,useAddressPicker,useAddressSuggestions};
|
|
2
|
+
//# sourceMappingURL=address.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/address.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AM,KAAK,EACxB,UAAU,IAAM,CACd,GAAI,CAAC,SAAW,KAAK,OAAS,UAAW,CACvC,eAAe,CAAC,CAAC,EACjB,aAAa,KAAK,EAClB,MACF,CACA,IAAI,KAAO,KACX,aAAa,IAAI,EACjB,MAAM,MAAQ,OAAO,WAAW,IAAM,CACpC,KAAK,OACF,QAAQ,IAAI,EACZ,KAAM,OAAU,CACf,GAAI,KAAM,CACR,eACE,MAAM,IAAK,QAAW,CAAE,GAAI,MAAM,SAAU,KAAM,MAAM,IAAK,EAAE,CACjE,CACF,CACF,CAAC,EACA,MAAM,IAAM,MAAS,EACrB,QAAQ,IAAM,CACb,GAAI,KAAM,CACR,aAAa,KAAK,CACpB,CACF,CAAC,CACL,EAAG,UAAU,EACb,MAAO,IAAM,CACX,KAAO,MACP,OAAO,aAAa,KAAK,CAC3B,CACF,EAAG,CAAC,WAAY,QAAS,UAAW,OAAQ,IAAI,CAAC,EACjD,MAAO,CAAE,YAAa,SAAU,CAClC",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/contact.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{contactProblems}from"@zappie/foundations/checkout";import{useState}from"react";function contactProblemText(problem,field){if(!problem){return void 0}if(!field){return problem==="invalid"?"Check this number":"Add your phone number"}if(problem==="invalid"){return field.type==="email"?"Check this email address":`Check your ${field.label.toLowerCase()}`}return`Add your ${field.label.toLowerCase()}`}function contactProblemTexts(fields,problems){const text={};for(const[key,problem]of Object.entries(problems)){const message=contactProblemText(problem,key==="phone"?void 0:fields.find(field=>field.key===key));if(message){text[key]=message}}return text}function useContactDraft(contact,focus,dialCode="+234"){const[phone,setPhone]=useState(contact.phone.startsWith(dialCode)?contact.phone.slice(dialCode.length):contact.phone);const[values,setValues]=useState(contact.values);const[tried,setTried]=useState(contact.shown.has(focus));const problems=contactProblems(contact.fields,values,phone,contact.accountPhone,dialCode);return{phone,setPhone,values,setValue:(key,value)=>setValues({...values,[key]:value}),problem:key=>tried?contactProblemText(problems[key],key==="phone"?void 0:contact.fields.find(field=>field.key===key)):void 0,save:()=>{const first=Object.keys(problems)[0];if(first){setTried(true);return first}contact.setPhone(phone);for(const field of contact.fields){contact.setField(field.key,values[field.key]??"")}for(const key of["phone",...contact.fields.map(field=>field.key)]){contact.show(key)}return void 0}}}export{contactProblemText,contactProblemTexts,useContactDraft};
|
|
2
|
+
//# sourceMappingURL=contact.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/contact.ts"],
|
|
4
|
+
"mappings": "aACA,OACE,oBAKK,+BACP,OAAS,aAAgB,QAQlB,SAAS,mBACd,QACA,MACoB,CACpB,GAAI,CAAC,QAAS,CACZ,OAAO,MACT,CACA,GAAI,CAAC,MAAO,CACV,OAAO,UAAY,UACf,oBACA,uBACN,CACA,GAAI,UAAY,UAAW,CACzB,OAAO,MAAM,OAAS,QAClB,2BACA,cAAc,MAAM,MAAM,YAAY,CAAC,EAC7C,CACA,MAAO,YAAY,MAAM,MAAM,YAAY,CAAC,EAC9C,CAQO,SAAS,oBACd,OACA,SACwB,CACxB,MAAM,KAA+B,CAAC,EACtC,SAAW,CAAC,IAAK,OAAO,IAAK,OAAO,QAAQ,QAAQ,EAAG,CACrD,MAAM,QAAU,mBACd,QACA,MAAQ,QAAU,OAAY,OAAO,KAAM,OAAU,MAAM,MAAQ,GAAG,CACxE,EACA,GAAI,QAAS,CACX,KAAK,GAAG,EAAI,OACd,CACF,CACA,OAAO,IACT,CA0BO,SAAS,gBACd,QACA,MACA,SAAW,OACG,CACd,KAAM,CAAC,MAAO,QAAQ,EAAI,SACxB,QAAQ,MAAM,WAAW,QAAQ,EAC7B,QAAQ,MAAM,MAAM,SAAS,MAAM,EACnC,QAAQ,KACd,EACA,KAAM,CAAC,OAAQ,SAAS,EAAI,SAAwB,QAAQ,MAAM,EAElE,KAAM,CAAC,MAAO,QAAQ,EAAI,SAAS,QAAQ,MAAM,IAAI,KAAK,CAAC,EAC3D,MAAM,SAAW,gBACf,QAAQ,OACR,OACA,MACA,QAAQ,aACR,QACF,EACA,MAAO,CACL,MACA,SACA,OACA,SAAU,CAAC,IAAK,QAAU,UAAU,CAAE,GAAG,OAAQ,CAAC,GAAG,EAAG,KAAM,CAAC,EAC/D,QAAU,KACR,MACI,mBACE,SAAS,GAAG,EACZ,MAAQ,QACJ,OACA,QAAQ,OAAO,KAAM,OAAU,MAAM,MAAQ,GAAG,CACtD,EACA,OACN,KAAM,IAAM,CACV,MAAM,MAAQ,OAAO,KAAK,QAAQ,EAAE,CAAC,EACrC,GAAI,MAAO,CACT,SAAS,IAAI,EACb,OAAO,KACT,CACA,QAAQ,SAAS,KAAK,EACtB,UAAW,SAAS,QAAQ,OAAQ,CAClC,QAAQ,SAAS,MAAM,IAAK,OAAO,MAAM,GAAG,GAAK,EAAE,CACrD,CACA,UAAW,MAAO,CAChB,QACA,GAAG,QAAQ,OAAO,IAAK,OAAU,MAAM,GAAG,CAC5C,EAAG,CACD,QAAQ,KAAK,GAAG,CAClB,CACA,OAAO,MACT,CACF,CACF",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{deferred}from"@zappie/foundations";import{jsx}from"react/jsx-runtime";var liveMap=deferred(()=>import("./live-map.js"));var join=(...names)=>names.filter(Boolean).join(" ");function DeliveryAddressMap({places,branch,address,mapsKey,pinImageUrl,label,className,surfaceClassName}){const at=address.coordinates;if(!at){return null}if(mapsKey&&branch?.coordinates){return jsx(liveMap.Component,{open:true,fallback:jsx("div",{"aria-hidden":"true",className:join(surfaceClassName,className)}),branch,shopper:at,browserKey:mapsKey,...pinImageUrl?{pinImageUrl}:{},...label?{role:"img","aria-label":label}:{"aria-hidden":true},className:join(surfaceClassName,className)})}return jsx("img",{src:places.staticMapUrl(at.lat,at.lng,branch?.id),alt:label??"",width:560,height:160,className})}export{DeliveryAddressMap};
|
|
2
|
+
//# sourceMappingURL=delivery-map.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/delivery-map.tsx"],
|
|
4
|
+
"mappings": "aACA,OAAS,aAAgB,sBAuDf,mCAnDV,IAAM,QAAU,SAAS,IAAM,OAAO,eAAY,CAAC,EAwBnD,IAAM,KAAO,IAAI,QACf,MAAM,OAAO,OAAO,EAAE,KAAK,GAAG,EAOzB,SAAS,mBAAmB,CACjC,OACA,OACA,QACA,QACA,YACA,MACA,UACA,gBACF,EAA4B,CAC1B,MAAM,GAAK,QAAQ,YACnB,GAAI,CAAC,GAAI,CACP,OAAO,IACT,CACA,GAAI,SAAW,QAAQ,YAAa,CAClC,OACE,IAAC,QAAQ,UAAR,CACC,KAAI,KACJ,SACE,IAAC,OACC,cAAY,OACZ,UAAW,KAAK,iBAAkB,SAAS,EAC7C,EAEF,OACA,QAAS,GACT,WAAY,QACX,GAAI,YAAc,CAAE,WAAY,EAAI,CAAC,EACrC,GAAI,MACD,CAAE,KAAM,MAAO,aAAc,KAAM,EACnC,CAAE,cAAe,IAAK,EAC1B,UAAW,KAAK,iBAAkB,SAAS,EAC7C,CAEJ,CACA,OACE,IAAC,OACC,IAAK,OAAO,aAAa,GAAG,IAAK,GAAG,IAAK,QAAQ,EAAE,EACnD,IAAK,OAAS,GACd,MAAO,IACP,OAAQ,IACR,UACF,CAEJ",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/escape.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{useEffect}from"react";function useEscapeClose(onClose){useEffect(()=>{const onKey=event=>{if(event.key==="Escape"){event.stopPropagation();onClose()}};document.addEventListener("keydown",onKey,true);return()=>document.removeEventListener("keydown",onKey,true)},[onClose])}export{useEscapeClose};
|
|
2
|
+
//# sourceMappingURL=escape.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/escape.ts"],
|
|
4
|
+
"mappings": "aACA,OAAS,cAAiB,QAMnB,SAAS,eAAe,QAA2B,CACxD,UAAU,IAAM,CACd,MAAM,MAAS,OAAyB,CACtC,GAAI,MAAM,MAAQ,SAAU,CAC1B,MAAM,gBAAgB,EACtB,QAAQ,CACV,CACF,EACA,SAAS,iBAAiB,UAAW,MAAO,IAAI,EAChD,MAAO,IAAM,SAAS,oBAAoB,UAAW,MAAO,IAAI,CAClE,EAAG,CAAC,OAAO,CAAC,CACd",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { DeliveryAddress, Branch } from '@zappie/sdk';
|
|
2
|
+
import { PlacesClient, Place } from '@zappie/sdk/places';
|
|
3
|
+
import { ContactValues, ContactProblem, ContactField, CheckoutContact, CheckoutTiming } from '@zappie/foundations/checkout';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
|
|
6
|
+
/** A place from the address search or the shopper's location, as the checkout keeps it. */
|
|
7
|
+
declare function deliveryAddress(place: Place): DeliveryAddress;
|
|
8
|
+
/** What to tell the shopper when their location can't be read. */
|
|
9
|
+
declare function locationError(error: unknown): string;
|
|
10
|
+
/** State and actions of the address search, from `useAddressPicker`. */
|
|
11
|
+
type AddressPickerState = {
|
|
12
|
+
/** The branch's address search. It is disposed when the branch changes or the picker unmounts. */
|
|
13
|
+
search: ReturnType<PlacesClient["createAddressSearch"]>;
|
|
14
|
+
query: string;
|
|
15
|
+
setQuery(query: string): void;
|
|
16
|
+
/** The address the shopper chose, until they clear it. */
|
|
17
|
+
selected: DeliveryAddress | null;
|
|
18
|
+
choose(address: DeliveryAddress): void;
|
|
19
|
+
/** Chooses the place behind a suggestion's id. */
|
|
20
|
+
pick(id: string): Promise<void>;
|
|
21
|
+
/** Forgets the chosen address and empties the search, for Change address. */
|
|
22
|
+
clear(): void;
|
|
23
|
+
/** Whether the browser can share the shopper's location. False on the server. */
|
|
24
|
+
canLocate: boolean;
|
|
25
|
+
/** Reads the shopper's location and chooses the address there. */
|
|
26
|
+
locate(): void;
|
|
27
|
+
finding: boolean;
|
|
28
|
+
error: string | null;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The address search of a delivery checkout, with no markup: the query, the chosen address, the
|
|
32
|
+
* shopper's location, and the error to show. Each new query or choice supersedes a location still
|
|
33
|
+
* being read.
|
|
34
|
+
*
|
|
35
|
+
* @param places - The places client.
|
|
36
|
+
* @param branchId - The branch whose delivery area the search covers.
|
|
37
|
+
* @param onChange - Called with each address the shopper chooses.
|
|
38
|
+
*/
|
|
39
|
+
declare function useAddressPicker(places: PlacesClient, branchId: string, onChange: (address: DeliveryAddress) => void): AddressPickerState;
|
|
40
|
+
/** A suggestion from the address search. */
|
|
41
|
+
type AddressSuggestion = {
|
|
42
|
+
id: string;
|
|
43
|
+
text: string;
|
|
44
|
+
};
|
|
45
|
+
/** Options for `useAddressSuggestions`. */
|
|
46
|
+
type AddressSuggestionsOptions = {
|
|
47
|
+
/** False stops searching and empties the list, such as once an address is chosen. Defaults to true. */
|
|
48
|
+
enabled?: boolean;
|
|
49
|
+
/** Characters typed before the first search. Defaults to 3. */
|
|
50
|
+
minLength?: number;
|
|
51
|
+
/** Milliseconds of no typing before a search. Defaults to 250. */
|
|
52
|
+
debounceMs?: number;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The suggestions for a query, searched after the shopper stops typing. A result that arrives
|
|
56
|
+
* after a newer query is dropped.
|
|
57
|
+
*
|
|
58
|
+
* @param search - The address search, `useAddressPicker(...).search`.
|
|
59
|
+
* @param query - What the shopper typed.
|
|
60
|
+
*/
|
|
61
|
+
declare function useAddressSuggestions(search: AddressPickerState["search"], query: string, { enabled, minLength, debounceMs, }?: AddressSuggestionsOptions): {
|
|
62
|
+
suggestions: readonly AddressSuggestion[];
|
|
63
|
+
searching: boolean;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* What to tell the shopper about a contact detail that stops Pay, or undefined when it doesn't.
|
|
68
|
+
*
|
|
69
|
+
* @param problem - The detail's problem, from `flow.contact.problems`.
|
|
70
|
+
* @param field - The business's field. Leave it out for the phone.
|
|
71
|
+
*/
|
|
72
|
+
declare function contactProblemText(problem: ContactProblem | undefined, field?: ContactField): string | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* `contactProblemText` for every detail that stops Pay, by key, with `phone` for the phone.
|
|
75
|
+
*
|
|
76
|
+
* @param fields - The business's contact fields.
|
|
77
|
+
* @param problems - `flow.contact.problems`.
|
|
78
|
+
*/
|
|
79
|
+
declare function contactProblemTexts(fields: readonly ContactField[], problems: Readonly<Record<string, ContactProblem>>): Record<string, string>;
|
|
80
|
+
/** A contact dialog's draft, from `useContactDraft`. */
|
|
81
|
+
type ContactDraft = {
|
|
82
|
+
/** The phone as typed in the dialog, without the dial code. */
|
|
83
|
+
phone: string;
|
|
84
|
+
setPhone(phone: string): void;
|
|
85
|
+
values: ContactValues;
|
|
86
|
+
setValue(key: string, value: string): void;
|
|
87
|
+
/** What to show under a detail: nothing until the first Save, unless Pay opened the dialog on it. */
|
|
88
|
+
problem(key: string): string | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Keeps the draft for the order and returns undefined, or, while a detail stops Pay, shows the
|
|
91
|
+
* problems and returns the first one's key for the dialog to focus.
|
|
92
|
+
*/
|
|
93
|
+
save(): string | undefined;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The draft of a contact details dialog: what the shopper types stays in the dialog until Save,
|
|
97
|
+
* which checks it as Pay would and keeps it for the order.
|
|
98
|
+
*
|
|
99
|
+
* @param contact - `flow.contact`.
|
|
100
|
+
* @param focus - The detail the dialog opened on, such as `phone` or the step's `field`.
|
|
101
|
+
* @param dialCode - The dial code a local number takes. Defaults to `+234`.
|
|
102
|
+
*/
|
|
103
|
+
declare function useContactDraft(contact: CheckoutContact, focus: string, dialCode?: string): ContactDraft;
|
|
104
|
+
|
|
105
|
+
/** Props for `DeliveryAddressMap`. */
|
|
106
|
+
type DeliveryAddressMapProps = {
|
|
107
|
+
places: PlacesClient;
|
|
108
|
+
/**
|
|
109
|
+
* The branch the order leaves from. With its coordinates and a Maps key the map is live and draws
|
|
110
|
+
* the line from the branch. Leave it out to show only the shopper's address, such as for a
|
|
111
|
+
* kitchen whose location is private.
|
|
112
|
+
*/
|
|
113
|
+
branch?: Branch | undefined;
|
|
114
|
+
address: DeliveryAddress;
|
|
115
|
+
/** The store's Maps browser key. Without one the map is a static image. */
|
|
116
|
+
mapsKey?: string | undefined;
|
|
117
|
+
/** The image inside the branch marker, such as the business logo. */
|
|
118
|
+
pinImageUrl?: string | undefined;
|
|
119
|
+
/** Names the map for screen readers. Without one the map is decoration beside the written address. */
|
|
120
|
+
label?: string | undefined;
|
|
121
|
+
/** Sets the map's size and frame, on the live map, its placeholder and the static image. */
|
|
122
|
+
className?: string | undefined;
|
|
123
|
+
/** Classes for the live map and its loading placeholder only, such as a background and `overflow: hidden`. */
|
|
124
|
+
surfaceClassName?: string | undefined;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* The delivery from the branch to the shopper's door: the live map, loaded in its own chunk, when
|
|
128
|
+
* the store has a Maps key and the branch has coordinates, else the static map of the address.
|
|
129
|
+
* It renders nothing for an address without coordinates.
|
|
130
|
+
*/
|
|
131
|
+
declare function DeliveryAddressMap({ places, branch, address, mapsKey, pinImageUrl, label, className, surfaceClassName, }: DeliveryAddressMapProps): react.JSX.Element | null;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Closes on Escape before anything under it hears the key, such as the bag a checkout dialog
|
|
135
|
+
* opens over.
|
|
136
|
+
*/
|
|
137
|
+
declare function useEscapeClose(onClose: () => void): void;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* What the checkout's When section offers. `closed` and `now` are a fixed line for a branch that
|
|
141
|
+
* takes no orders ahead. `choice` offers As soon as possible and Schedule for later, with `later`
|
|
142
|
+
* chosen when a time is set or the order can't be made now.
|
|
143
|
+
*/
|
|
144
|
+
type OrderTimeChoice = {
|
|
145
|
+
kind: "closed";
|
|
146
|
+
} | {
|
|
147
|
+
kind: "now";
|
|
148
|
+
} | {
|
|
149
|
+
kind: "choice";
|
|
150
|
+
later: boolean;
|
|
151
|
+
canNow: boolean;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* The When section's state, for `data-zappie-order-time`: `closed`, `now`, or the chosen option.
|
|
155
|
+
*
|
|
156
|
+
* @param timing - `checkoutTiming(...)` from `@zappie/foundations/checkout`.
|
|
157
|
+
* @param scheduledFor - The chosen time, if any.
|
|
158
|
+
*/
|
|
159
|
+
declare function orderTimeChoice(timing: CheckoutTiming, scheduledFor: string | undefined): OrderTimeChoice;
|
|
160
|
+
|
|
161
|
+
/** A delivery region a branch offers. */
|
|
162
|
+
type DeliveryRegion = NonNullable<Branch["deliveryRegions"]>[number];
|
|
163
|
+
/**
|
|
164
|
+
* The search of a delivery area list: the query and the regions whose name holds it.
|
|
165
|
+
*
|
|
166
|
+
* @param regions - `branch.deliveryRegions`.
|
|
167
|
+
*/
|
|
168
|
+
declare function useRegionSearch(regions: readonly DeliveryRegion[]): {
|
|
169
|
+
query: string;
|
|
170
|
+
setQuery(query: string): void;
|
|
171
|
+
shown: readonly DeliveryRegion[];
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/** A day the schedule can offer, as `Schedule` gives it. */
|
|
175
|
+
type ScheduleDay = {
|
|
176
|
+
date: string;
|
|
177
|
+
slots: readonly {
|
|
178
|
+
value: string;
|
|
179
|
+
label: string;
|
|
180
|
+
}[];
|
|
181
|
+
};
|
|
182
|
+
/** The day strip of a schedule dialog, from `useScheduleStrip`. */
|
|
183
|
+
type ScheduleStrip<D extends ScheduleDay> = {
|
|
184
|
+
/** The chosen day, or undefined while the branch offers none. */
|
|
185
|
+
day: D | undefined;
|
|
186
|
+
dayIndex: number;
|
|
187
|
+
/** The days in view, each with its index among all the days. */
|
|
188
|
+
visible: readonly {
|
|
189
|
+
day: D;
|
|
190
|
+
index: number;
|
|
191
|
+
selected: boolean;
|
|
192
|
+
}[];
|
|
193
|
+
/** Chooses a day. The time chosen on another day is cleared. */
|
|
194
|
+
choose(index: number): void;
|
|
195
|
+
canEarlier: boolean;
|
|
196
|
+
canLater: boolean;
|
|
197
|
+
earlier(): void;
|
|
198
|
+
later(): void;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* A schedule dialog's day strip: a window of days the shopper pages through, and the chosen day
|
|
202
|
+
* whose times the dialog lists.
|
|
203
|
+
*
|
|
204
|
+
* @param days - The days `Schedule` offers.
|
|
205
|
+
* @param onDay - Called when the shopper chooses another day, such as to clear the chosen time.
|
|
206
|
+
* @param size - How many days are in view. Defaults to 3.
|
|
207
|
+
*/
|
|
208
|
+
declare function useScheduleStrip<D extends ScheduleDay>(days: readonly D[], onDay: () => void, size?: number): ScheduleStrip<D>;
|
|
209
|
+
/**
|
|
210
|
+
* A chosen time as the checkout names it, in the branch's time zone: "Today, 9 am",
|
|
211
|
+
* "Tomorrow, 7:30 pm", "Sat 14 Nov, 10 am".
|
|
212
|
+
*
|
|
213
|
+
* @param at - The scheduled time, an ISO string.
|
|
214
|
+
* @param timezone - The branch's time zone, `branchTimezone(branch)` from `@zappie/foundations/hours`.
|
|
215
|
+
* @param now - The current time. Defaults to now.
|
|
216
|
+
*/
|
|
217
|
+
declare function scheduledLabel(at: string, timezone: string, now?: Date): string;
|
|
218
|
+
|
|
219
|
+
export { DeliveryAddressMap, contactProblemText, contactProblemTexts, deliveryAddress, locationError, orderTimeChoice, scheduledLabel, useAddressPicker, useAddressSuggestions, useContactDraft, useEscapeClose, useRegionSearch, useScheduleStrip };
|
|
220
|
+
export type { AddressPickerState, AddressSuggestion, AddressSuggestionsOptions, ContactDraft, DeliveryAddressMapProps, DeliveryRegion, OrderTimeChoice, ScheduleStrip };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{deliveryAddress,locationError,useAddressPicker,useAddressSuggestions}from"./address.js";import{contactProblemText,contactProblemTexts,useContactDraft}from"./contact.js";import{DeliveryAddressMap}from"./delivery-map.js";import{useEscapeClose}from"./escape.js";import{orderTimeChoice}from"./order-time.js";import{useRegionSearch}from"./region.js";import{scheduledLabel,useScheduleStrip}from"./schedule.js";export{DeliveryAddressMap,contactProblemText,contactProblemTexts,deliveryAddress,locationError,orderTimeChoice,scheduledLabel,useAddressPicker,useAddressSuggestions,useContactDraft,useEscapeClose,useRegionSearch,useScheduleStrip};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/live-map.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/order-time.ts"],
|
|
4
|
+
"mappings": "AAkBO,SAAS,gBACd,OACA,aACiB,CACjB,GAAI,CAAC,OAAO,MAAO,CACjB,MAAO,CAAE,KAAM,OAAO,OAAS,SAAW,KAAM,CAClD,CACA,MAAO,CACL,KAAM,SACN,MAAO,QAAQ,YAAY,GAAK,CAAC,OAAO,OACxC,OAAQ,OAAO,MACjB,CACF",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/region.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{useState}from"react";function useRegionSearch(regions){const[query,setQuery]=useState("");const text=query.trim().toLowerCase();return{query,setQuery,shown:text?regions.filter(region=>region.name.toLowerCase().includes(text)):regions}}export{useRegionSearch};
|
|
2
|
+
//# sourceMappingURL=region.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/region.ts"],
|
|
4
|
+
"mappings": "aAEA,OAAS,aAAgB,QAUlB,SAAS,gBAAgB,QAI9B,CACA,KAAM,CAAC,MAAO,QAAQ,EAAI,SAAS,EAAE,EACrC,MAAM,KAAO,MAAM,KAAK,EAAE,YAAY,EACtC,MAAO,CACL,MACA,SACA,MAAO,KACH,QAAQ,OAAQ,QAAW,OAAO,KAAK,YAAY,EAAE,SAAS,IAAI,CAAC,EACnE,OACN,CACF",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/schedule.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{formatClock}from"@zappie/foundations/hours";import{useState}from"react";function useScheduleStrip(days,onDay,size=3){const[dayIndex,setDayIndex]=useState(0);const[start,setStart]=useState(0);return{day:days[dayIndex],dayIndex,visible:days.slice(start,start+size).map((day,offset)=>({day,index:start+offset,selected:start+offset===dayIndex})),choose:index=>{if(index!==dayIndex){setDayIndex(index);onDay()}},canEarlier:start>0,canLater:start+size<days.length,earlier:()=>setStart(Math.max(0,start-1)),later:()=>setStart(Math.min(Math.max(0,days.length-size),start+1))}}var dayKey=(date,timezone)=>new Intl.DateTimeFormat("en-CA",{timeZone:timezone,year:"numeric",month:"2-digit",day:"2-digit"}).format(date);function scheduledLabel(at,timezone,now=new Date){const date=new Date(at);const day=dayKey(date,timezone);const tomorrow=new Date(now.getTime()+864e5);const clock=new Intl.DateTimeFormat("en-GB",{timeZone:timezone,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(date);const named=day===dayKey(now,timezone)?"Today":day===dayKey(tomorrow,timezone)?"Tomorrow":new Intl.DateTimeFormat("en-GB",{timeZone:timezone,weekday:"short",day:"numeric",month:"short"}).format(date).replace(",","");return`${named}, ${formatClock(clock)}`}export{scheduledLabel,useScheduleStrip};
|
|
2
|
+
//# sourceMappingURL=schedule.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/schedule.ts"],
|
|
4
|
+
"mappings": "aACA,OAAS,gBAAmB,4BAC5B,OAAS,aAAgB,QA+BlB,SAAS,iBACd,KACA,MACA,KAAO,EACW,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GAAG,KAAK,KAAK,YAAY,KAAK,CAAC,EACxC",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zappie/checkout-fields",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "UI-less checkout field behaviour for Zappie storefronts: the address search and its map, the contact draft and the schedule's days.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"provenance": false
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"CHANGELOG.md"
|
|
20
|
+
],
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"react": "^18.2.0 || ^19.0.0",
|
|
23
|
+
"@zappie/foundations": "^0.22.3",
|
|
24
|
+
"@zappie/sdk": "^0.24.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@zappie/foundations": "0.22.3",
|
|
28
|
+
"@zappie/sdk": "0.24.0"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/zappie/storefront-packages.git",
|
|
33
|
+
"directory": "packages/checkout-fields"
|
|
34
|
+
},
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"homepage": "https://github.com/zappie/storefront-packages#readme",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/zappie/storefront-packages/issues"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup && node ../../scripts/release-packages/build-modules.mjs --no-sources-content"
|
|
42
|
+
}
|
|
6
43
|
}
|