@churchapps/helpers 1.2.14 → 1.2.15
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/cjs/CurrencyHelper.d.ts +3 -0
- package/dist/cjs/CurrencyHelper.d.ts.map +1 -1
- package/dist/cjs/CurrencyHelper.js +51 -0
- package/dist/cjs/CurrencyHelper.js.map +1 -1
- package/dist/esm/CurrencyHelper.d.ts +3 -0
- package/dist/esm/CurrencyHelper.d.ts.map +1 -1
- package/dist/esm/CurrencyHelper.js +51 -0
- package/dist/esm/CurrencyHelper.js.map +1 -1
- package/package.json +1 -1
- package/src/CurrencyHelper.ts +56 -0
- package/src/interfaces/Lessons.ts +61 -61
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare class CurrencyHelper {
|
|
2
2
|
static formatCurrency(amount: number): string;
|
|
3
|
+
static formatCurrencyWithLocale(amount: number, currency?: string): string;
|
|
4
|
+
static getCurrencySymbol(currency?: string): any;
|
|
5
|
+
private static getLocaleForCurrency;
|
|
3
6
|
}
|
|
4
7
|
//# sourceMappingURL=CurrencyHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyHelper.d.ts","sourceRoot":"","sources":["../../src/CurrencyHelper.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"CurrencyHelper.d.ts","sourceRoot":"","sources":["../../src/CurrencyHelper.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM;IASpC,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAc;IAYxE,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM;IAsB1C,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAqBpC"}
|
|
@@ -10,6 +10,57 @@ class CurrencyHelper {
|
|
|
10
10
|
});
|
|
11
11
|
return formatter.format(amount);
|
|
12
12
|
}
|
|
13
|
+
static formatCurrencyWithLocale(amount, currency = "USD") {
|
|
14
|
+
const normalizedCurrency = currency.toUpperCase();
|
|
15
|
+
const locale = this.getLocaleForCurrency(normalizedCurrency);
|
|
16
|
+
const formatter = new Intl.NumberFormat(locale, {
|
|
17
|
+
style: "currency",
|
|
18
|
+
currency: normalizedCurrency,
|
|
19
|
+
minimumFractionDigits: 2,
|
|
20
|
+
});
|
|
21
|
+
return formatter.format(amount);
|
|
22
|
+
}
|
|
23
|
+
static getCurrencySymbol(currency) {
|
|
24
|
+
const normalizedCurrency = currency?.toLowerCase() || "usd";
|
|
25
|
+
const stripeCurrencyFees = {
|
|
26
|
+
usd: { percent: 2.9, fixed: 0.3, symbol: "$" },
|
|
27
|
+
eur: { percent: 2.9, fixed: 0.25, symbol: "€" },
|
|
28
|
+
gbp: { percent: 2.9, fixed: 0.2, symbol: "£" },
|
|
29
|
+
cad: { percent: 2.9, fixed: 0.3, symbol: "$" },
|
|
30
|
+
aud: { percent: 2.9, fixed: 0.3, symbol: "$" },
|
|
31
|
+
inr: { percent: 2.9, fixed: 3.0, symbol: "₹" },
|
|
32
|
+
jpy: { percent: 2.9, fixed: 30.0, symbol: "¥" },
|
|
33
|
+
sgd: { percent: 2.9, fixed: 0.5, symbol: "S$" },
|
|
34
|
+
hkd: { percent: 2.9, fixed: 2.35, symbol: "元" },
|
|
35
|
+
sek: { percent: 2.9, fixed: 2.5, symbol: "kr" },
|
|
36
|
+
nok: { percent: 2.9, fixed: 2.0, symbol: "kr" },
|
|
37
|
+
dkk: { percent: 2.9, fixed: 1.8, symbol: "kr" },
|
|
38
|
+
chf: { percent: 2.9, fixed: 0.3, symbol: "CHF" },
|
|
39
|
+
mxn: { percent: 2.9, fixed: 3.0, symbol: "MXN" },
|
|
40
|
+
brl: { percent: 3.9, fixed: 0.5, symbol: "R$" },
|
|
41
|
+
};
|
|
42
|
+
return stripeCurrencyFees[normalizedCurrency]?.symbol || "$";
|
|
43
|
+
}
|
|
44
|
+
static getLocaleForCurrency(currency) {
|
|
45
|
+
const currencyLocaleMap = {
|
|
46
|
+
USD: "en-US",
|
|
47
|
+
EUR: "en-GB",
|
|
48
|
+
GBP: "en-GB",
|
|
49
|
+
CAD: "en-CA",
|
|
50
|
+
AUD: "en-AU",
|
|
51
|
+
INR: "en-IN",
|
|
52
|
+
JPY: "ja-JP",
|
|
53
|
+
SGD: "en-SG",
|
|
54
|
+
HKD: "en-HK",
|
|
55
|
+
SEK: "sv-SE",
|
|
56
|
+
NOK: "nb-NO",
|
|
57
|
+
DKK: "da-DK",
|
|
58
|
+
CHF: "de-CH",
|
|
59
|
+
MXN: "es-MX",
|
|
60
|
+
BRL: "pt-BR",
|
|
61
|
+
};
|
|
62
|
+
return currencyLocaleMap[currency] || "en-US";
|
|
63
|
+
}
|
|
13
64
|
}
|
|
14
65
|
exports.CurrencyHelper = CurrencyHelper;
|
|
15
66
|
//# sourceMappingURL=CurrencyHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyHelper.js","sourceRoot":"","sources":["../../src/CurrencyHelper.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAc;QAClC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YAC/C,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,KAAK;YACf,qBAAqB,EAAE,CAAC;SACzB,CAAC,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"CurrencyHelper.js","sourceRoot":"","sources":["../../src/CurrencyHelper.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAc;QAClC,MAAM,SA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GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;SACb,CAAC;QAEF,OAAO,iBAAiB,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC;IAChD,CAAC;CACF;AAjED,wCAiEC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare class CurrencyHelper {
|
|
2
2
|
static formatCurrency(amount: number): string;
|
|
3
|
+
static formatCurrencyWithLocale(amount: number, currency?: string): string;
|
|
4
|
+
static getCurrencySymbol(currency?: string): any;
|
|
5
|
+
private static getLocaleForCurrency;
|
|
3
6
|
}
|
|
4
7
|
//# sourceMappingURL=CurrencyHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyHelper.d.ts","sourceRoot":"","sources":["../../src/CurrencyHelper.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"CurrencyHelper.d.ts","sourceRoot":"","sources":["../../src/CurrencyHelper.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM;IASpC,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAc;IAYxE,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM;IAsB1C,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAqBpC"}
|
|
@@ -10,6 +10,57 @@ class CurrencyHelper {
|
|
|
10
10
|
});
|
|
11
11
|
return formatter.format(amount);
|
|
12
12
|
}
|
|
13
|
+
static formatCurrencyWithLocale(amount, currency = "USD") {
|
|
14
|
+
const normalizedCurrency = currency.toUpperCase();
|
|
15
|
+
const locale = this.getLocaleForCurrency(normalizedCurrency);
|
|
16
|
+
const formatter = new Intl.NumberFormat(locale, {
|
|
17
|
+
style: "currency",
|
|
18
|
+
currency: normalizedCurrency,
|
|
19
|
+
minimumFractionDigits: 2,
|
|
20
|
+
});
|
|
21
|
+
return formatter.format(amount);
|
|
22
|
+
}
|
|
23
|
+
static getCurrencySymbol(currency) {
|
|
24
|
+
const normalizedCurrency = currency?.toLowerCase() || "usd";
|
|
25
|
+
const stripeCurrencyFees = {
|
|
26
|
+
usd: { percent: 2.9, fixed: 0.3, symbol: "$" },
|
|
27
|
+
eur: { percent: 2.9, fixed: 0.25, symbol: "€" },
|
|
28
|
+
gbp: { percent: 2.9, fixed: 0.2, symbol: "£" },
|
|
29
|
+
cad: { percent: 2.9, fixed: 0.3, symbol: "$" },
|
|
30
|
+
aud: { percent: 2.9, fixed: 0.3, symbol: "$" },
|
|
31
|
+
inr: { percent: 2.9, fixed: 3.0, symbol: "₹" },
|
|
32
|
+
jpy: { percent: 2.9, fixed: 30.0, symbol: "¥" },
|
|
33
|
+
sgd: { percent: 2.9, fixed: 0.5, symbol: "S$" },
|
|
34
|
+
hkd: { percent: 2.9, fixed: 2.35, symbol: "元" },
|
|
35
|
+
sek: { percent: 2.9, fixed: 2.5, symbol: "kr" },
|
|
36
|
+
nok: { percent: 2.9, fixed: 2.0, symbol: "kr" },
|
|
37
|
+
dkk: { percent: 2.9, fixed: 1.8, symbol: "kr" },
|
|
38
|
+
chf: { percent: 2.9, fixed: 0.3, symbol: "CHF" },
|
|
39
|
+
mxn: { percent: 2.9, fixed: 3.0, symbol: "MXN" },
|
|
40
|
+
brl: { percent: 3.9, fixed: 0.5, symbol: "R$" },
|
|
41
|
+
};
|
|
42
|
+
return stripeCurrencyFees[normalizedCurrency]?.symbol || "$";
|
|
43
|
+
}
|
|
44
|
+
static getLocaleForCurrency(currency) {
|
|
45
|
+
const currencyLocaleMap = {
|
|
46
|
+
USD: "en-US",
|
|
47
|
+
EUR: "en-GB",
|
|
48
|
+
GBP: "en-GB",
|
|
49
|
+
CAD: "en-CA",
|
|
50
|
+
AUD: "en-AU",
|
|
51
|
+
INR: "en-IN",
|
|
52
|
+
JPY: "ja-JP",
|
|
53
|
+
SGD: "en-SG",
|
|
54
|
+
HKD: "en-HK",
|
|
55
|
+
SEK: "sv-SE",
|
|
56
|
+
NOK: "nb-NO",
|
|
57
|
+
DKK: "da-DK",
|
|
58
|
+
CHF: "de-CH",
|
|
59
|
+
MXN: "es-MX",
|
|
60
|
+
BRL: "pt-BR",
|
|
61
|
+
};
|
|
62
|
+
return currencyLocaleMap[currency] || "en-US";
|
|
63
|
+
}
|
|
13
64
|
}
|
|
14
65
|
exports.CurrencyHelper = CurrencyHelper;
|
|
15
66
|
//# sourceMappingURL=CurrencyHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyHelper.js","sourceRoot":"","sources":["../../src/CurrencyHelper.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAc;QAClC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YAC/C,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,KAAK;YACf,qBAAqB,EAAE,CAAC;SACzB,CAAC,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"CurrencyHelper.js","sourceRoot":"","sources":["../../src/CurrencyHelper.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAc;QAClC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YAC/C,KAA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AO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;SACb,CAAC;QAEF,OAAO,iBAAiB,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC;IAChD,CAAC;CACF;AAjED,wCAiEC"}
|
package/package.json
CHANGED
package/src/CurrencyHelper.ts
CHANGED
|
@@ -7,4 +7,60 @@ export class CurrencyHelper {
|
|
|
7
7
|
});
|
|
8
8
|
return formatter.format(amount);
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
static formatCurrencyWithLocale(amount: number, currency: string = "USD") {
|
|
12
|
+
const normalizedCurrency = currency.toUpperCase();
|
|
13
|
+
const locale = this.getLocaleForCurrency(normalizedCurrency);
|
|
14
|
+
|
|
15
|
+
const formatter = new Intl.NumberFormat(locale, {
|
|
16
|
+
style: "currency",
|
|
17
|
+
currency: normalizedCurrency,
|
|
18
|
+
minimumFractionDigits: 2,
|
|
19
|
+
});
|
|
20
|
+
return formatter.format(amount);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static getCurrencySymbol(currency?: string) {
|
|
24
|
+
const normalizedCurrency = currency?.toLowerCase() || "usd";
|
|
25
|
+
const stripeCurrencyFees: any = {
|
|
26
|
+
usd: { percent: 2.9, fixed: 0.3, symbol: "$" },
|
|
27
|
+
eur: { percent: 2.9, fixed: 0.25, symbol: "€" },
|
|
28
|
+
gbp: { percent: 2.9, fixed: 0.2, symbol: "£" },
|
|
29
|
+
cad: { percent: 2.9, fixed: 0.3, symbol: "$" },
|
|
30
|
+
aud: { percent: 2.9, fixed: 0.3, symbol: "$" },
|
|
31
|
+
inr: { percent: 2.9, fixed: 3.0, symbol: "₹" },
|
|
32
|
+
jpy: { percent: 2.9, fixed: 30.0, symbol: "¥" },
|
|
33
|
+
sgd: { percent: 2.9, fixed: 0.5, symbol: "S$" },
|
|
34
|
+
hkd: { percent: 2.9, fixed: 2.35, symbol: "元" },
|
|
35
|
+
sek: { percent: 2.9, fixed: 2.5, symbol: "kr" },
|
|
36
|
+
nok: { percent: 2.9, fixed: 2.0, symbol: "kr" },
|
|
37
|
+
dkk: { percent: 2.9, fixed: 1.8, symbol: "kr" },
|
|
38
|
+
chf: { percent: 2.9, fixed: 0.3, symbol: "CHF" },
|
|
39
|
+
mxn: { percent: 2.9, fixed: 3.0, symbol: "MXN" },
|
|
40
|
+
brl: { percent: 3.9, fixed: 0.5, symbol: "R$" },
|
|
41
|
+
};
|
|
42
|
+
return stripeCurrencyFees[normalizedCurrency]?.symbol || "$";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private static getLocaleForCurrency(currency: string): string {
|
|
46
|
+
const currencyLocaleMap: { [key: string]: string } = {
|
|
47
|
+
USD: "en-US",
|
|
48
|
+
EUR: "en-GB",
|
|
49
|
+
GBP: "en-GB",
|
|
50
|
+
CAD: "en-CA",
|
|
51
|
+
AUD: "en-AU",
|
|
52
|
+
INR: "en-IN",
|
|
53
|
+
JPY: "ja-JP",
|
|
54
|
+
SGD: "en-SG",
|
|
55
|
+
HKD: "en-HK",
|
|
56
|
+
SEK: "sv-SE",
|
|
57
|
+
NOK: "nb-NO",
|
|
58
|
+
DKK: "da-DK",
|
|
59
|
+
CHF: "de-CH",
|
|
60
|
+
MXN: "es-MX",
|
|
61
|
+
BRL: "pt-BR",
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return currencyLocaleMap[currency] || "en-US";
|
|
65
|
+
}
|
|
10
66
|
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
// Interfaces for Lessons API responses (tree structures)
|
|
2
|
-
|
|
3
|
-
export interface LessonActionInterface {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
actionType: string;
|
|
7
|
-
roleName?: string;
|
|
8
|
-
seconds?: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface LessonSectionInterface {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
actions?: LessonActionInterface[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface LessonVenueInterface {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
sections?: LessonSectionInterface[];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface LessonInfoInterface {
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
venues?: LessonVenueInterface[];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface LessonStudyInterface {
|
|
30
|
-
id: string;
|
|
31
|
-
name: string;
|
|
32
|
-
lessons?: LessonInfoInterface[];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface LessonProgramInterface {
|
|
36
|
-
id: string;
|
|
37
|
-
name: string;
|
|
38
|
-
studies?: LessonStudyInterface[];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Response from /lessons/public/tree
|
|
42
|
-
export interface LessonTreeInterface {
|
|
43
|
-
programs?: LessonProgramInterface[];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Response from /lessons/public/actionTree (same structure as LessonTreeInterface)
|
|
47
|
-
export interface LessonActionTreeInterface {
|
|
48
|
-
programs?: LessonProgramInterface[];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Response from /venues/public/actions/{id}
|
|
52
|
-
export interface VenueActionResponseInterface {
|
|
53
|
-
venueName?: string;
|
|
54
|
-
sections?: LessonSectionInterface[];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Response from /venues/public/planItems/{id}
|
|
58
|
-
export interface VenuePlanItemsResponseInterface {
|
|
59
|
-
venueName?: string;
|
|
60
|
-
items?: import("./Doing.js").PlanItemInterface[];
|
|
61
|
-
}
|
|
1
|
+
// Interfaces for Lessons API responses (tree structures)
|
|
2
|
+
|
|
3
|
+
export interface LessonActionInterface {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
actionType: string;
|
|
7
|
+
roleName?: string;
|
|
8
|
+
seconds?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface LessonSectionInterface {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
actions?: LessonActionInterface[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface LessonVenueInterface {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
sections?: LessonSectionInterface[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface LessonInfoInterface {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
venues?: LessonVenueInterface[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface LessonStudyInterface {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
lessons?: LessonInfoInterface[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface LessonProgramInterface {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
studies?: LessonStudyInterface[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Response from /lessons/public/tree
|
|
42
|
+
export interface LessonTreeInterface {
|
|
43
|
+
programs?: LessonProgramInterface[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Response from /lessons/public/actionTree (same structure as LessonTreeInterface)
|
|
47
|
+
export interface LessonActionTreeInterface {
|
|
48
|
+
programs?: LessonProgramInterface[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Response from /venues/public/actions/{id}
|
|
52
|
+
export interface VenueActionResponseInterface {
|
|
53
|
+
venueName?: string;
|
|
54
|
+
sections?: LessonSectionInterface[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Response from /venues/public/planItems/{id}
|
|
58
|
+
export interface VenuePlanItemsResponseInterface {
|
|
59
|
+
venueName?: string;
|
|
60
|
+
items?: import("./Doing.js").PlanItemInterface[];
|
|
61
|
+
}
|