@servicetitan/notifications 31.1.0 → 31.3.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/api/notifications.api.js +4 -3
- package/dist/api/notifications.api.js.map +1 -1
- package/dist/common.js +4 -3
- package/dist/common.js.map +1 -1
- package/dist/components/notifications.js +42 -22
- package/dist/components/notifications.js.map +1 -1
- package/dist/demo/action-button-preview.js +41 -23
- package/dist/demo/action-button-preview.js.map +1 -1
- package/dist/demo/action-button.js +4 -1
- package/dist/demo/action-button.js.map +1 -1
- package/dist/demo/basic-preview.js +9 -5
- package/dist/demo/basic-preview.js.map +1 -1
- package/dist/demo/basic.js +4 -1
- package/dist/demo/basic.js.map +1 -1
- package/dist/demo/container.js +44 -45
- package/dist/demo/container.js.map +1 -1
- package/dist/demo/duration-preview.js +23 -9
- package/dist/demo/duration-preview.js.map +1 -1
- package/dist/demo/duration.js +4 -1
- package/dist/demo/duration.js.map +1 -1
- package/dist/demo/index.js +1 -0
- package/dist/demo/index.js.map +1 -1
- package/dist/demo/multiline-message-preview.js +9 -5
- package/dist/demo/multiline-message-preview.js.map +1 -1
- package/dist/demo/multiline-message.js +4 -1
- package/dist/demo/multiline-message.js.map +1 -1
- package/dist/demo/prevent-duplicates-preview.js +9 -5
- package/dist/demo/prevent-duplicates-preview.js.map +1 -1
- package/dist/demo/prevent-duplicates.js +4 -1
- package/dist/demo/prevent-duplicates.js.map +1 -1
- package/dist/demo/progress-preview.js +9 -5
- package/dist/demo/progress-preview.js.map +1 -1
- package/dist/demo/progress.js +4 -1
- package/dist/demo/progress.js.map +1 -1
- package/dist/demo/server-custom-preview.js +5 -4
- package/dist/demo/server-custom-preview.js.map +1 -1
- package/dist/demo/server-custom.js +13 -7
- package/dist/demo/server-custom.js.map +1 -1
- package/dist/demo/server-default.js +66 -61
- package/dist/demo/server-default.js.map +1 -1
- package/dist/demo/status-variations-preview.js +35 -13
- package/dist/demo/status-variations-preview.js.map +1 -1
- package/dist/demo/status-variations.js +4 -1
- package/dist/demo/status-variations.js.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/intercept.js +1 -0
- package/dist/intercept.js.map +1 -1
- package/dist/notifications-channel.js +1 -0
- package/dist/notifications-channel.js.map +1 -1
- package/dist/notifications-service.js +71 -69
- package/dist/notifications-service.js.map +1 -1
- package/dist/stores/notifications.store.js +210 -218
- package/dist/stores/notifications.store.js.map +1 -1
- package/dist/utils/date-from-string.js +2 -1
- package/dist/utils/date-from-string.js.map +1 -1
- package/dist/utils/use-compatible-navigate.js +4 -3
- package/dist/utils/use-compatible-navigate.js.map +1 -1
- package/package.json +8 -8
- package/dist/__tests__/intercept.test.js +0 -13
- package/dist/__tests__/intercept.test.js.map +0 -1
- package/dist/__tests__/notifications-service.test.js +0 -42
- package/dist/__tests__/notifications-service.test.js.map +0 -1
- package/dist/components/__tests__/notifications.test.js +0 -93
- package/dist/components/__tests__/notifications.test.js.map +0 -1
- package/dist/notifications.stories.js +0 -20
- package/dist/notifications.stories.js.map +0 -1
- package/dist/stores/__mocks__/mock-notifications-channel.js +0 -36
- package/dist/stores/__mocks__/mock-notifications-channel.js.map +0 -1
- package/dist/stores/__tests__/notifications.store.test.js +0 -367
- package/dist/stores/__tests__/notifications.store.test.js.map +0 -1
- package/dist/utils/__tests__/date-from-string.test.js +0 -45
- package/dist/utils/__tests__/date-from-string.test.js.map +0 -1
- package/dist/utils/__tests__/use-compatible-navigate.test.js +0 -27
- package/dist/utils/__tests__/use-compatible-navigate.test.js.map +0 -1
@@ -1,80 +1,82 @@
|
|
1
|
-
|
1
|
+
function _define_property(obj, key, value) {
|
2
|
+
if (key in obj) {
|
3
|
+
Object.defineProperty(obj, key, {
|
4
|
+
value: value,
|
5
|
+
enumerable: true,
|
6
|
+
configurable: true,
|
7
|
+
writable: true
|
8
|
+
});
|
9
|
+
} else {
|
10
|
+
obj[key] = value;
|
11
|
+
}
|
12
|
+
return obj;
|
13
|
+
}
|
14
|
+
function _ts_decorate(decorators, target, key, desc) {
|
2
15
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
16
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
-
else for
|
17
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
-
}
|
7
|
-
|
19
|
+
}
|
20
|
+
function _ts_metadata(k, v) {
|
8
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
-
}
|
10
|
-
|
11
|
-
return function
|
12
|
-
|
22
|
+
}
|
23
|
+
function _ts_param(paramIndex, decorator) {
|
24
|
+
return function(target, key) {
|
25
|
+
decorator(target, key, paramIndex);
|
26
|
+
};
|
27
|
+
}
|
13
28
|
import { injectable, inject } from '@servicetitan/react-ioc';
|
14
29
|
import { Status } from './common';
|
15
30
|
import { NotificationsStore } from './stores/notifications.store';
|
16
|
-
|
17
|
-
constructor(store)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
}
|
55
|
-
}
|
56
|
-
Object.defineProperty(this, "warning", {
|
57
|
-
enumerable: true,
|
58
|
-
configurable: true,
|
59
|
-
writable: true,
|
60
|
-
value: (options, preventDuplicates) => {
|
61
|
-
this.store.add({ ...options, status: Status.Warning }, preventDuplicates);
|
62
|
-
}
|
63
|
-
});
|
64
|
-
Object.defineProperty(this, "error", {
|
65
|
-
enumerable: true,
|
66
|
-
configurable: true,
|
67
|
-
writable: true,
|
68
|
-
value: (options, preventDuplicates) => {
|
69
|
-
this.store.add({ ...options, status: Status.Error }, preventDuplicates);
|
70
|
-
}
|
71
|
-
});
|
31
|
+
export class NotificationsService {
|
32
|
+
constructor(store){
|
33
|
+
_define_property(this, "store", void 0);
|
34
|
+
_define_property(this, "initialize", void 0);
|
35
|
+
_define_property(this, "show", void 0);
|
36
|
+
_define_property(this, "info", void 0);
|
37
|
+
_define_property(this, "success", void 0);
|
38
|
+
_define_property(this, "warning", void 0);
|
39
|
+
_define_property(this, "error", void 0);
|
40
|
+
this.store = store;
|
41
|
+
this.initialize = async (userId = 0)=>{
|
42
|
+
await this.store.initialize(userId);
|
43
|
+
};
|
44
|
+
this.show = (options, preventDuplicates)=>{
|
45
|
+
this.store.add(options, preventDuplicates);
|
46
|
+
};
|
47
|
+
this.info = (options, preventDuplicates)=>{
|
48
|
+
this.store.add({
|
49
|
+
...options,
|
50
|
+
status: Status.Info
|
51
|
+
}, preventDuplicates);
|
52
|
+
};
|
53
|
+
this.success = (options, preventDuplicates)=>{
|
54
|
+
this.store.add({
|
55
|
+
...options,
|
56
|
+
status: Status.Success
|
57
|
+
}, preventDuplicates);
|
58
|
+
};
|
59
|
+
this.warning = (options, preventDuplicates)=>{
|
60
|
+
this.store.add({
|
61
|
+
...options,
|
62
|
+
status: Status.Warning
|
63
|
+
}, preventDuplicates);
|
64
|
+
};
|
65
|
+
this.error = (options, preventDuplicates)=>{
|
66
|
+
this.store.add({
|
67
|
+
...options,
|
68
|
+
status: Status.Error
|
69
|
+
}, preventDuplicates);
|
70
|
+
};
|
72
71
|
}
|
73
|
-
}
|
74
|
-
NotificationsService =
|
72
|
+
}
|
73
|
+
NotificationsService = _ts_decorate([
|
75
74
|
injectable(),
|
76
|
-
|
77
|
-
|
75
|
+
_ts_param(0, inject(NotificationsStore)),
|
76
|
+
_ts_metadata("design:type", Function),
|
77
|
+
_ts_metadata("design:paramtypes", [
|
78
|
+
typeof NotificationsStore === "undefined" ? Object : NotificationsStore
|
79
|
+
])
|
78
80
|
], NotificationsService);
|
79
|
-
|
81
|
+
|
80
82
|
//# sourceMappingURL=notifications-service.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/notifications-service.ts"],"sourcesContent":["import { injectable, inject } from '@servicetitan/react-ioc';\n\nimport { DefaultNotificationOptions, Status } from './common';\n\nimport { NotificationsStore } from './stores/notifications.store';\n\ntype OptionsWithoutStatus = Omit<DefaultNotificationOptions, 'status'>;\n\nexport interface INotificationsService {\n initialize(userId?: number): Promise<void>;\n show(options: DefaultNotificationOptions, preventDuplicates?: boolean): void;\n info(options: OptionsWithoutStatus, preventDuplicates?: boolean): void;\n success(options: OptionsWithoutStatus, preventDuplicates?: boolean): void;\n warning(options: OptionsWithoutStatus, preventDuplicates?: boolean): void;\n error(options: OptionsWithoutStatus, preventDuplicates?: boolean): void;\n}\n\n@injectable()\nexport class NotificationsService implements INotificationsService {\n constructor(@inject(NotificationsStore) private readonly store: NotificationsStore) {}\n\n initialize = async (userId = 0) => {\n await this.store.initialize(userId);\n };\n\n show = (options: DefaultNotificationOptions, preventDuplicates?: boolean) => {\n this.store.add(options, preventDuplicates);\n };\n\n info = (options: OptionsWithoutStatus, preventDuplicates?: boolean) => {\n this.store.add({ ...options, status: Status.Info }, preventDuplicates);\n };\n\n success = (options: OptionsWithoutStatus, preventDuplicates?: boolean) => {\n this.store.add({ ...options, status: Status.Success }, preventDuplicates);\n };\n\n warning = (options: OptionsWithoutStatus, preventDuplicates?: boolean) => {\n this.store.add({ ...options, status: Status.Warning }, preventDuplicates);\n };\n\n error = (options: OptionsWithoutStatus, preventDuplicates?: boolean) => {\n this.store.add({ ...options, status: Status.Error }, preventDuplicates);\n };\n}\n"],"names":["injectable","inject","Status","NotificationsStore","NotificationsService","constructor","store","initialize","show","info","success","warning","error","userId","options","preventDuplicates","add","status","Info","Success","Warning","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,UAAU,EAAEC,MAAM,QAAQ,0BAA0B;AAE7D,SAAqCC,MAAM,QAAQ,WAAW;AAE9D,SAASC,kBAAkB,QAAQ,+BAA+B;AAclE,OAAO,MAAMC;IACTC,YAAY,AAA6CC,KAAyB,CAAE;;QAEpFC,uBAAAA,cAAAA,KAAAA;QAIAC,uBAAAA,QAAAA,KAAAA;QAIAC,uBAAAA,QAAAA,KAAAA;QAIAC,uBAAAA,WAAAA,KAAAA;QAIAC,uBAAAA,WAAAA,KAAAA;QAIAC,uBAAAA,SAAAA,KAAAA;aAtByDN,QAAAA;aAEzDC,aAAa,OAAOM,SAAS,CAAC;YAC1B,MAAM,IAAI,CAACP,KAAK,CAACC,UAAU,CAACM;QAChC;aAEAL,OAAO,CAACM,SAAqCC;YACzC,IAAI,CAACT,KAAK,CAACU,GAAG,CAACF,SAASC;QAC5B;aAEAN,OAAO,CAACK,SAA+BC;YACnC,IAAI,CAACT,KAAK,CAACU,GAAG,CAAC;gBAAE,GAAGF,OAAO;gBAAEG,QAAQf,OAAOgB,IAAI;YAAC,GAAGH;QACxD;aAEAL,UAAU,CAACI,SAA+BC;YACtC,IAAI,CAACT,KAAK,CAACU,GAAG,CAAC;gBAAE,GAAGF,OAAO;gBAAEG,QAAQf,OAAOiB,OAAO;YAAC,GAAGJ;QAC3D;aAEAJ,UAAU,CAACG,SAA+BC;YACtC,IAAI,CAACT,KAAK,CAACU,GAAG,CAAC;gBAAE,GAAGF,OAAO;gBAAEG,QAAQf,OAAOkB,OAAO;YAAC,GAAGL;QAC3D;aAEAH,QAAQ,CAACE,SAA+BC;YACpC,IAAI,CAACT,KAAK,CAACU,GAAG,CAAC;gBAAE,GAAGF,OAAO;gBAAEG,QAAQf,OAAOmB,KAAK;YAAC,GAAGN;QACzD;IAxBqF;AAyBzF"}
|