@salla.sa/twilight 1.0.19 → 1.6.13

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.
Files changed (115) hide show
  1. package/LICENSE.md +674 -0
  2. package/README.md +214 -4
  3. package/dist/@salla.sa/twilight.min.js +20 -0
  4. package/dist/@salla.sa/twilight.min.js.map +1 -0
  5. package/dist/cjs/index.js +2 -0
  6. package/dist/cjs/index.js.map +1 -0
  7. package/dist/esm/index.js +2 -0
  8. package/dist/esm/index.js.map +1 -0
  9. package/package.json +64 -53
  10. package/types/actions.d.ts +47 -0
  11. package/types/api/auth/index.d.ts +17 -0
  12. package/types/api/auth/request.d.ts +42 -0
  13. package/types/api/auth/response.d.ts +22 -0
  14. package/types/api/cart/index.d.ts +24 -0
  15. package/types/api/cart/request.d.ts +8 -0
  16. package/types/api/cart/response.d.ts +66 -0
  17. package/types/api/comment.d.ts +18 -0
  18. package/types/api/currency.d.ts +17 -0
  19. package/types/api/document.d.ts +3 -0
  20. package/types/api/index.d.ts +110 -0
  21. package/types/api/loyalty.d.ts +226 -0
  22. package/types/api/order.d.ts +15 -0
  23. package/types/api/product/index.d.ts +17 -0
  24. package/types/api/product/request.d.ts +53 -0
  25. package/types/api/product/response.d.ts +103 -0
  26. package/types/api/profile.d.ts +50 -0
  27. package/types/api/rating.d.ts +49 -0
  28. package/types/api/scope.d.ts +42 -0
  29. package/types/api/wishlist.d.ts +7 -0
  30. package/types/common.d.ts +75 -0
  31. package/types/event/auth.d.ts +18 -0
  32. package/types/event/cart.d.ts +30 -0
  33. package/types/event/comment.d.ts +7 -0
  34. package/types/event/currency.d.ts +9 -0
  35. package/types/event/document.d.ts +29 -0
  36. package/types/event/index.d.ts +48 -0
  37. package/types/event/infiniteScroll.d.ts +12 -0
  38. package/types/event/loyalty.d.ts +14 -0
  39. package/types/event/order.d.ts +11 -0
  40. package/types/event/product.d.ts +30 -0
  41. package/types/event/profile.d.ts +13 -0
  42. package/types/event/rating.d.ts +13 -0
  43. package/types/event/scope.d.ts +15 -0
  44. package/types/event/wishlist.d.ts +8 -0
  45. package/types/helpers/app-helpers.d.ts +29 -0
  46. package/types/index.d.ts +36 -0
  47. package/types/lib/config.ts +14 -0
  48. package/types/lib/form.d.ts +8 -0
  49. package/types/lib/lang.d.ts +14 -0
  50. package/types/lib/notify.d.ts +14 -0
  51. package/types/tiwlight-config.d.ts +74 -0
  52. package/watcher.js +62 -20
  53. package/components/README.md +0 -55
  54. package/components/dist/cjs/index-9441fd8e.js +0 -1554
  55. package/components/dist/cjs/index.cjs.js +0 -2
  56. package/components/dist/cjs/loader.cjs.js +0 -21
  57. package/components/dist/cjs/salla-login_2.cjs.entry.js +0 -131
  58. package/components/dist/cjs/twilight-components.cjs.js +0 -19
  59. package/components/dist/collection/collection-manifest.json +0 -13
  60. package/components/dist/collection/components/generate-summary.js +0 -35
  61. package/components/dist/collection/components/salla-login/salla-login.css +0 -104
  62. package/components/dist/collection/components/salla-login/salla-login.js +0 -113
  63. package/components/dist/collection/components/search-modal/search-modal.css +0 -9
  64. package/components/dist/collection/components/search-modal/search-modal.js +0 -161
  65. package/components/dist/collection/index.js +0 -1
  66. package/components/dist/collection/interfaces/colors.js +0 -1
  67. package/components/dist/collection/interfaces/index.js +0 -2
  68. package/components/dist/collection/interfaces/ratio.js +0 -1
  69. package/components/dist/collection/plugins/tailwind-theme/index.js +0 -32
  70. package/components/dist/collection/plugins/tailwind-theme/scripts/generator.js +0 -51
  71. package/components/dist/collection/utils/utils.js +0 -16
  72. package/components/dist/esm/index-63e5409f.js +0 -1527
  73. package/components/dist/esm/index.js +0 -1
  74. package/components/dist/esm/loader.js +0 -17
  75. package/components/dist/esm/polyfills/core-js.js +0 -11
  76. package/components/dist/esm/polyfills/css-shim.js +0 -1
  77. package/components/dist/esm/polyfills/dom.js +0 -79
  78. package/components/dist/esm/polyfills/es5-html-element.js +0 -1
  79. package/components/dist/esm/polyfills/index.js +0 -34
  80. package/components/dist/esm/polyfills/system.js +0 -6
  81. package/components/dist/esm/salla-login_2.entry.js +0 -126
  82. package/components/dist/esm/twilight-components.js +0 -17
  83. package/components/dist/index.cjs.js +0 -1
  84. package/components/dist/index.js +0 -1
  85. package/components/dist/twilight-components/index.esm.js +0 -0
  86. package/components/dist/twilight-components/p-3d53781c.js +0 -1
  87. package/components/dist/twilight-components/p-fccb89fa.entry.js +0 -1
  88. package/components/dist/twilight-components/twilight-components.esm.js +0 -1
  89. package/components/dist/types/components/salla-login/salla-login.d.ts +0 -14
  90. package/components/dist/types/components/search-modal/search-modal.d.ts +0 -26
  91. package/components/dist/types/components.d.ts +0 -76
  92. package/components/dist/types/index.d.ts +0 -6
  93. package/components/dist/types/interfaces/colors.d.ts +0 -1
  94. package/components/dist/types/interfaces/index.d.ts +0 -2
  95. package/components/dist/types/interfaces/ratio.d.ts +0 -1
  96. package/components/dist/types/stencil-public-runtime.d.ts +0 -1563
  97. package/components/dist/types/utils/utils.d.ts +0 -6
  98. package/components/loader/cdn.js +0 -3
  99. package/components/loader/index.cjs.js +0 -3
  100. package/components/loader/index.d.ts +0 -13
  101. package/components/loader/index.es2017.js +0 -3
  102. package/components/loader/index.js +0 -4
  103. package/components/loader/package.json +0 -10
  104. package/components/package.json +0 -70
  105. package/components/src/plugins/tailwind-theme/index.js +0 -32
  106. package/components/src/plugins/tailwind-theme/package.json +0 -27
  107. package/components/src/plugins/tailwind-theme/readme.md +0 -47
  108. package/components/src/plugins/tailwind-theme/safe-list-css.txt +0 -19
  109. package/components/src/plugins/tailwind-theme/utilities.json +0 -1
  110. package/components.js +0 -1
  111. package/dist/twilight.js +0 -2
  112. package/dist/twilight.js.LICENSE.txt +0 -27
  113. package/postInstall.js +0 -2
  114. package/tailwind.js +0 -1
  115. package/tailwind_css_list.js +0 -1
package/package.json CHANGED
@@ -1,55 +1,66 @@
1
1
  {
2
- "name": "@salla.sa/twilight",
3
- "version": "1.0.19",
4
- "description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
5
- "main": "dist/twilight.js",
6
- "scripts": {
7
- "prod": "webpack --mode production",
8
- "watch": "webpack --mode development --watch",
9
- "postinstall": "node ./postInstall.js"
10
- },
11
- "keywords": [
12
- "salla",
13
- "theme",
14
- "utils",
15
- "events",
16
- "requests"
17
- ],
18
- "repository": {
19
- "type": "git",
20
- "url": "https://github.com/SallaApp/twilight-js.git"
21
- },
22
- "author": "Salla.sa",
23
- "license": "MIT",
24
- "files": [
25
- "dist",
26
- "watcher.js",
27
- "tailwind.js",
28
- "package.json",
29
- "components.js",
30
- "postInstall.js",
31
- "components/dist",
32
- "components/loader",
33
- "tailwind_css_list.js"
34
- ],
35
- "homepage": "https://salla.dev",
36
- "dependencies": {
37
- "@salla.sa/applepay": "~1.0",
38
- "axios": "^0.23.0",
39
- "eventemitter2": "^6.4.5",
40
- "infinite-scroll": "^4.0.1",
41
- "lang.js": "^1.1.14",
42
- "store": "^2.0.12"
43
- },
44
- "devDependencies": {
45
- "@babel/core": "^7.16.0",
46
- "babel-loader": "^8.2.3",
47
- "glob": "^7.2.0",
48
- "webpack": "^5.64.2",
49
- "webpack-build-notifier": "^2.3.0",
50
- "webpack-cli": "^4.9.1"
51
- },
52
- "peerDependencies": {
53
- "webpack": "^4 || ^5"
54
- }
2
+ "name": "@salla.sa/twilight",
3
+ "version": "1.6.13",
4
+ "description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
5
+ "main": "dist/cjs",
6
+ "module": "dist/esm",
7
+ "types": "types/index.d.ts",
8
+ "scripts": {
9
+ "build": "npx rollup --config --preserveSymlinks=true",
10
+ "watch": "npx rollup --watch --config --preserveSymlinks=true"
11
+ },
12
+ "keywords": [
13
+ "salla",
14
+ "theme",
15
+ "utils",
16
+ "events",
17
+ "requests"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/SallaApp/twilight.git"
22
+ },
23
+ "author": "Salla.sa",
24
+ "license": "MIT",
25
+ "files": [
26
+ "dist",
27
+ "types",
28
+ "watcher.js",
29
+ "package.json",
30
+ "postInstall.js"
31
+ ],
32
+ "homepage": "https://salla.dev",
33
+ "dependencies": {
34
+ "@salla.sa/applepay": "~1.0",
35
+ "@salla.sa/base": "^1.6.13",
36
+ "@salla.sa/twilight-tailwind-theme": "^1.5.14",
37
+ "axios": "^0.27.2",
38
+ "infinite-scroll": "^4.0.1",
39
+ "jwt-decode": "^3.1.2",
40
+ "lang.js": "^1.1.14",
41
+ "websocket": "^1.0.34"
42
+ },
43
+ "devDependencies": {
44
+ "@babel/core": "^7.18.10",
45
+ "@babel/preset-env": "^7.18.10",
46
+ "@rollup/plugin-babel": "^5.3.1",
47
+ "@rollup/plugin-commonjs": "^22.0.2",
48
+ "@rollup/plugin-node-resolve": "^13.1.3",
49
+ "babel-loader": "^8.2.5",
50
+ "rollup-plugin-analyzer": "^4.0.0",
51
+ "rollup-plugin-cleaner": "^1.0.0",
52
+ "rollup-plugin-exclude-dependencies-from-bundle": "^1.1.22",
53
+ "rollup-plugin-node-polyfills": "^0.2.1",
54
+ "rollup-plugin-serve": "^2.0.1",
55
+ "rollup-plugin-terser": "^7.0.2",
56
+ "rollup-plugin-version-injector": "^1.3.3",
57
+ "rollup-plugin-watch": "^1.0.1",
58
+ "webpack": "^5.74.0",
59
+ "webpack-build-notifier": "^2.3.0",
60
+ "webpack-cli": "^4.10.0"
61
+ },
62
+ "peerDependencies": {
63
+ "webpack": "^4 || ^5"
64
+ },
65
+ "gitHead": "46e8084d1dcdbf7feddec0eb68fe856cabfa7a42"
55
66
  }
@@ -0,0 +1,47 @@
1
+ import {
2
+ AuthApi, CartApi, CommentApi, CurrencyApi, DocumentApi, RatingApi, OrderApi,
3
+ ProductApi, ProfileApi, WishlistApi, LoyaltyApi,
4
+ } from "./api";
5
+ import {
6
+ AuthEvent, CartEvent, CommentEvent, CurrencyEvent, DocumentEvent, RatingEvent,
7
+ InfiniteScrollEvent, OrderEvent, ProductEvent, ProfileEvent, WishlistEvent, LoyaltyEvent,
8
+ } from "./event";
9
+
10
+ import Salla from "@salla.sa/base/types/index";
11
+
12
+ export default interface SallaActions extends Salla {
13
+ cart: CartApi & { api: CartApi, event: CartEvent };
14
+ auth: AuthApi & { api: AuthApi, event: AuthEvent };
15
+ order: OrderApi & { api: OrderApi, event: OrderEvent };
16
+ rating: RatingApi & { api: RatingApi, event: RatingEvent };
17
+ comment: CommentApi & { api: CommentApi, event: CommentEvent };
18
+ loyalty: LoyaltyApi & { api: LoyaltyApi, event: LoyaltyEvent };
19
+ product: ProductApi & { api: ProductApi, event: ProductEvent };
20
+ profile: ProfileApi & { api: ProfileApi, event: ProfileEvent };
21
+ currency: CurrencyApi & { api: CurrencyApi, event: CurrencyEvent };
22
+ document: DocumentApi & { api: DocumentApi, event: DocumentEvent };
23
+ wishlist: WishlistApi & { api: WishlistApi, event: WishlistEvent };
24
+ infiniteScroll: InfiniteScroll & { api: null, event: InfiniteScrollEvent };
25
+ }
26
+
27
+
28
+ /********************* Infinite Scroll *********************/
29
+ /**
30
+ * @see https://infinite-scroll.com/options.html
31
+ */
32
+ export interface InfiniteScrollOptions {
33
+ path: '.infinite-scroll-btn' | string;
34
+ history: 'push' | false;
35
+ status: ".infinite-scroll-status" | string;
36
+ append: ".list-block" | string;
37
+ button: ".infinite-scroll-btn" | string;
38
+ next_page: string;
39
+ }
40
+
41
+ /**
42
+ * @see https://infinite-scroll.com/api.html
43
+ */
44
+ export interface InfiniteScroll {
45
+ //💡 when there is no need to pass options, but there is need to change append selector, just pass it as string as second argument
46
+ initiate: (selector: string | HTMLElement, append?: string | InfiniteScrollOptions, customOptions?: InfiniteScrollOptions) => Object;
47
+ }
@@ -0,0 +1,17 @@
1
+ import {SuccessResponse} from "../../common";
2
+
3
+ export * from "./request";
4
+ export * from "./response";
5
+ import {AuthRequest} from "./request";
6
+ import {AuthResponse} from "./response";
7
+
8
+ export default interface AuthApi {
9
+ canRedirect: () => boolean; //change it to false when you don't want page to reload or redirect automatically after logged in, use `salla.auth.event.onLoggedIn(response=>{...})`
10
+ setCanRedirect: (canRedirect: boolean) => void;
11
+ login: (data: AuthRequest.loginByMobile | AuthRequest.loginByEmail) => Promise<AuthResponse.loginOrResendCode>;
12
+ logout: () => Promise<SuccessResponse>;
13
+ verify: (data: AuthRequest.verifyByMobile | AuthRequest.verifyByEmail, supportWebAuth: boolean) => Promise<AuthResponse.verify>;
14
+ resend: (data: AuthRequest.resend) => Promise<AuthResponse.loginOrResendCode>;
15
+ register: (data: AuthRequest.register) => Promise<AuthResponse.verify>;
16
+ refresh: () => Promise<AuthResponse.verify>;
17
+ }
@@ -0,0 +1,42 @@
1
+ export namespace AuthRequest {
2
+ export interface loginByMobile {
3
+ phone: string;
4
+ type: 'mobile';
5
+ country_code: string | 'SA';
6
+ }
7
+
8
+ export interface loginByEmail {
9
+ email: string;
10
+ type: 'email';
11
+ }
12
+
13
+ export interface verifyByEmail {
14
+ type: 'email';
15
+ code: string;
16
+ email: string;
17
+ }
18
+
19
+ export interface verifyByMobile {
20
+ type: 'mobile';
21
+ code: string;
22
+ phone: string;
23
+ country_code: string | "SA";
24
+ }
25
+
26
+ export interface register {
27
+ first_name: string;
28
+ last_name: string;
29
+ phone: string;
30
+ country_code: string | 'SA';
31
+ verified_by: 'email' | 'phone';
32
+ email?: string;
33
+ code: number;
34
+ }
35
+
36
+ export interface resend {
37
+ type: 'mobile' | 'email';
38
+ phone?: string;
39
+ country_code?: string | "SA";
40
+ email?: string;
41
+ }
42
+ }
@@ -0,0 +1,22 @@
1
+ import {SuccessResponse} from "../../common";
2
+
3
+ export type VerificationStatus = {
4
+ type: 'mobile' | 'email';
5
+ status: 'success' | 'pending' | 'failed';
6
+ }
7
+ export namespace AuthResponse {
8
+ export interface verify extends SuccessResponse {
9
+ data: {
10
+ case: 'authenticated' | 'new_customer';
11
+ redirect_url?: string;
12
+ token?: string;
13
+ verification?: VerificationStatus;
14
+ }
15
+ }
16
+
17
+ export interface loginOrResendCode extends SuccessResponse {
18
+ data: {
19
+ resend_counter?: 2 | 3 | 4;//when resend code
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,24 @@
1
+ export * from "./request";
2
+ export * from "./response";
3
+ import {SuccessResponse} from "../../common";
4
+ import {CartResponse} from "./response";
5
+ import {CartRequest} from "./request";
6
+
7
+ export default interface CartApi {
8
+ latest: () => Promise<CartResponse.update>;
9
+ details: () => Promise<CartResponse.update>;
10
+ quickAdd: (/*product_id*/id: number) => Promise<CartResponse.update>;
11
+ addItem: (data: CartRequest.addItem) => Promise<CartResponse.update>;
12
+ deleteItem: (item_id: number) => Promise<CartResponse.update>;
13
+ updateItem: (data: CartRequest.addItem) => Promise<CartResponse.update>;
14
+ deleteImage: (file_id: number) => Promise<SuccessResponse>;
15
+ status: () => Promise<CartResponse.status>;
16
+ reset: () => void;
17
+ submit: () => void;
18
+
19
+ getUploadImageEndpoint: (cartId?: number) => string;
20
+
21
+ //coupons
22
+ addCoupon: (coupon: string) => Promise<CartResponse.update>;
23
+ deleteCoupon: () => Promise<CartResponse.update>;
24
+ }
@@ -0,0 +1,8 @@
1
+ import ProductPayload from "../product";
2
+
3
+ export namespace CartRequest {
4
+ export interface addItem extends ProductPayload {
5
+ notes?: string;
6
+ file?: BinaryType | string;
7
+ }
8
+ }
@@ -0,0 +1,66 @@
1
+ import { SuccessResponse } from "../../common";
2
+ export namespace CartResponse {
3
+ export interface update extends SuccessResponse {
4
+ data: CartUpdatedData;
5
+ }
6
+
7
+ export interface status extends SuccessResponse {
8
+ data: {
9
+ active: boolean;
10
+ next_step: {
11
+ to: 'refresh' | 'login' | 'checkout';
12
+ url?: string;
13
+ };
14
+ }
15
+ }
16
+ }
17
+
18
+
19
+ export interface CartUpdatedData extends Object {
20
+ product_id?: number;
21
+ offer?: OfferSummary;
22
+ googleTags: string;//json string
23
+ cart: CartSummary;
24
+ }
25
+
26
+ export interface itemOffer {
27
+ discount: number;
28
+ is_free: boolean;
29
+ names: string;
30
+ }
31
+
32
+ export interface CartItem {
33
+ id: number;
34
+ product_id: number;
35
+ product_price: number;
36
+ price: number;
37
+ total: number;
38
+ is_available: true;
39
+ offer?: itemOffer;
40
+ quantity: number;
41
+ total_special_price: number;
42
+ special_price: number;
43
+ }
44
+
45
+ export interface CartSummary {
46
+ id: number;
47
+ user_id: number | string;
48
+ store_id: number;
49
+ real_shipping_cost?: number;
50
+ free_shipping_bar?: {
51
+ minimum_amount: number;
52
+ has_free_shipping: boolean;
53
+ percent: number | 0 | 100;
54
+ remaining: number;
55
+ };
56
+ sub_total: number;
57
+ discount: number;
58
+ total: number;
59
+ count: number;
60
+ items?: CartItem[];
61
+ }
62
+
63
+ export interface OfferSummary {
64
+ id: number;
65
+ product_id: number;
66
+ }
@@ -0,0 +1,18 @@
1
+ import {SuccessResponse} from "../common";
2
+
3
+ export interface AddCommentResponse extends SuccessResponse {
4
+ data: {
5
+ case: 'success' | 'error';
6
+ message: string;
7
+ }
8
+ }
9
+
10
+ export interface AddCommentPayload {
11
+ id: number;
12
+ comment: string;
13
+ type: 'product' | 'page';
14
+ }
15
+
16
+ export default interface CommentApi {
17
+ add: (data: AddCommentPayload) => Promise<AddCommentResponse>;
18
+ }
@@ -0,0 +1,17 @@
1
+ import {Currency, SuccessResponse} from "../common";
2
+
3
+ export interface ChangeCurrencyResponse extends SuccessResponse {
4
+ data: {
5
+ code: 'SAR' | string;
6
+ symbol: string;
7
+ }
8
+ }
9
+
10
+ export interface ListCurrenciesResponse extends SuccessResponse {
11
+ data: Array<Currency>
12
+ }
13
+
14
+ export default interface CurrencyApi {
15
+ change: (currency_code: 'SAR' | 'USD' | string) => Promise<ChangeCurrencyResponse>;
16
+ list: () => Promise<ListCurrenciesResponse>;
17
+ }
@@ -0,0 +1,3 @@
1
+
2
+ export default interface DocumentApi {
3
+ }
@@ -0,0 +1,110 @@
1
+ import CartApi from "./cart";
2
+ import AuthApi from "./auth";
3
+ import OrderApi from "./order";
4
+ import RatingApi from "./rating";
5
+ import CommentApi from "./comment";
6
+ import LoyaltyApi from "./loyalty";
7
+ import ProductApi from "./product";
8
+ import ProfileApi from "./profile";
9
+ import CurrencyApi from "./currency";
10
+ import DocumentApi from "./document";
11
+ import WishlistApi from "./wishlist";
12
+ import ScopeApi from "./scope";
13
+ import {ErrorResponse, SuccessResponse} from "@salla.sa/base/types/common";
14
+
15
+ export {
16
+ CartApi,
17
+ AuthApi,
18
+ OrderApi,
19
+ RatingApi,
20
+ CommentApi,
21
+ LoyaltyApi,
22
+ ProductApi,
23
+ ProfileApi,
24
+ CurrencyApi,
25
+ DocumentApi,
26
+ WishlistApi,
27
+ ScopeApi,
28
+ };
29
+ export type ApiActionName =
30
+ 'auth.login'
31
+ | 'auth.resend'
32
+ | 'auth.verify'
33
+ | 'auth.register'
34
+ | 'auth.logout'
35
+ | 'auth.refresh'
36
+ | 'cart.latest'
37
+ | 'cart.details'
38
+ | 'cart.summary'
39
+ | 'cart.quickAdd'
40
+ | 'cart.addItem'
41
+ | 'cart.deleteItem'
42
+ | 'cart.updateItem'
43
+ | 'cart.deleteImage'
44
+ | 'cart.status'
45
+ | 'cart.addCoupon'
46
+ | 'cart.deleteCoupon'
47
+ | 'loyalty.exchange'
48
+ | 'loyalty.getProgram'
49
+ | 'loyalty.reset'
50
+ | 'order.cancel'
51
+ | 'order.reOrder'
52
+ | 'order.send'
53
+ | 'product.getPrice'
54
+ | 'product.availabilitySubscribe'
55
+ | 'product.purchaseNow'
56
+ | 'product.search'
57
+ | 'product.categories'
58
+ | 'product.offers'
59
+ | 'profile.update'
60
+ | 'profile.getSizeGuides'
61
+ | 'profile.getGiftDetails'
62
+ | 'profile.addGiftToCart'
63
+ | 'profile.uploadGiftImage'
64
+ | 'comment.add'
65
+ | 'currency.change'
66
+ | 'currency.list'
67
+ | 'rating.store'
68
+ | 'rating.products'
69
+ | 'rating.shipping'
70
+ | 'rating.order'
71
+ | 'wishlist.add'
72
+ | 'wishlist.remove'
73
+ | 'scope.get'
74
+ | 'scope.change'
75
+ | 'scope.getProductAvailability'
76
+ | 'withoutNotifier';
77
+
78
+ export default interface Api {
79
+ cart: CartApi;
80
+ auth: AuthApi;
81
+ order: OrderApi;
82
+ rating: RatingApi;
83
+ comment: CommentApi;
84
+ loyalty: LoyaltyApi;
85
+ product: ProductApi;
86
+ profile: ProfileApi;
87
+ currency: CurrencyApi;
88
+ document: DocumentApi;
89
+ wishlist: WishlistApi;
90
+ scope: ScopeApi;
91
+ withoutNotifier: (callback: Function) => Promise<void>;
92
+ getHeaders: () => {
93
+ Accept: string | 'application/json, text/plain, */*',
94
+ "X-Requested-With": 'XMLHttpRequest',
95
+ "S-SOURCE": 'twilight',
96
+ "Store-Identifier"?: number,
97
+ currency?: string | 'SAR',
98
+ "accept-language"?: string | 'ar',
99
+ Authorization?: string
100
+ }
101
+ request(endPoint: string, formData: undefined | object, method: string, options: object): Promise<any>
102
+ handleAfterResponseActions(response: SuccessResponse|ErrorResponse|any): void;
103
+ fireEventsForResponse(response: SuccessResponse|ErrorResponse|any): void;
104
+ showAlert(response: SuccessResponse|ErrorResponse|any): void;
105
+ handleErrorResponse(error: object): void;
106
+ handleInvalidFields(error: object): void;
107
+ errorPromise(data: any): Promise<any>;
108
+ successPromise(data: any): Promise<any>;
109
+ isFastRequestsAllowed(): boolean;
110
+ }