Skip to content

Commit

Permalink
demo axo component
Browse files Browse the repository at this point in the history
  • Loading branch information
siddy2181 committed Nov 3, 2023
1 parent c38b3ef commit e980158
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"@krakenjs/zoid": "^10.3.1",
"@paypal/common-components": "^1.0.35",
"@paypal/funding-components": "^1.0.31",
"@paypal/connect-loader-component": "^1.0.0",
"@paypal/sdk-client": "^4.0.176",
"@paypal/sdk-constants": "^1.0.133",
"@paypal/sdk-logos": "^2.2.6"
Expand Down
7 changes: 7 additions & 0 deletions src/interface/axo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* @flow */
import type { LazyExport } from "../types";
import { getAxoComponent, type AXOComponent } from "../zoid/axo";

export const AXO: LazyExport<AXOComponent> = {
__get__: getAxoComponent,
};
20 changes: 20 additions & 0 deletions src/zoid/axo/component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* @flow */
/** @jsx node */
/* eslint max-lines: 0 */

import { loadConnectScript } from "@paypal/connect-loader-component";
import { getClientID, getClientMetadataID } from "@paypal/sdk-client/src";
// eslint-disable-next-line flowtype/no-weak-types
export type AXOComponent = any;

export function getAxoComponent(): AXOComponent {
const cmid = getClientMetadataID();
const clientID = getClientID();
// this will change to whatever options we received
// from the merchant
try {
return loadConnectScript({ cmid, clientID });
} catch (error) {
return new Error(error);
}
}
3 changes: 3 additions & 0 deletions src/zoid/axo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* @flow */

export * from "./component";

0 comments on commit e980158

Please sign in to comment.