@simonarcher/fika-types 1.0.87 → 1.0.89
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/dist/currencyUtils.d.ts +10 -0
- package/dist/currencyUtils.js +85 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/shop.d.ts +33 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps ISO 3166-1 alpha-2 country codes to ISO 4217 currency codes
|
|
3
|
+
* Used to automatically determine currency for shops based on their country code
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Gets the currency code for a given country code
|
|
7
|
+
* @param countryCode ISO 3166-1 alpha-2 country code (e.g., "NL", "US", "ZA")
|
|
8
|
+
* @returns ISO 4217 currency code (e.g., "EUR", "USD", "ZAR"), defaults to "EUR" if not found
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCurrencyFromCountryCode(countryCode: string | undefined | null): string;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Maps ISO 3166-1 alpha-2 country codes to ISO 4217 currency codes
|
|
4
|
+
* Used to automatically determine currency for shops based on their country code
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getCurrencyFromCountryCode = getCurrencyFromCountryCode;
|
|
8
|
+
const COUNTRY_TO_CURRENCY = {
|
|
9
|
+
// Eurozone countries
|
|
10
|
+
NL: 'EUR', // Netherlands
|
|
11
|
+
BE: 'EUR', // Belgium
|
|
12
|
+
DE: 'EUR', // Germany
|
|
13
|
+
FR: 'EUR', // France
|
|
14
|
+
IT: 'EUR', // Italy
|
|
15
|
+
ES: 'EUR', // Spain
|
|
16
|
+
PT: 'EUR', // Portugal
|
|
17
|
+
AT: 'EUR', // Austria
|
|
18
|
+
FI: 'EUR', // Finland
|
|
19
|
+
IE: 'EUR', // Ireland
|
|
20
|
+
GR: 'EUR', // Greece
|
|
21
|
+
LU: 'EUR', // Luxembourg
|
|
22
|
+
MT: 'EUR', // Malta
|
|
23
|
+
CY: 'EUR', // Cyprus
|
|
24
|
+
SK: 'EUR', // Slovakia
|
|
25
|
+
SI: 'EUR', // Slovenia
|
|
26
|
+
EE: 'EUR', // Estonia
|
|
27
|
+
LV: 'EUR', // Latvia
|
|
28
|
+
LT: 'EUR', // Lithuania
|
|
29
|
+
HR: 'EUR', // Croatia
|
|
30
|
+
// Major coffee shop countries
|
|
31
|
+
US: 'USD', // United States
|
|
32
|
+
ZA: 'ZAR', // South Africa
|
|
33
|
+
GB: 'GBP', // United Kingdom
|
|
34
|
+
UK: 'GBP', // United Kingdom (alternative code)
|
|
35
|
+
AU: 'AUD', // Australia
|
|
36
|
+
CA: 'CAD', // Canada
|
|
37
|
+
JP: 'JPY', // Japan
|
|
38
|
+
CH: 'CHF', // Switzerland
|
|
39
|
+
SE: 'SEK', // Sweden
|
|
40
|
+
NO: 'NOK', // Norway
|
|
41
|
+
DK: 'DKK', // Denmark
|
|
42
|
+
PL: 'PLN', // Poland
|
|
43
|
+
CZ: 'CZK', // Czech Republic
|
|
44
|
+
NZ: 'NZD', // New Zealand
|
|
45
|
+
SG: 'SGD', // Singapore
|
|
46
|
+
HK: 'HKD', // Hong Kong
|
|
47
|
+
KR: 'KRW', // South Korea
|
|
48
|
+
CN: 'CNY', // China
|
|
49
|
+
IN: 'INR', // India
|
|
50
|
+
BR: 'BRL', // Brazil
|
|
51
|
+
MX: 'MXN', // Mexico
|
|
52
|
+
AR: 'ARS', // Argentina
|
|
53
|
+
CL: 'CLP', // Chile
|
|
54
|
+
CO: 'COP', // Colombia
|
|
55
|
+
PE: 'PEN', // Peru
|
|
56
|
+
TH: 'THB', // Thailand
|
|
57
|
+
MY: 'MYR', // Malaysia
|
|
58
|
+
ID: 'IDR', // Indonesia
|
|
59
|
+
PH: 'PHP', // Philippines
|
|
60
|
+
VN: 'VND', // Vietnam
|
|
61
|
+
TW: 'TWD', // Taiwan
|
|
62
|
+
TR: 'TRY', // Turkey
|
|
63
|
+
IL: 'ILS', // Israel
|
|
64
|
+
AE: 'AED', // United Arab Emirates
|
|
65
|
+
SA: 'SAR', // Saudi Arabia
|
|
66
|
+
RU: 'RUB', // Russia
|
|
67
|
+
IS: 'ISK', // Iceland
|
|
68
|
+
HU: 'HUF', // Hungary
|
|
69
|
+
RO: 'RON', // Romania
|
|
70
|
+
BG: 'BGN', // Bulgaria
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Gets the currency code for a given country code
|
|
74
|
+
* @param countryCode ISO 3166-1 alpha-2 country code (e.g., "NL", "US", "ZA")
|
|
75
|
+
* @returns ISO 4217 currency code (e.g., "EUR", "USD", "ZAR"), defaults to "EUR" if not found
|
|
76
|
+
*/
|
|
77
|
+
function getCurrencyFromCountryCode(countryCode) {
|
|
78
|
+
if (!countryCode) {
|
|
79
|
+
return 'EUR'; // Default to EUR
|
|
80
|
+
}
|
|
81
|
+
// Normalize to uppercase for lookup
|
|
82
|
+
const normalizedCode = countryCode.toUpperCase().trim();
|
|
83
|
+
// Return mapped currency or default to EUR
|
|
84
|
+
return COUNTRY_TO_CURRENCY[normalizedCode] || 'EUR';
|
|
85
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -42,3 +42,5 @@ __exportStar(require("./rewards"), exports);
|
|
|
42
42
|
__exportStar(require("./shopAnalytics"), exports);
|
|
43
43
|
// Export all shop correction-related types
|
|
44
44
|
__exportStar(require("./shopCorrections"), exports);
|
|
45
|
+
// Export currency utilities
|
|
46
|
+
__exportStar(require("./currencyUtils"), exports);
|
package/dist/shop.d.ts
CHANGED
|
@@ -143,6 +143,37 @@ export type ShopOpeningTimes = {
|
|
|
143
143
|
close: string;
|
|
144
144
|
};
|
|
145
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* Franchise/Chain type for managing multiple shop locations
|
|
148
|
+
* with shared branding, roasters, features, and menu items
|
|
149
|
+
*/
|
|
150
|
+
export interface Franchise {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
logoImage?: string;
|
|
155
|
+
coverImage?: string;
|
|
156
|
+
roasterRefs?: RoasterRef[];
|
|
157
|
+
roasterRefsIds?: string[];
|
|
158
|
+
sharedFeatures?: Partial<Record<ShopFeatureKey, boolean | null>>;
|
|
159
|
+
sharedSpecialties?: ShopSpecialtyKey[];
|
|
160
|
+
menu?: MenuItem[];
|
|
161
|
+
totalLocations?: number;
|
|
162
|
+
countryCode?: string;
|
|
163
|
+
website?: string;
|
|
164
|
+
socials?: SocialMedia;
|
|
165
|
+
createdAt: AdminTimestamp;
|
|
166
|
+
updatedAt: AdminTimestamp;
|
|
167
|
+
createdBy?: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Denormalized franchise reference for quick access in shop data
|
|
171
|
+
*/
|
|
172
|
+
export interface FranchiseRef {
|
|
173
|
+
id: string;
|
|
174
|
+
name: string;
|
|
175
|
+
logoImage?: string;
|
|
176
|
+
}
|
|
146
177
|
export type ShopData = {
|
|
147
178
|
id: string;
|
|
148
179
|
active: boolean;
|
|
@@ -163,6 +194,8 @@ export type ShopData = {
|
|
|
163
194
|
logoImage?: string;
|
|
164
195
|
addedByUser?: string;
|
|
165
196
|
ownerId?: string;
|
|
197
|
+
franchiseId?: string;
|
|
198
|
+
franchiseRef?: FranchiseRef;
|
|
166
199
|
platformLoyaltyRewards?: {
|
|
167
200
|
hasPlatformLoyaltyRewards?: boolean;
|
|
168
201
|
stampsRequired?: number;
|