pinelab-storefront-client
Advanced tools
Comparing version 0.50.0 to 0.51.0
@@ -14,2 +14,3 @@ import { Store } from './store'; | ||
ProductQuery, | ||
UpdateOrderCustomFieldsInput, | ||
} from '../generated/graphql'; | ||
@@ -64,4 +65,8 @@ export declare class VendureClient { | ||
): Promise<MyparcelDropOffPoint[]>; | ||
setPickupLocationOnOrder( | ||
customFields: UpdateOrderCustomFieldsInput | ||
): Promise<OrderFieldsFragment>; | ||
unsetPickupLocation(): Promise<OrderFieldsFragment>; | ||
validateResult(result: any): void; | ||
request<T = void, I = void>(document: string, variables?: I): Promise<T>; | ||
} |
@@ -258,11 +258,14 @@ 'use strict'; | ||
})[0]; | ||
if (!defaultMethod) return [3 /*break*/, 3]; | ||
if (!defaultMethod) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, this.setOrderShippingMethod(defaultMethod.id)]; | ||
case 2: | ||
_a.sent(); | ||
return [3 /*break*/, 4]; | ||
return [4 /*yield*/, this.unsetPickupLocation()]; | ||
case 3: | ||
_a.sent(); | ||
return [3 /*break*/, 5]; | ||
case 4: | ||
console.error('No default shipping found'); | ||
_a.label = 4; | ||
case 4: | ||
_a.label = 5; | ||
case 5: | ||
return [2 /*return*/]; | ||
@@ -568,2 +571,44 @@ } | ||
}; | ||
VendureClient.prototype.setPickupLocationOnOrder = function (customFields) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var order; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
return [ | ||
4 /*yield*/, | ||
this.request(vendure_queries_1.SET_PICKUP_LOCATION_FOR_ORDER, { | ||
customFields: customFields, | ||
}), | ||
]; | ||
case 1: | ||
order = _a.sent().setOrderCustomFields; | ||
this.validateResult(order); | ||
this.store.activeOrder = order; | ||
return [2 /*return*/, order]; | ||
} | ||
}); | ||
}); | ||
}; | ||
VendureClient.prototype.unsetPickupLocation = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
// null is needed, otherwise it cannot be unset | ||
return [ | ||
2 /*return*/, | ||
this.setPickupLocationOnOrder({ | ||
// @ts-ignore | ||
pickupLocationNumber: null, | ||
pickupLocationCarrier: null, | ||
pickupLocationName: null, | ||
pickupLocationStreet: null, | ||
pickupLocationHouseNumber: null, | ||
pickupLocationZipcode: null, | ||
pickupLocationCity: null, | ||
pickupLocationCountry: null, // @ts-ignore | ||
}), | ||
]; | ||
}); | ||
}); | ||
}; | ||
VendureClient.prototype.validateResult = function (result) { | ||
@@ -570,0 +615,0 @@ var _a; |
@@ -22,1 +22,2 @@ export declare const PRODUCT_FIELDS: string; | ||
export declare const GET_DROP_OFF_POINTS: string; | ||
export declare const SET_PICKUP_LOCATION_FOR_ORDER: string; |
@@ -13,3 +13,4 @@ 'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.GET_DROP_OFF_POINTS = | ||
exports.SET_PICKUP_LOCATION_FOR_ORDER = | ||
exports.GET_DROP_OFF_POINTS = | ||
exports.REMOVE_COUPON_CODE = | ||
@@ -300,2 +301,16 @@ exports.REMOVE_ALL_ORDER_LINES = | ||
); | ||
exports.SET_PICKUP_LOCATION_FOR_ORDER = graphql_request_1.gql( | ||
templateObject_22 || | ||
(templateObject_22 = __makeTemplateObject( | ||
[ | ||
'\n ', | ||
'\n mutation setOrderCustomFields($customFields: UpdateOrderCustomFieldsInput) {\n setOrderCustomFields(input: { customFields: $customFields }) {\n ... on Order {\n ...OrderFields\n }\n ... on NoActiveOrderError {\n errorCode\n message\n }\n }\n }\n', | ||
], | ||
[ | ||
'\n ', | ||
'\n mutation setOrderCustomFields($customFields: UpdateOrderCustomFieldsInput) {\n setOrderCustomFields(input: { customFields: $customFields }) {\n ... on Order {\n ...OrderFields\n }\n ... on NoActiveOrderError {\n errorCode\n message\n }\n }\n }\n', | ||
] | ||
)), | ||
exports.ORDER_FIELDS | ||
); | ||
var templateObject_1, | ||
@@ -321,2 +336,3 @@ templateObject_2, | ||
templateObject_20, | ||
templateObject_21; | ||
templateObject_21, | ||
templateObject_22; |
{ | ||
"name": "pinelab-storefront-client", | ||
"version": "0.50.0", | ||
"version": "0.51.0", | ||
"description": "Generates static html pages with Gridsome and suplied Vue components", | ||
@@ -50,3 +50,3 @@ "author": "Martijn van de Brug <martijn@pinelab.studio>", | ||
}, | ||
"gitHead": "994d938d18a8dd11e024e6399d496b285ad150c5" | ||
"gitHead": "061d6904deb550d3040bb67207b74019e87f1a94" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
644589
8355