daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Dec 15th, 2018 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // tsconfig.json
  2. {
  3.   "files":
  4.   [
  5.     "src/index.d.ts",
  6.   ],
  7.   "compileOnSave": false,
  8.   "compilerOptions": {
  9.     "outDir": "./dist/out-tsc",
  10.     "baseUrl": "src",
  11.     "sourceMap": true,
  12.     "declaration": false,
  13.     "moduleResolution": "node",
  14.     "emitDecoratorMetadata": true,
  15.     "experimentalDecorators": true,
  16.     "target": "es5",
  17.     "typeRoots":
  18.     [
  19.       "node_modules/@types",
  20.       "src/index.d.ts"
  21.     ],
  22.     "lib": [
  23.       "es2016",
  24.       "dom"
  25.     ],
  26.   }
  27. }
  28.  
  29. // index.d.ts
  30.  
  31. declare const enum ERRORS
  32. {
  33.     CATEGORY_DOESNT_EXIST = 0,
  34.     PRODUCT_DOESNT_EXIST = 1,
  35. }
  36.  
  37. /*declare const textFieldErrors =
  38. {
  39.     required: "Acest câmp trebuie completat.",
  40.     pattern: "Formatul introdus este invalid.",
  41.     email: "Email-ul introdus nu este unul valid.",
  42.     minlength: "Conținutul trebuie să aiba minim %% caractere.",
  43.     matchPassword: "Parolele introduse nu coincid.",
  44.     uniqueEmail: "Acest email este deja folosit."
  45. };
  46. */
  47. interface Point
  48. {
  49.     x: number;
  50.     y: number;
  51. }
  52.  
  53. interface URL
  54. {
  55.     url: string;
  56.     name: string;
  57. }
  58.  
  59. interface Pagination
  60. {
  61.     active: number;
  62.     total: number;
  63. }
  64.  
  65. interface Color
  66. {
  67.     name: string;
  68.     value: string;
  69. }
  70.  
  71. interface Image
  72. {
  73.     url: string;
  74.     alt: string;
  75.     title: string;
  76.     ratio_width: number;
  77.     ratio_height: number;
  78. }
  79.  
  80. declare type Breadcrumb = URL[];
  81.  
  82. /*
  83.  * Product
  84.  */
  85.  
  86. declare namespace ProductResponse
  87.  {
  88.      export interface small
  89.      {
  90.  
  91.      }
  92.      export interface medium
  93.      {
  94.         id: number;
  95.         name: string;
  96.         url: string;
  97.         stock: number;
  98.         price: number;
  99.         discount: number;
  100.         rate: number;
  101.      }
  102.  
  103.      export interface full
  104.      {
  105.         data:
  106.         {
  107.             id: number;
  108.             name: string;
  109.             url: string;
  110.             stock: number;
  111.             rate: number;
  112.             reviews: number;
  113.             price: number;
  114.             discount: number;  
  115.             description: string;
  116.             created_at: number;
  117.             updated_at: number;
  118.         };
  119.         images: Image[];
  120.         breadcrumb: Breadcrumb;
  121.         reviews: ReviewResponse[];
  122.         auth?:
  123.         {
  124.             can_review: boolean;
  125.             review?: ReviewResponse;
  126.         };
  127.      }
  128.  }
  129.  
  130. /*
  131.  * Product END
  132.  */
  133.  
  134.  /*
  135.   * Cart
  136.   */
  137.  
  138. declare namespace CartResponse
  139. {
  140.     type List = ListItem[];
  141.     export interface ListItem
  142.     {
  143.         id: number;
  144.         quantity: number;
  145.         stock: number;
  146.     }
  147.  
  148.     type Store = StoreItem[];
  149.     export interface StoreItem
  150.     {
  151.         id: number;
  152.         code: number;
  153.     }
  154.  
  155.     type Product = ProductItem[];
  156.     export interface ProductItem
  157.     {
  158.         id: number;
  159.         name: string;
  160.         url: string;
  161.         image: Image;
  162.         stock: number;
  163.         price: number;
  164.         discount: number;
  165.         quantity: number;
  166.     }
  167. }
  168.  
  169. interface CartItem
  170. {
  171.     id: number;
  172.     quantity: number;
  173. }
  174.  
  175. declare type CartList = CartItem[];
  176.  
  177.  /*
  178.   * Cart END
  179.   */
  180.  
  181. /*
  182.  * Review
  183.  */
  184.  
  185. interface ReviewsResponse
  186. {
  187.     data: ReviewResponse[];
  188.     total: number;
  189. }
  190.  
  191. interface ReviewResponse
  192. {
  193.     id: number;
  194.     author_id: number;
  195.     author: string;
  196.     rate: number;
  197.     message: string;
  198.     created_at: number;
  199.     updated_at: number;
  200. }
  201.  
  202. /*
  203.  * Review END
  204.  */
  205.  
  206.  
  207.  /*
  208.   * User
  209.   */
  210.  
  211.  declare namespace User
  212.  {
  213.      export interface Address
  214.      {
  215.         id: number;
  216.         fullname: string;
  217.         phone: string;
  218.         country: number;
  219.         line1: string;
  220.         line2: string;
  221.         city: string;
  222.         state: string;
  223.         //postal: number;    
  224.      }
  225.  }
  226.  
  227.  
  228. /*
  229.  * User END
  230.  */
  231.  
  232. interface Token
  233. {
  234.     token_type: string;
  235.     expires_in: number;
  236.     access_token: string;
  237.     refresh_token?: string;
  238. }
  239.  
  240. interface SigninResponseError
  241. {
  242.     error: string;
  243.     message: string
  244. }
  245.  
  246. /*
  247.  * Category
  248.  */
  249.  
  250.  
  251. interface CategoryDataResponse
  252. {
  253.     category:
  254.     {
  255.         id: number;
  256.         url: string;
  257.         name: string;
  258.         breadcrumb: URL[];
  259.         tree: CategoryTree;
  260.         price: CategoryPrice;
  261.         specifications: CategoryFilter[];
  262.     };
  263.     products: ProductResponse.medium[];
  264.     pagination: Pagination;
  265. }
  266.  
  267. interface CategoryTreeItem
  268. {
  269.     id: number;
  270.     url: string;
  271.     name: string;
  272. }
  273.  
  274. interface CategoryTree
  275. {
  276.     parent: CategoryTreeItem;
  277.     childs: CategoryTreeItem[];
  278. }
  279.  
  280. interface CategoryPrice
  281. {
  282.     min: number;
  283.     max: number;
  284. }
  285.  
  286. interface CategoryFilter
  287. {
  288.     id: number;
  289.     name: string;
  290.     type: number;
  291.     fields: CategoryFilterField[];
  292.     ctrl?: any;
  293. }
  294.  
  295. interface CategoryFilterField
  296. {
  297.     id: number;
  298.     name: string;
  299. }
  300. /*
  301.  * Category END
  302.  */
  303.  
  304. /*
  305.  * Bug report
  306.  */
  307.  
  308. export interface BugReportData
  309. {
  310.     file: string;
  311.     browser_url: string;
  312.     api_url?: string;
  313.     api_body?: string;
  314.     api_type?: string;
  315.     response_error: string;
  316. }
  317.  
  318. /*
  319.  * Bug report END
  320.  */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top