@occluze/tether 0.6.8 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/README.md +11 -11
  2. package/dist/esm/astro.js +2 -2
  3. package/dist/esm/chunks/account-UIPWJQ3Y.js +1 -0
  4. package/dist/esm/chunks/account-pages-6ROA6Y4V.js +1 -0
  5. package/dist/esm/chunks/analytics-2V632IRV.js +1 -0
  6. package/dist/esm/chunks/chunk-4GCXM764.js +1 -0
  7. package/dist/esm/chunks/chunk-56FCLJJD.js +1 -0
  8. package/dist/esm/chunks/chunk-5Z5O3767.js +1 -0
  9. package/dist/esm/chunks/chunk-6OZJCAGZ.js +1 -0
  10. package/dist/esm/chunks/chunk-A5SYCVQM.js +1 -0
  11. package/dist/esm/chunks/chunk-BA4LQJJQ.js +1 -0
  12. package/dist/esm/chunks/chunk-BFTZR4OB.js +4 -0
  13. package/dist/esm/chunks/chunk-C5JYQCWH.js +1 -0
  14. package/dist/esm/chunks/chunk-E5YO6274.js +1 -0
  15. package/dist/esm/chunks/chunk-MPDWM2NN.js +1 -0
  16. package/dist/esm/chunks/chunk-T44MUL4Y.js +1 -0
  17. package/dist/esm/chunks/chunk-YLUULATY.js +1 -0
  18. package/dist/esm/chunks/diagnose-3FEKRIEK.js +14 -0
  19. package/dist/esm/chunks/extras-6POFBNOP.js +1 -0
  20. package/dist/esm/chunks/markets-ui-FD6NI2OG.js +1 -0
  21. package/dist/esm/chunks/search-UJ73YBQ5.js +1 -0
  22. package/dist/esm/index.js +1 -1
  23. package/dist/esm/server.js +2 -2
  24. package/dist/presets/barba.esm.js +19 -23
  25. package/dist/tether.account-pages.js +320 -365
  26. package/dist/tether.account-pages.min.js +1 -1
  27. package/dist/tether.account.js +242 -491
  28. package/dist/tether.account.min.js +1 -1
  29. package/dist/tether.analytics.js +66 -88
  30. package/dist/tether.analytics.min.js +1 -1
  31. package/dist/tether.diagnose.js +36 -33
  32. package/dist/tether.diagnose.min.js +2 -2
  33. package/dist/tether.extras.js +28 -36
  34. package/dist/tether.extras.min.js +1 -1
  35. package/dist/tether.js +1270 -894
  36. package/dist/tether.markets.js +73 -90
  37. package/dist/tether.markets.min.js +1 -1
  38. package/dist/tether.min.js +0 -0
  39. package/dist/tether.min.js.map +4 -4
  40. package/dist/tether.search.js +44 -68
  41. package/dist/tether.search.min.js +1 -1
  42. package/dist/types/server/src/shared/account-orders.d.ts +44 -0
  43. package/dist/types/server/src/shared/account-routes.d.ts +153 -0
  44. package/dist/types/server/src/shared/api-versions.d.ts +13 -0
  45. package/dist/types/server/src/shared/error-message.d.ts +2 -0
  46. package/dist/types/server/src/shared/json.d.ts +25 -0
  47. package/dist/types/server/src/shared/market-codes.d.ts +16 -0
  48. package/dist/types/src/account/addresses-view.d.ts +5 -0
  49. package/dist/types/src/account/answers.d.ts +40 -0
  50. package/dist/types/src/account/markup.d.ts +19 -0
  51. package/dist/types/src/account/operations.d.ts +41 -0
  52. package/dist/types/src/account/order-lines.d.ts +13 -0
  53. package/dist/types/src/account/order-list.d.ts +12 -0
  54. package/dist/types/src/account/order-page.d.ts +6 -0
  55. package/dist/types/src/account/page-answers.d.ts +182 -0
  56. package/dist/types/src/account/page-events.d.ts +2 -0
  57. package/dist/types/src/account/server-client.d.ts +60 -0
  58. package/dist/types/src/account/subscriptions-view.d.ts +2 -0
  59. package/dist/types/src/account-api.d.ts +18 -0
  60. package/dist/types/src/account-marks.d.ts +15 -0
  61. package/dist/types/src/account-pages.d.ts +8 -0
  62. package/dist/types/src/account.d.ts +64 -0
  63. package/dist/types/src/amounts.d.ts +12 -0
  64. package/dist/types/src/analytics-shopify.d.ts +41 -0
  65. package/dist/types/src/analytics.d.ts +2 -0
  66. package/dist/types/src/api-version.d.ts +28 -0
  67. package/dist/types/src/astro.d.ts +42 -0
  68. package/dist/types/src/cart/cart-shape.d.ts +43 -0
  69. package/dist/types/src/cart/checkout.d.ts +16 -0
  70. package/dist/types/src/cart/drawer.d.ts +18 -0
  71. package/dist/types/src/cart/mutations.d.ts +79 -0
  72. package/dist/types/src/cart/render.d.ts +17 -0
  73. package/dist/types/src/cart/store.d.ts +182 -0
  74. package/dist/types/src/cart.d.ts +106 -0
  75. package/dist/types/src/client.d.ts +100 -0
  76. package/dist/types/src/collection.d.ts +25 -0
  77. package/dist/types/src/config-sections.d.ts +40 -0
  78. package/dist/types/src/config.d.ts +185 -0
  79. package/dist/types/src/controls/cart-controls.d.ts +2 -0
  80. package/dist/types/src/controls/discount.d.ts +2 -0
  81. package/dist/types/src/controls/extras.d.ts +5 -0
  82. package/dist/types/src/controls/navigation.d.ts +12 -0
  83. package/dist/types/src/diagnose-markup.d.ts +19 -0
  84. package/dist/types/src/diagnose.d.ts +60 -0
  85. package/dist/types/src/dom.d.ts +75 -0
  86. package/dist/types/src/extras.d.ts +21 -0
  87. package/dist/types/src/fragments.d.ts +158 -0
  88. package/dist/types/src/globals.d.ts +15 -0
  89. package/dist/types/src/images.d.ts +20 -0
  90. package/dist/types/src/index.d.ts +167 -0
  91. package/dist/types/src/initial.d.ts +56 -0
  92. package/dist/types/src/lazy.d.ts +28 -0
  93. package/dist/types/src/loader.d.ts +84 -0
  94. package/dist/types/src/market-codes.d.ts +6 -0
  95. package/dist/types/src/markets-ui.d.ts +32 -0
  96. package/dist/types/src/markets.d.ts +72 -0
  97. package/dist/types/src/markup.d.ts +131 -0
  98. package/dist/types/src/mounting.d.ts +46 -0
  99. package/dist/types/src/page-market.d.ts +27 -0
  100. package/dist/types/src/presets/barba.d.ts +56 -0
  101. package/dist/types/src/product-events.d.ts +2 -0
  102. package/dist/types/src/product-render.d.ts +17 -0
  103. package/dist/types/src/product-shape.d.ts +88 -0
  104. package/dist/types/src/product-state.d.ts +110 -0
  105. package/dist/types/src/product.d.ts +66 -0
  106. package/dist/types/src/repeaters.d.ts +16 -0
  107. package/dist/types/src/search.d.ts +33 -0
  108. package/dist/types/src/selling-plans.d.ts +64 -0
  109. package/dist/types/src/server.d.ts +88 -0
  110. package/dist/types/src/shopify-values.d.ts +46 -0
  111. package/dist/types/src/status.d.ts +33 -0
  112. package/dist/types/src/storage.d.ts +12 -0
  113. package/dist/types/src/store-html.d.ts +39 -0
  114. package/dist/types/src/storefront/catalog.d.ts +38 -0
  115. package/dist/types/src/storefront/json-ld.d.ts +20 -0
  116. package/dist/types/src/variant-render.d.ts +14 -0
  117. package/package.json +24 -23
  118. package/src/account/addresses-view.ts +58 -0
  119. package/src/account/answers.ts +79 -0
  120. package/src/account/markup.ts +36 -0
  121. package/src/account/operations.ts +145 -0
  122. package/src/account/{order-lines.js → order-lines.ts} +20 -41
  123. package/src/account/order-list.ts +107 -0
  124. package/src/account/order-page.ts +137 -0
  125. package/src/account/page-answers.ts +317 -0
  126. package/src/account/{page-events.js → page-events.ts} +55 -90
  127. package/src/account/server-client.ts +183 -0
  128. package/src/account/{subscriptions-view.js → subscriptions-view.ts} +25 -68
  129. package/src/account-api.ts +98 -0
  130. package/src/account-marks.ts +35 -0
  131. package/src/{account-pages.js → account-pages.ts} +29 -37
  132. package/src/account.ts +284 -0
  133. package/src/amounts.ts +64 -0
  134. package/src/{analytics-shopify.js → analytics-shopify.ts} +112 -107
  135. package/src/analytics.ts +315 -0
  136. package/src/{api-version.js → api-version.ts} +25 -31
  137. package/src/{astro.js → astro.ts} +110 -104
  138. package/src/cart/cart-shape.ts +25 -0
  139. package/src/cart/checkout.ts +101 -0
  140. package/src/cart/{drawer.js → drawer.ts} +18 -31
  141. package/src/cart/mutations.ts +237 -0
  142. package/src/cart/{render.js → render.ts} +68 -96
  143. package/src/cart/store.ts +279 -0
  144. package/src/{cart.js → cart.ts} +82 -128
  145. package/src/client.ts +391 -0
  146. package/src/{collection.js → collection.ts} +30 -38
  147. package/src/config-sections.ts +284 -0
  148. package/src/config.ts +480 -0
  149. package/src/controls/{cart-controls.js → cart-controls.ts} +22 -54
  150. package/src/controls/{discount.js → discount.ts} +13 -34
  151. package/src/controls/{extras.js → extras.ts} +15 -24
  152. package/src/controls/{navigation.js → navigation.ts} +24 -30
  153. package/src/{diagnose-markup.js → diagnose-markup.ts} +37 -72
  154. package/src/{diagnose.js → diagnose.ts} +95 -96
  155. package/src/dom.ts +268 -0
  156. package/src/{extras.js → extras.ts} +43 -52
  157. package/src/fragments.ts +261 -0
  158. package/src/globals.d.ts +15 -0
  159. package/src/{images.js → images.ts} +30 -43
  160. package/src/index.ts +415 -0
  161. package/src/initial.ts +101 -0
  162. package/src/lazy-iife.ts +197 -0
  163. package/src/lazy.ts +42 -0
  164. package/src/{loader.js → loader.ts} +149 -123
  165. package/src/market-codes.ts +6 -0
  166. package/src/{markets-ui.js → markets-ui.ts} +91 -68
  167. package/src/markets.ts +246 -0
  168. package/src/markup.ts +127 -0
  169. package/src/{mounting.js → mounting.ts} +88 -101
  170. package/src/{page-market.js → page-market.ts} +32 -38
  171. package/src/part-integrity.ts +7 -0
  172. package/src/parts/account-pages.ts +7 -0
  173. package/src/parts/account.ts +7 -0
  174. package/src/parts/analytics.ts +7 -0
  175. package/src/parts/diagnose.ts +7 -0
  176. package/src/parts/extras.ts +7 -0
  177. package/src/parts/markets.ts +7 -0
  178. package/src/parts/search.ts +7 -0
  179. package/src/presets/barba.ts +194 -0
  180. package/src/{product-events.js → product-events.ts} +33 -48
  181. package/src/{product-render.js → product-render.ts} +38 -77
  182. package/src/product-shape.ts +49 -0
  183. package/src/product-state.ts +318 -0
  184. package/src/{product.js → product.ts} +90 -126
  185. package/src/{repeaters.js → repeaters.ts} +40 -52
  186. package/src/{search.js → search.ts} +85 -103
  187. package/src/selling-plans.ts +145 -0
  188. package/src/server.ts +211 -0
  189. package/src/{shopify-values.js → shopify-values.ts} +24 -22
  190. package/src/{status.js → status.ts} +34 -54
  191. package/src/storage.ts +34 -0
  192. package/src/store-html.ts +359 -0
  193. package/src/storefront/catalog.ts +196 -0
  194. package/src/storefront/{json-ld.js → json-ld.ts} +45 -68
  195. package/src/{variant-render.js → variant-render.ts} +24 -50
  196. package/dist/esm/chunks/account-C3NP6HFB.js +0 -1
  197. package/dist/esm/chunks/account-pages-WLK374FO.js +0 -1
  198. package/dist/esm/chunks/analytics-G3SAWMNL.js +0 -1
  199. package/dist/esm/chunks/chunk-27PJJZGC.js +0 -1
  200. package/dist/esm/chunks/chunk-2FSXS55U.js +0 -1
  201. package/dist/esm/chunks/chunk-FCSWQDVV.js +0 -1
  202. package/dist/esm/chunks/chunk-FOMSMIAM.js +0 -1
  203. package/dist/esm/chunks/chunk-GZJTCLLW.js +0 -1
  204. package/dist/esm/chunks/chunk-HEQILZVR.js +0 -1
  205. package/dist/esm/chunks/chunk-JOOEXYF3.js +0 -4
  206. package/dist/esm/chunks/chunk-MPTQYLSM.js +0 -1
  207. package/dist/esm/chunks/chunk-NEHZ37TU.js +0 -3
  208. package/dist/esm/chunks/chunk-V74KGEJF.js +0 -1
  209. package/dist/esm/chunks/chunk-VT4CDUJJ.js +0 -1
  210. package/dist/esm/chunks/chunk-YJLWX2HK.js +0 -1
  211. package/dist/esm/chunks/diagnose-6VVGZNTY.js +0 -14
  212. package/dist/esm/chunks/extras-GJVRDFM3.js +0 -1
  213. package/dist/esm/chunks/markets-ui-UNB4PTA7.js +0 -1
  214. package/dist/esm/chunks/search-OU75RNQL.js +0 -1
  215. package/src/account/addresses-view.js +0 -92
  216. package/src/account/browser-session.js +0 -359
  217. package/src/account/markup.js +0 -48
  218. package/src/account/operations.js +0 -180
  219. package/src/account/order-list.js +0 -91
  220. package/src/account/order-page.js +0 -192
  221. package/src/account/server-client.js +0 -172
  222. package/src/account/shared.js +0 -111
  223. package/src/account/shopify-auth.js +0 -150
  224. package/src/account-api.js +0 -118
  225. package/src/account-links.js +0 -35
  226. package/src/account.js +0 -342
  227. package/src/amounts.js +0 -36
  228. package/src/analytics.js +0 -352
  229. package/src/cart/checkout.js +0 -97
  230. package/src/cart/mutations.js +0 -234
  231. package/src/cart/store.js +0 -326
  232. package/src/client.js +0 -267
  233. package/src/config.js +0 -349
  234. package/src/dom.js +0 -287
  235. package/src/fragments.js +0 -237
  236. package/src/index.js +0 -353
  237. package/src/initial.js +0 -87
  238. package/src/lazy-iife.js +0 -116
  239. package/src/lazy.js +0 -39
  240. package/src/market-codes.js +0 -35
  241. package/src/markets.js +0 -334
  242. package/src/markup.js +0 -64
  243. package/src/parts/account-pages.js +0 -6
  244. package/src/parts/account.js +0 -6
  245. package/src/parts/analytics.js +0 -6
  246. package/src/parts/diagnose.js +0 -6
  247. package/src/parts/extras.js +0 -6
  248. package/src/parts/markets.js +0 -6
  249. package/src/parts/search.js +0 -6
  250. package/src/presets/barba.js +0 -190
  251. package/src/product-state.js +0 -318
  252. package/src/selling-plans.js +0 -154
  253. package/src/server.js +0 -215
  254. package/src/store-html.js +0 -0
  255. package/src/storefront/catalog.js +0 -199
  256. package/types/astro.d.ts +0 -28
  257. package/types/barba.d.ts +0 -16
  258. package/types/index.d.ts +0 -577
  259. package/types/server.d.ts +0 -182
@@ -1,2 +1,2 @@
1
- import{b as x,d as q,e as F}from"./chunks/chunk-HEQILZVR.js";import{a as D,c as T,e as v,f as I,g as C,i as R,l as L}from"./chunks/chunk-JOOEXYF3.js";import{F as b,a as g,d as U,l as _,n as J,o as y,y as N}from"./chunks/chunk-YJLWX2HK.js";import{b as O,e as A,f as S,g as $}from"./chunks/chunk-FOMSMIAM.js";function B(e,t={}){if(!e)return null;let{variant:a,sellingPlan:c,defaultPurchase:l=g.defaultPurchase,lowStock:u=g.lowStock}=t,i=q(e,{variant:a,sellingPlan:c,defaultPurchase:l}),n=F(e,{...i,quantity:1},u);if(!n)return null;let{selected:f,isSubscription:p}=n,o=(r,s)=>!x(e,f,r,s);return{variant:n.variant,selected:f,purchase:n.purchase.kind,plan:p?n.plan:null,plans:v(e).map(r=>({id:r.id,name:r.name,price:C(n.variant,r.id),savings:R(n.variant,r.id).percentage,selected:p&&r.id===n.purchase.planId,available:!!I(n.variant,r.id)})),savings:n.savings.percentage,price:n.price,compareAtPrice:n.compareAtPrice,available:n.variant.availableForSale,show:n.show,unavailable:Object.fromEntries(e.options.map(r=>[r.name,r.optionValues.map(s=>s.name).filter(s=>o(r.name,s))])),isUnavailable:o}}var Q=500,z=100,W=100,X="query TetherServerProductById($id:ID!){node(id:$id){... on Product{...TetherProduct}}}",Z="query TetherServerProduct($handle:String!){product(handle:$handle){...TetherProduct}}",ee=()=>`query TetherServerCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${T()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}`,te="query TetherServerProducts($first:Int!,$after:String,$query:String,$sortKey:ProductSortKeys,$reverse:Boolean){products(first:$first,after:$after,query:$query,sortKey:$sortKey,reverse:$reverse){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}",re=()=>`query TetherServerCollections($first:Int!,$after:String){collections(first:$first,after:$after){nodes{${T()}}pageInfo{hasNextPage endCursor}}}`,ne=e=>`query TetherServerRecs(${e?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${e?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}`;function K(e,t){let a=(o,r)=>y(e,`${o}
2
- ${D(e)}`,r);async function c(o){let r=$(o);if(!r)return null;if(r.startsWith("gid://")){let d=await a(X,{id:r});return d.node?.id?d.node:null}return(await a(Z,{handle:r})).product}async function l(o,{first:r=t,after:s=null,sortKey:d,reverse:m=!1,filters:E}){let P=await a(ee(),{handle:o,first:r,after:s,sortKey:d||void 0,reverse:m,filters:E??void 0});if(!P.collection)return{collection:null,products:[],pageInfo:{hasNextPage:!1,endCursor:null}};let{products:h,...Y}=P.collection;return{collection:Y,products:h.nodes,pageInfo:h.pageInfo}}async function u(o={}){let{collection:r,query:s,first:d=t,after:m=null,sortKey:E,reverse:P=!1}=o;if(r)return l(r,o);let h=await a(te,{first:d,after:m,query:s||void 0,sortKey:E||void 0,reverse:P});return{collection:null,products:h.products.nodes,pageInfo:h.products.pageInfo}}async function i(o={}){let r=[],s=null;for(let d=0;d<Q;d++){let m=await u({...o,first:t,after:s});if(r.push(...m.products),!m.pageInfo.hasNextPage)break;s=m.pageInfo.endCursor}return r}async function n(o,r={}){let s=await u({...r,collection:o});return s.collection?{...s.collection,products:s.products,pageInfo:s.pageInfo}:null}async function f(){let o=[],r=null;for(let s=0;s<W;s++){let d=await y(e,re(),{first:z,after:r});if(o.push(...d.collections.nodes),!d.collections.pageInfo.hasNextPage)break;r=d.collections.pageInfo.endCursor}return o}async function p(o,r="RELATED"){let s=$(typeof o=="object"?o?.id:o),d=s?.startsWith("gid://")??!1;return(await a(ne(d),d?{id:s,intent:r}:{handle:s,intent:r})).productRecommendations??[]}return{getProduct:c,getProducts:u,allProducts:i,getCollection:n,allCollections:f,getRecommendations:p}}var M={size:"https://schema.org/size",color:"https://schema.org/color",colour:"https://schema.org/color",material:"https://schema.org/material"},k=e=>JSON.stringify(e).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");function j(e){return JSON.parse(JSON.stringify(e))}var G=e=>e.split("/").pop()??e;function oe(e){return e.availableForSale?e.currentlyNotInStock?"https://schema.org/BackOrder":"https://schema.org/InStock":"https://schema.org/OutOfStock"}function ae(e,t){if(!e.requiresSellingPlan)return t.price;let a=v(e).find(c=>I(t,c.id));return(a&&C(t,a.id))??t.price}function H(e,t,a){let c=ae(e,t),l=a?.includes("?")?"&":"?";return{"@type":"Offer",price:c.amount,priceCurrency:c.currencyCode,availability:oe(t),url:a?`${a}${l}variant=${G(t.id)}`:void 0}}function ie(e,t,a,c){let l=t.selectedOptions.flatMap(u=>{let i=M[u.name.toLowerCase()];return i?[[i.split("/").pop()??i,u.value]]:[]});return{"@type":"Product",name:`${e.title} - ${t.title}`,sku:t.sku||void 0,image:t.image?.url||c[0],...Object.fromEntries(l),offers:H(e,t,a)}}function se(e,{url:t},a){if(t)return t;if(a.siteUrl)return new URL(S(a.productPath,e.handle,e.id),a.siteUrl).toString()}function w(e,t,a){if(!e)return null;let c=se(e,t,a),l=e.images.nodes.map(o=>o.url).filter(Boolean),u=t.brand||e.vendor,i=u?{"@type":"Brand",name:u}:void 0,n=e.description.trim()||void 0,f=e.variants.nodes;if(f.length<=1){let[o]=f;return j({"@context":"https://schema.org","@type":"Product",name:e.title,description:n,url:c,image:l,sku:o?.sku||void 0,brand:i,offers:o?H(e,o,c):void 0})}let p=e.options.map(o=>M[o.name.toLowerCase()]).filter(Boolean);return j({"@context":"https://schema.org","@type":"ProductGroup",name:e.title,description:n,url:c,productGroupID:G(e.id),image:l,brand:i,variesBy:[...new Set(p)],hasVariant:f.map(o=>ie(e,o,c,l))})}var ce=25,le=2,ue=1;function de(e,{productPath:t=g.productPath,id:a}={}){return S(t,e,a)}function V(e,t){for(let a of t){let c=e[a];if(typeof c=="string"&&c)return c}return""}function fe(e){let t={};for(let[u,i]of Object.entries(e))u in g&&(t[u]=i);let a=typeof e.domain=="string"&&e.domain?e.domain:"",c=typeof e.token=="string"&&e.token?e.token:"",l=U({...t,domain:a||V(e,O.domain),token:c||V(e,O.token)});return e.fetch&&(l.fetch=e.fetch),e.pageSize!==void 0&&(l.pageSize=e.pageSize),e.siteUrl!==void 0&&(l.siteUrl=e.siteUrl),l}var pe=e=>typeof e=="number"&&Number.isInteger(e)&&e>0?e:ce;function me(e,t){return{...e,description:"",descriptionHtml:"",images:{nodes:e.images.nodes.slice(0,Math.max(1,t))},variants:{nodes:e.variants.nodes.map(a=>({...a,image:null}))}}}function be(e={}){let t=fe(e);if(!t.domain||!t.token)throw new _("createStorefront needs domain and token: pass them, or import.meta.env with PUBLIC_SHOPIFY_DOMAIN and PUBLIC_SHOPIFY_STOREFRONT_TOKEN",{code:"NOT_CONFIGURED"});let a=K(t,pe(t.pageSize)),c={productPath:t.productPath,siteUrl:t.siteUrl};function l(i,{card:n=!1,images:f=le}={}){let p=(Array.isArray(i)?i:[i]).filter(r=>r!=null),o={v:ue,at:new Date().toISOString(),country:t.country||null,language:t.language||null,products:n?p.map(r=>me(r,f)):p};return`<script type="application/json" data-tether-hydrate>${k(o)}<\/script>`}function u(i,n={}){return i?`<script type="application/ld+json">${k(w(i,n,c))}<\/script>`:""}return{config:t,query:(i,n,f)=>y(t,i,n,f),...a,hydrate:l,formatMoney:(i,n=t.locale)=>A(i,n),formatPercent:(i,n=t.locale)=>b(i,n),imageUrl:N,jsonLd:u,jsonLdData:(i,n={})=>w(i,n,c),initialState:(i,n={})=>B(i,{defaultPurchase:t.defaultPurchase,lowStock:t.lowStock,...n}),productUrl:(i,n={})=>de(i,{productPath:t.productPath,...n}),plans:L}}export{_ as TetherError,be as createStorefront,A as formatMoney,b as formatPercent,N as imageUrl,B as initialState,L as plans,$ as productKey,de as productUrl,J as withContext};
1
+ import{b as j,f as G,g as H}from"./chunks/chunk-T44MUL4Y.js";import{A as B,B as J,C as K,a as _,c as T,h as v,i as b,j as $,l as M,o as q,q as F,s as V}from"./chunks/chunk-BFTZR4OB.js";import{B as D,a as S,c as k,d as C,f as nt,g as P,i as L,u as U}from"./chunks/chunk-BA4LQJJQ.js";import{B as E,E as N,F as I,G as O,q as g,t as A}from"./chunks/chunk-E5YO6274.js";function Q(t,e={}){if(!t)return null;let{variant:r,sellingPlan:a,defaultPurchase:c=g.defaultPurchase,lowStock:u=g.lowStock}=e,d=G(t,{variant:r,sellingPlan:a,defaultPurchase:c}),n=H(t,{...d,quantity:1},u);if(!n)throw new S(`Product ${t.handle} has no variants`);let{selected:l,line:p}=n,i=(o,s)=>!j(t,l,o,s);return{variant:n.variant,selected:l,purchase:n.purchase.kind,plan:p.kind==="subscription"?n.plan:null,plans:v(t).map(o=>({id:o.id,name:o.name,price:$(n.variant,o.id),savings:M(n.variant,o.id).percentage,selected:p.kind==="subscription"&&o.id===p.planId,available:!!b(n.variant,o.id)})),savings:n.savings.percentage,price:n.price,compareAtPrice:n.compareAtPrice,available:n.variant.availableForSale,show:n.show,unavailable:Object.fromEntries(t.options.map(o=>[o.name,o.optionValues.map(s=>s.name).filter(s=>i(o.name,s))])),isUnavailable:i}}var rt=500,ot=100,it=100,at="query TetherServerProductById($id:ID!){node(id:$id){... on Product{...TetherProduct}}}",st="query TetherServerProduct($handle:String!){product(handle:$handle){...TetherProduct}}",lt=()=>`query TetherServerCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${T()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}`,ct="query TetherServerProducts($first:Int!,$after:String,$query:String,$sortKey:ProductSortKeys,$reverse:Boolean){products(first:$first,after:$after,query:$query,sortKey:$sortKey,reverse:$reverse){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}",ut=()=>`query TetherServerCollections($first:Int!,$after:String){collections(first:$first,after:$after){nodes{${T()}}pageInfo{hasNextPage endCursor}}}`,dt=t=>`query TetherServerRecs(${t?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${t?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}`,ft=C({product:k(F)}),pt=C({node:k(V)}),mt=C({collections:{nodes:[{handle:"string"}],pageInfo:{hasNextPage:"boolean"}}});async function gt(t){let e=[],r=null;for(let a=0;a<it;a++){let c=await P(t,ut(),{first:ot,after:r},mt);if(e.push(...c.collections.nodes),!c.collections.pageInfo.hasNextPage)break;r=c.collections.pageInfo.endCursor}return e}function Y(t,e){let r=(i,o,s)=>P(t,f=>`${i}
2
+ ${_(t,f)}`,o,s);async function a(i){let o=O(i);if(!o)return null;if(o.startsWith("gid://")){let{node:f}=await r(at,{id:o},pt);return f?.id?f:null}return(await r(st,{handle:o},ft)).product}async function c(i,{first:o=e,after:s=null,sortKey:f,reverse:m=!1,filters:w}){let h=await r(lt(),{handle:i,first:o,after:s,sortKey:f||void 0,reverse:m,filters:w??void 0},B);if(!h.collection)return{collection:null,products:[],pageInfo:{hasNextPage:!1,endCursor:null}};let{products:y,...et}=h.collection;return{collection:et,products:y.nodes,pageInfo:y.pageInfo}}async function u(i={}){let{collection:o,query:s,first:f=e,after:m=null,sortKey:w,reverse:h=!1}=i;if(o)return c(o,i);let y=await r(ct,{first:f,after:m,query:s||void 0,sortKey:w||void 0,reverse:h},J);return{collection:null,products:y.products.nodes,pageInfo:y.products.pageInfo}}async function d(i={}){let o=[],s=null;for(let f=0;f<rt;f++){let m=await u({...i,first:e,after:s});if(o.push(...m.products),!m.pageInfo.hasNextPage)break;s=m.pageInfo.endCursor}return o}async function n(i,o={}){let s=await u({...o,collection:i});return s.collection?{...s.collection,products:s.products,pageInfo:s.pageInfo}:null}async function l(i,o="RELATED"){let s=O(typeof i=="object"?i?.id:i),f=s?.startsWith("gid://")??!1;return(await r(dt(f),f?{id:s,intent:o}:{handle:s,intent:o},K)).productRecommendations??[]}return{getProduct:a,getProducts:u,allProducts:d,getCollection:n,allCollections:()=>gt(t),getRecommendations:l}}var W={size:"https://schema.org/size",color:"https://schema.org/color",colour:"https://schema.org/color",material:"https://schema.org/material"},R=t=>JSON.stringify(t).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");function z(t){return JSON.parse(JSON.stringify(t))}var X=t=>t.split("/").pop()??t;function yt(t){return t.availableForSale?t.currentlyNotInStock?"https://schema.org/BackOrder":"https://schema.org/InStock":"https://schema.org/OutOfStock"}function Pt(t,e){if(!t.requiresSellingPlan)return e.price;let r=v(t).find(a=>b(e,a.id));return(r&&$(e,r.id))??e.price}function Z(t,e,r){let a=Pt(t,e),c=r?.includes("?")?"&":"?";return{"@type":"Offer",price:a.amount,priceCurrency:a.currencyCode,availability:yt(e),url:r?`${r}${c}variant=${X(e.id)}`:void 0}}function ht(t,e,r,a){let c=e.selectedOptions.flatMap(u=>{let d=W[u.name.toLowerCase()];return d?[[d.split("/").pop()??d,u.value]]:[]});return{"@type":"Product",name:`${t.title} - ${e.title}`,sku:e.sku||void 0,image:e.image?.url||a[0],...Object.fromEntries(c),offers:Z(t,e,r)}}function St(t,{url:e},r){if(e)return e;let a=I(r.productPath,t.handle,t.id);if(!(!r.siteUrl||!a))return new URL(a,r.siteUrl).toString()}function x(t,e,r){if(!t)return null;let a=St(t,e,r),c=t.images.nodes.map(i=>i.url).filter(Boolean),u=e.brand||t.vendor,d=u?{"@type":"Brand",name:u}:void 0,n=t.description.trim()||void 0,l=t.variants.nodes;if(l.length<=1){let[i]=l;return z({"@context":"https://schema.org","@type":"Product",name:t.title,description:n,url:a,image:c,sku:i?.sku||void 0,brand:d,offers:i?Z(t,i,a):void 0})}let p=t.options.map(i=>W[i.name.toLowerCase()]).filter(Boolean);return z({"@context":"https://schema.org","@type":"ProductGroup",name:t.title,description:n,url:a,productGroupID:X(t.id),image:c,brand:d,variesBy:[...new Set(p)],hasVariant:l.map(i=>ht(t,i,a,c))})}var Ct=25,It=2,Ot=1;function vt(t,{productPath:e=g.productPath,id:r}={}){return I(e,t,r)}function tt(t,e){for(let r of e){let a=t[r];if(typeof a=="string"&&a)return a}return""}function bt(t){let e={};for(let[u,d]of Object.entries(t))u in g&&(e[u]=d);let r=typeof t.domain=="string"&&t.domain?t.domain:"",a=typeof t.token=="string"&&t.token?t.token:"",c=A({...e,domain:r||tt(t,E.domain),token:a||tt(t,E.token)});return t.fetch&&(c.fetch=t.fetch),t.pageSize!==void 0&&(c.pageSize=t.pageSize),t.siteUrl!==void 0&&(c.siteUrl=t.siteUrl),c}var $t=t=>typeof t=="number"&&Number.isInteger(t)&&t>0?t:Ct;function wt(t,e){return{...t,description:"",descriptionHtml:"",images:{nodes:t.images.nodes.slice(0,Math.max(1,e))},variants:{nodes:t.variants.nodes.map(r=>({...r,image:null}))}}}function Qt(t={}){let e=bt(t);if(!e.domain||!e.token)throw new S("createStorefront needs domain and token: pass them, or import.meta.env with PUBLIC_SHOPIFY_DOMAIN and PUBLIC_SHOPIFY_STOREFRONT_TOKEN",{code:"NOT_CONFIGURED"});let r=Y(e,$t(e.pageSize)),a={productPath:e.productPath,siteUrl:e.siteUrl};function c(n,{card:l=!1,images:p=It}={}){let i=(Array.isArray(n)?n:[n]).filter(s=>s!=null),o={v:Ot,at:new Date().toISOString(),country:e.country||null,language:e.language||null,products:l?i.map(s=>wt(s,p)):i};return`<script type="application/json" data-tether-hydrate>${R(o)}<\/script>`}function u(n,l={}){return n?`<script type="application/ld+json">${R(x(n,l,a))}<\/script>`:""}function d(n,l={}){return Q(n,{defaultPurchase:e.defaultPurchase,lowStock:e.lowStock,...l})}return{config:e,query:(n,l,p)=>P(e,n,l??{},L,p),...r,hydrate:c,formatMoney:(n,l=e.locale)=>N(n,l),formatPercent:(n,l=e.locale)=>D(n,l),imageUrl:U,jsonLd:u,jsonLdData:(n,l={})=>x(n,l,a),initialState:d,productUrl:(n,l={})=>vt(n,{productPath:e.productPath,...l}),plans:q}}export{S as TetherError,Qt as createStorefront,N as formatMoney,D as formatPercent,U as imageUrl,Q as initialState,q as plans,O as productKey,vt as productUrl,nt as withContext};
@@ -1,4 +1,4 @@
1
- // src/presets/barba.js
1
+ // src/presets/barba.ts
2
2
  var LINE_DURATION_SECONDS = 0.3;
3
3
  var collapsed = () => ({
4
4
  height: 0,
@@ -10,31 +10,27 @@ var collapsed = () => ({
10
10
  });
11
11
  var ANIMATED_PROPS = "height,paddingTop,paddingBottom,borderBottomWidth,opacity,overflow";
12
12
  var reducedMotion = () => typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
13
- function current(option) {
14
- if (typeof option !== "function") return option;
15
- const getter = (
16
- /** @type {() => unknown} */
17
- option
18
- );
19
- return getter();
13
+ var GETTER_OPTIONS = ["gsap", "lenis", "scrollTrigger"];
14
+ function checkGetters(options) {
15
+ for (const name of GETTER_OPTIONS) {
16
+ const option = options[name];
17
+ if (option !== void 0 && option !== null && typeof option !== "function") {
18
+ throw new TypeError(`barbaPreset: ${name} must be a function that returns it, such as () => ${name}`);
19
+ }
20
+ }
20
21
  }
21
22
  function callIfPresent(target, method) {
22
- if (typeof target !== "object" || target === null) return;
23
+ if (typeof target !== "object" && typeof target !== "function" || target === null) return;
23
24
  const fn = Reflect.get(target, method);
24
25
  if (typeof fn === "function") fn.call(target);
25
26
  }
26
27
  var isGsap = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "fromTo") === "function" && typeof Reflect.get(value, "to") === "function";
27
28
  function barbaPreset(options = {}) {
29
+ checkGetters(options);
28
30
  const {
29
- gsap = () => (
30
- /** @type {unknown} */
31
- Reflect.get(window, "gsap")
32
- ),
31
+ gsap = () => Reflect.get(window, "gsap"),
33
32
  lenis = null,
34
- scrollTrigger = () => (
35
- /** @type {unknown} */
36
- Reflect.get(window, "ScrollTrigger")
37
- ),
33
+ scrollTrigger = () => Reflect.get(window, "ScrollTrigger"),
38
34
  lockScroll = null,
39
35
  unlockScroll = null,
40
36
  onResize = null,
@@ -45,23 +41,23 @@ function barbaPreset(options = {}) {
45
41
  let locked = false;
46
42
  const animator = (node) => {
47
43
  if (!animateLines || reducedMotion() || node.offsetHeight <= 0) return null;
48
- const animation = current(gsap);
44
+ const animation = gsap();
49
45
  return isGsap(animation) ? animation : null;
50
46
  };
51
47
  return {
52
48
  autoMount: false,
53
49
  onLayoutChange() {
54
- callIfPresent(current(lenis), "resize");
55
- callIfPresent(current(scrollTrigger), "refresh");
50
+ callIfPresent(lenis?.(), "resize");
51
+ callIfPresent(scrollTrigger(), "refresh");
56
52
  },
57
53
  onCartOpen(drawers) {
58
54
  const drawer = drawers[0];
59
- if (locked || typeof lockScroll !== "function" || !drawer) return;
55
+ if (locked || !lockScroll || !drawer) return;
60
56
  lockScroll(drawer);
61
57
  locked = true;
62
58
  },
63
59
  onCartClose() {
64
- if (locked && typeof unlockScroll === "function") unlockScroll();
60
+ if (locked && unlockScroll) unlockScroll();
65
61
  locked = false;
66
62
  },
67
63
  onLineEnter(node) {
@@ -94,7 +90,7 @@ function barbaPreset(options = {}) {
94
90
  }
95
91
  });
96
92
  },
97
- onValueChange: typeof onValueChange === "function" ? onValueChange : null
93
+ onValueChange
98
94
  };
99
95
  }
100
96
  var barba_default = barbaPreset;