@agnostack/next-shopify 1.7.0-alpha.2 → 1.7.0-alpha.21
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/dist/handlers/api.js +31 -14
- package/dist/handlers/api.js.map +1 -1
- package/dist/handlers/ssr.d.ts +1 -10
- package/dist/handlers/ssr.js +18 -15
- package/dist/handlers/ssr.js.map +1 -1
- package/dist/helpers/auth.d.ts +1 -9
- package/dist/helpers/auth.js +19 -11
- package/dist/helpers/auth.js.map +1 -1
- package/dist/helpers/callback.d.ts +1 -4
- package/dist/helpers/callback.js +35 -28
- package/dist/helpers/callback.js.map +1 -1
- package/dist/helpers/graph.d.ts +1 -1
- package/dist/helpers/graph.js +3 -5
- package/dist/helpers/graph.js.map +1 -1
- package/dist/helpers/rest.js +6 -9
- package/dist/helpers/rest.js.map +1 -1
- package/dist/helpers/uninstall.js +10 -16
- package/dist/helpers/uninstall.js.map +1 -1
- package/dist/utils/billing.d.ts +11 -20
- package/dist/utils/billing.js +52 -190
- package/dist/utils/billing.js.map +1 -1
- package/dist/utils/constants.d.ts +4 -5
- package/dist/utils/constants.js +4 -72
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/display.d.ts +1 -1
- package/dist/utils/firebase.d.ts +13 -6
- package/dist/utils/firebase.js +35 -39
- package/dist/utils/firebase.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/session.d.ts +16 -11
- package/dist/utils/session.js +45 -34
- package/dist/utils/session.js.map +1 -1
- package/dist/utils/shopify-api-node/beginAuth.js +3 -2
- package/dist/utils/shopify-api-node/beginAuth.js.map +1 -1
- package/dist/utils/shopify.d.ts +4 -3
- package/dist/utils/shopify.js +49 -15
- package/dist/utils/shopify.js.map +1 -1
- package/dist/withShopify.js +15 -17
- package/dist/withShopify.js.map +1 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -469
- package/dist/utils/webhooks.d.ts +0 -1
- package/dist/utils/webhooks.js +0 -22
- package/dist/utils/webhooks.js.map +0 -1
package/dist/utils/billing.js
CHANGED
|
@@ -1,209 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generatePaymentConfig = exports.
|
|
3
|
+
exports.generatePaymentConfig = exports.ensureBilling = void 0;
|
|
4
4
|
const shopify_api_1 = require("@shopify/shopify-api");
|
|
5
5
|
const display_1 = require("./display");
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.shopify = shopify;
|
|
18
|
-
this.shop = session.shop;
|
|
19
|
-
this.graphClient = new shopify.clients.Graphql({ session });
|
|
20
|
-
this.session = session;
|
|
21
|
-
this.accessToken = session.accessToken;
|
|
22
|
-
this.appId = APP_ID;
|
|
23
|
-
this.appBaseUrl = APP_BASE_URL;
|
|
24
|
-
this.paymentConfig = display_1.ensureObject(PAYMENT_CONFIG);
|
|
25
|
-
this.isRecurring = constants_1.RECURRING_INTERVALS.includes(this.paymentConfig.type);
|
|
26
|
-
}
|
|
27
|
-
async ensureBilling() {
|
|
28
|
-
var _a;
|
|
29
|
-
try {
|
|
30
|
-
if (await this.hasActivePayment()) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
return this.requestPayment();
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
if (error instanceof shopify_api_1.GraphqlQueryError) {
|
|
37
|
-
throw new shopify_api_1.BillingError({
|
|
38
|
-
message: 'Failed to verify or initialize payment',
|
|
39
|
-
errorData: display_1.ensureArray((_a = error.response) === null || _a === void 0 ? void 0 : _a.errors).map(({ message }) => display_1.ensureString(message)),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async hasActiveRecurringPayment() {
|
|
46
|
-
var _a, _b, _c;
|
|
47
|
-
const currentInstallations = await this.graphClient.query({
|
|
48
|
-
data: constants_1.RECURRING_PURCHASES_QUERY,
|
|
7
|
+
const hasValidBilling = (session, paymentConfig) => (display_1.stringNotEmpty(session === null || session === void 0 ? void 0 : session.shop) &&
|
|
8
|
+
display_1.stringNotEmpty(session === null || session === void 0 ? void 0 : session.accessToken) &&
|
|
9
|
+
display_1.stringNotEmpty(paymentConfig === null || paymentConfig === void 0 ? void 0 : paymentConfig.name) &&
|
|
10
|
+
display_1.objectNotEmpty(paymentConfig === null || paymentConfig === void 0 ? void 0 : paymentConfig.config) &&
|
|
11
|
+
Object.values(constants_1.BILLING_INTERVALS).includes(paymentConfig === null || paymentConfig === void 0 ? void 0 : paymentConfig.type));
|
|
12
|
+
// TODO: minor update to handle if no paymentConfig or !paymentConfig.req'd return undefined??
|
|
13
|
+
const ensureBilling = async (shopify, session, paymentConfig) => {
|
|
14
|
+
if (!hasValidBilling(session, paymentConfig)) {
|
|
15
|
+
throw new shopify_api_1.BillingError({
|
|
16
|
+
message: 'Invalid billing configuration',
|
|
49
17
|
});
|
|
50
|
-
const subscriptions = (_c = (_b = (_a = currentInstallations === null || currentInstallations === void 0 ? void 0 : currentInstallations.body) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.currentAppInstallation) === null || _c === void 0 ? void 0 : _c.activeSubscriptions;
|
|
51
|
-
const matchingSubscription = display_1.ensureArray(subscriptions).find((node) => (((node === null || node === void 0 ? void 0 : node.name) === this.paymentConfig.name)
|
|
52
|
-
&& (!display_1.isTrue(node === null || node === void 0 ? void 0 : node.test) || this.paymentConfig.test)
|
|
53
|
-
// ORIG && (isTrue(chargeTest) === this.paymentConfig.test)
|
|
54
|
-
));
|
|
55
|
-
return display_1.objectNotEmpty(matchingSubscription);
|
|
56
|
-
}
|
|
57
|
-
async hasActiveOneTimePayment(endCursor = null) {
|
|
58
|
-
var _a, _b, _c, _d, _e;
|
|
59
|
-
const currentInstallations = await this.graphClient.query({
|
|
60
|
-
data: {
|
|
61
|
-
query: constants_1.ONE_TIME_PURCHASES_QUERY,
|
|
62
|
-
variables: { endCursor },
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
const purchases = (_c = (_b = (_a = currentInstallations === null || currentInstallations === void 0 ? void 0 : currentInstallations.body) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.currentAppInstallation) === null || _c === void 0 ? void 0 : _c.oneTimePurchases;
|
|
66
|
-
const matchingPurchase = display_1.ensureArray(purchases === null || purchases === void 0 ? void 0 : purchases.edges).find(({ node } = {}) => {
|
|
67
|
-
if (((node === null || node === void 0 ? void 0 : node.name) === this.paymentConfig.name) && ((node === null || node === void 0 ? void 0 : node.status) === 'ACTIVE')) {
|
|
68
|
-
console.log(`>>> ~ node`, {
|
|
69
|
-
node,
|
|
70
|
-
truish: (!display_1.isTrue(node === null || node === void 0 ? void 0 : node.test) || this.paymentConfig.test),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return (((node === null || node === void 0 ? void 0 : node.name) === this.paymentConfig.name)
|
|
74
|
-
&& ((node === null || node === void 0 ? void 0 : node.status) === 'ACTIVE')
|
|
75
|
-
&& (!display_1.isTrue(node === null || node === void 0 ? void 0 : node.test) || this.paymentConfig.test)
|
|
76
|
-
// ORIG && (isTrue(node?.test) === this.paymentConfig.test)
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
if (display_1.objectNotEmpty(matchingPurchase)) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
if ((_d = purchases === null || purchases === void 0 ? void 0 : purchases.pageInfo) === null || _d === void 0 ? void 0 : _d.hasNextPage) {
|
|
83
|
-
return this.hasActiveOneTimePayment((_e = purchases === null || purchases === void 0 ? void 0 : purchases.pageInfo) === null || _e === void 0 ? void 0 : _e.endCursor);
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
async hasActivePayment() {
|
|
88
|
-
if (this.isRecurring) {
|
|
89
|
-
return this.hasActiveRecurringPayment();
|
|
90
|
-
}
|
|
91
|
-
return this.hasActiveOneTimePayment();
|
|
92
18
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const data = this.isRecurring
|
|
101
|
-
? await this.requestRecurringPayment(returnUrl)
|
|
102
|
-
: await this.requestSinglePayment(returnUrl);
|
|
103
|
-
if (display_1.arrayNotEmpty(data === null || data === void 0 ? void 0 : data.userErrors)) {
|
|
104
|
-
throw new shopify_api_1.BillingError({
|
|
105
|
-
message: 'User error requesting payment',
|
|
106
|
-
});
|
|
19
|
+
try {
|
|
20
|
+
if (display_1.isTrue(await shopify.billing.check({
|
|
21
|
+
plans: [paymentConfig.name],
|
|
22
|
+
isTest: display_1.isTrue(paymentConfig.test),
|
|
23
|
+
session,
|
|
24
|
+
}))) {
|
|
25
|
+
return undefined;
|
|
107
26
|
}
|
|
108
|
-
return
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const { price, name, test, } = this.paymentConfig;
|
|
113
|
-
const mutationResponse = await this.graphClient.query({
|
|
114
|
-
data: {
|
|
115
|
-
query: constants_1.ONE_TIME_PURCHASE_MUTATION,
|
|
116
|
-
variables: {
|
|
117
|
-
test,
|
|
118
|
-
name,
|
|
119
|
-
price,
|
|
120
|
-
returnUrl,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
27
|
+
return shopify.billing.request({
|
|
28
|
+
plan: paymentConfig.name,
|
|
29
|
+
isTest: display_1.isTrue(paymentConfig.test),
|
|
30
|
+
session,
|
|
123
31
|
});
|
|
124
|
-
if (((_a = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _a === void 0 ? void 0 : _a.errors) && display_1.arrayNotEmpty((_b = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _b === void 0 ? void 0 : _b.errors)) {
|
|
125
|
-
throw new shopify_api_1.BillingError({
|
|
126
|
-
message: 'Error executing one-time purchase',
|
|
127
|
-
errorData: display_1.ensureArray(mutationResponse.body.errors).map(({ message }) => display_1.ensureString(message)).join('. '),
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return (_d = (_c = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.appPurchaseOneTimeCreate;
|
|
131
32
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const mutationResponse = await this.graphClient.query({
|
|
136
|
-
data: {
|
|
137
|
-
query: constants_1.RECURRING_PURCHASE_MUTATION,
|
|
138
|
-
variables: {
|
|
139
|
-
test,
|
|
140
|
-
name,
|
|
141
|
-
returnUrl,
|
|
142
|
-
lineItems: [{
|
|
143
|
-
plan: {
|
|
144
|
-
appRecurringPricingDetails: {
|
|
145
|
-
interval,
|
|
146
|
-
price,
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
}],
|
|
150
|
-
},
|
|
151
|
-
},
|
|
33
|
+
catch (error) {
|
|
34
|
+
throw new shopify_api_1.BillingError({
|
|
35
|
+
message: 'Failed to verify or initialize payment',
|
|
152
36
|
});
|
|
153
|
-
if (((_a = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _a === void 0 ? void 0 : _a.errors) && display_1.arrayNotEmpty((_b = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _b === void 0 ? void 0 : _b.errors)) {
|
|
154
|
-
throw new shopify_api_1.BillingError({
|
|
155
|
-
message: 'Error executing recurring purchase',
|
|
156
|
-
errorData: display_1.ensureArray(mutationResponse.body.errors).map(({ message }) => display_1.ensureString(message)).join('. '),
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return (_d = (_c = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.appSubscriptionCreate;
|
|
160
37
|
}
|
|
161
|
-
}
|
|
162
|
-
exports.
|
|
163
|
-
// TODO enable billing management
|
|
38
|
+
};
|
|
39
|
+
exports.ensureBilling = ensureBilling;
|
|
164
40
|
// eslint-disable-next-line arrow-body-style
|
|
165
|
-
const generatePaymentConfig = () => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
price,
|
|
171
|
-
currency = 'USD',
|
|
172
|
-
type = BILLING_INTERVALS.ONE_TIME,
|
|
173
|
-
} = ensureObject(paymentConfig)
|
|
174
|
-
const { debugMode, environment } = ensureObject(data)
|
|
175
|
-
|
|
176
|
-
if (objectEmpty(paymentConfig) || stringEmpty(environment)) {
|
|
177
|
-
return undefined
|
|
41
|
+
const generatePaymentConfig = (data) => {
|
|
42
|
+
const { debugMode, environment, paymentConfig, SHOPIFY_RUN_MODE, } = display_1.ensureObject(data);
|
|
43
|
+
const { name, price, currency = 'USD', type = constants_1.BILLING_INTERVALS.ONE_TIME, } = display_1.ensureObject(paymentConfig);
|
|
44
|
+
if (display_1.objectEmpty(paymentConfig) || display_1.stringEmpty(environment)) {
|
|
45
|
+
return undefined;
|
|
178
46
|
}
|
|
179
|
-
|
|
180
|
-
const notProduction =
|
|
181
|
-
|
|
182
|
-
// TODO ensure this logic is correct
|
|
183
|
-
let test = environment !== 'production'
|
|
184
|
-
if (debugMode) {
|
|
185
|
-
test = true
|
|
186
|
-
}
|
|
187
|
-
|
|
47
|
+
const isProduction = (environment === 'production');
|
|
48
|
+
const notProduction = !isProduction;
|
|
49
|
+
const billingName = `${name}${notProduction ? ` - ${environment}` : ''} - ${display_1.unsnakecase(type)}`;
|
|
188
50
|
const _paymentConfig = {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
51
|
+
required: (isProduction || (SHOPIFY_RUN_MODE === 'cli')),
|
|
52
|
+
test: (notProduction || debugMode),
|
|
53
|
+
name: billingName,
|
|
54
|
+
config: {
|
|
55
|
+
interval: type,
|
|
56
|
+
amount: price,
|
|
57
|
+
currencyCode: currency,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
// TODO: clean this up
|
|
199
61
|
console.log(`>>> ~ _paymentConfig`, {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
62
|
+
_paymentConfig,
|
|
63
|
+
SHOPIFY_RUN_MODE,
|
|
64
|
+
notProduction,
|
|
65
|
+
debugMode,
|
|
66
|
+
debugEnv: process.env.DEBUG,
|
|
67
|
+
});
|
|
68
|
+
return _paymentConfig;
|
|
207
69
|
};
|
|
208
70
|
exports.generatePaymentConfig = generatePaymentConfig;
|
|
209
71
|
//# sourceMappingURL=billing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/utils/billing.js"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/utils/billing.js"],"names":[],"mappings":";;;AAAA,sDAAmD;AAEnD,uCAQkB;AAClB,2CAA+C;AAE/C,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,CAAC,CAClD,wBAAc,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC;IAC7B,wBAAc,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAC;IACpC,wBAAc,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,CAAC;IACnC,wBAAc,CAAC,aAAa,aAAb,aAAa,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GAAG,sBAAY,CAAC,aAAa,CAAC,CAAA;IAE/B,IAAI,qBAAW,CAAC,aAAa,CAAC,IAAI,qBAAW,CAAC,WAAW,CAAC,EAAE;QAC1D,OAAO,SAAS,CAAA;KACjB;IAED,MAAM,YAAY,GAAG,CAAC,WAAW,KAAK,YAAY,CAAC,CAAA;IACnD,MAAM,aAAa,GAAG,CAAC,YAAY,CAAA;IACnC,MAAM,WAAW,GAAG,GAAG,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,qBAAW,CAAC,IAAI,CAAC,EAAE,CAAA;IAE/F,MAAM,cAAc,GAAG;QACrB,QAAQ,EAAE,CAAC,YAAY,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAAC;QACxD,IAAI,EAAE,CAAC,aAAa,IAAI,SAAS,CAAC;QAClC,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE;YACN,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,QAAQ;SACvB;KACF,CAAA;IACD,sBAAsB;IACtB,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE;QAClC,cAAc;QACd,gBAAgB;QAChB,aAAa;QACb,SAAS;QACT,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK;KAC5B,CAAC,CAAA;IAEF,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA;AA1CY,QAAA,qBAAqB,yBA0CjC"}
|
|
@@ -8,14 +8,13 @@ export namespace API_ROUTE_NAMES {
|
|
|
8
8
|
const AUTH_CALLBACK: string;
|
|
9
9
|
const APP_UNINSTALLED: string;
|
|
10
10
|
}
|
|
11
|
+
export namespace API_WEBHOOK_TOPICS {
|
|
12
|
+
const APP_UNINSTALLED_1: string;
|
|
13
|
+
export { APP_UNINSTALLED_1 as APP_UNINSTALLED };
|
|
14
|
+
}
|
|
11
15
|
export namespace BILLING_INTERVALS {
|
|
12
16
|
const ONE_TIME: string;
|
|
13
17
|
const EVERY_30_DAYS: string;
|
|
14
18
|
const ANNUAL: string;
|
|
15
19
|
}
|
|
16
|
-
export const RECURRING_INTERVALS: string[];
|
|
17
20
|
export const SHOP_QUERY: "\n {\n shop {\n name\n }\n }\n";
|
|
18
|
-
export const RECURRING_PURCHASES_QUERY: "\n query appSubscription {\n currentAppInstallation {\n activeSubscriptions {\n name, test\n }\n }\n }\n";
|
|
19
|
-
export const ONE_TIME_PURCHASES_QUERY: "\n query appPurchases($endCursor: String) {\n currentAppInstallation {\n oneTimePurchases(first: 250, sortKey: CREATED_AT, after: $endCursor) {\n edges {\n node {\n name, test, status\n }\n }\n pageInfo {\n hasNextPage, endCursor\n }\n }\n }\n }\n";
|
|
20
|
-
export const RECURRING_PURCHASE_MUTATION: "\n mutation test(\n $name: String!\n $lineItems: [AppSubscriptionLineItemInput!]!\n $returnUrl: URL!\n $test: Boolean\n ) {\n appSubscriptionCreate(\n name: $name\n lineItems: $lineItems\n returnUrl: $returnUrl\n test: $test\n ) {\n confirmationUrl\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
21
|
-
export const ONE_TIME_PURCHASE_MUTATION: "\n mutation test(\n $name: String!\n $price: MoneyInput!\n $returnUrl: URL!\n $test: Boolean\n ) {\n appPurchaseOneTimeCreate(\n name: $name\n price: $price\n returnUrl: $returnUrl\n test: $test\n ) {\n confirmationUrl\n userErrors {\n field\n message\n }\n }\n }\n";
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SHOP_QUERY = exports.BILLING_INTERVALS = exports.API_WEBHOOK_TOPICS = exports.API_ROUTE_NAMES = exports.PAGE_ROUTE_NAMES = exports.COLLECTION_ROOT = void 0;
|
|
4
4
|
exports.COLLECTION_ROOT = 'oauth-data';
|
|
5
5
|
exports.PAGE_ROUTE_NAMES = {
|
|
6
6
|
EXIT: 'pageRouteExit',
|
|
@@ -11,15 +11,14 @@ exports.API_ROUTE_NAMES = {
|
|
|
11
11
|
AUTH_CALLBACK: 'apiRouteAuthCallback',
|
|
12
12
|
APP_UNINSTALLED: 'apiRouteAppUninstalled',
|
|
13
13
|
};
|
|
14
|
+
exports.API_WEBHOOK_TOPICS = {
|
|
15
|
+
APP_UNINSTALLED: 'APP_UNINSTALLED',
|
|
16
|
+
};
|
|
14
17
|
exports.BILLING_INTERVALS = {
|
|
15
18
|
ONE_TIME: 'ONE_TIME',
|
|
16
19
|
EVERY_30_DAYS: 'EVERY_30_DAYS',
|
|
17
20
|
ANNUAL: 'ANNUAL',
|
|
18
21
|
};
|
|
19
|
-
exports.RECURRING_INTERVALS = [
|
|
20
|
-
exports.BILLING_INTERVALS.EVERY_30_DAYS,
|
|
21
|
-
exports.BILLING_INTERVALS.ANNUAL
|
|
22
|
-
];
|
|
23
22
|
// TODO can we remove?
|
|
24
23
|
/*
|
|
25
24
|
export const SHOP_DATA_QUERY = `
|
|
@@ -66,71 +65,4 @@ exports.SHOP_QUERY = `
|
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
`;
|
|
69
|
-
exports.RECURRING_PURCHASES_QUERY = `
|
|
70
|
-
query appSubscription {
|
|
71
|
-
currentAppInstallation {
|
|
72
|
-
activeSubscriptions {
|
|
73
|
-
name, test
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
78
|
-
exports.ONE_TIME_PURCHASES_QUERY = `
|
|
79
|
-
query appPurchases($endCursor: String) {
|
|
80
|
-
currentAppInstallation {
|
|
81
|
-
oneTimePurchases(first: 250, sortKey: CREATED_AT, after: $endCursor) {
|
|
82
|
-
edges {
|
|
83
|
-
node {
|
|
84
|
-
name, test, status
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
pageInfo {
|
|
88
|
-
hasNextPage, endCursor
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
`;
|
|
94
|
-
exports.RECURRING_PURCHASE_MUTATION = `
|
|
95
|
-
mutation test(
|
|
96
|
-
$name: String!
|
|
97
|
-
$lineItems: [AppSubscriptionLineItemInput!]!
|
|
98
|
-
$returnUrl: URL!
|
|
99
|
-
$test: Boolean
|
|
100
|
-
) {
|
|
101
|
-
appSubscriptionCreate(
|
|
102
|
-
name: $name
|
|
103
|
-
lineItems: $lineItems
|
|
104
|
-
returnUrl: $returnUrl
|
|
105
|
-
test: $test
|
|
106
|
-
) {
|
|
107
|
-
confirmationUrl
|
|
108
|
-
userErrors {
|
|
109
|
-
field
|
|
110
|
-
message
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
`;
|
|
115
|
-
exports.ONE_TIME_PURCHASE_MUTATION = `
|
|
116
|
-
mutation test(
|
|
117
|
-
$name: String!
|
|
118
|
-
$price: MoneyInput!
|
|
119
|
-
$returnUrl: URL!
|
|
120
|
-
$test: Boolean
|
|
121
|
-
) {
|
|
122
|
-
appPurchaseOneTimeCreate(
|
|
123
|
-
name: $name
|
|
124
|
-
price: $price
|
|
125
|
-
returnUrl: $returnUrl
|
|
126
|
-
test: $test
|
|
127
|
-
) {
|
|
128
|
-
confirmationUrl
|
|
129
|
-
userErrors {
|
|
130
|
-
field
|
|
131
|
-
message
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
`;
|
|
136
68
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.js"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,YAAY,CAAA;AAE9B,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,gBAAgB;CACxB,CAAA;AAEY,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,cAAc;IACpB,aAAa,EAAE,sBAAsB;IACrC,eAAe,EAAE,wBAAwB;CAC1C,CAAA;AAEY,QAAA,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;CACjB,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.js"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,YAAY,CAAA;AAE9B,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,gBAAgB;CACxB,CAAA;AAEY,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,cAAc;IACpB,aAAa,EAAE,sBAAsB;IACrC,eAAe,EAAE,wBAAwB;CAC1C,CAAA;AAEY,QAAA,kBAAkB,GAAG;IAChC,eAAe,EAAE,iBAAiB;CACnC,CAAA;AAEY,QAAA,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;CACjB,CAAA;AAED,sBAAsB;AACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCE;AAEW,QAAA,UAAU,GAAG;;;;;;CAMzB,CAAA"}
|
package/dist/utils/display.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function getGUID(): any;
|
|
2
2
|
export function getInteger(): any;
|
|
3
3
|
export function querystringToObject(queryString: any): {
|
|
4
|
-
[k: string]:
|
|
4
|
+
[k: string]: string;
|
|
5
5
|
};
|
|
6
6
|
export function isType(value: any, type: any): boolean;
|
|
7
7
|
export function ensureObject(object: any): any;
|
package/dist/utils/firebase.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
export class FirebaseSessionHandler {
|
|
2
|
-
static getInstance(firebaseConfig: any, collection
|
|
3
|
-
|
|
2
|
+
static getInstance(firebaseConfig: any, { collection, config }: {
|
|
3
|
+
collection: any;
|
|
4
|
+
config: any;
|
|
5
|
+
}): any;
|
|
6
|
+
constructor(enforcer: any, { config, collection }: {
|
|
7
|
+
config: any;
|
|
8
|
+
collection?: string;
|
|
9
|
+
});
|
|
4
10
|
type: string;
|
|
11
|
+
config: any;
|
|
5
12
|
collection: string;
|
|
6
13
|
get isInitialized(): boolean;
|
|
7
14
|
initializeFireStore(firebaseConfig: any): void;
|
|
8
15
|
firestore: any;
|
|
9
16
|
[singleton]: FirebaseSessionHandler;
|
|
10
17
|
}
|
|
11
|
-
export function storeCallback(
|
|
12
|
-
export function loadCallback(
|
|
13
|
-
export function deleteSessionsCallback(
|
|
14
|
-
export function findSessionsByShop(
|
|
18
|
+
export function storeCallback(instance: any, session: any): Promise<boolean>;
|
|
19
|
+
export function loadCallback(instance: any, sessionId: any): Promise<any>;
|
|
20
|
+
export function deleteSessionsCallback(instance: any, sessionIds: any): Promise<void>;
|
|
21
|
+
export function findSessionsByShop(instance: any, shop: any): Promise<any[]>;
|
|
15
22
|
declare const singleton: unique symbol;
|
|
16
23
|
export {};
|
package/dist/utils/firebase.js
CHANGED
|
@@ -21,11 +21,12 @@ const constants_1 = require("./constants");
|
|
|
21
21
|
const singleton = Symbol('singleton');
|
|
22
22
|
const singletonEnforcer = Symbol('singletonEnforcer');
|
|
23
23
|
class FirebaseSessionHandler {
|
|
24
|
-
constructor(enforcer, collection = constants_1.COLLECTION_ROOT) {
|
|
24
|
+
constructor(enforcer, { config, collection = constants_1.COLLECTION_ROOT }) {
|
|
25
25
|
this.type = 'FirebaseSessionHandler';
|
|
26
26
|
if (enforcer !== singletonEnforcer) {
|
|
27
27
|
throw new Error('Cannot instantiate FirebaseSessionHandler directly, please use getInstance()');
|
|
28
28
|
}
|
|
29
|
+
this.config = config;
|
|
29
30
|
this.collection = collection;
|
|
30
31
|
}
|
|
31
32
|
get isInitialized() {
|
|
@@ -41,9 +42,9 @@ class FirebaseSessionHandler {
|
|
|
41
42
|
this.firestore = project.firestore();
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
static getInstance(firebaseConfig, collection) {
|
|
45
|
+
static getInstance(firebaseConfig, { collection, config }) {
|
|
45
46
|
if (!this[singleton]) {
|
|
46
|
-
this[singleton] = new FirebaseSessionHandler(singletonEnforcer, collection);
|
|
47
|
+
this[singleton] = new FirebaseSessionHandler(singletonEnforcer, { collection, config });
|
|
47
48
|
}
|
|
48
49
|
if (!this[singleton].isInitialized) {
|
|
49
50
|
this[singleton].initializeFireStore(firebaseConfig);
|
|
@@ -52,12 +53,12 @@ class FirebaseSessionHandler {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
exports.FirebaseSessionHandler = FirebaseSessionHandler;
|
|
55
|
-
const storeCallback = async (
|
|
56
|
+
const storeCallback = async (instance, session) => {
|
|
56
57
|
try {
|
|
57
58
|
const docRef = instance.firestore
|
|
58
59
|
.collection(instance.collection)
|
|
59
|
-
.doc(
|
|
60
|
-
.collection(
|
|
60
|
+
.doc(instance.config.shop)
|
|
61
|
+
.collection(instance.config.configurationId)
|
|
61
62
|
.doc(session.id);
|
|
62
63
|
const _a = JSON.parse(JSON.stringify(session)), { onlineAccessInfo: _onlineAccessInfo } = _a, docData = __rest(_a, ["onlineAccessInfo"]);
|
|
63
64
|
// NOTE: destructuring out associated_user for DPA compliance
|
|
@@ -67,18 +68,18 @@ const storeCallback = async (session, data, instance) => {
|
|
|
67
68
|
await docRef.set(payload);
|
|
68
69
|
return true;
|
|
69
70
|
}
|
|
70
|
-
catch (
|
|
71
|
-
console.error('FirebaseSessionHandler.storeCallback error',
|
|
72
|
-
throw
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.error('FirebaseSessionHandler.storeCallback error', error);
|
|
73
|
+
throw error;
|
|
73
74
|
}
|
|
74
75
|
};
|
|
75
76
|
exports.storeCallback = storeCallback;
|
|
76
|
-
const loadCallback = async (
|
|
77
|
+
const loadCallback = async (instance, sessionId) => {
|
|
77
78
|
try {
|
|
78
79
|
const docRef = instance.firestore
|
|
79
80
|
.collection(instance.collection)
|
|
80
|
-
.doc(
|
|
81
|
-
.collection(
|
|
81
|
+
.doc(instance.config.shop)
|
|
82
|
+
.collection(instance.config.configurationId)
|
|
82
83
|
.doc(sessionId);
|
|
83
84
|
const document = await docRef.get();
|
|
84
85
|
if (document.exists) {
|
|
@@ -86,56 +87,51 @@ const loadCallback = async (sessionId, data, instance) => {
|
|
|
86
87
|
}
|
|
87
88
|
return undefined;
|
|
88
89
|
}
|
|
89
|
-
catch (
|
|
90
|
-
console.error('FirebaseSessionHandler.loadCallback error',
|
|
91
|
-
throw
|
|
90
|
+
catch (error) {
|
|
91
|
+
console.error('FirebaseSessionHandler.loadCallback error', error);
|
|
92
|
+
throw error;
|
|
92
93
|
}
|
|
93
94
|
};
|
|
94
95
|
exports.loadCallback = loadCallback;
|
|
95
|
-
const deleteSessionsCallback = async (
|
|
96
|
+
const deleteSessionsCallback = async (instance, sessionIds) => {
|
|
97
|
+
const collectionRef = instance.firestore
|
|
98
|
+
.collection(instance.collection)
|
|
99
|
+
.doc(instance.config.shop)
|
|
100
|
+
.collection(instance.config.configurationId);
|
|
96
101
|
const _deleteSessionCallback = async (_sessionId) => {
|
|
97
102
|
try {
|
|
98
|
-
const docRef =
|
|
99
|
-
.collection(instance.collection)
|
|
100
|
-
.doc(data.shop)
|
|
101
|
-
.collection(data.app)
|
|
102
|
-
.doc(_sessionId);
|
|
103
|
+
const docRef = collectionRef.doc(_sessionId);
|
|
103
104
|
await docRef.delete();
|
|
104
105
|
return true;
|
|
105
106
|
}
|
|
106
|
-
catch (
|
|
107
|
-
console.error('FirebaseSessionHandler.deleteSessionsCallback error',
|
|
108
|
-
throw
|
|
107
|
+
catch (error) {
|
|
108
|
+
console.error('FirebaseSessionHandler.deleteSessionsCallback error', error);
|
|
109
|
+
throw error;
|
|
109
110
|
}
|
|
110
111
|
};
|
|
111
112
|
await Promise.all(display_1.ensureArray(sessionIds).map((sessionId) => _deleteSessionCallback(sessionId)));
|
|
112
113
|
};
|
|
113
114
|
exports.deleteSessionsCallback = deleteSessionsCallback;
|
|
114
|
-
const findSessionsByShop = async (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (display_1.stringEmpty(shop)) {
|
|
115
|
+
const findSessionsByShop = async (instance, shop) => {
|
|
116
|
+
if (display_1.stringEmpty(shop) || (shop !== instance.config.shop)) {
|
|
117
|
+
console.warn('FirebaseSessionHandler.findSessionsByShop warn', shop);
|
|
118
118
|
return [];
|
|
119
119
|
}
|
|
120
120
|
try {
|
|
121
|
-
|
|
122
|
-
const collectionRef = instance.firestore
|
|
121
|
+
const collection = await instance.firestore
|
|
123
122
|
.collection(instance.collection)
|
|
124
123
|
.doc(shop)
|
|
125
|
-
.collection(
|
|
126
|
-
|
|
127
|
-
const querySnapshot = await collectionRef.get();
|
|
128
|
-
console.log('querySnapshot:', querySnapshot);
|
|
124
|
+
.collection(instance.config.configurationId)
|
|
125
|
+
.get();
|
|
129
126
|
const sessions = [];
|
|
130
|
-
|
|
127
|
+
collection.forEach((_doc) => {
|
|
131
128
|
sessions.push(_doc.data());
|
|
132
129
|
});
|
|
133
|
-
console.log('sessions:', sessions);
|
|
134
130
|
return sessions;
|
|
135
131
|
}
|
|
136
|
-
catch (
|
|
137
|
-
console.error('FirebaseSessionHandler.findSessionsByShop error',
|
|
138
|
-
throw
|
|
132
|
+
catch (error) {
|
|
133
|
+
console.error('FirebaseSessionHandler.findSessionsByShop error', error);
|
|
134
|
+
throw error;
|
|
139
135
|
}
|
|
140
136
|
};
|
|
141
137
|
exports.findSessionsByShop = findSessionsByShop;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../../src/utils/firebase.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oEAAkC;AAElC,uCAIkB;AAClB,2CAA6C;AAE7C,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AACrC,MAAM,iBAAiB,GAAG,M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AAkB,sBAuB9B"}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -17,5 +17,4 @@ __exportStar(require("./errors"), exports);
|
|
|
17
17
|
__exportStar(require("./firebase"), exports);
|
|
18
18
|
__exportStar(require("./session"), exports);
|
|
19
19
|
__exportStar(require("./shopify"), exports);
|
|
20
|
-
__exportStar(require("./webhooks"), exports);
|
|
21
20
|
//# sourceMappingURL=index.js.map
|