Skip to content

Commit

Permalink
fix: fixes build artifact for angular 14 (#121)
Browse files Browse the repository at this point in the history
* fix: fixes build artifact for angular 14 v1.0.0

* chore: adds dist directory to git

* chore: adds package-lock
  • Loading branch information
cb-dinesh authored Jan 10, 2023
1 parent 50c6492 commit 1205526
Show file tree
Hide file tree
Showing 43 changed files with 2,041 additions and 4 deletions.
1 change: 0 additions & 1 deletion chargebee-js-angular/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
### v1.0.1 (2023-01-09)
***
* Fixes build dependency issue on installing 1.0.0

### v1.0.0 (2022-12-15)
***
* Support for Angular 14.

### v0.3.1 (2021-03-26)
***
* Support for Server Side Rendering using wrapper component compatible with Angular Universal Framework (with prerendering)

### v0.3.0 (2020-09-16)
***
* Security updates

### v0.2.0 (2019-09-07)
* * *
* Support for 3DS Authorization
* Support for passing additional info in tokenize method

### v0.1.4 (2019-05-17)
* * *
* Added currency support
* Updated README

### v0.1.3 (2019-05-09)
* * *
* Mount new syntax

### v0.1.1 (2019-04-28)
* * *
* Updated build

### v0.1.1 (2019-04-28)
* * *
* Added card icon

### v0.1.0 (2019-04-28)
* * *
Initial version of ChargeBee.js Angular Wrapper.
24 changes: 24 additions & 0 deletions chargebee-js-angular/dist/chargebee-js-angular-wrapper/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
The MIT License

Copyright (c) 2011-2019 ChargeBee, Inc.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
287 changes: 287 additions & 0 deletions chargebee-js-angular/dist/chargebee-js-angular-wrapper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
# Chargebee JS Angular Wrapper
Angular wrapper for Chargebee Components

## Examples
For detailed examples: [Click here](https://github.com/chargebee/chargebee-checkout-samples/tree/master/components/angular-app#readme)

## Live Demo
View live demo [here](https://www.recur.in/components-examples/angular/#/example1)

## Installation
Install from npm:
```bash
npm install @chargebee/chargebee-js-angular-wrapper
```

## Usage
Chargebee Components requires you to initialize chargebee js with `site` and `publishableKey`

> Wondering where to obtain your publishable API key? [Refer here](https://www.chargebee.com/docs/api_keys.html)
In your `index.html`:
```html
<html>
<head>
...
<script src="https://js.chargebee.com/v2/chargebee.js"></script>
<script>
Chargebee.init({
site: 'your-site'
publishableKey: 'your-publishable-key'
})
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>
```

### Basic usage
In your angular component

component.html
```html
<div class="cell example example3" id="example-3" style="padding: 1em">
<form>
<div cbCardField id='card-field' (ready)="onReady($event)"></div>
<button (click)="onTokenize($event)">Submit</button>
</form>
</div>
```
component.ts
```js
import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
cardComponent = null;

onReady = (cardComponent) => {
this.cardComponent = cardComponent;
}

onTokenize = (event) => {
event.preventDefault();

this.cardComponent.tokenize().then(data => {
console.log('chargebee token', data.token)
});
}
}

```


### A more complex example:
component.html
```html
<div class="cell example example3" id="example-3" style="padding: 1em">
<form>
<div cbCardField id='card-field'
[fonts]="fonts"
[styles]="styles"
locale='en'
[classes]="classes"
(ready)="onReady($event)"
>
<div id='card-number' cbNumberField class="field empty" placeholder="4111 1111 1111 1111"
(ready)="setFocus($event)"
(change)="onChange($event)"
></div>
<div id='card-expiry' cbExpiryField class="field empty" placeholder="MM / YY"
(change)="onChange($event)"
></div>
<div id='card-cvv' cbCvvField class="field empty" placeholder="CVV"
(change)="onChange($event)"
></div>
</div>
<div id="errors">{{errorMessage}}</div>
<button id='submit-button' (click)="onSubmit($event)">Pay 25$</button>
</form>
</div>
```
component.ts
```js
import { Component, ChangeDetectorRef, HostListener } from '@angular/core';
declare var Chargebee;

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
errorMessage = '';
changeDetectorRef: ChangeDetectorRef;
cardComponent = null;

constructor(changeDetectorRef: ChangeDetectorRef) {
this.changeDetectorRef = changeDetectorRef;
}

errors = {};
classes = {
focus: 'focus',
complete: 'complete-custom-class',
invalid: 'invalid',
empty: 'empty',
};
fonts = [
'https://fonts.googleapis.com/css?family=Open+Sans'
];
styles = {
base: {
color: '#fff',
fontWeight: 600,
fontFamily: 'Quicksand, Open Sans, Segoe UI, sans-serif',
fontSize: '16px',
fontSmoothing: 'antialiased',

':focus': {
color: '#424770'
},

'::placeholder': {
color: '#9BACC8'
},

':focus::placeholder': {
color: '#CFD7DF'
}
},
invalid: {
color: '#fff',
':focus': {
color: '#FA755A'
},
'::placeholder': {
color: '#FFCCA5'
}
}
};

onReady = (cardComponent) => {
this.cardComponent = cardComponent;
}

setFocus(field) {
field.focus();
}

onChange = (status) => {
let errors = {
...this.errors,
[status.field]: status.error
}
this.errors = errors
let {message} = Object.values(errors).filter(message => !!message).pop() || {}
this.errorMessage = message
this.changeDetectorRef.detectChanges();
}

onSubmit = (event) => {
event.preventDefault();
this.cardComponent.tokenize().then(data => {
console.log('chargebee token', data.token)
});
}
}

```

### 3DS Authorization
In your angular component

component.html
```html
<div class="cell example example3" id="example-3" style="padding: 1em">
<form>
<div cbCardField id='card-field' (ready)="onReady($event)"></div>
<button (click)="authorize($event)">Submit</button>
</form>
</div>
```
component.ts
```js
import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
cardComponent = null;
intent = null;
additionalData = {
// Additional data to improve the chances of frictionless flow
}

onReady = (cardComponent) => {
this.cardComponent = cardComponent;
}

createPaymentIntent() {
// make ajax call to your server to create a paymentIntent
...
this.intent = paymentIntent
}

authorize = (event) => {
event.preventDefault();

this.cardComponent.authorizeWith3ds(this.intent, this.additionalData).then(authorizedIntent => {
console.log('3DS Authorization success', authorizedIntent.id)
});
}
}

```

## Directives and APIs

#### cbCardField Directive ([docs](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#card-component-object))
Attributes | Description | Datatype
-----------|-------------|---------
`fonts` | An array of font faces or links | [Fonts](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-3)
`classes` | Set of CSS classnames that get substituted for various [events](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#on) | [Classes](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-3)
`locale` | Language code | [Locale](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-3)
`styles` | Set of style customizations | [Styles](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-3)
`placeholder` | Set of placeholders for the card fields | [Placeholder](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-3)

##### Events ([docs](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#on))
Props | Description | Arguments
------|-------------|---------
`(ready)` | Triggers when component is mounted and ready | [Field](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#card-field-object)
`(change)` | Triggers for every state change | [Field State](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-6)
`(focus)` | Triggers when component is focused | [Field State](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-6)
`(blur)` | Triggers when component is blurred | [Field State](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-6)

#### Individual Field directives ([docs](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#card-field-object))
* cbNumberField
* cbExpiryField
* cbCvvField

Props | Description | Datatype
------|-------------|---------
`styles` | Styles for inidividual field | [Styles](http://localhost:8081/checkout-portal-docs/components-fields-reference.html#parameters-5)
`placeholder` | Placeholder for the field | String

##### Event Props ([docs](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#on-2))
Props | Description | Arguments
------|-------------|---------
`(ready)` | Triggers when component is mounted and ready | [Field](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#card-field-object)
`(change)` | Triggers for every state change | [Field State](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-6)
`(focus)` | Triggers when component is focused | [Field State](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-6)
`(blur)` | Triggers when component is blurred | [Field State](https://chargebee.com/checkout-portal-docs/components-fields-reference.html#parameters-6)

## Reference:
[Chargebee Components - JS Docs](https://chargebee.com/checkout-portal-docs/components-fields-integrations.html#quick-start-integration)

## Support
Have any queries regarding the implementation? Reach out to [[email protected]](mailto:[email protected])

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* Generated bundle index. Do not edit.
*/
export * from './public-api';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhcmdlYmVlLWNoYXJnZWJlZS1qcy1hbmd1bGFyLXdyYXBwZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9jaGFyZ2ViZWUtanMtYW5ndWxhci13cmFwcGVyL3NyYy9jaGFyZ2ViZWUtY2hhcmdlYmVlLWpzLWFuZ3VsYXItd3JhcHBlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpYy1hcGknO1xuIl19
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { NgModule } from '@angular/core';
import { CardFieldDirective } from './directives/card-field.directive';
import { CvvFieldDirective } from './directives/cvv-field.directive';
import { NumberFieldDirective } from './directives/number-field.directive';
import { ExpiryFieldDirective } from './directives/expiry-field.directive';
import { Provider } from './directives/provider.directive';
import { CommonModule } from '@angular/common';
import * as i0 from "@angular/core";
export class ChargebeeJsAngularWrapperModule {
}
/** @nocollapse */ ChargebeeJsAngularWrapperModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ChargebeeJsAngularWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
/** @nocollapse */ ChargebeeJsAngularWrapperModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: ChargebeeJsAngularWrapperModule, declarations: [CardFieldDirective, CvvFieldDirective, NumberFieldDirective, ExpiryFieldDirective, Provider], imports: [CommonModule], exports: [CardFieldDirective, CvvFieldDirective, NumberFieldDirective, ExpiryFieldDirective, Provider] });
/** @nocollapse */ ChargebeeJsAngularWrapperModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ChargebeeJsAngularWrapperModule, imports: [CommonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ChargebeeJsAngularWrapperModule, decorators: [{
type: NgModule,
args: [{
declarations: [CardFieldDirective, CvvFieldDirective, NumberFieldDirective, ExpiryFieldDirective, Provider],
imports: [
CommonModule
],
exports: [CardFieldDirective, CvvFieldDirective, NumberFieldDirective, ExpiryFieldDirective, Provider]
}]
}] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhcmdlYmVlLWpzLWFuZ3VsYXItd3JhcHBlci5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9jaGFyZ2ViZWUtanMtYW5ndWxhci13cmFwcGVyL3NyYy9saWIvY2hhcmdlYmVlLWpzLWFuZ3VsYXItd3JhcHBlci5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUN2RSxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNyRSxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxxQ0FBcUMsQ0FBQztBQUMzRSxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxxQ0FBcUMsQ0FBQztBQUMzRSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDM0QsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDOztBQVMvQyxNQUFNLE9BQU8sK0JBQStCOzsrSUFBL0IsK0JBQStCO2dKQUEvQiwrQkFBK0IsaUJBTjNCLGtCQUFrQixFQUFFLGlCQUFpQixFQUFFLG9CQUFvQixFQUFFLG9CQUFvQixFQUFFLFFBQVEsYUFFeEcsWUFBWSxhQUVKLGtCQUFrQixFQUFFLGlCQUFpQixFQUFFLG9CQUFvQixFQUFFLG9CQUFvQixFQUFFLFFBQVE7Z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