@snugdesk/core 0.2.28 → 0.2.29
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 +86 -74
- package/fesm2022/snugdesk-core.mjs.map +1 -1
- package/index.d.ts +65 -42
- package/package.json +1 -1
|
@@ -1212,6 +1212,79 @@ 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
|
+
}
|
|
1258
|
+
return this.countriesData;
|
|
1259
|
+
}
|
|
1260
|
+
async getCountryFromCallingCode(countryCallingCode) {
|
|
1261
|
+
const countries = await this.getAllCountries();
|
|
1262
|
+
return countries.find((country) => country.callingCode === countryCallingCode);
|
|
1263
|
+
}
|
|
1264
|
+
async getCountryFromCountryCode(countryCode) {
|
|
1265
|
+
const countries = await this.getAllCountries();
|
|
1266
|
+
return countries.find((country) => country.code === countryCode);
|
|
1267
|
+
}
|
|
1268
|
+
async getAllLanguages() {
|
|
1269
|
+
if (!this.languagesData) {
|
|
1270
|
+
this.languagesData = await lastValueFrom(this.httpClient.get(CommonService.LANGUAGE_ENDPOINT));
|
|
1271
|
+
}
|
|
1272
|
+
return this.languagesData;
|
|
1273
|
+
}
|
|
1274
|
+
async getLanguageFromLanguageCode(languageCode) {
|
|
1275
|
+
const languages = await this.getAllLanguages();
|
|
1276
|
+
return languages?.find((language) => language.code === languageCode);
|
|
1277
|
+
}
|
|
1278
|
+
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 });
|
|
1279
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
1280
|
+
}
|
|
1281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, decorators: [{
|
|
1282
|
+
type: Injectable,
|
|
1283
|
+
args: [{
|
|
1284
|
+
providedIn: 'root',
|
|
1285
|
+
}]
|
|
1286
|
+
}], ctorParameters: () => [{ type: i1$2.HttpClient }] });
|
|
1287
|
+
|
|
1215
1288
|
const FIELDS_ENTITY_TYPE = `
|
|
1216
1289
|
id
|
|
1217
1290
|
externalId
|
|
@@ -1578,6 +1651,18 @@ class EntityService {
|
|
|
1578
1651
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1579
1652
|
return response.data.listEntityTypesByTenantId;
|
|
1580
1653
|
}
|
|
1654
|
+
OnEntityByIdListener(id) {
|
|
1655
|
+
const statement = `subscription OnEntityById($id: ID!) {
|
|
1656
|
+
OnEntityById(id: $id) {
|
|
1657
|
+
${FIELDS_ENTITY_EXPANDED}
|
|
1658
|
+
}
|
|
1659
|
+
}`;
|
|
1660
|
+
const gqlAPIServiceArguments = {
|
|
1661
|
+
id,
|
|
1662
|
+
};
|
|
1663
|
+
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
1664
|
+
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, "OnEntityById">>>; */
|
|
1665
|
+
}
|
|
1581
1666
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1582
1667
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityService, providedIn: 'root' });
|
|
1583
1668
|
}
|
|
@@ -1884,79 +1969,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
1884
1969
|
}]
|
|
1885
1970
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
1886
1971
|
|
|
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
1972
|
const FIELDS_USER = `
|
|
1961
1973
|
id
|
|
1962
1974
|
externalId
|
|
@@ -4301,5 +4313,5 @@ class CustomValidators {
|
|
|
4301
4313
|
* Generated bundle index. Do not edit.
|
|
4302
4314
|
*/
|
|
4303
4315
|
|
|
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 };
|
|
4316
|
+
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
4317
|
//# sourceMappingURL=snugdesk-core.mjs.map
|