merchi_sdk_js 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. package/dist/address.js +109 -0
  2. package/dist/assignment.js +175 -0
  3. package/dist/automatic_payment_relationship.js +72 -0
  4. package/dist/backup.js +32 -0
  5. package/dist/bank.js +25 -0
  6. package/dist/cart.js +133 -0
  7. package/dist/cart_item.js +71 -0
  8. package/dist/cart_shipment_group.js +23 -0
  9. package/dist/cart_shipment_quote.js +26 -0
  10. package/dist/category.js +68 -0
  11. package/dist/company.js +248 -0
  12. package/dist/company_invitation.js +70 -0
  13. package/dist/component.js +107 -0
  14. package/dist/component_tag.js +60 -0
  15. package/dist/component_version.js +21 -0
  16. package/dist/country_tax.js +93 -0
  17. package/dist/dictionary.js +130 -0
  18. package/dist/discount.js +22 -0
  19. package/dist/discount_group.js +18 -0
  20. package/dist/domain.js +245 -0
  21. package/dist/domain_invitation.js +17 -0
  22. package/dist/domain_tag.js +87 -0
  23. package/dist/domain_types.js +22 -0
  24. package/dist/draft.js +97 -0
  25. package/dist/draft_comment.js +45 -0
  26. package/dist/draft_template.js +39 -0
  27. package/dist/email_address.js +34 -0
  28. package/dist/email_counter.js +47 -0
  29. package/dist/enrolled_domain.js +88 -0
  30. package/dist/exchange_rate.js +66 -0
  31. package/dist/field_types.js +19 -0
  32. package/dist/helpers.js +86 -0
  33. package/dist/internal_tag.js +98 -0
  34. package/dist/inventory.js +100 -0
  35. package/dist/inventory_unit_variation.js +19 -0
  36. package/dist/invoice.js +225 -0
  37. package/dist/invoice_types.js +11 -0
  38. package/dist/item.js +25 -0
  39. package/dist/job.js +536 -0
  40. package/dist/job_comment.js +45 -0
  41. package/dist/job_status.js +47 -0
  42. package/dist/matching_inventory.js +21 -0
  43. package/dist/md5.js +149 -0
  44. package/dist/menu.js +37 -0
  45. package/dist/menu_item.js +24 -0
  46. package/dist/merchi.js +1004 -0
  47. package/dist/merchi_file.js +165 -0
  48. package/dist/model.js +753 -0
  49. package/dist/notification.js +151 -0
  50. package/dist/notification_types.js +199 -0
  51. package/dist/output.cjs.js +31317 -0
  52. package/dist/output.esm.js +31312 -0
  53. package/dist/page.js +41 -0
  54. package/dist/payment.js +32 -0
  55. package/dist/payment_device.js +21 -0
  56. package/dist/payment_types.js +20 -0
  57. package/dist/phone_number.js +37 -0
  58. package/dist/product.js +288 -0
  59. package/dist/product_types.js +32 -0
  60. package/dist/production_comment.js +44 -0
  61. package/dist/quote.js +91 -0
  62. package/dist/quote_item.js +59 -0
  63. package/dist/roles.js +29 -0
  64. package/dist/seo_domain_page.js +42 -0
  65. package/dist/session.js +103 -0
  66. package/dist/set.js +29 -0
  67. package/dist/shipment.js +181 -0
  68. package/dist/shipment_item.js +17 -0
  69. package/dist/shipment_item_fulfillment.js +17 -0
  70. package/dist/shipment_method.js +81 -0
  71. package/dist/shipment_method_variation.js +38 -0
  72. package/dist/subscription_plan.js +75 -0
  73. package/dist/supply_domain.js +65 -0
  74. package/dist/system_role.js +12 -0
  75. package/dist/theme.js +180 -0
  76. package/dist/theme_css_setting.js +61 -0
  77. package/dist/theme_status.js +11 -0
  78. package/dist/user.js +409 -0
  79. package/dist/user_company.js +19 -0
  80. package/dist/user_types.js +23 -0
  81. package/dist/uuid.js +12 -0
  82. package/dist/variation.js +233 -0
  83. package/dist/variation_field.js +233 -0
  84. package/dist/variation_fields_option.js +41 -0
  85. package/dist/variation_option.js +62 -0
  86. package/dist/variations_group.js +43 -0
  87. package/dist/white_label_accessibilities.js +11 -0
  88. package/package.json +30 -0
  89. package/src/address.js +107 -0
  90. package/src/assignment.js +165 -0
  91. package/src/automatic_payment_relationship.js +65 -0
  92. package/src/backup.js +29 -0
  93. package/src/bank.js +21 -0
  94. package/src/cart.js +131 -0
  95. package/src/cart_item.js +71 -0
  96. package/src/cart_shipment_group.js +20 -0
  97. package/src/cart_shipment_quote.js +23 -0
  98. package/src/category.js +62 -0
  99. package/src/company.js +267 -0
  100. package/src/company_invitation.js +63 -0
  101. package/src/component.js +100 -0
  102. package/src/component_tag.js +53 -0
  103. package/src/component_version.js +17 -0
  104. package/src/country_tax.js +89 -0
  105. package/src/dictionary.js +135 -0
  106. package/src/discount.js +19 -0
  107. package/src/discount_group.js +15 -0
  108. package/src/domain.js +254 -0
  109. package/src/domain_invitation.js +13 -0
  110. package/src/domain_tag.js +79 -0
  111. package/src/domain_types.js +18 -0
  112. package/src/draft.js +92 -0
  113. package/src/draft_comment.js +41 -0
  114. package/src/draft_template.js +35 -0
  115. package/src/email_address.js +27 -0
  116. package/src/email_counter.js +42 -0
  117. package/src/enrolled_domain.js +79 -0
  118. package/src/exchange_rate.js +61 -0
  119. package/src/field_types.js +15 -0
  120. package/src/helpers.js +81 -0
  121. package/src/internal_tag.js +90 -0
  122. package/src/inventory.js +99 -0
  123. package/src/inventory_unit_variation.js +18 -0
  124. package/src/invoice.js +224 -0
  125. package/src/invoice_types.js +7 -0
  126. package/src/item.js +22 -0
  127. package/src/job.js +616 -0
  128. package/src/job_comment.js +41 -0
  129. package/src/job_status.js +51 -0
  130. package/src/matching_inventory.js +17 -0
  131. package/src/md5.js +162 -0
  132. package/src/menu.js +32 -0
  133. package/src/menu_item.js +22 -0
  134. package/src/merchi.js +1074 -0
  135. package/src/merchi_file.js +163 -0
  136. package/src/model.js +820 -0
  137. package/src/notification.js +153 -0
  138. package/src/notification_types.js +246 -0
  139. package/src/page.js +38 -0
  140. package/src/payment.js +32 -0
  141. package/src/payment_device.js +17 -0
  142. package/src/payment_types.js +18 -0
  143. package/src/phone_number.js +30 -0
  144. package/src/product.js +309 -0
  145. package/src/product_types.js +28 -0
  146. package/src/production_comment.js +40 -0
  147. package/src/quote.js +89 -0
  148. package/src/quote_item.js +51 -0
  149. package/src/roles.js +27 -0
  150. package/src/seo_domain_page.js +35 -0
  151. package/src/session.js +102 -0
  152. package/src/set.js +28 -0
  153. package/src/shipment.js +191 -0
  154. package/src/shipment_item.js +13 -0
  155. package/src/shipment_item_fulfillment.js +13 -0
  156. package/src/shipment_method.js +73 -0
  157. package/src/shipment_method_variation.js +34 -0
  158. package/src/subscription_plan.js +68 -0
  159. package/src/supply_domain.js +60 -0
  160. package/src/system_role.js +8 -0
  161. package/src/theme.js +188 -0
  162. package/src/theme_css_setting.js +54 -0
  163. package/src/theme_status.js +6 -0
  164. package/src/user.js +442 -0
  165. package/src/user_company.js +15 -0
  166. package/src/user_types.js +19 -0
  167. package/src/uuid.js +3 -0
  168. package/src/variation.js +257 -0
  169. package/src/variation_field.js +261 -0
  170. package/src/variation_fields_option.js +41 -0
  171. package/src/variation_option.js +59 -0
  172. package/src/variations_group.js +43 -0
  173. package/src/white_label_accessibilities.js +6 -0
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Notification = Notification;
7
+ exports.Notifications = Notifications;
8
+ var _uuid = require("./uuid.js");
9
+ var _model = require("./model.js");
10
+ var _notification_types = require("./notification_types.js");
11
+ var _user = require("./user.js");
12
+ var _domain = require("./domain.js");
13
+ var _job = require("./job.js");
14
+ var _merchi_file = require("./merchi_file.js");
15
+ var _draft_comment = require("./draft_comment.js");
16
+ var _job_comment = require("./job_comment.js");
17
+ var _production_comment = require("./production_comment.js");
18
+ var _invoice = require("./invoice.js");
19
+ function Notification() {
20
+ this.resource = '/notifications';
21
+ this.json = 'notification';
22
+ this.temporaryId = (0, _uuid.generateUUID)();
23
+ (0, _model.addPropertyTo)(this, 'id');
24
+ (0, _model.addPropertyTo)(this, 'recipient', _user.User);
25
+ (0, _model.addPropertyTo)(this, 'sender', _user.User);
26
+ (0, _model.addPropertyTo)(this, 'date');
27
+ (0, _model.addPropertyTo)(this, 'domain', _domain.Domain);
28
+ (0, _model.addPropertyTo)(this, 'relatedJob', _job.Job);
29
+ (0, _model.addPropertyTo)(this, 'attachment', _merchi_file.MerchiFile);
30
+ (0, _model.addPropertyTo)(this, 'seen');
31
+ (0, _model.addPropertyTo)(this, 'htmlMessage');
32
+ (0, _model.addPropertyTo)(this, 'description');
33
+ (0, _model.addPropertyTo)(this, 'urgency');
34
+ (0, _model.addPropertyTo)(this, 'subject');
35
+ (0, _model.addPropertyTo)(this, 'message');
36
+ (0, _model.addPropertyTo)(this, 'link');
37
+ (0, _model.addPropertyTo)(this, 'section');
38
+ (0, _model.addPropertyTo)(this, 'sendSms');
39
+ (0, _model.addPropertyTo)(this, 'sendEmail');
40
+ (0, _model.addPropertyTo)(this, 'notificationType');
41
+ (0, _model.addPropertyTo)(this, 'relatedJobComment', _job_comment.JobComment);
42
+ (0, _model.addPropertyTo)(this, 'relatedDraftComment', _draft_comment.DraftComment);
43
+ (0, _model.addPropertyTo)(this, 'relatedProductionComment', _production_comment.ProductionComment);
44
+ (0, _model.addPropertyTo)(this, 'relatedInvoice', _invoice.Invoice);
45
+ this.title = function () {
46
+ if (this.subject() && this.subject() !== 'None') {
47
+ if (this.relatedJob()) {
48
+ return this.subject() + " - " + this.domain().emailDomain();
49
+ }
50
+ return this.subject();
51
+ }
52
+ return this.description();
53
+ };
54
+ this.create = function (success, error, embed, as_domain) {
55
+ var data = (0, _model.serialise)(this),
56
+ self = this;
57
+ function handleResponse(result) {
58
+ success((0, _model.fromJson)(self, result[self.json]));
59
+ }
60
+ (0, _model.create)({
61
+ resource: this.resource,
62
+ parameters: data[0],
63
+ files: (0, _model.enumerateFiles)(data[1]),
64
+ success: handleResponse,
65
+ as_domain: as_domain,
66
+ error: error,
67
+ embed: embed
68
+ });
69
+ };
70
+ this.get = function (success, error, embed) {
71
+ var self = this;
72
+ function handleResponse(result) {
73
+ success((0, _model.fromJson)(self, result[self.json], {
74
+ makesDirty: false
75
+ }));
76
+ }
77
+ (0, _model.getOne)({
78
+ resource: this.resource,
79
+ id: this.id(),
80
+ success: handleResponse,
81
+ error: error,
82
+ embed: embed
83
+ });
84
+ };
85
+ this.patch = function (success, error, embed, asDomain) {
86
+ var self = this,
87
+ data = (0, _model.serialise)(this, undefined, undefined, undefined, {
88
+ excludeOld: true
89
+ })[0],
90
+ domainId = Boolean(asDomain) ? asDomain.id() : null;
91
+ function handleResponse(result) {
92
+ success((0, _model.fromJson)(self, result[self.json], {
93
+ makesDirty: false
94
+ }));
95
+ }
96
+ (0, _model.patchOne)({
97
+ resource: this.resource,
98
+ id: this.id(),
99
+ success: handleResponse,
100
+ error: error,
101
+ as_domain: domainId,
102
+ data: data,
103
+ embed: embed
104
+ });
105
+ };
106
+ this.avatarUrl = function () {
107
+ var noteType = this.notificationType(),
108
+ sender = this.sender(),
109
+ senderAvatarUri = sender && sender.profilePicture() ? sender.profilePictureUrl() : null,
110
+ domain = this.domain(),
111
+ domainAvatarUri = domain && domain.logo() ? domain.logo().viewUrl() : null;
112
+ if ((0, _notification_types.isAvatarTypeInNotificationAvatar)('SHOW_USER_AVATAR', noteType)) {
113
+ return senderAvatarUri;
114
+ } else if ((0, _notification_types.isAvatarTypeInNotificationAvatar)('SHOW_DOMAIN_AVATAR', noteType)) {
115
+ return domainAvatarUri;
116
+ } else if ((0, _notification_types.isAvatarTypeInNotificationAvatar)('SHOW_USER_OR_DOMAIN_AVATAR', noteType)) {
117
+ return sender ? senderAvatarUri : domainAvatarUri;
118
+ } else if ((0, _notification_types.isAvatarTypeInNotificationAvatar)('SHOW_DOMAIN_OR_USER_AVATAR', noteType)) {
119
+ return domain ? domainAvatarUri : senderAvatarUri;
120
+ }
121
+ return domainAvatarUri;
122
+ };
123
+ this.iconClass = function () {
124
+ return _notification_types.notificationSectionIconClass.get(this.section());
125
+ };
126
+ this.checkKeyValue = function (key, value) {
127
+ var self = this;
128
+ if (self[key]() === value) {
129
+ return self;
130
+ }
131
+ return null;
132
+ };
133
+ this.notificationTypeKey = function () {
134
+ var noteType = this.notificationType();
135
+ return noteType ? _notification_types.notificationTypesKeys.get(noteType) : null;
136
+ };
137
+ }
138
+ function Notifications() {
139
+ this.resource = '/notifications';
140
+ this.json = 'notifications';
141
+ this.single = Notification;
142
+ this.get = function (success, error, queryObject) {
143
+ var self = this;
144
+ function handleResponse(result) {
145
+ success((0, _model.fromJsonList)(self, result, {
146
+ makesDirty: false
147
+ }));
148
+ }
149
+ (0, _model.getList)(this.resource, handleResponse, error, queryObject);
150
+ };
151
+ }
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isAvatarTypeInNotificationAvatar = isAvatarTypeInNotificationAvatar;
7
+ exports.notificationAvatar = void 0;
8
+ exports.notificationRecieverIsCurrentUserFilter = notificationRecieverIsCurrentUserFilter;
9
+ exports.notificationTypesKeys = exports.notificationTypes = exports.notificationSectionKey = exports.notificationSectionIconClass = exports.notificationSectionCodes = exports.notificationSectionClass = exports.notificationSection = void 0;
10
+ exports.notificationsFilter = notificationsFilter;
11
+ exports.showUserOrDomainAvatarArray = exports.showUserAvatarArray = exports.showDomainOrUserAvatarArray = exports.showDomainAvatarArray = void 0;
12
+ var _dictionary = require("./dictionary.js");
13
+ var _helpers = require("./helpers.js");
14
+ var showUserAvatarArray = exports.showUserAvatarArray = ['DRAFT_SENT', 'DRAFT_CHANGE_REQUEST', 'DRAFT_APPROVED', 'DRAFT_COMMENT', 'JOB_COMMENT', 'PRODUCTION_COMMENT', 'PRODUCTION_FILE_UPLOADED', 'PRODUCTION_FINISHED', 'PRODUCTION_COMMENCED', 'QUOTE_APPROVED', 'SHIPMENT_UPDATE', 'JOB_FILE_UPLOADED'];
15
+ var showDomainAvatarArray = exports.showDomainAvatarArray = ['NO_TYPE', 'DESIGNER_ASSIGNED', 'DESIGNER_CHANGED', 'SEND_INVOICE', 'JOB_STALE', 'MANAGER_ASSIGNED', 'ORDER_RECEIVED', 'CLIENT_CHANGED', 'PRODUCTION_CANCELLED', 'QUOTE_FAILED', 'QUOTE_COMMENCED', 'QUOTE_EXPIRED', 'SUPPLIER_ASSIGNED', 'READY_FOR_SHIPPING', 'SIGN_UP_CONFIRMATION', 'CRASH_EVENT', 'MANAGER_SUMMARY', 'PASSWORD_RESET', 'MANAGER_REASSIGNED', 'EMAIL_RESPONSE', 'SHIPMENT_EXPECTED_DATE_PAST', 'DOMAIN_INVITATION', 'MOD_SELLER_SUMMARY', 'MOD_SUPPLIER_SUMMARY'];
16
+ var showUserOrDomainAvatarArray = exports.showUserOrDomainAvatarArray = ['JOB_PAID', 'INVOICE_PAID', 'PAYMENT_ACCEPTED', 'AUTOMATIC_JOB_RESPONSE', 'JOB_NOTIFICATION', 'JOB_REMINDER', 'GENERAL_REMINDER', 'INVOICE_EMAIL_RESPONSE', 'AUTOMATIC_INVOICE_RESPONSE', 'JOB_ADDED_TO_SHIPMENT', 'JOB_REMOVED_FROM_SHIPMENT', 'ASSIGNMENT_REMOVED_FROM_SHIPMENT', 'SHIPMENT_EXPECTED_DATE_PAST', 'ASSIGNMENT_ADDED_TO_SHIPMENT'];
17
+ var showDomainOrUserAvatarArray = exports.showDomainOrUserAvatarArray = ['SHIPMENT_DISPATCH_CLOSE', 'SHIPMENT_NOT_DISPATCHED', 'SHIPMENT_EXPECTED_DATE_WARNING', 'SHIPMENT_EXPECTED_DATE_PAST'];
18
+ var notificationTypes = exports.notificationTypes = new _dictionary.Dictionary();
19
+ notificationTypes.add("NO_TYPE", 0);
20
+ notificationTypes.add("DRAFT_SENT", 1);
21
+ notificationTypes.add("DRAFT_CHANGE_REQUEST", 2);
22
+ notificationTypes.add("DRAFT_APPROVED", 3);
23
+ notificationTypes.add("DESIGNER_ASSIGNED", 4);
24
+ notificationTypes.add("DESIGNER_CHANGED", 5);
25
+ notificationTypes.add("DRAFT_COMMENT", 6);
26
+ notificationTypes.add("JOB_PAID", 7);
27
+ notificationTypes.add("INVOICE_PAID", 8);
28
+ notificationTypes.add("PAYMENT_ACCEPTED", 9);
29
+ notificationTypes.add("SEND_INVOICE", 10);
30
+ notificationTypes.add("JOB_COMMENT", 11);
31
+ notificationTypes.add("PRODUCTION_COMMENT", 12);
32
+ notificationTypes.add("JOB_STALE", 13);
33
+ notificationTypes.add("MANAGER_ASSIGNED", 14);
34
+ notificationTypes.add("ORDER_RECEIVED", 15);
35
+ notificationTypes.add("CLIENT_CHANGED", 16);
36
+ notificationTypes.add("PRODUCTION_FILE_UPLOADED", 17);
37
+ notificationTypes.add("PRODUCTION_CANCELLED", 18);
38
+ notificationTypes.add("PRODUCTION_FINISHED", 19);
39
+ notificationTypes.add("PRODUCTION_COMMENCED", 20);
40
+ notificationTypes.add("QUOTE_APPROVED", 21);
41
+ notificationTypes.add("QUOTE_REFUSED", 22);
42
+ notificationTypes.add("QUOTE_SUBMITTED", 23);
43
+ notificationTypes.add("QUOTE_FAILED", 24);
44
+ notificationTypes.add("QUOTE_COMMENCED", 25);
45
+ notificationTypes.add("QUOTE_EXPIRED", 26);
46
+ notificationTypes.add("SUPPLIER_ASSIGNED", 27);
47
+ notificationTypes.add("SUPPLIER_REFUSED", 28);
48
+ notificationTypes.add("READY_FOR_SHIPPING", 29);
49
+ notificationTypes.add("SHIPMENT_UPDATE", 30);
50
+ notificationTypes.add("SIGN_UP_CONFIRMATION", 31);
51
+ notificationTypes.add("AUTOMATIC_JOB_RESPONSE", 32);
52
+ notificationTypes.add("CRASH_EVENT", 33);
53
+ notificationTypes.add("MANAGER_SUMMARY", 34);
54
+ notificationTypes.add("PASSWORD_RESET", 35);
55
+ notificationTypes.add("MANAGER_REASSIGNED", 36);
56
+ notificationTypes.add("EMAIL_RESPONSE", 37);
57
+ notificationTypes.add("JOB_NOTIFICATION", 38);
58
+ notificationTypes.add("JOB_REMINDER", 39);
59
+ notificationTypes.add("GENERAL_REMINDER", 40);
60
+ notificationTypes.add("INVOICE_EMAIL_RESPONSE", 41);
61
+ notificationTypes.add("AUTOMATIC_INVOICE_RESPONSE", 42);
62
+ notificationTypes.add("SHIPMENT_DISPATCH_CLOSE", 43);
63
+ notificationTypes.add("SHIPMENT_NOT_DISPATCHED", 44);
64
+ notificationTypes.add("SHIPMENT_EXPECTED_DATE_WARNING", 45);
65
+ notificationTypes.add("JOB_ADDED_TO_SHIPMENT", 46);
66
+ notificationTypes.add("JOB_REMOVED_FROM_SHIPMENT", 47);
67
+ notificationTypes.add("ASSIGNMENT_REMOVED_FROM_SHIPMENT", 48);
68
+ notificationTypes.add("ASSIGNMENT_ADDED_TO_SHIPMENT", 49);
69
+ notificationTypes.add("SHIPMENT_EXPECTED_DATE_PAST", 50);
70
+ notificationTypes.add("JOB_FILE_UPLOADED", 51);
71
+ notificationTypes.add("DOMAIN_INVITATION", 52);
72
+ notificationTypes.add("QUOTE_JOB_SUBMITTED", 53);
73
+ notificationTypes.add("QUOTE_JOB_RECEIVED", 54);
74
+ notificationTypes.add("QUOTE_JOB_UPDATED", 55);
75
+ notificationTypes.add("QUOTE_JOB_UPDATED_SENT", 56);
76
+ notificationTypes.add("QUOTE_JOB_APPROVED", 57);
77
+ notificationTypes.add("QUOTE_JOB_APPROVED_SENT", 58);
78
+ notificationTypes.add("JOB_NOTIFICATION_COMMENT", 59);
79
+ notificationTypes.add("PRODUCTION_SHIPPED", 60);
80
+ notificationTypes.add("SELLER_STORE_CREATED", 61);
81
+ notificationTypes.add("WEB_FORM", 62);
82
+ notificationTypes.add("CREATE_DOMAIN_FOR_MOD_PRODUCT", 63);
83
+ notificationTypes.add("RESELL_REQUEST_SUBMITTED", 64);
84
+ notificationTypes.add("RESELL_REQUEST_RECEIVED", 65);
85
+ notificationTypes.add("MOD_PRODUCT_READY_FOR_SALE", 66);
86
+ notificationTypes.add("ADDED_TO_COMPANY", 67);
87
+ notificationTypes.add("PRODUCTION_COMPLETED", 68);
88
+ notificationTypes.add("SUPPLIER_PRODUCT_READY_FOR_SALE", 69);
89
+ notificationTypes.add("STORE_ASSIGNED_TO_YOU", 70);
90
+ notificationTypes.add("CLIENT_STORE_CREATED", 71);
91
+ notificationTypes.add("MOD_SELLER_SUMMARY", 72);
92
+ notificationTypes.add("MOD_SUPPLIER_SUMMARY", 73);
93
+ var notificationTypesKeys = exports.notificationTypesKeys = new _dictionary.Dictionary();
94
+ notificationTypes.each(function (key, value) {
95
+ notificationTypesKeys.add(value, key);
96
+ });
97
+ var notificationAvatar = exports.notificationAvatar = new _dictionary.Dictionary();
98
+ function makeNotificationAvatarArray(listOfAvatarKeys) {
99
+ var avatarIdArray = [],
100
+ i;
101
+ for (i = 0; i < listOfAvatarKeys.length; i++) {
102
+ avatarIdArray.push(notificationTypes.get(listOfAvatarKeys[i]));
103
+ }
104
+ return avatarIdArray;
105
+ }
106
+ notificationAvatar.add('SHOW_USER_AVATAR', makeNotificationAvatarArray(showUserAvatarArray));
107
+ notificationAvatar.add('SHOW_DOMAIN_AVATAR', makeNotificationAvatarArray(showDomainAvatarArray));
108
+ notificationAvatar.add('SHOW_USER_OR_DOMAIN_AVATAR', makeNotificationAvatarArray(showUserOrDomainAvatarArray));
109
+ notificationAvatar.add('SHOW_DOMAIN_OR_USER_AVATAR', makeNotificationAvatarArray(showDomainOrUserAvatarArray));
110
+ function notificationsFilter(notificationsArray, filterObjectArray) {
111
+ /* Takes an array of notifications and a filter, loops over
112
+ the notifications array and checks to see
113
+ if any of the filters in the filter object apply.
114
+ */
115
+ var notifications = Boolean(notificationsArray) ? notificationsArray : [],
116
+ updatedArray = [],
117
+ filterObject,
118
+ key,
119
+ i;
120
+ function checkNotifications(attributeString, attributeValue) {
121
+ var i, notification;
122
+ for (i = 0; i < notifications.length; i++) {
123
+ notification = notifications[i].checkKeyValue(attributeString, attributeValue);
124
+ if (Boolean(notification)) {
125
+ updatedArray.push(notification);
126
+ }
127
+ }
128
+ }
129
+ for (i = 0; i < filterObjectArray.length; i++) {
130
+ filterObject = filterObjectArray[i];
131
+ for (key in filterObject) {
132
+ if (Object.prototype.hasOwnProperty.call(filterObject, key)) {
133
+ checkNotifications(key, filterObject[key]);
134
+ }
135
+ }
136
+ }
137
+ return updatedArray;
138
+ }
139
+ function notificationRecieverIsCurrentUserFilter(currentUser, notificationsArray) {
140
+ var notifications = Boolean(notificationsArray) ? notificationsArray : [],
141
+ updatedArray = [],
142
+ i;
143
+ for (i = 0; i < notifications.length; i++) {
144
+ if (Boolean(notifications[i].recipient()) && notifications[i].recipient().id() === currentUser.id()) {
145
+ updatedArray.push(notifications[i]);
146
+ }
147
+ }
148
+ return updatedArray;
149
+ }
150
+ function isAvatarTypeInNotificationAvatar(avatarTypeString, noteType) {
151
+ var avatarType = notificationAvatar.get(avatarTypeString);
152
+ return (0, _helpers.any)(avatarType, function (type) {
153
+ return type === noteType;
154
+ });
155
+ }
156
+ var notificationSection = exports.notificationSection = new _dictionary.Dictionary();
157
+ notificationSection.add(0, "system");
158
+ notificationSection.add(1, "user");
159
+ notificationSection.add(2, "info");
160
+ notificationSection.add(3, "design");
161
+ notificationSection.add(4, "production");
162
+ notificationSection.add(5, "invoicing");
163
+ notificationSection.add(6, "shipping");
164
+ notificationSection.add(7, "invoice");
165
+ notificationSection.add(8, "notifications");
166
+ notificationSection.add(9, "reminder");
167
+ notificationSection.add(10, "web form");
168
+ var notificationSectionKey = exports.notificationSectionKey = new _dictionary.Dictionary();
169
+ notificationSection.each(function (key, value) {
170
+ notificationSectionKey.add(value, key);
171
+ });
172
+ var notificationSectionClass = exports.notificationSectionClass = new _dictionary.Dictionary();
173
+ notificationSectionClass.add(0, "default");
174
+ notificationSectionClass.add(1, "danger");
175
+ notificationSectionClass.add(2, "dark");
176
+ notificationSectionClass.add(3, "success");
177
+ notificationSectionClass.add(4, "warning");
178
+ notificationSectionClass.add(5, "primary");
179
+ notificationSectionClass.add(6, "info");
180
+ notificationSectionClass.add(7, "primary");
181
+ notificationSectionClass.add(8, "dark");
182
+ notificationSectionClass.add(9, "default");
183
+ notificationSectionClass.add(10, "default");
184
+ var notificationSectionIconClass = exports.notificationSectionIconClass = new _dictionary.Dictionary();
185
+ notificationSectionIconClass.add(0, "fa fa-server");
186
+ notificationSectionIconClass.add(1, "icon_m_single_user");
187
+ notificationSectionIconClass.add(2, "icon_m_job_singular");
188
+ notificationSectionIconClass.add(3, "icon_m_design");
189
+ notificationSectionIconClass.add(4, "icon_m_manufacturing");
190
+ notificationSectionIconClass.add(5, "icon_m_invoice");
191
+ notificationSectionIconClass.add(6, "icon_m_shipping");
192
+ notificationSectionIconClass.add(7, "icon_m_invoice");
193
+ notificationSectionIconClass.add(8, "icon_m_inbox");
194
+ notificationSectionIconClass.add(9, "icon_m_reminder");
195
+ notificationSectionIconClass.add(10, "fa fa-server");
196
+ var notificationSectionCodes = exports.notificationSectionCodes = new _dictionary.Dictionary();
197
+ notificationSection.each(function (key, value) {
198
+ notificationSectionCodes.add(value, parseInt(key, 10));
199
+ });