@salla.sa/twilight 2.14.22 → 2.14.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight",
3
- "version": "2.14.22",
3
+ "version": "2.14.23",
4
4
  "description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -33,7 +33,7 @@
33
33
  ],
34
34
  "homepage": "https://salla.dev",
35
35
  "dependencies": {
36
- "@salla.sa/base": "^2.14.22",
36
+ "@salla.sa/base": "^2.14.23",
37
37
  "axios": "^0.27.2",
38
38
  "infinite-scroll": "^4.0.1",
39
39
  "jwt-decode": "^3.1.2",
@@ -67,5 +67,5 @@
67
67
  "peerDependencies": {
68
68
  "webpack": "^4 || ^5"
69
69
  },
70
- "gitHead": "0a3292796c532de17ececc6597113d5626c9b23c"
70
+ "gitHead": "1a784c9d18e6c90e01890aa75486dd30bafce4f2"
71
71
  }
@@ -13,6 +13,7 @@ import ScopeApi from "./scope";
13
13
  import LandingApi from "./landing";
14
14
  import BookingApi from "./booking";
15
15
  import NavigationApi from "./navigation"
16
+ import MetadataApi from "./metadata"
16
17
  import {AxiosInstance} from "axios";
17
18
  import {ErrorResponse, SuccessResponse} from "@salla.sa/base/types/common";
18
19
 
@@ -73,6 +74,7 @@ export type ApiActionName =
73
74
  | 'product.uploadGiftImage'
74
75
  | 'product.fetch'
75
76
  | 'product.fetchOptions'
77
+ | 'product.fetchImages'
76
78
  | 'profile.update'
77
79
  | 'profile.info'
78
80
  | 'profile.updateContacts'
@@ -97,7 +99,8 @@ export type ApiActionName =
97
99
  | 'scope.getProductAvailability'
98
100
  | 'withoutNotifier'
99
101
  | 'booking.add'
100
- | 'navigation.fetchBreadcrumbs';
102
+ | 'navigation.fetchBreadcrumbs'
103
+ | 'metadata.fetchValues';
101
104
 
102
105
  export default interface Api {
103
106
  cart: CartApi;
@@ -115,6 +118,7 @@ export default interface Api {
115
118
  booking: BookingApi;
116
119
  landing: LandingApi;
117
120
  navigation: NavigationApi;
121
+ metadata: MetadataApi;
118
122
 
119
123
  axios: AxiosInstance;
120
124
  withoutNotifier: (callback: Function) => Promise<void>;
@@ -0,0 +1,33 @@
1
+ import { SuccessResponse } from '../common';
2
+
3
+ export interface MetadataValue {
4
+ entity_id?: number;
5
+ sections?: Section[];
6
+ }
7
+
8
+ export interface Section {
9
+ id?: string;
10
+ name?: string;
11
+ fields?: Field[];
12
+ }
13
+
14
+ export interface Field {
15
+ id?: string;
16
+ name?: string;
17
+ type?: string;
18
+ value?: string;
19
+ }
20
+
21
+ export interface Metadata {
22
+ values: MetadataValue[];
23
+ }
24
+
25
+ export namespace MetadataApiResponse {
26
+ export interface value extends SuccessResponse {
27
+ data: Metadata;
28
+ }
29
+ }
30
+
31
+ export default interface MetadataApi {
32
+ fetchValues: (entity: string, entityIds: number[] | number) => Promise<MetadataApiResponse.value>;
33
+ }
@@ -55,6 +55,7 @@ export namespace ProductRequest {
55
55
  source_value: number | string | object | string[];
56
56
  filters?: object;
57
57
  limit?: number;
58
- includes?: Array<string>
58
+ includes?: Array<string>;
59
+ with?: Array<'images' | 'three_d_image'>;
59
60
  }
60
61
  }
package/types/common.d.ts CHANGED
@@ -119,6 +119,7 @@ export interface Product {
119
119
  attachments?: any;
120
120
  add_to_cart_label?: string;
121
121
  show_availability?: boolean;
122
+ metadata?: any;
122
123
  }
123
124
 
124
125
  export interface MainImage {
@@ -187,4 +188,22 @@ export interface Phone {
187
188
  export enum Genders {
188
189
  Female = 'female',
189
190
  Male = 'male',
191
+ }
192
+
193
+ export interface ProductMetadata {
194
+ entity_id?: number;
195
+ sections?: Section[];
196
+ }
197
+
198
+ export interface Section {
199
+ id?: string;
200
+ name?: string;
201
+ fields?: Field[];
202
+ }
203
+
204
+ export interface Field {
205
+ id?: string;
206
+ name?: string;
207
+ type?: string;
208
+ value?: string;
190
209
  }
@@ -14,6 +14,7 @@ import ScopeEvents from "./scope";
14
14
  import BookingEvent from "./booking";
15
15
  import LandingEvent from "./landing";
16
16
  import NavigationEvent from "./navigation";
17
+ import MetadataEvent from "./metadata";
17
18
 
18
19
  import Emitter from "@salla.sa/base/types/event";
19
20
 
@@ -36,6 +37,7 @@ export {
36
37
  BookingEvent,
37
38
  LandingEvent,
38
39
  NavigationEvent,
40
+ MetadataEvent,
39
41
  }
40
42
 
41
43
  export default interface TwilightEmitter extends Emitter {
@@ -55,4 +57,5 @@ export default interface TwilightEmitter extends Emitter {
55
57
  booking: BookingEvent;
56
58
  infiniteScroll: InfiniteScrollEvent;
57
59
  navigation: NavigationEvent;
60
+ metadata: MetadataEvent;
58
61
  }
@@ -0,0 +1,7 @@
1
+ import { RequestErrorEvent } from "../common";
2
+ import { MetadataApiResponse } from "../api/metadata";
3
+
4
+ export default interface MetadataEvent {
5
+ onValueFetched: (callback: (response: MetadataApiResponse.value) => void) => void;
6
+ onValueNotFetched: RequestErrorEvent;
7
+ }
@@ -35,5 +35,5 @@ export default interface ProductEvent {
35
35
  onProductListFetchFailed: RequestErrorEvent;
36
36
 
37
37
  onProductOptionsFetched: (callback: (response: ProductResponse.options) => void) => void;
38
- onProductOptionsNotFetched: RequestErrorEvent
38
+ onProductOptionsNotFetched: RequestErrorEvent;
39
39
  }