@mainmoneyapp/js-angular 0.0.0-stage → 0.1.5
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
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,55 @@
|
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, viewChild, inject, PLATFORM_ID, effect, 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
|
+
* `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).
|
|
13
|
+
*/
|
|
14
|
+
class CheckoutWizardComponent {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.checkout = input.required(...(ngDevMode ? [{ debugName: "checkout" }] : /* istanbul ignore next */ []));
|
|
17
|
+
this.logoUrl = input(undefined, ...(ngDevMode ? [{ debugName: "logoUrl" }] : /* istanbul ignore next */ []));
|
|
18
|
+
this.colorScheme = input("auto", ...(ngDevMode ? [{ debugName: "colorScheme" }] : /* istanbul ignore next */ []));
|
|
19
|
+
this.variant = input("default", ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
20
|
+
this.host = viewChild.required("host");
|
|
21
|
+
this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
22
|
+
effect((onCleanup) => {
|
|
23
|
+
if (!this.isBrowser) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const unmount = mountCheckout(this.host().nativeElement, this.checkout(), {
|
|
27
|
+
logoUrl: this.logoUrl(),
|
|
28
|
+
variant: this.variant(),
|
|
29
|
+
});
|
|
30
|
+
onCleanup(unmount);
|
|
31
|
+
});
|
|
32
|
+
effect(() => {
|
|
33
|
+
if (this.isBrowser) {
|
|
34
|
+
this.checkout().setColorScheme(this.colorScheme());
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
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 }); }
|
|
40
|
+
}
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: CheckoutWizardComponent, decorators: [{
|
|
42
|
+
type: Component,
|
|
43
|
+
args: [{
|
|
44
|
+
selector: "mm-checkout-wizard",
|
|
45
|
+
standalone: true,
|
|
46
|
+
template: "<div #host></div>",
|
|
47
|
+
}]
|
|
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 }] }] } });
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Generated bundle index. Do not edit.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
export { CheckoutWizardComponent };
|
|
55
|
+
//# 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 { 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,QA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A,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;;;;"}
|
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.5",
|
|
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.2",
|
|
29
|
+
"@angular/core": ">=17.2"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@mainmoneyapp/js-checkout": "0.1.5",
|
|
33
|
+
"tslib": "^2.8.1"
|
|
34
|
+
},
|
|
35
|
+
"module": "fesm2022/mainmoneyapp-js-angular.mjs",
|
|
36
|
+
"typings": "types/mainmoneyapp-js-angular.d.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
"./package.json": {
|
|
39
|
+
"default": "./package.json"
|
|
40
|
+
},
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./types/mainmoneyapp-js-angular.d.ts",
|
|
43
|
+
"default": "./fesm2022/mainmoneyapp-js-angular.mjs"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
6
46
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Checkout, ColorScheme, CheckoutVariant } from '@mainmoneyapp/js-checkout';
|
|
3
|
+
|
|
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
|
+
* `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).
|
|
11
|
+
*/
|
|
12
|
+
declare class CheckoutWizardComponent {
|
|
13
|
+
readonly checkout: _angular_core.InputSignal<Checkout>;
|
|
14
|
+
readonly logoUrl: _angular_core.InputSignal<string | undefined>;
|
|
15
|
+
readonly colorScheme: _angular_core.InputSignal<ColorScheme>;
|
|
16
|
+
readonly variant: _angular_core.InputSignal<CheckoutVariant>;
|
|
17
|
+
private readonly host;
|
|
18
|
+
private readonly isBrowser;
|
|
19
|
+
constructor();
|
|
20
|
+
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>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { CheckoutWizardComponent };
|
|
25
|
+
//# sourceMappingURL=mainmoneyapp-js-angular.d.ts.map
|
|
@@ -0,0 +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":[]}
|