@brytdesigns/shopify-product-info-components 1.0.0 → 1.0.3

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.
@@ -1,3 +1,4 @@
1
+ import { createMemo, createEffect, observable } from 'solid-js';
1
2
  import { provideProductContext } from '../hooks/index.js';
2
3
 
3
4
  const ProductInfo = (props, { element }) => {
@@ -18,6 +19,26 @@ const ProductInfo = (props, { element }) => {
18
19
  },
19
20
  element
20
21
  );
22
+ const url = createMemo(() => {
23
+ const url2 = new URL(window.location.href);
24
+ if (props.product && props.product.selected_or_first_available_variant) {
25
+ url2.searchParams.set(
26
+ "variant",
27
+ props.product.selected_or_first_available_variant.id.toString()
28
+ );
29
+ }
30
+ return url2;
31
+ });
32
+ function subscribe(cb) {
33
+ return observable(() => props.product).subscribe(cb).unsubscribe;
34
+ }
35
+ Object.assign(element, {
36
+ subscribe
37
+ });
38
+ createEffect(() => {
39
+ if (!props.isProductPage) return;
40
+ window.history.replaceState(null, "", url());
41
+ });
21
42
  };
22
43
 
23
44
  export { ProductInfo };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/product-info.ts"],"names":[],"mappings":";;AASO,MAAM,WAAsD,GAAA,CACjE,KACA,EAAA,EAAE,SACC,KAAA;AACH,EAAA,IAAI,CAAC,KAAM,CAAA,OAAA;AACT,IAAO,OAAA,OAAA,CAAQ,KAAK,6CAA6C,CAAA;AACnE,EAAI,IAAA,CAAC,MAAM,OAAQ,CAAA,QAAA;AACjB,IAAO,OAAA,OAAA,CAAQ,KAAK,sDAAsD,CAAA;AAC5E,EAAI,IAAA,CAAC,MAAM,OAAQ,CAAA,mCAAA;AACjB,IAAA,OAAO,OAAQ,CAAA,IAAA;AAAA,MACb;AAAA,KACF;AACF,EAAA,qBAAA;AAAA,IACE;AAAA,MACE,IAAI,OAAU,GAAA;AACZ,QAAA,OAAO,KAAM,CAAA,OAAA;AAAA,OACf;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,GACF;AACF","file":"product-info.js","sourcesContent":["import type { CorrectComponentType } from \"@brytdesigns/web-component-utils\";\nimport { provideProductContext } from \"../hooks/index.js\";\n\nimport type { Product } from \"../types.js\";\n\ntype ProductInfoProps = {\n product?: Product;\n};\n\nexport const ProductInfo: CorrectComponentType<ProductInfoProps> = (\n props,\n { element },\n) => {\n if (!props.product)\n return console.warn(\"product-info: product attribute is required\");\n if (!props.product.variants)\n return console.warn(\"product-info: product attribute needs variants array\");\n if (!props.product.selected_or_first_available_variant)\n return console.warn(\n \"product-info: product attribute needs selected or first available variant object\",\n );\n provideProductContext(\n {\n get product() {\n return props.product!;\n },\n element,\n },\n element,\n );\n};\n"]}
1
+ {"version":3,"sources":["../../../src/components/product-info.ts"],"names":["url"],"mappings":";;;AAaO,MAAM,WAAsD,GAAA,CACjE,KACA,EAAA,EAAE,SACC,KAAA;AACH,EAAA,IAAI,CAAC,KAAM,CAAA,OAAA;AACT,IAAO,OAAA,OAAA,CAAQ,KAAK,6CAA6C,CAAA;AACnE,EAAI,IAAA,CAAC,MAAM,OAAQ,CAAA,QAAA;AACjB,IAAO,OAAA,OAAA,CAAQ,KAAK,sDAAsD,CAAA;AAC5E,EAAI,IAAA,CAAC,MAAM,OAAQ,CAAA,mCAAA;AACjB,IAAA,OAAO,OAAQ,CAAA,IAAA;AAAA,MACb;AAAA,KACF;AACF,EAAA,qBAAA;AAAA,IACE;AAAA,MACE,IAAI,OAAU,GAAA;AACZ,QAAA,OAAO,KAAM,CAAA,OAAA;AAAA,OACf;AAAA,MACA;AAAA,KACF;AAAA,IACA;AAAA,GACF;AAEA,EAAM,MAAA,GAAA,GAAM,WAAW,MAAM;AAC3B,IAAA,MAAMA,IAAM,GAAA,IAAI,GAAI,CAAA,MAAA,CAAO,SAAS,IAAI,CAAA;AACxC,IAAA,IAAI,KAAM,CAAA,OAAA,IAAW,KAAM,CAAA,OAAA,CAAQ,mCAAqC,EAAA;AACtE,MAAAA,KAAI,YAAa,CAAA,GAAA;AAAA,QACf,SAAA;AAAA,QACA,KAAM,CAAA,OAAA,CAAQ,mCAAoC,CAAA,EAAA,CAAG,QAAS;AAAA,OAChE;AAAA;AAEF,IAAOA,OAAAA,IAAAA;AAAA,GACR,CAAA;AAED,EAAA,SAAS,UAAU,EAA4C,EAAA;AAC7D,IAAA,OAAO,WAAW,MAAM,KAAA,CAAM,OAAO,CAAE,CAAA,SAAA,CAAU,EAAE,CAAE,CAAA,WAAA;AAAA;AAGvD,EAAA,MAAA,CAAO,OAAO,OAAS,EAAA;AAAA,IACrB;AAAA,GACD,CAAA;AAED,EAAA,YAAA,CAAa,MAAM;AACjB,IAAI,IAAA,CAAC,MAAM,aAAe,EAAA;AAC1B,IAAA,MAAA,CAAO,OAAQ,CAAA,YAAA,CAAa,IAAM,EAAA,EAAA,EAAI,KAAK,CAAA;AAAA,GAC5C,CAAA;AACH","file":"product-info.js","sourcesContent":["import type { CorrectComponentType } from \"@brytdesigns/web-component-utils\";\n\nimport { createEffect, createMemo, observable } from \"solid-js\";\n\nimport { provideProductContext } from \"../hooks/index.js\";\n\nimport type { Product } from \"../types.js\";\n\ntype ProductInfoProps = {\n product?: Product;\n isProductPage?: boolean;\n};\n\nexport const ProductInfo: CorrectComponentType<ProductInfoProps> = (\n props,\n { element },\n) => {\n if (!props.product)\n return console.warn(\"product-info: product attribute is required\");\n if (!props.product.variants)\n return console.warn(\"product-info: product attribute needs variants array\");\n if (!props.product.selected_or_first_available_variant)\n return console.warn(\n \"product-info: product attribute needs selected or first available variant object\",\n );\n provideProductContext(\n {\n get product() {\n return props.product!;\n },\n element,\n },\n element,\n );\n\n const url = createMemo(() => {\n const url = new URL(window.location.href);\n if (props.product && props.product.selected_or_first_available_variant) {\n url.searchParams.set(\n \"variant\",\n props.product.selected_or_first_available_variant.id.toString(),\n );\n }\n return url;\n });\n\n function subscribe(cb: (product: Product | undefined) => void) {\n return observable(() => props.product).subscribe(cb).unsubscribe;\n }\n\n Object.assign(element, {\n subscribe,\n });\n\n createEffect(() => {\n if (!props.isProductPage) return;\n window.history.replaceState(null, \"\", url());\n });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/useProduct.ts"],"names":[],"mappings":";;;;AAoBA,SAAS,yBAAyB,KAA6B,EAAA;AAC7D,EAAM,MAAA,CAAC,cAAc,WAAW,CAAA,GAAI,WAAW,KAAO,EAAA,CAAC,SAAS,CAAC,CAAA;AACjE,EAAA,MAAM,KAAQ,GAAA,UAAA,CAAW,WAAa,EAAA,EAAE,CAAA;AAExC,EAAA,SAAS,sBAAsB,SAA4B,EAAA;AACzD,IAAA,IACE,OAAO,KAAA,EAAO,OAAS,EAAA,mCAAA,KACvB,WACA,IAAA,OAAO,KAAO,EAAA,OAAA,KAAY,WAC1B,IAAA,OAAO,KAAO,EAAA,OAAA,EAAS,QAAa,KAAA,WAAA;AAEpC,MAAA;AACF,IAAM,MAAA,UAAA,GAAa,KAAM,CAAA,OAAA,CAAQ,QAAS,CAAA,IAAA;AAAA,MACxC,CAAC,OAAY,KAAA,OAAA,CAAQ,GAAG,QAAS,EAAA,KAAM,UAAU,QAAS;AAAA,KAC5D;AAEA,IAAA,MAAM,QAAW,GAAA;AAAA,MACf,GAAG,KAAM,CAAA,OAAA;AAAA,MACT,mCAAqC,EAAA;AAAA,KACvC;AAEA,IAAA,YAAA,CAAa,QAAQ,YAAa,CAAA,SAAA,EAAW,IAAK,CAAA,SAAA,CAAU,QAAQ,CAAC,CAAA;AAErE,IAAA,YAAA,CAAa,OAAQ,CAAA,aAAA;AAAA,MACnB,IAAI,YAAY,iBAAmB,EAAA;AAAA,QACjC,MAAQ,EAAA;AAAA,UACN,OAAS,EAAA,UAAA;AAAA,UACT,OAAS,EAAA;AAAA,SACX;AAAA,QACA,OAAS,EAAA;AAAA,OACV;AAAA,KACH;AAAA;AAGF,EAAO,OAAA;AAAA,IACL,KAAA;AAAA,IACA;AAAA,MACE,OAAS,EAAA;AAAA,QACP,MAAQ,EAAA;AAAA;AACV;AACF,GACF;AACF;AAEA,MAAM,mBAAA,GAAsB,cAAc,wBAAwB,CAAA;AAErD,MAAA,qBAAA,GAAwB,CACnC,YAAA,EACA,OACmB,KAAA;AACnB,EAAA,MAAM,QAAQ,UAAW,CAAA,YAAA,EAAc,EAAE,IAAA,EAAM,SAAS,CAAA;AACxD,EAAO,OAAA,OAAA,CAAQ,mBAAqB,EAAA,KAAA,EAAO,OAAO,CAAA;AACpD;AAEa,MAAA,iBAAA,GAAoB,CAAC,OAA4B,KAAA;AAC5D,EAAO,OAAA,OAAA;AACT;AAEa,MAAA,UAAA,GAAa,CAAC,OAA0C,KAAA;AACnE,EAAM,MAAA,OAAA,GAA0B,OAAQ,CAAA,mBAAA,EAAqB,OAAO,CAAA;AAEpE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAA,MAAM,OAAQ,CAAA,KAAA;AAAA,MACZ;AAAA,KACF;AAAA;AAGF,EAAA,OAAO,kBAAkB,OAAO,CAAA;AAClC;AAEa,MAAA,iBAAA,GAAoB,CAAC,OAAqB,KAAA;AACrD,EAAA,MAAM,OAAU,GAAA,sBAAA;AAAA,IACd,mBAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,OAAO,kBAAkB,OAAO,CAAA;AAClC","file":"useProduct.js","sourcesContent":["import {\n type ICustomElement,\n createContext,\n provide,\n consume,\n} from \"component-register\";\nimport { mergeProps, splitProps } from \"solid-js\";\nimport { getContextFromProvider } from \"@brytdesigns/web-component-utils\";\n\nimport type { Product } from \"../types\";\n\ntype CreateContextOptions = {\n element: HTMLElement & ICustomElement;\n product: Product;\n};\n\ntype WalkableNode = Parameters<typeof provide>[2];\n\ntype ProductContext = ReturnType<typeof initializeProductContext>;\n\nfunction initializeProductContext(props: CreateContextOptions) {\n const [privateProps, publicProps] = splitProps(props, [\"element\"]);\n const state = mergeProps(publicProps, {});\n\n function updateSelectedVariant(variantId: string | number) {\n if (\n typeof state?.product?.selected_or_first_available_variant ===\n \"undefined\" ||\n typeof state?.product === \"undefined\" ||\n typeof state?.product?.variants === \"undefined\"\n )\n return;\n const newVariant = state.product.variants.find(\n (variant) => variant.id.toString() === variantId.toString(),\n );\n\n const newState = {\n ...props.product,\n selected_or_first_available_variant: newVariant,\n };\n\n privateProps.element.setAttribute(\"product\", JSON.stringify(newState));\n\n privateProps.element.dispatchEvent(\n new CustomEvent(\"variant-updated\", {\n detail: {\n variant: newVariant,\n product: newState,\n },\n bubbles: true,\n }),\n );\n }\n\n return [\n state,\n {\n variant: {\n update: updateSelectedVariant,\n },\n },\n ] as const;\n}\n\nconst ProductContextState = createContext(initializeProductContext);\n\nexport const provideProductContext = (\n initialState: Omit<CreateContextOptions, \"root\">,\n element: WalkableNode,\n): ProductContext => {\n const props = mergeProps(initialState, { root: element });\n return provide(ProductContextState, props, element);\n};\n\nexport const useProductContext = (context: ProductContext) => {\n return context;\n};\n\nexport const useProduct = (element: HTMLElement & ICustomElement) => {\n const context: ProductContext = consume(ProductContextState, element);\n\n if (!context) {\n throw console.error(\n \"DrawerContext not found! Please ensure to wrap your custom element with drawer-context element.\",\n );\n }\n\n return useProductContext(context);\n};\n\nexport const getProductContext = (element: Element) => {\n const context = getContextFromProvider<ProductContext>(\n ProductContextState,\n element,\n );\n return useProductContext(context);\n};\n"]}
1
+ {"version":3,"sources":["../../../src/hooks/useProduct.ts"],"names":[],"mappings":";;;;AAoBA,SAAS,yBAAyB,KAA6B,EAAA;AAC7D,EAAM,MAAA,CAAC,cAAc,WAAW,CAAA,GAAI,WAAW,KAAO,EAAA,CAAC,SAAS,CAAC,CAAA;AACjE,EAAA,MAAM,KAAQ,GAAA,UAAA,CAAW,WAAa,EAAA,EAAE,CAAA;AAExC,EAAA,SAAS,sBAAsB,SAA4B,EAAA;AACzD,IAAA,IACE,OAAO,KAAA,EAAO,OAAS,EAAA,mCAAA,KACrB,WACF,IAAA,OAAO,KAAO,EAAA,OAAA,KAAY,WAC1B,IAAA,OAAO,KAAO,EAAA,OAAA,EAAS,QAAa,KAAA,WAAA;AAEpC,MAAA;AACF,IAAM,MAAA,UAAA,GAAa,KAAM,CAAA,OAAA,CAAQ,QAAS,CAAA,IAAA;AAAA,MACxC,CAAC,OAAY,KAAA,OAAA,CAAQ,GAAG,QAAS,EAAA,KAAM,UAAU,QAAS;AAAA,KAC5D;AAEA,IAAA,MAAM,QAAW,GAAA;AAAA,MACf,GAAG,KAAM,CAAA,OAAA;AAAA,MACT,mCAAqC,EAAA;AAAA,KACvC;AAEA,IAAA,YAAA,CAAa,QAAQ,YAAa,CAAA,SAAA,EAAW,IAAK,CAAA,SAAA,CAAU,QAAQ,CAAC,CAAA;AAErE,IAAA,YAAA,CAAa,OAAQ,CAAA,aAAA;AAAA,MACnB,IAAI,YAAY,iBAAmB,EAAA;AAAA,QACjC,MAAQ,EAAA;AAAA,UACN,OAAS,EAAA,UAAA;AAAA,UACT,OAAS,EAAA;AAAA,SACX;AAAA,QACA,OAAS,EAAA;AAAA,OACV;AAAA,KACH;AAAA;AAGF,EAAO,OAAA;AAAA,IACL,KAAA;AAAA,IACA;AAAA,MACE,OAAS,EAAA;AAAA,QACP,MAAQ,EAAA;AAAA;AACV;AACF,GACF;AACF;AAEA,MAAM,mBAAA,GAAsB,cAAc,wBAAwB,CAAA;AAErD,MAAA,qBAAA,GAAwB,CACnC,YAAA,EACA,OACmB,KAAA;AACnB,EAAA,MAAM,QAAQ,UAAW,CAAA,YAAA,EAAc,EAAE,IAAA,EAAM,SAAS,CAAA;AACxD,EAAO,OAAA,OAAA,CAAQ,mBAAqB,EAAA,KAAA,EAAO,OAAO,CAAA;AACpD;AAEa,MAAA,iBAAA,GAAoB,CAAC,OAA4B,KAAA;AAC5D,EAAO,OAAA,OAAA;AACT;AAEa,MAAA,UAAA,GAAa,CAAC,OAA0C,KAAA;AACnE,EAAM,MAAA,OAAA,GAA0B,OAAQ,CAAA,mBAAA,EAAqB,OAAO,CAAA;AAEpE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAA,MAAM,OAAQ,CAAA,KAAA;AAAA,MACZ;AAAA,KACF;AAAA;AAGF,EAAA,OAAO,kBAAkB,OAAO,CAAA;AAClC;AAEa,MAAA,iBAAA,GAAoB,CAAC,OAAqB,KAAA;AACrD,EAAA,MAAM,OAAU,GAAA,sBAAA;AAAA,IACd,mBAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,OAAO,kBAAkB,OAAO,CAAA;AAClC","file":"useProduct.js","sourcesContent":["import {\n type ICustomElement,\n createContext,\n provide,\n consume,\n} from \"component-register\";\nimport { mergeProps, splitProps } from \"solid-js\";\nimport { getContextFromProvider } from \"@brytdesigns/web-component-utils\";\n\nimport type { Product } from \"../types\";\n\ntype CreateContextOptions = {\n element: HTMLElement & ICustomElement;\n product: Product;\n};\n\ntype WalkableNode = Parameters<typeof provide>[2];\n\ntype ProductContext = ReturnType<typeof initializeProductContext>;\n\nfunction initializeProductContext(props: CreateContextOptions) {\n const [privateProps, publicProps] = splitProps(props, [\"element\"]);\n const state = mergeProps(publicProps, {});\n\n function updateSelectedVariant(variantId: string | number) {\n if (\n typeof state?.product?.selected_or_first_available_variant ===\n \"undefined\" ||\n typeof state?.product === \"undefined\" ||\n typeof state?.product?.variants === \"undefined\"\n )\n return;\n const newVariant = state.product.variants.find(\n (variant) => variant.id.toString() === variantId.toString(),\n );\n\n const newState = {\n ...props.product,\n selected_or_first_available_variant: newVariant,\n };\n\n privateProps.element.setAttribute(\"product\", JSON.stringify(newState));\n\n privateProps.element.dispatchEvent(\n new CustomEvent(\"variant-updated\", {\n detail: {\n variant: newVariant,\n product: newState,\n },\n bubbles: true,\n }),\n );\n }\n\n return [\n state,\n {\n variant: {\n update: updateSelectedVariant,\n },\n },\n ] as const;\n}\n\nconst ProductContextState = createContext(initializeProductContext);\n\nexport const provideProductContext = (\n initialState: Omit<CreateContextOptions, \"root\">,\n element: WalkableNode,\n): ProductContext => {\n const props = mergeProps(initialState, { root: element });\n return provide(ProductContextState, props, element);\n};\n\nexport const useProductContext = (context: ProductContext) => {\n return context;\n};\n\nexport const useProduct = (element: HTMLElement & ICustomElement) => {\n const context: ProductContext = consume(ProductContextState, element);\n\n if (!context) {\n throw console.error(\n \"DrawerContext not found! Please ensure to wrap your custom element with drawer-context element.\",\n );\n }\n\n return useProductContext(context);\n};\n\nexport const getProductContext = (element: Element) => {\n const context = getContextFromProvider<ProductContext>(\n ProductContextState,\n element,\n );\n return useProductContext(context);\n};\n"]}
@@ -5,7 +5,8 @@ export { getProductContext, getProductOptionsContext, useProduct, useProductOpti
5
5
  customShadowlessElement(
6
6
  "product-info",
7
7
  {
8
- product: void 0
8
+ product: void 0,
9
+ isProductPage: false
9
10
  },
10
11
  correctElementType(ProductInfo)
11
12
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAaA,uBAAA;AAAA,EACE,cAAA;AAAA,EACA;AAAA,IACE,OAAS,EAAA;AAAA,GACX;AAAA,EACA,mBAAmB,WAAW;AAChC,CAAA;AAEA,uBAAA;AAAA,EACE,iBAAA;AAAA,EACA;AAAA,IACE,iBAAiB;AAAC,GACpB;AAAA,EACA,mBAAmB,cAAc;AACnC,CAAA;AAEA,uBAAA;AAAA,EACE,sBAAA;AAAA,EACA;AAAA,IACE,QAAU,EAAA,CAAA;AAAA,IACV,IAAM,EAAA,EAAA;AAAA,IACN,SAAW,EAAA;AAAA,GACb;AAAA,EACA,mBAAmB,kBAAkB;AACvC,CAAA;AAEA,uBAAA;AAAA,EACE,uBAAA;AAAA,EACA;AAAA,IACE,MAAQ,EAAA,EAAA;AAAA,IACR,cAAgB,EAAA;AAAA,GAClB;AAAA,EACA,mBAAmB,mBAAmB;AACxC,CAAA;AAEA,uBAAA;AAAA,EACE,wBAAA;AAAA,EACA,EAAC;AAAA,EACD,mBAAmB,oBAAoB;AACzC,CAAA","file":"index.js","sourcesContent":["import {\n customShadowlessElement,\n correctElementType,\n} from \"@brytdesigns/web-component-utils\";\n\nimport {\n ProductInfo,\n ProductOptions,\n ProductOptionGroup,\n ProductVariantInput,\n ProductVariantRender,\n} from \"./components/index.js\";\n\ncustomShadowlessElement(\n \"product-info\",\n {\n product: undefined,\n },\n correctElementType(ProductInfo),\n);\n\ncustomShadowlessElement(\n \"product-options\",\n {\n selectedOptions: [],\n },\n correctElementType(ProductOptions),\n);\n\ncustomShadowlessElement(\n \"product-option-group\",\n {\n position: 0,\n name: \"\",\n inputType: \"radio\",\n },\n correctElementType(ProductOptionGroup),\n);\n\ncustomShadowlessElement(\n \"product-variant-input\",\n {\n target: \"\",\n preventDefault: true,\n },\n correctElementType(ProductVariantInput),\n);\n\ncustomShadowlessElement(\n \"product-variant-render\",\n {},\n correctElementType(ProductVariantRender),\n);\n\nexport {\n useProduct,\n useProductOptions,\n getProductContext,\n getProductOptionsContext,\n} from \"./hooks/index.js\";\n"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAaA,uBAAA;AAAA,EACE,cAAA;AAAA,EACA;AAAA,IACE,OAAS,EAAA,MAAA;AAAA,IACT,aAAe,EAAA;AAAA,GACjB;AAAA,EACA,mBAAmB,WAAW;AAChC,CAAA;AAEA,uBAAA;AAAA,EACE,iBAAA;AAAA,EACA;AAAA,IACE,iBAAiB;AAAC,GACpB;AAAA,EACA,mBAAmB,cAAc;AACnC,CAAA;AAEA,uBAAA;AAAA,EACE,sBAAA;AAAA,EACA;AAAA,IACE,QAAU,EAAA,CAAA;AAAA,IACV,IAAM,EAAA,EAAA;AAAA,IACN,SAAW,EAAA;AAAA,GACb;AAAA,EACA,mBAAmB,kBAAkB;AACvC,CAAA;AAEA,uBAAA;AAAA,EACE,uBAAA;AAAA,EACA;AAAA,IACE,MAAQ,EAAA,EAAA;AAAA,IACR,cAAgB,EAAA;AAAA,GAClB;AAAA,EACA,mBAAmB,mBAAmB;AACxC,CAAA;AAEA,uBAAA;AAAA,EACE,wBAAA;AAAA,EACA,EAAC;AAAA,EACD,mBAAmB,oBAAoB;AACzC,CAAA","file":"index.js","sourcesContent":["import {\n customShadowlessElement,\n correctElementType,\n} from \"@brytdesigns/web-component-utils\";\n\nimport {\n ProductInfo,\n ProductOptions,\n ProductOptionGroup,\n ProductVariantInput,\n ProductVariantRender,\n} from \"./components/index.js\";\n\ncustomShadowlessElement(\n \"product-info\",\n {\n product: undefined,\n isProductPage: false,\n },\n correctElementType(ProductInfo),\n);\n\ncustomShadowlessElement(\n \"product-options\",\n {\n selectedOptions: [],\n },\n correctElementType(ProductOptions),\n);\n\ncustomShadowlessElement(\n \"product-option-group\",\n {\n position: 0,\n name: \"\",\n inputType: \"radio\",\n },\n correctElementType(ProductOptionGroup),\n);\n\ncustomShadowlessElement(\n \"product-variant-input\",\n {\n target: \"\",\n preventDefault: true,\n },\n correctElementType(ProductVariantInput),\n);\n\ncustomShadowlessElement(\n \"product-variant-render\",\n {},\n correctElementType(ProductVariantRender),\n);\n\nexport {\n useProduct,\n useProductOptions,\n getProductContext,\n getProductOptionsContext,\n} from \"./hooks/index.js\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brytdesigns/shopify-product-info-components",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "Headless web components used to render product information based on active product variants",
5
5
  "main": "./dist/main/index.js",
6
6
  "module": "./dist/main/index.js",