@autofleet/element-pay 1.0.4 → 1.1.0

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
@@ -1,4 +1,5 @@
1
1
  import { GraphQLClient, RequestOptions } from "graphql-request";
2
+ import { FuelSupplier } from "@autofleet/common-types/lib/pit-stop";
2
3
 
3
4
  //#region src/generated/sdk.d.ts
4
5
  type Maybe<T> = T | null;
@@ -61,6 +62,11 @@ interface EntityCreateInput {
61
62
  /** ID of parent entity, if there is one. */
62
63
  parentId?: InputMaybe<Scalars["ID"]["input"]>;
63
64
  }
65
+ declare enum FeeNetworkDesignationType {
66
+ ExtendedNetwork = "EXTENDED_NETWORK",
67
+ InNetwork = "IN_NETWORK",
68
+ OutOfNetwork = "OUT_OF_NETWORK",
69
+ }
64
70
  declare enum FundingSource {
65
71
  /** Electronic bank transfer. */
66
72
  Ach = "ACH",
@@ -144,5 +150,78 @@ interface ElementPayClientConfig {
144
150
  }
145
151
  declare function createElementPayClient(config: ElementPayClientConfig): ReturnType<typeof getSdk>;
146
152
  //#endregion
147
- export { type ElementPayClientConfig, createElementPayClient };
153
+ //#region src/pubSub/interfaces.d.ts
154
+ interface RawProvider {
155
+ id: string;
156
+ name: string;
157
+ label: string;
158
+ description: string;
159
+ inserted_at: string;
160
+ updated_at: string;
161
+ }
162
+ interface RawService {
163
+ id: string;
164
+ name: string;
165
+ type_id: string;
166
+ type: {
167
+ id: string;
168
+ name: string;
169
+ };
170
+ }
171
+ interface ServiceLocationFromEvent {
172
+ id: string;
173
+ provider_id: string;
174
+ provider: RawProvider;
175
+ name: string;
176
+ address: {
177
+ line1: string;
178
+ line2: string;
179
+ city: string;
180
+ state: string;
181
+ country: string;
182
+ zip: string;
183
+ };
184
+ geocoded: {
185
+ lng: number;
186
+ lat: number;
187
+ };
188
+ amenities: unknown[];
189
+ services: RawService[];
190
+ phone: string;
191
+ integration: string;
192
+ physical_card_enabled: boolean;
193
+ ttp_enabled: boolean;
194
+ enabled: boolean;
195
+ out_of_network: boolean;
196
+ is_validated: boolean;
197
+ inserted_at: string;
198
+ updated_at: string;
199
+ deleted_at: string | null;
200
+ cost_factor: number;
201
+ SyncControl: unknown;
202
+ rebate_eligible: boolean;
203
+ fee_network_designation: FeeNetworkDesignationType;
204
+ nfc_status: string;
205
+ }
206
+ interface ServiceLocationEvent {
207
+ ID: Buffer | string;
208
+ ServiceLocation: ServiceLocationFromEvent | Buffer;
209
+ ExternalId: string;
210
+ PriceApiId: string;
211
+ ExternalIdMap: Record<string, string>;
212
+ TargetEnvironment: string;
213
+ Parameters: {
214
+ action: string;
215
+ };
216
+ Generated: Date;
217
+ }
218
+ //#endregion
219
+ //#region src/service-locations/utils.d.ts
220
+ declare const serviceLocationEventToFuelSupplier: ({
221
+ serviceLocationEvent
222
+ }: {
223
+ serviceLocationEvent: ServiceLocationEvent;
224
+ }) => Partial<FuelSupplier>;
225
+ //#endregion
226
+ export { type ElementPayClientConfig, createElementPayClient, serviceLocationEventToFuelSupplier };
148
227
  //# sourceMappingURL=index.d.cts.map
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { GraphQLClient, RequestOptions } from "graphql-request";
2
+ import { FuelSupplier } from "@autofleet/common-types/lib/pit-stop";
2
3
 
3
4
  //#region src/generated/sdk.d.ts
4
5
  type Maybe<T> = T | null;
@@ -61,6 +62,11 @@ interface EntityCreateInput {
61
62
  /** ID of parent entity, if there is one. */
62
63
  parentId?: InputMaybe<Scalars["ID"]["input"]>;
63
64
  }
65
+ declare enum FeeNetworkDesignationType {
66
+ ExtendedNetwork = "EXTENDED_NETWORK",
67
+ InNetwork = "IN_NETWORK",
68
+ OutOfNetwork = "OUT_OF_NETWORK",
69
+ }
64
70
  declare enum FundingSource {
65
71
  /** Electronic bank transfer. */
66
72
  Ach = "ACH",
@@ -144,5 +150,78 @@ interface ElementPayClientConfig {
144
150
  }
145
151
  declare function createElementPayClient(config: ElementPayClientConfig): ReturnType<typeof getSdk>;
146
152
  //#endregion
147
- export { type ElementPayClientConfig, createElementPayClient };
153
+ //#region src/pubSub/interfaces.d.ts
154
+ interface RawProvider {
155
+ id: string;
156
+ name: string;
157
+ label: string;
158
+ description: string;
159
+ inserted_at: string;
160
+ updated_at: string;
161
+ }
162
+ interface RawService {
163
+ id: string;
164
+ name: string;
165
+ type_id: string;
166
+ type: {
167
+ id: string;
168
+ name: string;
169
+ };
170
+ }
171
+ interface ServiceLocationFromEvent {
172
+ id: string;
173
+ provider_id: string;
174
+ provider: RawProvider;
175
+ name: string;
176
+ address: {
177
+ line1: string;
178
+ line2: string;
179
+ city: string;
180
+ state: string;
181
+ country: string;
182
+ zip: string;
183
+ };
184
+ geocoded: {
185
+ lng: number;
186
+ lat: number;
187
+ };
188
+ amenities: unknown[];
189
+ services: RawService[];
190
+ phone: string;
191
+ integration: string;
192
+ physical_card_enabled: boolean;
193
+ ttp_enabled: boolean;
194
+ enabled: boolean;
195
+ out_of_network: boolean;
196
+ is_validated: boolean;
197
+ inserted_at: string;
198
+ updated_at: string;
199
+ deleted_at: string | null;
200
+ cost_factor: number;
201
+ SyncControl: unknown;
202
+ rebate_eligible: boolean;
203
+ fee_network_designation: FeeNetworkDesignationType;
204
+ nfc_status: string;
205
+ }
206
+ interface ServiceLocationEvent {
207
+ ID: Buffer | string;
208
+ ServiceLocation: ServiceLocationFromEvent | Buffer;
209
+ ExternalId: string;
210
+ PriceApiId: string;
211
+ ExternalIdMap: Record<string, string>;
212
+ TargetEnvironment: string;
213
+ Parameters: {
214
+ action: string;
215
+ };
216
+ Generated: Date;
217
+ }
218
+ //#endregion
219
+ //#region src/service-locations/utils.d.ts
220
+ declare const serviceLocationEventToFuelSupplier: ({
221
+ serviceLocationEvent
222
+ }: {
223
+ serviceLocationEvent: ServiceLocationEvent;
224
+ }) => Partial<FuelSupplier>;
225
+ //#endregion
226
+ export { type ElementPayClientConfig, createElementPayClient, serviceLocationEventToFuelSupplier };
148
227
  //# 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";const n=t`
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`
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";const
18
18
  deletedAt
19
19
  }
20
20
  }
21
- `,r=t`
21
+ `,i=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";const
32
32
  updatedAt
33
33
  }
34
34
  }
35
- `,i=(e,t,n,r)=>e();function a(e,t=i){return{organizationCreate(r,i,a){return t(t=>e.request({document:n,variables:r,requestHeaders:{...i,...t},signal:a}),`organizationCreate`,`mutation`,r)},entityCreate(n,i,a){return t(t=>e.request({document:r,variables:n,requestHeaders:{...i,...t},signal:a}),`entityCreate`,`mutation`,n)}}}function o(t){return a(new e(t.endpoint,{headers:{"x-api-key":t.apiKey,"Content-Type":`application/json`}}))}export{o as createElementPayClient};
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};
36
36
  //# sourceMappingURL=index.js.map