@mainmoneyapp/js-angular 0.1.5 → 0.2.1

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/README.md CHANGED
@@ -38,11 +38,22 @@ import { CheckoutWizardComponent } from "@mainmoneyapp/js-angular";
38
38
  imports: [CheckoutWizardComponent],
39
39
  template: `<mm-checkout-wizard [checkout]="checkout" />`,
40
40
  })
41
- export class PayComponent {
42
- checkout = createCheckout(session, { operation: "deposit", pollUrl, pollHeaders });
41
+ export class PayComponent implements OnInit {
42
+ checkout?: Checkout;
43
+
44
+ async ngOnInit(): Promise<void> {
45
+ const checkout = createCheckout(session, { operation: "deposit", pollUrl, pollHeaders });
46
+ await checkout.loadCountries();
47
+ this.checkout = checkout; // create once; a new instance restarts the widget
48
+ }
43
49
  }
44
50
  ```
45
51
 
46
52
  - The logo is embedded, so no `assets` entry is needed. Pass `[logoUrl]` to override it.
47
53
  - Changing `[checkout]` or `[logoUrl]` remounts the wizard.
48
54
  - Nothing is mounted on the server, so SSR is safe.
55
+ - Inputs: `checkout` (required), `logoUrl`, `colorScheme`, `variant`, `layout` (`form` | `wizard`), `defaultCountry`, `links`.
56
+ - The widget runs outside the Angular zone, so its polling and debounce timers do not trigger change detection.
57
+ - Create the `Checkout` once. Never build it in a template expression or getter.
58
+ - On `ngOnDestroy` of the host page call `checkout.close()` to stop status polling.
59
+ - The merchant backend must allow CORS for your origin, see [docs/troubleshooting.md](../../docs/troubleshooting.md) and [docs/frameworks/angular.md](../../docs/frameworks/angular.md).
@@ -1,42 +1,66 @@
1
1
  import { isPlatformBrowser } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { input, viewChild, inject, PLATFORM_ID, effect, Component } from '@angular/core';
3
+ import { input, viewChild, inject, PLATFORM_ID, NgZone, effect, untracked, Component } from '@angular/core';
4
4
  import { mountCheckout } from '@mainmoneyapp/js-checkout';
5
5
 
6
6
  /**
7
7
  * Checkout wizard. Import `@mainmoneyapp/js-checkout/styles.css` once in your app
8
8
  * (`angular.json` -> `styles`, or `src/main.ts`).
9
9
  *
10
- * The DOM mount only runs in the browser, so the component is safe under SSR.
11
- * `colorScheme` follows your theme signal: every change calls `checkout.setColorScheme`, which only flips the
12
- * palette (the form is not re-rendered, so a focused input keeps its focus and value).
10
+ * - The DOM mount only runs in the browser, so the component is safe under SSR.
11
+ * - The widget runs **outside the Angular zone**: its debounce timers, status polling and fetch calls would
12
+ * otherwise trigger a change-detection pass each. It renders its own DOM and never needs Angular to.
13
+ * - Create the `Checkout` once (in `ngOnInit`, a service or a signal), not in a template expression or getter:
14
+ * a new `Checkout` instance restarts the widget from the first step.
15
+ * - `colorScheme` follows your theme signal: every change calls `checkout.setColorScheme`, which only flips the
16
+ * palette (the form is not re-rendered, so a focused input keeps its focus and value).
13
17
  */
14
18
  class CheckoutWizardComponent {
15
19
  constructor() {
16
20
  this.checkout = input.required(...(ngDevMode ? [{ debugName: "checkout" }] : /* istanbul ignore next */ []));
17
21
  this.logoUrl = input(undefined, ...(ngDevMode ? [{ debugName: "logoUrl" }] : /* istanbul ignore next */ []));
18
- this.colorScheme = input("auto", ...(ngDevMode ? [{ debugName: "colorScheme" }] : /* istanbul ignore next */ []));
22
+ /** Leave unset to keep the scheme given to `createCheckout` (default `auto`). */
23
+ this.colorScheme = input(undefined, ...(ngDevMode ? [{ debugName: "colorScheme" }] : /* istanbul ignore next */ []));
19
24
  this.variant = input("default", ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
25
+ /** `form` is the single-page checkout (default for deposits); `wizard` is the step-by-step flow. */
26
+ this.layout = input(undefined, ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
27
+ /** Country preselected in the form layout. */
28
+ this.defaultCountry = input(undefined, ...(ngDevMode ? [{ debugName: "defaultCountry" }] : /* istanbul ignore next */ []));
29
+ /** Footer links; only links with a URL are shown. */
30
+ this.links = input(undefined, ...(ngDevMode ? [{ debugName: "links" }] : /* istanbul ignore next */ []));
20
31
  this.host = viewChild.required("host");
21
32
  this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
33
+ this.zone = inject(NgZone);
22
34
  effect((onCleanup) => {
23
35
  if (!this.isBrowser) {
24
36
  return;
25
37
  }
26
- const unmount = mountCheckout(this.host().nativeElement, this.checkout(), {
38
+ // Track only the inputs that must restart the widget; the host element is stable.
39
+ const checkout = this.checkout();
40
+ const options = {
27
41
  logoUrl: this.logoUrl(),
28
42
  variant: this.variant(),
43
+ layout: this.layout(),
44
+ defaultCountry: this.defaultCountry(),
45
+ links: this.links(),
46
+ };
47
+ const element = untracked(() => this.host().nativeElement);
48
+ const unmount = this.zone.runOutsideAngular(() => mountCheckout(element, checkout, options));
49
+ onCleanup(() => {
50
+ unmount();
51
+ element.replaceChildren();
29
52
  });
30
- onCleanup(unmount);
31
53
  });
32
54
  effect(() => {
33
- if (this.isBrowser) {
34
- this.checkout().setColorScheme(this.colorScheme());
55
+ const scheme = this.colorScheme();
56
+ const checkout = this.checkout();
57
+ if (this.isBrowser && scheme !== undefined) {
58
+ this.zone.runOutsideAngular(() => checkout.setColorScheme(scheme));
35
59
  }
36
60
  });
37
61
  }
38
62
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CheckoutWizardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
39
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.26", type: CheckoutWizardComponent, isStandalone: true, selector: "mm-checkout-wizard", inputs: { checkout: { classPropertyName: "checkout", publicName: "checkout", isSignal: true, isRequired: true, transformFunction: null }, logoUrl: { classPropertyName: "logoUrl", publicName: "logoUrl", isSignal: true, isRequired: false, transformFunction: null }, colorScheme: { classPropertyName: "colorScheme", publicName: "colorScheme", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "host", first: true, predicate: ["host"], descendants: true, isSignal: true }], ngImport: i0, template: "<div #host></div>", isInline: true }); }
63
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.26", type: CheckoutWizardComponent, isStandalone: true, selector: "mm-checkout-wizard", inputs: { checkout: { classPropertyName: "checkout", publicName: "checkout", isSignal: true, isRequired: true, transformFunction: null }, logoUrl: { classPropertyName: "logoUrl", publicName: "logoUrl", isSignal: true, isRequired: false, transformFunction: null }, colorScheme: { classPropertyName: "colorScheme", publicName: "colorScheme", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, defaultCountry: { classPropertyName: "defaultCountry", publicName: "defaultCountry", isSignal: true, isRequired: false, transformFunction: null }, links: { classPropertyName: "links", publicName: "links", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "host", first: true, predicate: ["host"], descendants: true, isSignal: true }], ngImport: i0, template: "<div #host></div>", isInline: true }); }
40
64
  }
41
65
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CheckoutWizardComponent, decorators: [{
42
66
  type: Component,
@@ -45,7 +69,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImpo
45
69
  standalone: true,
46
70
  template: "<div #host></div>",
47
71
  }]
48
- }], ctorParameters: () => [], propDecorators: { checkout: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkout", required: true }] }], logoUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "logoUrl", required: false }] }], colorScheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorScheme", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], host: [{ type: i0.ViewChild, args: ["host", { isSignal: true }] }] } });
72
+ }], ctorParameters: () => [], propDecorators: { checkout: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkout", required: true }] }], logoUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "logoUrl", required: false }] }], colorScheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorScheme", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], defaultCountry: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultCountry", required: false }] }], links: [{ type: i0.Input, args: [{ isSignal: true, alias: "links", required: false }] }], host: [{ type: i0.ViewChild, args: ["host", { isSignal: true }] }] } });
49
73
 
50
74
  /**
51
75
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"mainmoneyapp-js-angular.mjs","sources":["../../src/index.ts","../../src/mainmoneyapp-js-angular.ts"],"sourcesContent":["import { isPlatformBrowser } from \"@angular/common\";\nimport { Component, ElementRef, PLATFORM_ID, effect, inject, input, viewChild } from \"@angular/core\";\n\nimport type { Checkout, CheckoutVariant, ColorScheme } from \"@mainmoneyapp/js-checkout\";\nimport { mountCheckout } from \"@mainmoneyapp/js-checkout\";\n\n/**\n * Checkout wizard. Import `@mainmoneyapp/js-checkout/styles.css` once in your app\n * (`angular.json` -> `styles`, or `src/main.ts`).\n *\n * The DOM mount only runs in the browser, so the component is safe under SSR.\n * `colorScheme` follows your theme signal: every change calls `checkout.setColorScheme`, which only flips the\n * palette (the form is not re-rendered, so a focused input keeps its focus and value).\n */\n@Component({\n selector: \"mm-checkout-wizard\",\n standalone: true,\n template: \"<div #host></div>\",\n})\nexport class CheckoutWizardComponent {\n readonly checkout = input.required<Checkout>();\n readonly logoUrl = input<string | undefined>(undefined);\n readonly colorScheme = input<ColorScheme>(\"auto\");\n readonly variant = input<CheckoutVariant>(\"default\");\n private readonly host = viewChild.required<ElementRef<HTMLElement>>(\"host\");\n\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n constructor() {\n effect((onCleanup) => {\n if (!this.isBrowser) {\n return;\n }\n const unmount = mountCheckout(this.host().nativeElement, this.checkout(), {\n logoUrl: this.logoUrl(),\n variant: this.variant(),\n });\n onCleanup(unmount);\n });\n effect(() => {\n if (this.isBrowser) {\n this.checkout().setColorScheme(this.colorScheme());\n }\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAMA;;;;;;;AAOG;MAMU,uBAAuB,CAAA;AASlC,IAAA,WAAA,GAAA;AARS,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,QAAQ,8EAAY;AACrC,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAqB,SAAS,8EAAC;AAC9C,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAc,MAAM,kFAAC;AACxC,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAkB,SAAS,8EAAC;AACnC,QAAA,IAAA,CAAA,IAAI,GAAG,SAAS,CAAC,QAAQ,CAA0B,MAAM,CAAC;QAE1D,IAAA,CAAA,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAGjE,QAAA,MAAM,CAAC,CAAC,SAAS,KAAI;AACnB,YAAA,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnB;YACF;AACA,YAAA,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE;AACxE,gBAAA,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;AACvB,gBAAA,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;AACxB,aAAA,CAAC;YACF,SAAS,CAAC,OAAO,CAAC;AACpB,QAAA,CAAC,CAAC;QACF,MAAM,CAAC,MAAK;AACV,YAAA,IAAI,IAAI,CAAC,SAAS,EAAE;gBAClB,IAAI,CAAC,QAAQ,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpD;AACF,QAAA,CAAC,CAAC;IACJ;+GAzBW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,uBAAuB,8sBAFxB,mBAAmB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;;4FAElB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBALnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,mBAAmB;AAC9B,iBAAA;6dAMqE,MAAM,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;ACxB5E;;AAEG;;;;"}
1
+ {"version":3,"file":"mainmoneyapp-js-angular.mjs","sources":["../../src/index.ts","../../src/mainmoneyapp-js-angular.ts"],"sourcesContent":["import { isPlatformBrowser } from \"@angular/common\";\nimport { Component, ElementRef, NgZone, PLATFORM_ID, effect, inject, input, untracked, viewChild } from \"@angular/core\";\n\nimport type { Checkout, CheckoutVariant, ColorScheme, MountOptions } from \"@mainmoneyapp/js-checkout\";\nimport { mountCheckout } from \"@mainmoneyapp/js-checkout\";\n\n/**\n * Checkout wizard. Import `@mainmoneyapp/js-checkout/styles.css` once in your app\n * (`angular.json` -> `styles`, or `src/main.ts`).\n *\n * - The DOM mount only runs in the browser, so the component is safe under SSR.\n * - The widget runs **outside the Angular zone**: its debounce timers, status polling and fetch calls would\n * otherwise trigger a change-detection pass each. It renders its own DOM and never needs Angular to.\n * - Create the `Checkout` once (in `ngOnInit`, a service or a signal), not in a template expression or getter:\n * a new `Checkout` instance restarts the widget from the first step.\n * - `colorScheme` follows your theme signal: every change calls `checkout.setColorScheme`, which only flips the\n * palette (the form is not re-rendered, so a focused input keeps its focus and value).\n */\n@Component({\n selector: \"mm-checkout-wizard\",\n standalone: true,\n template: \"<div #host></div>\",\n})\nexport class CheckoutWizardComponent {\n readonly checkout = input.required<Checkout>();\n readonly logoUrl = input<string | undefined>(undefined);\n /** Leave unset to keep the scheme given to `createCheckout` (default `auto`). */\n readonly colorScheme = input<ColorScheme | undefined>(undefined);\n readonly variant = input<CheckoutVariant>(\"default\");\n /** `form` is the single-page checkout (default for deposits); `wizard` is the step-by-step flow. */\n readonly layout = input<MountOptions[\"layout\"]>(undefined);\n /** Country preselected in the form layout. */\n readonly defaultCountry = input<string | undefined>(undefined);\n /** Footer links; only links with a URL are shown. */\n readonly links = input<MountOptions[\"links\"]>(undefined);\n private readonly host = viewChild.required<ElementRef<HTMLElement>>(\"host\");\n\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly zone = inject(NgZone);\n\n constructor() {\n effect((onCleanup) => {\n if (!this.isBrowser) {\n return;\n }\n // Track only the inputs that must restart the widget; the host element is stable.\n const checkout = this.checkout();\n const options: MountOptions = {\n logoUrl: this.logoUrl(),\n variant: this.variant(),\n layout: this.layout(),\n defaultCountry: this.defaultCountry(),\n links: this.links(),\n };\n const element = untracked(() => this.host().nativeElement);\n const unmount = this.zone.runOutsideAngular(() => mountCheckout(element, checkout, options));\n onCleanup(() => {\n unmount();\n element.replaceChildren();\n });\n });\n effect(() => {\n const scheme = this.colorScheme();\n const checkout = this.checkout();\n if (this.isBrowser && scheme !== undefined) {\n this.zone.runOutsideAngular(() => checkout.setColorScheme(scheme));\n }\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAMA;;;;;;;;;;;AAWG;MAMU,uBAAuB,CAAA;AAiBl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
  "name": "@mainmoneyapp/js-angular",
3
- "version": "0.1.5",
3
+ "version": "0.2.1",
4
4
  "description": "Angular checkout wizard for the MainMoney JS/TS frontend SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  "@angular/core": ">=17.2"
30
30
  },
31
31
  "dependencies": {
32
- "@mainmoneyapp/js-checkout": "0.1.5",
32
+ "@mainmoneyapp/js-checkout": "0.2.1",
33
33
  "tslib": "^2.8.1"
34
34
  },
35
35
  "module": "fesm2022/mainmoneyapp-js-angular.mjs",
@@ -5,20 +5,32 @@ import { Checkout, ColorScheme, CheckoutVariant } from '@mainmoneyapp/js-checkou
5
5
  * Checkout wizard. Import `@mainmoneyapp/js-checkout/styles.css` once in your app
6
6
  * (`angular.json` -> `styles`, or `src/main.ts`).
7
7
  *
8
- * The DOM mount only runs in the browser, so the component is safe under SSR.
9
- * `colorScheme` follows your theme signal: every change calls `checkout.setColorScheme`, which only flips the
10
- * palette (the form is not re-rendered, so a focused input keeps its focus and value).
8
+ * - The DOM mount only runs in the browser, so the component is safe under SSR.
9
+ * - The widget runs **outside the Angular zone**: its debounce timers, status polling and fetch calls would
10
+ * otherwise trigger a change-detection pass each. It renders its own DOM and never needs Angular to.
11
+ * - Create the `Checkout` once (in `ngOnInit`, a service or a signal), not in a template expression or getter:
12
+ * a new `Checkout` instance restarts the widget from the first step.
13
+ * - `colorScheme` follows your theme signal: every change calls `checkout.setColorScheme`, which only flips the
14
+ * palette (the form is not re-rendered, so a focused input keeps its focus and value).
11
15
  */
12
16
  declare class CheckoutWizardComponent {
13
17
  readonly checkout: _angular_core.InputSignal<Checkout>;
14
18
  readonly logoUrl: _angular_core.InputSignal<string | undefined>;
15
- readonly colorScheme: _angular_core.InputSignal<ColorScheme>;
19
+ /** Leave unset to keep the scheme given to `createCheckout` (default `auto`). */
20
+ readonly colorScheme: _angular_core.InputSignal<ColorScheme | undefined>;
16
21
  readonly variant: _angular_core.InputSignal<CheckoutVariant>;
22
+ /** `form` is the single-page checkout (default for deposits); `wizard` is the step-by-step flow. */
23
+ readonly layout: _angular_core.InputSignal<"form" | "wizard" | undefined>;
24
+ /** Country preselected in the form layout. */
25
+ readonly defaultCountry: _angular_core.InputSignal<string | undefined>;
26
+ /** Footer links; only links with a URL are shown. */
27
+ readonly links: _angular_core.InputSignal<Partial<Record<"privacy" | "terms" | "security" | "help", string>> | undefined>;
17
28
  private readonly host;
18
29
  private readonly isBrowser;
30
+ private readonly zone;
19
31
  constructor();
20
32
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CheckoutWizardComponent, never>;
21
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckoutWizardComponent, "mm-checkout-wizard", never, { "checkout": { "alias": "checkout"; "required": true; "isSignal": true; }; "logoUrl": { "alias": "logoUrl"; "required": false; "isSignal": true; }; "colorScheme": { "alias": "colorScheme"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
33
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckoutWizardComponent, "mm-checkout-wizard", never, { "checkout": { "alias": "checkout"; "required": true; "isSignal": true; }; "logoUrl": { "alias": "logoUrl"; "required": false; "isSignal": true; }; "colorScheme": { "alias": "colorScheme"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "defaultCountry": { "alias": "defaultCountry"; "required": false; "isSignal": true; }; "links": { "alias": "links"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
22
34
  }
23
35
 
24
36
  export { CheckoutWizardComponent };
@@ -1 +1 @@
1
- {"version":3,"file":"mainmoneyapp-js-angular.d.ts","sources":["../../src/index.ts"],"mappings":";;;AAMA;;;;;;;AAOG;AACH,cAKa,uBAAuB;uBACjB,aAAA,CAAA,WAAA,CAAA,QAAA;sBACD,aAAA,CAAA,WAAA;0BACI,aAAA,CAAA,WAAA,CAAA,WAAA;sBACJ,aAAA,CAAA,WAAA,CAAA,eAAA;AAChB;AAEA;;oDAPW,uBAAuB;sDAAvB,uBAAuB;AA0BnC;;;;","names":[]}
1
+ {"version":3,"file":"mainmoneyapp-js-angular.d.ts","sources":["../../src/index.ts"],"mappings":";;;AAMA;;;;;;;;;;;AAWG;AACH,cAKa,uBAAuB;uBACjB,aAAA,CAAA,WAAA,CAAA,QAAA;sBACD,aAAA,CAAA,WAAA;;0BAEI,aAAA,CAAA,WAAA,CAAA,WAAA;sBACJ,aAAA,CAAA,WAAA,CAAA,eAAA;;qBAED,aAAA,CAAA,WAAA;;6BAEQ,aAAA,CAAA,WAAA;;oBAET,aAAA,CAAA,WAAA,CAAA,OAAA,CAAA,MAAA;AACd;AAEA;AACA;;oDAfW,uBAAuB;sDAAvB,uBAAuB;AA8CnC;;;;","names":[]}