UNPKG

@eastsideco/escshopify

Version:

WIP JS library for Shopify, containing a variety of useful functionality.

1,410 lines (1,409 loc) 121 kB
{ "type": "File", "start": 0, "end": 612, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 33, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 612, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 33, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 24, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 24 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 11, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 11 } }, "local": { "type": "Identifier", "start": 7, "end": 11, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 11 }, "identifierName": "Evee" }, "name": "Evee" } } ], "source": { "type": "StringLiteral", "start": 17, "end": 23, "loc": { "start": { "line": 1, "column": 17 }, "end": { "line": 1, "column": 23 } }, "extra": { "rawValue": "evee", "raw": "'evee'" }, "value": "evee" } }, { "type": "ImportDeclaration", "start": 25, "end": 49, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 24 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 32, "end": 35, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 10 } }, "local": { "type": "Identifier", "start": 32, "end": 35, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 10 }, "identifierName": "API" }, "name": "API" } } ], "source": { "type": "StringLiteral", "start": 41, "end": 48, "loc": { "start": { "line": 2, "column": 16 }, "end": { "line": 2, "column": 23 } }, "extra": { "rawValue": "./API", "raw": "'./API'" }, "value": "./API" } }, { "type": "ExportDefaultDeclaration", "start": 51, "end": 611, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 32, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 66, "end": 611, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 32, "column": 1 } }, "id": { "type": "Identifier", "start": 72, "end": 82, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 31 }, "identifierName": "GeoService" }, "name": "GeoService" }, "superClass": { "type": "Identifier", "start": 91, "end": 95, "loc": { "start": { "line": 4, "column": 40 }, "end": { "line": 4, "column": 44 }, "identifierName": "Evee" }, "name": "Evee" }, "body": { "type": "ClassBody", "start": 96, "end": 611, "loc": { "start": { "line": 4, "column": 45 }, "end": { "line": 32, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 102, "end": 247, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 11, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 102, "end": 113, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 15 }, "identifierName": "constructor" }, "name": "constructor" }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 116, "end": 247, "loc": { "start": { "line": 5, "column": 18 }, "end": { "line": 11, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 126, "end": 134, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 16 } }, "expression": { "type": "CallExpression", "start": 126, "end": 133, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 15 } }, "callee": { "type": "Super", "start": 126, "end": 131, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 13 } } }, "arguments": [] } }, { "type": "ExpressionStatement", "start": 152, "end": 173, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 152, "end": 172, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 152, "end": 160, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 16 } }, "object": { "type": "ThisExpression", "start": 152, "end": 156, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 12 } } }, "property": { "type": "Identifier", "start": 157, "end": 160, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 16 }, "identifierName": "api" }, "name": "api" }, "computed": false }, "right": { "type": "NewExpression", "start": 163, "end": 172, "loc": { "start": { "line": 8, "column": 19 }, "end": { "line": 8, "column": 28 } }, "callee": { "type": "Identifier", "start": 167, "end": 170, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 26 }, "identifierName": "API" }, "name": "API" }, "arguments": [] } } }, { "type": "ExpressionStatement", "start": 182, "end": 207, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 182, "end": 206, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 182, "end": 199, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 25 } }, "object": { "type": "ThisExpression", "start": 182, "end": 186, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 12 } } }, "property": { "type": "Identifier", "start": 187, "end": 199, "loc": { "start": { "line": 9, "column": 13 }, "end": { "line": 9, "column": 25 }, "identifierName": "cacheLookups" }, "name": "cacheLookups" }, "computed": false }, "right": { "type": "BooleanLiteral", "start": 202, "end": 206, "loc": { "start": { "line": 9, "column": 28 }, "end": { "line": 9, "column": 32 } }, "value": true } } }, { "type": "ExpressionStatement", "start": 216, "end": 241, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 216, "end": 240, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 216, "end": 235, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 27 } }, "object": { "type": "ThisExpression", "start": 216, "end": 220, "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 12 } } }, "property": { "type": "Identifier", "start": 221, "end": 235, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 27 }, "identifierName": "_cachedLookups" }, "name": "_cachedLookups" }, "computed": false }, "right": { "type": "ObjectExpression", "start": 238, "end": 240, "loc": { "start": { "line": 10, "column": 30 }, "end": { "line": 10, "column": 32 } }, "properties": [] } } } ], "directives": [] } }, { "type": "ClassMethod", "start": 253, "end": 605, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 27, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 259, "end": 268, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 19 }, "identifierName": "lookupGeo" }, "name": "lookupGeo" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": true, "params": [ { "type": "Identifier", "start": 269, "end": 271, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 22 }, "identifierName": "ip" }, "name": "ip" } ], "body": { "type": "BlockStatement", "start": 273, "end": 605, "loc": { "start": { "line": 13, "column": 24 }, "end": { "line": 27, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 283, "end": 324, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 16, "column": 9 } }, "test": { "type": "UnaryExpression", "start": 287, "end": 290, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 15 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 288, "end": 290, "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 15 }, "identifierName": "ip" }, "name": "ip" }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 292, "end": 324, "loc": { "start": { "line": 14, "column": 17 }, "end": { "line": 16, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 306, "end": 314, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 20 } }, "expression": { "type": "AssignmentExpression", "start": 306, "end": 313, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 19 } }, "operator": "=", "left": { "type": "Identifier", "start": 306, "end": 308, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 14 }, "identifierName": "ip" }, "name": "ip" }, "right": { "type": "StringLiteral", "start": 311, "end": 313, "loc": { "start": { "line": 15, "column": 17 }, "end": { "line": 15, "column": 19 } }, "extra": { "rawValue": "", "raw": "''" }, "value": "" } } } ], "directives": [] }, "alternate": null }, { "type": "IfStatement", "start": 334, "end": 439, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 20, "column": 9 } }, "test": { "type": "LogicalExpression", "start": 338, "end": 382, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 56 } }, "left": { "type": "MemberExpression", "start": 338, "end": 355, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 29 } }, "object": { "type": "ThisExpression", "start": 338, "end": 342, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 16 } } }, "property": { "type": "Identifier", "start": 343, "end": 355, "loc": { "start": { "line": 18, "column": 17 }, "end": { "line": 18, "column": 29 }, "identifierName": "cacheLookups" }, "name": "cacheLookups" }, "computed": false }, "operator": "&&", "right": { "type": "MemberExpression", "start": 359, "end": 382, "loc": { "start": { "line": 18, "column": 33 }, "end": { "line": 18, "column": 56 } }, "object": { "type": "MemberExpression", "start": 359, "end": 378, "loc": { "start": { "line": 18, "column": 33 }, "end": { "line": 18, "column": 52 } }, "object": { "type": "ThisExpression", "start": 359, "end": 363, "loc": { "start": { "line": 18, "column": 33 }, "end": { "line": 18, "column": 37 } } }, "property": { "type": "Identifier", "start": 364, "end": 378, "loc": { "start": { "line": 18, "column": 38 }, "end": { "line": 18, "column": 52 }, "identifierName": "_cachedLookups" }, "name": "_cachedLookups" }, "computed": false }, "property": { "type": "Identifier", "start": 379, "end": 381, "loc": { "start": { "line": 18, "column": 53 }, "end": { "line": 18, "column": 55 }, "identifierName": "ip" }, "name": "ip" }, "computed": true } }, "consequent": { "type": "BlockStatement", "start": 384, "end": 439, "loc": { "start": { "line": 18, "column": 58 }, "end": { "line": 20, "column": 9 } }, "body": [ { "type": "ReturnStatement", "start": 398, "end": 429, "loc": { "start": { "line": 19, "column": 12 }, "end": { "line": 19, "column": 43 } }, "argument": { "type": "MemberExpression", "start": 405, "end": 428, "loc": { "start": { "line": 19, "column": 19 }, "end": { "line": 19, "column": 42 } }, "object": { "type": "MemberExpression", "start": 405, "end": 424, "loc": { "start": { "line": 19, "column": 19 }, "end": { "line": 19, "column": 38 } }, "object": { "type": "ThisExpression", "start": 405, "end": 409, "loc": { "start": { "line": 19, "column": 19 }, "end": { "line": 19, "column": 23 } } }, "property": { "type": "Identifier", "start": 410, "end": 424, "loc": { "start": { "line": 19, "column": 24 }, "end": { "line": 19, "column": 38 }, "identifierName": "_cachedLookups" }, "name": "_cachedLookups" }, "computed": false }, "property": { "type": "Identifier", "start": 425, "end": 427, "loc": { "start": { "line": 19, "column": 39 }, "end": { "line": 19, "column": 41 }, "identifierName": "ip" }, "name": "ip" }, "computed": true } } ], "directives": [] }, "alternate": null }, { "type": "VariableDeclaration", "start": 449, "end": 487, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 46 } }, "declarations": [ { "type": "VariableDeclarator", "start": 453, "end": 486, "loc": { "start": { "line": 22, "column": 12 }, "end": { "line": 22, "column": 45 } }, "id": { "type": "Identifier", "start": 453, "end": 459, "loc": { "start": { "line": 22, "column": 12 }, "end": { "line": 22, "column": 18 }, "identifierName": "result" }, "name": "result" }, "init": { "type": "AwaitExpression", "start": 462, "end": 486, "loc": { "start": { "line": 22, "column": 21 }, "end": { "line": 22, "column": 45 } }, "argument": { "type": "CallExpression", "start": 468, "end": 486, "loc": { "start": { "line": 22, "column": 27 }, "end": { "line": 22, "column": 45 } }, "callee": { "type": "MemberExpression", "start": 468, "end": 482, "loc": { "start": { "line": 22, "column": 27 }, "end": { "line": 22, "column": 41 } }, "object": { "type": "MemberExpression", "start": 468, "end": 476, "loc": { "start": { "line": 22, "column": 27 }, "end": { "line": 22, "column": 35 } }, "object": { "type": "ThisExpression", "start": 468, "end": 472, "loc": { "start": { "line": 22, "column": 27 }, "end": { "line": 22, "column": 31 } } }, "property": { "type": "Identifier", "start": 473, "end": 476, "loc": { "start": { "line": 22, "column": 32 }, "end": { "line": 22, "column": 35 }, "identifierName": "api" }, "name": "api" }, "computed": false }, "property": { "type": "Identifier", "start": 477, "end": 482, "loc": { "start": { "line": 22, "column": 36 }, "end": { "line": 22, "column": 41 }, "identifierName": "geoip" }, "name": "geoip" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 483, "end": 485, "loc": { "start": { "line": 22, "column": 42 }, "end": { "line": 22, "column": 44 }, "identifierName": "ip" }, "name": "ip" } ] } } } ], "kind": "var" }, { "type": "IfStatement", "start": 496, "end": 576, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 25, "column": 9 } }, "test": { "type": "MemberExpression", "start": 500, "end": 517, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 29 } }, "object": { "type": "ThisExpression", "start": 500, "end": 504, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 16 } } }, "property": { "type": "Identifier", "start": 505, "end": 517, "loc": { "start": { "line": 23, "column": 17 }, "end": { "line": 23, "column": 29 }, "identifierName": "cacheLookups" }, "name": "cacheLookups" }, "computed": false }, "consequent": { "type": "BlockStatement", "start": 519, "end": 576, "loc": { "start": { "line": 23, "column": 31 }, "end": { "line": 25, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 533, "end": 566, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 45 } }, "expression": {