@gem-sdk/core 1.23.0-staging.172 → 1.23.0-staging.173

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.
@@ -77,9 +77,6 @@ const useQuantity = ()=>{
77
77
  ]);
78
78
  };
79
79
  const useSelectedOption = ()=>{
80
- const url = new URL(window.location.href);
81
- const variantId = url.searchParams.get('variant');
82
- const selectedVariant = useVariant(variantId ?? '');
83
80
  const setSelectedOption = ProductContext.useProductStore((s)=>s.setSelectedOption);
84
81
  const selectedOptions = ProductContext.useProductStore((s)=>s.selectedOptions);
85
82
  const forceSelectedOption = ProductContext.useProductStore((s)=>s.forceSelectedOption);
@@ -122,22 +119,13 @@ const useSelectedOption = ()=>{
122
119
  isSyncProduct
123
120
  ]);
124
121
  return react.useMemo(()=>({
125
- selectedOptions: selectedVariant ? selectedVariant.selectedOptions.reduce((a, b)=>{
126
- if (b.name) {
127
- return {
128
- ...a,
129
- [b.name]: b.value
130
- };
131
- }
132
- return a;
133
- }, {}) ?? undefined : selectedOptions,
122
+ selectedOptions,
134
123
  setSelectedOption: updateOption,
135
124
  forceSelectedOption: forceOption
136
125
  }), [
137
126
  selectedOptions,
138
127
  updateOption,
139
- forceOption,
140
- selectedVariant
128
+ forceOption
141
129
  ]);
142
130
  };
143
131
  const useVariants = ()=>{
@@ -75,9 +75,6 @@ const useQuantity = ()=>{
75
75
  ]);
76
76
  };
77
77
  const useSelectedOption = ()=>{
78
- const url = new URL(window.location.href);
79
- const variantId = url.searchParams.get('variant');
80
- const selectedVariant = useVariant(variantId ?? '');
81
78
  const setSelectedOption = useProductStore((s)=>s.setSelectedOption);
82
79
  const selectedOptions = useProductStore((s)=>s.selectedOptions);
83
80
  const forceSelectedOption = useProductStore((s)=>s.forceSelectedOption);
@@ -120,22 +117,13 @@ const useSelectedOption = ()=>{
120
117
  isSyncProduct
121
118
  ]);
122
119
  return useMemo(()=>({
123
- selectedOptions: selectedVariant ? selectedVariant.selectedOptions.reduce((a, b)=>{
124
- if (b.name) {
125
- return {
126
- ...a,
127
- [b.name]: b.value
128
- };
129
- }
130
- return a;
131
- }, {}) ?? undefined : selectedOptions,
120
+ selectedOptions,
132
121
  setSelectedOption: updateOption,
133
122
  forceSelectedOption: forceOption
134
123
  }), [
135
124
  selectedOptions,
136
125
  updateOption,
137
- forceOption,
138
- selectedVariant
126
+ forceOption
139
127
  ]);
140
128
  };
141
129
  const useVariants = ()=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.23.0-staging.172",
3
+ "version": "1.23.0-staging.173",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",