merchi_sdk_js 0.0.2 → 0.0.4

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 (88) hide show
  1. package/package.json +4 -3
  2. package/dist/address.js +0 -109
  3. package/dist/assignment.js +0 -175
  4. package/dist/automatic_payment_relationship.js +0 -72
  5. package/dist/backup.js +0 -32
  6. package/dist/bank.js +0 -25
  7. package/dist/cart.js +0 -133
  8. package/dist/cart_item.js +0 -71
  9. package/dist/cart_shipment_group.js +0 -23
  10. package/dist/cart_shipment_quote.js +0 -26
  11. package/dist/category.js +0 -68
  12. package/dist/company.js +0 -248
  13. package/dist/company_invitation.js +0 -70
  14. package/dist/component.js +0 -107
  15. package/dist/component_tag.js +0 -60
  16. package/dist/component_version.js +0 -21
  17. package/dist/country_tax.js +0 -93
  18. package/dist/dictionary.js +0 -130
  19. package/dist/discount.js +0 -22
  20. package/dist/discount_group.js +0 -18
  21. package/dist/domain.js +0 -245
  22. package/dist/domain_invitation.js +0 -17
  23. package/dist/domain_tag.js +0 -87
  24. package/dist/domain_types.js +0 -22
  25. package/dist/draft.js +0 -97
  26. package/dist/draft_comment.js +0 -45
  27. package/dist/draft_template.js +0 -39
  28. package/dist/email_address.js +0 -34
  29. package/dist/email_counter.js +0 -47
  30. package/dist/enrolled_domain.js +0 -88
  31. package/dist/exchange_rate.js +0 -66
  32. package/dist/field_types.js +0 -19
  33. package/dist/helpers.js +0 -86
  34. package/dist/internal_tag.js +0 -98
  35. package/dist/inventory.js +0 -100
  36. package/dist/inventory_unit_variation.js +0 -19
  37. package/dist/invoice.js +0 -225
  38. package/dist/invoice_types.js +0 -11
  39. package/dist/item.js +0 -25
  40. package/dist/job.js +0 -536
  41. package/dist/job_comment.js +0 -45
  42. package/dist/job_status.js +0 -47
  43. package/dist/matching_inventory.js +0 -21
  44. package/dist/md5.js +0 -149
  45. package/dist/menu.js +0 -37
  46. package/dist/menu_item.js +0 -24
  47. package/dist/merchi.js +0 -1004
  48. package/dist/merchi_file.js +0 -165
  49. package/dist/model.js +0 -753
  50. package/dist/notification.js +0 -151
  51. package/dist/notification_types.js +0 -199
  52. package/dist/output.cjs.js +0 -31317
  53. package/dist/output.esm.js +0 -31312
  54. package/dist/page.js +0 -41
  55. package/dist/payment.js +0 -32
  56. package/dist/payment_device.js +0 -21
  57. package/dist/payment_types.js +0 -20
  58. package/dist/phone_number.js +0 -37
  59. package/dist/product.js +0 -288
  60. package/dist/product_types.js +0 -32
  61. package/dist/production_comment.js +0 -44
  62. package/dist/quote.js +0 -91
  63. package/dist/quote_item.js +0 -59
  64. package/dist/roles.js +0 -29
  65. package/dist/seo_domain_page.js +0 -42
  66. package/dist/session.js +0 -103
  67. package/dist/set.js +0 -29
  68. package/dist/shipment.js +0 -181
  69. package/dist/shipment_item.js +0 -17
  70. package/dist/shipment_item_fulfillment.js +0 -17
  71. package/dist/shipment_method.js +0 -81
  72. package/dist/shipment_method_variation.js +0 -38
  73. package/dist/subscription_plan.js +0 -75
  74. package/dist/supply_domain.js +0 -65
  75. package/dist/system_role.js +0 -12
  76. package/dist/theme.js +0 -180
  77. package/dist/theme_css_setting.js +0 -61
  78. package/dist/theme_status.js +0 -11
  79. package/dist/user.js +0 -409
  80. package/dist/user_company.js +0 -19
  81. package/dist/user_types.js +0 -23
  82. package/dist/uuid.js +0 -12
  83. package/dist/variation.js +0 -233
  84. package/dist/variation_field.js +0 -233
  85. package/dist/variation_fields_option.js +0 -41
  86. package/dist/variation_option.js +0 -62
  87. package/dist/variations_group.js +0 -43
  88. package/dist/white_label_accessibilities.js +0 -11
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.userTypes = void 0;
7
- var _dictionary = require("./dictionary.js");
8
- var userTypes = exports.userTypes = new _dictionary.Dictionary();
9
- userTypes.add("PUBLIC", 0);
10
- userTypes.add("CLIENT_GUEST", 1);
11
- userTypes.add("CLIENT_DOMAIN", 2);
12
- userTypes.add("CLIENT_MULTIPLE_DOMAINS", 3);
13
- userTypes.add("CLIENT_MERCHI", 4);
14
- userTypes.add("SELLER_FREE_MERCHI", 5);
15
- userTypes.add("SELLER_FREE_DOMAIN", 6);
16
- userTypes.add("SELLER_PAID", 7);
17
- userTypes.add("SELLER_PAID_MULTIPLE_DOMAINS", 8);
18
- userTypes.add("SUPPLIER_THIRD_PARTY", 9);
19
- userTypes.add("SUPPLIER_RESTRICTED", 10);
20
- userTypes.add("SUPPLIER_MERCHI", 11);
21
- userTypes.add("UNRESTRICTED", 12);
22
- userTypes.add("SHOPIFY_REFERENCE", 13);
23
- userTypes.add("RESERVED_FROM_SOCIAL", 14);
package/dist/uuid.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "generateUUID", {
7
- enumerable: true,
8
- get: function get() {
9
- return _uuid.v4;
10
- }
11
- });
12
- var _uuid = require("uuid");
package/dist/variation.js DELETED
@@ -1,233 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Variation = Variation;
7
- var _uuid = require("./uuid.js");
8
- var _field_types = require("./field_types.js");
9
- var _model = require("./model.js");
10
- var _helpers = require("./helpers.js");
11
- var _variation_option = require("./variation_option.js");
12
- var _variation_field = require("./variation_field.js");
13
- var _merchi_file = require("./merchi_file.js");
14
- function Variation() {
15
- this.resource = '/variation';
16
- this.json = 'variation';
17
- this.temporaryId = (0, _uuid.generateUUID)();
18
- (0, _model.addPropertyTo)(this, 'id');
19
- (0, _model.addPropertyTo)(this, 'value');
20
- (0, _model.addPropertyTo)(this, 'quantity');
21
- (0, _model.addPropertyTo)(this, 'cost');
22
- (0, _model.addPropertyTo)(this, 'onceOffCost');
23
- (0, _model.addPropertyTo)(this, 'unitCost');
24
- (0, _model.addPropertyTo)(this, 'unitCostTotal');
25
- (0, _model.addPropertyTo)(this, 'selectableOptions', _variation_option.VariationOption);
26
- (0, _model.addPropertyTo)(this, 'selectedOptions', _variation_option.VariationOption);
27
- (0, _model.addPropertyTo)(this, 'variationField', _variation_field.VariationField);
28
- (0, _model.addPropertyTo)(this, 'variationFiles', _merchi_file.MerchiFile);
29
- this.unitCostAndOnceOffCost = function () {
30
- var unitCost = this.unitCost() ? this.unitCost() : 0,
31
- onceOffCost = this.onceOffCost() ? this.onceOffCost() : 0;
32
- return unitCost + onceOffCost;
33
- };
34
- this.unitCostTotalAndOnceOffCost = function () {
35
- var unitCostTotal = this.unitCostTotal() ? this.unitCostTotal() : 0,
36
- onceOffCost = this.onceOffCost() ? this.onceOffCost() : 0;
37
- return unitCostTotal + onceOffCost;
38
- };
39
- this.isTextField = function () {
40
- var field = this.variationField();
41
- return Boolean(field) && field.isTextType();
42
- };
43
- this.isNumberField = function () {
44
- var field = this.variationField();
45
- return Boolean(field) && field.isNumberType();
46
- };
47
- this.isSelectField = function () {
48
- var field = this.variationField();
49
- return Boolean(field) && field.isSelectType();
50
- };
51
- this.isCheckBoxField = function () {
52
- var field = this.variationField();
53
- return Boolean(field) && field.isCheckboxType();
54
- };
55
- this.isRadioField = function () {
56
- var field = this.variationField();
57
- return Boolean(field) && field.isRadioType();
58
- };
59
- this.isColourSelectField = function () {
60
- var field = this.variationField();
61
- return Boolean(field) && field.isColourSelectType();
62
- };
63
- this.isImageSelectField = function () {
64
- var field = this.variationField();
65
- return Boolean(field) && field.isImageSelectType();
66
- };
67
- this.isCheckboxOrRadioField = function () {
68
- return this.isRadioField() || this.isCheckBoxField();
69
- };
70
- this.isSelectableField = function () {
71
- var field = this.variationField();
72
- return Boolean(field) && field.isSelectable();
73
- };
74
- this.canHaveMultipleSelected = function () {
75
- var field = this.variationField();
76
- return Boolean(field) && field.isDefaultMultiSelect();
77
- };
78
- this.isTextAreaField = function () {
79
- var field = this.variationField();
80
- return Boolean(field) && field.isTextAreaType();
81
- };
82
- this.isInstructionsField = function () {
83
- var field = this.variationField();
84
- return Boolean(field) && field.isInstructionsType();
85
- };
86
- this.isFileUpload = function () {
87
- var field = this.variationField();
88
- return Boolean(field) && field.isFileInput();
89
- };
90
- this.valueArray = function (updateValueArray) {
91
- var valuesArray = [],
92
- i;
93
- if (!(0, _helpers.isUndefined)(updateValueArray)) {
94
- this.value(updateValueArray.join(','));
95
- return updateValueArray;
96
- }
97
- if (this.value() === "") {
98
- return [];
99
- }
100
- valuesArray = String(this.value()).split(',');
101
- for (i = 0; i < valuesArray.length; i++) {
102
- valuesArray[i] = parseInt(valuesArray[i], 10);
103
- }
104
- return valuesArray;
105
- };
106
- this.textValue = function () {
107
- var field = this.variationField(),
108
- text = "",
109
- i;
110
- if (field) {
111
- if (this.isTextField() || this.isNumberField() || this.isTextAreaField()) {
112
- return this.value();
113
- }
114
- if (this.isSelectableField() && this.selectedOptions()) {
115
- for (i = 0; i < this.selectedOptions().length; i++) {
116
- text += this.selectedOptions()[i].value() + " ";
117
- }
118
- return text;
119
- }
120
- }
121
- return null;
122
- };
123
- this.optionIsSelected = function (id) {
124
- var selectedIds = this.valueArray();
125
- return -1 < selectedIds.findIndex(function (_id) {
126
- return String(_id) === String(id);
127
- });
128
- };
129
- this.selectedSelectableOptions = function () {
130
- var self = this,
131
- options = this.selectableOptions() ? this.selectableOptions() : [];
132
- return options.filter(function (o) {
133
- return self.optionIsSelected(o.optionId());
134
- });
135
- };
136
- this.selectedFieldOptions = function () {
137
- var field = this.variationField(),
138
- options = field.options() ? field.options() : [],
139
- valueArray = this.valueArray(),
140
- optionsArray = [],
141
- selectedId,
142
- option,
143
- i,
144
- z;
145
- for (i = 0; i < valueArray.length; i++) {
146
- selectedId = valueArray[i];
147
- for (z = 0; z < options.length; z++) {
148
- option = options[z];
149
- if (selectedId === option.id()) {
150
- optionsArray.push(option);
151
- }
152
- }
153
- }
154
- return optionsArray;
155
- };
156
- this.findOptionValueIndex = function (optionId) {
157
- return this.valueArray().indexOf(parseInt(optionId, 10));
158
- };
159
- this.optionIsChecked = function (optionId) {
160
- return this.findOptionValueIndex(optionId) > -1;
161
- };
162
- this.addOptionToValueArray = function (optionId) {
163
- var newValueArray = this.valueArray();
164
- if (!this.optionIsChecked(optionId)) {
165
- newValueArray.push(optionId);
166
- this.valueArray(newValueArray);
167
- }
168
- };
169
- this.removeOptionFromValueArray = function (optionId) {
170
- var index = this.findOptionValueIndex(optionId),
171
- newValueArray = this.valueArray();
172
- newValueArray.splice(index, 1);
173
- this.valueArray(newValueArray);
174
- };
175
- this.fieldName = function () {
176
- return this.variationField().name();
177
- };
178
- this.fieldType = function () {
179
- return this.variationField().fieldType();
180
- };
181
- this.hasOptions = function () {
182
- return Boolean(this.selectedOptions());
183
- };
184
- this.hasMultipleOptions = function () {
185
- return parseInt(this.fieldType(), 10) === _field_types.fieldTypes.get("CHECKBOX");
186
- };
187
- this.isFileUpload = function () {
188
- return parseInt(this.fieldType(), 10) === _field_types.fieldTypes.get("FILE_UPLOAD");
189
- };
190
- this.isColourPicker = function () {
191
- return parseInt(this.fieldType(), 10) === _field_types.fieldTypes.get("COLOUR_PICKER");
192
- };
193
- this.clone = function () {
194
- var cloneVariation = new Variation();
195
- cloneVariation.value(this.value());
196
- cloneVariation.cost(this.cost());
197
- cloneVariation.variationField(this.variationField());
198
- cloneVariation.variationFiles(this.variationFiles());
199
- return cloneVariation;
200
- };
201
- this.valueIdArray = function () {
202
- var value = this.value();
203
- return value ? value.split(',') : [];
204
- };
205
- this.concatinatedSelectedOptionValues = function () {
206
- var optionIds = this.valueIdArray(),
207
- optionIdsLength = optionIds.length - 1,
208
- field = this.variationField(),
209
- value = '',
210
- option,
211
- i;
212
- for (i = 0; i < optionIds.length; i++) {
213
- option = field.findOptionById(optionIds[i]);
214
- value += option.value();
215
- if (optionIdsLength > i) {
216
- value += ', ';
217
- }
218
- }
219
- return value;
220
- };
221
- this.valueString = function () {
222
- var field = this.variationField();
223
- if (field.isSelectable()) {
224
- return this.concatinatedSelectedOptionValues();
225
- } else if (this.isFileUpload() && this.variationFiles()) {
226
- if (this.variationFiles().length > 1) {
227
- return 'uploaded files';
228
- }
229
- return 'uploaded file';
230
- }
231
- return this.value();
232
- };
233
- }
@@ -1,233 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.VariationField = VariationField;
7
- var _uuid = require("./uuid.js");
8
- var _field_types = require("./field_types.js");
9
- var _model = require("./model.js");
10
- var _helpers = require("./helpers.js");
11
- var _discount_group = require("./discount_group.js");
12
- var _variation_fields_option = require("./variation_fields_option.js");
13
- var _variation = require("./variation.js");
14
- var _variation_option = require("./variation_option.js");
15
- function VariationField() {
16
- this.resource = '/variationFields';
17
- this.json = 'variationField';
18
- this.temporaryId = (0, _uuid.generateUUID)();
19
- (0, _model.addPropertyTo)(this, 'id');
20
- (0, _model.addPropertyTo)(this, 'fieldType');
21
- (0, _model.addPropertyTo)(this, 'name');
22
- (0, _model.addPropertyTo)(this, 'position');
23
- (0, _model.addPropertyTo)(this, 'placeholder');
24
- (0, _model.addPropertyTo)(this, 'defaultValue');
25
- (0, _model.addPropertyTo)(this, 'required');
26
- (0, _model.addPropertyTo)(this, 'independent');
27
- (0, _model.addPropertyTo)(this, 'variationCost');
28
- (0, _model.addPropertyTo)(this, 'variationCostDiscountGroup', _discount_group.DiscountGroup);
29
- (0, _model.addPropertyTo)(this, 'variationUnitCost');
30
- (0, _model.addPropertyTo)(this, 'variationUnitCostDiscountGroup', _discount_group.DiscountGroup);
31
- (0, _model.addPropertyTo)(this, 'options', _variation_fields_option.VariationFieldsOption);
32
- (0, _model.addPropertyTo)(this, 'defaultOptions', _variation_fields_option.VariationFieldsOption);
33
- (0, _model.addPropertyTo)(this, 'multipleSelect');
34
- (0, _model.addPropertyTo)(this, 'rows');
35
- (0, _model.addPropertyTo)(this, 'fieldMin');
36
- (0, _model.addPropertyTo)(this, 'fieldMax');
37
- (0, _model.addPropertyTo)(this, 'showFilePreview');
38
- (0, _model.addPropertyTo)(this, 'allowDecimal');
39
- (0, _model.addPropertyTo)(this, 'allowFileMultiple');
40
- (0, _model.addPropertyTo)(this, 'allowFileJpeg');
41
- (0, _model.addPropertyTo)(this, 'allowFileGif');
42
- (0, _model.addPropertyTo)(this, 'allowFilePdf');
43
- (0, _model.addPropertyTo)(this, 'allowFilePng');
44
- (0, _model.addPropertyTo)(this, 'allowFileAi');
45
- (0, _model.addPropertyTo)(this, 'sellerProductEditable');
46
- this.isType = function (typeString) {
47
- return parseInt(this.fieldType(), 10) === _field_types.fieldTypes.get(typeString);
48
- };
49
- this.isTextType = function () {
50
- return this.isType('TEXT_INPUT');
51
- };
52
- this.isNumberType = function () {
53
- return this.isType('NUMBER_INPUT');
54
- };
55
- this.isSelectType = function () {
56
- return this.isType('SELECT');
57
- };
58
- this.isDefaultMultiSelect = function () {
59
- return this.isType('CHECKBOX') || this.isType('IMAGE_SELECT') && this.multipleSelect();
60
- };
61
- this.isCheckboxType = function () {
62
- return this.isType('CHECKBOX');
63
- };
64
- this.isRadioType = function () {
65
- return this.isType('RADIO');
66
- };
67
- this.hasOptions = function () {
68
- return Boolean(this.options());
69
- };
70
- this.isCheckboxOrRadio = function () {
71
- return this.isCheckboxType() || this.isRadioType();
72
- };
73
- this.isTextAreaType = function () {
74
- return this.isType('TEXT_AREA');
75
- };
76
- this.isInstructionsType = function () {
77
- return this.isType('FIELD_INSTRUCTIONS');
78
- };
79
- this.isFileInput = function () {
80
- return this.isType('FILE_UPLOAD');
81
- };
82
- this.isColourPickerType = function () {
83
- return this.isType('COLOUR_PICKER');
84
- };
85
- this.isColourSelectType = function () {
86
- return this.isType('COLOUR_SELECT');
87
- };
88
- this.isImageSelectType = function () {
89
- return this.isType('IMAGE_SELECT');
90
- };
91
- this.isSelectable = function () {
92
- return this.isSelectType() || this.isCheckboxOrRadio() || this.isImageSelectType() || this.isColourSelectType();
93
- };
94
- this.canMultiSelect = function () {
95
- return this.isImageSelectType() || this.isColourSelectType();
96
- };
97
- this.fieldInputTypeAttributeValue = function () {
98
- var inputType = this.fieldType(),
99
- inputTypeString = null;
100
- if (inputType === _field_types.fieldTypes.get("TEXT_INPUT")) {
101
- inputTypeString = 'text';
102
- } else if (inputType === _field_types.fieldTypes.get('FILE_UPLOAD')) {
103
- inputTypeString = 'file';
104
- } else if (inputType === _field_types.fieldTypes.get('NUMBER_INPUT')) {
105
- inputTypeString = 'number';
106
- } else if (inputType === _field_types.fieldTypes.get('RADIO')) {
107
- inputTypeString = 'radio';
108
- } else if (inputType === _field_types.fieldTypes.get('IMAGE_SELECT')) {
109
- if (this.multipleSelect()) {
110
- inputTypeString = 'checkbox';
111
- } else {
112
- inputTypeString = 'radio';
113
- }
114
- } else if (inputType === _field_types.fieldTypes.get('CHECKBOX')) {
115
- inputTypeString = 'checkbox';
116
- } else if (inputType === _field_types.fieldTypes.get('COLOUR_PICKER')) {
117
- inputTypeString = 'color';
118
- }
119
- return inputTypeString;
120
- };
121
- this.hasMultipleDefaults = function () {
122
- return this.optionsDefaults().length > 1;
123
- };
124
- this.setSingleOptionDefault = function (index) {
125
- var i,
126
- options = this.options();
127
- for (i = 0; i < options.length; i++) {
128
- options[i]["default"](false);
129
- }
130
- options[index]["default"](true);
131
- };
132
- this.optionsDefaults = function () {
133
- var i,
134
- defaultsArray = [],
135
- options = this.options();
136
- for (i = 0; i < options.length; i++) {
137
- if (options[i]["default"]()) {
138
- defaultsArray.push(options[i]);
139
- }
140
- }
141
- return defaultsArray;
142
- };
143
- this.findOptionById = function (id) {
144
- var i = 0,
145
- options;
146
- options = this.options();
147
- for (i = 0; i < options.length; i++) {
148
- if (parseInt(options[i].id(), 10) === parseInt(id, 10)) {
149
- return options[i];
150
- }
151
- }
152
- return null;
153
- };
154
- this.allowFileJpegString = function () {
155
- return Boolean(this.allowFileJpeg()) ? ".jpeg, .jpg" : "";
156
- };
157
- this.allowFileGifString = function () {
158
- return Boolean(this.allowFileGif()) ? ".gif" : "";
159
- };
160
- this.allowFilePdfString = function () {
161
- return Boolean(this.allowFilePdf()) ? ".pdf" : "";
162
- };
163
- this.allowFilePngString = function () {
164
- return Boolean(this.allowFilePng()) ? ".png" : "";
165
- };
166
- this.allowFileAiString = function () {
167
- return Boolean(this.allowFileAi()) ? ".ai" : "";
168
- };
169
- this.allowedFileTypesString = function () {
170
- function appendType(fileTypeString) {
171
- if (fileTypeString !== "") {
172
- return fileTypeString + ", ";
173
- }
174
- return "";
175
- }
176
- return appendType(this.allowFileJpegString()) + appendType(this.allowFileGifString()) + appendType(this.allowFilePdfString()) + appendType(this.allowFilePngString()) + appendType(this.allowFileAiString());
177
- };
178
- this.allowFileMultipleString = function () {
179
- if (this.allowFileMultiple()) {
180
- return "multiple";
181
- }
182
- return "";
183
- };
184
- this.buildEmptyVariation = function () {
185
- var variationBuilt = new _variation.Variation(),
186
- value,
187
- options,
188
- i,
189
- onceOffCost = 0,
190
- selectableOptions = [],
191
- sellerProductEditable = this.sellerProductEditable();
192
- if (this.isSelectable()) {
193
- options = this.options();
194
- value = [];
195
- for (i = 0; i < options.length; i++) {
196
- var selectableOption = new _variation_option.VariationOption();
197
- selectableOption.copyFieldOption(options[i]);
198
- selectableOptions.push(selectableOption);
199
- if (!sellerProductEditable && options[i]["default"]() || sellerProductEditable && options[i].include()) {
200
- value.push(options[i].id());
201
- onceOffCost += options[i].variationCost();
202
- }
203
- }
204
- variationBuilt.value(value.join());
205
- variationBuilt.onceOffCost(onceOffCost);
206
- } else {
207
- variationBuilt.value(this.defaultValue());
208
- variationBuilt.unitCost(this.variationUnitCost());
209
- variationBuilt.onceOffCost(this.variationCost());
210
- }
211
- variationBuilt.unitCostTotal('0');
212
- variationBuilt.cost(variationBuilt.onceOffCost());
213
- variationBuilt.variationField((0, _helpers.clone)(this));
214
- variationBuilt.selectableOptions(selectableOptions);
215
- return variationBuilt;
216
- };
217
- this.optionsHaveCost = function () {
218
- var i, options, o;
219
- function hasCost(cost) {
220
- return !(0, _helpers.isUndefinedOrNull)(cost);
221
- }
222
- if (this.isSelectable()) {
223
- options = this.options();
224
- for (i = 0; i < options.length; i++) {
225
- o = options[i];
226
- if (hasCost(o.variationCost()) || hasCost(o.variationUnitCost())) {
227
- return true;
228
- }
229
- }
230
- }
231
- return false;
232
- };
233
- }
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.VariationFieldsOption = VariationFieldsOption;
7
- var _uuid = require("./uuid.js");
8
- var _model = require("./model.js");
9
- var _discount_group = require("./discount_group.js");
10
- var _merchi_file = require("./merchi_file.js");
11
- var _variation_field = require("./variation_field.js");
12
- function VariationFieldsOption() {
13
- this.resource = '/variationFieldOptions';
14
- this.json = 'variationFieldOption';
15
- this.temporaryId = (0, _uuid.generateUUID)();
16
- (0, _model.addPropertyTo)(this, 'id');
17
- (0, _model.addPropertyTo)(this, 'value');
18
- (0, _model.addPropertyTo)(this, 'position');
19
- (0, _model.addPropertyTo)(this, 'default');
20
- (0, _model.addPropertyTo)(this, 'include');
21
- (0, _model.addPropertyTo)(this, 'colour');
22
- (0, _model.addPropertyTo)(this, 'variationCost');
23
- (0, _model.addPropertyTo)(this, 'variationCostDiscountGroup', _discount_group.DiscountGroup);
24
- (0, _model.addPropertyTo)(this, 'variationUnitCost');
25
- (0, _model.addPropertyTo)(this, 'variationUnitCostDiscountGroup', _discount_group.DiscountGroup);
26
- (0, _model.addPropertyTo)(this, 'linkedFile', _merchi_file.MerchiFile);
27
- (0, _model.addPropertyTo)(this, 'variationField', _variation_field.VariationField);
28
- this.totalCost = function (quantity) {
29
- var total = this.variationCost() ? this.variationCost() : 0;
30
- if (this.variationUnitCost() && quantity) {
31
- total += quantity * this.variationUnitCost();
32
- }
33
- return total;
34
- };
35
- this.onceOffCost = function () {
36
- return this.variationCost();
37
- };
38
- this.unitCost = function () {
39
- return this.variationUnitCost();
40
- };
41
- }
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.VariationOption = VariationOption;
7
- var _uuid = require("./uuid.js");
8
- var _model = require("./model.js");
9
- var _merchi_file = require("./merchi_file.js");
10
- var _variation = require("./variation.js");
11
- function VariationOption() {
12
- this.json = 'variation_option';
13
- this.temporaryId = (0, _uuid.generateUUID)();
14
- (0, _model.addPropertyTo)(this, 'optionId');
15
- (0, _model.addPropertyTo)(this, 'value');
16
- (0, _model.addPropertyTo)(this, 'available');
17
- (0, _model.addPropertyTo)(this, 'position');
18
- (0, _model.addPropertyTo)(this, 'default');
19
- (0, _model.addPropertyTo)(this, 'include');
20
- (0, _model.addPropertyTo)(this, 'colour');
21
- (0, _model.addPropertyTo)(this, 'quantity');
22
- (0, _model.addPropertyTo)(this, 'onceOffCost');
23
- (0, _model.addPropertyTo)(this, 'unitCost');
24
- (0, _model.addPropertyTo)(this, 'unitCostTotal');
25
- (0, _model.addPropertyTo)(this, 'totalCost');
26
- (0, _model.addPropertyTo)(this, 'fieldName');
27
- (0, _model.addPropertyTo)(this, 'linkedFile', _merchi_file.MerchiFile);
28
- this.copyFieldOption = function (option) {
29
- this.optionId(option.id());
30
- this.value(option.value());
31
- this.colour(option.colour());
32
- this.position(option.position());
33
- this["default"](option["default"]());
34
- this.onceOffCost(option.variationCost());
35
- this.unitCost(option.variationUnitCost());
36
- this.linkedFile(option.linkedFile());
37
- };
38
-
39
- // a hack around function for job cloneable renderering
40
- this.covertToVariation = function () {
41
- var variationConverted = new _variation.Variation(),
42
- unitCost = this.unitCost(),
43
- fieldName = this.fieldName(),
44
- optionValue = this.value();
45
- variationConverted.value(this.optionId());
46
- variationConverted.quantity(this.quantity());
47
- variationConverted.onceOffCost(this.onceOffCost());
48
- variationConverted.unitCostTotal(this.unitCostTotal());
49
-
50
- // hack around for variation unit cost
51
- variationConverted.unitCost = function () {
52
- return unitCost;
53
- };
54
- variationConverted.valueString = function () {
55
- return optionValue;
56
- };
57
- variationConverted.fieldName = function () {
58
- return fieldName;
59
- };
60
- return variationConverted;
61
- };
62
- }
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.VariationsGroup = VariationsGroup;
7
- var _uuid = require("./uuid.js");
8
- var _model = require("./model.js");
9
- var _variation = require("./variation.js");
10
- function VariationsGroup() {
11
- this.resource = '/variationsGroups';
12
- this.json = 'variationsGroup';
13
- this.temporaryId = (0, _uuid.generateUUID)();
14
- (0, _model.addPropertyTo)(this, 'id');
15
- (0, _model.addPropertyTo)(this, 'inventoryCount');
16
- (0, _model.addPropertyTo)(this, 'inventorySufficient');
17
- (0, _model.addPropertyTo)(this, 'quantity');
18
- (0, _model.addPropertyTo)(this, 'groupCost');
19
- (0, _model.addPropertyTo)(this, 'variations', _variation.Variation);
20
- this.clone = function () {
21
- var groupClone = new VariationsGroup(),
22
- variationsClone = [],
23
- i;
24
- groupClone.groupCost(this.groupCost());
25
- groupClone.quantity(this.quantity());
26
- for (i = 0; i < this.variations().length; i++) {
27
- variationsClone.push(this.variations()[i].clone());
28
- }
29
- return groupClone.variations(variationsClone);
30
- };
31
- this.loopVariationsAndReturnAttributeTotal = function (attribute) {
32
- var variations = this.variations() ? this.variations() : [],
33
- total = 0,
34
- i;
35
- for (i = 0; i < variations.length; i++) {
36
- total += variations[i][attribute]();
37
- }
38
- return parseFloat(total).toFixed(2);
39
- };
40
- this.variationsUnitCostAndOnceOffCost = function () {
41
- return this.loopVariationsAndReturnAttributeTotal('unitCostAndOnceOffCost');
42
- };
43
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.whiteLabelAccessibilities = void 0;
7
- var _dictionary = require("./dictionary.js");
8
- var whiteLabelAccessibilities = exports.whiteLabelAccessibilities = new _dictionary.Dictionary();
9
- whiteLabelAccessibilities.add("NOT_REACHABLE", 0);
10
- whiteLabelAccessibilities.add("NO_CERITICATE", 1);
11
- whiteLabelAccessibilities.add("FULLY_REACHABLE", 2);