Skip to content

Commit

Permalink
style: typo reciept -> receipt
Browse files Browse the repository at this point in the history
  • Loading branch information
emuvente committed Dec 1, 2023
1 parent 719e187 commit 5cf8af6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion @kiva/kv-shop/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export * from './basketTotals';
export * from './basketVerification';
export * from './checkoutStatus';
export * from './oneTimeCheckout';
export * from './reciept';
export * from './receipt';
export * from './shopError';
export * from './shopQueries';
export * from './subscriptionCheckout';
Expand Down
2 changes: 1 addition & 1 deletion @kiva/kv-shop/src/oneTimeCheckout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { callShopMutation, callShopQuery } from './shopQueries';
import { validatePreCheckout } from './validatePreCheckout';
import { wait } from './util/poll';
import getVisitorID from './util/visitorId';
import { getCheckoutTrackingData } from './reciept';
import { getCheckoutTrackingData } from './receipt';

interface CreditAmountNeededData {
shop: {
Expand Down
16 changes: 8 additions & 8 deletions @kiva/kv-shop/src/reciept.ts → @kiva/kv-shop/src/receipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@ export async function getFTDStatus(apollo: ApolloClient<any>) {
return result.data?.my?.userAccount?.isFirstTimeDepositor ?? false;
}

interface RecieptItem {
interface ReceiptItem {
id: string,
price: string,
__typename: string,
isTip?: boolean,
isUserEdited?: boolean,
}

interface RecieptItemsData {
interface ReceiptItemsData {
shop: {
id: string,
receipt: {
id: string,
items: {
totalCount: number,
values: RecieptItem[],
values: ReceiptItem[],
} | null,
} | null,
} | null,
}

export async function getRecieptItems(apollo: ApolloClient<any>, checkoutId: string): Promise<RecieptItem[]> {
export async function getReceiptItems(apollo: ApolloClient<any>, checkoutId: string): Promise<ReceiptItem[]> {
return new Promise((resolve, reject) => {
const limit = 100;
let offset = 0;
const observer = apollo.watchQuery<RecieptItemsData>({
const observer = apollo.watchQuery<ReceiptItemsData>({
query: gql`
query receiptItems($checkoutId: String, $visitorId: String, $limit: Int, $offset: Int) {
shop {
Expand Down Expand Up @@ -79,8 +79,8 @@ export async function getRecieptItems(apollo: ApolloClient<any>, checkoutId: str
},
});

let items: RecieptItem[] = [];
const handleResult = async (result: ApolloQueryResult<RecieptItemsData>) => {
let items: ReceiptItem[] = [];
const handleResult = async (result: ApolloQueryResult<ReceiptItemsData>) => {
const total = result.data?.shop?.receipt?.items?.totalCount;
items = items.concat(result.data?.shop?.receipt?.items?.values);
if (total > offset + limit) {
Expand Down Expand Up @@ -146,7 +146,7 @@ export async function getCheckoutTrackingData(
): Promise<TransactionData> {
const [isFTD, items, totals] = await Promise.all([
getFTDStatus(apollo),
getRecieptItems(apollo, checkoutId),
getReceiptItems(apollo, checkoutId),
getReceiptTotals(apollo, checkoutId),
]);

Expand Down

0 comments on commit 5cf8af6

Please sign in to comment.