Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cart to 1.2.0 #351

Merged
merged 2 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -37,7 +37,7 @@
"@adobe/magento-storefront-events-sdk": "^1.8.0",
"@dropins/storefront-account": "~1.0.3",
"@dropins/storefront-auth": "~1.0.3",
"@dropins/storefront-cart": "~1.1.0",
"@dropins/storefront-cart": "~1.2.0",
"@dropins/storefront-checkout": "~1.2.0",
"@dropins/storefront-order": "~1.0.4",
"@dropins/storefront-payment-services": "~1.0.1",
Expand Down
6 changes: 3 additions & 3 deletions scripts/__dropins__/storefront-cart/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! Copyright 2025 Adobe
All Rights Reserved. */
import{s as o,f as d,h as l}from"./chunks/resetCart.js";import{g as $,r as Q,d as H,a as k,b as z,c as V}from"./chunks/resetCart.js";import{C as T,t as g,c as f}from"./chunks/refreshCart.js";import{g as j,b as q,d as B,e as J,i as K,a as W,r as X}from"./chunks/refreshCart.js";import{events as C}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as h}from"./fragments.js";import{b as A,a as I,c as _}from"./chunks/acdl.js";import{u as Z}from"./chunks/updateProductsFromCart.js";import{g as rt,b as at,a as et}from"./chunks/getEstimateShipping.js";import{g as ot}from"./chunks/getEstimatedTotals.js";import{g as E}from"./chunks/persisted-data.js";import{A as it,a as ct}from"./chunks/applyCouponsToCart.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const S=`
import{s as o,f as m,h as l}from"./chunks/resetCart.js";import{g as $,r as Q,d as H,a as k,b as z,c as V}from"./chunks/resetCart.js";import{C as T,t as f,c as g}from"./chunks/refreshCart.js";import{g as j,b as q,d as B,e as J,i as K,a as W,r as X}from"./chunks/refreshCart.js";import{events as C}from"@dropins/tools/event-bus.js";import{CART_FRAGMENT as h}from"./fragments.js";import{b as A,a as I,c as _}from"./chunks/acdl.js";import{u as Z}from"./chunks/updateProductsFromCart.js";import{g as rt,b as at,a as et}from"./chunks/getEstimateShipping.js";import{g as ot}from"./chunks/getEstimatedTotals.js";import{g as E}from"./chunks/persisted-data.js";import{A as nt,a as ct}from"./chunks/applyCouponsToCart.js";import{a as Ct,r as mt}from"./chunks/removeGiftCardFromCart.js";import{s as ut}from"./chunks/setGiftOptionsOnCart.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const G=`
mutation ADD_PRODUCTS_TO_CART_MUTATION(
$cartId: String!,
$cartItems: [CartItemInput!]!,
Expand All @@ -21,12 +21,12 @@ import{s as o,f as d,h as l}from"./chunks/resetCart.js";import{g as $,r as Q,d a
}
${h}
`,F=async a=>{let r=!1;const n=o.cartId||await R().then(s=>(r=!0,s));return d(S,{variables:{cartId:n,cartItems:a.map(({sku:s,parentSku:e,quantity:i,optionsUIDs:t,enteredOptions:c})=>({sku:s,parent_sku:e,quantity:i,selected_options:t,entered_options:c}))}}).then(({errors:s,data:e})=>{var c;const i=[...((c=e==null?void 0:e.addProductsToCart)==null?void 0:c.user_errors)??[],...s??[]];if(i.length>0)return l(i);const t=g(e.addProductsToCart.cart);if(C.emit("cart/updated",t),C.emit("cart/data",t),t){const p=t.items.filter(m=>a.some(({sku:u})=>u===m.topLevelSku));r?A(t,p,o.locale??"en-US"):I(t,p,o.locale??"en-US")}return t})},G=`
`,y=async a=>{let r=!1;const i=o.cartId||await R().then(s=>(r=!0,s));return m(G,{variables:{cartId:i,cartItems:a.map(({sku:s,parentSku:e,quantity:n,optionsUIDs:t,enteredOptions:c})=>({sku:s,parent_sku:e,quantity:n,selected_options:t,entered_options:c}))}}).then(({errors:s,data:e})=>{var c;const n=[...((c=e==null?void 0:e.addProductsToCart)==null?void 0:c.user_errors)??[],...s??[]];if(n.length>0)return l(n);const t=f(e.addProductsToCart.cart);if(C.emit("cart/updated",t),C.emit("cart/data",t),t){const p=t.items.filter(d=>a.some(({sku:u})=>u===d.topLevelSku));r?A(t,p,o.locale??"en-US"):I(t,p,o.locale??"en-US")}return t})},S=`
mutation CREATE_GUEST_CART_MUTATION {
createGuestCart {
cart {
id
}
}
}
`,R=async()=>{const{disableGuestCart:a}=f.getConfig();if(a)throw new Error("Guest cart is disabled");return await d(G).then(({data:r})=>{const n=r.createGuestCart.cart.id;return o.cartId=n,n})},M=()=>{const a=o.locale??"en-US",r=E();r&&_(r,a)};export{it as ApplyCouponsStrategy,F as addProductsToCart,ct as applyCouponsToCart,f as config,R as createGuestCart,d as fetchGraphQl,j as getCartData,E as getCartDataFromCache,$ as getConfig,rt as getCountries,q as getCustomerCartPayload,at as getEstimateShipping,ot as getEstimatedTotals,B as getGuestCartPayload,et as getRegions,J as getStoreConfig,K as initialize,W as initializeCart,M as publishShoppingCartViewEvent,X as refreshCart,Q as removeFetchGraphQlHeader,H as resetCart,k as setEndpoint,z as setFetchGraphQlHeader,V as setFetchGraphQlHeaders,Z as updateProductsFromCart};
`,R=async()=>{const{disableGuestCart:a}=g.getConfig();if(a)throw new Error("Guest cart is disabled");return await m(S).then(({data:r})=>{const i=r.createGuestCart.cart.id;return o.cartId=i,i})},F=()=>{const a=o.locale??"en-US",r=E();r&&_(r,a)};export{nt as ApplyCouponsStrategy,y as addProductsToCart,ct as applyCouponsToCart,Ct as applyGiftCardToCart,g as config,R as createGuestCart,m as fetchGraphQl,j as getCartData,E as getCartDataFromCache,$ as getConfig,rt as getCountries,q as getCustomerCartPayload,at as getEstimateShipping,ot as getEstimatedTotals,B as getGuestCartPayload,et as getRegions,J as getStoreConfig,K as initialize,W as initializeCart,F as publishShoppingCartViewEvent,X as refreshCart,Q as removeFetchGraphQlHeader,mt as removeGiftCardFromCart,H as resetCart,k as setEndpoint,z as setFetchGraphQlHeader,V as setFetchGraphQlHeaders,ut as setGiftOptionsOnCart,Z as updateProductsFromCart};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { CartModel } from '../../data/models';

export declare const applyGiftCardToCart: (giftCardCode: string) => Promise<CartModel | null>;
//# sourceMappingURL=applyGiftCardToCart.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/********************************************************************
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
*******************************************************************/
export declare const APPLY_GIFT_CARD_ON_CART_MUTATION: string;
//# sourceMappingURL=ApplyGiftCardToCartMutation.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/********************************************************************
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
*******************************************************************/
export * from './applyGiftCardToCart';
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions scripts/__dropins__/storefront-cart/api/fragments.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { CART_FRAGMENT } from './graphql/CartFragment';
export { CART_ITEM_FRAGMENT } from './graphql/CartItemFragment';
export { DOWNLOADABLE_CART_ITEMS_FRAGMENT } from './graphql/DownloadableCartItemsFragment';
export { GIFT_MESSAGE_FRAGMENT, GIFT_WRAPPING_FRAGMENT, AVAILABLE_GIFT_WRAPPING_FRAGMENT, APPLIED_GIFT_CARDS_FRAGMENT } from './graphql/GiftFragment';
//# sourceMappingURL=fragments.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
*******************************************************************/
export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n minicart_display \n minicart_max_items\n cart_expires_in_days \n cart_summary_display_quantity\n max_items_in_order_summary\n default_country\n category_fixed_product_tax_display_setting\n product_fixed_product_tax_display_setting\n sales_fixed_product_tax_display_setting\n shopping_cart_display_full_summary\n shopping_cart_display_grand_total\n shopping_cart_display_price\n shopping_cart_display_shipping\n shopping_cart_display_subtotal\n shopping_cart_display_tax_gift_wrapping\n shopping_cart_display_zero_tax\n configurable_thumbnail_source\n }\n}\n";
export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n minicart_display\n minicart_max_items\n cart_expires_in_days\n cart_summary_display_quantity\n max_items_in_order_summary\n default_country\n category_fixed_product_tax_display_setting\n product_fixed_product_tax_display_setting\n sales_fixed_product_tax_display_setting\n shopping_cart_display_full_summary\n shopping_cart_display_grand_total\n shopping_cart_display_price\n shopping_cart_display_shipping\n shopping_cart_display_subtotal\n shopping_cart_display_tax_gift_wrapping\n shopping_cart_display_zero_tax\n configurable_thumbnail_source\n allow_gift_wrapping_on_order\n allow_gift_wrapping_on_order_items\n allow_order\n allow_items\n allow_gift_receipt\n allow_printed_card\n printed_card_priceV2 {\n currency\n value\n }\n cart_gift_wrapping\n cart_printed_card\n }\n}\n";
//# sourceMappingURL=StoreConfigQuery.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare const APPLIED_GIFT_CARDS_FRAGMENT = "\n fragment APPLIED_GIFT_CARDS_FRAGMENT on AppliedGiftCard {\n __typename\n code\n applied_balance {\n value\n currency\n }\n current_balance {\n value\n currency\n }\n expiration_date\n }\n";
export declare const GIFT_MESSAGE_FRAGMENT = "\n fragment GIFT_MESSAGE_FRAGMENT on GiftMessage {\n __typename\n from\n to\n message\n }\n";
export declare const GIFT_WRAPPING_FRAGMENT = "\n fragment GIFT_WRAPPING_FRAGMENT on GiftWrapping {\n __typename\n uid\n design\n image {\n url\n }\n price {\n value\n currency\n }\n }\n";
export declare const AVAILABLE_GIFT_WRAPPING_FRAGMENT = "\n fragment AVAILABLE_GIFT_WRAPPING_FRAGMENT on GiftWrapping {\n __typename\n uid\n design\n image {\n url\n label\n }\n price {\n currency\n value\n }\n }\n";
//# sourceMappingURL=GiftFragment.d.ts.map
3 changes: 3 additions & 0 deletions scripts/__dropins__/storefront-cart/api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ export * from './refreshCart';
export { getPersistedCartData as getCartDataFromCache } from '../lib/persisted-data';
export * from './applyCouponsToCart';
export * from './publishShoppingCartViewEvent';
export * from './applyGiftCardToCart';
export * from './removeGiftCardFromCart';
export * from './setGiftOptionsOnCart';
//# sourceMappingURL=index.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/********************************************************************
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
*******************************************************************/
export declare const REMOVE_GIFT_CARD_ON_CART_MUTATION: string;
//# sourceMappingURL=RemoveGiftCardFromCartMutation.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/********************************************************************
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
*******************************************************************/
export * from './removeGiftCardFromCart';
//# sourceMappingURL=index.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { CartModel } from '../../data/models';

export declare const removeGiftCardFromCart: (giftCardCode: string) => Promise<CartModel | null>;
//# sourceMappingURL=removeGiftCardFromCart.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/********************************************************************
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
*******************************************************************/
export declare const SET_GIFT_OPTIONS_ON_CART_MUTATION: string;
//# sourceMappingURL=UpdateGiftOptionsMutation.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/********************************************************************
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
*******************************************************************/
export * from './setGiftOptionsOnCart';
//# sourceMappingURL=index.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { CartModel } from '../../data/models';
import { GiftFormDataType } from '../../types';

export declare const setGiftOptionsOnCart: (giftForm: GiftFormDataType) => Promise<CartModel | null>;
//# sourceMappingURL=setGiftOptionsOnCart.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { CartModel } from '../../data/models';
type UpdateProductsFromCart = Array<{
uid: string;
quantity: number;
giftOptions?: {
gift_wrapping_id?: string | null;
gift_message: {
to: string;
from: string;
message: string;
};
};
}>;
export declare const updateProductsFromCart: (items: UpdateProductsFromCart) => Promise<CartModel | null>;
export {};
Expand Down

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

Loading