Skip to content

Commit

Permalink
updated order
Browse files Browse the repository at this point in the history
  • Loading branch information
KostiantynFandeliuk committed Dec 15, 2024
1 parent 8764e0a commit e0c4406
Show file tree
Hide file tree
Showing 11 changed files with 243 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,95 @@
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
*******************************************************************/
export declare const confirmCancelOrder: (orderId: string, confirmationKey: string) => Promise<any>;
export declare const confirmCancelOrder: (orderId: string, confirmationKey: string) => Promise<{
subtotalExclTax: any;
subtotalInclTax: any;
billingAddress: {
city: any;
company: any;
countryCode: any;
fax: any;
firstName: any;
lastName: any;
middleName: any;
postCode: any;
prefix: any;
region: any;
regionId: any;
street: any;
suffix: any;
telephone: any;
vatId: any;
};
shippingAddress: {
city: any;
company: any;
countryCode: any;
fax: any;
firstName: any;
lastName: any;
middleName: any;
postCode: any;
prefix: any;
region: any;
regionId: any;
street: any;
suffix: any;
telephone: any;
vatId: any;
};
shipments: {
items: {
id: string;
productName: string;
productSku: string;
quantityShipped: number;
orderItem: import('../../data/models').OrderItemModel;
}[];
id: string;
number: string;
tracking: {
carrier: string;
number: string;
title: string;
}[];
comments: {
message: string;
timestamp: string;
}[];
}[];
items: import('../../data/models').OrderItemModel[];
returns: import('../../data/models').OrdersReturnPropsModel[];
itemsEligibleForReturn: import('../../data/models').OrderItemModel[];
totalQuantity: number;
shippingMethod: string;
shipping: {
amount: any;
currency: any;
code: string;
};
payments: {
code: string;
name: string;
}[];
grandTotal: any;
totalGiftcard: any;
taxes: any;
totalTax: any;
totalShipping: any;
discounts: any;
token: string;
email: string;
status: string;
number: string;
id: string;
carrier: string;
coupons: {
code: string;
}[];
orderDate: string;
isVirtual: boolean;
availableActions: import('../../types/index').AvailableActionsProps[];
orderStatusChangeDate: string;
} | null>;
//# sourceMappingURL=confirmCancelOrder.d.ts.map
22 changes: 11 additions & 11 deletions scripts/__dropins__/storefront-order/chunks/initialize.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*! Copyright 2024 Adobe
All Rights Reserved. */
import{events as f}from"@dropins/tools/event-bus.js";const l=r=>r.replace(/_([a-z])/g,(s,e)=>e.toUpperCase()),i=r=>r.replace(/([A-Z])/g,s=>`_${s.toLowerCase()}`),u=(r,s,e)=>{const c=["string","boolean","number"],a=s==="camelCase"?l:i;return Array.isArray(r)?r.map(o=>c.includes(typeof o)||o===null?o:typeof o=="object"?u(o,s,e):o):r!==null&&typeof r=="object"?Object.entries(r).reduce((o,[t,n])=>{const p=e&&e[t]?e[t]:a(t);return o[p]=c.includes(typeof n)||n===null?n:u(n,s,e),o},{}):r},C=r=>{const s=r instanceof DOMException&&r.name==="AbortError",e=r.name==="PlaceOrderError";throw!s&&!e&&f.emit("order/error",{source:"auth",type:"network",error:r.message}),r};export{u as a,l as c,C as h};
import{events as t}from"@dropins/tools/event-bus.js";const s=r=>{const e=r instanceof DOMException&&r.name==="AbortError",o=r.name==="PlaceOrderError";throw!e&&!o&&t.emit("order/error",{source:"auth",type:"network",error:r.message}),r};export{s as h};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! Copyright 2024 Adobe
All Rights Reserved. */
import{h as i,a as _}from"./network-error.js";import{f as o,h as s}from"./fetch-graphql.js";import{t as d}from"./transform-attributes-form.js";import{REQUEST_RETURN_ORDER_FRAGMENT as m}from"../fragments.js";import{merge as l}from"@dropins/tools/lib.js";import{d as f}from"./initialize.js";const h=r=>{var a,n,E,c,R,T;if(!((n=(a=r==null?void 0:r.data)==null?void 0:a.requestReturn)!=null&&n.return))return{};const{created_at:e,...t}=r.data.requestReturn.return,u={...t,createdAt:e};return l(u,(T=(R=(c=(E=f.getConfig())==null?void 0:E.models)==null?void 0:c.RequestReturnModel)==null?void 0:R.transformer)==null?void 0:T.call(R,r.data.requestReturn.return))},U=`
import{h as i}from"./network-error.js";import{f as o,h as s}from"./fetch-graphql.js";import{t as d,a as _}from"./transform-attributes-form.js";import{REQUEST_RETURN_ORDER_FRAGMENT as m}from"../fragments.js";import{merge as l}from"@dropins/tools/lib.js";import{d as f}from"./initialize.js";const h=r=>{var a,n,E,c,R,T;if(!((n=(a=r==null?void 0:r.data)==null?void 0:a.requestReturn)!=null&&n.return))return{};const{created_at:e,...t}=r.data.requestReturn.return,u={...t,createdAt:e};return l(u,(T=(R=(c=(E=f.getConfig())==null?void 0:E.models)==null?void 0:c.RequestReturnModel)==null?void 0:R.transformer)==null?void 0:T.call(R,r.data.requestReturn.return))},U=`
query GET_ATTRIBUTES_LIST($entityType: AttributeEntityTypeEnum!) {
attributesList(entityType: $entityType) {
items {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export declare const transformMockOrderInput: {
customer: {
orders: {
items: {
uid: string;
available_actions: string[];
status: string;
number: string;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export type OrderAddressModel = {
}[];
} | null;
export type OrderItemProductModel = {
onlyXLeftInStock?: number;
priceRange?: {
maximumPrice?: {
regularPrice?: MoneyProps;
};
};
uid: string;
__typename: string;
stockStatus?: string;
Expand All @@ -36,6 +42,8 @@ export type OrderItemProductModel = {
};
};
export type OrderItemModel = {
productSalePrice: MoneyProps;
status?: string;
currentReturnOrderQuantity?: number;
eligibleForReturn: boolean;
productSku?: string;
Expand All @@ -59,6 +67,20 @@ export type OrderItemModel = {
count: number;
result: string;
} | null;
prices: {
priceIncludingTax: MoneyProps;
originalPrice: MoneyProps;
originalPriceIncludingTax: MoneyProps;
price: MoneyProps;
discounts: [
{
label: string;
amount: {
value: number;
};
}
];
};
itemPrices: {
priceIncludingTax: MoneyProps;
originalPrice: MoneyProps;
Expand Down Expand Up @@ -91,7 +113,7 @@ export type OrderItemModel = {
quantityRefunded: number;
quantityReturned: number;
quantityShipped: number;
requestQuantity: number;
requestQuantity?: number;
totalQuantity: number;
returnableQuantity?: number;
quantityReturnRequested: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,96 @@ export declare const transformLinks: (links: {
result: string;
} | null;
export declare const transformOrderItems: (items: OrderItemProps[]) => OrderItemModel[];
export declare const transformOrderData: (orderData: OrderProps, returnRef?: string) => any;
export declare const transformOrderData: (orderData: OrderProps, returnRef?: string) => {
subtotalExclTax: any;
subtotalInclTax: any;
billingAddress: {
city: any;
company: any;
countryCode: any;
fax: any;
firstName: any;
lastName: any;
middleName: any;
postCode: any;
prefix: any;
region: any;
regionId: any;
street: any;
suffix: any;
telephone: any;
vatId: any;
};
shippingAddress: {
city: any;
company: any;
countryCode: any;
fax: any;
firstName: any;
lastName: any;
middleName: any;
postCode: any;
prefix: any;
region: any;
regionId: any;
street: any;
suffix: any;
telephone: any;
vatId: any;
};
shipments: {
items: {
id: string;
productName: string;
productSku: string;
quantityShipped: number;
orderItem: OrderItemModel;
}[];
id: string;
number: string;
tracking: {
carrier: string;
number: string;
title: string;
}[];
comments: {
message: string;
timestamp: string;
}[];
}[];
items: OrderItemModel[];
returns: import('../models').OrdersReturnPropsModel[];
itemsEligibleForReturn: OrderItemModel[];
totalQuantity: number;
shippingMethod: string;
shipping: {
amount: any;
currency: any;
code: string;
};
payments: {
code: string;
name: string;
}[];
grandTotal: any;
totalGiftcard: any;
taxes: any;
totalTax: any;
totalShipping: any;
discounts: any;
token: string;
email: string;
status: string;
number: string;
id: string;
carrier: string;
coupons: {
code: string;
}[];
orderDate: string;
isVirtual: boolean;
availableActions: import('../../types').AvailableActionsProps[];
orderStatusChangeDate: string;
};
export declare const transformOrderDetails: <T extends "orderData">(queryType: QueryType, response: ResponseData<T>, returnRef?: string) => TransformedData<T>;
//# sourceMappingURL=transform-order-details.d.ts.map
16 changes: 15 additions & 1 deletion scripts/__dropins__/storefront-order/lib/categorizeProducts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { OrderDataModel } from '../data/models';
export declare const categorizeProducts: (order: OrderDataModel) => {
returnedList: {
totalQuantity: number;
productSalePrice: import('../types/index').MoneyProps;
status?: string | undefined;
currentReturnOrderQuantity?: number | undefined;
eligibleForReturn: boolean;
productSku?: string | undefined;
Expand All @@ -26,6 +28,18 @@ export declare const categorizeProducts: (order: OrderDataModel) => {
count: number;
result: string;
} | null;
prices: {
priceIncludingTax: import('../types/index').MoneyProps;
originalPrice: import('../types/index').MoneyProps;
originalPriceIncludingTax: import('../types/index').MoneyProps;
price: import('../types/index').MoneyProps;
discounts: [{
label: string;
amount: {
value: number;
};
}];
};
itemPrices: {
priceIncludingTax: import('../types/index').MoneyProps;
originalPrice: import('../types/index').MoneyProps;
Expand Down Expand Up @@ -56,7 +70,7 @@ export declare const categorizeProducts: (order: OrderDataModel) => {
quantityRefunded: number;
quantityReturned: number;
quantityShipped: number;
requestQuantity: number;
requestQuantity?: number | undefined;
returnableQuantity?: number | undefined;
quantityReturnRequested: number;
}[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ interface ThumbnailImageProps {
label?: string;
}
export interface ProductProps {
only_x_left_in_stock?: number;
stock_status?: string;
thumbnail?: ThumbnailImageProps;
image: ThumbnailImageProps;
canonical_url: string;
Expand Down Expand Up @@ -176,7 +178,9 @@ export interface ShipmentsProps {
id: string;
product_sku: string;
product_name: string;
};
quantity_shipped: number;
order_item: OrderItemProps;
}[];
}
export declare enum AvailableActionsProps {
CANCEL = "CANCEL",
Expand Down Expand Up @@ -213,6 +217,8 @@ export interface ReturnsItemsProps {
}[];
}
export interface OrderProps {
is_virtual?: boolean;
order_status_change_date?: string;
available_actions: AvailableActionsProps[];
shipping_method: string;
status: string;
Expand Down

0 comments on commit e0c4406

Please sign in to comment.