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
1 parent
1d10801
commit e5ced49
Showing
19 changed files
with
264 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
scripts/__dropins__/storefront-checkout/chunks/fixtures.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
scripts/__dropins__/storefront-checkout/chunks/getMultilineValues.js
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,43 @@ | ||
import{k as _,M as y,d as h,l as g,x as l}from"./fixtures.js";import{t as m}from"./transform-shipping-methods.js";import"@dropins/tools/event-bus.js";const I=` | ||
mutation estimateShippingMethods( | ||
$cartId: String! | ||
$address: EstimateAddressInput! | ||
) { | ||
estimateShippingMethods( | ||
input: { | ||
cart_id: $cartId | ||
address: $address | ||
} | ||
) { | ||
carrier_title | ||
carrier_code | ||
method_title | ||
method_code | ||
available | ||
amount { | ||
currency | ||
value | ||
} | ||
price_excl_tax { | ||
currency | ||
value | ||
} | ||
price_incl_tax { | ||
currency | ||
value | ||
} | ||
error_message | ||
} | ||
} | ||
`,M=t=>t?!!t.id&&!!t.code&&!!t.name:!1,S=t=>{if(t)return t.filter(M).map(e=>{const{id:a,code:n,name:i}=e;return{id:a,code:n,name:i}})};var f=(t=>(t.SHIPPING="shipping_addresses",t.BILLING="billing_address",t))(f||{}),v=(t=>(t.City="city",t.Company="company",t.Country="country_id",t.FirstName="firstname",t.LastName="lastname",t.PostCode="postcode",t.Region="region",t.RegionId="region_id",t.SaveInAddressBook="save_in_address_book",t.Street="street",t.Telephone="telephone",t.Vat="vat_id",t))(v||{});const L=async t=>{const e=_.cartId,{criteria:a}=t||{},{country_code:n,region_id:i,region_name:s,zip:r}=a||{};if(!e)throw new y;if(!n)throw new h;const o=typeof i=="string"?parseInt(i,10):i,c=i||s?{...o&&{region_id:o},...s&&{region_code:s}}:void 0,u={country_code:n,...r&&{postcode:r},...c&&{region:c}};return await g({type:"mutation",query:I,options:{variables:{cartId:e,address:u}},path:"estimateShippingMethods",signalType:"estimateShippingMethods",transformer:m})},d=` | ||
query getRegions($countryCode: String!) { | ||
country(id: $countryCode) { | ||
id | ||
available_regions { | ||
id | ||
code | ||
name | ||
} | ||
} | ||
}`,N=async(t,e)=>(l.value.addressType=e,g({type:"query",query:d,options:{variables:{countryCode:t}},path:"country.available_regions",signalType:"regions",transformer:S})),p="-",R=` | ||
`,E=2e3,w=(t,e)=>Object.keys(e).filter(a=>a.startsWith(t)).sort((a,n)=>parseInt(a.replace(`${t}${p}`,""),10)-parseInt(n.replace(`${t}${p}`,""),10)).map(a=>e[a]);export{f as A,E as D,p as M,v as a,w as b,R as c,L as e,N as g}; |
17 changes: 17 additions & 0 deletions
17
scripts/__dropins__/storefront-checkout/chunks/setGuestEmailOnCart.js
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,17 @@ | ||
import{a as r,g as s,u as e,k as l,M as n,l as o}from"./fixtures.js";import"@dropins/tools/event-bus.js";import{C as m,t as c}from"./getCart.graphql.js";const u=a=>!!(a!=null&&a.is_email_available),E=` | ||
query isEmailAvailable($email: String!) { | ||
isEmailAvailable(email: $email) { | ||
is_email_available | ||
} | ||
} | ||
`,h=a=>{if(!(!a||a.length===0))throw Error(a.map(t=>t.message).join(" "))},A=async a=>{if(!a)throw new r;const{data:t,errors:i}=await s(E,{method:"GET",cache:"no-cache",variables:{email:a}}).catch(e);return i&&h(i),u(t.isEmailAvailable)},p=` | ||
mutation setGuestEmail($cartId: String!, $email: String!) { | ||
setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) { | ||
cart { | ||
id | ||
...CheckoutData | ||
} | ||
} | ||
} | ||
${m} | ||
`,C=async a=>{const t=l.cartId;if(!t)throw new n;return await o({type:"mutation",query:p,options:{variables:{cartId:t,email:a}},path:"setGuestEmailOnCart.cart",signalType:"cart",transformer:c})};export{A as i,C as s}; |
13 changes: 13 additions & 0 deletions
13
scripts/__dropins__/storefront-checkout/chunks/setPaymentMethod.js
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,13 @@ | ||
import{k as e,M as r,b as n,l as s}from"./fixtures.js";import{C as o,t as i}from"./getCart.graphql.js";const m=` | ||
mutation setPaymentMethod($cartId: String!, $paymentMethod: String!) { | ||
setPaymentMethodOnCart( | ||
input: { cart_id: $cartId, payment_method: { code: $paymentMethod } } | ||
) { | ||
cart { | ||
id | ||
...CheckoutData | ||
} | ||
} | ||
} | ||
${o} | ||
`,h=async t=>{const a=e.cartId;if(!a)throw new r;if(!t)throw new n;return await s({type:"mutation",query:m,options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",signalType:"cart",transformer:i})};export{h as s}; |
16 changes: 16 additions & 0 deletions
16
scripts/__dropins__/storefront-checkout/chunks/setShippingAddress.js
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,16 @@ | ||
import{a as s,b as p,M as u,c as _}from"./getMultilineValues.js";import{k as g,M as I,l}from"./fixtures.js";import{C,t as h}from"./getCart.graphql.js";import"@dropins/tools/event-bus.js";const A=/^\d+$/,T=t=>{if(A.test(t))return parseInt(t,10)},m=` | ||
mutation setShippingAddress($cartId: String!, $address: CartAddressInput!, $pickup_location_code: String) { | ||
setShippingAddressesOnCart( | ||
input: { | ||
cart_id: $cartId, | ||
shipping_addresses: [{ address: $address, pickup_location_code: $pickup_location_code }] | ||
} | ||
) { | ||
cart { | ||
id | ||
...CheckoutData | ||
} | ||
} | ||
} | ||
${C} | ||
`,y=["city","company","country_code","firstname","lastname","postcode","region","region_id","save_in_address_book","street","telephone","vat_id"],$=t=>{const a={city:t[s.City],company:t[s.Company],country_code:t[s.Country],firstname:t[s.FirstName],lastname:t[s.LastName],postcode:t[s.PostCode],save_in_address_book:!0,street:p(s.Street,t),telephone:t[s.Telephone],vat_id:t[s.Vat]},r=t[s.Region],c=T(r);c?a.region_id=c:a.region=r;const d=Object.keys(t).filter(e=>!e.startsWith("street")).filter(e=>!y.includes(e)).filter(e=>e!=="country_id").map(e=>{const[n,i]=e.split(u);if(!i)return{attribute_code:n,value:t[e]};const o=p(n,t).join(_);return{attribute_code:n,value:o}}).filter((e,n,i)=>n===i.findIndex(o=>o.attribute_code===e.attribute_code));return d.length>0&&(a.custom_attributes=d),a},k=async({signal:t,...a})=>{const r=g.cartId;if(!r)throw new I;return await l({type:"mutation",query:m,options:{signal:t,variables:{cartId:r,...a}},path:"setShippingAddressesOnCart.cart",signalType:"cart",transformer:h})};export{y as S,$ as p,k as s}; |
1 change: 1 addition & 0 deletions
1
scripts/__dropins__/storefront-checkout/chunks/transform-shipping-methods.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
scripts/__dropins__/storefront-checkout/chunks/withConditionalRendering.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
scripts/__dropins__/storefront-checkout/containers/ServerError.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,3 @@ | ||
export * from './ServerError/index' | ||
import _default from './ServerError/index' | ||
export default _default |
1 change: 1 addition & 0 deletions
1
scripts/__dropins__/storefront-checkout/containers/ServerError.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
scripts/__dropins__/storefront-checkout/containers/ServerError/ServerError.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,8 @@ | ||
import { Container } from '@dropins/tools/types/elsie/src/lib'; | ||
|
||
interface ServerErrorProps { | ||
onServerError?: () => void; | ||
} | ||
export declare const ServerError: Container<ServerErrorProps>; | ||
export {}; | ||
//# sourceMappingURL=ServerError.d.ts.map |
19 changes: 19 additions & 0 deletions
19
scripts/__dropins__/storefront-checkout/containers/ServerError/index.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,19 @@ | ||
/******************************************************************** | ||
* 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 './ServerError'; | ||
export { ServerError as default } from './ServerError'; | ||
//# sourceMappingURL=index.d.ts.map |
18 changes: 18 additions & 0 deletions
18
scripts/__dropins__/storefront-checkout/signals/ServerErrorSignal.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,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 serverErrorSignal: import('@preact/signals-core').Signal<string | undefined>; | ||
//# sourceMappingURL=ServerErrorSignal.d.ts.map |
18 changes: 18 additions & 0 deletions
18
scripts/__dropins__/storefront-checkout/utils/isUnexpectedError/index.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,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 './isUnexpectedError'; | ||
//# sourceMappingURL=index.d.ts.map |
Oops, something went wrong.