@autofleet/element-pay 1.1.0 → 1.1.1

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.
package/lib/index.d.cts CHANGED
@@ -223,5 +223,8 @@ declare const serviceLocationEventToFuelSupplier: ({
223
223
  serviceLocationEvent: ServiceLocationEvent;
224
224
  }) => Partial<FuelSupplier>;
225
225
  //#endregion
226
- export { type ElementPayClientConfig, createElementPayClient, serviceLocationEventToFuelSupplier };
226
+ //#region src/service-locations/index.d.ts
227
+ declare const serviceLocationPubSubMessageToFuelSupplier: (message: string) => ReturnType<typeof serviceLocationEventToFuelSupplier>;
228
+ //#endregion
229
+ export { type ElementPayClientConfig, createElementPayClient, serviceLocationPubSubMessageToFuelSupplier };
227
230
  //# sourceMappingURL=index.d.cts.map
package/lib/index.d.ts CHANGED
@@ -223,5 +223,8 @@ declare const serviceLocationEventToFuelSupplier: ({
223
223
  serviceLocationEvent: ServiceLocationEvent;
224
224
  }) => Partial<FuelSupplier>;
225
225
  //#endregion
226
- export { type ElementPayClientConfig, createElementPayClient, serviceLocationEventToFuelSupplier };
226
+ //#region src/service-locations/index.d.ts
227
+ declare const serviceLocationPubSubMessageToFuelSupplier: (message: string) => ReturnType<typeof serviceLocationEventToFuelSupplier>;
228
+ //#endregion
229
+ export { type ElementPayClientConfig, createElementPayClient, serviceLocationPubSubMessageToFuelSupplier };
227
230
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{GraphQLClient as e}from"graphql-request";import t from"graphql-tag";import{FUEL_BRANDS as n}from"@autofleet/common-types/lib/pit-stop";const r=t`
1
+ import{GraphQLClient as e}from"graphql-request";import t from"graphql-tag";import{decode as n}from"@msgpack/msgpack";import{FUEL_BRANDS as r}from"@autofleet/common-types/lib/pit-stop";const i=t`
2
2
  mutation organizationCreate($input: OrganizationCreateInput!) {
3
3
  organizationCreate(input: $input) {
4
4
  id
@@ -18,7 +18,7 @@ import{GraphQLClient as e}from"graphql-request";import t from"graphql-tag";impor
18
18
  deletedAt
19
19
  }
20
20
  }
21
- `,i=t`
21
+ `,a=t`
22
22
  mutation entityCreate($input: EntityCreateInput!) {
23
23
  entityCreate(input: $input) {
24
24
  id
@@ -32,5 +32,5 @@ import{GraphQLClient as e}from"graphql-request";import t from"graphql-tag";impor
32
32
  updatedAt
33
33
  }
34
34
  }
35
- `,a=(e,t,n,r)=>e();function o(e,t=a){return{organizationCreate(n,i,a){return t(t=>e.request({document:r,variables:n,requestHeaders:{...i,...t},signal:a}),`organizationCreate`,`mutation`,n)},entityCreate(n,r,a){return t(t=>e.request({document:i,variables:n,requestHeaders:{...r,...t},signal:a}),`entityCreate`,`mutation`,n)}}}function s(t){return o(new e(t.endpoint,{headers:{"x-api-key":t.apiKey,"Content-Type":`application/json`}}))}const c={EXXON:n.EXXONMOBIL,MOBIL:n.EXXONMOBIL,SHELL:n.SHELL,SUNOCO:n.SUNOCO},l=({serviceLocationEvent:e})=>{let t=e.ServiceLocation,{address:n,geocoded:r}=t;return{acceptElementPay:!0,address:[n.line1,n.line2,n.city,n.state,n.zip].filter(Boolean).join(`, `),externalId:t.id,name:t.name,brandName:c[t.provider.name]||null,lat:r.lat,lng:r.lng,directPayEnabled:!t.out_of_network,ttpEnabled:t.ttp_enabled,isActive:t.enabled&&!t.deleted_at}};export{s as createElementPayClient,l as serviceLocationEventToFuelSupplier};
35
+ `,o=(e,t,n,r)=>e();function s(e,t=o){return{organizationCreate(n,r,a){return t(t=>e.request({document:i,variables:n,requestHeaders:{...r,...t},signal:a}),`organizationCreate`,`mutation`,n)},entityCreate(n,r,i){return t(t=>e.request({document:a,variables:n,requestHeaders:{...r,...t},signal:i}),`entityCreate`,`mutation`,n)}}}function c(t){return s(new e(t.endpoint,{headers:{"x-api-key":t.apiKey,"Content-Type":`application/json`}}))}const l=e=>n(Buffer.from(e,`base64`)),u=e=>{let t=l(e);if(Buffer.isBuffer(t.ID)&&(t.ID=t.ID.toString(`hex`)),Buffer.isBuffer(t.ServiceLocation)){let e=t.ServiceLocation.toString(`utf8`);t.ServiceLocation=JSON.parse(e)}return t},d={EXXON:r.EXXONMOBIL,MOBIL:r.EXXONMOBIL,SHELL:r.SHELL,SUNOCO:r.SUNOCO},f=({serviceLocationEvent:e})=>{let t=e.ServiceLocation,{address:n,geocoded:r}=t;return{acceptElementPay:!0,address:[n.line1,n.line2,n.city,n.state,n.zip].filter(Boolean).join(`, `),externalId:t.id,name:t.name,brandName:d[t.provider.name]||null,lat:r.lat,lng:r.lng,directPayEnabled:!t.out_of_network,ttpEnabled:t.ttp_enabled,isActive:t.enabled&&!t.deleted_at}},p=e=>f({serviceLocationEvent:u(e)});export{c as createElementPayClient,p as serviceLocationPubSubMessageToFuelSupplier};
36
36
  //# sourceMappingURL=index.js.map