@snugdesk/whatsapp-widget 0.2.2 → 0.2.3
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.
Potentially problematic release.
This version of @snugdesk/whatsapp-widget might be problematic. Click here for more details.
|
@@ -22,12 +22,12 @@ import * as i6$1 from '@angular/material/select';
|
|
|
22
22
|
import { MatSelectModule } from '@angular/material/select';
|
|
23
23
|
import * as i1 from '@snugdesk/core';
|
|
24
24
|
import { CustomValidators, CleanDeep, SnugdeskCoreModule, CustomPipesModule } from '@snugdesk/core';
|
|
25
|
-
import { API, Amplify } from 'aws-amplify';
|
|
26
|
-
import { GRAPHQL_AUTH_MODE } from '@aws-amplify/api-graphql';
|
|
27
25
|
import moment from 'moment-timezone';
|
|
28
26
|
import { lastValueFrom, BehaviorSubject } from 'rxjs';
|
|
29
27
|
import * as i1$1 from '@angular/common/http';
|
|
30
28
|
import { HttpHeaders } from '@angular/common/http';
|
|
29
|
+
import { API, Amplify } from 'aws-amplify';
|
|
30
|
+
import { GRAPHQL_AUTH_MODE } from '@aws-amplify/api-graphql';
|
|
31
31
|
import * as i3 from '@angular/material/snack-bar';
|
|
32
32
|
import { parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
33
33
|
import * as i6$2 from 'ngx-avatars';
|
|
@@ -44,18 +44,32 @@ import { sort } from 'sort-nested-json';
|
|
|
44
44
|
import * as i16 from '@ctrl/ngx-emoji-mart';
|
|
45
45
|
import { PickerModule } from '@ctrl/ngx-emoji-mart';
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
var ModelAttributeTypes;
|
|
48
|
+
(function (ModelAttributeTypes) {
|
|
49
|
+
ModelAttributeTypes["binary"] = "binary";
|
|
50
|
+
ModelAttributeTypes["binarySet"] = "binarySet";
|
|
51
|
+
ModelAttributeTypes["bool"] = "bool";
|
|
52
|
+
ModelAttributeTypes["list"] = "list";
|
|
53
|
+
ModelAttributeTypes["map"] = "map";
|
|
54
|
+
ModelAttributeTypes["number"] = "number";
|
|
55
|
+
ModelAttributeTypes["numberSet"] = "numberSet";
|
|
56
|
+
ModelAttributeTypes["string"] = "string";
|
|
57
|
+
ModelAttributeTypes["stringSet"] = "stringSet";
|
|
58
|
+
ModelAttributeTypes["_null"] = "_null";
|
|
59
|
+
})(ModelAttributeTypes || (ModelAttributeTypes = {}));
|
|
60
|
+
var ModelSortDirection;
|
|
61
|
+
(function (ModelSortDirection) {
|
|
62
|
+
ModelSortDirection["ASC"] = "ASC";
|
|
63
|
+
ModelSortDirection["DESC"] = "DESC";
|
|
64
|
+
})(ModelSortDirection || (ModelSortDirection = {}));
|
|
65
|
+
|
|
66
|
+
const defaultAmplifyConfig = {
|
|
67
|
+
aws_project_region: 'ap-south-1',
|
|
68
|
+
aws_appsync_graphqlEndpoint: 'https://sgbnsklbvrh67mcvh3wqkzgyou.appsync-api.ap-south-1.amazonaws.com/graphql',
|
|
69
|
+
aws_appsync_region: 'ap-south-1',
|
|
70
|
+
aws_appsync_authenticationType: 'AWS_LAMBDA',
|
|
50
71
|
};
|
|
51
72
|
|
|
52
|
-
const APPSYNC_GRAPHQL_CONFIG = new InjectionToken('APPSYNC_GRAPHQL_CONFIG');
|
|
53
|
-
function provideAppSyncConfig(config) {
|
|
54
|
-
return {
|
|
55
|
-
provide: APPSYNC_GRAPHQL_CONFIG,
|
|
56
|
-
useValue: config,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
73
|
const AMPLIFY_CONFIG = new InjectionToken('AMPLIFY_CONFIG');
|
|
60
74
|
function provideAmplifyConfig(config) {
|
|
61
75
|
return {
|
|
@@ -67,11 +81,9 @@ class AppSyncGraphqlService {
|
|
|
67
81
|
authenticationService;
|
|
68
82
|
configured = false;
|
|
69
83
|
authMode = GRAPHQL_AUTH_MODE.AWS_LAMBDA;
|
|
70
|
-
config;
|
|
71
84
|
amplifyConfig;
|
|
72
|
-
constructor(
|
|
85
|
+
constructor(amplifyConfig, authenticationService) {
|
|
73
86
|
this.authenticationService = authenticationService;
|
|
74
|
-
this.config = config ?? defaultAppSyncConfig;
|
|
75
87
|
this.amplifyConfig = amplifyConfig;
|
|
76
88
|
// this.ensureConfigured();
|
|
77
89
|
}
|
|
@@ -153,30 +165,24 @@ class AppSyncGraphqlService {
|
|
|
153
165
|
}
|
|
154
166
|
if (this.amplifyConfig) {
|
|
155
167
|
Amplify.configure(this.amplifyConfig);
|
|
156
|
-
this.authMode = this.normalizeAuthMode(this.getAuthModeFromConfig(this.amplifyConfig))
|
|
168
|
+
this.authMode = this.normalizeAuthMode(this.getAuthModeFromConfig(this.amplifyConfig));
|
|
157
169
|
this.configured = true;
|
|
158
170
|
return;
|
|
159
171
|
}
|
|
160
172
|
const hostConfig = this.getHostConfig();
|
|
161
173
|
if (hostConfig.useHost) {
|
|
162
|
-
this.authMode = this.normalizeAuthMode(hostConfig.authMode)
|
|
174
|
+
this.authMode = this.normalizeAuthMode(hostConfig.authMode);
|
|
163
175
|
this.configured = true;
|
|
164
176
|
return;
|
|
165
177
|
}
|
|
166
|
-
if (!this.config?.endpoint || !this.config?.region) {
|
|
167
|
-
throw new Error('AppSync GraphQL configuration is missing.');
|
|
168
|
-
}
|
|
169
|
-
const { endpoint, region } = this.config;
|
|
170
178
|
Amplify.configure({
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
aws_appsync_region: region,
|
|
174
|
-
aws_appsync_authenticationType: GRAPHQL_AUTH_MODE.AWS_LAMBDA,
|
|
179
|
+
...defaultAmplifyConfig,
|
|
180
|
+
aws_appsync_authenticationType: this.normalizeAuthMode(defaultAmplifyConfig.aws_appsync_authenticationType),
|
|
175
181
|
API: {
|
|
176
182
|
GraphQL: {
|
|
177
|
-
endpoint,
|
|
178
|
-
region,
|
|
179
|
-
defaultAuthMode:
|
|
183
|
+
endpoint: defaultAmplifyConfig.aws_appsync_graphqlEndpoint,
|
|
184
|
+
region: defaultAmplifyConfig.aws_appsync_region,
|
|
185
|
+
defaultAuthMode: this.normalizeAuthMode(defaultAmplifyConfig.aws_appsync_authenticationType),
|
|
180
186
|
graphql_headers: async () => this.buildAuthHeaders(),
|
|
181
187
|
functionAuthProvider: async () => ({
|
|
182
188
|
token: this.getToken(),
|
|
@@ -184,7 +190,7 @@ class AppSyncGraphqlService {
|
|
|
184
190
|
},
|
|
185
191
|
},
|
|
186
192
|
});
|
|
187
|
-
this.authMode =
|
|
193
|
+
this.authMode = this.normalizeAuthMode(defaultAmplifyConfig.aws_appsync_authenticationType);
|
|
188
194
|
this.configured = true;
|
|
189
195
|
}
|
|
190
196
|
getHostConfig() {
|
|
@@ -192,7 +198,7 @@ class AppSyncGraphqlService {
|
|
|
192
198
|
const existingEndpoint = existing?.API?.GraphQL?.endpoint ?? existing?.API?.GraphQL?.graphql_endpoint ?? existing?.aws_appsync_graphqlEndpoint;
|
|
193
199
|
const existingAuthMode = existing?.API?.GraphQL?.defaultAuthMode ?? existing?.aws_appsync_authenticationType;
|
|
194
200
|
return {
|
|
195
|
-
useHost: existingEndpoint ===
|
|
201
|
+
useHost: existingEndpoint === defaultAmplifyConfig.aws_appsync_graphqlEndpoint,
|
|
196
202
|
authMode: existingAuthMode,
|
|
197
203
|
};
|
|
198
204
|
}
|
|
@@ -234,7 +240,7 @@ class AppSyncGraphqlService {
|
|
|
234
240
|
}
|
|
235
241
|
return token;
|
|
236
242
|
}
|
|
237
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AppSyncGraphqlService, deps: [{ token:
|
|
243
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AppSyncGraphqlService, deps: [{ token: AMPLIFY_CONFIG, optional: true }, { token: i1.SnugdeskAuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
238
244
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AppSyncGraphqlService, providedIn: 'root' });
|
|
239
245
|
}
|
|
240
246
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AppSyncGraphqlService, decorators: [{
|
|
@@ -244,35 +250,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
244
250
|
}]
|
|
245
251
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
246
252
|
type: Optional
|
|
247
|
-
}, {
|
|
248
|
-
type: Inject,
|
|
249
|
-
args: [APPSYNC_GRAPHQL_CONFIG]
|
|
250
|
-
}] }, { type: undefined, decorators: [{
|
|
251
|
-
type: Optional
|
|
252
253
|
}, {
|
|
253
254
|
type: Inject,
|
|
254
255
|
args: [AMPLIFY_CONFIG]
|
|
255
256
|
}] }, { type: i1.SnugdeskAuthenticationService }] });
|
|
256
257
|
|
|
257
|
-
var ModelAttributeTypes;
|
|
258
|
-
(function (ModelAttributeTypes) {
|
|
259
|
-
ModelAttributeTypes["binary"] = "binary";
|
|
260
|
-
ModelAttributeTypes["binarySet"] = "binarySet";
|
|
261
|
-
ModelAttributeTypes["bool"] = "bool";
|
|
262
|
-
ModelAttributeTypes["list"] = "list";
|
|
263
|
-
ModelAttributeTypes["map"] = "map";
|
|
264
|
-
ModelAttributeTypes["number"] = "number";
|
|
265
|
-
ModelAttributeTypes["numberSet"] = "numberSet";
|
|
266
|
-
ModelAttributeTypes["string"] = "string";
|
|
267
|
-
ModelAttributeTypes["stringSet"] = "stringSet";
|
|
268
|
-
ModelAttributeTypes["_null"] = "_null";
|
|
269
|
-
})(ModelAttributeTypes || (ModelAttributeTypes = {}));
|
|
270
|
-
var ModelSortDirection;
|
|
271
|
-
(function (ModelSortDirection) {
|
|
272
|
-
ModelSortDirection["ASC"] = "ASC";
|
|
273
|
-
ModelSortDirection["DESC"] = "DESC";
|
|
274
|
-
})(ModelSortDirection || (ModelSortDirection = {}));
|
|
275
|
-
|
|
276
258
|
const ENTITY_SELECTION = /* GraphQL */ `
|
|
277
259
|
id
|
|
278
260
|
externalId
|
|
@@ -6315,7 +6297,7 @@ class WhatsAppWidgetModule {
|
|
|
6315
6297
|
InfiniteScrollDirective,
|
|
6316
6298
|
NgxSkeletonLoaderModule,
|
|
6317
6299
|
PickerModule], exports: [WhatsAppWidgetComponent, WhatsAppTextFormatterPipe] });
|
|
6318
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: WhatsAppWidgetModule,
|
|
6300
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: WhatsAppWidgetModule, imports: [CommonModule,
|
|
6319
6301
|
FormsModule,
|
|
6320
6302
|
ReactiveFormsModule,
|
|
6321
6303
|
MatNativeDateModule,
|
|
@@ -6376,7 +6358,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
6376
6358
|
PickerModule,
|
|
6377
6359
|
],
|
|
6378
6360
|
exports: [WhatsAppWidgetComponent, WhatsAppTextFormatterPipe],
|
|
6379
|
-
providers: [
|
|
6361
|
+
// providers: [provideAmplifyConfig(defaultAmplifyConfig)],
|
|
6380
6362
|
}]
|
|
6381
6363
|
}] });
|
|
6382
6364
|
|
|
@@ -6388,5 +6370,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
6388
6370
|
* Generated bundle index. Do not edit.
|
|
6389
6371
|
*/
|
|
6390
6372
|
|
|
6391
|
-
export { AMPLIFY_CONFIG,
|
|
6373
|
+
export { AMPLIFY_CONFIG, AppSyncGraphqlService, CustomError, LocationInputComponent, PhoneInputComponent, WhatsAppContactCreateComponent, WhatsAppContactListComponent, WhatsAppConversationsComponent, WhatsAppMessageItemComponent, WhatsAppMessagesComponent, WhatsAppTemplatePreviewComponent, WhatsAppTemplatesComponent, WhatsAppTextFormatterPipe, WhatsAppWidgetComponent, WhatsAppWidgetModule, provideAmplifyConfig };
|
|
6392
6374
|
//# sourceMappingURL=snugdesk-whatsapp-widget.mjs.map
|