@osovitny/anatoly 3.19.33 → 3.19.35

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.
@@ -0,0 +1,28 @@
1
+ https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
2
+ https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
3
+
4
+ {
5
+ "code": "en", //Language Code => 639-1 or 639-2
6
+ "name": "English", //Country Name
7
+ "country": "us" //Country Code
8
+ }
9
+
10
+ "us" //The United States of America
11
+ "ru" //The Russian Federation
12
+ "es" //The Kingdom of Spain
13
+ "in" //The Republic of India
14
+ "am" //The Republic of Armenia
15
+ "ua" //Ukraine
16
+
17
+ Recommendation:
18
+ Use ISO 639‑1 codes (en, fr, es, ru) in most cases.
19
+ Short → only 2 characters, compact for storage and indexing.
20
+ Widely supported → used in BCP 47 language tags, browsers, HTTP Accept-Language, Android/iOS locales.
21
+ Easy for users → more familiar for developers and end users.
22
+ Good for most apps → unless you need obscure languages.
23
+
24
+ When to use ISO 639‑2
25
+ Use 3‑letter codes (eng, fra, spa) only if:
26
+ You must support rare, historical, or constructed languages not in ISO 639‑1.
27
+ You work with bibliographic or archival systems (libraries, research).
28
+ You need to distinguish similar but separate dialects more precisely.
@@ -0,0 +1,38 @@
1
+ [
2
+ {
3
+ "code": "en",
4
+ "name": "English",
5
+ "country": "us",
6
+ "standard": "639-1"
7
+ },
8
+ {
9
+ "code": "ru",
10
+ "name": "Russian",
11
+ "country": "ru",
12
+ "standard": "639-1"
13
+ },
14
+ {
15
+ "code": "es",
16
+ "name": "Spanish",
17
+ "country": "es",
18
+ "standard": "639-1"
19
+ },
20
+ {
21
+ "code": "hi",
22
+ "name": "Hindi",
23
+ "country": "in",
24
+ "standard": "639-1"
25
+ },
26
+ {
27
+ "code": "hy",
28
+ "name": "Armenian",
29
+ "country": "am",
30
+ "standard": "639-1"
31
+ },
32
+ {
33
+ "code": "uk",
34
+ "name": "Ukrainian",
35
+ "country": "ua",
36
+ "standard": "639-1"
37
+ }
38
+ ]
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, EventEmitter, Component, Output, Input, Inject, Pipe, provideAppInitializer, inject, NgModule, Directive, ChangeDetectionStrategy, ViewChild, ViewEncapsulation, HostListener, HostBinding } from '@angular/core';
3
- import { BehaviorSubject, Subject, filter, takeUntil, map as map$1, catchError, of, merge, forkJoin, timer, fromEvent, firstValueFrom } from 'rxjs';
3
+ import { BehaviorSubject, merge, Subject, filter, takeUntil, map as map$1, catchError, of, forkJoin, timer, fromEvent, firstValueFrom } from 'rxjs';
4
4
  import { map, tap, mergeMap } from 'rxjs/operators';
5
5
  import * as i1 from '@angular/common/http';
6
6
  import { HttpResponse, HttpClient, HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
@@ -246,7 +246,6 @@ class Stopwatch {
246
246
 
247
247
  Authors:
248
248
  Vadim Osovitny vadim.osovitny@osovitny.com
249
- Anatoly Osovitny anatoly.osovitny@osovitny.com
250
249
 
251
250
  Created:
252
251
  28 Apr 2024
@@ -259,7 +258,9 @@ const AppContextStorageKeys = {
259
258
  currency: 'currency',
260
259
  //Lists
261
260
  countries: 'countries',
262
- languages: 'languages'
261
+ languages: 'languages',
262
+ timezones: 'timezones',
263
+ usStates: 'usStates'
263
264
  };
264
265
 
265
266
  /*
@@ -333,7 +334,6 @@ class SessionStorageService extends WebStorageService {
333
334
 
334
335
  Authors:
335
336
  Vadim Osovitny vadim.osovitny@osovitny.com
336
- Anatoly Osovitny anatoly.osovitny@osovitny.com
337
337
 
338
338
  Created:
339
339
  13 Nov 2017
@@ -350,14 +350,18 @@ class AppContextService extends ApiServiceBase {
350
350
  this.sessionStorage = sessionStorage;
351
351
  this.storageKeyName = 'appContext';
352
352
  this.subscription = null;
353
- //Private Streams
353
+ //updated
354
354
  this._updated = new BehaviorSubject(null);
355
- this._userUpdated = new BehaviorSubject(null);
356
- //Public Streams
357
355
  this.updated$ = this._updated.asObservable();
356
+ //userUpdated
357
+ this._userUpdated = new BehaviorSubject(null);
358
358
  this.userUpdated$ = this._userUpdated.asObservable();
359
+ //jsonFilesLoaded
360
+ this._jsonFilesLoaded = new BehaviorSubject(null);
361
+ this.jsonFilesLoaded$ = this._jsonFilesLoaded.asObservable();
359
362
  this.baseUrl = `${ApiUrl}/appContext`;
360
363
  }
364
+ //fires
361
365
  fireUpdated(data) {
362
366
  if (!data) {
363
367
  return;
@@ -367,6 +371,22 @@ class AppContextService extends ApiServiceBase {
367
371
  fireUserUpdated() {
368
372
  this._userUpdated.next(null);
369
373
  }
374
+ fireJsonFilesLoaded() {
375
+ this._jsonFilesLoaded.next(null);
376
+ }
377
+ //API
378
+ getCountriesJsonFile() {
379
+ return this.getExternalJsonFile('anatoly', 'countries.json');
380
+ }
381
+ getLanguagesJsonFile() {
382
+ return this.getExternalJsonFile('anatoly', 'languages.json');
383
+ }
384
+ getTimezonesJsonFile() {
385
+ return this.getExternalJsonFile('anatoly', 'timezones.json');
386
+ }
387
+ getUSStatesJsonFile() {
388
+ return this.getExternalJsonFile('anatoly', 'usStates.json');
389
+ }
370
390
  //Session
371
391
  getCurrent4Session() {
372
392
  return this.sessionStorage.getObject(this.storageKeyName);
@@ -423,6 +443,46 @@ class AppContextService extends ApiServiceBase {
423
443
  this.current = context;
424
444
  }
425
445
  }
446
+ loadStandardJsonFiles() {
447
+ let countries = this.countries;
448
+ let languages = this.languages;
449
+ let timezones = this.timezones;
450
+ let usStates = this.usStates;
451
+ if (countries && languages && timezones && usStates) {
452
+ //VadimOS: that means NO action requried, just we have everything in place
453
+ return null;
454
+ }
455
+ let countries$ = this.getCountriesJsonFile().pipe(map(data => {
456
+ if (data) {
457
+ this.countries = data;
458
+ }
459
+ }));
460
+ let languages$ = this.getLanguagesJsonFile().pipe(map(data => {
461
+ if (data) {
462
+ this.languages = data;
463
+ }
464
+ }));
465
+ let timezones$ = this.getTimezonesJsonFile().pipe(map(data => {
466
+ if (data) {
467
+ this.timezones = data;
468
+ }
469
+ }));
470
+ let usStates$ = this.getUSStatesJsonFile().pipe(map(data => {
471
+ if (data) {
472
+ this.usStates = data;
473
+ }
474
+ }));
475
+ let tasks$ = merge(countries$, languages$, timezones$, usStates$);
476
+ //Logging
477
+ let stopwatch = new Stopwatch("AppContextService: standard json files loaded");
478
+ stopwatch.start();
479
+ return tasks$.pipe(map(() => {
480
+ this.fireJsonFilesLoaded();
481
+ //Logging
482
+ stopwatch.stop();
483
+ stopwatch.printElapsedAsMilliseconds();
484
+ }));
485
+ }
426
486
  loadRequiredJsonFiles() {
427
487
  return null;
428
488
  }
@@ -495,6 +555,26 @@ class AppContextService extends ApiServiceBase {
495
555
  clearLanguages() {
496
556
  this.localStorage.remove(AppContextStorageKeys.languages);
497
557
  }
558
+ //timezones => localStorage
559
+ get timezones() {
560
+ return this.localStorage.getObject(AppContextStorageKeys.timezones);
561
+ }
562
+ set timezones(value) {
563
+ this.localStorage.setObject(AppContextStorageKeys.timezones, value);
564
+ }
565
+ clearTimezones() {
566
+ this.localStorage.remove(AppContextStorageKeys.timezones);
567
+ }
568
+ //usStates => localStorage
569
+ get usStates() {
570
+ return this.localStorage.getObject(AppContextStorageKeys.usStates);
571
+ }
572
+ set usStates(value) {
573
+ this.localStorage.setObject(AppContextStorageKeys.usStates, value);
574
+ }
575
+ clearUSStates() {
576
+ this.localStorage.remove(AppContextStorageKeys.usStates);
577
+ }
498
578
  static { this.ɵfac = function AppContextService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AppContextService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(LocalStorageService), i0.ɵɵinject(SessionStorageService)); }; }
499
579
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AppContextService, factory: AppContextService.ɵfac }); }
500
580
  }
@@ -2686,14 +2766,17 @@ class StarterService extends ApiServiceBase {
2686
2766
  //1. Application Starting
2687
2767
  let applicationStarting$ = this.applicationStarting();
2688
2768
  //2. Load json files
2689
- let jsonFiles$ = this.appContext.loadRequiredJsonFiles();
2769
+ let standardJsonFiles$ = this.appContext.loadStandardJsonFiles();
2770
+ let requiredJsonFiles$ = this.appContext.loadRequiredJsonFiles();
2690
2771
  //3. Load required items, like settings
2691
2772
  let requiredItems$ = this.appContext.loadRequiredItems();
2692
2773
  //Tasks to execute
2693
2774
  let parallelTasks = [];
2694
2775
  let tasks$ = null;
2695
- if (jsonFiles$)
2696
- parallelTasks.push(jsonFiles$);
2776
+ if (standardJsonFiles$)
2777
+ parallelTasks.push(standardJsonFiles$);
2778
+ if (requiredJsonFiles$)
2779
+ parallelTasks.push(requiredJsonFiles$);
2697
2780
  if (requiredItems$)
2698
2781
  parallelTasks.push(requiredItems$);
2699
2782
  /*
@@ -2712,7 +2795,7 @@ class StarterService extends ApiServiceBase {
2712
2795
  tasks$ = applicationStarting$;
2713
2796
  }
2714
2797
  //Logging
2715
- let stopwatch = new Stopwatch("StarterService.ensureApplicationStarted");
2798
+ let stopwatch = new Stopwatch("StarterService: ensureApplicationStarted");
2716
2799
  stopwatch.start();
2717
2800
  return tasks$.pipe(map(() => {
2718
2801
  //Logging
@@ -5080,11 +5163,7 @@ class SubscriptionsApiService extends ApiServiceBase {
5080
5163
  getSubscriptions(data) {
5081
5164
  return this.get('getSubscriptions', data);
5082
5165
  }
5083
- addSubscription(
5084
- //Subscription
5085
- subscriptionProvider, newSubscriptionId,
5086
- //Plan & Price
5087
- planId, addons, subtotal, promoCode, total, currency, success, error) {
5166
+ addSubscription(subscriptionProvider, newSubscriptionId, planId, addons, subtotal, promoCode, total, currency, success, error) {
5088
5167
  this.post('addSubscription', {
5089
5168
  subscriptionProvider, newSubscriptionId,
5090
5169
  planId, addons, subtotal, promoCode, total, currency
@@ -5099,6 +5178,20 @@ class SubscriptionsApiService extends ApiServiceBase {
5099
5178
  }
5100
5179
  });
5101
5180
  }
5181
+ addFreeSubscription(planId, addons, subtotal, promoCode, total, currency, success, error) {
5182
+ this.post('addFreeSubscription', {
5183
+ planId, addons, subtotal, promoCode, total, currency
5184
+ }).subscribe({
5185
+ next: (data) => {
5186
+ if (success)
5187
+ success(data);
5188
+ },
5189
+ error: (e) => {
5190
+ if (error)
5191
+ error(e);
5192
+ }
5193
+ });
5194
+ }
5102
5195
  cancelSubscription(subscriptionProvider, subscriptionId, success, error) {
5103
5196
  this.post('cancelSubscription', { subscriptionProvider, subscriptionId }).subscribe({
5104
5197
  next: (data) => {
@@ -5166,8 +5259,6 @@ class BillingService {
5166
5259
  createBraintreeToken() {
5167
5260
  return this.apiPayments.createBraintreeToken();
5168
5261
  }
5169
- /*
5170
- */
5171
5262
  addPayment(paymentMethod, paidFor, subtotal, promoCode, total, currency, pmId, pmStatus, pmDetails) {
5172
5263
  this.zone.run(() => {
5173
5264
  let paidForAsString = JSON.stringify(paidFor);
@@ -5202,9 +5293,6 @@ class BillingService {
5202
5293
  this.ns.error("Payment Failed");
5203
5294
  }
5204
5295
  }
5205
- /*
5206
- Adding Subscription after it is paid
5207
- */
5208
5296
  addSubscription(sp, newSubscriptionId, planId, addons, subtotal, promoCode, total, currency) {
5209
5297
  this.zone.run(() => {
5210
5298
  this.apiSubscriptions.addSubscription(sp, newSubscriptionId, planId, addons, subtotal, promoCode, total, currency, () => {
@@ -5215,6 +5303,16 @@ class BillingService {
5215
5303
  });
5216
5304
  });
5217
5305
  }
5306
+ addFreeSubscription(planId, addons, subtotal, promoCode, total, currency) {
5307
+ this.zone.run(() => {
5308
+ this.apiSubscriptions.addFreeSubscription(planId, addons, subtotal, promoCode, total, currency, () => {
5309
+ this.fireSubscriptionAdded(false, false);
5310
+ this.appContext.updateCurrent();
5311
+ }, () => {
5312
+ this.fireSubscriptionAdded(false, true);
5313
+ });
5314
+ });
5315
+ }
5218
5316
  static { this.ɵfac = function BillingService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BillingService)(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(AppContextService), i0.ɵɵinject(PaymentsApiService), i0.ɵɵinject(SubscriptionsApiService), i0.ɵɵinject(NotificationService)); }; }
5219
5317
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: BillingService, factory: BillingService.ɵfac }); }
5220
5318
  }
@@ -6533,15 +6631,6 @@ class CoreApiService extends ApiServiceBase {
6533
6631
  this.http = http;
6534
6632
  this.baseUrl = `${ApiUrl}/core`;
6535
6633
  }
6536
- getTimezonesJsonFile() {
6537
- return this.getExternalJsonFile('anatoly', 'timezones.json');
6538
- }
6539
- getCountriesJsonFile() {
6540
- return this.getExternalJsonFile('anatoly', 'countries.json');
6541
- }
6542
- getUSStatesJsonFile() {
6543
- return this.getExternalJsonFile('anatoly', 'usStates.json');
6544
- }
6545
6634
  static { this.ɵfac = function CoreApiService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CoreApiService)(i0.ɵɵinject(i1.HttpClient)); }; }
6546
6635
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CoreApiService, factory: CoreApiService.ɵfac }); }
6547
6636
  }
@@ -7148,18 +7237,18 @@ function CountryDropdownlist_div_1_Template(rf, ctx) { if (rf & 1) {
7148
7237
  i0.ɵɵproperty("ngForOf", ctx_r0.items);
7149
7238
  } }
7150
7239
  class CountryDropdownlist extends EditComponentBase {
7151
- constructor(api) {
7240
+ constructor(appContext) {
7152
7241
  super();
7153
- this.api = api;
7242
+ this.appContext = appContext;
7154
7243
  this.title = 'Country';
7155
7244
  }
7156
7245
  ngOnInit() {
7157
7246
  this.setValues();
7158
7247
  }
7159
7248
  setValues() {
7160
- this.api.getCountriesJsonFile().subscribe({
7161
- next: (data) => {
7162
- this.items = data.reverse();
7249
+ this.appContext.jsonFilesLoaded$.subscribe({
7250
+ next: () => {
7251
+ this.items = this.appContext.countries.reverse();
7163
7252
  }
7164
7253
  });
7165
7254
  if (this.isNgModelBased) {
@@ -7167,7 +7256,7 @@ class CountryDropdownlist extends EditComponentBase {
7167
7256
  else {
7168
7257
  }
7169
7258
  }
7170
- static { this.ɵfac = function CountryDropdownlist_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CountryDropdownlist)(i0.ɵɵdirectiveInject(CoreApiService)); }; }
7259
+ static { this.ɵfac = function CountryDropdownlist_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CountryDropdownlist)(i0.ɵɵdirectiveInject(AppContextService)); }; }
7171
7260
  static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CountryDropdownlist, selectors: [["anatoly-country-dropdownlist"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 2, vars: 2, consts: [[4, "ngIf"], [3, "formGroup", 4, "ngIf"], [3, "formGroup"], [3, "text", 4, "ngIf"], [1, "form-select", 3, "formControlName"], [3, "value", 4, "ngFor", "ngForOf"], [3, "text"], [3, "value"]], template: function CountryDropdownlist_Template(rf, ctx) { if (rf & 1) {
7172
7261
  i0.ɵɵtemplate(0, CountryDropdownlist_div_0_Template, 1, 0, "div", 0)(1, CountryDropdownlist_div_1_Template, 4, 4, "div", 1);
7173
7262
  } if (rf & 2) {
@@ -7179,7 +7268,7 @@ class CountryDropdownlist extends EditComponentBase {
7179
7268
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CountryDropdownlist, [{
7180
7269
  type: Component,
7181
7270
  args: [{ selector: 'anatoly-country-dropdownlist', standalone: false, template: "<div *ngIf='isNgModelBased'>\r\n</div>\r\n\r\n<div *ngIf='!isNgModelBased' [formGroup]='formGroup'>\r\n <kendo-label text=\"{{ title }}\" *ngIf='isTitleVisible'></kendo-label>\r\n <select [formControlName]='controlName' class='form-select'>\r\n <option *ngFor='let item of items' [value]='item.code'>\r\n {{ item.name }}\r\n </option>\r\n </select>\r\n</div>\r\n" }]
7182
- }], () => [{ type: CoreApiService }], null); })();
7271
+ }], () => [{ type: AppContextService }], null); })();
7183
7272
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CountryDropdownlist, { className: "CountryDropdownlist", filePath: "lib/ui/components/dropdownlists/country/country.dropdownlist.ts", lineNumber: 28 }); })();
7184
7273
 
7185
7274
  /*
@@ -7560,9 +7649,8 @@ function TimezoneDropdownlist_div_1_Template(rf, ctx) { if (rf & 1) {
7560
7649
  i0.ɵɵproperty("ngForOf", ctx_r1.items);
7561
7650
  } }
7562
7651
  class TimezoneDropdownlist extends EditComponentBase {
7563
- constructor(api, appContext) {
7652
+ constructor(appContext) {
7564
7653
  super();
7565
- this.api = api;
7566
7654
  this.appContext = appContext;
7567
7655
  this.disabled = false;
7568
7656
  this.title = 'Timezone';
@@ -7571,9 +7659,9 @@ class TimezoneDropdownlist extends EditComponentBase {
7571
7659
  this.setValues();
7572
7660
  }
7573
7661
  setValues() {
7574
- this.api.getTimezonesJsonFile().subscribe({
7575
- next: (data) => {
7576
- this.items = data.reverse();
7662
+ this.appContext.jsonFilesLoaded$.subscribe({
7663
+ next: () => {
7664
+ this.items = this.appContext.timezones.reverse();
7577
7665
  }
7578
7666
  });
7579
7667
  if (this.isNgModelBased) {
@@ -7598,7 +7686,7 @@ class TimezoneDropdownlist extends EditComponentBase {
7598
7686
  }
7599
7687
  }
7600
7688
  }
7601
- static { this.ɵfac = function TimezoneDropdownlist_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TimezoneDropdownlist)(i0.ɵɵdirectiveInject(CoreApiService), i0.ɵɵdirectiveInject(AppContextService)); }; }
7689
+ static { this.ɵfac = function TimezoneDropdownlist_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TimezoneDropdownlist)(i0.ɵɵdirectiveInject(AppContextService)); }; }
7602
7690
  static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TimezoneDropdownlist, selectors: [["anatoly-timezone-dropdownlist"]], inputs: { disabled: "disabled" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 2, vars: 2, consts: [[4, "ngIf"], [3, "formGroup", 4, "ngIf"], [3, "formGroup"], ["class", "col-form-label", 4, "ngIf"], [1, "form-select", 3, "formControlName", "disabled"], [3, "value", 4, "ngFor", "ngForOf"], [1, "col-form-label"], [3, "value"]], template: function TimezoneDropdownlist_Template(rf, ctx) { if (rf & 1) {
7603
7691
  i0.ɵɵtemplate(0, TimezoneDropdownlist_div_0_Template, 1, 0, "div", 0)(1, TimezoneDropdownlist_div_1_Template, 4, 5, "div", 1);
7604
7692
  } if (rf & 2) {
@@ -7610,10 +7698,10 @@ class TimezoneDropdownlist extends EditComponentBase {
7610
7698
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TimezoneDropdownlist, [{
7611
7699
  type: Component,
7612
7700
  args: [{ selector: 'anatoly-timezone-dropdownlist', standalone: false, template: "<div *ngIf='isNgModelBased'>\r\n</div>\r\n\r\n<div *ngIf='!isNgModelBased' [formGroup]='formGroup'>\r\n <label *ngIf='isTitleVisible' class='col-form-label'>Timezone</label>\r\n <select [formControlName]='controlName' class='form-select' [disabled]='disabled'>\r\n <option *ngFor='let item of items' [value]='item.code'>\r\n ({{ item.offset }}) {{ item.name }}\r\n </option>\r\n </select>\r\n</div>\r\n" }]
7613
- }], () => [{ type: CoreApiService }, { type: AppContextService }], { disabled: [{
7701
+ }], () => [{ type: AppContextService }], { disabled: [{
7614
7702
  type: Input
7615
7703
  }] }); })();
7616
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TimezoneDropdownlist, { className: "TimezoneDropdownlist", filePath: "lib/ui/components/dropdownlists/timezone/timezone.dropdownlist.ts", lineNumber: 30 }); })();
7704
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TimezoneDropdownlist, { className: "TimezoneDropdownlist", filePath: "lib/ui/components/dropdownlists/timezone/timezone.dropdownlist.ts", lineNumber: 29 }); })();
7617
7705
 
7618
7706
  /*
7619
7707
  <file>
@@ -9606,10 +9694,10 @@ class AddressComponent extends EditComponentBase {
9606
9694
  this.init();
9607
9695
  }
9608
9696
  }
9609
- constructor(fb, api) {
9697
+ constructor(fb, appContext) {
9610
9698
  super();
9611
9699
  this.fb = fb;
9612
- this.api = api;
9700
+ this.appContext = appContext;
9613
9701
  this.formGroupGenerated = false;
9614
9702
  this.countryData = [];
9615
9703
  this.usStateData = [];
@@ -9620,14 +9708,10 @@ class AddressComponent extends EditComponentBase {
9620
9708
  this.title = 'Address';
9621
9709
  }
9622
9710
  ngOnInit() {
9623
- this.api.getCountriesJsonFile().subscribe({
9624
- next: (data) => {
9625
- this.countryData = data;
9626
- }
9627
- });
9628
- this.api.getUSStatesJsonFile().subscribe({
9629
- next: (data) => {
9630
- this.usStateData = data;
9711
+ this.appContext.jsonFilesLoaded$.subscribe({
9712
+ next: () => {
9713
+ this.countryData = this.appContext.countries.reverse();
9714
+ this.usStateData = this.appContext.usStates;
9631
9715
  }
9632
9716
  });
9633
9717
  this.createFormGroup();
@@ -9687,7 +9771,7 @@ class AddressComponent extends EditComponentBase {
9687
9771
  let usState = event.target.value;
9688
9772
  this.change.emit(usState);
9689
9773
  }
9690
- static { this.ɵfac = function AddressComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AddressComponent)(i0.ɵɵdirectiveInject(i2$1.FormBuilder), i0.ɵɵdirectiveInject(CoreApiService)); }; }
9774
+ static { this.ɵfac = function AddressComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AddressComponent)(i0.ɵɵdirectiveInject(i2$1.FormBuilder), i0.ɵɵdirectiveInject(AppContextService)); }; }
9691
9775
  static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AddressComponent, selectors: [["anatoly-forms-address"]], inputs: { address: "address" }, outputs: { change: "change" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 30, vars: 29, consts: [["classes", "card-outline card-primary"], [3, "title", 4, "ngIf"], [3, "formGroup"], [1, "row"], [1, "form-group", 3, "ngClass"], ["type", "text", "formControlName", "address_street", "placeholder", "Street Address", 1, "form-control"], ["controlName", "address_street", "controlTitle", "Street", 3, "formGroup", "formSubmitted"], ["type", "text", "formControlName", "address_street2", "placeholder", "Apartment, suite, unit, building, floor, etc.", 1, "form-control"], ["controlName", "address_street2", "controlTitle", "Street2", 3, "formGroup", "formSubmitted"], [1, "form-group", "col-3", "mb-0", 3, "ngClass"], ["type", "text", "formControlName", "address_city", "placeholder", "City", 1, "form-control"], ["controlName", "address_city", "controlTitle", "City", 3, "formGroup", "formSubmitted"], ["class", "form-group col-3 mb-0", 3, "ngClass", 4, "ngIf"], ["type", "text", "formControlName", "address_zipcode", "placeholder", "zipcode", 1, "form-control"], ["controlName", "address_zipcode", "controlTitle", "zipcode", 3, "formGroup", "formSubmitted"], ["formControlName", "address_country", "data-placeholder", "Select a Country", 1, "form-control", 3, "change"], [3, "value", 4, "ngFor", "ngForOf"], ["controlName", "address_country", "controlTitle", "Country", 3, "formGroup", "formSubmitted"], [3, "title"], ["formControlName", "address_stateOrRegion", 1, "form-control", 3, "change"], ["controlName", "address_stateOrRegion", "controlTitle", "State", 3, "formGroup", "formSubmitted"], [3, "value"]], template: function AddressComponent_Template(rf, ctx) { if (rf & 1) {
9692
9776
  i0.ɵɵelementStart(0, "anatoly-card", 0);
9693
9777
  i0.ɵɵtemplate(1, AddressComponent_anatoly_card_header_1_Template, 1, 1, "anatoly-card-header", 1);
@@ -9753,7 +9837,7 @@ class AddressComponent extends EditComponentBase {
9753
9837
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AddressComponent, [{
9754
9838
  type: Component,
9755
9839
  args: [{ selector: 'anatoly-forms-address', standalone: false, template: "<anatoly-card classes='card-outline card-primary'>\r\n <anatoly-card-header *ngIf='isTitleVisible' [title]='title' />\r\n <anatoly-card-body [formGroup]='formGroup'>\r\n <div class=\"row\">\r\n <div class='form-group' [ngClass]=\"{'has-error': isControlInvalid('address_street')}\" >\r\n <label>Street Address</label>\r\n <input type='text' class='form-control' formControlName='address_street' placeholder='Street Address'>\r\n <anatoly-item-validation-summary controlName='address_street'\r\n controlTitle='Street'\r\n [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'>\r\n </anatoly-item-validation-summary>\r\n </div>\r\n <div class='form-group' [ngClass]=\"{'has-error': isControlInvalid('address_street2')}\" >\r\n <input type='text' class='form-control' formControlName='address_street2' placeholder='Apartment, suite, unit, building, floor, etc.'>\r\n <anatoly-item-validation-summary controlName='address_street2'\r\n controlTitle='Street2'\r\n [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'>\r\n </anatoly-item-validation-summary>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class='form-group col-3 mb-0' [ngClass]=\"{'has-error': isControlInvalid('address_city')}\">\r\n <label>City</label>\r\n <input type='text' class='form-control' formControlName='address_city' placeholder='City'>\r\n <anatoly-item-validation-summary controlName='address_city'\r\n controlTitle='City'\r\n [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'>\r\n </anatoly-item-validation-summary>\r\n </div>\r\n <div class='form-group col-3 mb-0' *ngIf=\"formGroup.value.address_country == 'US'\" [ngClass]=\"{'has-error': isControlInvalid('address_stateOrRegion')}\">\r\n <label>State</label>\r\n <select class='form-control' (change)='onUSStateChange($event)' formControlName='address_stateOrRegion'>\r\n <option *ngFor='let state of usStateData' [value]='state.code'>{{state.name}}</option>\r\n </select>\r\n <anatoly-item-validation-summary controlName='address_stateOrRegion'\r\n controlTitle='State'\r\n [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'>\r\n </anatoly-item-validation-summary>\r\n </div>\r\n <div class='form-group col-3 mb-0' [ngClass]=\"{'has-error': isControlInvalid('address_zipcode')}\" >\r\n <label>Zipcode</label>\r\n <input type='text' class='form-control' formControlName='address_zipcode' placeholder='zipcode'>\r\n <anatoly-item-validation-summary controlName='address_zipcode'\r\n controlTitle='zipcode'\r\n [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'>\r\n </anatoly-item-validation-summary>\r\n </div>\r\n <div class='form-group col-3 mb-0' [ngClass]=\"{'has-error': isControlInvalid('address_country')}\">\r\n <label>Country</label>\r\n <select class='form-control' (change)='onCountryChange($event)' formControlName='address_country' data-placeholder='Select a Country'>\r\n <option *ngFor='let country of countryData' [value]='country.code'>{{country.name}}</option>\r\n </select>\r\n <anatoly-item-validation-summary controlName='address_country'\r\n controlTitle='Country'\r\n [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'>\r\n </anatoly-item-validation-summary>\r\n </div>\r\n </div>\r\n </anatoly-card-body>\r\n</anatoly-card>\r\n" }]
9756
- }], () => [{ type: i2$1.FormBuilder }, { type: CoreApiService }], { address: [{
9840
+ }], () => [{ type: i2$1.FormBuilder }, { type: AppContextService }], { address: [{
9757
9841
  type: Input
9758
9842
  }], change: [{
9759
9843
  type: Output
@@ -10169,14 +10253,14 @@ class AnatolyDataModule {
10169
10253
  static { this.ɵfac = function AnatolyDataModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AnatolyDataModule)(); }; }
10170
10254
  static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AnatolyDataModule }); }
10171
10255
  static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
10172
- //Billing
10256
+ //Billing Services
10173
10257
  CurrenciesApiService,
10174
10258
  CurrenciesStorageService,
10175
10259
  PaymentsApiService,
10176
10260
  PromoCodesApiService,
10177
10261
  SubscriptionsApiService,
10178
10262
  TransactionsApiService,
10179
- //App
10263
+ //Services
10180
10264
  CoreApiService,
10181
10265
  EmailsApiService
10182
10266
  ], imports: [CommonModule] }); }
@@ -10188,14 +10272,14 @@ class AnatolyDataModule {
10188
10272
  CommonModule
10189
10273
  ],
10190
10274
  providers: [
10191
- //Billing
10275
+ //Billing Services
10192
10276
  CurrenciesApiService,
10193
10277
  CurrenciesStorageService,
10194
10278
  PaymentsApiService,
10195
10279
  PromoCodesApiService,
10196
10280
  SubscriptionsApiService,
10197
10281
  TransactionsApiService,
10198
- //App
10282
+ //Services
10199
10283
  CoreApiService,
10200
10284
  EmailsApiService
10201
10285
  ]