@mainmoneyapp/js-angular 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +47 -2
- package/fesm2022/mainmoneyapp-js-angular.mjs +53 -0
- package/fesm2022/mainmoneyapp-js-angular.mjs.map +1 -0
- package/index.d.ts +21 -0
- package/index.d.ts.map +1 -0
- package/mainmoneyapp-js-angular.d.ts.map +1 -0
- package/package.json +43 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MainMoney SARL
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mainmoneyapp/js-angular
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular standalone `CheckoutWizardComponent` (`<mm-checkout-wizard>`).
|
|
4
|
+
Peer dependencies: `@angular/core` and `@angular/common` >= 17.
|
|
5
|
+
See the [root README](../../README.md).
|
|
6
|
+
|
|
7
|
+
## Build and install
|
|
8
|
+
|
|
9
|
+
Always build from the SDK root so `core`, `http` and `checkout` are built before the wrapper:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install && npm run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
ng-packagr writes the publishable package to `packages/angular/dist` (it generates the
|
|
16
|
+
`exports`, `module` and `typings` fields). Publish or install **from `dist`**:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm pack ./packages/angular/dist ./packages/checkout ./packages/core ./packages/http
|
|
20
|
+
# then in your Angular app: npm install ./mainmoney-js-*.tgz
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or, for local development, `"@mainmoneyapp/js-angular": "file:<path>/packages/angular/dist"`.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Import the stylesheet once, in `angular.json` -> `styles` or `src/main.ts`:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import "@mainmoneyapp/js-checkout/styles.css";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { CheckoutWizardComponent } from "@mainmoneyapp/js-angular";
|
|
35
|
+
|
|
36
|
+
@Component({
|
|
37
|
+
standalone: true,
|
|
38
|
+
imports: [CheckoutWizardComponent],
|
|
39
|
+
template: `<mm-checkout-wizard [checkout]="checkout" />`,
|
|
40
|
+
})
|
|
41
|
+
export class PayComponent {
|
|
42
|
+
checkout = createCheckout(session, { operation: "deposit", pollUrl, pollHeaders });
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- The logo is embedded, so no `assets` entry is needed. Pass `[logoUrl]` to override it.
|
|
47
|
+
- Changing `[checkout]` or `[logoUrl]` remounts the wizard.
|
|
48
|
+
- Nothing is mounted on the server, so SSR is safe.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, PLATFORM_ID, ViewChild, Input, Component } from '@angular/core';
|
|
4
|
+
import { mountCheckout } from '@mainmoneyapp/js-checkout';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Checkout wizard. Import `@mainmoneyapp/js-checkout/styles.css` once in your app
|
|
8
|
+
* (`angular.json` -> `styles`, or `src/main.ts`).
|
|
9
|
+
*
|
|
10
|
+
* The DOM mount only runs in the browser, so the component is safe under SSR.
|
|
11
|
+
*/
|
|
12
|
+
class CheckoutWizardComponent {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
15
|
+
}
|
|
16
|
+
ngOnChanges(changes) {
|
|
17
|
+
if (!this.isBrowser || !this.checkout) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (changes["checkout"] || changes["logoUrl"]) {
|
|
21
|
+
this.unmount?.();
|
|
22
|
+
this.unmount = mountCheckout(this.host.nativeElement, this.checkout, { logoUrl: this.logoUrl });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
ngOnDestroy() {
|
|
26
|
+
this.unmount?.();
|
|
27
|
+
}
|
|
28
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: CheckoutWizardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
29
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: CheckoutWizardComponent, isStandalone: true, selector: "mm-checkout-wizard", inputs: { checkout: "checkout", logoUrl: "logoUrl" }, viewQueries: [{ propertyName: "host", first: true, predicate: ["host"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div #host></div>", isInline: true }); }
|
|
30
|
+
}
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: CheckoutWizardComponent, decorators: [{
|
|
32
|
+
type: Component,
|
|
33
|
+
args: [{
|
|
34
|
+
selector: "mm-checkout-wizard",
|
|
35
|
+
standalone: true,
|
|
36
|
+
template: "<div #host></div>",
|
|
37
|
+
}]
|
|
38
|
+
}], propDecorators: { checkout: [{
|
|
39
|
+
type: Input,
|
|
40
|
+
args: [{ required: true }]
|
|
41
|
+
}], logoUrl: [{
|
|
42
|
+
type: Input
|
|
43
|
+
}], host: [{
|
|
44
|
+
type: ViewChild,
|
|
45
|
+
args: ["host", { static: true }]
|
|
46
|
+
}] } });
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Generated bundle index. Do not edit.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
export { CheckoutWizardComponent };
|
|
53
|
+
//# sourceMappingURL=mainmoneyapp-js-angular.mjs.map
|
|
@@ -0,0 +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 {\n Component,\n ElementRef,\n inject,\n Input,\n OnChanges,\n OnDestroy,\n PLATFORM_ID,\n SimpleChanges,\n ViewChild,\n} from \"@angular/core\";\n\nimport type { Checkout } 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 */\n@Component({\n selector: \"mm-checkout-wizard\",\n standalone: true,\n template: \"<div #host></div>\",\n})\nexport class CheckoutWizardComponent implements OnChanges, OnDestroy {\n @Input({ required: true }) checkout!: Checkout;\n @Input() logoUrl?: string;\n @ViewChild(\"host\", { static: true }) host!: ElementRef<HTMLElement>;\n\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private unmount?: () => void;\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.isBrowser || !this.checkout) {\n return;\n }\n if (changes[\"checkout\"] || changes[\"logoUrl\"]) {\n this.unmount?.();\n this.unmount = mountCheckout(this.host.nativeElement, this.checkout, { logoUrl: this.logoUrl });\n }\n }\n\n ngOnDestroy(): void {\n this.unmount?.();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAgBA;;;;;AAKG;MAMU,uBAAuB,CAAA;AALpC,IAAA,WAAA,GAAA;QAUmB,IAAA,CAAA,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAgBpE,IAAA;AAbC,IAAA,WAAW,CAAC,OAAsB,EAAA;QAChC,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACrC;QACF;QACA,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE;AAC7C,YAAA,IAAI,CAAC,OAAO,IAAI;YAChB,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QACjG;IACF;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,OAAO,IAAI;IAClB;+GApBW,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,qQAFxB,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;8BAE4B,QAAQ,EAAA,CAAA;sBAAlC,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAChB,OAAO,EAAA,CAAA;sBAAf;gBACoC,IAAI,EAAA,CAAA;sBAAxC,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;AC9BrC;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ElementRef, OnChanges, OnDestroy, SimpleChanges } from "@angular/core";
|
|
2
|
+
import type { Checkout } from "@mainmoneyapp/js-checkout";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Checkout wizard. Import `@mainmoneyapp/js-checkout/styles.css` once in your app
|
|
6
|
+
* (`angular.json` -> `styles`, or `src/main.ts`).
|
|
7
|
+
*
|
|
8
|
+
* The DOM mount only runs in the browser, so the component is safe under SSR.
|
|
9
|
+
*/
|
|
10
|
+
export declare class CheckoutWizardComponent implements OnChanges, OnDestroy {
|
|
11
|
+
checkout: Checkout;
|
|
12
|
+
logoUrl?: string;
|
|
13
|
+
host: ElementRef<HTMLElement>;
|
|
14
|
+
private readonly isBrowser;
|
|
15
|
+
private unmount?;
|
|
16
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
17
|
+
ngOnDestroy(): void;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutWizardComponent, never>;
|
|
19
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CheckoutWizardComponent, "mm-checkout-wizard", never, { "checkout": { "alias": "checkout"; "required": true; }; "logoUrl": { "alias": "logoUrl"; "required": false; }; }, {}, never, never, true, never>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,UAAU,EAGV,SAAS,EACT,SAAS,EAET,aAAa,EAEd,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;;AAG1D;;;;;GAKG;AACH,qBAKa,uBAAwB,YAAW,SAAS,EAAE,SAAS;IACvC,QAAQ,EAAG,QAAQ,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACW,IAAI,EAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAEpE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0C;IACpE,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAUzC,WAAW,IAAI,IAAI;yCAlBR,uBAAuB;2CAAvB,uBAAuB;CAqBnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainmoneyapp-js-angular.d.ts","sourceRoot":"","sources":["../src/mainmoneyapp-js-angular.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mainmoneyapp/js-angular",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Angular checkout wizard for the MainMoney JS/TS frontend SDK",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "MainMoney SARL",
|
|
8
|
+
"homepage": "https://github.com/MainMoney-Inc/mm_aggr_js_sdk",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/MainMoney-Inc/mm_aggr_js_sdk.git",
|
|
12
|
+
"directory": "packages/angular"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/MainMoney-Inc/mm_aggr_js_sdk/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"mainmoney",
|
|
19
|
+
"checkout",
|
|
20
|
+
"payments",
|
|
21
|
+
"angular"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@angular/common": ">=17",
|
|
29
|
+
"@angular/core": ">=17"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@mainmoneyapp/js-checkout": "0.1.1",
|
|
33
|
+
"tslib": "^2.8.1"
|
|
34
|
+
},
|
|
35
|
+
"module": "fesm2022/mainmoneyapp-js-angular.mjs",
|
|
36
|
+
"typings": "index.d.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
"./package.json": {
|
|
39
|
+
"default": "./package.json"
|
|
40
|
+
},
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./index.d.ts",
|
|
43
|
+
"default": "./fesm2022/mainmoneyapp-js-angular.mjs"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
6
46
|
}
|