@salla.sa/twilight 1.6.15 → 2.0.0

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/README.md +4 -214
  2. package/components/README.md +55 -0
  3. package/components/dist/cjs/index-9441fd8e.js +1554 -0
  4. package/components/dist/cjs/index.cjs.js +2 -0
  5. package/components/dist/cjs/loader.cjs.js +21 -0
  6. package/components/dist/cjs/salla-login_2.cjs.entry.js +131 -0
  7. package/components/dist/cjs/twilight-components.cjs.js +19 -0
  8. package/components/dist/collection/collection-manifest.json +13 -0
  9. package/components/dist/collection/components/generate-summary.js +35 -0
  10. package/components/dist/collection/components/salla-login/salla-login.css +104 -0
  11. package/components/dist/collection/components/salla-login/salla-login.js +113 -0
  12. package/components/dist/collection/components/search-modal/search-modal.css +9 -0
  13. package/components/dist/collection/components/search-modal/search-modal.js +161 -0
  14. package/components/dist/collection/index.js +1 -0
  15. package/components/dist/collection/interfaces/colors.js +1 -0
  16. package/components/dist/collection/interfaces/index.js +2 -0
  17. package/components/dist/collection/interfaces/ratio.js +1 -0
  18. package/components/dist/collection/plugins/tailwind-theme/index.js +32 -0
  19. package/components/dist/collection/plugins/tailwind-theme/scripts/generator.js +51 -0
  20. package/components/dist/collection/utils/utils.js +16 -0
  21. package/components/dist/esm/index-63e5409f.js +1527 -0
  22. package/components/dist/esm/index.js +1 -0
  23. package/components/dist/esm/loader.js +17 -0
  24. package/components/dist/esm/polyfills/core-js.js +11 -0
  25. package/components/dist/esm/polyfills/css-shim.js +1 -0
  26. package/components/dist/esm/polyfills/dom.js +79 -0
  27. package/components/dist/esm/polyfills/es5-html-element.js +1 -0
  28. package/components/dist/esm/polyfills/index.js +34 -0
  29. package/components/dist/esm/polyfills/system.js +6 -0
  30. package/components/dist/esm/salla-login_2.entry.js +126 -0
  31. package/components/dist/esm/twilight-components.js +17 -0
  32. package/components/dist/index.cjs.js +1 -0
  33. package/components/dist/index.js +1 -0
  34. package/components/dist/twilight-components/index.esm.js +0 -0
  35. package/components/dist/twilight-components/p-3d53781c.js +1 -0
  36. package/components/dist/twilight-components/p-fccb89fa.entry.js +1 -0
  37. package/components/dist/twilight-components/twilight-components.esm.js +1 -0
  38. package/components/dist/types/components/salla-login/salla-login.d.ts +14 -0
  39. package/components/dist/types/components/search-modal/search-modal.d.ts +26 -0
  40. package/components/dist/types/components.d.ts +76 -0
  41. package/components/dist/types/index.d.ts +6 -0
  42. package/components/dist/types/interfaces/colors.d.ts +1 -0
  43. package/components/dist/types/interfaces/index.d.ts +2 -0
  44. package/components/dist/types/interfaces/ratio.d.ts +1 -0
  45. package/components/dist/types/stencil-public-runtime.d.ts +1563 -0
  46. package/components/dist/types/utils/utils.d.ts +6 -0
  47. package/components/loader/cdn.js +3 -0
  48. package/components/loader/index.cjs.js +3 -0
  49. package/components/loader/index.d.ts +13 -0
  50. package/components/loader/index.es2017.js +3 -0
  51. package/components/loader/index.js +4 -0
  52. package/components/loader/package.json +10 -0
  53. package/components/package.json +70 -0
  54. package/components/src/plugins/tailwind-theme/index.js +32 -0
  55. package/components/src/plugins/tailwind-theme/package.json +27 -0
  56. package/components/src/plugins/tailwind-theme/readme.md +47 -0
  57. package/components/src/plugins/tailwind-theme/safe-list-css.txt +19 -0
  58. package/components/src/plugins/tailwind-theme/utilities.json +1 -0
  59. package/components.js +1 -0
  60. package/dist/twilight.js +2 -0
  61. package/dist/twilight.js.LICENSE.txt +27 -0
  62. package/package.json +53 -63
  63. package/postInstall.js +2 -0
  64. package/tailwind.js +1 -0
  65. package/tailwind_css_list.js +1 -0
  66. package/watcher.js +20 -62
  67. package/LICENSE.md +0 -674
  68. package/dist/@salla.sa/twilight.min.js +0 -20
  69. package/dist/@salla.sa/twilight.min.js.map +0 -1
  70. package/dist/cjs/index.js +0 -2
  71. package/dist/cjs/index.js.map +0 -1
  72. package/dist/esm/index.js +0 -2
  73. package/dist/esm/index.js.map +0 -1
  74. package/types/actions.d.ts +0 -47
  75. package/types/api/auth/index.d.ts +0 -17
  76. package/types/api/auth/request.d.ts +0 -42
  77. package/types/api/auth/response.d.ts +0 -22
  78. package/types/api/cart/index.d.ts +0 -24
  79. package/types/api/cart/request.d.ts +0 -8
  80. package/types/api/cart/response.d.ts +0 -66
  81. package/types/api/comment.d.ts +0 -18
  82. package/types/api/currency.d.ts +0 -17
  83. package/types/api/document.d.ts +0 -3
  84. package/types/api/index.d.ts +0 -110
  85. package/types/api/loyalty.d.ts +0 -226
  86. package/types/api/order.d.ts +0 -15
  87. package/types/api/product/index.d.ts +0 -17
  88. package/types/api/product/request.d.ts +0 -53
  89. package/types/api/product/response.d.ts +0 -103
  90. package/types/api/profile.d.ts +0 -60
  91. package/types/api/rating.d.ts +0 -49
  92. package/types/api/scope.d.ts +0 -42
  93. package/types/api/wishlist.d.ts +0 -7
  94. package/types/common.d.ts +0 -75
  95. package/types/event/auth.d.ts +0 -18
  96. package/types/event/cart.d.ts +0 -30
  97. package/types/event/comment.d.ts +0 -7
  98. package/types/event/currency.d.ts +0 -9
  99. package/types/event/document.d.ts +0 -29
  100. package/types/event/index.d.ts +0 -48
  101. package/types/event/infiniteScroll.d.ts +0 -12
  102. package/types/event/loyalty.d.ts +0 -14
  103. package/types/event/order.d.ts +0 -11
  104. package/types/event/product.d.ts +0 -30
  105. package/types/event/profile.d.ts +0 -19
  106. package/types/event/rating.d.ts +0 -13
  107. package/types/event/scope.d.ts +0 -15
  108. package/types/event/wishlist.d.ts +0 -8
  109. package/types/helpers/app-helpers.d.ts +0 -29
  110. package/types/index.d.ts +0 -37
  111. package/types/lib/config.ts +0 -14
  112. package/types/lib/form.d.ts +0 -8
  113. package/types/lib/lang.d.ts +0 -14
  114. package/types/lib/notify.d.ts +0 -14
  115. package/types/tiwlight-config.d.ts +0 -74
package/types/index.d.ts DELETED
@@ -1,37 +0,0 @@
1
- import TwilightEmitter from './event';
2
- import Api, {ApiActionName} from "./api";
3
- import SallaActions from "./actions";
4
-
5
- import Config from "./lib/config";
6
- import AppHelpers from "./helpers/app-helpers";
7
- import SallaNotify from "./lib/notify";
8
- import SallaLang from "./lib/lang";
9
- import SallaForm from "./lib/form";
10
- import {TwilightConfig} from "./tiwlight-config";
11
-
12
- export default interface Salla extends SallaActions {
13
- onReady: (callback: (event: Event) => unknown) => void; //relay on it, it will be available even salla object is not loaded yet
14
-
15
- api: Api;
16
- event: TwilightEmitter;
17
-
18
- config: TwilightConfig;
19
- lang: SallaLang;
20
-
21
- notify: SallaNotify;
22
- success: (message: string, data?: any) => void;
23
- error: (message: string, data?: any) => void;
24
-
25
- AppHelpers: AppHelpers;
26
- form: SallaForm;
27
- isInitiated: boolean; // will be true when firing event `twilight::initiated`
28
- init: (config: TwilightConfig) => void; // an alias for `salla.twilight.init(config)`
29
- call: (action: ApiActionName | string) => any;
30
-
31
- onInitiated: (callback) => void; // don't relay on it because Salla may not existed yet
32
- }
33
-
34
- declare global {
35
- // @ts-ignore
36
- let salla: Salla, Salla: Salla;
37
- }
@@ -1,14 +0,0 @@
1
- import { Language, TwilightConfig } from "../tiwlight-config";
2
- import { Currency, Price } from "../common";
3
- import { default as SallaConfig } from "@salla.sa/base/types/config";
4
-
5
- export default interface Config extends SallaConfig {
6
- merge: (config: TwilightConfig) => Config;
7
- isRTL: () => boolean;
8
- money: (money: number | Price) => string;
9
- isUser: () => boolean;
10
- isGuest: () => boolean;
11
- currency: (code?: string | 'SAR') => Currency;
12
- currencies: () => Promise<{ SAR: Currency, [iso_code: string]: Currency }>;
13
- languages: () => Promise<Language[]>;
14
- }
@@ -1,8 +0,0 @@
1
- import {ApiActionName} from "../api";
2
-
3
- export default interface SallaForm {
4
- submit: (action: ApiActionName|string, eventOrData: Event | Object) => Promise<any>;
5
- onSubmit: (action: ApiActionName|string, eventOrData: Event | Object) => false;
6
- onChange: (action: ApiActionName|string, eventOrData: Event | Object) => false;
7
- getPossibleValue(formData: object|FormData, possibleNames: Array<string>, objectable?: boolean): object | FormData | string | undefined;
8
- }
@@ -1,14 +0,0 @@
1
- import Lang from 'lang.js'
2
-
3
- type Replacements = { [key: string]: string }
4
-
5
- /**
6
- * @Example
7
- * salla.lang.get('pages.cart.free_shipping_alert',{amount:salla.money(100)})
8
- */
9
- export default interface SallaLang extends Lang {
10
- translationsLoaded: boolean;
11
- onLoaded: (callback: Function) => void;
12
- get: (key: string, replacements?: Replacements, locale?: string | 'ar') => string;
13
- set: (key: string, message: string) => SallaLang;
14
- }
@@ -1,14 +0,0 @@
1
- export type NotifyType = 'error' | 'success' | 'info' | string;
2
- export type Notifier = (message: string, type: NotifyType, data?: object | any) => void | unknown;
3
- export type Logger = (...data: string[]) => void | unknown;
4
- export default interface SallaNotify {
5
- fire: (message: string, type: NotifyType, data?: object | any) => Notifier; //default is just `alert(message)
6
- setNotifier: (callback: Notifier) => void;// handy to override notifier used by salla.notify.fire(salla.success, salla.error, salla.info)
7
- log: Logger; //default is just `console.log(...data)`
8
- setLogger: (callback: Logger) => void;// handy to override logger used by salla.log()
9
- error: (message: string, data?: object | any) => Notifier; //an alias for fire(message, salla.notify.types.error, data)
10
- success: (message: string, data?: object | any) => Notifier; //an alias for fire(message, salla.notify.types.success, data)
11
- info: (message: string, data?: object | any) => Notifier; //an alias for fire(message, salla.notify.types.info, data)
12
- sallaInitiated;
13
- types: { error: 'error', success: 'success', info: 'info' }; //handy to be overridden, to be passed via salla.error, salla.info, salla.success second argument when calling salla.notify.fire(message, /*{type}*/, data)
14
- }
@@ -1,74 +0,0 @@
1
- import {Currency} from "./common";
2
-
3
- export interface Language {
4
- name: string;
5
- code: string;
6
- url: string;
7
- is_rtl: boolean;
8
- country_code: string;
9
- }
10
-
11
- type Installment = 'tabby_installment' | 'tamara_installment' | 'spotii_pay';
12
- type PaymentName = Installment | 'mada' | 'credit_card' | 'paypal' | 'bank' | 'stc_pay' | 'apple_pay' | 'knet';
13
-
14
- export interface TwilightConfig {
15
- /**
16
- * @deprecated
17
- */
18
- _token?: string;
19
-
20
- maintenance?: boolean;
21
- debug?: boolean;
22
- events?: { [event_name: string]: any };
23
- sdk?: {
24
- notifier_handler_disabled: boolean
25
- },
26
- store: {
27
- url: string;
28
- id: number;
29
- logo?: string;
30
- name?: string;
31
- api?: string;
32
- settings?: {
33
- auth: {
34
- email_allowed: boolean;
35
- mobile_allowed: boolean;
36
- is_email_required: boolean;
37
- };
38
- arabic_numbers_enabled: boolean;
39
- payments: PaymentName[];
40
- installments: Installment[];
41
- };
42
- };
43
- user?: {
44
- type?: 'user' | 'guest';
45
- id?: string | number;
46
- email?: any;
47
- mobile?: any;
48
- language_code?: string;
49
- currency_code?: string;
50
- country_code?: string;
51
- };
52
- theme?: {
53
- name?: string;
54
- mode?: string;
55
- translations_hash?: string;
56
- color?: {
57
- primary: string | '#5cd5c4';
58
- text: string | '#ffffff';
59
- is_dark: boolean;
60
- reverse_primary: string | '#5cd5c4';
61
- reverse_text: string | '#005544';
62
- }
63
- };
64
- languages?: Language[];
65
- currencies?: {
66
- SAR?: Currency;
67
- [key: string]: Currency;
68
- };
69
- page?: {
70
- title?: string;
71
- slug?: string;
72
- id?: number;//available in product.single, customer.orders.single, cart, thank-you, page-single
73
- };
74
- }