@snugdesk/core 0.2.28 → 0.2.30
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/fesm2022/snugdesk-core.mjs +89 -75
- package/fesm2022/snugdesk-core.mjs.map +1 -1
- package/index.d.ts +66 -43
- package/package.json +1 -1
|
@@ -1212,6 +1212,81 @@ var UserType;
|
|
|
1212
1212
|
UserType["ADMINISTRATOR"] = "ADMINISTRATOR";
|
|
1213
1213
|
})(UserType || (UserType = {}));
|
|
1214
1214
|
|
|
1215
|
+
const FIELDS_LANGUAGE = `
|
|
1216
|
+
code
|
|
1217
|
+
nameEn
|
|
1218
|
+
nameLocal
|
|
1219
|
+
`;
|
|
1220
|
+
const FIELDS_COUNTRY = `
|
|
1221
|
+
code
|
|
1222
|
+
nameEn
|
|
1223
|
+
nameLocal
|
|
1224
|
+
currency {
|
|
1225
|
+
code
|
|
1226
|
+
nameEn
|
|
1227
|
+
}
|
|
1228
|
+
officialLanguage {
|
|
1229
|
+
${FIELDS_LANGUAGE}
|
|
1230
|
+
}
|
|
1231
|
+
callingCode
|
|
1232
|
+
region
|
|
1233
|
+
flag
|
|
1234
|
+
`;
|
|
1235
|
+
const FIELDS_PHONE_NUMBER = `
|
|
1236
|
+
countryCode
|
|
1237
|
+
dialCode
|
|
1238
|
+
e164Number
|
|
1239
|
+
internationalNumber
|
|
1240
|
+
nationalNumber
|
|
1241
|
+
number
|
|
1242
|
+
`;
|
|
1243
|
+
class CommonService {
|
|
1244
|
+
httpClient;
|
|
1245
|
+
countriesData;
|
|
1246
|
+
languagesData;
|
|
1247
|
+
// private static readonly COUNTRY_ENDPOINT = `https://assets.snugdesk.com/metadata/countries.json`;
|
|
1248
|
+
static COUNTRY_ENDPOINT = `https://snugdesk-assets.s3.amazonaws.com/metadata/countries.json`;
|
|
1249
|
+
// private static readonly LANGUAGE_ENDPOINT = `https://assets.snugdesk.com/metadata/languages.json`;
|
|
1250
|
+
static LANGUAGE_ENDPOINT = `https://snugdesk-assets.s3.amazonaws.com/metadata/languages.json`;
|
|
1251
|
+
constructor(httpClient) {
|
|
1252
|
+
this.httpClient = httpClient;
|
|
1253
|
+
}
|
|
1254
|
+
async getAllCountries() {
|
|
1255
|
+
if (!this.countriesData) {
|
|
1256
|
+
this.countriesData = await lastValueFrom(this.httpClient.get(CommonService.COUNTRY_ENDPOINT));
|
|
1257
|
+
this.countriesData.sort((a, b) => (a.nameEn ?? '').localeCompare(b.nameEn ?? ''));
|
|
1258
|
+
}
|
|
1259
|
+
return this.countriesData;
|
|
1260
|
+
}
|
|
1261
|
+
async getCountryFromCallingCode(countryCallingCode) {
|
|
1262
|
+
const countries = await this.getAllCountries();
|
|
1263
|
+
return countries.find((country) => country.callingCode === countryCallingCode);
|
|
1264
|
+
}
|
|
1265
|
+
async getCountryFromCountryCode(countryCode) {
|
|
1266
|
+
const countries = await this.getAllCountries();
|
|
1267
|
+
return countries.find((country) => country.code === countryCode);
|
|
1268
|
+
}
|
|
1269
|
+
async getAllLanguages() {
|
|
1270
|
+
if (!this.languagesData) {
|
|
1271
|
+
this.languagesData = await lastValueFrom(this.httpClient.get(CommonService.LANGUAGE_ENDPOINT));
|
|
1272
|
+
this.languagesData.sort((a, b) => (a.nameEn ?? '').localeCompare(b.nameEn ?? ''));
|
|
1273
|
+
}
|
|
1274
|
+
return this.languagesData;
|
|
1275
|
+
}
|
|
1276
|
+
async getLanguageFromLanguageCode(languageCode) {
|
|
1277
|
+
const languages = await this.getAllLanguages();
|
|
1278
|
+
return languages?.find((language) => language.code === languageCode);
|
|
1279
|
+
}
|
|
1280
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1281
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
1282
|
+
}
|
|
1283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, decorators: [{
|
|
1284
|
+
type: Injectable,
|
|
1285
|
+
args: [{
|
|
1286
|
+
providedIn: 'root',
|
|
1287
|
+
}]
|
|
1288
|
+
}], ctorParameters: () => [{ type: i1$2.HttpClient }] });
|
|
1289
|
+
|
|
1215
1290
|
const FIELDS_ENTITY_TYPE = `
|
|
1216
1291
|
id
|
|
1217
1292
|
externalId
|
|
@@ -1578,6 +1653,18 @@ class EntityService {
|
|
|
1578
1653
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1579
1654
|
return response.data.listEntityTypesByTenantId;
|
|
1580
1655
|
}
|
|
1656
|
+
OnEntityByIdListener(id) {
|
|
1657
|
+
const statement = `subscription OnEntityById($id: ID!) {
|
|
1658
|
+
OnEntityById(id: $id) {
|
|
1659
|
+
${FIELDS_ENTITY}
|
|
1660
|
+
}
|
|
1661
|
+
}`;
|
|
1662
|
+
const gqlAPIServiceArguments = {
|
|
1663
|
+
id,
|
|
1664
|
+
};
|
|
1665
|
+
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
1666
|
+
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, "OnEntityById">>>; */
|
|
1667
|
+
}
|
|
1581
1668
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1582
1669
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityService, providedIn: 'root' });
|
|
1583
1670
|
}
|
|
@@ -1884,79 +1971,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
1884
1971
|
}]
|
|
1885
1972
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
1886
1973
|
|
|
1887
|
-
const FIELDS_LANGUAGE = `
|
|
1888
|
-
code
|
|
1889
|
-
nameEn
|
|
1890
|
-
nameLocal
|
|
1891
|
-
`;
|
|
1892
|
-
const FIELDS_COUNTRY = `
|
|
1893
|
-
code
|
|
1894
|
-
nameEn
|
|
1895
|
-
nameLocal
|
|
1896
|
-
currency {
|
|
1897
|
-
code
|
|
1898
|
-
nameEn
|
|
1899
|
-
}
|
|
1900
|
-
officialLanguage {
|
|
1901
|
-
${FIELDS_LANGUAGE}
|
|
1902
|
-
}
|
|
1903
|
-
callingCode
|
|
1904
|
-
region
|
|
1905
|
-
flag
|
|
1906
|
-
`;
|
|
1907
|
-
const FIELDS_PHONE_NUMBER = `
|
|
1908
|
-
countryCode
|
|
1909
|
-
dialCode
|
|
1910
|
-
e164Number
|
|
1911
|
-
internationalNumber
|
|
1912
|
-
nationalNumber
|
|
1913
|
-
number
|
|
1914
|
-
`;
|
|
1915
|
-
class CommonService {
|
|
1916
|
-
httpClient;
|
|
1917
|
-
countriesData;
|
|
1918
|
-
languagesData;
|
|
1919
|
-
// private static readonly COUNTRY_ENDPOINT = `https://assets.snugdesk.com/metadata/countries.json`;
|
|
1920
|
-
static COUNTRY_ENDPOINT = `https://snugdesk-assets.s3.amazonaws.com/metadata/countries.json`;
|
|
1921
|
-
// private static readonly LANGUAGE_ENDPOINT = `https://assets.snugdesk.com/metadata/languages.json`;
|
|
1922
|
-
static LANGUAGE_ENDPOINT = `https://snugdesk-assets.s3.amazonaws.com/metadata/languages.json`;
|
|
1923
|
-
constructor(httpClient) {
|
|
1924
|
-
this.httpClient = httpClient;
|
|
1925
|
-
}
|
|
1926
|
-
async getAllCountries() {
|
|
1927
|
-
if (!this.countriesData) {
|
|
1928
|
-
this.countriesData = await lastValueFrom(this.httpClient.get(CommonService.COUNTRY_ENDPOINT));
|
|
1929
|
-
}
|
|
1930
|
-
return this.countriesData;
|
|
1931
|
-
}
|
|
1932
|
-
async getCountryFromCallingCode(countryCallingCode) {
|
|
1933
|
-
const countries = await this.getAllCountries();
|
|
1934
|
-
return countries.find((country) => country.callingCode === countryCallingCode);
|
|
1935
|
-
}
|
|
1936
|
-
async getCountryFromCountryCode(countryCode) {
|
|
1937
|
-
const countries = await this.getAllCountries();
|
|
1938
|
-
return countries.find((country) => country.code === countryCode);
|
|
1939
|
-
}
|
|
1940
|
-
async getAllLanguages() {
|
|
1941
|
-
if (!this.languagesData) {
|
|
1942
|
-
this.languagesData = await lastValueFrom(this.httpClient.get(CommonService.LANGUAGE_ENDPOINT));
|
|
1943
|
-
}
|
|
1944
|
-
return this.languagesData;
|
|
1945
|
-
}
|
|
1946
|
-
async getLanguageFromLanguageCode(languageCode) {
|
|
1947
|
-
const languages = await this.getAllLanguages();
|
|
1948
|
-
return languages?.find((language) => language.code === languageCode);
|
|
1949
|
-
}
|
|
1950
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1951
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
1952
|
-
}
|
|
1953
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, decorators: [{
|
|
1954
|
-
type: Injectable,
|
|
1955
|
-
args: [{
|
|
1956
|
-
providedIn: 'root',
|
|
1957
|
-
}]
|
|
1958
|
-
}], ctorParameters: () => [{ type: i1$2.HttpClient }] });
|
|
1959
|
-
|
|
1960
1974
|
const FIELDS_USER = `
|
|
1961
1975
|
id
|
|
1962
1976
|
externalId
|
|
@@ -2515,7 +2529,7 @@ const FIELDS_INTERACTION_ATTENDEE_EXPANDED = `
|
|
|
2515
2529
|
interactionId
|
|
2516
2530
|
entityId
|
|
2517
2531
|
entity {
|
|
2518
|
-
${
|
|
2532
|
+
${FIELDS_ENTITY}
|
|
2519
2533
|
}
|
|
2520
2534
|
interactionWidgetSessionId
|
|
2521
2535
|
teamId
|
|
@@ -4301,5 +4315,5 @@ class CustomValidators {
|
|
|
4301
4315
|
* Generated bundle index. Do not edit.
|
|
4302
4316
|
*/
|
|
4303
4317
|
|
|
4304
|
-
export { AMPLIFY_CONFIG, AppSyncHelperService, CleanDeep, CustomPipesModule, CustomValidators, DomainNamePipe, EncryptedStorageService, EntityConversationService, EntityService, ErrorComponent, FIELDS_ENTITY, FIELDS_ENTITY_CONVERSATION, FIELDS_ENTITY_CONVERSATION_EXPANDED, FIELDS_ENTITY_CONVERSATION_MINIMAL, FIELDS_ENTITY_EXPANDED, FIELDS_ENTITY_MINIMAL, FIELDS_ENTITY_TYPE, FIELDS_INTERACTION, FIELDS_INTERACTION_ATTENDEE, FIELDS_INTERACTION_ATTENDEE_EXPANDED, FIELDS_INTERACTION_ENDPOINT, FIELDS_INTERACTION_ENDPOINT_MINIMAL, FIELDS_INTERACTION_EXPANDED, FIELDS_INTERACTION_HOST, FIELDS_INTERACTION_INVITEE, FIELDS_INTERACTION_MESSAGE, FIELDS_INTERACTION_MESSAGE_ATTACHMENT, FIELDS_INTERACTION_MESSAGE_EXPANDED, FIELDS_INTERACTION_MINIMAL, FIELDS_INTERACTION_WIDGET, FIELDS_INTERACTION_WIDGET_USER_SETTING, FIELDS_TEAM, FIELDS_TEAM_MEMBER, FIELDS_TENANT, FIELDS_TENANT_COMPLIANCE_DOCUMENT, FIELDS_TENANT_EXPANDED, FIELDS_TENANT_MINIMAL, FIELDS_TICKET, FIELDS_TICKET_PRIORITY, FIELDS_TICKET_STATUS, FIELDS_TICKET_TYPE, FIELDS_USER, FIELDS_USER_SESSION, FooterComponent, FormatEpochTimestampPipe, InteractionChannel, InteractionContext, InteractionDirection, InteractionEndpointService, InteractionProvider, InteractionRouteLogic, InteractionService, InteractionStatus, InteractionWidgetService, LoaderComponent, ModelAttributeTypes, ModelSortDirection, OpenSearchHelperService, ProcessingStatus, S3HelperService, SafeHtmlPipe, SearchInnerFieldPipe, SearchPipe, SingularizePipe, SnugdeskAuthenticationService, SnugdeskCoreModule, SnugdeskIPRegistryService, StorageType, TeamService, TenantComplianceDocumentStatus, TenantComplianceDocumentType, TenantSSOConfigurationProtocol, TenantService, TicketService, UserService, UserSessionService, UserStatus, UserType, provideAmplifyConfig };
|
|
4318
|
+
export { AMPLIFY_CONFIG, AppSyncHelperService, CleanDeep, CommonService, CustomPipesModule, CustomValidators, DomainNamePipe, EncryptedStorageService, EntityConversationService, EntityService, ErrorComponent, FIELDS_COUNTRY, FIELDS_ENTITY, FIELDS_ENTITY_CONVERSATION, FIELDS_ENTITY_CONVERSATION_EXPANDED, FIELDS_ENTITY_CONVERSATION_MINIMAL, FIELDS_ENTITY_EXPANDED, FIELDS_ENTITY_MINIMAL, FIELDS_ENTITY_TYPE, FIELDS_INTERACTION, FIELDS_INTERACTION_ATTENDEE, FIELDS_INTERACTION_ATTENDEE_EXPANDED, FIELDS_INTERACTION_ENDPOINT, FIELDS_INTERACTION_ENDPOINT_MINIMAL, FIELDS_INTERACTION_EXPANDED, FIELDS_INTERACTION_HOST, FIELDS_INTERACTION_INVITEE, FIELDS_INTERACTION_MESSAGE, FIELDS_INTERACTION_MESSAGE_ATTACHMENT, FIELDS_INTERACTION_MESSAGE_EXPANDED, FIELDS_INTERACTION_MINIMAL, FIELDS_INTERACTION_WIDGET, FIELDS_INTERACTION_WIDGET_USER_SETTING, FIELDS_LANGUAGE, FIELDS_PHONE_NUMBER, FIELDS_TEAM, FIELDS_TEAM_MEMBER, FIELDS_TENANT, FIELDS_TENANT_COMPLIANCE_DOCUMENT, FIELDS_TENANT_EXPANDED, FIELDS_TENANT_MINIMAL, FIELDS_TICKET, FIELDS_TICKET_PRIORITY, FIELDS_TICKET_STATUS, FIELDS_TICKET_TYPE, FIELDS_USER, FIELDS_USER_SESSION, FooterComponent, FormatEpochTimestampPipe, InteractionChannel, InteractionContext, InteractionDirection, InteractionEndpointService, InteractionProvider, InteractionRouteLogic, InteractionService, InteractionStatus, InteractionWidgetService, LoaderComponent, ModelAttributeTypes, ModelSortDirection, OpenSearchHelperService, ProcessingStatus, S3HelperService, SafeHtmlPipe, SearchInnerFieldPipe, SearchPipe, SingularizePipe, SnugdeskAuthenticationService, SnugdeskCoreModule, SnugdeskIPRegistryService, StorageType, TeamService, TenantComplianceDocumentStatus, TenantComplianceDocumentType, TenantSSOConfigurationProtocol, TenantService, TicketService, UserService, UserSessionService, UserStatus, UserType, provideAmplifyConfig };
|
|
4305
4319
|
//# sourceMappingURL=snugdesk-core.mjs.map
|