@zappie/foundations 0.27.0 → 0.28.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 +22 -0
- package/dist/bag/index.d.ts +1 -1
- package/dist/checkout/use-checkout-flow.js +1 -1
- package/dist/checkout/use-checkout-flow.js.map +1 -1
- package/dist/{countries-B5Bl7vkm.d.ts → countries-BLeLfxnY.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/phone/countries.d.ts +1 -1
- package/dist/phone/index.d.ts +4 -4
- package/dist/site/server/index.d.ts +5 -5
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @zappie/foundations
|
|
2
2
|
|
|
3
|
+
## 0.28.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- de699e1: The reference text for the support links names no messaging app, and the summaries that used semicolons use full stops and commas. No code changed.
|
|
8
|
+
- Updated dependencies [de699e1]
|
|
9
|
+
- @zappie/sdk@0.28.1
|
|
10
|
+
|
|
11
|
+
## 0.28.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- b7fcb8c: A bag on delivery is priced before the shopper gives an address.
|
|
16
|
+
|
|
17
|
+
- `@zappie/sdk`: `cart.setPendingFulfilment({ type: "delivery", scheduledFor })` prices a delivery and its time while the cart holds no fulfilment, so a quote has the bag's total and taxes before the address. It stays in memory and never goes to checkout.
|
|
18
|
+
- `@zappie/foundations`: `useCheckoutFlow()` sets it while delivery waits for an address, with the time chosen.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [b7fcb8c]
|
|
23
|
+
- @zappie/sdk@0.28.0
|
|
24
|
+
|
|
3
25
|
## 0.27.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/dist/bag/index.d.ts
CHANGED
|
@@ -157,7 +157,7 @@ type CartNoticeProps = {
|
|
|
157
157
|
/**
|
|
158
158
|
* One message at a time over the page and the bag: a change the server refused and the cart put back, such as
|
|
159
159
|
* "Only 2 left", or a line `useAddToBag()` just added, with its Undo. It sits in the top layer, so it shows over an
|
|
160
|
-
* open bag, and leaves after `duration
|
|
160
|
+
* open bag, and leaves after `duration`. Escape dismisses it. A line just added is announced politely to screen
|
|
161
161
|
* readers. A refusal isn't, because the SDK has announced it. Render it once, in the shell.
|
|
162
162
|
*
|
|
163
163
|
* @example
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{holdsForLater,isHeldQuote}from"@zappie/sdk";import{CheckoutError,createCheckout}from"@zappie/sdk/checkout";import{defaultRegion,prefillFulfilment,rememberAddress,rememberedAddress,watchCheckoutDefaults}from"@zappie/sdk/checkout-defaults";import{createCustomer}from"@zappie/sdk/customer";import{holdPerks}from"@zappie/sdk/loyalty";import{usePendingNavigation}from"@zappie/sdk/navigation/react";import{useCart}from"@zappie/sdk/react";import{redirectToCheckout}from"@zappie/sdk/redirect";import{countEvent,currentSource}from"@zappie/sdk/visits";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{createCheckoutAttempt}from"./attempt.js";import{businessContactFields,checkoutCustomer,contactProblems,fullPhone,recipientProblems}from"./contact.js";import{fieldSelector,issueSelector}from"./markers.js";import{checkoutOffers}from"./offers.js";import{cartIdentity,paymentNotice,payPath,takePaymentIntent}from"./pay-after-sign-in.js";import{signInOnce}from"./sign-in.js";import{checkoutStatus,firstIssue,isCheckoutFieldIssue,payEnabled}from"./status.js";import{checkoutTiming}from"./timing.js";function readSession(key){try{return window.sessionStorage.getItem(key)}catch{return null}}function writeSession(key,value){try{window.sessionStorage.setItem(key,value)}catch{}}function removeSession(key){try{window.sessionStorage.removeItem(key)}catch{}}var aborted=failure=>failure instanceof Error&&failure.name==="AbortError";var NO_FIELDS=[];var NO_VALUES={};var NO_RECIPIENT={on:false,name:"",phone:""};function profileValues(me){const values={};for(const[key,value]of[["given_name",me.given_name],["family_name",me.family_name],["email",me.email]]){if(value?.trim()){values[key]=value.trim()}}return values}var LISTED_BY_DEFAULT=["delivery","pickup"];var accountOf=person=>person?{name:person.given_name,phone:person.phone_masked}:void 0;function useCheckoutFlow(options){const{branch,menu,contactFields:givenFields=NO_FIELDS,reviewPath="/checkout",dialCode="+234",storageKey="zappie:checkout"}=options;const cart=useCart();const checkout=useMemo(()=>options.checkout??createCheckout(),[options.checkout]);const customer=useMemo(()=>options.customer??createCustomer(),[options.customer]);const owned=options.customer===void 0;const attempt=useMemo(()=>createCheckoutAttempt(),[]);const leaving=usePendingNavigation();const[auth,setAuth]=useState("unknown");const[who,setWho]=useState();const[account,setAccount]=useState();const[profile,setProfile]=useState();const[defaults,setDefaults]=useState();const[phone,setPhoneState]=useState("");const[values,setValues]=useState({});const[recipient,setRecipient]=useState(NO_RECIPIENT);const[shown,setShown]=useState(new Set);const[error,setError]=useState();const[signInRequired,setSignInRequired]=useState(false);const[leavingFor,setLeavingFor]=useState();const[failedKey,setFailedKey]=useState();const[notice,setNotice]=useState();const[defaultsFor,setDefaultsFor]=useState();const payKey=`${storageKey}.pay`;const paying=useRef(void 0);const payRead=useRef(false);useEffect(()=>{if(!payRead.current){payRead.current=true;paying.current=takePaymentIntent(payKey)}},[payKey]);const listed=options.offers??LISTED_BY_DEFAULT;const listedKey=listed.join();const offers=useMemo(()=>{const taken=checkoutOffers(branch,menu);return listed.filter(type=>taken.includes(type))},[branch,menu,listedKey]);const branchId=cart.branchId??branch.id;const fulfilment=cart.fulfilment;const[chosen,setChosen]=useState();const initial=options.initialMode&&offers.includes(options.initialMode)?options.initialMode:offers[0]??"pickup";const mode=chosen??(fulfilment&&offers.includes(fulfilment.type)?fulfilment.type:initial);const asking=options.checkoutFields!==void 0;const storeFieldsKey=asking?JSON.stringify(options.checkoutFields):"";const asked=useMemo(()=>asking?businessContactFields(options.checkoutFields,branchId,mode):givenFields,[asking,storeFieldsKey,branchId,mode,givenFields]);const holds=profile&&profile.of===who?profile.values:NO_VALUES;const held=asked.flatMap(field=>holds[field.key]?[{key:field.key,label:field.label,value:holds[field.key]}]:[]);const heldKey=held.map(entry=>entry.key).join();const contactFields=useMemo(()=>asked.filter(field=>!heldKey.split(",").includes(field.key)),[asked,heldKey]);const[pendingAt,setPendingAt]=useState();const delivery=mode==="delivery"&&fulfilment?.type==="delivery"?fulfilment:void 0;const scheduledFor=mode==="dine_in"?void 0:(fulfilment&&fulfilment.type!=="dine_in"&&fulfilment.type===mode?fulfilment.scheduledFor:void 0)??pendingAt;const latest=useRef(delivery);latest.current=delivery;useEffect(()=>{const ownerKey=`${storageKey}.owner`;const owner=readSession(ownerKey);if(owner&&owner!==who){if(who!==void 0){for(const key of[ownerKey,`${storageKey}.phone`,`${storageKey}.contact`,`${storageKey}.recipient`]){removeSession(key)}}setPhoneState("");setValues({});setRecipient(NO_RECIPIENT);return}if(who){writeSession(ownerKey,who)}setPhoneState(readSession(`${storageKey}.phone`)??"");try{setValues(JSON.parse(readSession(`${storageKey}.contact`)??"{}"))}catch{setValues({})}try{setRecipient({...NO_RECIPIENT,...JSON.parse(readSession(`${storageKey}.recipient`)??"{}")})}catch{setRecipient(NO_RECIPIENT)}},[storageKey,who]);const read=useRef({branch,fulfilment});read.current={branch,fulfilment};useEffect(()=>{const stopDefaults=watchCheckoutDefaults(customer,()=>read.current,next=>{setDefaults(next);setDefaultsFor(customer.state==="authenticated"?customer.customer?.id:customer.state==="anonymous"?null:void 0)});const stopAuth=customer.onChange((state,person)=>{setAuth(state);setAccount(state==="authenticated"?accountOf(person):void 0);setWho(state==="authenticated"?person?.id??void 0:state==="anonymous"?null:void 0)});void customer.session().then(current=>{setAuth(current?"authenticated":"anonymous");setAccount(accountOf(current));setWho(current?.id??null)},()=>{setAuth("anonymous");setAccount(void 0)});return()=>{stopDefaults();stopAuth();if(owned&&"dispose"in customer){customer.dispose()}}},[customer,owned]);const asksAny=asking&&asked.length>0;useEffect(()=>{if(!asksAny||!who){return}let current=true;customer.profile().then(me=>{if(current){setProfile({of:who,values:profileValues(me)})}},()=>void 0);return()=>{current=false}},[asksAny,who,customer]);useEffect(()=>{if(!cart.isHydrated||cart.lines.length===0||mode==="delivery"||fulfilment?.type===mode){return}cart.actions.setFulfilment(mode==="dine_in"?{type:"dine_in",branchId}:{type:"pickup",branchId,...pendingAt?{scheduledFor:pendingAt}:{}})},[branchId,cart.actions,cart.isHydrated,cart.lines.length,fulfilment?.type,mode,pendingAt]);const awaiting=useRef(false);const writeDelivery=useCallback((patch,at=scheduledFor)=>{const current=latest.current;const address=patch.address??current?.address;if(!address?.line1){return false}const regionId=defaultRegion(branch,patch.deliveryRegionId??current?.deliveryRegionId);const next={type:"delivery",branchId,address,...regionId?{deliveryRegionId:regionId}:{},...at?{scheduledFor:at}:{}};latest.current=next;awaiting.current=false;setChosen("delivery");cart.actions.setFulfilment(next);return true},[branch,branchId,cart.actions,scheduledFor]);const prefilled=useRef(void 0);useEffect(()=>{if(!cart.isHydrated||cart.lines.length===0){return}const filled=prefillFulfilment(fulfilment,branch);if(filled&&filled!==fulfilment){cart.actions.setFulfilment(filled);return}if(awaiting.current&&who!==void 0&&mode==="delivery"&&fulfilment?.type!=="delivery"){const known=rememberedAddress({customerId:who})??defaults?.address;if(known){writeDelivery({address:known})}return}const address=defaults?.address;if(mode==="delivery"&&!fulfilment&&address&&prefilled.current!==address){prefilled.current=address;writeDelivery({address})}},[branch,cart.actions,cart.isHydrated,cart.lines.length,defaults?.address,fulfilment,mode,who,writeDelivery]);const quoteKey=JSON.stringify([cart.lines,fulfilment,cart.promoCode]);const quoted=useRef("");useEffect(()=>{if(cart.isHydrated&&cart.lines.length>0&&cart.state.status==="ready"&"ed.current!==quoteKey){quoted.current=quoteKey;void cart.actions.quote().then(()=>{setFailedKey(void 0);setError(current=>current==="quote_failed"?void 0:current)},failure=>{if(!aborted(failure)){setFailedKey(quoteKey);setError("quote_failed")}})}},[cart.actions,cart.isHydrated,cart.lines.length,cart.state.status,quoteKey]);const timing=checkoutTiming(branch,menu,cart.lines,scheduledFor);const quote="quote"in cart.state?cart.state.quote:void 0;const heldQuote=isHeldQuote(quote);const unquotedTime=Boolean(scheduledFor)&&!quote?.fulfilment?.scheduledFor;const issues=useMemo(()=>{const cartIssues=cart.issues.filter(issue2=>!isCheckoutFieldIssue(issue2));return timing.ahead?unquotedTime?cartIssues.filter(issue2=>!holdsForLater(issue2)):cartIssues:cartIssues.map(issue2=>holdsForLater(issue2)?{...issue2,fixes:issue2.fixes.filter(entry=>entry.action!=="schedule")}:issue2)},[cart.issues,timing.ahead,unquotedTime]);const accountPhone=defaults?.phone.fromAccount?defaults.phone.display:void 0;const forOther=mode!=="dine_in"&&recipient.on;const problems=contactProblems(contactFields,values,phone,accountPhone,dialCode);if(forOther){delete problems.phone;Object.assign(problems,recipientProblems(recipient,dialCode))}const quotedField=cart.issues.map(issue2=>isCheckoutFieldIssue(issue2)?issue2.data?.field:void 0).find(field=>typeof field==="string");const contactField=Object.keys(problems)[0]??quotedField;const sending=asking?checkoutCustomer(contactFields,values):null;const sendingKey=JSON.stringify(sending);useEffect(()=>{if(asking){cart.actions.setCustomer(sending)}},[asking,sendingKey,cart.actions]);const contactPhone=forOther?fullPhone(recipient.phone,dialCode):phone.trim()?fullPhone(phone,dialCode):"";const status=checkoutStatus({busy:leaving.pending,hydrated:cart.isHydrated,lines:cart.lines.length,auth,closed:timing.closed,needsAddress:mode==="delivery"&&!delivery?.address.line1,needsTime:mode!=="dine_in"&&timing.needsTime,state:cart.state,quoteFailed:failedKey===quoteKey,signInRequired,contactField});const shopper=()=>customer.state==="authenticated"?customer.customer?.id??void 0:customer.state==="anonymous"?null:void 0;const choose=type=>{setChosen(type);awaiting.current=false;if(type==="delivery"&&fulfilment?.type!=="delivery"){setPendingAt(scheduledFor);const owner=shopper();const known=(owner===void 0?void 0:rememberedAddress({customerId:owner}))??defaults?.address;if(known){writeDelivery({address:known},scheduledFor);return void 0}awaiting.current=true;return{step:"address"}}return void 0};const setDelivery=(change,{remember=true}={})=>{const base=change.address??latest.current?.address;if(!base?.line1){return{step:"address"}}const typed=change.note??change.address?.instructions??latest.current?.address.instructions;const{instructions:_old,...rest}=base;const note=typed?.trim();writeDelivery({address:note?{...rest,instructions:note}:rest,...change.regionId!==void 0?{deliveryRegionId:change.regionId}:{}});const owner=shopper();if(change.address&&remember&&owner!==void 0){rememberAddress(change.address,void 0,owner)}return void 0};const setAddress=(address,options2={})=>{setDelivery({address},options2)};const setRegion=regionId=>latest.current?setDelivery({regionId}):{step:"address"};const setNote=note=>latest.current?setDelivery({note}):{step:"address"};const schedule=at=>{setPendingAt(at??void 0);if(!fulfilment||fulfilment.type==="dine_in"||fulfilment.type!==mode){return}const{scheduledFor:_old,...rest}=fulfilment;cart.actions.setFulfilment(at?{...rest,scheduledFor:at}:rest)};const fix=(issue2,action)=>{setError(void 0);switch(action.action){case"change_address":return{step:"address"};case"choose_region":return{step:"area"};case"schedule":return{step:"time"};case"switch_fulfilment":{const next=action.types.find(type=>type!==mode&&offers.includes(type))??(mode==="delivery"?"pickup":"delivery");return choose(next)}case"choose_option":case"choose_other_option":{const line=cart.lines.find(entry=>entry.id===issue2.lineId);return line?{step:"item",itemId:line.itemId,lineId:line.id}:void 0}default:cart.actions.applyFix(cart.issues.find(entry=>entry.code===issue2.code&&entry.lineId===issue2.lineId&&entry.message===issue2.message)??issue2,action);return void 0}};const signIn=options.signIn??signInOnce;const leaveToSignIn=()=>{setLeavingFor("sign_in");if(quote){writeSession(payKey,JSON.stringify({at:Date.now(),cart:cartIdentity(branchId,cart.lines,cart.promoCode),total:quote.total}))}if(!signIn(payPath(reviewPath))){removeSession(payKey);leaving.end();setError("sign_in_failed")}};const keepRecipient=change=>setRecipient(current=>{const next={...current,...change};writeSession(`${storageKey}.recipient`,JSON.stringify(next));return next});const redirect=options.redirect??(url=>redirectToCheckout(url,window.top??window));const attribution=options.attribution??currentSource;const openPayment=async()=>{setLeavingFor("payment");try{const prepared=attempt({payload:cart.actions.toCheckoutPayload(),branchId,contactPhone,contactName:forOther?recipient.name:"",returnUrl:`${location.origin}/checkout/return`,cancelUrl:`${location.origin}${reviewPath}`,attribution:attribution()});const session=await checkout.open(prepared.request,prepared.key);holdPerks(prepared.request.perk_redemption_ids,session);redirect(session.url)}catch(failure){if(failure instanceof CheckoutError&&failure.apiCode==="customer_required"){setSignInRequired(true);leaveToSignIn();return}leaving.end();if(failure instanceof CheckoutError&&failure.apiCode==="quote_issues"&&failure.param?.startsWith("customer.")){const key=failure.param.slice("customer.".length);setShown(current=>new Set([...current,key]));void cart.actions.quote({force:true}).catch(()=>void 0);return}setError("open_failed")}};const retry=async()=>{setFailedKey(void 0);try{await cart.actions.quote({force:true});setError(void 0)}catch(failure){if(!aborted(failure)){setFailedKey(quoteKey);setError("quote_failed")}}};const issue=status==="fix_issues"?firstIssue(cart.state):void 0;const activate=async()=>{setError(void 0);setNotice(void 0);switch(status){case"address":return{step:"address"};case"area":return{step:"area"};case"time":return{step:"time"};case"fix_issues":{const target=issue??issues[0];return target?{step:"issue",issue:target,target:issueSelector(target)}:void 0}case"phone":case"contact":setShown(current=>new Set([...current,...Object.keys(problems)]));return contactField?{step:"contact",field:contactField,target:fieldSelector(contactField)}:void 0;case"retry":await retry();return void 0;case"sign_in":countEvent("checkout");await leaving.start(leaveToSignIn);return void 0;case"pay":countEvent("checkout");await leaving.start(openPayment);return void 0;default:return void 0}};useEffect(()=>{const intent=paying.current;if(!intent||auth==="unknown"){return}if(auth==="authenticated"&&status!=="empty"&&(defaultsFor!==who||cart.state.status==="ready"||status==="checking"||status==="quoting"||status==="busy")){return}paying.current=void 0;if(auth==="anonymous"){return}const found=paymentNotice(intent,{cart:cartIdentity(branchId,cart.lines,cart.promoCode),total:quote?.total,status,issues});if(found){setNotice(found);return}countEvent("checkout");void leaving.start(openPayment)});return{mode,offers,choose,delivery,setDelivery,setAddress,setRegion,setNote,scheduledFor,schedule,timing,contact:{phone,contactPhone,setPhone:value=>{setPhoneState(value);writeSession(`${storageKey}.phone`,value)},accountPhone,fields:contactFields,held,values,setField:(key,value)=>{setValues(current=>{const next={...current,[key]:value};writeSession(`${storageKey}.contact`,JSON.stringify(next));return next})},recipient:mode==="dine_in"?void 0:{label:mode==="pickup"?"Collected by":"Deliver to",...recipient,setOn:on=>keepRecipient({on}),setName:name=>keepRecipient({name}),setPhone:value=>keepRecipient({phone:value})},problems,shown,show:key=>setShown(current=>current.has(key)?current:new Set([...current,key]))},auth,account,quote,pricing:cart.state.status==="quoting",held:heldQuote?timing.ahead?"time":"opening":void 0,issues,fix,error,clearError:()=>setError(void 0),notice,clearNotice:()=>setNotice(void 0),pay:{status,enabled:payEnabled(status),leavingFor:status==="busy"?leavingFor:void 0,issue,field:status==="phone"||status==="contact"?contactField:void 0,activate}}}export{useCheckoutFlow};
|
|
1
|
+
"use client";import{holdsForLater,isHeldQuote}from"@zappie/sdk";import{CheckoutError,createCheckout}from"@zappie/sdk/checkout";import{defaultRegion,prefillFulfilment,rememberAddress,rememberedAddress,watchCheckoutDefaults}from"@zappie/sdk/checkout-defaults";import{createCustomer}from"@zappie/sdk/customer";import{holdPerks}from"@zappie/sdk/loyalty";import{usePendingNavigation}from"@zappie/sdk/navigation/react";import{useCart}from"@zappie/sdk/react";import{redirectToCheckout}from"@zappie/sdk/redirect";import{countEvent,currentSource}from"@zappie/sdk/visits";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{createCheckoutAttempt}from"./attempt.js";import{businessContactFields,checkoutCustomer,contactProblems,fullPhone,recipientProblems}from"./contact.js";import{fieldSelector,issueSelector}from"./markers.js";import{checkoutOffers}from"./offers.js";import{cartIdentity,paymentNotice,payPath,takePaymentIntent}from"./pay-after-sign-in.js";import{signInOnce}from"./sign-in.js";import{checkoutStatus,firstIssue,isCheckoutFieldIssue,payEnabled}from"./status.js";import{checkoutTiming}from"./timing.js";function readSession(key){try{return window.sessionStorage.getItem(key)}catch{return null}}function writeSession(key,value){try{window.sessionStorage.setItem(key,value)}catch{}}function removeSession(key){try{window.sessionStorage.removeItem(key)}catch{}}var aborted=failure=>failure instanceof Error&&failure.name==="AbortError";var NO_FIELDS=[];var NO_VALUES={};var NO_RECIPIENT={on:false,name:"",phone:""};function profileValues(me){const values={};for(const[key,value]of[["given_name",me.given_name],["family_name",me.family_name],["email",me.email]]){if(value?.trim()){values[key]=value.trim()}}return values}var LISTED_BY_DEFAULT=["delivery","pickup"];var accountOf=person=>person?{name:person.given_name,phone:person.phone_masked}:void 0;function useCheckoutFlow(options){const{branch,menu,contactFields:givenFields=NO_FIELDS,reviewPath="/checkout",dialCode="+234",storageKey="zappie:checkout"}=options;const cart=useCart();const checkout=useMemo(()=>options.checkout??createCheckout(),[options.checkout]);const customer=useMemo(()=>options.customer??createCustomer(),[options.customer]);const owned=options.customer===void 0;const attempt=useMemo(()=>createCheckoutAttempt(),[]);const leaving=usePendingNavigation();const[auth,setAuth]=useState("unknown");const[who,setWho]=useState();const[account,setAccount]=useState();const[profile,setProfile]=useState();const[defaults,setDefaults]=useState();const[phone,setPhoneState]=useState("");const[values,setValues]=useState({});const[recipient,setRecipient]=useState(NO_RECIPIENT);const[shown,setShown]=useState(new Set);const[error,setError]=useState();const[signInRequired,setSignInRequired]=useState(false);const[leavingFor,setLeavingFor]=useState();const[failedKey,setFailedKey]=useState();const[notice,setNotice]=useState();const[defaultsFor,setDefaultsFor]=useState();const payKey=`${storageKey}.pay`;const paying=useRef(void 0);const payRead=useRef(false);useEffect(()=>{if(!payRead.current){payRead.current=true;paying.current=takePaymentIntent(payKey)}},[payKey]);const listed=options.offers??LISTED_BY_DEFAULT;const listedKey=listed.join();const offers=useMemo(()=>{const taken=checkoutOffers(branch,menu);return listed.filter(type=>taken.includes(type))},[branch,menu,listedKey]);const branchId=cart.branchId??branch.id;const fulfilment=cart.fulfilment;const[chosen,setChosen]=useState();const initial=options.initialMode&&offers.includes(options.initialMode)?options.initialMode:offers[0]??"pickup";const mode=chosen??(fulfilment&&offers.includes(fulfilment.type)?fulfilment.type:initial);const asking=options.checkoutFields!==void 0;const storeFieldsKey=asking?JSON.stringify(options.checkoutFields):"";const asked=useMemo(()=>asking?businessContactFields(options.checkoutFields,branchId,mode):givenFields,[asking,storeFieldsKey,branchId,mode,givenFields]);const holds=profile&&profile.of===who?profile.values:NO_VALUES;const held=asked.flatMap(field=>holds[field.key]?[{key:field.key,label:field.label,value:holds[field.key]}]:[]);const heldKey=held.map(entry=>entry.key).join();const contactFields=useMemo(()=>asked.filter(field=>!heldKey.split(",").includes(field.key)),[asked,heldKey]);const[pendingAt,setPendingAt]=useState();const delivery=mode==="delivery"&&fulfilment?.type==="delivery"?fulfilment:void 0;const scheduledFor=mode==="dine_in"?void 0:(fulfilment&&fulfilment.type!=="dine_in"&&fulfilment.type===mode?fulfilment.scheduledFor:void 0)??pendingAt;const latest=useRef(delivery);latest.current=delivery;useEffect(()=>{const ownerKey=`${storageKey}.owner`;const owner=readSession(ownerKey);if(owner&&owner!==who){if(who!==void 0){for(const key of[ownerKey,`${storageKey}.phone`,`${storageKey}.contact`,`${storageKey}.recipient`]){removeSession(key)}}setPhoneState("");setValues({});setRecipient(NO_RECIPIENT);return}if(who){writeSession(ownerKey,who)}setPhoneState(readSession(`${storageKey}.phone`)??"");try{setValues(JSON.parse(readSession(`${storageKey}.contact`)??"{}"))}catch{setValues({})}try{setRecipient({...NO_RECIPIENT,...JSON.parse(readSession(`${storageKey}.recipient`)??"{}")})}catch{setRecipient(NO_RECIPIENT)}},[storageKey,who]);const read=useRef({branch,fulfilment});read.current={branch,fulfilment};useEffect(()=>{const stopDefaults=watchCheckoutDefaults(customer,()=>read.current,next=>{setDefaults(next);setDefaultsFor(customer.state==="authenticated"?customer.customer?.id:customer.state==="anonymous"?null:void 0)});const stopAuth=customer.onChange((state,person)=>{setAuth(state);setAccount(state==="authenticated"?accountOf(person):void 0);setWho(state==="authenticated"?person?.id??void 0:state==="anonymous"?null:void 0)});void customer.session().then(current=>{setAuth(current?"authenticated":"anonymous");setAccount(accountOf(current));setWho(current?.id??null)},()=>{setAuth("anonymous");setAccount(void 0)});return()=>{stopDefaults();stopAuth();if(owned&&"dispose"in customer){customer.dispose()}}},[customer,owned]);const asksAny=asking&&asked.length>0;useEffect(()=>{if(!asksAny||!who){return}let current=true;customer.profile().then(me=>{if(current){setProfile({of:who,values:profileValues(me)})}},()=>void 0);return()=>{current=false}},[asksAny,who,customer]);useEffect(()=>{if(!cart.isHydrated||cart.lines.length===0||mode==="delivery"||fulfilment?.type===mode){return}cart.actions.setFulfilment(mode==="dine_in"?{type:"dine_in",branchId}:{type:"pickup",branchId,...pendingAt?{scheduledFor:pendingAt}:{}})},[branchId,cart.actions,cart.isHydrated,cart.lines.length,fulfilment?.type,mode,pendingAt]);const pendingDelivery=mode==="delivery"&&fulfilment?.type!=="delivery";useEffect(()=>{cart.actions.setPendingFulfilment(pendingDelivery?{type:"delivery",scheduledFor:pendingAt}:null)},[cart.actions,pendingDelivery,pendingAt]);const awaiting=useRef(false);const writeDelivery=useCallback((patch,at=scheduledFor)=>{const current=latest.current;const address=patch.address??current?.address;if(!address?.line1){return false}const regionId=defaultRegion(branch,patch.deliveryRegionId??current?.deliveryRegionId);const next={type:"delivery",branchId,address,...regionId?{deliveryRegionId:regionId}:{},...at?{scheduledFor:at}:{}};latest.current=next;awaiting.current=false;setChosen("delivery");cart.actions.setFulfilment(next);return true},[branch,branchId,cart.actions,scheduledFor]);const prefilled=useRef(void 0);useEffect(()=>{if(!cart.isHydrated||cart.lines.length===0){return}const filled=prefillFulfilment(fulfilment,branch);if(filled&&filled!==fulfilment){cart.actions.setFulfilment(filled);return}if(awaiting.current&&who!==void 0&&mode==="delivery"&&fulfilment?.type!=="delivery"){const known=rememberedAddress({customerId:who})??defaults?.address;if(known){writeDelivery({address:known})}return}const address=defaults?.address;if(mode==="delivery"&&!fulfilment&&address&&prefilled.current!==address){prefilled.current=address;writeDelivery({address})}},[branch,cart.actions,cart.isHydrated,cart.lines.length,defaults?.address,fulfilment,mode,who,writeDelivery]);const quoteKey=JSON.stringify([cart.lines,fulfilment,cart.promoCode]);const quoted=useRef("");useEffect(()=>{if(cart.isHydrated&&cart.lines.length>0&&cart.state.status==="ready"&"ed.current!==quoteKey){quoted.current=quoteKey;void cart.actions.quote().then(()=>{setFailedKey(void 0);setError(current=>current==="quote_failed"?void 0:current)},failure=>{if(!aborted(failure)){setFailedKey(quoteKey);setError("quote_failed")}})}},[cart.actions,cart.isHydrated,cart.lines.length,cart.state.status,quoteKey]);const timing=checkoutTiming(branch,menu,cart.lines,scheduledFor);const quote="quote"in cart.state?cart.state.quote:void 0;const heldQuote=isHeldQuote(quote);const unquotedTime=Boolean(scheduledFor)&&!quote?.fulfilment?.scheduledFor;const issues=useMemo(()=>{const cartIssues=cart.issues.filter(issue2=>!isCheckoutFieldIssue(issue2));return timing.ahead?unquotedTime?cartIssues.filter(issue2=>!holdsForLater(issue2)):cartIssues:cartIssues.map(issue2=>holdsForLater(issue2)?{...issue2,fixes:issue2.fixes.filter(entry=>entry.action!=="schedule")}:issue2)},[cart.issues,timing.ahead,unquotedTime]);const accountPhone=defaults?.phone.fromAccount?defaults.phone.display:void 0;const forOther=mode!=="dine_in"&&recipient.on;const problems=contactProblems(contactFields,values,phone,accountPhone,dialCode);if(forOther){delete problems.phone;Object.assign(problems,recipientProblems(recipient,dialCode))}const quotedField=cart.issues.map(issue2=>isCheckoutFieldIssue(issue2)?issue2.data?.field:void 0).find(field=>typeof field==="string");const contactField=Object.keys(problems)[0]??quotedField;const sending=asking?checkoutCustomer(contactFields,values):null;const sendingKey=JSON.stringify(sending);useEffect(()=>{if(asking){cart.actions.setCustomer(sending)}},[asking,sendingKey,cart.actions]);const contactPhone=forOther?fullPhone(recipient.phone,dialCode):phone.trim()?fullPhone(phone,dialCode):"";const status=checkoutStatus({busy:leaving.pending,hydrated:cart.isHydrated,lines:cart.lines.length,auth,closed:timing.closed,needsAddress:mode==="delivery"&&!delivery?.address.line1,needsTime:mode!=="dine_in"&&timing.needsTime,state:cart.state,quoteFailed:failedKey===quoteKey,signInRequired,contactField});const shopper=()=>customer.state==="authenticated"?customer.customer?.id??void 0:customer.state==="anonymous"?null:void 0;const choose=type=>{setChosen(type);awaiting.current=false;if(type==="delivery"&&fulfilment?.type!=="delivery"){setPendingAt(scheduledFor);const owner=shopper();const known=(owner===void 0?void 0:rememberedAddress({customerId:owner}))??defaults?.address;if(known){writeDelivery({address:known},scheduledFor);return void 0}awaiting.current=true;return{step:"address"}}return void 0};const setDelivery=(change,{remember=true}={})=>{const base=change.address??latest.current?.address;if(!base?.line1){return{step:"address"}}const typed=change.note??change.address?.instructions??latest.current?.address.instructions;const{instructions:_old,...rest}=base;const note=typed?.trim();writeDelivery({address:note?{...rest,instructions:note}:rest,...change.regionId!==void 0?{deliveryRegionId:change.regionId}:{}});const owner=shopper();if(change.address&&remember&&owner!==void 0){rememberAddress(change.address,void 0,owner)}return void 0};const setAddress=(address,options2={})=>{setDelivery({address},options2)};const setRegion=regionId=>latest.current?setDelivery({regionId}):{step:"address"};const setNote=note=>latest.current?setDelivery({note}):{step:"address"};const schedule=at=>{setPendingAt(at??void 0);if(!fulfilment||fulfilment.type==="dine_in"||fulfilment.type!==mode){return}const{scheduledFor:_old,...rest}=fulfilment;cart.actions.setFulfilment(at?{...rest,scheduledFor:at}:rest)};const fix=(issue2,action)=>{setError(void 0);switch(action.action){case"change_address":return{step:"address"};case"choose_region":return{step:"area"};case"schedule":return{step:"time"};case"switch_fulfilment":{const next=action.types.find(type=>type!==mode&&offers.includes(type))??(mode==="delivery"?"pickup":"delivery");return choose(next)}case"choose_option":case"choose_other_option":{const line=cart.lines.find(entry=>entry.id===issue2.lineId);return line?{step:"item",itemId:line.itemId,lineId:line.id}:void 0}default:cart.actions.applyFix(cart.issues.find(entry=>entry.code===issue2.code&&entry.lineId===issue2.lineId&&entry.message===issue2.message)??issue2,action);return void 0}};const signIn=options.signIn??signInOnce;const leaveToSignIn=()=>{setLeavingFor("sign_in");if(quote){writeSession(payKey,JSON.stringify({at:Date.now(),cart:cartIdentity(branchId,cart.lines,cart.promoCode),total:quote.total}))}if(!signIn(payPath(reviewPath))){removeSession(payKey);leaving.end();setError("sign_in_failed")}};const keepRecipient=change=>setRecipient(current=>{const next={...current,...change};writeSession(`${storageKey}.recipient`,JSON.stringify(next));return next});const redirect=options.redirect??(url=>redirectToCheckout(url,window.top??window));const attribution=options.attribution??currentSource;const openPayment=async()=>{setLeavingFor("payment");try{const prepared=attempt({payload:cart.actions.toCheckoutPayload(),branchId,contactPhone,contactName:forOther?recipient.name:"",returnUrl:`${location.origin}/checkout/return`,cancelUrl:`${location.origin}${reviewPath}`,attribution:attribution()});const session=await checkout.open(prepared.request,prepared.key);holdPerks(prepared.request.perk_redemption_ids,session);redirect(session.url)}catch(failure){if(failure instanceof CheckoutError&&failure.apiCode==="customer_required"){setSignInRequired(true);leaveToSignIn();return}leaving.end();if(failure instanceof CheckoutError&&failure.apiCode==="quote_issues"&&failure.param?.startsWith("customer.")){const key=failure.param.slice("customer.".length);setShown(current=>new Set([...current,key]));void cart.actions.quote({force:true}).catch(()=>void 0);return}setError("open_failed")}};const retry=async()=>{setFailedKey(void 0);try{await cart.actions.quote({force:true});setError(void 0)}catch(failure){if(!aborted(failure)){setFailedKey(quoteKey);setError("quote_failed")}}};const issue=status==="fix_issues"?firstIssue(cart.state):void 0;const activate=async()=>{setError(void 0);setNotice(void 0);switch(status){case"address":return{step:"address"};case"area":return{step:"area"};case"time":return{step:"time"};case"fix_issues":{const target=issue??issues[0];return target?{step:"issue",issue:target,target:issueSelector(target)}:void 0}case"phone":case"contact":setShown(current=>new Set([...current,...Object.keys(problems)]));return contactField?{step:"contact",field:contactField,target:fieldSelector(contactField)}:void 0;case"retry":await retry();return void 0;case"sign_in":countEvent("checkout");await leaving.start(leaveToSignIn);return void 0;case"pay":countEvent("checkout");await leaving.start(openPayment);return void 0;default:return void 0}};useEffect(()=>{const intent=paying.current;if(!intent||auth==="unknown"){return}if(auth==="authenticated"&&status!=="empty"&&(defaultsFor!==who||cart.state.status==="ready"||status==="checking"||status==="quoting"||status==="busy")){return}paying.current=void 0;if(auth==="anonymous"){return}const found=paymentNotice(intent,{cart:cartIdentity(branchId,cart.lines,cart.promoCode),total:quote?.total,status,issues});if(found){setNotice(found);return}countEvent("checkout");void leaving.start(openPayment)});return{mode,offers,choose,delivery,setDelivery,setAddress,setRegion,setNote,scheduledFor,schedule,timing,contact:{phone,contactPhone,setPhone:value=>{setPhoneState(value);writeSession(`${storageKey}.phone`,value)},accountPhone,fields:contactFields,held,values,setField:(key,value)=>{setValues(current=>{const next={...current,[key]:value};writeSession(`${storageKey}.contact`,JSON.stringify(next));return next})},recipient:mode==="dine_in"?void 0:{label:mode==="pickup"?"Collected by":"Deliver to",...recipient,setOn:on=>keepRecipient({on}),setName:name=>keepRecipient({name}),setPhone:value=>keepRecipient({phone:value})},problems,shown,show:key=>setShown(current=>current.has(key)?current:new Set([...current,key]))},auth,account,quote,pricing:cart.state.status==="quoting",held:heldQuote?timing.ahead?"time":"opening":void 0,issues,fix,error,clearError:()=>setError(void 0),notice,clearNotice:()=>setNotice(void 0),pay:{status,enabled:payEnabled(status),leavingFor:status==="busy"?leavingFor:void 0,issue,field:status==="phone"||status==="contact"?contactField:void 0,activate}}}export{useCheckoutFlow};
|
|
2
2
|
//# sourceMappingURL=use-checkout-flow.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/checkout/use-checkout-flow.ts"],
|
|
4
|
-
"mappings": "aACA,OACE,cACA,gBASK,cACP,OACE,cACA,mBAEK,uBACP,OACE,cACA,kBACA,gBACA,kBACA,0BAEK,gCACP,OAAS,mBAA2C,uBACpD,OAAS,cAAiB,sBAC1B,OAAS,yBAA4B,+BACrC,OAAS,YAAe,oBACxB,OAAS,uBAA0B,uBACnC,OAAS,WAAY,kBAAqB,qBAC1C,OAAS,YAAa,UAAW,QAA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,CAAE,EAAG,CAAC,EAC5C,QAAU,MAAiB,cAAc,CAAE,IAAK,CAAC,EACjD,SAAW,OAAkB,cAAc,CAAE,MAAO,KAAM,CAAC,CAC7D,EACN,SACA,MACA,KAAO,KACL,SAAU,SACR,QAAQ,IAAI,GAAG,EAAI,QAAU,IAAI,IAAI,CAAC,GAAG,QAAS,GAAG,CAAC,CACxD,CACJ,EACA,KACA,QACA,MACA,QAAS,KAAK,MAAM,SAAW,UAC/B,KAAM,UAAa,OAAO,MAAQ,OAAS,UAAa,OACxD,OACA,IACA,MACA,WAAY,IAAM,SAAS,MAAS,EACpC,OACA,YAAa,IAAM,UAAU,MAAS,EACtC,IAAK,CACH,OACA,QAAS,WAAW,MAAM,EAC1B,WAAY,SAAW,OAAS,WAAa,OAC7C,MACA,MACE,SAAW,SAAW,SAAW,UAAY,aAAe,OAC9D,QACF,CACF,CACF",
|
|
5
5
|
"names": ["issue", "options"]
|
|
6
6
|
}
|
|
@@ -139,7 +139,7 @@ declare function pinnedFirst(countries: readonly PhoneCountry[], pinned: readonl
|
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* Every country a phone field can take, A to Z by name. The four markets carry their own number
|
|
142
|
-
* rules
|
|
142
|
+
* rules. Everyone else is read by the general E.164 rules.
|
|
143
143
|
*/
|
|
144
144
|
declare const PHONE_COUNTRIES: readonly PhoneCountry[];
|
|
145
145
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1039,7 +1039,7 @@ type ZappieSupportContext = {
|
|
|
1039
1039
|
page?: string | undefined;
|
|
1040
1040
|
};
|
|
1041
1041
|
/**
|
|
1042
|
-
* A
|
|
1042
|
+
* A chat link to Zappie support, for a shopper with a problem such as a payment. The message
|
|
1043
1043
|
* starts with "Hi Zappie support," and names the store, branch, order and page it is given, so
|
|
1044
1044
|
* support can find them.
|
|
1045
1045
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { r as PHONE_COUNTRIES, s as dialCodeFor, u as findPhoneCountry, v as splitE164, w as typingDialCode } from '../countries-
|
|
1
|
+
export { r as PHONE_COUNTRIES, s as dialCodeFor, u as findPhoneCountry, v as splitE164, w as typingDialCode } from '../countries-BLeLfxnY.js';
|
package/dist/phone/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as __countries, P as PhoneCountry, a as PhoneCheck, b as PhoneCountryCode } from '../countries-
|
|
2
|
-
export { c as PHONE_MARKETS, d as PhoneMarketCode, e as countryFlag, f as flagEmojiRenders, g as formatNational, h as generalGroups, i as hasDialPrefix, j as internationalDigits, m as marketCountry, k as maxNationalDigits, n as nationalDigits, l as normalisePhone, p as phoneCheck, o as phoneProblem, q as pinnedFirst, t as toE164 } from '../countries-
|
|
1
|
+
import { _ as __countries, P as PhoneCountry, a as PhoneCheck, b as PhoneCountryCode } from '../countries-BLeLfxnY.js';
|
|
2
|
+
export { c as PHONE_MARKETS, d as PhoneMarketCode, e as countryFlag, f as flagEmojiRenders, g as formatNational, h as generalGroups, i as hasDialPrefix, j as internationalDigits, m as marketCountry, k as maxNationalDigits, n as nationalDigits, l as normalisePhone, p as phoneCheck, o as phoneProblem, q as pinnedFirst, t as toE164 } from '../countries-BLeLfxnY.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
|
|
5
5
|
/** The full country list and the readings that need it, from `@zappie/foundations/phone/countries`. */
|
|
@@ -71,7 +71,7 @@ type PhoneField = {
|
|
|
71
71
|
/**
|
|
72
72
|
* A phone number from any country, with no markup: the country, the national digits grouped as
|
|
73
73
|
* typed, and E.164 out. A number typed or pasted with its own code, such as `+44 7911 123456`,
|
|
74
|
-
* moves to its country. The four markets are known at once
|
|
74
|
+
* moves to its country. The four markets are known at once. Every other country loads on its
|
|
75
75
|
* own the first time the field calls `load`, or reads a number with a code it doesn't know.
|
|
76
76
|
*
|
|
77
77
|
* @param options - The value, the change callback and the starting country.
|
|
@@ -96,7 +96,7 @@ declare const countryMark: (code: string, flags: boolean) => string;
|
|
|
96
96
|
/**
|
|
97
97
|
* The country part of a phone field, with no styles. With a mouse or trackpad it is a button
|
|
98
98
|
* that opens a searchable list of every country (a combobox, loaded the first time the shopper
|
|
99
|
-
* points at or focuses the button)
|
|
99
|
+
* points at or focuses the button). On touch it is the platform's own select, whose picker
|
|
100
100
|
* is better there. Both show the pinned countries first. Elements carry `data-phone-*`
|
|
101
101
|
* attributes for styling.
|
|
102
102
|
*/
|
|
@@ -36,7 +36,7 @@ type ClosedPageOptions = {
|
|
|
36
36
|
*/
|
|
37
37
|
declare function closedPageData(store: Store, closed: SiteClosed, { copy, title, branches, hours, }?: ClosedPageOptions): ClosedPageData;
|
|
38
38
|
|
|
39
|
-
/** The Worker's variables a site reads. Zappie hosting sets them
|
|
39
|
+
/** The Worker's variables a site reads. Zappie hosting sets them, and a self-hosted site sets them on its Worker. */
|
|
40
40
|
type SiteEnv = {
|
|
41
41
|
ZAPPIE_API?: string;
|
|
42
42
|
ZAPPIE_KEY?: string;
|
|
@@ -106,7 +106,7 @@ type ServerClient<Env extends SiteEnv = SiteEnv> = {
|
|
|
106
106
|
/**
|
|
107
107
|
* The site's `serverClient(context, request)` for loaders: a Zappie client for the request, made once per load
|
|
108
108
|
* context. The live site reads the store and its menus through the Worker's edge cache, for as long as the API's own
|
|
109
|
-
* `Cache-Control` allows
|
|
109
|
+
* `Cache-Control` allows. A draft, a review and `ZAPPIE_EDGE_CACHE=off` read afresh, so each saved change shows. Each
|
|
110
110
|
* API call names the shopper's origin, and the customer API goes through the site host's `/_zappie/api`, which adds
|
|
111
111
|
* the signed-in shopper.
|
|
112
112
|
*
|
|
@@ -147,10 +147,10 @@ type DocumentHandlerOptions = {
|
|
|
147
147
|
* headers, and sets the cache headers from the site's rules:
|
|
148
148
|
*
|
|
149
149
|
* - a page a shared cache may keep, the closed page, a crawler's page and SPA mode render in full before the headers
|
|
150
|
-
* go out, so an error after the shell can still make the page private
|
|
151
|
-
* - a page that errored, sets a cookie, is a preview or whose deferred data failed is private
|
|
150
|
+
* go out, so an error after the shell can still make the page private.
|
|
151
|
+
* - a page that errored, sets a cookie, is a preview or whose deferred data failed is private.
|
|
152
152
|
* - a route that exports its own `headers()` keeps its `Cache-Control`, unless the response sets a cookie or the
|
|
153
|
-
* page errored
|
|
153
|
+
* page errored.
|
|
154
154
|
* - a shared menu page gets a weak ETag of its menu version, its store details and the deploy.
|
|
155
155
|
*
|
|
156
156
|
* @example
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var PACKAGE_VERSION=true?"0.
|
|
1
|
+
var PACKAGE_VERSION=true?"0.28.1":"0.0.0-development";export{PACKAGE_VERSION};
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zappie/foundations",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "UI-less React primitives for Zappie storefronts: behaviour, state and accessibility without styles.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"react": "^18.2.0 || ^19.0.0",
|
|
103
103
|
"react-dom": "^18.2.0 || ^19.0.0",
|
|
104
|
-
"@zappie/sdk": "^0.
|
|
104
|
+
"@zappie/sdk": "^0.28.1",
|
|
105
105
|
"react-router": "^8.4.0"
|
|
106
106
|
},
|
|
107
107
|
"peerDependenciesMeta": {
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@types/google.maps": "^3.66.7",
|
|
119
119
|
"esbuild": "^0.28.2",
|
|
120
120
|
"react-router": "8.5.0",
|
|
121
|
-
"@zappie/sdk": "0.
|
|
121
|
+
"@zappie/sdk": "0.28.1"
|
|
122
122
|
},
|
|
123
123
|
"license": "MIT",
|
|
124
124
|
"homepage": "https://github.com/zappie/storefront-packages#readme",
|