@ibiliaze/global-vars 1.126.0 → 1.127.0
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/flows.d.ts +3 -6
- package/dist/flows.js +6 -20
- package/dist/ticketops/inputsDefault.d.ts +7 -5
- package/package.json +2 -2
package/dist/flows.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FixtureCategoryBase, FixtureCategoryFlowBase, FlowBase, OccupanceBase, StaffBase } from './ticketops/inputsDefault';
|
|
2
|
-
export declare const flows: readonly ["Online", "Offline", "Special link"
|
|
2
|
+
export declare const flows: readonly ["Online", "Offline", "Special link"];
|
|
3
3
|
export declare const idsEqual: <Id>(a: Id | null | undefined, b: Id | null | undefined) => boolean;
|
|
4
4
|
export declare const arrayHasId: <Id>(list: readonly (Id | null | undefined)[] | null | undefined, target: Id | null | undefined) => boolean;
|
|
5
5
|
export declare function makeSaleLogic<Id, TDate>(): SaleLogic<Id, TDate>;
|
|
@@ -50,10 +50,7 @@ export interface GetOccupanceCategoryArgs<Id, TDate> {
|
|
|
50
50
|
occupanceCategory: OccupanceCategoryOf<Id, TDate>;
|
|
51
51
|
fixtureCategories: FixtureCategoryOf<Id>[];
|
|
52
52
|
}
|
|
53
|
-
export interface GetCategoryArgs<Id
|
|
54
|
-
where: WhereOf<Id, TDate>;
|
|
55
|
-
fixtureCategories: FixtureCategoryOf<Id>[];
|
|
56
|
-
sectionId: Id;
|
|
53
|
+
export interface GetCategoryArgs<Id> {
|
|
57
54
|
occupanceCategory: FixtureCategoryOf<Id> | undefined;
|
|
58
55
|
sectionCategory: FixtureCategoryOf<Id> | undefined;
|
|
59
56
|
}
|
|
@@ -63,6 +60,6 @@ export interface SaleLogic<Id, TDate> {
|
|
|
63
60
|
canISeeSeat(args: CanISeeSeatArgs<Id, TDate>): boolean;
|
|
64
61
|
getSectorCategory(args: GetSectorCategoryArgs<Id>): FixtureCategoryOf<Id> | undefined;
|
|
65
62
|
getOccupanceCategory(args: GetOccupanceCategoryArgs<Id, TDate>): FixtureCategoryOf<Id> | undefined;
|
|
66
|
-
getCategory(args: GetCategoryArgs<Id
|
|
63
|
+
getCategory(args: GetCategoryArgs<Id>): FixtureCategoryOf<Id> | undefined;
|
|
67
64
|
}
|
|
68
65
|
export {};
|
package/dist/flows.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.arrayHasId = exports.idsEqual = exports.flows = void 0;
|
|
4
4
|
exports.makeSaleLogic = makeSaleLogic;
|
|
5
|
-
exports.flows = ['Online', 'Offline', 'Special link'
|
|
5
|
+
exports.flows = ['Online', 'Offline', 'Special link'];
|
|
6
6
|
const idsEqual = (a, b) => {
|
|
7
7
|
if (a == null || b == null)
|
|
8
8
|
return false;
|
|
@@ -25,8 +25,6 @@ function makeSaleLogic() {
|
|
|
25
25
|
return 'Special link';
|
|
26
26
|
case 'pos':
|
|
27
27
|
return 'Offline';
|
|
28
|
-
case 'seasonal':
|
|
29
|
-
return 'Seasonal ticket';
|
|
30
28
|
default:
|
|
31
29
|
return 'Online';
|
|
32
30
|
}
|
|
@@ -36,8 +34,6 @@ function makeSaleLogic() {
|
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
const guestSeesOnline = (flow) => flow.type === 'Online';
|
|
39
|
-
const guestSeesSeasonal = (flow) => flow.type === 'Seasonal ticket';
|
|
40
|
-
const cashierSeesSeasonal = (flow, staffFlowIds) => flow.type === 'Seasonal ticket' && (0, exports.arrayHasId)(staffFlowIds, flow.flowId);
|
|
41
37
|
const cashierSeesOffline = (flow, staffFlowIds) => flow.type === 'Offline' && (0, exports.arrayHasId)(staffFlowIds, flow.flowId);
|
|
42
38
|
const comesFromSpecialLink = (flow, signedFlowId) => flow.type === 'Special link' && (0, exports.idsEqual)(flow.flowId, signedFlowId);
|
|
43
39
|
const authoriser = ({ who, where, effectiveFlows, signedFlowId, staffFlowIds, }) => {
|
|
@@ -49,8 +45,6 @@ function makeSaleLogic() {
|
|
|
49
45
|
return effectiveFlows.some(f => comesFromSpecialLink(f, signedFlowId));
|
|
50
46
|
if (where === 'Online')
|
|
51
47
|
return effectiveFlows.some(f => guestSeesOnline(f));
|
|
52
|
-
if (where === 'Seasonal ticket')
|
|
53
|
-
return effectiveFlows.some(f => guestSeesSeasonal(f));
|
|
54
48
|
}
|
|
55
49
|
// Cashier
|
|
56
50
|
if (who === 'cashier') {
|
|
@@ -62,8 +56,6 @@ function makeSaleLogic() {
|
|
|
62
56
|
return false;
|
|
63
57
|
if (where === 'Offline')
|
|
64
58
|
return effectiveFlows.some(f => cashierSeesOffline(f, staffFlowIds));
|
|
65
|
-
if (where === 'Seasonal ticket')
|
|
66
|
-
return effectiveFlows.some(f => cashierSeesSeasonal(f, staffFlowIds));
|
|
67
59
|
}
|
|
68
60
|
return false;
|
|
69
61
|
};
|
|
@@ -109,6 +101,7 @@ function makeSaleLogic() {
|
|
|
109
101
|
name: sectionCat?.name ?? '',
|
|
110
102
|
color: sectionCat?.color || 'blue.4',
|
|
111
103
|
disabled: sectionCat?.disabled ?? false,
|
|
104
|
+
seasonal: sectionCat?.seasonal ?? false,
|
|
112
105
|
price: sectionCat?.price ?? 0,
|
|
113
106
|
flows: sectionCat?.flows ?? [],
|
|
114
107
|
sections: sectionCat?.sections ?? [],
|
|
@@ -126,6 +119,7 @@ function makeSaleLogic() {
|
|
|
126
119
|
name: occupanceCat?.name ?? '',
|
|
127
120
|
color: occupanceCat?.color || 'blue.4',
|
|
128
121
|
disabled: occupanceCat?.disabled ?? false,
|
|
122
|
+
seasonal: occupanceCat?.seasonal ?? false,
|
|
129
123
|
price: occupanceCat?.price ?? 0,
|
|
130
124
|
flows: occupanceCat?.flows ?? [],
|
|
131
125
|
sections: occupanceCat?.sections ?? [],
|
|
@@ -135,29 +129,21 @@ function makeSaleLogic() {
|
|
|
135
129
|
return undefined;
|
|
136
130
|
}
|
|
137
131
|
}
|
|
138
|
-
function getCategory({
|
|
132
|
+
function getCategory({ occupanceCategory, sectionCategory }) {
|
|
139
133
|
try {
|
|
140
134
|
const occupanceCatOverride = !!occupanceCategory?.categoryId;
|
|
141
135
|
const category = occupanceCatOverride ? occupanceCategory : sectionCategory;
|
|
142
|
-
const isSeasonal = category?.flows.find(flow => flow.type === 'Seasonal ticket');
|
|
143
136
|
const effectiveCategory = {
|
|
144
137
|
categoryId: (category?.categoryId ?? undefined),
|
|
145
138
|
name: category?.name ?? '',
|
|
146
139
|
color: category?.color || 'blue',
|
|
147
140
|
disabled: category?.disabled ?? false,
|
|
141
|
+
seasonal: category?.seasonal ?? false,
|
|
148
142
|
price: category?.price ?? 0,
|
|
149
143
|
flows: category?.flows ?? [],
|
|
150
144
|
sections: category?.sections ?? [],
|
|
151
145
|
};
|
|
152
|
-
|
|
153
|
-
if (!isSeasonal)
|
|
154
|
-
return effectiveCategory;
|
|
155
|
-
// Return the effective category is Sale Channel is Seasonal
|
|
156
|
-
if (where === 'Seasonal ticket')
|
|
157
|
-
return effectiveCategory;
|
|
158
|
-
// If sale channel is not seasonal but the seat is seasonal, return a default category
|
|
159
|
-
const defaultFlowCategory = fixtureCategories.find(cat => cat.sections?.some(sec => (0, exports.idsEqual)(sec.sectionId, sectionId)));
|
|
160
|
-
return defaultFlowCategory;
|
|
146
|
+
return effectiveCategory;
|
|
161
147
|
}
|
|
162
148
|
catch {
|
|
163
149
|
return undefined;
|
|
@@ -293,6 +293,7 @@ export interface CampaignBase<Id, TDate> {
|
|
|
293
293
|
export interface CategoryBase<Id, TDate> {
|
|
294
294
|
_id?: Id;
|
|
295
295
|
name: string;
|
|
296
|
+
seasonal?: boolean;
|
|
296
297
|
description?: string;
|
|
297
298
|
color?: string;
|
|
298
299
|
createdAt?: TDate;
|
|
@@ -365,10 +366,16 @@ export interface FileBase<Id, TDate> {
|
|
|
365
366
|
createdAt?: TDate;
|
|
366
367
|
updatedAt?: TDate;
|
|
367
368
|
}
|
|
369
|
+
export interface FixtureCategoryFlowBase<Id> {
|
|
370
|
+
flowId: Id;
|
|
371
|
+
name: string;
|
|
372
|
+
type: FlowBase<Id, Date>['type'];
|
|
373
|
+
}
|
|
368
374
|
export interface FixtureCategoryBase<Id> {
|
|
369
375
|
categoryId: Id;
|
|
370
376
|
name: string;
|
|
371
377
|
color: string;
|
|
378
|
+
seasonal: boolean;
|
|
372
379
|
price: number;
|
|
373
380
|
flows: FixtureCategoryFlowBase<Id>[];
|
|
374
381
|
sections: {
|
|
@@ -377,11 +384,6 @@ export interface FixtureCategoryBase<Id> {
|
|
|
377
384
|
}[];
|
|
378
385
|
disabled?: boolean;
|
|
379
386
|
}
|
|
380
|
-
export interface FixtureCategoryFlowBase<Id> {
|
|
381
|
-
flowId: Id;
|
|
382
|
-
name: string;
|
|
383
|
-
type: FlowBase<Id, Date>['type'];
|
|
384
|
-
}
|
|
385
387
|
export interface FixtureBase<Id, TDate> {
|
|
386
388
|
_id?: Id;
|
|
387
389
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiliaze/global-vars",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.127.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc",
|
|
24
24
|
"pub": "npm publish --access public",
|
|
25
|
-
"git": "git add .; git commit -m 'changes'; git tag -a v1.
|
|
25
|
+
"git": "git add .; git commit -m 'changes'; git tag -a v1.127.0 -m 'v1.127.0'; git push origin v1.127.0; git push",
|
|
26
26
|
"push": "npm run build; npm run git; npm run pub"
|
|
27
27
|
},
|
|
28
28
|
"author": "Ibi Hasanli",
|