@react-pakistan/util-functions 1.25.16 → 1.25.18

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.
@@ -162,7 +162,7 @@ exports.getCachedDataSync = getCachedDataSync;
162
162
  * const active = await getCachedData<UserBE>({ config, filters: { enabled: true }, pageLimit: 200 });
163
163
  */
164
164
  var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
165
- var config, params, cacheKey, apiUrl, responseKey, expirationMs, fallBackPageLimit, fallBackCurrentPage, filters, searchQuery, queryObj_1, searchParams_1, response_1, items_1, raw, currentTime, cachedTime, ageInMs, cachedTime, ageInMs, itemsArray, queryObj, searchParams, response, itemsRaw, items, count, itemsMap, updatedCache, error_1;
165
+ var config, params, cacheKey, apiUrl, responseKey, expirationMs, fallBackPageLimit, fallBackCurrentPage, filters, searchQuery, paramsWithoutFilters_1, otherParams_1, queryObj_1, searchParams_1, response_1, items_1, raw, currentTime, cachedTime, ageInMs, cachedTime, ageInMs, itemsArray, paramsWithoutFilters_2, otherParams, queryObj, searchParams, response, itemsRaw, items, count, itemsMap, updatedCache, error_1;
166
166
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
167
167
  return __generator(this, function (_m) {
168
168
  switch (_m.label) {
@@ -179,12 +179,20 @@ var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, f
179
179
  _m.trys.push([1, 5, , 6]);
180
180
  if (!((searchQuery && searchQuery.trim()) ||
181
181
  (filters && Object.keys(filters).length > 0))) return [3 /*break*/, 3];
182
+ paramsWithoutFilters_1 = __assign({}, (params || {}));
183
+ if (paramsWithoutFilters_1.filters !== undefined) {
184
+ delete paramsWithoutFilters_1.filters;
185
+ }
186
+ otherParams_1 = Object.keys(paramsWithoutFilters_1).reduce(function (acc, key) {
187
+ acc[key] = String(paramsWithoutFilters_1[key]);
188
+ return acc;
189
+ }, {});
182
190
  queryObj_1 = __assign(__assign(__assign({ pageLimit: fallBackPageLimit, currentPage: fallBackCurrentPage }, (searchQuery && { searchQuery: searchQuery })), (filters
183
191
  ? Object.keys(filters).reduce(function (acc, key) {
184
192
  acc[key] = String(filters[key]);
185
193
  return acc;
186
194
  }, {})
187
- : {})), (params || {}));
195
+ : {})), otherParams_1);
188
196
  searchParams_1 = new URLSearchParams(queryObj_1);
189
197
  return [4 /*yield*/, (0, fetch_data_1.fetchData)({
190
198
  url: "".concat(apiUrl, "?").concat(searchParams_1.toString()),
@@ -217,7 +225,15 @@ var getCachedData = function (opts) { return __awaiter(void 0, void 0, void 0, f
217
225
  return [2 /*return*/, { count: itemsArray.length, items: itemsArray }];
218
226
  }
219
227
  }
220
- queryObj = __assign({ pageLimit: fallBackPageLimit, currentPage: fallBackCurrentPage }, (params || {}));
228
+ paramsWithoutFilters_2 = __assign({}, (params || {}));
229
+ if (paramsWithoutFilters_2.filters !== undefined) {
230
+ delete paramsWithoutFilters_2.filters;
231
+ }
232
+ otherParams = Object.keys(paramsWithoutFilters_2).reduce(function (acc, key) {
233
+ acc[key] = String(paramsWithoutFilters_2[key]);
234
+ return acc;
235
+ }, {});
236
+ queryObj = __assign({ pageLimit: fallBackPageLimit, currentPage: fallBackCurrentPage }, otherParams);
221
237
  searchParams = new URLSearchParams(queryObj);
222
238
  return [4 /*yield*/, (0, fetch_data_1.fetchData)({
223
239
  url: "".concat(apiUrl, "?").concat(searchParams.toString()),
@@ -3,6 +3,7 @@ interface WrapperProps {
3
3
  organizationJsonLd?: any;
4
4
  breadcrumbJsonLd?: any;
5
5
  faqJsonLd?: any;
6
+ localBusinessJsonLd?: any;
6
7
  [key: string]: any;
7
8
  }
8
9
  export declare const withSEO: (Component: ComponentType<WrapperProps>, rest: WrapperProps) => (() => JSX.Element);
package/hooks/with-seo.js CHANGED
@@ -28,6 +28,9 @@ var withSEO = function (Component, rest) {
28
28
  } })),
29
29
  rest.faqJsonLd && (react_1.default.createElement(script_1.default, { id: "faq-schema", type: "application/ld+json", dangerouslySetInnerHTML: {
30
30
  __html: JSON.stringify(rest.faqJsonLd),
31
+ } })),
32
+ rest.localBusinessJsonLd && (react_1.default.createElement(script_1.default, { id: "local-business-schema", type: "application/ld+json", dangerouslySetInnerHTML: {
33
+ __html: JSON.stringify(rest.localBusinessJsonLd),
31
34
  } })))); };
32
35
  return EnhancedComponent;
33
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.25.16",
3
+ "version": "1.25.18",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {