Last active
August 16, 2021 17:02
-
-
Save rohittagadiya/be3bd1e9f41f7ff92634515531d3e195 to your computer and use it in GitHub Desktop.
Initialize fastspring popup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HostListener } from '@angular/core'; | |
import { Component, OnInit } from '@angular/core'; | |
declare var fastspring: any; | |
@Component({ | |
selector: 'app-home', | |
templateUrl: './home.component.html', | |
styleUrls: ['./home.component.css'] | |
}) | |
export class HomeComponent implements OnInit { | |
@HostListener('window:onFSPopupClosed', ['$event.detail']) | |
onFSPopupClosed(detail) { | |
console.log(detail) | |
if (detail && detail.orderReference && detail.orderReference.id) { | |
// Payment done successfull | |
} | |
} | |
constructor() {} | |
popupStoreFront(itemIdentifier: string): void { | |
fastspring.builder.push({ | |
reset: true, | |
products: [ | |
{ path: 'yearly', quantity: 1 } | |
], | |
checkout: true, | |
tags: { | |
emailId: '[email protected]', | |
userId: 'HJS678HJ' | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment