forked from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
689 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ package.json | |
package-lock.json | ||
test/* | ||
postinstall.js | ||
build.mjs | ||
tools/picker/src/* | ||
cypress/ | ||
tools/pdp-metadata/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { overrideGQLOperations } from '@dropins/build-tools/gql-extend.js'; | ||
|
||
overrideGQLOperations([ | ||
{ | ||
npm: '@dropins/storefront-cart', | ||
operations: [], | ||
}, | ||
]); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
import{s,f as p,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a as H,b as k,c as z}from"./chunks/resetCart.js";import{C as g,a as l,t as f}from"./chunks/CartFragment.js";import{events as m}from"@dropins/tools/event-bus.js";import{c as h,p as I}from"./chunks/acdl.js";import{c as _,g as E,a as A}from"./chunks/getStoreConfig.js";import{b as j,e as q,i as B,d as J}from"./chunks/getStoreConfig.js";import{u as L}from"./chunks/updateProductsFromCart.js";import{g as W,b as X,a as Z}from"./chunks/getEstimateShipping.js";import{g as at}from"./chunks/getEstimatedTotals.js";import{g as et}from"./chunks/persisted-data.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const R=` | ||
import{s,f as p,h as T}from"./chunks/resetCart.js";import{g as $,r as v,d as Q,a as H,b as k,c as z}from"./chunks/resetCart.js";import{C as l,t as f,c as g,g as h,a as I}from"./chunks/getStoreConfig.js";import{b as j,e as q,i as B,d as J}from"./chunks/getStoreConfig.js";import{events as d}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as _}from"./fragments.js";import{c as A,p as E}from"./chunks/acdl.js";import{u as L}from"./chunks/updateProductsFromCart.js";import{g as W,b as X,a as Z}from"./chunks/getEstimateShipping.js";import{g as rt}from"./chunks/getEstimatedTotals.js";import{g as et}from"./chunks/persisted-data.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const R=` | ||
mutation ADD_PRODUCTS_TO_CART_MUTATION( | ||
$cartId: String!, | ||
$cartItems: [CartItemInput!]!, | ||
${g} | ||
${l} | ||
) { | ||
addProductsToCart( | ||
cartId: $cartId | ||
cartItems: $cartItems | ||
) { | ||
cart { | ||
...CartFragment | ||
...CART_FRAGMENT | ||
} | ||
user_errors { | ||
code | ||
message | ||
} | ||
} | ||
} | ||
${l} | ||
`,b=async a=>{let o=!1;const n=s.cartId||await O().then(e=>(o=!0,e));return p(R,{variables:{cartId:n,cartItems:a.map(({sku:e,parentSku:r,quantity:c,optionsUIDs:t,enteredOptions:i})=>({sku:e,parent_sku:r,quantity:c,selected_options:t,entered_options:i}))}}).then(({errors:e,data:r})=>{var i;const c=[...((i=r==null?void 0:r.addProductsToCart)==null?void 0:i.user_errors)??[],...e??[]];if(c.length>0)return T(c);const t=f(r.addProductsToCart.cart);if(m.emit("cart/updated",t),m.emit("cart/data",t),t){const d=t.items.filter(C=>a.some(({sku:u})=>u===C.sku));o?h(t,d,s.locale??"en-US"):I(t,d,s.locale??"en-US")}return t})},P=` | ||
${_} | ||
`,b=async r=>{let o=!1;const c=s.cartId||await G().then(e=>(o=!0,e));return p(R,{variables:{cartId:c,cartItems:r.map(({sku:e,parentSku:a,quantity:n,optionsUIDs:t,enteredOptions:i})=>({sku:e,parent_sku:a,quantity:n,selected_options:t,entered_options:i}))}}).then(({errors:e,data:a})=>{var i;const n=[...((i=a==null?void 0:a.addProductsToCart)==null?void 0:i.user_errors)??[],...e??[]];if(n.length>0)return T(n);const t=f(a.addProductsToCart.cart);if(d.emit("cart/updated",t),d.emit("cart/data",t),t){const m=t.items.filter(C=>r.some(({sku:u})=>u===C.sku));o?A(t,m,s.locale??"en-US"):E(t,m,s.locale??"en-US")}return t})},P=` | ||
mutation CREATE_EMPTY_CART_MUTATION { | ||
createEmptyCart | ||
} | ||
`,O=async()=>{const{disableGuestCart:a}=_.getConfig();if(a)throw new Error("Guest cart is disabled");return await p(P).then(({data:o})=>{const n=o.createEmptyCart;return s.cartId=n,n})},F=async()=>{const a=s.authenticated?await E():await A();return m.emit("cart/updated",a),m.emit("cart/data",a),a};export{b as addProductsToCart,_ as config,O as createEmptyCart,p as fetchGraphQl,j as getCartData,et as getCartDataFromCache,$ as getConfig,W as getCountries,E as getCustomerCartPayload,X as getEstimateShipping,at as getEstimatedTotals,A as getGuestCartPayload,Z as getRegions,q as getStoreConfig,B as initialize,J as initializeCart,F as refreshCart,v as removeFetchGraphQlHeader,Q as resetCart,H as setEndpoint,k as setFetchGraphQlHeader,z as setFetchGraphQlHeaders,L as updateProductsFromCart}; | ||
`,G=async()=>{const{disableGuestCart:r}=g.getConfig();if(r)throw new Error("Guest cart is disabled");return await p(P).then(({data:o})=>{const c=o.createEmptyCart;return s.cartId=c,c})},F=async()=>{const r=s.authenticated?await h():await I();return d.emit("cart/updated",r),d.emit("cart/data",r),r};export{b as addProductsToCart,g as config,G as createEmptyCart,p as fetchGraphQl,j as getCartData,et as getCartDataFromCache,$ as getConfig,W as getCountries,h as getCustomerCartPayload,X as getEstimateShipping,rt as getEstimatedTotals,I as getGuestCartPayload,Z as getRegions,q as getStoreConfig,B as initialize,J as initializeCart,F as refreshCart,v as removeFetchGraphQlHeader,Q as resetCart,H as setEndpoint,k as setFetchGraphQlHeader,z as setFetchGraphQlHeaders,L as updateProductsFromCart}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { CART_FRAGMENT } from './graphql/CartFragment'; | ||
export { CART_ITEM_FRAGMENT } from './graphql/CartItemFragment'; | ||
//# sourceMappingURL=fragments.d.ts.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
scripts/__dropins__/storefront-cart/api/graphql/CartItemFragment.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare const CART_ITEM_FRAGMENT: string; | ||
//# sourceMappingURL=CartItemFragment.d.ts.map |
2 changes: 2 additions & 0 deletions
2
scripts/__dropins__/storefront-cart/api/graphql/CustomerAccountFragment.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare const CUSTOMER_ACCOUNT_FRAGMENT = "\nfragment CUSTOMER_FRAGMENT on Customer {\n addresses {\n default_shipping\n country_id\n postcode\n region {\n region\n region_code\n region_id\n }\n }\n}"; | ||
//# sourceMappingURL=CustomerAccountFragment.d.ts.map |
2 changes: 2 additions & 0 deletions
2
scripts/__dropins__/storefront-cart/api/graphql/CustomizableOptionsFragment.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare const CUSTOMIZABLE_OPTIONS_FRAGMENT = "\n fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {\n type\n customizable_option_uid\n label\n is_required\n values {\n label\n value\n price{\n type\n units\n value\n }\n }\n }\n"; | ||
//# sourceMappingURL=CustomizableOptionsFragment.d.ts.map |
2 changes: 2 additions & 0 deletions
2
scripts/__dropins__/storefront-cart/api/graphql/PriceRangeFragment.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare const PRICE_RANGE_FRAGMENT = "\n fragment PRICE_RANGE_FRAGMENT on PriceRange {\n minimum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n maximum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n }\n"; | ||
//# sourceMappingURL=PriceRangeFragment.d.ts.map |
2 changes: 2 additions & 0 deletions
2
scripts/__dropins__/storefront-cart/api/graphql/arguments.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare const CART_ITEMS_PAGINATION_ARGUMENTS = "\n $pageSize: Int! = 100,\n $currentPage: Int! = 1,\n $itemsSortInput: QuoteItemsSortInput! = {field: CREATED_AT, order: DESC}\n"; | ||
//# sourceMappingURL=arguments.d.ts.map |
6 changes: 5 additions & 1 deletion
6
scripts/__dropins__/storefront-cart/api/initialize/initialize.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.