@segment/action-destinations 3.194.0-staging.0 → 3.194.0-staging.2

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.
Files changed (59) hide show
  1. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +8 -21
  2. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -1
  3. package/dist/destinations/engage/twilio/sendMobilePush/PushSender.d.ts +1 -0
  4. package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js +10 -3
  5. package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js.map +1 -1
  6. package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.js +3 -3
  7. package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.js.map +1 -1
  8. package/dist/destinations/example/generated-types.d.ts +2 -0
  9. package/dist/destinations/example/generated-types.js +3 -0
  10. package/dist/destinations/example/generated-types.js.map +1 -0
  11. package/dist/destinations/gameball/generated-types.d.ts +4 -0
  12. package/dist/destinations/gameball/generated-types.js +3 -0
  13. package/dist/destinations/gameball/generated-types.js.map +1 -0
  14. package/dist/destinations/gameball/identifyPlayer/generated-types.d.ts +39 -0
  15. package/dist/destinations/gameball/identifyPlayer/generated-types.js +3 -0
  16. package/dist/destinations/gameball/identifyPlayer/generated-types.js.map +1 -0
  17. package/dist/destinations/gameball/identifyPlayer/index.d.ts +5 -0
  18. package/dist/destinations/gameball/identifyPlayer/index.js +309 -0
  19. package/dist/destinations/gameball/identifyPlayer/index.js.map +1 -0
  20. package/dist/destinations/gameball/index.d.ts +4 -0
  21. package/dist/destinations/gameball/index.js +69 -0
  22. package/dist/destinations/gameball/index.js.map +1 -0
  23. package/dist/destinations/gameball/trackEvent/generated-types.d.ts +9 -0
  24. package/dist/destinations/gameball/trackEvent/generated-types.js +3 -0
  25. package/dist/destinations/gameball/trackEvent/generated-types.js.map +1 -0
  26. package/dist/destinations/gameball/trackEvent/index.d.ts +5 -0
  27. package/dist/destinations/gameball/trackEvent/index.js +45 -0
  28. package/dist/destinations/gameball/trackEvent/index.js.map +1 -0
  29. package/dist/destinations/gameball/trackOrder/generated-types.d.ts +37 -0
  30. package/dist/destinations/gameball/trackOrder/generated-types.js +3 -0
  31. package/dist/destinations/gameball/trackOrder/generated-types.js.map +1 -0
  32. package/dist/destinations/gameball/trackOrder/index.d.ts +5 -0
  33. package/dist/destinations/gameball/trackOrder/index.js +281 -0
  34. package/dist/destinations/gameball/trackOrder/index.js.map +1 -0
  35. package/dist/destinations/gameball/util.d.ts +13 -0
  36. package/dist/destinations/gameball/util.js +66 -0
  37. package/dist/destinations/gameball/util.js.map +1 -0
  38. package/dist/destinations/hubspot/upsertContact/index.d.ts +19 -0
  39. package/dist/destinations/hubspot/upsertContact/index.js +119 -0
  40. package/dist/destinations/hubspot/upsertContact/index.js.map +1 -1
  41. package/dist/destinations/insider/insider-helpers.d.ts +4 -0
  42. package/dist/destinations/insider/insider-helpers.js +3 -1
  43. package/dist/destinations/insider/insider-helpers.js.map +1 -1
  44. package/dist/destinations/insider/updateUserProfile/generated-types.d.ts +4 -0
  45. package/dist/destinations/insider/updateUserProfile/index.js +17 -6
  46. package/dist/destinations/insider/updateUserProfile/index.js.map +1 -1
  47. package/dist/destinations/linkedin-audiences/api/index.js +2 -2
  48. package/dist/destinations/linkedin-audiences/api/index.js.map +1 -1
  49. package/dist/destinations/linkedin-audiences/constants.d.ts +1 -1
  50. package/dist/destinations/linkedin-audiences/constants.js +1 -1
  51. package/dist/destinations/linkedin-audiences/updateAudience/generated-types.d.ts +1 -0
  52. package/dist/destinations/linkedin-audiences/updateAudience/index.js +23 -3
  53. package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
  54. package/dist/destinations/pinterest-conversions/pinterest-capi-custom-data.js +7 -2
  55. package/dist/destinations/pinterest-conversions/pinterest-capi-custom-data.js.map +1 -1
  56. package/dist/destinations/pinterest-conversions/reportConversionEvent/generated-types.d.ts +1 -0
  57. package/dist/destinations/salesforce/sf-utils.js +3 -1
  58. package/dist/destinations/salesforce/sf-utils.js.map +1 -1
  59. package/package.json +3 -3
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const actions_core_1 = require("@segment/actions-core");
7
+ const trackEvent_1 = __importDefault(require("./trackEvent"));
8
+ const util_1 = require("./util");
9
+ const identifyPlayer_1 = __importDefault(require("./identifyPlayer"));
10
+ const trackOrder_1 = __importDefault(require("./trackOrder"));
11
+ const destination = {
12
+ name: 'gameball',
13
+ slug: 'actions-gameball',
14
+ mode: 'cloud',
15
+ authentication: {
16
+ scheme: 'custom',
17
+ fields: {
18
+ apiKey: {
19
+ label: 'API Key',
20
+ description: 'Go to [help center](https://help.gameball.co/en/articles/3467114-get-your-account-integration-details-api-key-and-transaction-key) to learn how to find your API Key.',
21
+ type: 'password',
22
+ required: true
23
+ },
24
+ secretKey: {
25
+ label: 'Secret Key',
26
+ description: 'Go to [help center](https://help.gameball.co/en/articles/3467114-get-your-account-integration-details-api-key-and-transaction-key) to learn how to find your API Key.',
27
+ type: 'password',
28
+ required: true
29
+ }
30
+ },
31
+ testAuthentication: (request, { settings }) => {
32
+ const endpoint = `${util_1.endpoints.baseAuthUrl}${util_1.endpoints.testAuthentication}`;
33
+ return util_1.sendRequest(request, endpoint, settings, {
34
+ apiKey: settings.apiKey,
35
+ secretKey: settings.secretKey
36
+ });
37
+ }
38
+ },
39
+ presets: [
40
+ {
41
+ name: 'Track Events',
42
+ subscribe: 'type = "track" and event != "Order Completed"',
43
+ partnerAction: 'trackEvent',
44
+ mapping: actions_core_1.defaultValues(trackEvent_1.default.fields),
45
+ type: 'automatic'
46
+ },
47
+ {
48
+ name: 'Track Orders',
49
+ subscribe: 'type = "track" and event = "Order Completed"',
50
+ partnerAction: 'trackOrder',
51
+ mapping: actions_core_1.defaultValues(trackOrder_1.default.fields),
52
+ type: 'automatic'
53
+ },
54
+ {
55
+ name: 'Create Or Update Players',
56
+ subscribe: 'type = "identify"',
57
+ partnerAction: 'identifyPlayer',
58
+ mapping: actions_core_1.defaultValues(identifyPlayer_1.default.fields),
59
+ type: 'automatic'
60
+ }
61
+ ],
62
+ actions: {
63
+ trackEvent: trackEvent_1.default,
64
+ identifyPlayer: identifyPlayer_1.default,
65
+ trackOrder: trackOrder_1.default
66
+ }
67
+ };
68
+ exports.default = destination;
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/gameball/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAG5E,8DAAqC;AACrC,iCAA+C;AAE/C,sEAA6C;AAE7C,8DAAqC;AAErC,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,KAAK,EAAE,SAAS;gBAChB,WAAW,EACT,uKAAuK;gBACzK,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,YAAY;gBACnB,WAAW,EACT,uKAAuK;gBACzK,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;SACF;QAED,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5C,MAAM,QAAQ,GAAG,GAAG,gBAAS,CAAC,WAAW,GAAG,gBAAS,CAAC,kBAAkB,EAAE,CAAA;YAC1E,OAAO,kBAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE;gBAC9C,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,SAAS,EAAE,QAAQ,CAAC,SAAS;aAC9B,CAAC,CAAA;QACJ,CAAC;KACF;IAED,OAAO,EAAE;QACP;YACE,IAAI,EAAE,cAAc;YACpB,SAAS,EAAE,+CAA+C;YAC1D,aAAa,EAAE,YAAY;YAC3B,OAAO,EAAE,4BAAa,CAAC,oBAAU,CAAC,MAAM,CAAC;YACzC,IAAI,EAAE,WAAW;SAClB;QACD;YACE,IAAI,EAAE,cAAc;YACpB,SAAS,EAAE,8CAA8C;YACzD,aAAa,EAAE,YAAY;YAC3B,OAAO,EAAE,4BAAa,CAAC,oBAAU,CAAC,MAAM,CAAC;YACzC,IAAI,EAAE,WAAW;SAClB;QACD;YACE,IAAI,EAAE,0BAA0B;YAChC,SAAS,EAAE,mBAAmB;YAC9B,aAAa,EAAE,gBAAgB;YAC/B,OAAO,EAAE,4BAAa,CAAC,wBAAc,CAAC,MAAM,CAAC;YAC7C,IAAI,EAAE,WAAW;SAClB;KACF;IAED,OAAO,EAAE;QACP,UAAU,EAAV,oBAAU;QACV,cAAc,EAAd,wBAAc;QACd,UAAU,EAAV,oBAAU;KACX;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,9 @@
1
+ export interface Payload {
2
+ name: string;
3
+ metadata?: {
4
+ [k: string]: unknown;
5
+ };
6
+ playerUniqueId: string;
7
+ mobile?: string;
8
+ email?: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/gameball/trackEvent/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const util_1 = require("../util");
4
+ const mapPayload = (payload) => {
5
+ delete payload.metadata?.mobile;
6
+ return {
7
+ events: {
8
+ [payload.name.trim()]: payload.metadata
9
+ },
10
+ playerUniqueId: payload.playerUniqueId.toLowerCase(),
11
+ mobile: payload.mobile?.toLowerCase(),
12
+ email: payload.email?.toLowerCase()
13
+ };
14
+ };
15
+ const action = {
16
+ title: 'Track Event',
17
+ description: `This action allows you to track and send your players' events to Gameball.`,
18
+ defaultSubscription: 'type = "track"',
19
+ fields: {
20
+ name: {
21
+ label: 'Event Name',
22
+ description: 'The name of the event',
23
+ type: 'string',
24
+ required: true,
25
+ default: {
26
+ '@path': '$.event'
27
+ }
28
+ },
29
+ metadata: {
30
+ label: 'Event Metadata',
31
+ description: 'The event metadata to send to Gameball',
32
+ type: 'object',
33
+ default: {
34
+ '@path': '$.properties'
35
+ }
36
+ },
37
+ ...util_1.playerProperties
38
+ },
39
+ perform: async (request, { payload, settings }) => {
40
+ const endpoint = `${util_1.endpoints.baseApiUrl}${util_1.endpoints.trackEvent}`;
41
+ return await util_1.sendRequest(request, endpoint, settings, mapPayload(payload));
42
+ }
43
+ };
44
+ exports.default = action;
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/gameball/trackEvent/index.ts"],"names":[],"mappings":";;AAEA,kCAAkE;AAGlE,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,EAAE;IACtC,OAAO,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAA;IAC/B,OAAO;QACL,MAAM,EAAE;YACN,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,QAAQ;SACxC;QACD,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE;QACpD,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE;QACrC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE;KACpC,CAAA;AACH,CAAC,CAAA;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,4EAA4E;IACzF,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,uBAAuB;YACpC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;QACD,GAAG,uBAAgB;KACpB;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG,GAAG,gBAAS,CAAC,UAAU,GAAG,gBAAS,CAAC,UAAU,EAAE,CAAA;QACjE,OAAO,MAAM,kBAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5E,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,37 @@
1
+ export interface Payload {
2
+ playerUniqueId: string;
3
+ mobile?: string;
4
+ email?: string;
5
+ orderId: string;
6
+ orderDate: string | number;
7
+ totalPrice: number;
8
+ totalPaid: number;
9
+ totalShipping?: number;
10
+ totalTax?: number;
11
+ totalDiscount?: number;
12
+ lineItems?: {
13
+ productId?: string;
14
+ sku?: string;
15
+ title?: string;
16
+ category?: string[];
17
+ collection?: string[];
18
+ tags?: string[];
19
+ weight?: number;
20
+ vendor?: string;
21
+ quantity?: number;
22
+ price: number;
23
+ taxes: number;
24
+ discount: number;
25
+ }[];
26
+ discountCodes?: string[];
27
+ redeemedAmount?: number;
28
+ holdReference?: string;
29
+ guest?: boolean;
30
+ extra?: {
31
+ [k: string]: unknown;
32
+ };
33
+ merchantId?: string;
34
+ merchantName?: string;
35
+ branchId?: string;
36
+ branchName?: string;
37
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/gameball/trackOrder/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const util_1 = require("../util");
4
+ const mapPayload = (payload) => {
5
+ const object = { ...payload };
6
+ delete object.branch;
7
+ if (payload.merchantId && payload.merchantName) {
8
+ object.merchant = {
9
+ uniqueId: payload.merchantId,
10
+ name: payload.merchantName
11
+ };
12
+ if (payload.branchId && payload.branchName) {
13
+ object.merchant.branch = {
14
+ uniqueId: payload.branchId,
15
+ name: payload.branchName
16
+ };
17
+ }
18
+ }
19
+ return object;
20
+ };
21
+ const action = {
22
+ title: 'Track Order',
23
+ description: 'This action used to track orders. They are designed specifically for E-Commerce Solutions.',
24
+ defaultSubscription: 'event = "Order Completed"',
25
+ fields: {
26
+ ...util_1.playerProperties,
27
+ orderId: {
28
+ label: 'Order Id',
29
+ description: 'Unique order ID which identifies the underlying order in your system, e.g. order number, invoice number. It will be used for reversing any reward or redemption transaction on Gameball.',
30
+ type: 'string',
31
+ required: true,
32
+ default: {
33
+ '@path': '$.properties.order_id'
34
+ }
35
+ },
36
+ orderDate: {
37
+ label: 'Order Date',
38
+ description: 'The date this order was placed, as an ISO8601 timestamp. Defaults to now if not provided.',
39
+ type: 'datetime',
40
+ required: true,
41
+ default: {
42
+ '@path': '$.timestamp'
43
+ }
44
+ },
45
+ totalPrice: {
46
+ label: 'Total Price',
47
+ description: `The sum of all order items' prices, including discounts, shipping, taxes, and tips. (Note: totalPaid is part of the totalPrice). Must be positive.`,
48
+ required: true,
49
+ type: 'number',
50
+ default: {
51
+ '@path': '$.properties.total'
52
+ }
53
+ },
54
+ totalPaid: {
55
+ label: 'Total Paid',
56
+ description: 'The actual paid amount to the store. (Based on this amount, the player will be rewarded. Also, According to the Cashback Configuration). Must be positive.',
57
+ type: 'number',
58
+ required: true,
59
+ default: {
60
+ '@path': '$.properties.subtotal'
61
+ }
62
+ },
63
+ totalShipping: {
64
+ label: 'Total Shipping',
65
+ description: 'The total shipping price of the order. Must be positive.',
66
+ type: 'number',
67
+ default: {
68
+ '@path': '$.properties.shipping'
69
+ }
70
+ },
71
+ totalTax: {
72
+ label: 'Total Tax',
73
+ description: 'The sum of all the taxes applied to the order in the shop currency. Must be positive.',
74
+ type: 'number',
75
+ default: {
76
+ '@path': '$.properties.tax'
77
+ }
78
+ },
79
+ totalDiscount: {
80
+ label: 'Total Discount',
81
+ description: 'Total discount applied on this order. Must be positive.',
82
+ type: 'number',
83
+ default: {
84
+ '@path': '$.properties.discount'
85
+ }
86
+ },
87
+ lineItems: {
88
+ label: 'Line Items',
89
+ description: 'A list of line items, each containing information about an item in the order.',
90
+ type: 'object',
91
+ multiple: true,
92
+ properties: {
93
+ productId: {
94
+ label: 'Product Id',
95
+ type: 'string',
96
+ description: 'The ID of the product that the line item belongs to'
97
+ },
98
+ sku: {
99
+ label: 'SKU',
100
+ type: 'string',
101
+ description: `The item's SKU (stock keeping unit).`
102
+ },
103
+ title: {
104
+ label: 'Title',
105
+ type: 'string',
106
+ description: 'The title of the product.'
107
+ },
108
+ category: {
109
+ label: 'Category',
110
+ type: 'string',
111
+ multiple: true,
112
+ description: 'Product category (fashion, electronics.. etc). It can be one category or multiple categories.'
113
+ },
114
+ collection: {
115
+ label: 'Collection',
116
+ type: 'string',
117
+ multiple: true,
118
+ description: 'Collection ID(s) to which the product belongs. It can be one collection or multiple collections. This will be also based on the available collections in your store.'
119
+ },
120
+ tags: {
121
+ label: 'Tags',
122
+ type: 'string',
123
+ multiple: true,
124
+ description: 'Tag(s) attached to the item in the order.'
125
+ },
126
+ weight: {
127
+ label: 'Weight',
128
+ type: 'number',
129
+ description: 'Item weight. Must be positive.'
130
+ },
131
+ vendor: {
132
+ label: 'Vendor',
133
+ type: 'string',
134
+ description: `The name of the item's supplier.`
135
+ },
136
+ quantity: {
137
+ label: 'Quantity',
138
+ type: 'number',
139
+ description: 'Number of items purchased of this line item. Must be positive.'
140
+ },
141
+ price: {
142
+ label: 'Price',
143
+ type: 'number',
144
+ required: true,
145
+ description: 'The original price of the product before adding tax or discount. Note that: it should reflect the price of a single product ignoring quantity'
146
+ },
147
+ taxes: {
148
+ label: 'Taxes',
149
+ type: 'number',
150
+ required: true,
151
+ description: 'The sum of all the taxes applied to the line item in the shop currency. Must be positive. Note that: It should reflect total taxes for line item considering quantity'
152
+ },
153
+ discount: {
154
+ label: 'Discount',
155
+ type: 'number',
156
+ required: true,
157
+ description: 'Total discount applied on this line item. Must be positive. Note that: This value should reflect total discounts for line item considering quantity'
158
+ }
159
+ },
160
+ default: {
161
+ '@arrayPath': [
162
+ '$.properties.products',
163
+ {
164
+ productId: {
165
+ '@path': 'product_id'
166
+ },
167
+ sku: {
168
+ '@path': 'sku'
169
+ },
170
+ title: {
171
+ '@path': 'title'
172
+ },
173
+ category: {
174
+ '@path': 'category'
175
+ },
176
+ collection: {
177
+ '@path': 'collection'
178
+ },
179
+ tags: {
180
+ '@path': 'tags'
181
+ },
182
+ weight: {
183
+ '@path': 'weight'
184
+ },
185
+ vendor: {
186
+ '@path': 'vendor'
187
+ },
188
+ quantity: {
189
+ '@path': 'quantity'
190
+ },
191
+ price: {
192
+ '@path': 'price'
193
+ },
194
+ taxes: {
195
+ '@path': 'taxes'
196
+ },
197
+ discount: {
198
+ '@path': 'discount'
199
+ }
200
+ }
201
+ ]
202
+ }
203
+ },
204
+ discountCodes: {
205
+ label: 'Discount Codes',
206
+ description: 'An array of discount codes.',
207
+ type: 'string',
208
+ multiple: true,
209
+ default: {
210
+ '@path': '$.properties.coupon'
211
+ }
212
+ },
213
+ redeemedAmount: {
214
+ label: 'Redeemed Amount',
215
+ description: 'Monetary value of the redeemed points to be used by that player while placing his order. Note: If this field is set, then the holdReference value should be null. Also, both fields could be null.',
216
+ type: 'number',
217
+ default: {
218
+ '@path': '$.properties.redeemedAmount'
219
+ }
220
+ },
221
+ holdReference: {
222
+ label: 'Hold Reference',
223
+ description: 'Hold reference ID received after calling Hold Points API. This is used in case you want to use already held points. Note: If this field is set, then the redeemedAmount value should be null. Also, both fields could be null.',
224
+ type: 'string',
225
+ default: {
226
+ '@path': '$.properties.holdReference'
227
+ }
228
+ },
229
+ guest: {
230
+ label: 'Guest',
231
+ description: 'A boolean value indicating if the customer who placed this order is a guest. The default is false.',
232
+ type: 'boolean',
233
+ default: {
234
+ '@if': {
235
+ exists: { '@path': '$.properties.is_guest' },
236
+ then: { '@path': '$.properties.is_guest' },
237
+ else: false
238
+ }
239
+ }
240
+ },
241
+ extra: {
242
+ label: 'Extra',
243
+ description: 'Key value pair(s) of any extra information about the order. The key values must be of type string or number',
244
+ type: 'object',
245
+ additionalProperties: true,
246
+ default: {
247
+ '@path': '$.properties.extra'
248
+ }
249
+ },
250
+ merchantId: {
251
+ label: 'Merchant Id',
252
+ type: 'string',
253
+ description: 'Merchant unique id or code',
254
+ default: { '@path': '$.properties.merchantId' }
255
+ },
256
+ merchantName: {
257
+ label: 'Merchant Name',
258
+ type: 'string',
259
+ description: 'Merchant name',
260
+ default: { '@path': '$.properties.merchantName' }
261
+ },
262
+ branchId: {
263
+ label: 'Branch Id',
264
+ type: 'string',
265
+ description: 'Branch unique id or code',
266
+ default: { '@path': '$.properties.branchId' }
267
+ },
268
+ branchName: {
269
+ label: 'Branch Name',
270
+ type: 'string',
271
+ description: 'Branch name',
272
+ default: { '@path': '$.properties.branchName' }
273
+ }
274
+ },
275
+ perform: (request, { payload, settings }) => {
276
+ const endpoint = `${util_1.endpoints.baseApiUrl}${util_1.endpoints.trackOrder}`;
277
+ return util_1.sendRequest(request, endpoint, settings, mapPayload(payload), true);
278
+ }
279
+ };
280
+ exports.default = action;
281
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/gameball/trackOrder/index.ts"],"names":[],"mappings":";;AAEA,kCAAkE;AAGlE,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,EAAE;IACtC,MAAM,MAAM,GAAG,EAAE,GAAG,OAAO,EAAS,CAAA;IACpC,OAAO,MAAM,CAAC,MAAM,CAAA;IACpB,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE;QAC9C,MAAM,CAAC,QAAQ,GAAG;YAChB,QAAQ,EAAE,OAAO,CAAC,UAAU;YAC5B,IAAI,EAAE,OAAO,CAAC,YAAY;SAC3B,CAAA;QAED,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,UAAU,EAAE;YAC1C,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG;gBACvB,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,IAAI,EAAE,OAAO,CAAC,UAAU;aACzB,CAAA;SACF;KACF;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,4FAA4F;IACzG,mBAAmB,EAAE,2BAA2B;IAChD,MAAM,EAAE;QACN,GAAG,uBAAgB;QACnB,OAAO,EAAE;YACP,KAAK,EAAE,UAAU;YACjB,WAAW,EACT,0LAA0L;YAC5L,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO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AO,CAAC,EAAE,IAAI,CAAC,CAAA;IAC5E,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { RequestClient } from '@segment/actions-core/create-request-client';
2
+ import { InputField } from '@segment/actions-core/index';
3
+ import type { Settings } from './generated-types';
4
+ export declare const endpoints: {
5
+ baseApiUrl: string;
6
+ baseAuthUrl: string;
7
+ testAuthentication: string;
8
+ trackEvent: string;
9
+ trackOrder: string;
10
+ identifyPlayer: string;
11
+ };
12
+ export declare const playerProperties: Record<string, InputField>;
13
+ export declare const sendRequest: (request: RequestClient, path: string, settings: Settings, body: any, addSecretey?: boolean) => Promise<import("@segment/actions-core/create-request-client").ModifiedResponse<unknown>>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendRequest = exports.playerProperties = exports.endpoints = void 0;
4
+ exports.endpoints = {
5
+ baseApiUrl: 'https://api.gameball.co',
6
+ baseAuthUrl: 'https://auth.gameball.co',
7
+ testAuthentication: '/api/v1.0/protected/TestAuthentication',
8
+ trackEvent: '/api/v3.0/integrations/event',
9
+ trackOrder: '/api/v3.0/integrations/order',
10
+ identifyPlayer: '/api/v3.0/integrations/player'
11
+ };
12
+ exports.playerProperties = {
13
+ playerUniqueId: {
14
+ label: 'Player ID',
15
+ description: 'Unique identifier for the player in your database.',
16
+ type: 'string',
17
+ required: true,
18
+ default: {
19
+ '@if': {
20
+ exists: { '@path': '$.userId' },
21
+ then: { '@path': '$.userId' },
22
+ else: { '@path': '$.anonymousId' }
23
+ }
24
+ }
25
+ },
26
+ mobile: {
27
+ label: 'Mobile Number',
28
+ description: `Player's unique mobile number.`,
29
+ type: 'string',
30
+ default: {
31
+ '@if': {
32
+ exists: { '@path': '$.properties.mobile' },
33
+ then: { '@path': '$.properties.mobile' },
34
+ else: { '@path': '$.traits.mobile' }
35
+ }
36
+ }
37
+ },
38
+ email: {
39
+ label: 'Email',
40
+ description: `Player's unique email.`,
41
+ type: 'string',
42
+ default: {
43
+ '@if': {
44
+ exists: { '@path': '$.properties.email' },
45
+ then: { '@path': '$.properties.email' },
46
+ else: { '@path': '$.traits.email' }
47
+ }
48
+ }
49
+ }
50
+ };
51
+ const sendRequest = (request, path, settings, body, addSecretey = false) => {
52
+ const requestOptions = {};
53
+ requestOptions.json = requestOptions.json || body;
54
+ requestOptions.headers = requestOptions.headers || {};
55
+ requestOptions.headers['APIKey'] = settings.apiKey;
56
+ requestOptions.headers['Content-Type'] = 'application/json';
57
+ requestOptions.headers['x-gb-agent'] = 'GB/Zapier';
58
+ requestOptions.throwHttpErrors = false;
59
+ requestOptions.method = requestOptions.method || 'POST';
60
+ if (addSecretey && settings.secretKey) {
61
+ requestOptions.headers['SecretKey'] = settings.secretKey;
62
+ }
63
+ return request(path, requestOptions);
64
+ };
65
+ exports.sendRequest = sendRequest;
66
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/destinations/gameball/util.ts"],"names":[],"mappings":";;;AAKa,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,yBAAyB;IACrC,WAAW,EAAE,0BAA0B;IACvC,kBAAkB,EAAE,wCAAwC;IAC5D,UAAU,EAAE,8BAA8B;IAC1C,UAAU,EAAE,8BAA8B;IAC1C,cAAc,EAAE,+BAA+B;CAChD,CAAA;AAEY,QAAA,gBAAgB,GAA+B;IAC1D,cAAc,EAAE;QACd,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;gBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;gBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;aACnC;SACF;KACF;IACD,MAAM,EAAE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,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAA;KACzD;IACD,OAAO,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAAA;AACtC,CAAC,CAAA;AAnBY,QAAA,WAAW,eAmBvB"}
@@ -1,5 +1,24 @@
1
1
  import { ActionDefinition } from '@segment/actions-core';
2
2
  import type { Settings } from '../generated-types';
3
3
  import type { Payload } from './generated-types';
4
+ interface ContactSuccessResponse {
5
+ id: string;
6
+ properties: Record<string, string>;
7
+ }
8
+ interface ContactErrorResponse {
9
+ status: string;
10
+ category: string;
11
+ message: string;
12
+ context: {
13
+ ids: string[];
14
+ [key: string]: unknown;
15
+ };
16
+ }
17
+ export interface ContactBatchResponse {
18
+ status: string;
19
+ results: ContactSuccessResponse[];
20
+ numErrors?: number;
21
+ errors?: ContactErrorResponse[];
22
+ }
4
23
  declare const action: ActionDefinition<Settings, Payload>;
5
24
  export default action;