| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- export interface IFBLoginRes {
- accessToken: string;
- /** iOS Limited Login JWT; never use as a Graph API access token. */
- authenticationToken?: string;
- tokenType?: "access" | "authentication";
- nonce?: string;
- isCancel: boolean;
- status?: string;
- reason?: string;
- }
- export type IFBEventValue = string | number;
- export type IFBEventParams = Record<string, IFBEventValue>;
- export interface IFBShareOptions {
- url: string;
- hashtag?: string;
- quote?: string;
- }
- export interface IFBShareRes {
- success: boolean;
- isCancel: boolean;
- postId?: string;
- reason?: string;
- }
- export abstract class FacebookImpl {
- private _isInitialized = false;
- public get isInitialized() { return this._isInitialized; }
- abstract init(): void;
- protected onInited() {
- this._isInitialized = true;
- }
- async login(): Promise<IFBLoginRes> {
- const res = await this.onLogin();
- return res;
- }
- protected abstract onLogin(): Promise<IFBLoginRes>;
- abstract logOut(): Promise<boolean>;
- abstract share(options: IFBShareOptions): Promise<IFBShareRes>;
- abstract logEvent(
- eventName: string,
- parameters?: IFBEventParams,
- valueToSum?: number,
- ): Promise<boolean>;
- abstract logPurchase(
- amount: number,
- currency: string,
- parameters?: IFBEventParams,
- ): Promise<boolean>;
- abstract flushEvents(): Promise<boolean>;
- }
|