Socket
Socket
Sign inDemoInstall

@pinelab/vendure-order-client

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pinelab/vendure-order-client - npm Package Compare versions

Comparing version 2.8.0 to 2.8.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 2.8.1 (2023-12-01)
- Added `pollOrderByCode` to poll for order every second
# 2.8.0 (2024-01-04)

@@ -2,0 +6,0 @@

@@ -694,2 +694,18 @@ import { gql, GraphQLClient } from 'graphql-request';

}
/**
* Poll order by code for a given poll amount of times. And Poll for x seconds
*/
async pollOrderByCode(code, pollFor = 10, acceptedStates = ['PaymentSettled', 'PaymentAuthorized']) {
let order;
let pollingCount = 0;
while (!order || !acceptedStates.includes(order === null || order === void 0 ? void 0 : order.state)) {
if (pollingCount > pollFor) {
throw Error(`Order not found after polling ${pollFor} times`);
}
order = await this.getOrderByCode(code);
await new Promise((resolve) => setTimeout(resolve, 1000));
pollingCount++;
}
return order;
}
async registerCustomerAccount(input) {

@@ -847,2 +863,8 @@ const { registerCustomerAccount } = await this.rawRequest(this.queries.REGISTER_CUSTOMER_ACCOUNT, { input });

], VendureOrderClient.prototype, "getOrderByCode", null);
__decorate([
HandleLoadingState('$activeOrder'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Number, Array]),
__metadata("design:returntype", Promise)
], VendureOrderClient.prototype, "pollOrderByCode", null);

@@ -849,0 +871,0 @@ var AdjustmentType;

@@ -48,2 +48,6 @@ import { GraphQLClient } from 'graphql-request';

getOrderByCode(code: string): Promise<ActiveOrder<A>>;
/**
* Poll order by code for a given poll amount of times. And Poll for x seconds
*/
pollOrderByCode(code: string, pollFor?: number, acceptedStates?: string[]): Promise<ActiveOrder<A>>;
registerCustomerAccount(input: RegisterCustomerInput): Promise<Success | ErrorResult>;

@@ -50,0 +54,0 @@ requestPasswordReset(emailAddress: string): Promise<Success | ErrorResult | undefined>;

4

package.json
{
"name": "@pinelab/vendure-order-client",
"version": "2.8.0",
"version": "2.8.1",
"description": "A tiny, framework agnostic client for managing active orders and checkout with Vendure.",

@@ -40,3 +40,3 @@ "author": "Martijn van de Brug <martijn@pinelab.studio>",

},
"gitHead": "d934dca456447058c062f371fafb8d3206c1405a"
"gitHead": "8e39c6ecc3e5acdca075411566f989e3b910a422"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc