Skip to content

Commit

Permalink
Install 1.0.0 version of order dropin
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferri0 committed Dec 7, 2024
1 parent 8494af6 commit 3ffd216
Show file tree
Hide file tree
Showing 44 changed files with 249 additions and 138 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@dropins/storefront-auth": "1.0.0-beta2",
"@dropins/storefront-cart": "0.10.0",
"@dropins/storefront-checkout": "0.1.0-alpha61",
"@dropins/storefront-order": "0.1.0-alpha32",
"@dropins/storefront-order": "1.0.0-beta1",
"@dropins/storefront-pdp": "1.0.0-beta3",
"@dropins/tools": "^0.36.0"
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/__dropins__/storefront-order/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! Copyright 2024 Adobe
All Rights Reserved. */
import{c as H,r as X}from"./chunks/requestGuestOrderCancel.js";import{f as _,h as T}from"./chunks/fetch-graphql.js";import{g as V,r as Y,s as z,a as j,b as J}from"./chunks/fetch-graphql.js";import{g as W}from"./chunks/getAttributesForm.js";import{g as tt,r as et}from"./chunks/requestReturn.js";import{g as at,a as ot}from"./chunks/getGuestOrder.js";import{g as st}from"./chunks/getCustomerOrdersReturn.js";import{c as m,P as R,a as A,G as D,O as g,B as O,b as h,A as C}from"./chunks/initialize.js";import{e as pt,g as ct,d as ut,i as dt}from"./chunks/initialize.js";import{g as Et}from"./chunks/getStoreConfig.js";import{h as f}from"./chunks/network-error.js";import{events as u}from"@dropins/tools/event-bus.js";import{r as Tt}from"./chunks/reorderItems.js";import"./chunks/GurestOrderFragment.graphql.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-attributes-form.js";import"@dropins/tools/lib.js";const M=(e,r)=>({id:e,totalQuantity:r.totalQuantity,possibleOnepageCheckout:!0,items:r.items.map(t=>{var a,o,n,s,i,p;return{canApplyMsrp:!0,formattedPrice:"",id:t.id,quantity:t.totalQuantity,product:{canonicalUrl:((a=t.product)==null?void 0:a.canonicalUrl)??"",mainImageUrl:((o=t.product)==null?void 0:o.image)??"",name:((n=t.product)==null?void 0:n.name)??"",productId:0,productType:(s=t.product)==null?void 0:s.productType,sku:((i=t.product)==null?void 0:i.sku)??""},prices:{price:{value:t.price.value,currency:t.price.currency}},configurableOptions:((p=t.selectedOptions)==null?void 0:p.map(c=>({optionLabel:c.label,valueLabel:c.value})))||[]}})}),G=e=>{var a,o,n;const r=e.coupons[0],t=(a=e.payments)==null?void 0:a[0];return{appliedCouponCode:(r==null?void 0:r.code)??"",email:e.email,grandTotal:e.grandTotal.value,orderId:e.number,orderType:"checkout",otherTax:0,salesTax:e.totalTax.value,shipping:{shippingMethod:((o=e.shipping)==null?void 0:o.code)??"",shippingAmount:((n=e.shipping)==null?void 0:n.amount)??0},subtotalExcludingTax:e.subtotal.value,subtotalIncludingTax:0,payments:t?[{paymentMethodCode:(t==null?void 0:t.code)||"",paymentMethodName:(t==null?void 0:t.name)||"",total:e.grandTotal.value}]:[]}},N=e=>{var t,a;const r=(a=(t=e==null?void 0:e.data)==null?void 0:t.placeOrder)==null?void 0:a.orderV2;return r?m(r):null},d={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},b={PLACE_ORDER:"place-order"};function E(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function l(e,r){const t=E();t.push({[e]:null}),t.push({[e]:r})}function I(e,r){E().push(a=>{const o=a.getState?a.getState():{};a.push({event:e,eventInfo:{...o,...r}})})}function L(e,r){const t=G(r),a=M(e,r);l(d.ORDER_CONTEXT,{...t}),l(d.SHOPPING_CART_CONTEXT,{...a}),I(b.PLACE_ORDER)}const S=`
import{c as q,r as X}from"./chunks/requestGuestOrderCancel.js";import{f as E,h as _}from"./chunks/fetch-graphql.js";import{g as Y,r as z,s as j,a as J,b as K}from"./chunks/fetch-graphql.js";import{g as Z}from"./chunks/getAttributesForm.js";import{g as te,a as re,r as ae}from"./chunks/requestGuestReturn.js";import{g as ne,a as se}from"./chunks/getGuestOrder.js";import{g as pe}from"./chunks/getCustomerOrdersReturn.js";import{c as T,P as R,a as A,G as D,O as g,B as O,b as h,A as C}from"./chunks/initialize.js";import{e as ue,g as de,d as le,i as me}from"./chunks/initialize.js";import{g as _e}from"./chunks/getStoreConfig.js";import{h as f}from"./chunks/network-error.js";import{events as u}from"@dropins/tools/event-bus.js";import{a as Re,c as Ae,r as De}from"./chunks/confirmCancelOrder.js";import"./chunks/GurestOrderFragment.graphql.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-attributes-form.js";import"./chunks/RequestReturnOrderFragment.graphql.js";import"@dropins/tools/lib.js";const G=(t,r)=>({id:t,totalQuantity:r.totalQuantity,possibleOnepageCheckout:!0,items:r.items.map(e=>{var a,o,n,s,i,p;return{canApplyMsrp:!0,formattedPrice:"",id:e.id,quantity:e.totalQuantity,product:{canonicalUrl:((a=e.product)==null?void 0:a.canonicalUrl)??"",mainImageUrl:((o=e.product)==null?void 0:o.image)??"",name:((n=e.product)==null?void 0:n.name)??"",productId:0,productType:(s=e.product)==null?void 0:s.productType,sku:((i=e.product)==null?void 0:i.sku)??""},prices:{price:{value:e.price.value,currency:e.price.currency}},configurableOptions:((p=e.selectedOptions)==null?void 0:p.map(c=>({optionLabel:c.label,valueLabel:c.value})))||[]}})}),M=t=>{var a,o,n;const r=t.coupons[0],e=(a=t.payments)==null?void 0:a[0];return{appliedCouponCode:(r==null?void 0:r.code)??"",email:t.email,grandTotal:t.grandTotal.value,orderId:t.number,orderType:"checkout",otherTax:0,salesTax:t.totalTax.value,shipping:{shippingMethod:((o=t.shipping)==null?void 0:o.code)??"",shippingAmount:((n=t.shipping)==null?void 0:n.amount)??0},subtotalExcludingTax:t.subtotal.value,subtotalIncludingTax:0,payments:e?[{paymentMethodCode:(e==null?void 0:e.code)||"",paymentMethodName:(e==null?void 0:e.name)||"",total:t.grandTotal.value}]:[]}},N=t=>{var e,a;const r=(a=(e=t==null?void 0:t.data)==null?void 0:e.placeOrder)==null?void 0:a.orderV2;return r?T(r):null},d={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},b={PLACE_ORDER:"place-order"};function m(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function l(t,r){const e=m();e.push({[t]:null}),e.push({[t]:r})}function I(t,r){m().push(a=>{const o=a.getState?a.getState():{};a.push({event:t,eventInfo:{...o,...r}})})}function L(t,r){const e=M(r),a=G(t,r);l(d.ORDER_CONTEXT,{...e}),l(d.SHOPPING_CART_CONTEXT,{...a}),I(b.PLACE_ORDER)}const S=`
mutation PLACE_ORDER_MUTATION($cartId: String!) {
placeOrder(input: { cart_id: $cartId }) {
errors {
Expand Down Expand Up @@ -89,4 +89,4 @@ import{c as H,r as X}from"./chunks/requestGuestOrderCancel.js";import{f as _,h a
${O}
${h}
${C}
`,k=async e=>{if(!e)throw new Error("No cart ID found");return _(S,{variables:{cartId:e}}).then(r=>{var a;(a=r.errors)!=null&&a.length&&T(r.errors);const t=N(r);return t&&(u.emit("order/placed",t),u.emit("cart/reset",void 0),L(e,t)),t}).catch(f)};export{H as cancelOrder,pt as config,_ as fetchGraphQl,W as getAttributesForm,tt as getAttributesList,V as getConfig,at as getCustomer,st as getCustomerOrdersReturn,ot as getGuestOrder,ct as getOrderDetailsById,Et as getStoreConfig,ut as guestOrderByToken,dt as initialize,k as placeOrder,Y as removeFetchGraphQlHeader,Tt as reorderItems,X as requestGuestOrderCancel,et as requestReturn,z as setEndpoint,j as setFetchGraphQlHeader,J as setFetchGraphQlHeaders};
`,Q=async t=>{if(!t)throw new Error("No cart ID found");return E(S,{variables:{cartId:t}}).then(r=>{var a;(a=r.errors)!=null&&a.length&&_(r.errors);const e=N(r);return e&&(u.emit("order/placed",e),u.emit("cart/reset",void 0),L(t,e)),e}).catch(f)};export{q as cancelOrder,ue as config,Re as confirmCancelOrder,Ae as confirmGuestReturn,E as fetchGraphQl,Z as getAttributesForm,te as getAttributesList,Y as getConfig,ne as getCustomer,pe as getCustomerOrdersReturn,se as getGuestOrder,de as getOrderDetailsById,_e as getStoreConfig,le as guestOrderByToken,me as initialize,Q as placeOrder,z as removeFetchGraphQlHeader,De as reorderItems,X as requestGuestOrderCancel,re as requestGuestReturn,ae as requestReturn,j as setEndpoint,J as setFetchGraphQlHeader,K as setFetchGraphQlHeaders};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare const confirmGuestReturn: (orderId: string, confirmationKey: string) => Promise<void>;
//# sourceMappingURL=confirmGuestReturn.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare const CONFIRM_RETURN_GUEST_ORDER: string;
//# sourceMappingURL=confirmGuestReturn.graphql.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './confirmGuestReturn';
//# sourceMappingURL=index.d.ts.map
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export declare const ORDER_SUMMARY_FRAGMENT = "\n fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {\n grand_total {\n value\n currency\n }\n total_giftcard {\n currency\n value\n }\n subtotal {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n }\n";
export declare const ORDER_SUMMARY_FRAGMENT = "\n fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {\n grand_total {\n value\n currency\n }\n total_giftcard {\n currency\n value\n }\n subtotal_excl_tax {\n currency\n value\n }\n subtotal_incl_tax {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n }\n";
//# sourceMappingURL=OrderSummaryFragment.graphql.d.ts.map
3 changes: 3 additions & 0 deletions scripts/__dropins__/storefront-order/api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ export * from './placeOrder';
export * from './reorderItems';
export * from './requestGuestOrderCancel';
export * from './requestReturn';
export * from './requestGuestReturn';
export * from './confirmGuestReturn';
export * from './confirmCancelOrder';
//# sourceMappingURL=index.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare const REQUEST_RETURN_GUEST_ORDER: string;
//# sourceMappingURL=requestGuestReturn.graphql.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './requestGuestReturn';
//# sourceMappingURL=index.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { RequestGuestReturnProps } from '../../types';

export declare const requestGuestReturn: (form: RequestGuestReturnProps) => Promise<{
uid: string;
number: string;
status: string;
createdAt: string;
}>;
//# sourceMappingURL=requestGuestReturn.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*! Copyright 2024 Adobe
All Rights Reserved. */
const R=`
fragment REQUEST_RETURN_ORDER_FRAGMENT on Return {
__typename
uid
status
number
created_at
}
`;export{R};
Loading

0 comments on commit 3ffd216

Please sign in to comment.