Skip to content

Commit

Permalink
rename to connect, move code directly for now
Browse files Browse the repository at this point in the history
  • Loading branch information
cgdibble committed Nov 6, 2023
1 parent e980158 commit 358c9d4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/interface/axo.js

This file was deleted.

39 changes: 39 additions & 0 deletions src/interface/connect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* @flow */
import type { LazyExport } from "../types";
import { getAxoComponent, type AXOComponent } from "../zoid/axo";
import { loadConnectScript } from "@paypal/connect-loader-component";
import {
getClientID,
getClientMetadataID,
getUserIDToken,
} from "@paypal/sdk-client/src";

// eslint-disable-next-line flowtype/no-weak-types
export type AXOComponent = any;

// TODO: What's the expected structure/approach for this interface. It's not a zoid
// scenario, so what do we return?
// -> Looks like it returns a function that accepts the props
// How do we define the input of merchant params here?
export const AXO: LazyExport<AXOComponent> = {
__get__: () => {
return async (merchantProps) => {
const cmid = getClientMetadataID();
const clientID = getClientID();
const userIdToken = getUserIDToken();
// TODO: Sort out integration specifics for inputs
try {
const loadResult = await loadConnectScript();
return window.braintree.connect.create({
...loadResult.metadata,
...merchantProps,
cmid,
clientID,
userIdToken,
});
} catch (error) {
return new Error(error);
}
};
},
};

0 comments on commit 358c9d4

Please sign in to comment.