@tecof/theme-editor 0.0.31 → 0.0.32

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.
package/dist/index.d.mts CHANGED
@@ -228,7 +228,7 @@ declare class TecofApiClient {
228
228
  getCmsCollectionItems(collectionSlug: string, options?: {
229
229
  page?: number;
230
230
  limit?: number;
231
- sort?: 'newest' | 'oldest';
231
+ sort?: 'newest' | 'oldest' | 'custom';
232
232
  locale?: string;
233
233
  }): Promise<ApiResponse<any>>;
234
234
  /** CDN base URL (defaults to apiUrl if not set) */
@@ -650,7 +650,7 @@ interface CmsCollectionFieldValue {
650
650
  /** Max items to fetch */
651
651
  limit?: number;
652
652
  /** Sort order */
653
- sort?: 'newest' | 'oldest';
653
+ sort?: 'newest' | 'oldest' | 'custom';
654
654
  /** Field mapping: slotKey → CMS field shortcode */
655
655
  fieldMap?: Record<string, string>;
656
656
  }
package/dist/index.d.ts CHANGED
@@ -228,7 +228,7 @@ declare class TecofApiClient {
228
228
  getCmsCollectionItems(collectionSlug: string, options?: {
229
229
  page?: number;
230
230
  limit?: number;
231
- sort?: 'newest' | 'oldest';
231
+ sort?: 'newest' | 'oldest' | 'custom';
232
232
  locale?: string;
233
233
  }): Promise<ApiResponse<any>>;
234
234
  /** CDN base URL (defaults to apiUrl if not set) */
@@ -650,7 +650,7 @@ interface CmsCollectionFieldValue {
650
650
  /** Max items to fetch */
651
651
  limit?: number;
652
652
  /** Sort order */
653
- sort?: 'newest' | 'oldest';
653
+ sort?: 'newest' | 'oldest' | 'custom';
654
654
  /** Field mapping: slotKey → CMS field shortcode */
655
655
  fieldMap?: Record<string, string>;
656
656
  }
package/dist/index.js CHANGED
@@ -286,15 +286,19 @@ var TecofApiClient = class {
286
286
  */
287
287
  async getCmsCollectionItems(collectionSlug, options) {
288
288
  try {
289
+ const body = {
290
+ page: options?.page || 1,
291
+ limit: options?.limit || 50,
292
+ locale: options?.locale
293
+ };
294
+ const sortValue = options?.sort || "custom";
295
+ if (sortValue !== "custom") {
296
+ body.sort = sortValue;
297
+ }
289
298
  const res2 = await fetch(`${this.apiUrl}/api/store/cms/collections/${encodeURIComponent(collectionSlug)}/items`, {
290
299
  method: "POST",
291
300
  headers: this.headers,
292
- body: JSON.stringify({
293
- page: options?.page || 1,
294
- limit: options?.limit || 50,
295
- sort: options?.sort || "newest",
296
- locale: options?.locale
297
- })
301
+ body: JSON.stringify(body)
298
302
  });
299
303
  return await res2.json();
300
304
  } catch (error2) {
@@ -24849,7 +24853,7 @@ var CmsCollectionField = ({
24849
24853
  collectionSlug: col.slug,
24850
24854
  collectionName: col.name,
24851
24855
  limit: value?.limit || defaultLimit,
24852
- sort: value?.sort || "newest",
24856
+ sort: value?.sort || "custom",
24853
24857
  fieldMap: value?.fieldMap || {}
24854
24858
  });
24855
24859
  setDropdownOpen(false);
@@ -24998,7 +25002,17 @@ var CmsCollectionField = ({
24998
25002
  "button",
24999
25003
  {
25000
25004
  type: "button",
25001
- className: `tecof-cms-col-sort-btn ${(value.sort || "newest") === "newest" ? "active" : ""}`,
25005
+ className: `tecof-cms-col-sort-btn ${(value.sort || "custom") === "custom" ? "active" : ""}`,
25006
+ onClick: () => handleSortChange("custom"),
25007
+ disabled: readOnly,
25008
+ children: "\xD6zel S\u0131ralama"
25009
+ }
25010
+ ),
25011
+ /* @__PURE__ */ jsxRuntime.jsx(
25012
+ "button",
25013
+ {
25014
+ type: "button",
25015
+ className: `tecof-cms-col-sort-btn ${value.sort === "newest" ? "active" : ""}`,
25002
25016
  onClick: () => handleSortChange("newest"),
25003
25017
  disabled: readOnly,
25004
25018
  children: "Yeni\u2192Eski"