@snugdesk/core 0.2.24 → 0.2.25
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 +82 -6
- package/fesm2022/snugdesk-core.mjs.map +1 -1
- package/index.d.ts +6 -6
- package/package.json +1 -1
|
@@ -3140,6 +3140,79 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
3140
3140
|
}]
|
|
3141
3141
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
3142
3142
|
|
|
3143
|
+
const FIELDS_LANGUAGE = `
|
|
3144
|
+
code
|
|
3145
|
+
nameEn
|
|
3146
|
+
nameLocal
|
|
3147
|
+
`;
|
|
3148
|
+
const FIELDS_COUNTRY = `
|
|
3149
|
+
code
|
|
3150
|
+
nameEn
|
|
3151
|
+
nameLocal
|
|
3152
|
+
currency {
|
|
3153
|
+
code
|
|
3154
|
+
nameEn
|
|
3155
|
+
}
|
|
3156
|
+
officialLanguage {
|
|
3157
|
+
${FIELDS_LANGUAGE}
|
|
3158
|
+
}
|
|
3159
|
+
callingCode
|
|
3160
|
+
region
|
|
3161
|
+
flag
|
|
3162
|
+
`;
|
|
3163
|
+
const FIELDS_PHONE_NUMBER = `
|
|
3164
|
+
countryCode
|
|
3165
|
+
dialCode
|
|
3166
|
+
e164Number
|
|
3167
|
+
internationalNumber
|
|
3168
|
+
nationalNumber
|
|
3169
|
+
number
|
|
3170
|
+
`;
|
|
3171
|
+
class CommonService {
|
|
3172
|
+
httpClient;
|
|
3173
|
+
countriesData;
|
|
3174
|
+
languagesData;
|
|
3175
|
+
// private static readonly COUNTRY_ENDPOINT = `https://assets.snugdesk.com/metadata/countries.json`;
|
|
3176
|
+
static COUNTRY_ENDPOINT = `https://snugdesk-assets.s3.amazonaws.com/metadata/countries.json`;
|
|
3177
|
+
// private static readonly LANGUAGE_ENDPOINT = `https://assets.snugdesk.com/metadata/languages.json`;
|
|
3178
|
+
static LANGUAGE_ENDPOINT = `https://snugdesk-assets.s3.amazonaws.com/metadata/languages.json`;
|
|
3179
|
+
constructor(httpClient) {
|
|
3180
|
+
this.httpClient = httpClient;
|
|
3181
|
+
}
|
|
3182
|
+
async getAllCountries() {
|
|
3183
|
+
if (!this.countriesData) {
|
|
3184
|
+
this.countriesData = await lastValueFrom(this.httpClient.get(CommonService.COUNTRY_ENDPOINT));
|
|
3185
|
+
}
|
|
3186
|
+
return this.countriesData;
|
|
3187
|
+
}
|
|
3188
|
+
async getCountryFromCallingCode(countryCallingCode) {
|
|
3189
|
+
const countries = await this.getAllCountries();
|
|
3190
|
+
return countries.find((country) => country.callingCode === countryCallingCode);
|
|
3191
|
+
}
|
|
3192
|
+
async getCountryFromCountryCode(countryCode) {
|
|
3193
|
+
const countries = await this.getAllCountries();
|
|
3194
|
+
return countries.find((country) => country.code === countryCode);
|
|
3195
|
+
}
|
|
3196
|
+
async getAllLanguages() {
|
|
3197
|
+
if (!this.languagesData) {
|
|
3198
|
+
this.languagesData = await lastValueFrom(this.httpClient.get(CommonService.LANGUAGE_ENDPOINT));
|
|
3199
|
+
}
|
|
3200
|
+
return this.languagesData;
|
|
3201
|
+
}
|
|
3202
|
+
async getLanguageFromLanguageCode(languageCode) {
|
|
3203
|
+
const languages = await this.getAllLanguages();
|
|
3204
|
+
return languages?.find((language) => language.code === languageCode);
|
|
3205
|
+
}
|
|
3206
|
+
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 });
|
|
3207
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
3208
|
+
}
|
|
3209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CommonService, decorators: [{
|
|
3210
|
+
type: Injectable,
|
|
3211
|
+
args: [{
|
|
3212
|
+
providedIn: 'root',
|
|
3213
|
+
}]
|
|
3214
|
+
}], ctorParameters: () => [{ type: i1$2.HttpClient }] });
|
|
3215
|
+
|
|
3143
3216
|
const FIELDS_TENANT = `
|
|
3144
3217
|
id
|
|
3145
3218
|
externalId
|
|
@@ -3147,8 +3220,6 @@ const FIELDS_TENANT = `
|
|
|
3147
3220
|
organizationName
|
|
3148
3221
|
websiteURL
|
|
3149
3222
|
image {
|
|
3150
|
-
key
|
|
3151
|
-
bucket
|
|
3152
3223
|
location
|
|
3153
3224
|
}
|
|
3154
3225
|
preferences {
|
|
@@ -3208,8 +3279,6 @@ const FIELDS_TENANT_EXPANDED = `
|
|
|
3208
3279
|
organizationName
|
|
3209
3280
|
websiteURL
|
|
3210
3281
|
image {
|
|
3211
|
-
key
|
|
3212
|
-
bucket
|
|
3213
3282
|
location
|
|
3214
3283
|
}
|
|
3215
3284
|
billingInformation {
|
|
@@ -3218,16 +3287,25 @@ const FIELDS_TENANT_EXPANDED = `
|
|
|
3218
3287
|
state
|
|
3219
3288
|
city
|
|
3220
3289
|
postalCode
|
|
3290
|
+
country {
|
|
3291
|
+
${FIELDS_COUNTRY}
|
|
3292
|
+
}
|
|
3221
3293
|
companyIdentificationNumber
|
|
3222
3294
|
taxIdentificationNumber
|
|
3223
3295
|
}
|
|
3224
3296
|
contactInformation {
|
|
3225
3297
|
name
|
|
3226
3298
|
email
|
|
3299
|
+
phoneNumber {
|
|
3300
|
+
${FIELDS_PHONE_NUMBER}
|
|
3301
|
+
}
|
|
3227
3302
|
address
|
|
3228
3303
|
state
|
|
3229
3304
|
city
|
|
3230
3305
|
postalCode
|
|
3306
|
+
country {
|
|
3307
|
+
${FIELDS_COUNTRY}
|
|
3308
|
+
}
|
|
3231
3309
|
}
|
|
3232
3310
|
preferences {
|
|
3233
3311
|
timezoneName
|
|
@@ -3274,8 +3352,6 @@ const FIELDS_TENANT_COMPLIANCE_DOCUMENT = `
|
|
|
3274
3352
|
status
|
|
3275
3353
|
notes
|
|
3276
3354
|
file {
|
|
3277
|
-
key
|
|
3278
|
-
bucket
|
|
3279
3355
|
location
|
|
3280
3356
|
}
|
|
3281
3357
|
createdAt
|