passkit-wallet 0.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/README.md +190 -0
- package/dist/apple/index.d.ts +7 -0
- package/dist/apple/index.d.ts.map +1 -0
- package/dist/apple/index.js +5 -0
- package/dist/apple/index.js.map +1 -0
- package/dist/apple/order.d.ts +40 -0
- package/dist/apple/order.d.ts.map +1 -0
- package/dist/apple/order.js +127 -0
- package/dist/apple/order.js.map +1 -0
- package/dist/apple/pass.d.ts +36 -0
- package/dist/apple/pass.d.ts.map +1 -0
- package/dist/apple/pass.js +44 -0
- package/dist/apple/pass.js.map +1 -0
- package/dist/apple/push.d.ts +14 -0
- package/dist/apple/push.d.ts.map +1 -0
- package/dist/apple/push.js +37 -0
- package/dist/apple/push.js.map +1 -0
- package/dist/apple/registration.d.ts +41 -0
- package/dist/apple/registration.d.ts.map +1 -0
- package/dist/apple/registration.js +40 -0
- package/dist/apple/registration.js.map +1 -0
- package/dist/apple/types.d.ts +110 -0
- package/dist/apple/types.d.ts.map +1 -0
- package/dist/apple/types.js +2 -0
- package/dist/apple/types.js.map +1 -0
- package/dist/common/config.d.ts +247 -0
- package/dist/common/config.d.ts.map +1 -0
- package/dist/common/config.js +58 -0
- package/dist/common/config.js.map +1 -0
- package/dist/common/types.d.ts +54 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/types.js +20 -0
- package/dist/common/types.js.map +1 -0
- package/dist/google/index.d.ts +4 -0
- package/dist/google/index.d.ts.map +1 -0
- package/dist/google/index.js +3 -0
- package/dist/google/index.js.map +1 -0
- package/dist/google/pass.d.ts +147 -0
- package/dist/google/pass.d.ts.map +1 -0
- package/dist/google/pass.js +269 -0
- package/dist/google/pass.js.map +1 -0
- package/dist/google/push.d.ts +15 -0
- package/dist/google/push.d.ts.map +1 -0
- package/dist/google/push.js +22 -0
- package/dist/google/push.js.map +1 -0
- package/dist/google/types.d.ts +58 -0
- package/dist/google/types.d.ts.map +1 -0
- package/dist/google/types.js +2 -0
- package/dist/google/types.js.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/react/AddToAppleWallet.d.ts +20 -0
- package/dist/react/AddToAppleWallet.d.ts.map +1 -0
- package/dist/react/AddToAppleWallet.js +10 -0
- package/dist/react/AddToAppleWallet.js.map +1 -0
- package/dist/react/AddToGoogleWallet.d.ts +20 -0
- package/dist/react/AddToGoogleWallet.d.ts.map +1 -0
- package/dist/react/AddToGoogleWallet.js +10 -0
- package/dist/react/AddToGoogleWallet.js.map +1 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +3 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { type walletobjects_v1 } from "googleapis";
|
|
2
|
+
import type { GoogleClientConfig } from "../common/config.js";
|
|
3
|
+
import type { GoogleClassType, GoogleObjectType, GoogleSaveType, GoogleOfferClassOptions, GoogleOfferObjectOptions, GoogleOrderClassOptions, GoogleOrderObjectOptions } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Create an authenticated Google Wallet API client.
|
|
6
|
+
*/
|
|
7
|
+
export declare const loadClient: (config: GoogleClientConfig) => walletobjects_v1.Walletobjects;
|
|
8
|
+
export declare const getClass: (client: walletobjects_v1.Walletobjects, type: GoogleClassType, issuerId: string, classSuffix: string) => Promise<walletobjects_v1.Schema$GenericClass | null>;
|
|
9
|
+
export declare const createClass: (client: walletobjects_v1.Walletobjects, type: GoogleClassType, issuerId: string, classSuffix: string, body: object) => Promise<string>;
|
|
10
|
+
export declare const updateClass: (client: walletobjects_v1.Walletobjects, type: GoogleClassType, issuerId: string, classSuffix: string, body: object) => Promise<import("gaxios").GaxiosResponse<walletobjects_v1.Schema$GenericClass> | null>;
|
|
11
|
+
export declare const updateObject: (client: walletobjects_v1.Walletobjects, type: GoogleObjectType, issuerId: string, objectSuffix: string, body: object) => Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Generate a signed JWT URL that adds a pass to Google Wallet.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getSignedURL: (config: GoogleClientConfig, type: GoogleSaveType, objectSuffix: string, classSuffix: string) => string;
|
|
16
|
+
export declare const mountOfferClassBody: (issuerId: string, options: GoogleOfferClassOptions) => {
|
|
17
|
+
localizedTitle: {
|
|
18
|
+
defaultValue: {
|
|
19
|
+
language: string;
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
heroImage?: {
|
|
24
|
+
sourceUri: {
|
|
25
|
+
uri: string;
|
|
26
|
+
};
|
|
27
|
+
contentDescription: {
|
|
28
|
+
defaultValue: {
|
|
29
|
+
language: string;
|
|
30
|
+
value: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
} | undefined;
|
|
34
|
+
hexBackgroundColor?: string | undefined;
|
|
35
|
+
localizedIssuerName?: {
|
|
36
|
+
defaultValue: {
|
|
37
|
+
language: string;
|
|
38
|
+
value: string;
|
|
39
|
+
};
|
|
40
|
+
} | undefined;
|
|
41
|
+
titleImage?: {
|
|
42
|
+
sourceUri: {
|
|
43
|
+
uri: string;
|
|
44
|
+
};
|
|
45
|
+
contentDescription: {
|
|
46
|
+
defaultValue: {
|
|
47
|
+
language: string;
|
|
48
|
+
value: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
} | undefined;
|
|
52
|
+
id: string;
|
|
53
|
+
reviewStatus: import("./types.js").GoogleReviewStatus;
|
|
54
|
+
provider: string;
|
|
55
|
+
redemptionChannel: string;
|
|
56
|
+
};
|
|
57
|
+
export declare const mountOfferObjectBody: (issuerId: string, options: GoogleOfferObjectOptions) => {
|
|
58
|
+
id: string;
|
|
59
|
+
classId: string;
|
|
60
|
+
state: import("./types.js").GoogleObjectState;
|
|
61
|
+
barcode: {
|
|
62
|
+
type: string;
|
|
63
|
+
value: string;
|
|
64
|
+
alternateText: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export declare const mountOrderClassBody: (issuerId: string, options: GoogleOrderClassOptions) => {
|
|
68
|
+
id: string;
|
|
69
|
+
classTemplateInfo: {
|
|
70
|
+
cardTemplateOverride: {
|
|
71
|
+
cardRowTemplateInfos: {
|
|
72
|
+
twoItems: {
|
|
73
|
+
startItem: {
|
|
74
|
+
firstValue: {
|
|
75
|
+
fields: {
|
|
76
|
+
fieldPath: string;
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
endItem: {
|
|
81
|
+
firstValue: {
|
|
82
|
+
fields: {
|
|
83
|
+
fieldPath: string;
|
|
84
|
+
}[];
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}[];
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export declare const mountOrderObjectBody: (issuerId: string, options: GoogleOrderObjectOptions) => {
|
|
93
|
+
heroImage?: {
|
|
94
|
+
sourceUri: {
|
|
95
|
+
uri: string;
|
|
96
|
+
};
|
|
97
|
+
contentDescription: {
|
|
98
|
+
defaultValue: {
|
|
99
|
+
language: string;
|
|
100
|
+
value: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
} | undefined;
|
|
104
|
+
hexBackgroundColor?: string | undefined;
|
|
105
|
+
cardTitle: {
|
|
106
|
+
defaultValue: {
|
|
107
|
+
language: string;
|
|
108
|
+
value: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
subheader: {
|
|
112
|
+
defaultValue: {
|
|
113
|
+
language: string;
|
|
114
|
+
value: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
header: {
|
|
118
|
+
defaultValue: {
|
|
119
|
+
language: string;
|
|
120
|
+
value: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
textModulesData: {
|
|
124
|
+
id: string;
|
|
125
|
+
header: string;
|
|
126
|
+
body: string;
|
|
127
|
+
}[];
|
|
128
|
+
barcode: {
|
|
129
|
+
type: string;
|
|
130
|
+
value: string;
|
|
131
|
+
alternateText: string;
|
|
132
|
+
};
|
|
133
|
+
logo?: {
|
|
134
|
+
sourceUri: {
|
|
135
|
+
uri: string;
|
|
136
|
+
};
|
|
137
|
+
contentDescription: {
|
|
138
|
+
defaultValue: {
|
|
139
|
+
language: string;
|
|
140
|
+
value: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
} | undefined;
|
|
144
|
+
id: string;
|
|
145
|
+
classId: string;
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=pass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pass.d.ts","sourceRoot":"","sources":["../../src/google/pass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAGlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,YAAY,CAAA;AAInB;;GAEG;AACH,eAAO,MAAM,UAAU,GACrB,QAAQ,kBAAkB,KACzB,gBAAgB,CAAC,aAOnB,CAAA;AAID,eAAO,MAAM,QAAQ,GACnB,QAAQ,gBAAgB,CAAC,aAAa,EACtC,MAAM,eAAe,EACrB,UAAU,MAAM,EAChB,aAAa,MAAM,yDAYpB,CAAA;AAED,eAAO,MAAM,WAAW,GACtB,QAAQ,gBAAgB,CAAC,aAAa,EACtC,MAAM,eAAe,EACrB,UAAU,MAAM,EAChB,aAAa,MAAM,EACnB,MAAM,MAAM,KACX,OAAO,CAAC,MAAM,CAehB,CAAA;AAED,eAAO,MAAM,WAAW,GACtB,QAAQ,gBAAgB,CAAC,aAAa,EACtC,MAAM,eAAe,EACrB,UAAU,MAAM,EAChB,aAAa,MAAM,EACnB,MAAM,MAAM,0FAkBb,CAAA;AAED,eAAO,MAAM,YAAY,GACvB,QAAQ,gBAAgB,CAAC,aAAa,EACtC,MAAM,gBAAgB,EACtB,UAAU,MAAM,EAChB,cAAc,MAAM,EACpB,MAAM,MAAM,iBAmBb,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,QAAQ,kBAAkB,EAC1B,MAAM,cAAc,EACpB,cAAc,MAAM,EACpB,aAAa,MAAM,KAClB,MAqBF,CAAA;AAID,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,EAChB,SAAS,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCjC,CAAA;AAED,eAAO,MAAM,oBAAoB,GAC/B,UAAU,MAAM,EAChB,SAAS,wBAAwB;;;;;;;;;CAYlC,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,EAChB,SAAS,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;CAoDjC,CAAA;AAED,eAAO,MAAM,oBAAoB,GAC/B,UAAU,MAAM,EAChB,SAAS,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DlC,CAAA"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { google } from "googleapis";
|
|
2
|
+
import jwt from "jsonwebtoken";
|
|
3
|
+
// ── Client ──────────────────────────────────────────────────────────────
|
|
4
|
+
/**
|
|
5
|
+
* Create an authenticated Google Wallet API client.
|
|
6
|
+
*/
|
|
7
|
+
export const loadClient = (config) => {
|
|
8
|
+
const auth = new google.auth.GoogleAuth({
|
|
9
|
+
credentials: config.credentials,
|
|
10
|
+
scopes: ["https://www.googleapis.com/auth/wallet_object.issuer"],
|
|
11
|
+
});
|
|
12
|
+
return google.walletobjects({ version: "v1", auth });
|
|
13
|
+
};
|
|
14
|
+
// ── Class / Object CRUD ─────────────────────────────────────────────────
|
|
15
|
+
export const getClass = async (client, type, issuerId, classSuffix) => {
|
|
16
|
+
try {
|
|
17
|
+
const response = await client[type].get({
|
|
18
|
+
resourceId: `${issuerId}.${classSuffix}`,
|
|
19
|
+
});
|
|
20
|
+
return response.data;
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
if (err.response?.status === 404)
|
|
24
|
+
return null;
|
|
25
|
+
console.error(err);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export const createClass = async (client, type, issuerId, classSuffix, body) => {
|
|
30
|
+
const resourceId = `${issuerId}.${classSuffix}`;
|
|
31
|
+
try {
|
|
32
|
+
await client[type].get({ resourceId });
|
|
33
|
+
return resourceId; // already exists
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
if (err.response?.status !== 404) {
|
|
37
|
+
console.error(err);
|
|
38
|
+
return resourceId;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
await client[type].insert({ requestBody: body });
|
|
42
|
+
return resourceId;
|
|
43
|
+
};
|
|
44
|
+
export const updateClass = async (client, type, issuerId, classSuffix, body) => {
|
|
45
|
+
const resourceId = `${issuerId}.${classSuffix}`;
|
|
46
|
+
try {
|
|
47
|
+
await client[type].get({ resourceId });
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
if (err.response?.status === 404)
|
|
51
|
+
return null;
|
|
52
|
+
console.error(err);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const response = await client[type].update({
|
|
56
|
+
resourceId,
|
|
57
|
+
requestBody: body,
|
|
58
|
+
});
|
|
59
|
+
return response;
|
|
60
|
+
};
|
|
61
|
+
export const updateObject = async (client, type, issuerId, objectSuffix, body) => {
|
|
62
|
+
const resourceId = `${issuerId}.${objectSuffix}`;
|
|
63
|
+
try {
|
|
64
|
+
await client[type].get({ resourceId });
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
if (err.response?.status === 404) {
|
|
68
|
+
throw new Error(`Object ${objectSuffix} not found`);
|
|
69
|
+
}
|
|
70
|
+
throw err;
|
|
71
|
+
}
|
|
72
|
+
const response = await client[type].update({
|
|
73
|
+
resourceId,
|
|
74
|
+
requestBody: body,
|
|
75
|
+
});
|
|
76
|
+
return response;
|
|
77
|
+
};
|
|
78
|
+
// ── Signed "Save to Wallet" URL ─────────────────────────────────────────
|
|
79
|
+
/**
|
|
80
|
+
* Generate a signed JWT URL that adds a pass to Google Wallet.
|
|
81
|
+
*/
|
|
82
|
+
export const getSignedURL = (config, type, objectSuffix, classSuffix) => {
|
|
83
|
+
const claims = {
|
|
84
|
+
iss: config.credentials.client_email,
|
|
85
|
+
aud: "google",
|
|
86
|
+
origins: config.origins,
|
|
87
|
+
typ: "savetowallet",
|
|
88
|
+
payload: {
|
|
89
|
+
[type]: [
|
|
90
|
+
{
|
|
91
|
+
id: `${config.issuerId}.${objectSuffix}`,
|
|
92
|
+
classId: `${config.issuerId}.${classSuffix}`,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
const token = jwt.sign(claims, config.credentials.private_key, {
|
|
98
|
+
algorithm: "RS256",
|
|
99
|
+
});
|
|
100
|
+
return `https://pay.google.com/gp/v/save/${token}`;
|
|
101
|
+
};
|
|
102
|
+
// ── Body Builders ───────────────────────────────────────────────────────
|
|
103
|
+
export const mountOfferClassBody = (issuerId, options) => {
|
|
104
|
+
return {
|
|
105
|
+
id: `${issuerId}.${options.classSuffix}`,
|
|
106
|
+
reviewStatus: options.reviewStatus,
|
|
107
|
+
provider: options.provider,
|
|
108
|
+
redemptionChannel: "ONLINE",
|
|
109
|
+
...(options.titleImageUri && {
|
|
110
|
+
titleImage: {
|
|
111
|
+
sourceUri: { uri: options.titleImageUri },
|
|
112
|
+
contentDescription: {
|
|
113
|
+
defaultValue: {
|
|
114
|
+
language: "en-US",
|
|
115
|
+
value: options.titleImageDescription ?? "Logo",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
}),
|
|
120
|
+
...(options.issuerName && {
|
|
121
|
+
localizedIssuerName: {
|
|
122
|
+
defaultValue: { language: "en-US", value: options.issuerName },
|
|
123
|
+
},
|
|
124
|
+
}),
|
|
125
|
+
...(options.hexBackgroundColor && {
|
|
126
|
+
hexBackgroundColor: options.hexBackgroundColor,
|
|
127
|
+
}),
|
|
128
|
+
...(options.heroImageUri && {
|
|
129
|
+
heroImage: {
|
|
130
|
+
sourceUri: { uri: options.heroImageUri },
|
|
131
|
+
contentDescription: {
|
|
132
|
+
defaultValue: {
|
|
133
|
+
language: "en-US",
|
|
134
|
+
value: options.heroImageDescription ?? "Hero image",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
}),
|
|
139
|
+
localizedTitle: {
|
|
140
|
+
defaultValue: { language: "en-US", value: options.offerTitle },
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
export const mountOfferObjectBody = (issuerId, options) => {
|
|
145
|
+
return {
|
|
146
|
+
id: `${issuerId}.${options.objectSuffix}`,
|
|
147
|
+
classId: `${issuerId}.${options.classSuffix}`,
|
|
148
|
+
state: options.state ?? "ACTIVE",
|
|
149
|
+
barcode: {
|
|
150
|
+
type: "QR_CODE",
|
|
151
|
+
value: options.qrCodeUrl,
|
|
152
|
+
alternateText: "Code: " + options.code,
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
export const mountOrderClassBody = (issuerId, options) => {
|
|
157
|
+
return {
|
|
158
|
+
id: `${issuerId}.${options.classSuffix}`,
|
|
159
|
+
classTemplateInfo: {
|
|
160
|
+
cardTemplateOverride: {
|
|
161
|
+
cardRowTemplateInfos: [
|
|
162
|
+
{
|
|
163
|
+
twoItems: {
|
|
164
|
+
startItem: {
|
|
165
|
+
firstValue: {
|
|
166
|
+
fields: [
|
|
167
|
+
{ fieldPath: "object.textModulesData['status']" },
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
endItem: {
|
|
172
|
+
firstValue: {
|
|
173
|
+
fields: [
|
|
174
|
+
{ fieldPath: "object.textModulesData['order_date']" },
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
twoItems: {
|
|
182
|
+
startItem: {
|
|
183
|
+
firstValue: {
|
|
184
|
+
fields: [
|
|
185
|
+
{
|
|
186
|
+
fieldPath: "object.textModulesData['estimated_delivery']",
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
endItem: {
|
|
192
|
+
firstValue: {
|
|
193
|
+
fields: [
|
|
194
|
+
{
|
|
195
|
+
fieldPath: "object.textModulesData['tracking_number']",
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
export const mountOrderObjectBody = (issuerId, options) => {
|
|
208
|
+
return {
|
|
209
|
+
id: `${issuerId}.${options.objectSuffix}`,
|
|
210
|
+
classId: `${issuerId}.${options.classSuffix}`,
|
|
211
|
+
...(options.logoUri && {
|
|
212
|
+
logo: {
|
|
213
|
+
sourceUri: { uri: options.logoUri },
|
|
214
|
+
contentDescription: {
|
|
215
|
+
defaultValue: {
|
|
216
|
+
language: "en-US",
|
|
217
|
+
value: options.logoDescription ?? "Logo",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
}),
|
|
222
|
+
cardTitle: {
|
|
223
|
+
defaultValue: {
|
|
224
|
+
language: "en-US",
|
|
225
|
+
value: options.cardTitle ?? "Order Status",
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
subheader: {
|
|
229
|
+
defaultValue: { language: "en-US", value: "Order Number" },
|
|
230
|
+
},
|
|
231
|
+
header: {
|
|
232
|
+
defaultValue: { language: "en-US", value: options.orderNumber },
|
|
233
|
+
},
|
|
234
|
+
textModulesData: [
|
|
235
|
+
{ id: "status", header: "Status", body: options.orderStatus },
|
|
236
|
+
{ id: "order_date", header: "Order Date", body: options.orderDate },
|
|
237
|
+
{
|
|
238
|
+
id: "estimated_delivery",
|
|
239
|
+
header: "Estimated Delivery",
|
|
240
|
+
body: options.estimatedDelivery,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
id: "tracking_number",
|
|
244
|
+
header: "Tracking Number",
|
|
245
|
+
body: options.trackingNumber,
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
barcode: {
|
|
249
|
+
type: "QR_CODE",
|
|
250
|
+
value: options.qrCodeUrl,
|
|
251
|
+
alternateText: "Scan to track your order",
|
|
252
|
+
},
|
|
253
|
+
...(options.hexBackgroundColor && {
|
|
254
|
+
hexBackgroundColor: options.hexBackgroundColor,
|
|
255
|
+
}),
|
|
256
|
+
...(options.heroImageUri && {
|
|
257
|
+
heroImage: {
|
|
258
|
+
sourceUri: { uri: options.heroImageUri },
|
|
259
|
+
contentDescription: {
|
|
260
|
+
defaultValue: {
|
|
261
|
+
language: "en-US",
|
|
262
|
+
value: options.heroImageDescription ?? "Hero image",
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
}),
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
//# sourceMappingURL=pass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pass.js","sourceRoot":"","sources":["../../src/google/pass.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,GAAG,MAAM,cAAc,CAAA;AAY9B,2EAA2E;AAE3E;;GAEG;AACH,MAAM,CAAC,MA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AC1B,SAAS,EAAE;gBACT,SAAS,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,YAAY,EAAE;gBACxC,kBAAkB,EAAE;oBAClB,YAAY,EAAE;wBACZ,QAAQ,EAAE,OAAO;wBACjB,KAAK,EAAE,OAAO,CAAC,oBAAoB,IAAI,YAAY;qBACpD;iBACF;aACF;SACF,CAAC;KACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { walletobjects_v1 } from "googleapis";
|
|
2
|
+
/**
|
|
3
|
+
* Send a message/notification to a Google Wallet object to trigger an update.
|
|
4
|
+
*
|
|
5
|
+
* Google Wallet does not use push tokens like Apple. Instead, you update the
|
|
6
|
+
* class or object via the API and Google handles notifying the device.
|
|
7
|
+
*
|
|
8
|
+
* This helper wraps the `addMessage` API call to attach a visible message
|
|
9
|
+
* to a wallet object.
|
|
10
|
+
*/
|
|
11
|
+
export declare const sendObjectMessage: (client: walletobjects_v1.Walletobjects, type: "genericobject" | "offerobject", resourceId: string, message: {
|
|
12
|
+
header: string;
|
|
13
|
+
body: string;
|
|
14
|
+
}) => Promise<any>;
|
|
15
|
+
//# sourceMappingURL=push.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/google/push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,gBAAgB,CAAC,aAAa,EACtC,MAAM,eAAe,GAAG,aAAa,EACrC,YAAY,MAAM,EAClB,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,iBAa1C,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send a message/notification to a Google Wallet object to trigger an update.
|
|
3
|
+
*
|
|
4
|
+
* Google Wallet does not use push tokens like Apple. Instead, you update the
|
|
5
|
+
* class or object via the API and Google handles notifying the device.
|
|
6
|
+
*
|
|
7
|
+
* This helper wraps the `addMessage` API call to attach a visible message
|
|
8
|
+
* to a wallet object.
|
|
9
|
+
*/
|
|
10
|
+
export const sendObjectMessage = async (client, type, resourceId, message) => {
|
|
11
|
+
const response = await client[type].addmessage({
|
|
12
|
+
resourceId,
|
|
13
|
+
requestBody: {
|
|
14
|
+
message: {
|
|
15
|
+
header: message.header,
|
|
16
|
+
body: message.body,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return response.data;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=push.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/google/push.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,MAAsC,EACtC,IAAqC,EACrC,UAAkB,EAClB,OAAyC,EACzC,EAAE;IACF,MAAM,QAAQ,GAAG,MAAO,MAAM,CAAC,IAAI,CAAS,CAAC,UAAU,CAAC;QACtD,UAAU;QACV,WAAW,EAAE;YACX,OAAO,EAAE;gBACP,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB;SACF;KACF,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type GoogleReviewStatus = "REVIEW_STATUS_UNSPECIFIED" | "UNDER_REVIEW" | "APPROVED" | "REJECTED" | "DRAFT";
|
|
2
|
+
export type GoogleObjectState = "STATE_UNSPECIFIED" | "ACTIVE" | "COMPLETED" | "EXPIRED" | "INACTIVE";
|
|
3
|
+
export type GoogleClassType = "genericclass" | "offerclass";
|
|
4
|
+
export type GoogleObjectType = "genericobject" | "offerobject";
|
|
5
|
+
export type GoogleSaveType = "genericObjects" | "offerObjects";
|
|
6
|
+
/** Options for building a Google Wallet offer class. */
|
|
7
|
+
export interface GoogleOfferClassOptions {
|
|
8
|
+
classSuffix: string;
|
|
9
|
+
offerTitle: string;
|
|
10
|
+
reviewStatus: GoogleReviewStatus;
|
|
11
|
+
/** Provider / issuer display name */
|
|
12
|
+
provider: string;
|
|
13
|
+
/** Hex background color (e.g. "#000000") */
|
|
14
|
+
hexBackgroundColor?: string;
|
|
15
|
+
/** Title image URI */
|
|
16
|
+
titleImageUri?: string;
|
|
17
|
+
titleImageDescription?: string;
|
|
18
|
+
/** Hero image URI */
|
|
19
|
+
heroImageUri?: string;
|
|
20
|
+
heroImageDescription?: string;
|
|
21
|
+
/** Localized issuer name */
|
|
22
|
+
issuerName?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Options for building a Google Wallet offer object. */
|
|
25
|
+
export interface GoogleOfferObjectOptions {
|
|
26
|
+
classSuffix: string;
|
|
27
|
+
objectSuffix: string;
|
|
28
|
+
code: string;
|
|
29
|
+
qrCodeUrl: string;
|
|
30
|
+
state?: GoogleObjectState;
|
|
31
|
+
}
|
|
32
|
+
/** Options for building a Google Wallet order class (generic class). */
|
|
33
|
+
export interface GoogleOrderClassOptions {
|
|
34
|
+
classSuffix: string;
|
|
35
|
+
}
|
|
36
|
+
/** Options for building a Google Wallet order object (generic object). */
|
|
37
|
+
export interface GoogleOrderObjectOptions {
|
|
38
|
+
classSuffix: string;
|
|
39
|
+
objectSuffix: string;
|
|
40
|
+
orderNumber: string;
|
|
41
|
+
orderDate: string;
|
|
42
|
+
orderStatus: string;
|
|
43
|
+
estimatedDelivery: string;
|
|
44
|
+
trackingNumber: string;
|
|
45
|
+
/** QR code value / URL */
|
|
46
|
+
qrCodeUrl: string;
|
|
47
|
+
/** Card title (default: "Order Status") */
|
|
48
|
+
cardTitle?: string;
|
|
49
|
+
/** Hex background color */
|
|
50
|
+
hexBackgroundColor?: string;
|
|
51
|
+
/** Logo image URI */
|
|
52
|
+
logoUri?: string;
|
|
53
|
+
logoDescription?: string;
|
|
54
|
+
/** Hero image URI */
|
|
55
|
+
heroImageUri?: string;
|
|
56
|
+
heroImageDescription?: string;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/google/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAC1B,2BAA2B,GAC3B,cAAc,GACd,UAAU,GACV,UAAU,GACV,OAAO,CAAA;AAEX,MAAM,MAAM,iBAAiB,GACzB,mBAAmB,GACnB,QAAQ,GACR,WAAW,GACX,SAAS,GACT,UAAU,CAAA;AAEd,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,YAAY,CAAA;AAC3D,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,aAAa,CAAA;AAC9D,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,cAAc,CAAA;AAE9D,wDAAwD;AACxD,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,kBAAkB,CAAA;IAChC,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,4CAA4C;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,sBAAsB;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,yDAAyD;AACzD,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,iBAAiB,CAAA;CAC1B;AAED,wEAAwE;AACxE,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,0EAA0E;AAC1E,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2BAA2B;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/google/types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export { loadPassTemplate, mountCouponPassBody, loadOrderModel, mountOrderInstance, generateOrder, writeOrderCertificates, addImagesToModelDir, removeImagesFromModelDir, sendPushNotification, parseRegistrationRequest, parseUnregistrationRequest, } from "./apple/index.js";
|
|
2
|
+
export { loadClient, getClass, createClass, updateClass, updateObject, getSignedURL, mountOfferClassBody, mountOfferObjectBody, mountOrderClassBody, mountOrderObjectBody, sendObjectMessage, } from "./google/index.js";
|
|
3
|
+
export { applePassConfigSchema, appleOrderConfigSchema, appleClientConfigSchema, googleClientConfigSchema, } from "./common/config.js";
|
|
4
|
+
export type { ApplePassConfig, AppleOrderConfig, AppleClientConfig, GoogleClientConfig, } from "./common/config.js";
|
|
5
|
+
export { translateOrderStatus } from "./common/types.js";
|
|
6
|
+
export type { OrderStatus, CouponPassData, OrderData } from "./common/types.js";
|
|
7
|
+
export type { OrderInstance, Merchant, Payment, MoneyAmount, SummaryItem, LineItem, Fulfillment, AppleCouponPassOptions, AppleOrderOptions, ApplePushOptions, } from "./apple/types.js";
|
|
8
|
+
export type { GoogleReviewStatus, GoogleObjectState, GoogleClassType, GoogleObjectType, GoogleSaveType, GoogleOfferClassOptions, GoogleOfferObjectOptions, GoogleOrderClassOptions, GoogleOrderObjectOptions, } from "./google/types.js";
|
|
9
|
+
import type { ApplePassConfig, AppleOrderConfig, GoogleClientConfig } from "./common/config.js";
|
|
10
|
+
/**
|
|
11
|
+
* Create a configured Apple Wallet client with convenience methods.
|
|
12
|
+
*/
|
|
13
|
+
export declare const createAppleWalletClient: (config: {
|
|
14
|
+
pass?: ApplePassConfig;
|
|
15
|
+
order?: AppleOrderConfig;
|
|
16
|
+
}) => {
|
|
17
|
+
/** Load the pass template (requires `pass` config). */
|
|
18
|
+
loadPassTemplate: () => Promise<import("@walletpass/pass-js").Template>;
|
|
19
|
+
/** Load the order model (requires `order` config). */
|
|
20
|
+
loadOrderModel: () => Promise<import("./index.js").OrderInstance>;
|
|
21
|
+
/** Generate a signed .order file buffer (requires `order` config). */
|
|
22
|
+
generateOrder: (orderInstance: Record<string, unknown>, images?: string[]) => Promise<Buffer<ArrayBufferLike>>;
|
|
23
|
+
/** Build an order instance body (requires `order` config). */
|
|
24
|
+
mountOrderInstance: (options: import("./apple/types.js").AppleOrderOptions) => Record<string, unknown>;
|
|
25
|
+
/** Send an APN push notification. */
|
|
26
|
+
sendPushNotification: (pushTokens: string | string[], topic: string) => Promise<{
|
|
27
|
+
sent: number;
|
|
28
|
+
failed: number;
|
|
29
|
+
}>;
|
|
30
|
+
passConfig: {
|
|
31
|
+
passTypeIdentifier: string;
|
|
32
|
+
teamIdentifier: string;
|
|
33
|
+
certificate: string;
|
|
34
|
+
privateKey: string;
|
|
35
|
+
wwdrCertificate: string;
|
|
36
|
+
webServiceURL: string;
|
|
37
|
+
authenticationToken: string;
|
|
38
|
+
passTemplatePath: string;
|
|
39
|
+
allowHttp: boolean;
|
|
40
|
+
keyPassword?: string | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
orderConfig: {
|
|
43
|
+
certificate: string;
|
|
44
|
+
privateKey: string;
|
|
45
|
+
wwdrCertificate: string;
|
|
46
|
+
webServiceURL: string;
|
|
47
|
+
authenticationToken: string;
|
|
48
|
+
orderTypeIdentifier: string;
|
|
49
|
+
orderModelPath: string;
|
|
50
|
+
keyPassword?: string | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Create a configured Google Wallet client with convenience methods.
|
|
55
|
+
*/
|
|
56
|
+
export declare const createGoogleWalletClient: (config: GoogleClientConfig) => {
|
|
57
|
+
client: import("googleapis").walletobjects_v1.Walletobjects;
|
|
58
|
+
config: {
|
|
59
|
+
issuerId: string;
|
|
60
|
+
credentials: {
|
|
61
|
+
client_email: string;
|
|
62
|
+
private_key: string;
|
|
63
|
+
} & {
|
|
64
|
+
[k: string]: unknown;
|
|
65
|
+
};
|
|
66
|
+
origins: string[];
|
|
67
|
+
};
|
|
68
|
+
/** Generate a signed "Save to Wallet" URL. */
|
|
69
|
+
getSignedURL: (type: import("./google/types.js").GoogleSaveType, objectSuffix: string, classSuffix: string) => string;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,aAAa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