@lancom/shared 0.0.280 → 0.0.282

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 (95) hide show
  1. package/assets/js/api/admin.js +3 -0
  2. package/assets/js/api/index.js +7 -4
  3. package/assets/js/models/print-area.js +8 -4
  4. package/assets/js/utils/colors.js +1 -1
  5. package/assets/js/utils/fabric-helper.js +5 -18
  6. package/assets/js/utils/filters.js +2 -2
  7. package/assets/js/utils/product.js +10 -1
  8. package/assets/scss/_common.scss +10 -0
  9. package/components/asides/contact_us/contact-us.vue +9 -2
  10. package/components/asides/menu/menu.vue +1 -25
  11. package/components/checkout/cart/cart.mixin.js +3 -3
  12. package/components/checkout/cart/cart.scss +8 -109
  13. package/components/checkout/cart/cart.vue +84 -46
  14. package/components/checkout/cart/cart_entity/cart_entity_color_simple_products/cart_entity_color_simple_product/cart-entity-color-simple-product.vue +7 -4
  15. package/components/checkout/cart/cart_price_info/cart-price-info.vue +4 -5
  16. package/components/checkout/cart/cart_pricing/cart-pricing.scss +34 -0
  17. package/components/checkout/cart/cart_pricing/cart-pricing.vue +112 -0
  18. package/components/checkout/cart/cart_shipments_pricing/cart-shipments-pricing.vue +2 -2
  19. package/components/checkout/order/address-form/address-form.scss +16 -0
  20. package/components/checkout/order/address-form/address-form.vue +199 -91
  21. package/components/checkout/order/order-billing-information/order-billing-information.scss +1 -1
  22. package/components/checkout/order/order-payment-information/order-payment-information.vue +15 -5
  23. package/components/checkout/order/order.vue +2 -1
  24. package/components/common/client_settings/client-settings.scss +6 -0
  25. package/components/common/client_settings/client-settings.vue +9 -1
  26. package/components/common/payment/payment_card/stripe/stripe.vue +1 -0
  27. package/components/common/payment/payment_success/payment-success.vue +8 -1
  28. package/components/common/postcode_select/postcode-select.vue +24 -12
  29. package/components/common/price.vue +1 -1
  30. package/components/common/pricing_table/pricing-table.vue +3 -2
  31. package/components/common/tabs.vue +17 -8
  32. package/components/editor/editor.scss +6 -0
  33. package/components/editor/editor.vue +9 -25
  34. package/components/editor/editor_layers/editor-layers.scss +18 -0
  35. package/components/editor/editor_layers/editor-layers.vue +76 -20
  36. package/components/editor/editor_layers/editor_layers_layer/editor-layers-layer.vue +11 -4
  37. package/components/editor/editor_print_area_options/editor-print-area-options.vue +6 -1
  38. package/components/editor/editor_print_area_options/editor_print_area_option/editor-print-area-option.vue +2 -2
  39. package/components/editor/editor_product_details/editor-product-details.scss +8 -2
  40. package/components/editor/editor_product_details/editor-product-details.vue +22 -25
  41. package/components/editor/editor_wizard/editor-wizard.vue +2 -1
  42. package/components/editor/editor_workspace/editor-workspace.vue +7 -3
  43. package/components/editor/editor_workspace/editor_workspace_side/editor-workspace-side.vue +17 -20
  44. package/components/editor/mobile_editor_product_details/mobile-editor-product-details.scss +2 -2
  45. package/components/modals/cart_modal/cart-modal.vue +1 -1
  46. package/components/modals/order_modal/order-modal.vue +6 -0
  47. package/components/modals/payment_modal/payment-modal.vue +4 -3
  48. package/components/order/order_payment/order-payment.vue +6 -6
  49. package/components/product/editor_pricing/editor-pricing.scss +75 -0
  50. package/components/product/editor_pricing/editor-pricing.vue +197 -0
  51. package/components/product/editor_pricing/editor_pricing_details/editor-pricing-details.scss +0 -0
  52. package/components/product/editor_pricing/editor_pricing_details/editor-pricing-details.vue +29 -0
  53. package/components/product/editor_pricing/editor_pricing_details/editor_pricing_details_prints/editor-pricing-details-prints.scss +41 -0
  54. package/components/product/editor_pricing/editor_pricing_details/editor_pricing_details_prints/editor-pricing-details-prints.vue +118 -0
  55. package/components/product/editor_pricing/editor_pricing_details/editor_pricing_details_products/editor-pricing-details-products.scss +41 -0
  56. package/components/product/editor_pricing/editor_pricing_details/editor_pricing_details_products/editor-pricing-details-products.vue +102 -0
  57. package/components/product/product.vue +1 -1
  58. package/components/product/product_colors_selector/product-colors-selector.scss +117 -0
  59. package/components/product/product_colors_selector/product-colors-selector.vue +188 -0
  60. package/components/product/product_multipacks_carousel/product-multipacks-carousel.vue +3 -1
  61. package/components/product/product_size_selector/product_size_selector_color/product_size_selector_color_cell/product-size-selector-color-cell.vue +4 -5
  62. package/components/product/products_size_selector_color/product_size_selector_color/product-size-selector-color.scss +58 -0
  63. package/components/product/products_size_selector_color/product_size_selector_color/product-size-selector-color.vue +128 -0
  64. package/components/product/products_size_selector_color/products-size-selector-color.scss +12 -0
  65. package/components/product/products_size_selector_color/products-size-selector-color.vue +43 -0
  66. package/components/product/wizard/wizard_print_layers/wizard_print_layer/wizard-print-layer.vue +4 -34
  67. package/components/product/wizard/wizard_print_size/wizard_print_area_print_size/wizard-print-area-print-size.vue +2 -1
  68. package/components/product/wizard/wizard_print_text_or_logo/wizard-print-text-or-logo.vue +22 -1
  69. package/components/product/wizard/wizard_print_type/wizard_print_area_print_type/wizard-print-area-print-type.vue +2 -1
  70. package/components/products/product_list/product-list.scss +2 -2
  71. package/components/products/product_list_product/product-list-product.scss +7 -11
  72. package/components/products/product_list_product/product-list-product.vue +7 -15
  73. package/components/the_aside/the-aside.vue +1 -0
  74. package/components/the_navbar/the-navbar.scss +1 -1
  75. package/feeds/google-shopping.js +5 -5
  76. package/layouts/error.vue +39 -0
  77. package/layouts/products.vue +386 -0
  78. package/mixins/add-to-cart.js +64 -0
  79. package/mixins/payment.js +2 -1
  80. package/mixins/print-layer.js +45 -0
  81. package/mixins/product-preview.js +1 -1
  82. package/mixins/product-view.js +313 -0
  83. package/nuxt.config.js +0 -5
  84. package/package.json +1 -1
  85. package/pages/checkout/cart.vue +40 -0
  86. package/pages/checkout/order.vue +72 -0
  87. package/pages/customer/create.vue +33 -0
  88. package/pages/customer/password/_token.vue +79 -0
  89. package/pages/customer/recovery.vue +33 -0
  90. package/pages/customer/settings.vue +33 -0
  91. package/pages/customer/signin.vue +33 -0
  92. package/routes/index.js +35 -0
  93. package/store/cart.js +15 -6
  94. package/store/order.js +2 -2
  95. package/store/product.js +5 -12
package/routes/index.js CHANGED
@@ -24,5 +24,40 @@ module.exports = function(routes, resolve) {
24
24
  path: '/order/:token/refund/:refund',
25
25
  component: resolve('@lancom/shared/pages/order/_token/refund/_refund.vue'),
26
26
  chunkName: 'pages/order/view/refund'
27
+ }, {
28
+ name: 'customer-signin',
29
+ path: '/customer/signin',
30
+ component: resolve('@lancom/shared/pages/customer/signin.vue'),
31
+ chunkName: 'pages/customer/signin'
32
+ }, {
33
+ name: 'customer-settings',
34
+ path: '/customer/settings',
35
+ component: resolve('@lancom/shared/pages/customer/settings.vue'),
36
+ chunkName: 'pages/customer/settings'
37
+ }, {
38
+ name: 'customer-recovery',
39
+ path: '/customer/recovery',
40
+ component: resolve('@lancom/shared/pages/customer/recovery.vue'),
41
+ chunkName: 'pages/customer/recovery'
42
+ }, {
43
+ name: 'customer-create',
44
+ path: '/customer/create',
45
+ component: resolve('@lancom/shared/pages/customer/create.vue'),
46
+ chunkName: 'pages/customer/create'
47
+ }, {
48
+ name: 'customer-password-reset',
49
+ path: '/customer/password/:token',
50
+ component: resolve('@lancom/shared/pages/customer/password/_token.vue'),
51
+ chunkName: 'pages/customer/password/reset'
52
+ }, {
53
+ name: 'checkout-cart',
54
+ path: '/checkout/cart',
55
+ component: resolve('@lancom/shared/pages/checkout/cart.vue'),
56
+ chunkName: 'pages/checkout/cart'
57
+ }, {
58
+ name: 'checkout-order',
59
+ path: '/checkout/order',
60
+ component: resolve('@lancom/shared/pages/checkout/order.vue'),
61
+ chunkName: 'pages/checkout/reset'
27
62
  }];
28
63
  }
package/store/cart.js CHANGED
@@ -113,6 +113,7 @@ export const actions = {
113
113
  }).filter(e => !!e);
114
114
  const payload = {
115
115
  _id: state.id || undefined,
116
+ currency: currency?._id,
116
117
  entities: [...cartEntities, ...entities]
117
118
  };
118
119
  const cart = await api.saveCart(payload, shop._id);
@@ -124,36 +125,42 @@ export const actions = {
124
125
  gtm.addToCart(addingEntities, pricing);
125
126
  }
126
127
  },
127
- async removeSimpleProductsFromCart({ commit, state }, { simpleProducts, shop }) {
128
+ async removeSimpleProductsFromCart({ commit, state }, { simpleProducts, shop, currency }) {
128
129
  const removeGuids = (simpleProducts || []).map(e => e.guid);
129
130
  const entities = state.entities.map(entity => ({
130
131
  ...entity,
131
132
  simpleProducts: entity.simpleProducts.filter(sp => !removeGuids.includes(sp.guid))
132
133
  })).filter(({ simpleProducts }) => simpleProducts.length > 0);
133
- const payload = { _id: state.id, entities };
134
+ const payload = {
135
+ _id: state.id,
136
+ entities,
137
+ currency: currency?._id
138
+ };
134
139
  await api.saveCart(payload, shop._id);
135
140
  commit('setEntities', entities);
136
141
  if (state.cartPricing) {
137
142
  gtm.removeFromCart(simpleProducts, state.cartPricing);
138
143
  }
139
144
  },
140
- async removeSupplier({ commit, state }, { supplier, shop }) {
145
+ async removeSupplier({ commit, state }, { supplier, shop, currency }) {
141
146
  const brands = supplier.brands.map(({ _id }) => _id);
142
147
  const entities = state.entities.filter(entity => !brands.includes(entity.product.brand._id));
143
148
  if (state.cartPricing) {
144
149
  const simpleProducts = entities.reduce((items, entity) => [...items, ...entity.simpleProducts], []);
145
150
  gtm.removeFromCart(simpleProducts, state.cartPricing);
146
151
  }
147
- const payload = { _id: state.id, entities };
152
+ const payload = { _id: state.id, entities, currency: currency?._id};
148
153
  await api.saveCart(payload, shop._id);
149
154
  commit('setEntities', entities);
150
155
  },
151
156
  async calculateCartPrice({ state: { suburb, entities, coupon, cartPricing }, commit }, { shop, country }) {
152
157
  const selectedSuppliersWithRates = cartPricing?.shipping?.suppliersWithRates;
153
158
  const payload = generateCalculatePriceData(entities, suburb, null, coupon, selectedSuppliersWithRates, country);
159
+ console.log('calculateCartPrice:payload: ', payload)
154
160
  try {
155
161
  commit('setCartPricingCalculating', true);
156
162
  const response = await api.calculateProductPrice(payload, shop._id);
163
+ console.log('response: ', response);
157
164
  commit('setCartPricing', response);
158
165
  commit('setCartPricingError', null);
159
166
  } catch (e) {
@@ -164,7 +171,7 @@ export const actions = {
164
171
  commit('setCartPricingCalculating', false);
165
172
  }
166
173
  },
167
- async setSimpleProductAmount({ state, commit }, { guid, amount, shop }) {
174
+ async setSimpleProductAmount({ state, commit }, { guid, amount, shop, currency }) {
168
175
  const entities = (state.entities || []).map(product => ({
169
176
  ...product,
170
177
  simpleProducts: (product.simpleProducts || []).map(sp => ({
@@ -172,7 +179,7 @@ export const actions = {
172
179
  amount: sp.guid === guid ? +amount : sp.amount
173
180
  }))
174
181
  }));
175
- const payload = { _id: state.id, entities };
182
+ const payload = { _id: state.id, entities, currency: currency?._id };
176
183
  await api.saveCart(payload, shop._id);
177
184
  commit('setEntities', entities);
178
185
  },
@@ -215,6 +222,7 @@ export const mutations = {
215
222
  state.id = id;
216
223
  },
217
224
  setEntities(state, entities) {
225
+ console.log('setEntities: ', entities);
218
226
  state.entities = entities;
219
227
  },
220
228
  setSuburb(state, suburb) {
@@ -224,6 +232,7 @@ export const mutations = {
224
232
  state.coupon = coupon;
225
233
  },
226
234
  setCartPricing(state, price) {
235
+ console.log('setCartPricing: ', price);
227
236
  state.cartPricing = price;
228
237
  },
229
238
  setCartPricingCalculating(state, calculating) {
package/store/order.js CHANGED
@@ -19,9 +19,9 @@ export const actions = {
19
19
  const response = await api.createOrder({ ...order, recaptchaToken }, shop);
20
20
  commit('setOrderData', response);
21
21
  },
22
- async submitPayment({ commit, state: { orderData } }, { card, payment, country, shop, recaptchaToken }) {
22
+ async submitPayment({ commit, state: { orderData } }, { card, payment, country, shop, currency, recaptchaToken }) {
23
23
  const { _id } = orderData || {};
24
- const response = await api.createOrderPayment(_id, { card, shop, country, payment, recaptchaToken });
24
+ const response = await api.createOrderPayment(_id, { card, shop, country, payment, currency, recaptchaToken });
25
25
  commit('setOrderData', response);
26
26
  return {};
27
27
  },
package/store/product.js CHANGED
@@ -82,11 +82,7 @@ export const getters = {
82
82
  availableColors: ({ availableColors }) => availableColors,
83
83
  availableSizes: ({ availableSizes }) => availableSizes,
84
84
  editableColor: ({ editableColor }) => editableColor,
85
- editableLayers: ({ template, editableColor, editablePrintArea }) => template.layers
86
- .filter(({ printArea }) => (
87
- // colorId === editableColor._id &&
88
- printArea === editablePrintArea?._id
89
- )),
85
+ editableLayers: ({ template, editableColor, editablePrintArea }) => template.layers,
90
86
  selectedLayer: ({ selectedLayer }) => selectedLayer,
91
87
  editModeSelectedLayer: ({ editModeSelectedLayer }) => editModeSelectedLayer,
92
88
  selectedPrintAreas: ({ selectedPrintAreas }) => selectedPrintAreas,
@@ -106,6 +102,8 @@ export const getters = {
106
102
  printArea: ({ editablePrintArea, editorSize: { width, height }, product }) => {
107
103
  return getPrintAreaByName({
108
104
  printArea: editablePrintArea?._id,
105
+ printSize: editablePrintArea?.printSize,
106
+ printAreaOffsets: editablePrintArea?.printAreaOffsets,
109
107
  editorWidth: width,
110
108
  editorHeight: height
111
109
  }, product);
@@ -122,7 +120,7 @@ export const getters = {
122
120
  minimumOrderQuantity: ({ product, template }) => {
123
121
  const layersPrintTypes = (template.layers || []).map(({ printType }) => printType);
124
122
  const printTypesMinQuantity = (product.printTypes || [])
125
- .filter(printType => layersPrintTypes.includes(printType._id))
123
+ .filter(printType => layersPrintTypes.includes(printType._id || printType))
126
124
  .map(printType => printType.minQuantity);
127
125
  return Math.max(
128
126
  product.minimumOrderQuantity,
@@ -162,12 +160,6 @@ export const actions = {
162
160
  const product = await api.fetchProduct(shop, slug, query);
163
161
  commit('setProduct', product);
164
162
  commit('setPreSetPrint', (product.prints || []).find(({ _id }) => _id === print));
165
-
166
- const [first] = (product.printAreas || []);
167
- if (first) {
168
- commit('setEditablePrintArea', first);
169
- commit('setSelectedPrintArea', { printArea: first._id, size: first.printSize });
170
- }
171
163
  } catch (e) {
172
164
  console.log(e);
173
165
  const { status, data } = e?.response || {};
@@ -248,6 +240,7 @@ export const actions = {
248
240
  printType: selectedPrintType?._id
249
241
  }
250
242
  });
243
+ console.log('layer: ', layer);
251
244
  if (preselect) {
252
245
  commit('setSelectedLayer', layer);
253
246
  }