# Franchise
- Create a new homepage app which would be multi-tenanted, multi-language and muilti-currency.
- Standardise locale cookies so they can be used server side, client side and on the router.
- Implement new locale cookies in legacy solution (move away from languageid implementation)
- Use existing order process on the existing url (parcel2go.com/order). Cookies would be used to determine locale & currency (website).
- Allow multiple different redirection schemes (so whitelabel are not locked to how we do things).
- If there are SEO pages which we want to make multi-locale then they would have to be routed (either app router or asp routing) or migrated to react.
- Anything which uses the legacy solution will be slow due to hosting in Ireland limitations.
- new order process will fix this
# New Homepage App
Create a new homepage app.
## Requirements
- Use style system and components
- New quick quote components
- New locale components
- Implement cookie rules
- Cacheable - improves speed when accessing from other edge locations (australia!)
- May need an additional API if we don't have everything needed in the id_token
- SSR?
# Redirection Rules
```flow
st=>start: New Request
e=>end: Homepage
redirect=>end: Redirect
clocale=>condition: locale endpoint(eg /en-aud)?
opsetcookie2=>operation: Set cookies
opsetcookie=>operation: Set cookies
locale=X-Y
opdorigin=>operation: determine origin
& set cookies
crequireredirect=>condition: requires redirect?
chascookies=>condition: has locale cookies?
st->clocale
clocale(yes)->opsetcookie->e
clocale(no)->chascookies
crequireredirect(no)->e
chascookies(yes)->crequireredirect
chascookies(no)->opdorigin->crequireredirect
crequireredirect(yes)->redirect
```
- Going directly to a locale page will overwrite any existing cookies.
- /en-gb would set cookies and redirect back to / to allow site switcher functionality).
- for cache and SEO reasons if we want to support the UK site in any other language, the other language would have to be a locale endpoint. Eg (www.parcel2go.com/es-gb)
- Rules above can be implemented server side and client side.
- Redirect can be replaced with a prompt if we don't want to do it automatically.
### Redirection Options
We should be able to support all of the following redirection flows :
- optimistic redirect - do a best guess at the user locale (cf headers/ locale header / ip/etc) and redirect to the locale homepage with a notice that we redirect and allow user to override.
- do nothing but notify - don't do any automatic redirect but show a notice that we think they should use the locale site.
- always ask - redirect to a dedicated locale selection site then redirect to selected site
Going directly a locale endpoint should do no automatic redirects.
### Determine Origin
There are several ways to determine the best locale site to show. We should implement both a server side and client side solution.
- Cloudfront Headers - There is a header available with the edge server location
- Cloudflare headers
- Browser Locale
- IP
# Quote Results
We can keep the quote results on /quotes as the page is not indexed.
## Requirements
- Support the new cookie standards for locale
- May need to migrate to using our localisation framework /style system. Or setup a deploy for each language/currency combo?
- v4 Quote API used may need to be made multi-currency/language
# Integration into legacy solution
- Switch to use the the same cookies to determine the locale.
- If we want to use the existing CMS it may need tweaks so it can be indexed in multiple languages on different urls.
- If the franchisee will have access to this cms then we need to review security here as there are no permissions.
# Routing Rules
- www.parcel2go.com
- www.parcel2go.com/en-aud
## Examaples
www.parcel2go.com from Australia
- No Cookies
- origin = aus
- locale = en
- redirect = /en-aus
www.parcel2go.com from UK
- No cookies
- origin = gb
- locale = en
- redirect = (no redirect)
# Other Considerations
- We would need to add meta language and alternative tags to all indexed pages
- Add language/site switcher to the header/footer
- We would need to support multi language in the site map
- Existing CMS would need extra functionality
- Use local language as the fallback for unsupported languages (eg: en for gb).
- Will the franchisee have CRM access?
- How will we lock this down?
- **NOPE**
- make sure we buy the tlds so we don't get squatters (www.parcel2go.com.au)
- switching locale/currency mid order process
- prepay in multiple different currencies
- Multi currency/language Emails
- need a hint so we can link to the correct website (or assume they have the correct cookies)
- Underpayments would need to be multi-currency
- Need to determine how we do exchange rates for aggregate reporting.
- recommend fixing exchange rates by year
- Multiple reports in the crm would need updating to be multi-currency/website aware
- Banners need to be language/currency aware
- lets get rid of them?
- Would we roll this out on the mobile app?
- api changes required
- Analytics would need to be currency aware
- global variable stuff would need tweaks
- Service/courier logos needs to be multi-language
- This could already be built into the cdn?
- Does Prohib items need any tweaks? It must already work for p2g/es?
- Would stored cards be cross locale?
- **YES**
- Who would get the currency conversion fee?
- Data regulations in other countries
- Do we categorise customers as franchise customers so we can treat them differently?
- what if they place orders on multiple sites & franchises (shared ownership? fifo?)
- Would we have seperate email templates for each franchise?
- doesn't scale?